From 6b9c26463239b61bec79a5ba0393b1e7584b84d6 Mon Sep 17 00:00:00 2001 From: anazaz Date: Thu, 24 Sep 2026 09:04:00 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?works/c#/stage3=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/c#/stage3/Program.cs | 224 +++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 works/c#/stage3/Program.cs diff --git a/works/c#/stage3/Program.cs b/works/c#/stage3/Program.cs new file mode 100644 index 0000000..b07f9ca --- /dev/null +++ b/works/c#/stage3/Program.cs @@ -0,0 +1,224 @@ +using System; + +namespace PokemonDuelGame +{ + internal class Program + { + static void Main(string[] args) + { + + Console.WriteLine("======================================================================"); + Console.WriteLine("ИНИЦИАЛИЗА КАРТОЧКИ ПОКЕМОНА"); + Console.WriteLine("----------------------------------------------------------------------"); + + // 1.1. Ввод текстовых характеристик + Console.Write("Введите стадию развития: "); + string stage = Console.ReadLine(); + + Console.Write("Введите имя покемона: "); + string name = Console.ReadLine(); + + Console.Write("Введите вид покемона: "); + string category = Console.ReadLine(); + + Console.Write("Введите название 1-й атаки: "); + string attack1Name = Console.ReadLine(); + + Console.Write("Введите эффект 1-й атаки: "); + string attack1Desc = Console.ReadLine(); + + Console.Write("Введите базовый урон 1-й атаки: "); + int attack1BaseDamage = int.Parse(Console.ReadLine()); + + Console.Write("Введите название 2-й атаки: "); + string attack2Name = Console.ReadLine(); + + Console.Write("Введите эффект 2-й атаки: "); + string attack2Desc = Console.ReadLine(); + + Console.Write("Введите базовый урон 2-й атаки: "); + int attack2BaseDamage = int.Parse(Console.ReadLine()); + + Console.Write("Введите уязвимость: "); + string weakness = Console.ReadLine(); + + Console.Write("Введите устойчивость: "); + string resistance = Console.ReadLine(); + + Console.Write("Введите текущее HP: "); + int hp = int.Parse(Console.ReadLine()); + Console.Clear(); + + Console.WriteLine("======================================================================"); + Console.WriteLine($"[{stage}] {name} ОЖ: {hp}"); + Console.WriteLine("----------------------------------------------------------------------"); + Console.WriteLine($"Вид: {category}"); + Console.WriteLine("----------------------------------------------------------------------"); + Console.WriteLine($"[Атака 1] {attack1Name} Урон: {attack1BaseDamage}"); + Console.WriteLine($"Эффект: {attack1Desc}"); + Console.WriteLine(); + Console.WriteLine($"[Атака 2] {attack2Name} Урон: {attack2BaseDamage}+"); + Console.WriteLine($"Эффект: {attack2Desc}"); + Console.WriteLine("----------------------------------------------------------------------"); + Console.WriteLine($"Слабость: {weakness} | Устойчивость: {resistance}"); + Console.WriteLine("======================================================================"); + Console.WriteLine(); + + string enemyName = "Булбазавр"; + int enemyHp = 70; + int enemyBaseDamage = 15; + int roundNumber = 1; + bool isEnemyDebuffed = false; + + Console.WriteLine("Приготовьтесь к дуэли!"); + + for (int i = 3; i >= 1; i--) + { + Console.WriteLine($"{i}..."); + } + + Console.WriteLine(); + Console.WriteLine($"=== СТАРТ ДУЭЛИ: {name} (HP: {hp}) VS {enemyName} (HP: {enemyHp}) ==="); + Console.WriteLine(); + + while (hp > 0 && enemyHp > 0) + { + Console.WriteLine($"--- Раунд {roundNumber} ---"); + + int actionChoice; + do + { + Console.Write($"Выберите действие (1 - {attack1Name}, 2 - {attack2Name}): "); + actionChoice = int.Parse(Console.ReadLine()); + + if (actionChoice != 1 && actionChoice != 2) + { + Console.WriteLine("Некорректный выбор! Введите 1 или 2."); + } + } + while (actionChoice != 1 && actionChoice != 2); + + int playerDamageDealt = 0; + + if (actionChoice == 1) + { + Console.Write($"[{attack1Name}] Проверка условия спецэффекта (1 - Сработал, 0 - Нет): "); + int effectStatus = int.Parse(Console.ReadLine()); + + playerDamageDealt = attack1BaseDamage; + + if (effectStatus == 1) + { + isEnemyDebuffed = true; + Console.WriteLine($"Результат: Спецэффект сработал! {enemyName} потерял возможность атаковать!"); + } + else + { + Console.WriteLine("Результат: Спецэффект не сработал."); + } + } + else // actionChoice == 2 + { + Console.Write($"[{attack2Name}] Проверка условия спецэффекта (1 - Критический урон, 0 - Обычный): "); + int bonusStatus = int.Parse(Console.ReadLine()); + + if (bonusStatus == 1) + { + playerDamageDealt = attack2BaseDamage + 10; + Console.WriteLine($"Результат: Условие выполнено! Нанесен усиленный урон: {playerDamageDealt}"); + } + else + { + playerDamageDealt = attack2BaseDamage; + Console.WriteLine($"Результат: Базовый урон: {playerDamageDealt}"); + } + } + + enemyHp -= playerDamageDealt; + + if (enemyHp <= 0) + { + enemyHp = 0; + Console.WriteLine($"{enemyName} нокаутирован!"); + Console.WriteLine(); + break; // Прерывание цикла + } + + Console.WriteLine(); + + if (isEnemyDebuffed) + { + Console.WriteLine($"{enemyName} пропускает ход из-за эффекта атаки!"); + isEnemyDebuffed = false; // Сброс дебаффа + } + else + { + Console.Write("Выберите тип атаки противника (1 - Уязвимость, 2 - Устойчивость, 3 - Обычный): "); + int incomingType = int.Parse(Console.ReadLine()); + + int finalIncomingDamage = 0; + + switch (incomingType) + { + case 1: + Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2)."); + finalIncomingDamage = enemyBaseDamage * 2; + break; + + case 2: + Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20."); + finalIncomingDamage = enemyBaseDamage - 20; + if (finalIncomingDamage < 0) + { + finalIncomingDamage = 0; + } + break; + + case 3: + Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений."); + finalIncomingDamage = enemyBaseDamage; + break; + + default: + Console.WriteLine("Неизвестный тип атаки! Урон нанесён по умолчанию."); + finalIncomingDamage = enemyBaseDamage; + break; + } + + // Вычитаем урон игрока и проверяем нокаут + hp -= finalIncomingDamage; + + if (hp <= 0) + { + hp = 0; + Console.WriteLine($"{name} нокаутирован!"); + Console.WriteLine(); + break; // Прерывание цикла + } + } + + Console.WriteLine($"Итог раунда: {name} HP: {hp} | {enemyName} HP: {enemyHp}"); + Console.WriteLine(); + roundNumber++; + } + + Console.WriteLine("======================================================================"); + Console.WriteLine("=== ДУЭЛЬ ОКОНЧЕНА ==="); + + if (hp > 0) + { + Console.WriteLine($"Победитель: {name}!"); + } + else + { + Console.WriteLine($"Победитель: {enemyName}!"); + } + + Console.WriteLine("======================================================================"); + + Console.WriteLine(); + Console.WriteLine("Нажмите любую клавишу для выхода..."); + Console.ReadKey(); + } + } +} \ No newline at end of file