Advertisement
silvana1303

warrior's quest

Jul 27th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. using System.Text;
  5. using System.Linq;
  6.  
  7. namespace _01._Furniture
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string input = Console.ReadLine();
  14.  
  15.             var command = Console.ReadLine().Split().ToArray();
  16.  
  17.             while (command[0] != "For")
  18.             {
  19.                 if (command[0] == "GladiatorStance")
  20.                 {
  21.                     input = input.ToUpper();
  22.                     Console.WriteLine(input);
  23.                 }
  24.                 else if (command[0] == "DefensiveStance")
  25.                 {
  26.                     input = input.ToLower();
  27.                     Console.WriteLine(input);
  28.                 }
  29.                 else if (command[0] == "Dispel")
  30.                 {
  31.                     int index = int.Parse(command[1]);
  32.                     char[] chars = input.ToCharArray();
  33.  
  34.                     if (index >= 0 && index < chars.Length)
  35.                     {
  36.                         chars[index] = char.Parse(command[2]);
  37.                         input = new string(chars);
  38.                         Console.WriteLine("Success!");
  39.                     }
  40.                     else
  41.                     {
  42.                         Console.WriteLine("Dispel too weak.");
  43.                     }
  44.                    
  45.                 }
  46.                 else if (command[0] == "Target")
  47.                 {
  48.                     if (command[1] == "Change")
  49.                     {
  50.                         input = input.Replace(command[2], command[3]);
  51.                         Console.WriteLine(input);
  52.                     }
  53.                     if (command[1] == "Remove")
  54.                     {
  55.                         input = input.Replace(command[2], "");
  56.                         Console.WriteLine(input);
  57.                     }
  58.                 }
  59.                 else
  60.                 {
  61.                     Console.WriteLine("Command doesn't exist!");
  62.                 }
  63.  
  64.                 command = Console.ReadLine().Split().ToArray();
  65.             }
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement