complete stage 4

This commit is contained in:
2026-09-19 14:08:30 +03:00
parent 0916c2cdb1
commit 22d3814139
19 changed files with 420 additions and 33 deletions
+11 -4
View File
@@ -7,7 +7,6 @@
## Ключевой код ## Ключевой код
```csharp ```csharp
// Самая важная часть реализации (методы, структуры, логика)
Console.WriteLine("======================================================================"); Console.WriteLine("======================================================================");
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ ПОКЕМОНА"); Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ ПОКЕМОНА");
Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------");
@@ -38,7 +37,7 @@ int hp = int.Parse(Console.ReadLine());
string enemyName = ("Булбазавр"); string enemyName = ("Булбазавр");
int enemyHp = 70; int enemyHp = 70;
int enemyBaseDamage = 20; int enemyBaseDamage = 15;
int roundNumber = 1; int roundNumber = 1;
int actionChoice, attackChoice; int actionChoice, attackChoice;
bool isEnemyDebuffed = false; bool isEnemyDebuffed = false;
@@ -138,8 +137,15 @@ while (hp > 0 && enemyHp > 0)
Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2)."); Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2).");
break; break;
case 2: case 2:
hp -= (enemyBaseDamage - 20); if(enemyBaseDamage < 20)
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20."); {
Console.WriteLine($"Расчёт: Противник слишком слаб. Нанесено урона : 0.");
}
else
{
hp -= (enemyBaseDamage - 20);
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20.");
}
break; break;
case 3: case 3:
hp -= enemyBaseDamage; hp -= enemyBaseDamage;
@@ -167,3 +173,4 @@ else
Console.WriteLine($"Победитель: {name}!"); Console.WriteLine($"Победитель: {name}!");
Console.WriteLine("======================================================================"); Console.WriteLine("======================================================================");
```
@@ -28,7 +28,7 @@ int hp = int.Parse(Console.ReadLine());
string enemyName = ("Булбазавр"); string enemyName = ("Булбазавр");
int enemyHp = 70; int enemyHp = 70;
int enemyBaseDamage = 20; int enemyBaseDamage = 15;
int roundNumber = 1; int roundNumber = 1;
int actionChoice, attackChoice; int actionChoice, attackChoice;
bool isEnemyDebuffed = false; bool isEnemyDebuffed = false;
@@ -128,8 +128,15 @@ while (hp > 0 && enemyHp > 0)
Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2)."); Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2).");
break; break;
case 2: case 2:
hp -= (enemyBaseDamage - 20); if(enemyBaseDamage < 20)
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20."); {
Console.WriteLine($"Расчёт: Противник слишком слаб. Нанесено урона : 0.");
}
else
{
hp -= (enemyBaseDamage - 20);
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20.");
}
break; break;
case 3: case 3:
hp -= enemyBaseDamage; hp -= enemyBaseDamage;
+222 -1
View File
@@ -7,4 +7,225 @@
## Ключевой код ## Ключевой код
```csharp ```csharp
// Самая важная часть реализации (методы, структуры, логика) string[] activeTeam = new string[3];
List<string> backpack = new List<string>();
int[] pokedexHP = new int[3];
int[] pokedexDamage = new int[3];
string[] enemyNames = { "Мяут", "Геодуд", "Гарчомп" };
int[] enemyHPs = { 40, 65, 90 };
int[] enemyDamages = { 10, 15, 25 };
int[] enemyTypes = { 3, 1, 2 };
int currentEnemyIndex = 0;
int activeFighterIndex = 0;
int actionChoice, attackChoice;
string itemChoice;
Console.WriteLine("=== РЕГИСТРАЦИЯ НА СЕЗОН ЛИГИ ===");
for (int i = 0; i < 3; i++)
{
Console.Write($"Введите имя покемона №{i + 1}: ");
activeTeam[i] = Console.ReadLine();
Console.Write($"Введите макс. HP для {activeTeam[i]}: ");
pokedexHP[i] = int.Parse(Console.ReadLine());
Console.Write($"Введите базовый урон для {activeTeam[i]}: ");
pokedexDamage[i] = int.Parse(Console.ReadLine());;
Console.WriteLine();
}
backpack.Add("Зелье HP");
backpack.Add("Суперзелье");
backpack.Add("Антидот");
Console.WriteLine("Вы упаковали походную сумку тренера.");
Console.WriteLine("Предметов в инвентаре изначально: " + backpack.Count);
Console.ReadLine();
Console.Clear();
Console.WriteLine("Подготовка завершена! Ворота Арены открываются через...");
for (int i = 3; i > 0; i--)
{
Console.WriteLine(i + "...");
}
Console.WriteLine("======================================================================");
Console.WriteLine("=== ТУРНИР НАЧАЛСЯ ===");
while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{
Console.WriteLine($"=== ЭТАП {currentEnemyIndex + 1} ===");
Console.WriteLine($"Ваш активный боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]}) VS Дикий {enemyNames[currentEnemyIndex]} (HP: {enemyHPs[currentEnemyIndex]})");
Console.WriteLine("----------------------------------------------------------------------");
while (pokedexHP[activeFighterIndex] > 0 && enemyHPs[currentEnemyIndex] > 0)
{
do
{
Console.Write("Выберите действие (1 - Атака, 2 - Сумка, 3 - Смена Покемона): ");
actionChoice = int.Parse(Console.ReadLine());
} while (actionChoice != 1 && actionChoice != 2 && actionChoice != 3 );
switch (actionChoice)
{
case 1:
do
{
Console.Write("Проверка точности (1 - Критический урон, 0 - Обычный): ");
attackChoice = int.Parse(Console.ReadLine());
} while (attackChoice != 0 && attackChoice != 1);
if (attackChoice == 0)
{
enemyHPs[currentEnemyIndex] -= pokedexDamage[activeFighterIndex];
Console.WriteLine($"Результат: Нанесено урона: {pokedexDamage[activeFighterIndex]}");
}
else
{
enemyHPs[currentEnemyIndex] -= (pokedexDamage[activeFighterIndex] + 15);
Console.WriteLine($"Результат: Критический удар! Нанесено урона: {pokedexDamage[activeFighterIndex] + 15}");
}
break;
case 2:
if (backpack.Count > 0)
{
Console.WriteLine("--- Содержимое вашей сумки ---");
foreach (var item in backpack)
{
Console.WriteLine($"[Предмет] -> {item}");
}
Console.Write("Какой предмет использовать? Введите название: ");
itemChoice = Console.ReadLine();
switch (itemChoice)
{
case "Зелье HP":
backpack.Remove(itemChoice);
Console.WriteLine($"Результат: {activeTeam[activeFighterIndex]} восстановил 30 HP! Предмет удален из сумки.");
pokedexHP[activeFighterIndex] += 30;
break;
case "Суперзелье":
backpack.Remove(itemChoice);
Console.WriteLine($"Результат: {activeTeam[activeFighterIndex]} восстановил 60 HP! Предмет удален из сумки.");
pokedexHP[activeFighterIndex] += 60;
break;
case "Антидот":
backpack.Remove(itemChoice);
Console.WriteLine($"Результат: {activeTeam[activeFighterIndex]} выпивает антидот! Предмет удален из сумки.");
break;
default:
Console.WriteLine("Такого предмета нет в сумке.");
break;
}
}
else
Console.WriteLine("Ваш рюкзак пуст.");
break;
case 3:
Console.WriteLine("--- Ваша команда ---");
for (int i = 0; i < activeTeam.Length; i++)
{
Console.WriteLine($" {i + 1}. {activeTeam[i]} HP: {pokedexHP[i]}");
}
do
{
Console.Write("Введите номер замены: ");
attackChoice = int.Parse(Console.ReadLine());
if (attackChoice >= 1 && attackChoice <= 3 && pokedexHP[attackChoice - 1] <= 0)
Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца.");
else if (attackChoice < 1 || attackChoice > 3)
Console.WriteLine("Неверный номер. Введите число от 1 до 3.");
} while (attackChoice < 1 | attackChoice > 3 | pokedexHP[attackChoice - 1] <= 0);
if (pokedexHP[attackChoice - 1] > 0)
{
activeFighterIndex = attackChoice - 1;
Console.WriteLine($"Ваш текущий боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]})");
}
break;
}
if (enemyHPs[currentEnemyIndex] <= 0)
{
enemyHPs[currentEnemyIndex] = 0;
Console.WriteLine($"Дикий {enemyNames[currentEnemyIndex]} нокаутирован! Вы переходите на следующий этап!\n");
break;
}
Console.WriteLine($"\nДикий {enemyNames[currentEnemyIndex]} проводит контратаку!");
attackChoice = enemyTypes[currentEnemyIndex];
switch (attackChoice)
{
case 1:
pokedexHP[activeFighterIndex] -= enemyDamages[currentEnemyIndex] * 2;
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается.");
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] * 2}");
break;
case 2:
if (enemyDamages[currentEnemyIndex] < 10)
{
Console.WriteLine($"{activeTeam[activeFighterIndex]} не получает урона!");
}
else
{
pokedexHP[activeFighterIndex] -= (enemyDamages[currentEnemyIndex] - 10);
Console.WriteLine("Расчёт: Стальной тип! Урон снижается на 10 единиц.");
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] - 10}");
}
break;
case 3:
pokedexHP[activeFighterIndex] -= enemyDamages[currentEnemyIndex];
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex]}");
break;
}
if (pokedexHP[activeFighterIndex] <= 0)
{
pokedexHP[activeFighterIndex] = 0;
if((pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{Console.WriteLine($"{activeTeam[activeFighterIndex]} нокаутирован. Выберите другого бойца.");
Console.WriteLine("--- Ваша команда ---");
for (int i = 0; i < activeTeam.Length; i++)
{
Console.WriteLine($" {i + 1}. {activeTeam[i]} HP: {pokedexHP[i]}");
}
do
{
Console.Write("Введите номер замены: ");
attackChoice = int.Parse(Console.ReadLine());
if (attackChoice >= 1 && attackChoice <= 3 && pokedexHP[attackChoice - 1] <= 0)
Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца.");
else if (attackChoice < 1 || attackChoice > 3)
Console.WriteLine("Неверный номер. Введите число от 1 до 3.");
} while (attackChoice < 1 | attackChoice > 3 | pokedexHP[attackChoice - 1] <= 0);
if (pokedexHP[attackChoice - 1] > 0)
{
activeFighterIndex = attackChoice - 1;
Console.WriteLine($"Ваш текущий боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]})");
}
}
else
{
Console.WriteLine($"Команда потерпела поражение от {enemyNames[currentEnemyIndex]}. Попробуйте еще раз.");
break;
}
}
Console.WriteLine("----------------------------------------------------------------------");
Console.WriteLine($"Текущий статус: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]}) | {enemyNames[currentEnemyIndex]} (HP: {enemyHPs[currentEnemyIndex]})\n");
}
if (pokedexHP[0] == 0 && pokedexHP[1] == 0 && pokedexHP[2] == 0)
break;
currentEnemyIndex++;
}
if((pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{
Console.WriteLine("\n======================================================================");
Console.WriteLine("=== ТУРНИР ОКОНЧЕН ===");
Console.WriteLine("Вы победили всех боссов Лиги и стали Чемпионом!");
Console.WriteLine("======================================================================");
}
```
** Рис.1 Ввод данных**
![Ввод данных ](screenshots/1.png)
** Рис.2 Начало турнира по аналогии с эталоном**
![Первый этап ](screenshots/2.png)
** Рис.3 Завершение турнира**
![Завершение ](screenshots/3.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.
@@ -0,0 +1,58 @@
{
"Version": 1,
"WorkspaceRootPath": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|g:\\prog\\sharp-pribytkova\\works\\stage-04\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|g:\\prog\\sharp-pribytkova\\works\\stage-04\\readme.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|solutionrelative:readme.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{b1e99781-ab81-11d0-b683-00aa00a3ee26}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AgIAAHUAAAAAAAAAAAAuwIMAAAB3AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-09-15T15:42:51.728Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Readme.md",
"DocumentMoniker": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Readme.md",
"RelativeDocumentMoniker": "Readme.md",
"ToolTip": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Readme.md",
"RelativeToolTip": "Readme.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-09-15T15:42:48.673Z",
"EditorCaption": ""
}
]
}
]
}
]
}
@@ -0,0 +1,58 @@
{
"Version": 1,
"WorkspaceRootPath": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|g:\\prog\\sharp-pribytkova\\works\\stage-04\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|g:\\prog\\sharp-pribytkova\\works\\stage-04\\readme.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}|stage-04.csproj|solutionrelative:readme.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Readme.md",
"DocumentMoniker": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Readme.md",
"RelativeDocumentMoniker": "Readme.md",
"ToolTip": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Readme.md",
"RelativeToolTip": "Readme.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-09-15T15:42:48.673Z",
"EditorCaption": ""
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{b1e99781-ab81-11d0-b683-00aa00a3ee26}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "G:\\prog\\sharp-pribytkova\\works\\stage-04\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AgIAAHUAAAAAAAAAAAAuwIMAAAB3AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-09-15T15:42:51.728Z",
"EditorCaption": ""
}
]
}
]
}
]
}
@@ -13,7 +13,6 @@ int[] enemyTypes = { 3, 1, 2 };
int currentEnemyIndex = 0; int currentEnemyIndex = 0;
int activeFighterIndex = 0; int activeFighterIndex = 0;
int roundNumber = 1;
int actionChoice, attackChoice; int actionChoice, attackChoice;
string itemChoice; string itemChoice;
@@ -41,12 +40,12 @@ for (int i = 3; i > 0; i--)
{ {
Console.WriteLine(i + "..."); Console.WriteLine(i + "...");
} }
Console.WriteLine("\n======================================================================"); Console.WriteLine("======================================================================");
Console.WriteLine("=== ТУРНИР НАЧАЛСЯ ===");
while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0)) while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{ {
Console.WriteLine($"=== ТУРНИР НАЧАЛСЯ: ЭТАП {roundNumber} ==="); Console.WriteLine($"=== ЭТАП {currentEnemyIndex + 1} ===");
Console.WriteLine($"Ваш активный боец: {activeTeam[0]} (HP: {pokedexHP[0]}) VS Дикий {enemyNames[0]} (HP: {enemyHPs[0]})"); Console.WriteLine($"Ваш активный боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]}) VS Дикий {enemyNames[currentEnemyIndex]} (HP: {enemyHPs[currentEnemyIndex]})");
Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("----------------------------------------------------------------------");
while (pokedexHP[activeFighterIndex] > 0 && enemyHPs[currentEnemyIndex] > 0) while (pokedexHP[activeFighterIndex] > 0 && enemyHPs[currentEnemyIndex] > 0)
{ {
@@ -101,6 +100,9 @@ while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP
backpack.Remove(itemChoice); backpack.Remove(itemChoice);
Console.WriteLine($"Результат: {activeTeam[activeFighterIndex]} выпивает антидот! Предмет удален из сумки."); Console.WriteLine($"Результат: {activeTeam[activeFighterIndex]} выпивает антидот! Предмет удален из сумки.");
break; break;
default:
Console.WriteLine("Такого предмета нет в сумке.");
break;
} }
} }
else else
@@ -116,13 +118,15 @@ while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP
{ {
Console.Write("Введите номер замены: "); Console.Write("Введите номер замены: ");
attackChoice = int.Parse(Console.ReadLine()); attackChoice = int.Parse(Console.ReadLine());
if (pokedexHP[attackChoice - 1] < 0) if (attackChoice >= 1 && attackChoice <= 3 && pokedexHP[attackChoice - 1] <= 0)
Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца."); Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца.");
} while (attackChoice != 1 && attackChoice != 2 && attackChoice != 3 && pokedexHP[attackChoice - 1] > 0); else if (attackChoice < 1 || attackChoice > 3)
Console.WriteLine("Неверный номер. Введите число от 1 до 3.");
} while (attackChoice < 1 | attackChoice > 3 | pokedexHP[attackChoice - 1] <= 0);
if (pokedexHP[attackChoice - 1] > 0) if (pokedexHP[attackChoice - 1] > 0)
{ {
activeFighterIndex = attackChoice; activeFighterIndex = attackChoice - 1;
Console.WriteLine($"Ваш текущий боец: {activeTeam[activeFighterIndex]} HP: {pokedexHP[activeFighterIndex]}"); Console.WriteLine($"Ваш текущий боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]})");
} }
break; break;
} }
@@ -130,12 +134,11 @@ while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP
if (enemyHPs[currentEnemyIndex] <= 0) if (enemyHPs[currentEnemyIndex] <= 0)
{ {
enemyHPs[currentEnemyIndex] = 0; enemyHPs[currentEnemyIndex] = 0;
Console.WriteLine($"Дикий {enemyNames[currentEnemyIndex]} нокаутирован! Вы переходите на следующий этап!"); Console.WriteLine($"Дикий {enemyNames[currentEnemyIndex]} нокаутирован! Вы переходите на следующий этап!\n");
currentEnemyIndex++;
break; break;
} }
Console.WriteLine($"Дикий {enemyNames[currentEnemyIndex]} проводит контратаку!"); Console.WriteLine($"\nДикий {enemyNames[currentEnemyIndex]} проводит контратаку!");
attackChoice = enemyTypes[currentEnemyIndex]; attackChoice = enemyTypes[currentEnemyIndex];
switch (attackChoice) switch (attackChoice)
{ {
@@ -145,9 +148,16 @@ while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] * 2}"); Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] * 2}");
break; break;
case 2: case 2:
pokedexHP[activeFighterIndex] -= (enemyDamages[currentEnemyIndex] - 10); if (enemyDamages[currentEnemyIndex] < 10)
Console.WriteLine("Расчёт: Стальной тип! Урон снижается на 10 единиц."); {
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] - 10}"); Console.WriteLine($"{activeTeam[activeFighterIndex]} не получает урона!");
}
else
{
pokedexHP[activeFighterIndex] -= (enemyDamages[currentEnemyIndex] - 10);
Console.WriteLine("Расчёт: Стальной тип! Урон снижается на 10 единиц.");
Console.WriteLine($"{activeTeam[activeFighterIndex]} получил урон: {enemyDamages[currentEnemyIndex] - 10}");
}
break; break;
case 3: case 3:
pokedexHP[activeFighterIndex] -= enemyDamages[currentEnemyIndex]; pokedexHP[activeFighterIndex] -= enemyDamages[currentEnemyIndex];
@@ -158,20 +168,46 @@ while (currentEnemyIndex < 3 && (pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP
if (pokedexHP[activeFighterIndex] <= 0) if (pokedexHP[activeFighterIndex] <= 0)
{ {
pokedexHP[activeFighterIndex] = 0; pokedexHP[activeFighterIndex] = 0;
Console.WriteLine($"{pokedexHP[activeFighterIndex]} нокаутирован. Выберите другого бойца."); if((pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{Console.WriteLine($"{activeTeam[activeFighterIndex]} нокаутирован. Выберите другого бойца.");
Console.WriteLine("--- Ваша команда ---");
for (int i = 0; i < activeTeam.Length; i++)
{
Console.WriteLine($" {i + 1}. {activeTeam[i]} HP: {pokedexHP[i]}");
}
do do
{ {
Console.Write("Введите номер замены: "); Console.Write("Введите номер замены: ");
attackChoice = int.Parse(Console.ReadLine()); attackChoice = int.Parse(Console.ReadLine());
if (pokedexHP[attackChoice - 1] < 0) if (attackChoice >= 1 && attackChoice <= 3 && pokedexHP[attackChoice - 1] <= 0)
Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца."); Console.WriteLine($"{activeTeam[attackChoice - 1]} в нокауте. Выберите другого бойца.");
} while (attackChoice != 1 && attackChoice != 2 && attackChoice != 3 && pokedexHP[attackChoice - 1] > 0); else if (attackChoice < 1 || attackChoice > 3)
break; Console.WriteLine("Неверный номер. Введите число от 1 до 3.");
} } while (attackChoice < 1 | attackChoice > 3 | pokedexHP[attackChoice - 1] <= 0);
if (pokedexHP[attackChoice - 1] > 0)
{
activeFighterIndex = attackChoice - 1;
Console.WriteLine($"Ваш текущий боец: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]})");
}
}
else
{
Console.WriteLine($"Команда потерпела поражение от {enemyNames[currentEnemyIndex]}. Попробуйте еще раз.");
break;
}
}
Console.WriteLine("----------------------------------------------------------------------");
Console.WriteLine($"Текущий статус: {activeTeam[activeFighterIndex]} (HP: {pokedexHP[activeFighterIndex]}) | {enemyNames[currentEnemyIndex]} (HP: {enemyHPs[currentEnemyIndex]})\n");
} }
if (pokedexHP[0] == 0 && pokedexHP[1] == 0 && pokedexHP[2] == 0) if (pokedexHP[0] == 0 && pokedexHP[1] == 0 && pokedexHP[2] == 0)
Console.WriteLine($"Команда потерпела поражение от {enemyNames[currentEnemyIndex]}. Попробуйте еще раз."); break;
break; currentEnemyIndex++;
roundNumber++; }
if((pokedexHP[0] > 0 | pokedexHP[1] > 0 | pokedexHP[2] > 0))
{
Console.WriteLine("\n======================================================================");
Console.WriteLine("=== ТУРНИР ОКОНЧЕН ===");
Console.WriteLine("Вы победили всех боссов Лиги и стали Чемпионом!");
Console.WriteLine("======================================================================");
} }