generated from admin/template
Сделал stage2
This commit is contained in:
@@ -0,0 +1,113 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
Console.Write("Введите имя покемона: ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
Console.Write("Введите название первой атаки: ");
|
||||||
|
string attack1Name = Console.ReadLine();
|
||||||
|
Console.Write("Введите название второй атаки: ");
|
||||||
|
string attack2Name = Console.ReadLine();
|
||||||
|
Console.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine("ИНИЦИАЛИЗА КАРТОЧКИ");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.Write("Введите текущее HP Пикачу: ");
|
||||||
|
int hp = int.Parse(Console.ReadLine());
|
||||||
|
Console.Write("Введите базовый урон атаки Быстрая Атака: ");
|
||||||
|
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("ИСПОЛЬЗОВАНИЕ АТАК");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("[Атака 1: Электроудар]");
|
||||||
|
int? random;
|
||||||
|
var rand1 = new Random();
|
||||||
|
random = rand1.Next(2);
|
||||||
|
|
||||||
|
for(int i = 0; i < 1; i++)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Бросок монеты (1 - Орёл, 0 - Решка): {random}");
|
||||||
|
}
|
||||||
|
if(random == 1)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Результат: Активный Покемон противника парализован!");
|
||||||
|
}
|
||||||
|
else if (random == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Результат: Эффект паралича не сработал.");
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
Console.WriteLine("[Атака 2: Быстрая Атака");
|
||||||
|
int? randomNumber;
|
||||||
|
var rand = new Random();
|
||||||
|
randomNumber = rand.Next(2);
|
||||||
|
|
||||||
|
for (int ctr = 0; ctr < 1; ctr++)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Бросок монеты (1 - Орёл, 0 - Решка): {randomNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(randomNumber == 1)
|
||||||
|
{
|
||||||
|
attack2BaseDamage += 10;
|
||||||
|
Console.WriteLine($"Результат: Выпал орёл! Итоговый урон: {attack2BaseDamage}");
|
||||||
|
}
|
||||||
|
else if (randomNumber == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Результат: Выпала решка! Итоговый урон: {attack2BaseDamage}");
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------\n" +
|
||||||
|
"ПОЛУЧЕНИЕ УРОНА\n" +
|
||||||
|
"----------------------------------------------------------------------");
|
||||||
|
Console.Write("Введите базовый урон атаки противника: ");
|
||||||
|
int incomingDamage = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
Console.Write("Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): ");
|
||||||
|
int number = int.Parse(Console.ReadLine());
|
||||||
|
int finalIncomingDamage = 0;
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
switch(number)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается (x2).");
|
||||||
|
finalIncomingDamage = incomingDamage * 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Console.WriteLine("Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).");
|
||||||
|
finalIncomingDamage = incomingDamage - 20;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||||
|
finalIncomingDamage = incomingDamage;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"Получено урона: {finalIncomingDamage}");
|
||||||
|
hp -= finalIncomingDamage;
|
||||||
|
|
||||||
|
if (hp <= 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Пикачу нокаутирован!");
|
||||||
|
}
|
||||||
|
else if (hp > 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Пикачу выдержал удар! Остаток HP: {hp}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user