Advertisement
AziLif

Битва с боссом

Nov 7th, 2024 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 17.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             const string CommandHitByKnife = "1";
  10.             const string CommsndGustWind = "2";
  11.             const string CommandStaticCharge = "3";
  12.             const string CommandExecution = "4";
  13.             const string CommandMagneticField = "5";
  14.             const string CommandFlowersLife = "6";
  15.             const string CommandFlowersForest = "7";
  16.             const string CommandClaw = "0";
  17.             const string CommandShearingThorn = "1";
  18.             const string CommandParasitism = "2";
  19.             const string CommandTotalHealing = "3";
  20.             const string CommandMentalThirst = "4";
  21.  
  22.             Random random = new Random();
  23.             string hitByKnife = "Удар ножом";
  24.             string gustWind = "Порыв ветра";
  25.             string staticCharge = "Статический заряд";
  26.             string execution = "Казнь";
  27.             string magneticField = "Магнитное поле";
  28.             string flowersLife = "Цветы жизни";
  29.             string flowersForest = "Лес цветов";
  30.             string claw = "Когти";
  31.             string shearingThorn = "Стригущий шип";
  32.             string parasitism = "Паразитизм";
  33.             string totalHealing = "Тотальное восстановление";
  34.             string mentalThirst = "Ментальная жажда";
  35.             string userName;
  36.             string userInput;
  37.             string numberSpellEnemy;
  38.             int minNumberSpellEnemy = 0;
  39.             int maxNumberSpellEnemy = 4;
  40.             int userHealth = 200;
  41.             int userMaxHealth = 200;
  42.             int userDeath = 0;
  43.             int userMana = 150;
  44.             int userMaxMana = 150;
  45.             int userManaEmpty = 0;
  46.             int enemyHealth = 240;
  47.             int enemyMaxHealth = 240;
  48.             int enemyDeath = 0;
  49.             int enemyMana = 120;
  50.             int enemyMaxMana = 120;
  51.             int hitByKnifeDamage = 5;
  52.             int hitByKnifeManaRequirement = 0;
  53.             int gustWindDamage = 12;
  54.             int gustWindManaRequirement = 7;
  55.             int staticChargeDamage = 30;
  56.             int staticChargeManaRequiremet = 45;
  57.             int numeratorForPercentageCalculation = 100;
  58.             int mentalThirstManaRequirement = 15;
  59.             int magneticDamageMultiplier = 5;
  60.             int multiplierForCalculatingThePercentageEnemyHealth = 50;
  61.             int multiplierForCalculatingThePercentageUserHealth = 70;
  62.             int amountUserHealthTrigger = userHealth / numeratorForPercentageCalculation * multiplierForCalculatingThePercentageUserHealth;
  63.             int magneticFieldDamage = enemyHealth / numeratorForPercentageCalculation * magneticDamageMultiplier;
  64.             int amountEnemyHealthTrigger = enemyHealth / numeratorForPercentageCalculation * multiplierForCalculatingThePercentageEnemyHealth;
  65.             int magneticFieldManaRequirement = 4;
  66.             int numbersTriggersMagneticField = 10;
  67.             int magneticFieldCounter = 0;
  68.             int flowersLifeHealing = 11;
  69.             int flowersLifeManaRequirement = 6;
  70.             int flowersForestHealing = 20;
  71.             int flowersForestManaRequirement = 15;
  72.             int healthRegen = 1;
  73.             int manaRegen = 3;
  74.             int enemyManaRegen = 10;
  75.             int clawDamage = 5;
  76.             int shearingThornDamage = 5;
  77.             int shearingThornManaRequirement = 3;
  78.             int parasitismDamage = 10;
  79.             int parasitismHealthRegen = 7;
  80.             int parasitismManaRequirement = 16;
  81.             int mentalThirstDamage = 40;
  82.  
  83.             Console.WriteLine("Здравствуй путник. Ты попал в пещеру полную сокровищ.\nИз нее есть только один выход - тебе нужно одолеть Того,чье имя забыто." +
  84.                 "\nПобеди его, забери сокровища и скорее беги, " +
  85.                 "пока весть о его гибели не привлекла кого-то более страшного...\n" +
  86.                 "\nПобедить может только один!" +
  87.                 "\n\nДля начала скажи свое имя, дабы мы знали имя героя победившего древнего врага и могли увековечить его в сказаниях.");
  88.             userName = Console.ReadLine();
  89.  
  90.             Console.WriteLine($"\nФортуна любит подготовленных. И так, чтобы победить врага ты можешь: \n" +
  91.                         $"\n1 - {hitByKnife} - урон {hitByKnifeDamage} единиц, мана {hitByKnifeManaRequirement} единиц.\n" +
  92.                         $"2 - {gustWind} - урон {gustWindDamage} единиц, мана {gustWindManaRequirement} единиц.\n" +
  93.                         $"3 - {staticCharge} - урон {staticChargeDamage} единиц, мана {staticChargeManaRequiremet} единиц.\n" +
  94.                         $"4 - {execution} - урон {enemyHealth} единиц, мана {userMana} единиц, при условии, что у врага останется меньше " +
  95.                         $"{amountEnemyHealthTrigger} единиц здоровья,\n \tа у тебя {amountUserHealthTrigger} единиц здоровья.\n" +
  96.                         $"5 - {magneticField} - урон {magneticFieldDamage} единиц, мана {magneticFieldManaRequirement} единиц, количество стаков заклинания - {numbersTriggersMagneticField}.\n" +
  97.                         $"6 - {flowersLife} - лечение на {flowersLifeHealing} единиц, мана {flowersLifeManaRequirement} единиц.\n" +
  98.                         $"7 - {flowersForest} - лечение на {flowersForestHealing} единиц, мана {flowersForestManaRequirement} единиц.\n" +
  99.                         $"На данный момент это все твои возможности. Пусть тебе улыбнется удача.");
  100.             Console.WriteLine($"Позволь еще раз поприветствовать тебя {userName} и да начнется сражение! (Нажмите любую кнопку)");
  101.             Console.ReadKey();
  102.  
  103.             while (userHealth >= userDeath || enemyHealth >= enemyDeath)
  104.             {
  105.                 numberSpellEnemy = Convert.ToString(random.Next(minNumberSpellEnemy, maxNumberSpellEnemy));
  106.                 Console.Write("\nВыберите номер заклинания:");
  107.                 userInput = Console.ReadLine();
  108.  
  109.                 Console.WriteLine($"Твое здоровье {userHealth}, мана {userMana}");
  110.                 Console.WriteLine($"Здоровье врага {enemyHealth}, мана врага {enemyMana}");
  111.                 Console.WriteLine($"Накоплено стаков {magneticField} - {magneticFieldCounter} единиц.");
  112.                 Console.WriteLine($"Введи номер заклинания:\n\n" +
  113.                     $" {hitByKnife} - {CommandHitByKnife}.\n" +
  114.                     $" {gustWind}  - {CommsndGustWind}.\n" +
  115.                     $" {staticCharge} - {CommandStaticCharge}.\n" +
  116.                     $" {execution} - {CommandExecution}.\n" +
  117.                     $" {magneticField} - {CommandMagneticField}.\n" +
  118.                     $" {flowersLife} - {CommandFlowersLife}.\n" +
  119.                     $" {flowersForest} - {CommandFlowersForest}.\n");
  120.  
  121.                 magneticFieldCounter++;
  122.  
  123.                 switch (userInput)
  124.                 {
  125.                     case CommandHitByKnife:
  126.                         Console.ForegroundColor = ConsoleColor.DarkRed;
  127.                         Console.WriteLine($"Урон от {hitByKnife} - {hitByKnifeDamage} единиц.");
  128.  
  129.                         enemyHealth -= hitByKnifeDamage;
  130.  
  131.                         Console.ResetColor();
  132.                         break;
  133.  
  134.                     case CommsndGustWind:
  135.                         Console.ForegroundColor = ConsoleColor.DarkBlue;
  136.  
  137.                         if (userMana >= gustWindManaRequirement)
  138.                         {
  139.                             enemyHealth -= gustWindDamage;
  140.                             userMana -= gustWindManaRequirement;
  141.  
  142.                             Console.WriteLine($"Урон от {gustWind} - {gustWindDamage} единиц.");
  143.                             Console.ResetColor();
  144.                         }
  145.                         else
  146.                         {
  147.                             Console.ForegroundColor = ConsoleColor.Red;
  148.                             Console.WriteLine($"Для {gustWind} недостаточно маны.");
  149.                             Console.ResetColor();
  150.                         }
  151.                         break;
  152.  
  153.                     case CommandStaticCharge:
  154.                         Console.ForegroundColor = ConsoleColor.Blue;
  155.  
  156.                         if (userMana >= staticChargeManaRequiremet)
  157.                         {
  158.                             enemyHealth -= staticChargeDamage * magneticFieldCounter;
  159.                             userMana -= staticChargeManaRequiremet;
  160.  
  161.                             Console.WriteLine($"Урон от {staticCharge} - {staticChargeDamage} единиц.");
  162.                             Console.ResetColor();
  163.                         }
  164.                         else
  165.                         {
  166.                             Console.ForegroundColor = ConsoleColor.Red;
  167.                             Console.WriteLine($"Для {staticCharge} недостаточно маны");
  168.                             Console.ResetColor();
  169.                         }
  170.                         break;
  171.  
  172.                     case CommandExecution:
  173.                         if (enemyHealth <= amountEnemyHealthTrigger && userHealth >= amountUserHealthTrigger)
  174.                         {
  175.                             enemyHealth -= enemyDeath;
  176.                             userMana -= userMana;
  177.                         }
  178.                         else
  179.                         {
  180.                             Console.ForegroundColor = ConsoleColor.Red;
  181.                             Console.WriteLine("Условия не соотвевтствуют");
  182.                             Console.ResetColor();
  183.                         }
  184.                         break;
  185.  
  186.                     case CommandMagneticField:
  187.                         Console.ForegroundColor = ConsoleColor.DarkCyan;
  188.  
  189.                         if (magneticFieldCounter <= numbersTriggersMagneticField)
  190.                         {
  191.                             enemyHealth -= magneticFieldDamage;
  192.                             userMana -= magneticFieldManaRequirement;
  193.  
  194.                             Console.WriteLine($"Урон от {magneticField} - {magneticFieldDamage} единиц.");
  195.                             Console.ResetColor();
  196.                         }
  197.  
  198.                         Console.WriteLine($"{magneticField} наносит урон. {magneticFieldDamage} урона за {numbersTriggersMagneticField} ходов");
  199.                         break;
  200.  
  201.                     case CommandFlowersLife:
  202.                         Console.ForegroundColor = ConsoleColor.Green;
  203.  
  204.                         if (userHealth < userMaxHealth && userMana >= userManaEmpty)
  205.                         {
  206.                             userHealth += flowersLifeHealing;
  207.                             userMana -= flowersLifeManaRequirement;
  208.  
  209.                             Console.WriteLine($"Лечение от {flowersLife} - {flowersLifeHealing} единиц.");
  210.                             Console.ResetColor();
  211.                         }
  212.                         break;
  213.  
  214.                     case CommandFlowersForest:
  215.                         Console.ForegroundColor = ConsoleColor.Green;
  216.  
  217.                         if (userHealth < userMaxHealth && userMana >= userManaEmpty)
  218.                         {
  219.                             userHealth += flowersForestHealing;
  220.                             userMana -= flowersForestManaRequirement;
  221.  
  222.                             Console.WriteLine($"Лечение от {flowersForest} - {flowersForestHealing} единиц.");
  223.                             Console.ResetColor();
  224.                         }
  225.                         break;
  226.                 }
  227.  
  228.                 switch (numberSpellEnemy)
  229.                 {
  230.                     case CommandClaw:
  231.                         {
  232.                             Console.WriteLine($"Враг ударил {claw}. Получено {clawDamage} урона.");
  233.  
  234.                             userHealth -= clawDamage;
  235.                         }
  236.                         break;
  237.  
  238.                     case CommandShearingThorn:
  239.                         if (enemyMana > shearingThornManaRequirement)
  240.                         {
  241.                             Console.WriteLine($"{shearingThorn} попал в тебя. Получено {shearingThornDamage} урона.");
  242.  
  243.                             userHealth -= shearingThornDamage;
  244.                             enemyMana -= shearingThornManaRequirement;
  245.                         }
  246.                         else
  247.                         {
  248.                             Console.ForegroundColor = ConsoleColor.Red;
  249.  
  250.                             Console.WriteLine($"Для использования {shearingThorn} у врага не достаточно маны.");
  251.                             Console.ResetColor();
  252.                         }
  253.                         break;
  254.  
  255.                     case CommandParasitism:
  256.                         if (enemyMana > parasitismManaRequirement)
  257.                         {
  258.                             Console.WriteLine($"К тебе прилип {parasitism}. Он востанавливает {parasitismHealthRegen} здоровья врагу и наносит тебе {parasitismDamage} урона.");
  259.  
  260.                             userHealth -= parasitismDamage;
  261.                             enemyHealth += parasitismHealthRegen;
  262.                             enemyMana -= parasitismManaRequirement;
  263.                         }
  264.                         else
  265.                         {
  266.                             Console.ForegroundColor = ConsoleColor.Red;
  267.                             Console.WriteLine($"Для использования {parasitism} у врага не достаточно маны.");
  268.                             Console.ResetColor();
  269.                         }
  270.                         break;
  271.  
  272.                     case CommandTotalHealing:
  273.                         if (enemyMana >= enemyMaxMana)
  274.                         {
  275.                             Console.WriteLine($"Враг использовал {totalHealing}, его здоровье полностью восстановлено.");
  276.  
  277.                             enemyHealth = enemyMaxHealth;
  278.                             enemyMana -= enemyMaxMana;
  279.                         }
  280.                         else
  281.                         {
  282.                             Console.ForegroundColor = ConsoleColor.Red;
  283.                             Console.WriteLine($"Для {totalHealing} недостаточно маны.");
  284.                             Console.ResetColor();
  285.                         }
  286.                         break;
  287.  
  288.                     case CommandMentalThirst:
  289.                         if (enemyMana >= mentalThirstManaRequirement)
  290.                         {
  291.                             Console.WriteLine($"Враг использовал {mentalThirst}, нанесено {mentalThirstDamage} урона.");
  292.  
  293.                             userHealth -= mentalThirstDamage;
  294.                             enemyMana -= mentalThirstManaRequirement;
  295.                         }
  296.                         else
  297.                         {
  298.                             Console.ForegroundColor = ConsoleColor.Red;
  299.                             Console.WriteLine($"Для использования {mentalThirst} у врага не достаточно маны.");
  300.                             Console.ResetColor();
  301.                         }
  302.                         break;
  303.                 }
  304.  
  305.                 if (userHealth >= userMaxHealth || userMana >= userMaxMana)
  306.                 {
  307.                     userDeath = userMaxHealth;
  308.                     Console.WriteLine("Вы здоровы");
  309.                 }
  310.                 else
  311.                 {
  312.                     Console.ResetColor();
  313.                     userHealth += healthRegen;
  314.                     userMana += manaRegen;
  315.                     Console.WriteLine($"\nТебе восстановлено {healthRegen} здоровья и {manaRegen} маны.");
  316.                 }
  317.  
  318.                 if (enemyHealth >= enemyMaxHealth || enemyMana >= enemyMaxMana)
  319.                 {
  320.                     enemyHealth = enemyMaxHealth;
  321.                     Console.WriteLine("Враг здоров");
  322.                 }
  323.                 else
  324.                 {
  325.                     Console.ResetColor();
  326.                     enemyHealth += healthRegen;
  327.                     enemyMana += enemyManaRegen;
  328.                     Console.WriteLine($"\nВрагу восстановлено {healthRegen} здоровья и {enemyManaRegen} маны.");
  329.                 }
  330.             }
  331.  
  332.             if (userHealth <= userDeath)
  333.                 Console.WriteLine("Вы проиграли. Враг победил.");
  334.             else
  335.                 Console.WriteLine("Враг пал. Поздравляю!");
  336.         }
  337.     }
  338. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement