voldmaks

Бой с боссом

Apr 7th, 2020 (edited)
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.65 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 Бой_с_боссом
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Добро пожаловать. Выберите желаемое действие цифрой");
  14.             Console.WriteLine("1)Слабый удар - не потребляет ману");
  15.             Console.WriteLine("2)Средний удар - потребляет 15 единиц маны");
  16.             Console.WriteLine("3)Ульта - сильная атака. Требуется поставить печать силы. Потребляет 50 единиц маны");
  17.             Console.WriteLine("4)Печать силы - сила удара повышается на 5 единиц. Открывает доступ к ульте. Потребляет 40 единиц маны");
  18.             Console.WriteLine("5)Зелье маны");
  19.             Console.WriteLine("6)Зелье лечения");
  20.            
  21.             string commands;
  22.             int healthPotion = 3;
  23.             int manaPotion = 3;
  24.             bool printPermission = true;
  25.             bool ultimateAbilityPermission = false;
  26.             bool increaseInImpactForce = false;
  27.  
  28.             Random rand = new Random();
  29.             int healthBoss = rand.Next(150, 201);
  30.             int healthMage = rand.Next(100, 151);
  31.             int damageBoss = rand.Next(20, 35);
  32.             int weakStrikeWizard = rand.Next(0, 10);
  33.             int middleStrikeWizard = rand.Next(0, 15);
  34.             int ultimateAbility = rand.Next(30, 50);
  35.             int treatment = rand.Next(30, 101);
  36.             int mana = rand.Next(100, 201);
  37.             int manaReplenishment = rand.Next(30, 101);
  38.  
  39.             Console.WriteLine("Здоровье мага = " + healthMage + "единиц");
  40.             Console.WriteLine("Мана мага = " + mana + "единиц");
  41.             Console.WriteLine("Здоровье босса =" + healthBoss + "единиц");
  42.             while (healthBoss > 0 && healthMage > 0)
  43.             {
  44.                 commands = Console.ReadLine();
  45.                 switch (commands)
  46.                 {
  47.                     case "1":
  48.                         if (increaseInImpactForce)
  49.                         {
  50.                             weakStrikeWizard += 5;
  51.                         }
  52.                         healthBoss -= weakStrikeWizard;
  53.                         break;
  54.                     case "2":
  55.                         if (increaseInImpactForce)
  56.                         {
  57.                             middleStrikeWizard += 5;
  58.                         }
  59.                         if (mana > 15)
  60.                         {
  61.                             healthBoss -= middleStrikeWizard;
  62.                             mana -= 15;
  63.                         }
  64.                         else
  65.                         {
  66.                             Console.WriteLine("Не хвататет маны");
  67.                         }
  68.                         break;
  69.                     case "3":
  70.  
  71.                         if (ultimateAbilityPermission && mana > 50)
  72.                         {
  73.                             healthBoss -= ultimateAbility;
  74.                             Console.WriteLine("Вы использовали ультимативный удар");
  75.                             mana -= 50;
  76.                         }
  77.                         else
  78.                         {
  79.                             Console.WriteLine("Не хватает маны, либо не поставлена печать силы");
  80.                         }
  81.                         break;
  82.                     case "4":
  83.                         if (printPermission && mana > 40)
  84.                         {
  85.                             Console.WriteLine("Вы поставили печать силы. Сила атаки увеличена на 5 единиц. Доступна ульта");
  86.                             printPermission = false;
  87.                             ultimateAbilityPermission = true;
  88.                             increaseInImpactForce = true;
  89.                             mana -= 40;
  90.                         }
  91.                         else
  92.                         {
  93.                             Console.WriteLine("Действие отменено. Печать силы уже поставлена");
  94.                         }
  95.                         break;
  96.                     case "5":
  97.                         if (manaPotion > 0)
  98.                         {
  99.                             Console.WriteLine("Вы пополнили ману на " + manaReplenishment + " единиц");
  100.                             mana += manaReplenishment;
  101.                             manaPotion -= 1;
  102.                             Console.WriteLine("Осталось " + manaPotion + " зелий маны");
  103.                         }
  104.                         else
  105.                         {
  106.                             Console.WriteLine("Действие отменено. Зелий маны больше не осталось");
  107.                         }
  108.                         break;
  109.                     case "6":
  110.                         if (healthPotion > 0)
  111.                         {
  112.                             Console.WriteLine("Вы подлечились на " + treatment + " единиц");
  113.                             healthMage += treatment;
  114.                             healthPotion -= 1;
  115.                             Console.WriteLine("Осталось " + healthPotion + " зелий здоровья");
  116.                         }
  117.                         else
  118.                         {
  119.                             Console.WriteLine("Действие отменено. Зелий здоровья больше не осталось");
  120.                         }
  121.                         break;
  122.                 }
  123.                 healthMage -= damageBoss;
  124.                 Console.WriteLine("Здоровье мага = " + healthMage);
  125.                 Console.WriteLine("Мана мага = " + mana + " единиц");
  126.                 Console.WriteLine("Здоровье босса = " + healthBoss);
  127.             }
  128.             if (healthBoss < 0 && healthMage < 0)
  129.             {
  130.                 Console.WriteLine("Оба погибли. Ничья");
  131.             }
  132.             else if (healthMage < 0)
  133.             {
  134.                 Console.WriteLine("Вы проиграли");
  135.             }
  136.             else if (healthBoss < 0)
  137.             {
  138.                 Console.WriteLine("Вы победили");
  139.             }
  140.         }
  141.     }
  142. }
Add Comment
Please, Sign In to add comment