generated from admin/template
stage3
This commit is contained in:
@@ -10,9 +10,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace lesson4
|
namespace stage2
|
||||||
{
|
{
|
||||||
class lesson4
|
class stage2
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,154 @@
|
|||||||
|
# Stage 3
|
||||||
|
|
||||||
|
* **Студент:** [Пузанова Анна Андреевна]
|
||||||
|
* **Техническое задание: Универсальный игровой цикл дуэли Pokémon TCG (Абстрактная модель)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ключевой код
|
||||||
|
```csharp
|
||||||
|
namespace stage3
|
||||||
|
{
|
||||||
|
class stage3
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine("ИНИЦИАЛИЗА КАРТОЧКИ ПОКЕМОНА");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("Введите стадию развития покемона: ");
|
||||||
|
string stage = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите имя покемона: ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите вид покемона: ");
|
||||||
|
string category = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите название 1-й атаки: ");
|
||||||
|
string attack1Name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите эффект 1-й атаки: ");
|
||||||
|
string attack1Desc = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите базовый урон 1-й атаки:");
|
||||||
|
int attack1BaseDamage = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine("Введите название 2-й атаки: ");
|
||||||
|
string attack2Name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите эффект 2-й атаки: ");
|
||||||
|
string attack2Desc = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите базовый урон 2-й атаки: ");
|
||||||
|
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine("Введите уязвимость: ");
|
||||||
|
string weakness = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите устойчивость: ");
|
||||||
|
string resistance = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите текущее HP: ");
|
||||||
|
int hp = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
string enemyName = "Булбазавр";
|
||||||
|
int enemyHp = 70 ;
|
||||||
|
int enemyBaseDamage = 15 ;
|
||||||
|
int roundNumber = 20 ;
|
||||||
|
int actionChoice = 1 ;
|
||||||
|
bool isEnemyDebuffed = true;
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine($"[{stage}] Чармандер ОЖ: {enemyHp}");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine($"Вид: {category}");
|
||||||
|
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(" ");
|
||||||
|
Console.WriteLine("Приготовьтесь к дуэли!");
|
||||||
|
for (int i = 3; i > 0 ; i--)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{i}...");
|
||||||
|
}
|
||||||
|
Console.WriteLine($"=== СТАРТ ДУЭЛИ: {name} (HP: {hp}) VS {enemyName } (HP: {enemyHp}) ===\n");
|
||||||
|
while (hp > 0 && enemyHp > 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"--- Раунд {roundNumber} ---");
|
||||||
|
|
||||||
|
int choice;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Выберите атаку: 1 — {attack1Name}, 2 — {attack2Name}");
|
||||||
|
|
||||||
|
if (choice == 1 || choice == 2)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Неверный ввод. Введите 1 или 2.");
|
||||||
|
}
|
||||||
|
} while (true);
|
||||||
|
|
||||||
|
Console.WriteLine("Вы выбрали: " + choice);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isEnemyDebuffed == true)
|
||||||
|
{
|
||||||
|
Console.WriteLine($" {enemyName} пропускает ход из-за эффекта атаки!");
|
||||||
|
|
||||||
|
}
|
||||||
|
else Console.WriteLine();
|
||||||
|
|
||||||
|
}
|
||||||
|
roundNumber++;
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine("=== ДУЭЛЬ ОКОНЧЕНА ===");
|
||||||
|
if (hp > enemyHp)
|
||||||
|
{
|
||||||
|
Console.WriteLine("$\"Победитель: {name}!\"");
|
||||||
|
}
|
||||||
|
else Console.WriteLine($"Победитель: {enemyName}!");
|
||||||
|
|
||||||
|
Console.WriteLine($"Победитель: ");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ВЫВОД:
|
||||||
|
|
||||||
|
======================================================================
|
||||||
|
ИНИЦИАЛИЗА КАРТОЧКИ
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Введите текущее HP Пикачу: 60
|
||||||
|
Введите базовый урон атаки "Быстрая Атака": 20
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
ИСПОЛЬЗОВАНИЕ АТАК
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
[Атака 1: Электроудар]
|
||||||
|
Бросок монеты (1 - Орёл, 0 - Решка): 1
|
||||||
|
Результат: Активный Покемон противника парализован!
|
||||||
|
|
||||||
|
[Атака 2: Быстрая Атака]
|
||||||
|
Бросок монеты (1 - Орёл, 0 - Решка): 1
|
||||||
|
Результат: Выпал орёл! Итоговый урон: 30
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
ПОЛУЧЕНИЕ УРОНА
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Введите базовый урон атаки противника: 25
|
||||||
|
Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): 1
|
||||||
|
Расчёт: Боевой тип! Урон удваивается (x2).
|
||||||
|
Получено урона: 50
|
||||||
|
Пикачу выдержал удар! Остаток HP: 10
|
||||||
|
======================================================================
|
||||||
|
|
||||||
|
Process finished with exit code 0.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stage3", "stage3\stage3.csproj", "{5B75339E-D323-4277-8FBB-CA008C342B84}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5B75339E-D323-4277-8FBB-CA008C342B84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5B75339E-D323-4277-8FBB-CA008C342B84}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5B75339E-D323-4277-8FBB-CA008C342B84}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5B75339E-D323-4277-8FBB-CA008C342B84}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
namespace stage3
|
||||||
|
{
|
||||||
|
class stage3
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine("ИНИЦИАЛИЗА КАРТОЧКИ ПОКЕМОНА");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("Введите стадию развития покемона: ");
|
||||||
|
string stage = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите имя покемона: ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите вид покемона: ");
|
||||||
|
string category = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите название 1-й атаки: ");
|
||||||
|
string attack1Name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите эффект 1-й атаки: ");
|
||||||
|
string attack1Desc = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите базовый урон 1-й атаки:");
|
||||||
|
int attack1BaseDamage = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine("Введите название 2-й атаки: ");
|
||||||
|
string attack2Name = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите эффект 2-й атаки: ");
|
||||||
|
string attack2Desc = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите базовый урон 2-й атаки: ");
|
||||||
|
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine("Введите уязвимость: ");
|
||||||
|
string weakness = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите устойчивость: ");
|
||||||
|
string resistance = Console.ReadLine();
|
||||||
|
Console.WriteLine("Введите текущее HP: ");
|
||||||
|
int hp = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
string enemyName = "Булбазавр";
|
||||||
|
int enemyHp = 70 ;
|
||||||
|
int enemyBaseDamage = 15 ;
|
||||||
|
int roundNumber = 20 ;
|
||||||
|
int actionChoice = 1 ;
|
||||||
|
bool isEnemyDebuffed = true;
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
Console.WriteLine(" ");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine($"[{stage}] Чармандер ОЖ: {enemyHp}");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine($"Вид: {category}");
|
||||||
|
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(" ");
|
||||||
|
Console.WriteLine("Приготовьтесь к дуэли!");
|
||||||
|
for (int i = 3; i > 0 ; i--)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{i}...");
|
||||||
|
}
|
||||||
|
Console.WriteLine($"=== СТАРТ ДУЭЛИ: {name} (HP: {hp}) VS {enemyName } (HP: {enemyHp}) ===\n");
|
||||||
|
while (hp > 0 && enemyHp > 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"--- Раунд {roundNumber} ---");
|
||||||
|
|
||||||
|
int choice;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Выберите атаку: 1 — {attack1Name}, 2 — {attack2Name}");
|
||||||
|
|
||||||
|
if (choice == 1 || choice == 2)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Неверный ввод. Введите 1 или 2.");
|
||||||
|
}
|
||||||
|
} while (true);
|
||||||
|
|
||||||
|
Console.WriteLine("Вы выбрали: " + choice);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isEnemyDebuffed == true)
|
||||||
|
{
|
||||||
|
Console.WriteLine($" {enemyName} пропускает ход из-за эффекта атаки!");
|
||||||
|
|
||||||
|
}
|
||||||
|
else Console.WriteLine();
|
||||||
|
|
||||||
|
}
|
||||||
|
roundNumber++;
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine("=== ДУЭЛЬ ОКОНЧЕНА ===");
|
||||||
|
if (hp > enemyHp)
|
||||||
|
{
|
||||||
|
Console.WriteLine("$\"Победитель: {name}!\"");
|
||||||
|
}
|
||||||
|
else Console.WriteLine($"Победитель: {enemyName}!");
|
||||||
|
|
||||||
|
Console.WriteLine($"Победитель: ");
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user