Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Basic_Task10
- {
- class Program
- {
- static void Main(string[] args)
- {
- string username = "TravaMan";
- int maxHP = 100;
- int currentHP = 100;
- int maxMana = 100;
- int currentMana = 100;
- int countHealHP = 20;
- string str = "";
- Random rnd = new Random();
- while (str != "ESC")
- {
- Console.WriteLine("Имя: " + username);
- Console.WriteLine("ХП: " + currentHP + "/" + maxHP);
- Console.WriteLine("Мана: " + currentMana + "/" + maxMana);
- Console.WriteLine("Введите команду: ");
- str = Console.ReadLine();
- switch (str)
- {
- case "Heal":
- if (currentMana >= countHealHP)
- {
- currentMana -= countHealHP;
- if (currentHP + countHealHP >= maxHP)
- {
- currentHP = maxHP;
- }
- else
- {
- currentHP += countHealHP;
- }
- }
- break;
- case "Fight":
- if (currentHP > 0)
- {
- int damage = rnd.Next(0, 51);
- Console.WriteLine("Вам нанесли " + damage + " урона");
- if (currentHP - damage < 0)
- {
- currentHP = 0;
- break;
- }
- else
- {
- currentHP -= damage;
- }
- int addMana = rnd.Next(0, 21);
- Console.WriteLine("Вы улучшили свой манапул на " + addMana + "ед.");
- maxMana += addMana;
- }
- else
- {
- Console.WriteLine("Вы в плохом состоянии. Вы не можете драться");
- }
- break;
- case "Meditate":
- int regenMana = rnd.Next(1, maxMana / 4);
- if (maxMana - currentMana <= regenMana)
- {
- currentMana = maxMana;
- }
- else
- {
- currentMana += regenMana;
- }
- break;
- case "SetName":
- Console.WriteLine("Введите новое имя: ");
- username = Console.ReadLine();
- break;
- case "ESC":
- break;
- default:
- Console.WriteLine("Данной команды нету.");
- break;
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement