AlexRaynor

3.8 Armory

Sep 11th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp16
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.  
  15.             string[] weaponName = { " Винтовка Гаусса", " BFG", " Нож" };
  16.             int[] weaponAttackPower = { 100, 150, 10 };
  17.             int[] weaponShootingSpeed = { 10, 4, 0 };
  18.             string equippedWeapon = "";
  19.             bool isInventoryFull = false;
  20.  
  21.  
  22.             while (true)
  23.             {
  24.                 Console.WriteLine();
  25.                 Console.WriteLine("Введите команду: \n1. Вывод статистики оружия \n2. Экипировать оружие \n3. Добавить оружие ");
  26.  
  27.                 int userComandNumberInput = Convert.ToInt32(Console.ReadLine());
  28.                 switch (userComandNumberInput)
  29.                 {
  30.                     case 1:
  31.  
  32.                         Console.WriteLine("Статистику какого оружия вы хотите узнать?");
  33.  
  34.                         for (int i = 0; i < weaponName.Length; i++)
  35.                         {
  36.                             Console.WriteLine((i + 1) + "."+ weaponName[i]);
  37.                         }
  38.  
  39.  
  40.                         userComandNumberInput = Convert.ToInt32(Console.ReadLine());
  41.                         switch (userComandNumberInput)
  42.                         {
  43.                             case 1:
  44.                                 Console.WriteLine("\nВинтовка Гаусса Урон: " + weaponAttackPower[0] + "\n Скорострельность: " + weaponShootingSpeed[0] + " выстрелов в минуту");
  45.                                 break;
  46.                             case 2:
  47.                                 Console.WriteLine("\n BFG Урон: " + weaponAttackPower[1] + "\n Скорострельность: " + weaponShootingSpeed[1] + " выстрела в минуту");
  48.                                 break;
  49.                             case 3:
  50.                                 Console.WriteLine("\n Нож Урон: " + weaponAttackPower[2] + "\n Скорострельность: " + weaponShootingSpeed[2] + " выстрелов в минуту");
  51.                                 break;
  52.                             default:
  53.                                 Console.WriteLine(weaponName[weaponName.Length - 1] + "\n Урон: "
  54.                                     + weaponAttackPower[weaponAttackPower.Length - 1]
  55.                                     + "\n Скорострельность: " + weaponShootingSpeed[weaponShootingSpeed.Length - 1]);
  56.                                 break;
  57.                         }
  58.                         break;
  59.                     case 2:
  60.                         Console.WriteLine("Какое оружие экипируем?");
  61.                         for (int i = 0; i < weaponName.Length; i++)
  62.                         {
  63.                             Console.WriteLine((i + 1) + "." + weaponName[i]);
  64.                         }
  65.                             userComandNumberInput = Convert.ToInt32(Console.ReadLine());
  66.                         switch (userComandNumberInput)
  67.                         {
  68.                             case 1:
  69.                                 equippedWeapon = weaponName[0];
  70.                                 break;
  71.                             case 2:
  72.                                 equippedWeapon = weaponName[1];
  73.                                 break;
  74.                             case 3:
  75.                                 equippedWeapon = weaponName[2];
  76.                                 break;
  77.                             default:
  78.                                 equippedWeapon = weaponName[weaponName.Length-1];
  79.                                 break;
  80.                         }
  81.                         Console.WriteLine("Сейчас у вас в руках: оружие номер " + equippedWeapon);
  82.                         break;
  83.  
  84.                     case 3:
  85.                         if (isInventoryFull == false)
  86.                         {
  87.                             Console.WriteLine("Введите название нового оружия");
  88.  
  89.                             string[] tempWeaponName = new string[weaponName.Length + 1];
  90.                             for (int i = 0; i < weaponName.Length; i++)
  91.                             {
  92.                                 tempWeaponName[i] = weaponName[i];
  93.                             }
  94.                             tempWeaponName[tempWeaponName.Length - 1] = " " + Console.ReadLine();
  95.  
  96.                             weaponName = tempWeaponName;
  97.  
  98.                             Console.WriteLine("Какой урон у оружия?");
  99.  
  100.                             int[] tempWeaponAttackPower = new int[weaponAttackPower.Length + 1];
  101.                             for (int i = 0; i < weaponAttackPower.Length; i++)
  102.                             {
  103.                                 tempWeaponAttackPower[i] = weaponAttackPower[i];
  104.                             }
  105.                             tempWeaponAttackPower[tempWeaponAttackPower.Length - 1] = Convert.ToInt32(Console.ReadLine());
  106.  
  107.                             weaponAttackPower = tempWeaponAttackPower;
  108.  
  109.                             Console.WriteLine("Какая скорострельность у оружия?");
  110.  
  111.                             int[] tempWeaponShootingSpeed = new int[weaponShootingSpeed.Length + 1];
  112.                             for (int i = 0; i < weaponShootingSpeed.Length; i++)
  113.                             {
  114.                                 tempWeaponShootingSpeed[i] = weaponShootingSpeed[i];
  115.                             }
  116.                             tempWeaponShootingSpeed[tempWeaponShootingSpeed.Length - 1] = Convert.ToInt32(Console.ReadLine());
  117.  
  118.                             weaponShootingSpeed = tempWeaponShootingSpeed;
  119.  
  120.  
  121.                             isInventoryFull = true;
  122.                         }
  123.                         else
  124.                         {
  125.                             Console.WriteLine("Ошибка! Инвентарь полон!");
  126.                         }
  127.  
  128.  
  129.                         break;
  130.  
  131.  
  132.                 }
  133.  
  134.  
  135.  
  136.             }
  137.         }
  138.     }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment