W1thr

Spells

Jun 12th, 2021 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Spells
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int playerHealth = 400;
  10.             int playerDamage = 80;
  11.             int bossHealth = 650;
  12.             int bossDamage = 130;
  13.             bool higanzakuraAbilty = false;
  14.             string userInput;
  15.  
  16.             while(bossHealth > 0 && playerHealth > 0)
  17.             {
  18.                 Console.WriteLine($"Здоровье игрока:{playerHealth}");
  19.                 Console.WriteLine($"Здоровье босса:{bossHealth}\n");
  20.  
  21.                 Console.WriteLine($"Обычная атака({playerDamage} урона) - 1\n" +
  22.                                   $"Рашамон(-{playerDamage} хп, {playerDamage * 2} урона) - 2\n"+
  23.                                   $"Хуганзакура({playerDamage * 1.5f} урона, доступна после атаки \"Рашамон\") - 3\n" +
  24.                                   $"Межпространственный разлом(+{bossDamage * 2} хп, следущая атака босса не наносит урон) - 4\n");
  25.  
  26.                 userInput = Console.ReadLine();
  27.                 Console.Clear();
  28.  
  29.                 switch (userInput)
  30.                 {
  31.                     case "Обычная атака":
  32.                     default:
  33.                     case "1":
  34.                         bossHealth -= playerDamage;
  35.                         higanzakuraAbilty = false;
  36.                         break;
  37.                     case "Рашамон":
  38.                     case "2":
  39.                         playerHealth -= playerDamage;
  40.                         bossHealth -= playerDamage;
  41.                         higanzakuraAbilty = true;
  42.                         break;
  43.                     case "Хуганзакура":
  44.                     case "3":
  45.                         if (higanzakuraAbilty == true)
  46.                         {
  47.                             bossHealth -= (int)(playerDamage * 1.5f);
  48.                         }
  49.                         else
  50.                         {
  51.                             bossHealth -= playerDamage;
  52.                             Console.WriteLine("Для начала используйте атаку \"Рашамон\"");
  53.                         }
  54.  
  55.                         higanzakuraAbilty = false;
  56.                         break;
  57.                     case "":
  58.                     case "4":
  59.                         playerHealth += bossDamage * 2;
  60.                         playerHealth += bossDamage;
  61.                         break;
  62.                 }
  63.                 playerHealth -= bossDamage;
  64.  
  65.                 Console.Clear();
  66.             }
  67.  
  68.             if(playerHealth > bossHealth)
  69.                 Console.WriteLine("Игрок победил!");
  70.             else if (playerHealth < bossHealth)
  71.                 Console.WriteLine("Босс победил!");
  72.             else
  73.                 Console.WriteLine("Ничья!");
  74.  
  75.             Console.ReadKey();
  76.             Console.Clear();
  77.         }
  78.     }
  79. }
  80.  
Add Comment
Please, Sign In to add comment