From 69163e99df4617a6718cfeff7b7c6a4938d1999b Mon Sep 17 00:00:00 2001 From: Rulet13 Date: Wed, 30 Sep 2026 11:55:00 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20works/lab-03/readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/lab-03/readme.md | 103 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 works/lab-03/readme.md diff --git a/works/lab-03/readme.md b/works/lab-03/readme.md new file mode 100644 index 0000000..0ab0d0b --- /dev/null +++ b/works/lab-03/readme.md @@ -0,0 +1,103 @@ + internal class Program + { + static string pokemon1Name = "Пикачу"; + static int pokemon1Hp = 50; + static int pokemon1Attack = 12; + static string pokemon2Name = "Булбазавр"; + static int pokemon2Hp = 55; + static int pokemon2Attack = 10; + static int roundNumber = 1; + + static void Main(string[] args) + { + string userInput; + do + { + Console.WriteLine("1 -> Задание 1"); + Console.WriteLine("2 -> Задание 2"); + Console.WriteLine("3 -> Задание 3"); + Console.WriteLine("4 -> Выход"); + Console.Write("Выбор: "); + userInput = Console.ReadLine(); + switch (userInput) + { + case "1": + part1(); + break; + case "2": + part2(); + break; + case "3": + part3(); + break; + case "4": + part3(); + break; + default: + Console.WriteLine("выбор не допустим"); + break; + } + } while (userInput != "4"); + } + static void part1() + { + + Console.WriteLine("\nПриготовьтесь!"); + for (int i = 3; i >0; i--) + { + Console.WriteLine(i +"..."); + Thread.Sleep(1000); + } + Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ==="); + Console.WriteLine($"{pokemon1Name}({pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name}({pokemon2Hp} | Атака: {pokemon2Attack})\n"); + } + static void part2() + { + Console.Write("\nГотовы начать бой? (1 — Начать бой, 0 — Сдаться): "); + string userInput2 = Console.ReadLine(); + var consoleText = ""; + do + { + if (userInput2 == "1") + { + consoleText = "Бой начинается!"; + } + else if (userInput2 == "0") + { + consoleText = "...Никаких боев"; + } + else + { + consoleText = "Неверный ввод"; + } + } while (userInput2 != "1" && userInput2 != "0"); + Console.WriteLine(consoleText + "\n"); + } + static void part3() + { + Console.WriteLine("\n=== БОЙ НАЧИНАЕТСЯ ==="); + for (int i = 1; i <= 5; i++) + { + Console.WriteLine($"---Раунд {i}---"); + Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!"); + pokemon2Hp -= pokemon1Attack; + if (pokemon2Hp <= 0) + { + pokemon2Hp = 0; + Console.WriteLine($"{pokemon2Name} потерял сознание!"); + break; + } + Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} урона по {pokemon1Name}!"); + pokemon1Hp -= pokemon2Attack; + if (pokemon1Hp <= 0) + { + pokemon1Hp = 0; + Console.WriteLine($"{pokemon1Name} потерял сознание!"); + break; + } + Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}\n"); + Thread.Sleep(1000); + } + + } + } \ No newline at end of file