diff --git a/works/lab-02/lab2.1.cs b/works/lab-02/lab2.1.cs new file mode 100644 index 0000000..1cba78b --- /dev/null +++ b/works/lab-02/lab2.1.cs @@ -0,0 +1,15 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("=== Прокачка покемона ==="); + Console.WriteLine("Введите базовую атаку покемона: "); + int baseDamage = int.Parse(Console.ReadLine()); + Console.WriteLine("Введите кол-во полученных уровней: "); + int reachedLevels = int.Parse(Console.ReadLine()); + int finalDamage = baseDamage * (reachedLevels * 5); + Console.WriteLine($"Ваш финальный урон: {finalDamage}"); + } +} diff --git a/works/lab-02/lab2.2.cs b/works/lab-02/lab2.2.cs new file mode 100644 index 0000000..cf3e1b9 --- /dev/null +++ b/works/lab-02/lab2.2.cs @@ -0,0 +1,23 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + int balance = 1500; + int potionSale = 200; + Console.WriteLine("Ваш баланс 1500 монет"); + Console.WriteLine("Зелье стоит 200 монет"); + Console.WriteLine("Сколько зелий вы хотите купить?"); + int potionBuy = int.Parse(Console.ReadLine()); + int ostatok = 1500 - potionBuy * 200 ; + if (ostatok < 0) + { + Console.WriteLine("У вас не хватает денег! Купите поменьше!"); + } + else + { + Console.WriteLine($"Вы купили {potionBuy} зелий, у вас осталось {ostatok} монет"); + } + } +} diff --git a/works/lab-02/lab2.3.cs b/works/lab-02/lab2.3.cs new file mode 100644 index 0000000..7449be5 --- /dev/null +++ b/works/lab-02/lab2.3.cs @@ -0,0 +1,27 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("Вашего покемона атаковали!"); + Console.WriteLine("Введите сколько у него осталось здоровье! (максимум 50)"); + int currentHp = int.Parse(Console.ReadLine()); + if (currentHp <= 0) + { + Console.WriteLine("Покемон потерял сознание! Верните его в покебол."); + } + if (currentHp > 1 && currentHp < 21) + { +Console.WriteLine("Критическое состояние! Срочно используйте зелье!"); + } + if (currentHp > 20 && currentHp < 50) + { +Console.WriteLine("Покемон ранен, будьте осторожны."); + } + if (currentHp >= 50) + { +Console.WriteLine("Покемон полон сил и готов к бою!"); + } + } +} diff --git a/works/lab-02/lab2.4.cs b/works/lab-02/lab2.4.cs new file mode 100644 index 0000000..3f619a7 --- /dev/null +++ b/works/lab-02/lab2.4.cs @@ -0,0 +1,32 @@ +using System; + +class Program { + static void Main() { + Console.OutputEncoding = System.Text.Encoding.UTF8; +Console.InputEncoding = System.Text.Encoding.UTF8; + Console.WriteLine("БОЙ НАЧАЛСЯ, ДАЙТЕ ПОКЕМОНУ КОМАНДУ!"); + Console.WriteLine("1 — Атака"); + Console.WriteLine("2 — Инвентарь"); + Console.WriteLine("3 — Сменить покемона"); + Console.WriteLine("4 — Побег"); + int command = int.Parse(Console.ReadLine()); + switch(command) + { + case 1: + Console.WriteLine("Покемон наносит быстрый удар!"); + break; + case 2: + Console.WriteLine("Вы открыли сумку и применили Зелье Лечения."); + break; + case 3: + Console.WriteLine("Вы отозвали покемона и выпустили нового!"); + break; + case 4: + Console.WriteLine("Вы успешно сбежали из боя!"); + break; + default: + Console.WriteLine("Неизвестная команда! Вы пропустили ход."); + break; + } + } +}