kwest87

Untitled

Dec 30th, 2023
785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp19
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             const int CommandKnock = 1;
  10.             const int CommandSeriesKnock = 2;
  11.             const int CommandTreatment = 3;
  12.             const int CommandUndercut = 4;
  13.  
  14.             int bossHealth = 1000;
  15.             int golemHealth = 1000;
  16.             int bossDamage = 100;
  17.             int golemDamage = 50;
  18.             int golemTreatment = 200;
  19.             int clay = 2;
  20.             int userInput;
  21.             bool itSeriesKnocks = false;
  22.             bool isWork = true;
  23.  
  24.             Console.WriteLine($"На выбор прёмы голема : \n {CommandKnock})Обычный удар (50 урона)." +
  25.                 $"\n {CommandSeriesKnock})Серия ударов (делает 3 обычных удара но след. ход отдыхает)." +
  26.                 $"\n {CommandTreatment})Замазать раны глиной (восстановить 200 жизней , 2 куска глины)." +
  27.                 $"\n {CommandUndercut})Подсечка (обезвредить противника в этом ходу и 50 урона).");
  28.  
  29.             while (isWork)
  30.             {
  31.                 if (itSeriesKnocks)
  32.                 {
  33.                     Console.WriteLine("Отдыхаете после серии ударов .");
  34.                     itSeriesKnocks = false;
  35.                     golemHealth -= bossDamage;
  36.                     Console.ReadKey();
  37.                 }
  38.                 else
  39.                 {
  40.                     Console.WriteLine($"  Жизни босса - {bossHealth}\n  Жизни голема - {golemHealth}");
  41.                     Console.Write("Выберите действие : ");
  42.                     userInput = Convert.ToInt32(Console.ReadLine());
  43.  
  44.                     switch (userInput)
  45.                     {
  46.                         case CommandKnock:
  47.                             bossHealth -= golemDamage;
  48.                             golemHealth -= bossDamage;
  49.                             break;
  50.  
  51.                         case CommandSeriesKnock:
  52.                             bossHealth -= golemDamage + golemDamage + golemDamage;
  53.                             golemHealth -= bossDamage;
  54.                             itSeriesKnocks = true;
  55.                             break;
  56.  
  57.                         case CommandTreatment:
  58.                             golemHealth -= bossDamage;
  59.  
  60.                             if (clay > 0)
  61.                             {
  62.                                 clay--;
  63.                                 golemHealth += golemTreatment;
  64.                             }
  65.                             break;
  66.  
  67.                         case CommandUndercut:
  68.                             bossHealth -= golemDamage;
  69.                             break;
  70.                     }
  71.  
  72.                     if (bossHealth <= 0 || golemHealth <= 0)
  73.                     {
  74.                         isWork = false;
  75.                     }
  76.                 }
  77.             }
  78.  
  79.             if (bossHealth > 0)
  80.             {
  81.                 Console.WriteLine("Голем повержен.");
  82.             }
  83.             else if (golemHealth > 0)
  84.             {
  85.                 Console.WriteLine("Босс повержен."); ;
  86.             }
  87.             else
  88.             {
  89.                 Console.WriteLine("Ничья.");
  90.             }
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment