Advertisement
Suslick

Magician

Jan 5th, 2023 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.82 KB | None | 0 0
  1.     class Program
  2.     {
  3.         enum Skills
  4.         {
  5.             HolyElixir = 1,
  6.             Friends,
  7.             SecretWeapon,
  8.             UnusuaHit
  9.         }
  10.  
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("МАГИЧЕСКИЙ УЛИЧНЫЙ КЛУБ\n" +
  14.                 "  ( 0_0)     (0_0 )\n" +
  15.                 "  ( ง )ง     ୧( ୧ )\n" +
  16.                 "  /   \\       /   \\\n");
  17.  
  18.  
  19.             Random random = new Random();
  20.             int maxhealth = 130;
  21.             int minhealth = 80;
  22.             int maxEnemyDamage = 40;
  23.             int minEnemyDamage = 15;
  24.             int maxUserDamage = 35;
  25.             int minUserDamage = 10;
  26.             int maxArmor = 75;
  27.             int minArmor = 25;
  28.             bool isUsedSkill = false;
  29.  
  30.             float userHealth = random.Next(minhealth, maxhealth);
  31.             int userDamage = random.Next(minUserDamage, maxUserDamage);
  32.             int userArmor = random.Next(minArmor, maxArmor);
  33.             int userInput;
  34.  
  35.             float enemyHealth = random.Next(minhealth, maxhealth);
  36.             int enemyDamage = random.Next(minEnemyDamage, maxEnemyDamage);
  37.             int enemyArmor = random.Next(minArmor, maxArmor);
  38.  
  39.             int percentages = 100;
  40.             int maxCountOfElixirs = 2;
  41.             int countOfElixirsInventory = maxCountOfElixirs;
  42.             int countOfUsedElixirs = 0;
  43.             int countOfElixirsForUseSkillFriends = 2;
  44.             int countWarriors = 2;
  45.             bool isActiveFriends = false;
  46.             bool isActiveSecretWeapon = false;
  47.             int recoveryPercentage = 10;
  48.             int friendsDamage = 20;
  49.             int secretWeaponDamage = 6;
  50.             int reductionDamage = 3;
  51.  
  52.             Console.WriteLine($"Ваше обмундирование:\n\tHealth - {userHealth}\n\tArmor - {userArmor}\n\tDamage - {userDamage}");
  53.             Console.WriteLine($"Обмундирование властелина помойки №38:\n\tHealth - {enemyHealth}\n\tArmor - {enemyArmor}\n\tDamage - {enemyDamage}");
  54.             Console.WriteLine("Нажмите любую кнопку для начала боя.");
  55.             Console.ReadLine();
  56.  
  57.             while (enemyHealth > 0 && userHealth > 0)
  58.             {
  59.                 Console.WriteLine("Статистика:\n" +
  60.                     $"Ваше здоровье - {userHealth}\tЗдоровье врага - {enemyHealth}");
  61.  
  62.                 float damage;
  63.                 damage = Convert.ToSingle(random.Next(0, enemyDamage)) / percentages * userArmor;
  64.                 userHealth -= damage;
  65.  
  66.                 Console.ForegroundColor = ConsoleColor.Red;
  67.                 Console.WriteLine("Урон врага - " + damage);
  68.                 Console.ForegroundColor = ConsoleColor.White;
  69.  
  70.                 while (isUsedSkill == false)
  71.                 {
  72.                     Console.WriteLine($"{(int)Skills.HolyElixir}) Святой элексир \"Алтус\"- элексир жизни. (У вас {countOfElixirsInventory} шт.)\n" +
  73.                                 "Эффекты:\n" +
  74.                                 "+\n" +
  75.                                 $"\t*  Восстанавливает жизни герою на {recoveryPercentage}% от вашего здоровья на момет использования. \n" +
  76.                                 "-\n" +
  77.                                 $"\t*  Уменьшается урон по врагу на {reductionDamage}.\n\n" +
  78.                                 $"{(int)Skills.Friends}) Братва - к вашему сражению присоединяются пьяные собутыльники Колька и Джамал.\n" +
  79.                                 "Условия: У вас должны быть 2 элексира жизни \"Алтус\" для привлечения внимания союзников\n" +
  80.                                 "Эффекты:\n" +
  81.                                 "+\n" +
  82.                                 "\t*  Наносят урон врагу. \n" +
  83.                                 "-\n" +
  84.                                 "\t*  Могут увидеть врага в вас.\n\n" +
  85.                                 $"{(int)Skills.SecretWeapon}) Секретное химическое оружие – вы отрыгиваете облако газа.\n" +
  86.                                 "Условия: Употребите все элексиры жизни \"Алтус\"\n" +
  87.                                 "Эффекты:\n" +
  88.                                 "+\n" +
  89.                                 "\t*  Наносит одинаковый урон врагу. \n" +
  90.                                 $"{(int)Skills.UnusuaHit}) Необычный удар - обычный удар с необычным прошлым.");
  91.  
  92.                     Console.Write("Выберите способность:");
  93.                     userInput = Convert.ToInt32(Console.ReadLine());
  94.  
  95.                     if (userInput == (int)Skills.HolyElixir && countOfElixirsInventory > 0)
  96.                     {
  97.                         Console.WriteLine("Умение \"Святой элексир \"Алтус\"\" применено");
  98.                         float addHealth = userHealth / percentages * recoveryPercentage;
  99.                         userHealth += addHealth;
  100.                         countOfElixirsInventory--;
  101.                         countOfUsedElixirs++;
  102.                         userDamage -= reductionDamage;
  103.                         isUsedSkill = true;
  104.  
  105.                         Console.ForegroundColor = ConsoleColor.Green;
  106.                         Console.WriteLine($"Вы востановили здоровья на {addHealth}");
  107.                         Console.ForegroundColor = ConsoleColor.White;
  108.                     }
  109.                     else if (userInput == (int)Skills.Friends && countOfElixirsInventory >= countOfElixirsForUseSkillFriends)
  110.                     {
  111.                         Console.WriteLine("Умение \"Братва\" применено");
  112.                         isUsedSkill = true;
  113.                         isActiveFriends = true;
  114.                         countOfElixirsInventory -= countOfElixirsForUseSkillFriends;
  115.                     }
  116.                     else if (userInput == (int)Skills.SecretWeapon && countOfUsedElixirs == maxCountOfElixirs)
  117.                     {
  118.                         Console.WriteLine("Умение \"Секретное химическое оружие\" применено");
  119.                         isUsedSkill = true;
  120.                         isActiveSecretWeapon = true;
  121.                     }
  122.                     else if (userInput == (int)Skills.UnusuaHit)
  123.                     {
  124.                         Console.WriteLine("Умение \"Необычный удар\" применено");
  125.                         damage = Convert.ToSingle(random.Next(0, userDamage)) / percentages * enemyArmor;
  126.                         enemyHealth -= damage;
  127.                         isUsedSkill = true;
  128.  
  129.                         Console.ForegroundColor = ConsoleColor.Green;
  130.                         Console.WriteLine("Вы нанесли - " + damage);
  131.                         Console.ForegroundColor = ConsoleColor.White;
  132.                     }
  133.                     else
  134.                     {
  135.                         Console.ForegroundColor = ConsoleColor.Red;
  136.                         Console.WriteLine("В применение данной способности отказано. Проверти условия использования.");
  137.                         Console.ForegroundColor = ConsoleColor.White;
  138.  
  139.                     }
  140.                 }
  141.  
  142.                 if (isActiveFriends == true)
  143.                 {
  144.                     bool attackingYou = Convert.ToBoolean(random.Next(0, countWarriors));
  145.  
  146.                     if (attackingYou)
  147.                     {
  148.                         damage = Convert.ToSingle(random.Next(0, friendsDamage)) / percentages * userArmor;
  149.                         userHealth -= damage;
  150.  
  151.                         Console.ForegroundColor = ConsoleColor.Red;
  152.                         Console.WriteLine("Урон вам от Кольки и Джамала - " + damage);
  153.                         Console.ForegroundColor = ConsoleColor.White;
  154.                     }
  155.                     else
  156.                     {
  157.                         damage = Convert.ToSingle(random.Next(0, userDamage)) / percentages * enemyArmor;
  158.                         enemyHealth -= damage;
  159.  
  160.                         Console.ForegroundColor = ConsoleColor.Green;
  161.                         Console.WriteLine("Урон врагу от Кольки и Джамала - " + damage);
  162.                         Console.ForegroundColor = ConsoleColor.White;
  163.                     }
  164.                 }
  165.  
  166.                 if (isActiveSecretWeapon == true)
  167.                 {
  168.                     damage = Convert.ToSingle(secretWeaponDamage) / percentages * enemyArmor;
  169.                     userHealth -= damage;
  170.  
  171.                     Console.ForegroundColor = ConsoleColor.Red;
  172.                     Console.WriteLine("Урон от газа - " + damage);
  173.                     Console.ForegroundColor = ConsoleColor.White;
  174.                 }
  175.  
  176.                 isUsedSkill = false;
  177.             }
  178.  
  179.             Console.Clear();
  180.  
  181.             if (userHealth <= 0 && enemyHealth <= 0)
  182.             {
  183.                 Console.WriteLine("Вы и ваш враг потеряли район");
  184.             }
  185.             else if (userHealth <= 0)
  186.             {
  187.                 Console.WriteLine("Вы потеряли район");
  188.             }
  189.             else
  190.             {
  191.                 Console.WriteLine("Вы отбили атаку врага и захватили его район.");
  192.             }
  193.         }
  194.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement