generated from admin/template
сделаны лаба 3,лаба 4 и стейджи 2,3
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string name = "Пикачу";
|
||||
string attack1Name = "Электроудар";
|
||||
string attack2Name = "Быстрая Атака";
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
|
||||
Console.Write("Введите текущее HP Пикачу: ");
|
||||
string hpInput = Console.ReadLine();
|
||||
int hp = int.Parse(hpInput);
|
||||
|
||||
Console.Write("Введите базовый урон атаки \"Быстрая Атака\": ");
|
||||
string damageInput = Console.ReadLine();
|
||||
int attack2BaseDamage = int.Parse(damageInput);
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine("ИСПОЛЬЗОВАНИЕ АТАК");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
|
||||
Console.WriteLine("[Атака 1: " + attack1Name + "]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
string coin1Input = Console.ReadLine();
|
||||
int coin1 = int.Parse(coin1Input);
|
||||
|
||||
if (coin1 == 1)
|
||||
{
|
||||
Console.WriteLine("Результат: Активный Покемон противника парализован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Результат: Эффект паралича не сработал.");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("[Атака 2: " + attack2Name + "]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
string coin2Input = Console.ReadLine();
|
||||
int coin2 = int.Parse(coin2Input);
|
||||
|
||||
int finalAttackDamage;
|
||||
|
||||
if (coin2 == 1)
|
||||
{
|
||||
finalAttackDamage = attack2BaseDamage + 10;
|
||||
Console.WriteLine("Результат: Выпал орёл! Итоговый урон: " + finalAttackDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
finalAttackDamage = attack2BaseDamage;
|
||||
Console.WriteLine("Результат: Выпала решка! Итоговый урон: " + finalAttackDamage);
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine("ПОЛУЧЕНИЕ УРОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
|
||||
Console.Write("Введите базовый урон атаки противника: ");
|
||||
string incomingInput = Console.ReadLine();
|
||||
int incomingDamage = int.Parse(incomingInput);
|
||||
|
||||
Console.Write("Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): ");
|
||||
string typeInput = Console.ReadLine();
|
||||
int attackType = int.Parse(typeInput);
|
||||
|
||||
int finalIncomingDamage;
|
||||
|
||||
switch (attackType)
|
||||
{
|
||||
case 1:
|
||||
finalIncomingDamage = incomingDamage * 2;
|
||||
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается (x2).");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
finalIncomingDamage = incomingDamage - 20;
|
||||
|
||||
if (finalIncomingDamage < 0)
|
||||
{
|
||||
finalIncomingDamage = 0;
|
||||
}
|
||||
|
||||
Console.WriteLine("Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
finalIncomingDamage = incomingDamage;
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||
break;
|
||||
|
||||
default:
|
||||
finalIncomingDamage = 0;
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine("Получено урона: " + finalIncomingDamage);
|
||||
|
||||
hp = hp - finalIncomingDamage;
|
||||
|
||||
if (hp <= 0)
|
||||
{
|
||||
Console.WriteLine("Пикачу нокаутирован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Пикачу выдержал удар! Остаток HP: " + hp);
|
||||
}
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user