generated from admin/template
add Readme выполнена лаба 2 Pokémon TCG
This commit is contained in:
@@ -110,5 +110,100 @@ class Program
|
||||
|
||||
}
|
||||
}
|
||||
//Техническое задание: Интерактивная механика карточки Pokémon TCG
|
||||
namespace TCG;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.Write("введите имя покемона : ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("введите название первой атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("введите название второй атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
Console.WriteLine("====================================================================== \n" +
|
||||
"ИНИЦИАЛИЗА КАРТОЧКИ \n" +
|
||||
"----------------------------------------------------------------------");
|
||||
Console.Write("Введите очки здоровья: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите базовый урон атаки «Быстрая Атака»:");
|
||||
Console.WriteLine();
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("---------------------------------------------------------------------- \n" +
|
||||
"ИСПОЛЬЗОВАНИЕ АТАК \n" +
|
||||
"----------------------------------------------------------------------");
|
||||
Console.Write($"[Атака 1: {attack1Name} ]\nБросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
int coin = int.Parse(Console.ReadLine());
|
||||
|
||||
if (coin == 1)
|
||||
{
|
||||
Console.WriteLine("Результат: aктивный Покемон противника парализован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Результат: Эффект паралича не сработал.");
|
||||
}
|
||||
|
||||
Console.Write($"[Атака 2: {attack2Name}] \nБросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
int coin1 = int.Parse(Console.ReadLine());
|
||||
if (coin1 == 1)
|
||||
{
|
||||
int attack2 = attack2BaseDamage + 10;
|
||||
Console.WriteLine($"Результат: Выпал орёл! Итоговый урон: {attack2}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Результат: Выпала решка! Итоговый урон: {attack2BaseDamage}");
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.Write("---------------------------------------------------------------------- \n" +
|
||||
"ПОЛУЧЕНИЕ УРОНА \n" +
|
||||
"---------------------------------------------------------------------- \n" +
|
||||
"Введите базовый урон атаки противника: ");
|
||||
int incomingDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный):");
|
||||
int attackType = int.Parse(Console.ReadLine());
|
||||
int finalIncomingDamag = 0;
|
||||
|
||||
Console.WriteLine();
|
||||
switch (attackType)
|
||||
{
|
||||
case 1:
|
||||
finalIncomingDamag = incomingDamage * 2;
|
||||
Console.WriteLine($"Расчёт: Боевой тип! Урон удваивается (x2). \n " +
|
||||
$"Получено урона: {finalIncomingDamag}");
|
||||
break;
|
||||
case 2:
|
||||
finalIncomingDamag = incomingDamage - 20;
|
||||
if (finalIncomingDamag < 0)
|
||||
{
|
||||
finalIncomingDamag = 0;
|
||||
}
|
||||
Console.WriteLine($"Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).\n"+
|
||||
$"Получено урона: {finalIncomingDamag}");
|
||||
break;
|
||||
case 3:
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
}
|
||||
|
||||
int damageReceived = hp - finalIncomingDamag;
|
||||
if (damageReceived <= 0)
|
||||
{
|
||||
Console.WriteLine("Пикачу нокаутирован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Пикачу выдержал удар! Остаток HP: {damageReceived}");
|
||||
}
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user