Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9131c45fa6 | ||
|
|
78a605a10c | ||
|
|
22d3814139 | ||
|
|
0916c2cdb1 | ||
|
|
381a74b74f | ||
|
|
95bcfd638a | ||
|
|
0abbdfbcf4 | ||
|
|
05baab2f06 | ||
|
|
41ba86a5cc | ||
|
|
06d86d4e2e | ||
|
|
06ef1dc35e | ||
|
|
50e11179a9 |
@@ -6,5 +6,11 @@
|
||||
* [Лабораторная работа №1](./works/lab-01)
|
||||
* [Лабораторная работа №2](./works/lab-02)
|
||||
* [Лабораторная работа №3](./works/lab-03)
|
||||
* [Лабораторная работа №4](./works/lab-04)
|
||||
* [Лабораторная работа №5](./works/lab-05)
|
||||
|
||||
* [Стадия №1](./works/stage-01)
|
||||
* [Стадия №1](./works/stage-01)
|
||||
* [Стадия №2](./works/stage-02)
|
||||
* [Стадия №3](./works/stage-03)
|
||||
* [Стадия №4](./works/stage-04)
|
||||
* [Стадия №5](./works/stage-05)
|
||||
@@ -1,7 +1,7 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** Прибыткова Елизавета
|
||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
||||
* **Тема:** [Введение в язык C#. Переменные, базовые типы данных и консольный ввод/вывод информации]
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Лабораторная работа №2
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace lesson3
|
||||
{
|
||||
internal class Program
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@@ -16,26 +9,23 @@ namespace lesson3
|
||||
int pokemon2Hp = 55;
|
||||
int pokemon2Attack = 10;
|
||||
int roundNumber = 1;
|
||||
|
||||
int actionChoise;
|
||||
//задание 2
|
||||
do
|
||||
{
|
||||
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
|
||||
int check = int.Parse(Console.ReadLine());
|
||||
if (check == 0)
|
||||
{
|
||||
Console.WriteLine("\nВы отменили бой!");
|
||||
break;
|
||||
}
|
||||
else if (check == 1)
|
||||
{
|
||||
Console.WriteLine("\nВы приняли бой!");
|
||||
break;
|
||||
}
|
||||
else
|
||||
Console.WriteLine("\nНекорректная команда! Попробуйте снова.");
|
||||
}while (true);
|
||||
|
||||
actionChoise = int.Parse(Console.ReadLine());
|
||||
if (actionChoise != 1 && actionChoise != 0)
|
||||
Console.WriteLine("Некорректная команда! Попробуйте снова.");
|
||||
}while (actionChoise != 1 && actionChoise != 0);
|
||||
if (actionChoise == 0)
|
||||
{
|
||||
Console.WriteLine("\nВы отменили бой!");
|
||||
}
|
||||
else if (actionChoise == 1)
|
||||
{
|
||||
Console.WriteLine("\nВы приняли бой!");
|
||||
}
|
||||
//задание 1
|
||||
Console.WriteLine("Приготовьтесь!");
|
||||
for (int i = 3; i > 0; i--)
|
||||
@@ -45,14 +35,12 @@ namespace lesson3
|
||||
Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ===");
|
||||
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
|
||||
|
||||
|
||||
|
||||
|
||||
//задание 3
|
||||
while (pokemon1Hp > 0 && pokemon2Hp > 0)
|
||||
{
|
||||
|
||||
Console.WriteLine($"--- Раунд {roundNumber} ---");
|
||||
Console.WriteLine($"\n--- Раунд {roundNumber} ---");
|
||||
Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!");
|
||||
pokemon2Hp -= pokemon1Attack;
|
||||
if (pokemon2Hp <= 0)
|
||||
@@ -74,12 +62,9 @@ namespace lesson3
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}");
|
||||
Console.WriteLine();
|
||||
roundNumber ++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
# Лабораторная работа №3
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
||||
* **Тема: ** [Циклы и управление потоком выполнения. Игровой цикл пошагового боя]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
// Самая важная часть реализации (методы, структуры, логика)
|
||||
internal class Program
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@@ -19,25 +19,23 @@
|
||||
int pokemon2Hp = 55;
|
||||
int pokemon2Attack = 10;
|
||||
int roundNumber = 1;
|
||||
|
||||
int actionChoise;
|
||||
//задание 2
|
||||
do
|
||||
{
|
||||
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
|
||||
int check = int.Parse(Console.ReadLine());
|
||||
if (check == 0)
|
||||
{
|
||||
Console.WriteLine("\nВы отменили бой!");
|
||||
break;
|
||||
}
|
||||
else if (check == 1)
|
||||
{
|
||||
Console.WriteLine("\nВы приняли бой!");
|
||||
break;
|
||||
}
|
||||
else
|
||||
Console.WriteLine("\nНекорректная команда! Попробуйте снова.");
|
||||
}while (true);
|
||||
actionChoise = int.Parse(Console.ReadLine());
|
||||
if (actionChoise != 1 && actionChoise != 0)
|
||||
Console.WriteLine("Некорректная команда! Попробуйте снова.");
|
||||
}while (actionChoise != 1 && actionChoise != 0);
|
||||
if (actionChoise == 0)
|
||||
{
|
||||
Console.WriteLine("\nВы отменили бой!");
|
||||
}
|
||||
else if (actionChoise == 1)
|
||||
{
|
||||
Console.WriteLine("\nВы приняли бой!");
|
||||
}
|
||||
//задание 1
|
||||
Console.WriteLine("Приготовьтесь!");
|
||||
for (int i = 3; i > 0; i--)
|
||||
@@ -46,15 +44,15 @@
|
||||
}
|
||||
Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ===");
|
||||
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//задание 3
|
||||
while (pokemon1Hp > 0 && pokemon2Hp > 0)
|
||||
{
|
||||
|
||||
Console.WriteLine($"--- Раунд {roundNumber} ---");
|
||||
Console.WriteLine($"\n--- Раунд {roundNumber} ---");
|
||||
Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!");
|
||||
pokemon2Hp -= pokemon1Attack;
|
||||
if (pokemon2Hp <= 0)
|
||||
@@ -76,10 +74,9 @@
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}");
|
||||
Console.WriteLine();
|
||||
roundNumber ++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>lab_03</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-03", "lab-03.csproj", "{B6FA26AE-3C54-4581-A137-151FA8AB7EB3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B6FA26AE-3C54-4581-A137-151FA8AB7EB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B6FA26AE-3C54-4581-A137-151FA8AB7EB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B6FA26AE-3C54-4581-A137-151FA8AB7EB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B6FA26AE-3C54-4581-A137-151FA8AB7EB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
After Width: | Height: | Size: 38 KiB |
@@ -0,0 +1,36 @@
|
||||
# Лабораторная работа №4
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Тема:** [Массивы и динамические списки. Цикл foreach и работа с коллекциями данных]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
// Самая важная часть реализации (методы, структуры, логика)
|
||||
|
||||
Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ===");
|
||||
string[] activeTeam = new string[3];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Console.Write($"Введите имя покемона №{i + 1}: ");
|
||||
activeTeam[i] = Console.ReadLine();
|
||||
}
|
||||
Console.WriteLine("\n--- Ваша команда на этот бой ---");
|
||||
Console.WriteLine($"1. {activeTeam[0]}\n2. {activeTeam[1]}\n3. {activeTeam[2]}\n");
|
||||
|
||||
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
||||
List<string> backpack = new List<string>();
|
||||
backpack.Add("Зелье HP");
|
||||
backpack.Add("Покебол");
|
||||
backpack.Add("Антидот");
|
||||
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {backpack.Count}");
|
||||
Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!");
|
||||
backpack.Remove("Покебол");
|
||||
Console.WriteLine($"Обновленный инвентарь. Осталось предметов: {backpack.Count}");
|
||||
Console.WriteLine("\n--- Содержимое вашей сумки ---");
|
||||
foreach (var item in backpack)
|
||||
{
|
||||
Console.WriteLine($"[Предмет] -> {item}");
|
||||
}
|
||||
Console.WriteLine("=============================");
|
||||
@@ -0,0 +1,25 @@
|
||||
Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ===");
|
||||
string[] activeTeam = new string[3];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Console.Write($"Введите имя покемона №{i + 1}: ");
|
||||
activeTeam[i] = Console.ReadLine();
|
||||
}
|
||||
Console.WriteLine("\n--- Ваша команда на этот бой ---");
|
||||
Console.WriteLine($"1. {activeTeam[0]}\n2. {activeTeam[1]}\n3. {activeTeam[2]}\n");
|
||||
|
||||
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
||||
List<string> backpack = new List<string>();
|
||||
backpack.Add("Зелье HP");
|
||||
backpack.Add("Покебол");
|
||||
backpack.Add("Антидот");
|
||||
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {backpack.Count}");
|
||||
Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!");
|
||||
backpack.Remove("Покебол");
|
||||
Console.WriteLine($"Обновленный инвентарь. Осталось предметов: {backpack.Count}");
|
||||
Console.WriteLine("\n--- Содержимое вашей сумки ---");
|
||||
foreach (var item in backpack)
|
||||
{
|
||||
Console.WriteLine($"[Предмет] -> {item}");
|
||||
}
|
||||
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>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab04", "lab04.csproj", "{9DC3F0BA-0111-417C-A81E-6B2C9374996A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9DC3F0BA-0111-417C-A81E-6B2C9374996A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DC3F0BA-0111-417C-A81E-6B2C9374996A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DC3F0BA-0111-417C-A81E-6B2C9374996A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DC3F0BA-0111-417C-A81E-6B2C9374996A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
After Width: | Height: | Size: 38 KiB |
@@ -0,0 +1,56 @@
|
||||
# Лабораторная работа №5
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Тема:** [Функции и методы в C#. Возвращаемые значения и модификаторы параметров (ref, out, in, params)]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
|
||||
int pokemonHP = 20;
|
||||
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
|
||||
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
|
||||
HealPokemon(ref pokemonHP);
|
||||
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
|
||||
|
||||
Console.WriteLine("\n=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
|
||||
Console.WriteLine("Вы зашли в высокую траву...");
|
||||
SearchBushes(out string foundPokemon, out int pokemonLevel);
|
||||
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
|
||||
|
||||
Console.WriteLine("\n=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
|
||||
double difficulty = 1.5;
|
||||
RegisterTournament(difficulty, "Булбазавр", "Чармандер" );
|
||||
Console.WriteLine("-----------------------------");
|
||||
RegisterTournament(difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут" );
|
||||
Console.WriteLine("=============================");
|
||||
|
||||
void HealPokemon(ref int pokemonHP)
|
||||
{
|
||||
if (pokemonHP >= 100)
|
||||
return;
|
||||
pokemonHP += 80;
|
||||
if (pokemonHP > 100)
|
||||
pokemonHP = 100;
|
||||
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
|
||||
}
|
||||
|
||||
void SearchBushes(out string foundPokemon, out int pokemonLevel)
|
||||
{
|
||||
foundPokemon = "Пикачу";
|
||||
pokemonLevel = new Random().Next(1, 15);
|
||||
}
|
||||
|
||||
void RegisterTournament(in double difficulty, params string[] participants)
|
||||
{
|
||||
//difficulty = 3;
|
||||
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
|
||||
foreach (var pokemon in participants )
|
||||
{
|
||||
Console.WriteLine($"* {pokemon}");
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||

|
||||
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,44 @@
|
||||
|
||||
int pokemonHP = 20;
|
||||
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
|
||||
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
|
||||
HealPokemon(ref pokemonHP);
|
||||
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
|
||||
|
||||
Console.WriteLine("\n=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
|
||||
Console.WriteLine("Вы зашли в высокую траву...");
|
||||
SearchBushes(out string foundPokemon, out int pokemonLevel);
|
||||
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
|
||||
|
||||
Console.WriteLine("\n=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
|
||||
double difficulty = 1.5;
|
||||
RegisterTournament(difficulty, "Булбазавр", "Чармандер" );
|
||||
Console.WriteLine("-----------------------------");
|
||||
RegisterTournament(difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут" );
|
||||
Console.WriteLine("=============================");
|
||||
|
||||
void HealPokemon(ref int pokemonHP)
|
||||
{
|
||||
if (pokemonHP >= 100)
|
||||
return;
|
||||
pokemonHP += 80;
|
||||
if (pokemonHP > 100)
|
||||
pokemonHP = 100;
|
||||
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
|
||||
}
|
||||
|
||||
void SearchBushes(out string foundPokemon, out int pokemonLevel)
|
||||
{
|
||||
foundPokemon = "Пикачу";
|
||||
pokemonLevel = new Random().Next(1, 15);
|
||||
}
|
||||
|
||||
void RegisterTournament(in double difficulty, params string[] participants)
|
||||
{
|
||||
//difficulty = 3;
|
||||
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
|
||||
foreach (var pokemon in participants )
|
||||
{
|
||||
Console.WriteLine($"* {pokemon}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>lab_05</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-05", "lab-05.csproj", "{D73CF250-78BC-4A3A-A9C4-679C3BBA1CC0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D73CF250-78BC-4A3A-A9C4-679C3BBA1CC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D73CF250-78BC-4A3A-A9C4-679C3BBA1CC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D73CF250-78BC-4A3A-A9C4-679C3BBA1CC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D73CF250-78BC-4A3A-A9C4-679C3BBA1CC0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,7 +1,7 @@
|
||||
# Stage №1
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Карточка:** #025 Pikachu
|
||||
* **Техническое задание: ** [Оцифровка карточки Pokémon TCG]
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# Stage №2
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Техническое задание: ** [Интерактивная механика карточки Pokémon TCG]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
// Самая важная часть реализации (методы, структуры, логика)
|
||||
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите название первой атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите название второй атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write($"Введите текущее текущее HP {name}: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
Console.Write($"Введите базовый урон атаки \"{attack2Name}\": ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
|
||||
Console.WriteLine("\n----------------------------------------------------------------------");
|
||||
Console.WriteLine("ИСПОЛЬЗОВАНИЕ АТАК");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1: {attack1Name}]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
int coinResult = Convert.ToInt16(Console.ReadLine());
|
||||
if (coinResult == 1)
|
||||
Console.WriteLine("Результат: Активный Покемон противника парализован!");
|
||||
else
|
||||
Console.WriteLine("Результат: Эффект паралича не сработал.");
|
||||
|
||||
Console.WriteLine($"\n[Атака 2: {attack2Name}]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
coinResult = int.Parse(Console.ReadLine());
|
||||
if (coinResult == 1)
|
||||
Console.WriteLine($"Результат: Выпал орёл! Итоговый урон: {attack2BaseDamage + 10}");
|
||||
else
|
||||
Console.WriteLine($"Результат: Выпала решка! Итоговый урон: {attack2BaseDamage}");
|
||||
|
||||
Console.WriteLine("\n----------------------------------------------------------------------");
|
||||
Console.WriteLine("ПОЛУЧЕНИЕ УРОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write("Введите базовый урон атаки противника: ");
|
||||
int incomingDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): ");
|
||||
int attackType = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine();
|
||||
int finalIncomingDamage = incomingDamage;
|
||||
switch (attackType)
|
||||
{
|
||||
case 1:
|
||||
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается (x2).");
|
||||
finalIncomingDamage *= 2;
|
||||
break;
|
||||
case 2:
|
||||
Console.WriteLine("Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).");
|
||||
finalIncomingDamage -= 20;
|
||||
break;
|
||||
case 3:
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Получено урона: {finalIncomingDamage}");
|
||||
hp -= finalIncomingDamage;
|
||||
if (hp <= 0)
|
||||
Console.WriteLine("Пикачу нокаутирован!");
|
||||
else
|
||||
Console.WriteLine($"Пикачу выдержал удар! Остаток HP: {hp}");
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
|
||||
|
After Width: | Height: | Size: 51 KiB |
@@ -0,0 +1,68 @@
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите название первой атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите название второй атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write($"Введите текущее текущее HP {name}: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
Console.Write($"Введите базовый урон атаки \"{attack2Name}\": ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
|
||||
Console.WriteLine("\n----------------------------------------------------------------------");
|
||||
Console.WriteLine("ИСПОЛЬЗОВАНИЕ АТАК");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1: {attack1Name}]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
int coinResult = Convert.ToInt16(Console.ReadLine());
|
||||
if (coinResult == 1)
|
||||
Console.WriteLine("Результат: Активный Покемон противника парализован!");
|
||||
else
|
||||
Console.WriteLine("Результат: Эффект паралича не сработал.");
|
||||
|
||||
Console.WriteLine($"\n[Атака 2: {attack2Name}]");
|
||||
Console.Write("Бросок монеты (1 - Орёл, 0 - Решка): ");
|
||||
coinResult = int.Parse(Console.ReadLine());
|
||||
if (coinResult == 1)
|
||||
Console.WriteLine($"Результат: Выпал орёл! Итоговый урон: {attack2BaseDamage + 10}");
|
||||
else
|
||||
Console.WriteLine($"Результат: Выпала решка! Итоговый урон: {attack2BaseDamage}");
|
||||
|
||||
Console.WriteLine("\n----------------------------------------------------------------------");
|
||||
Console.WriteLine("ПОЛУЧЕНИЕ УРОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write("Введите базовый урон атаки противника: ");
|
||||
int incomingDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): ");
|
||||
int attackType = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine();
|
||||
int finalIncomingDamage = incomingDamage;
|
||||
switch (attackType)
|
||||
{
|
||||
case 1:
|
||||
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается (x2).");
|
||||
finalIncomingDamage *= 2;
|
||||
break;
|
||||
case 2:
|
||||
Console.WriteLine("Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).");
|
||||
finalIncomingDamage -= 20;
|
||||
break;
|
||||
case 3:
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Получено урона: {finalIncomingDamage}");
|
||||
hp -= finalIncomingDamage;
|
||||
if (hp <= 0)
|
||||
Console.WriteLine("Пикачу нокаутирован!");
|
||||
else
|
||||
Console.WriteLine($"Пикачу выдержал удар! Остаток HP: {hp}");
|
||||
|
||||
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>
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stage2", "stage2.csproj", "{A19ADC2F-937C-43F7-AC59-BCCA519F9E2F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A19ADC2F-937C-43F7-AC59-BCCA519F9E2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A19ADC2F-937C-43F7-AC59-BCCA519F9E2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A19ADC2F-937C-43F7-AC59-BCCA519F9E2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,176 @@
|
||||
# Stage №3
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Техническое задание:** Универсальный игровой цикл дуэли Pokémon TCG (Абстрактная модель)
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
Console.WriteLine("======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ ПОКЕМОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write("Введите стадию развития: ");
|
||||
string stage = Console.ReadLine();
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите вид покемона: ");
|
||||
string category = Console.ReadLine();
|
||||
Console.Write("Введите название 1-й атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите эффект 1-й атаки: ");
|
||||
string attack1Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон 1-й атаки: ");
|
||||
int attack1BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите название 2-й атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
Console.Write("Введите эффект 2-й атаки: ");
|
||||
string attack2Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон 2-й атаки: ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите уязвимость: ");
|
||||
string weakness = Console.ReadLine();
|
||||
Console.Write("Введите устойчивость: ");
|
||||
string resistance = Console.ReadLine();
|
||||
Console.Write("Введите текущее HP: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
|
||||
string enemyName = ("Булбазавр");
|
||||
int enemyHp = 70;
|
||||
int enemyBaseDamage = 15;
|
||||
int roundNumber = 1;
|
||||
int actionChoice, attackChoice;
|
||||
bool isEnemyDebuffed = false;
|
||||
|
||||
Console.Clear();
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine($"[{stage}] {name} ОЖ: {hp}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"Вид: {category}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1] {attack1Name} Урон: {attack1BaseDamage}");
|
||||
Console.WriteLine($"Эффект: {attack1Desc}");
|
||||
Console.WriteLine($"\n[Атака 2] {attack2Name} Урон: {attack2BaseDamage}+");
|
||||
Console.WriteLine($"Эффект: {attack2Desc}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"Слабость: {weakness} | Устойчивость: {resistance}");
|
||||
Console.WriteLine("======================================================================");
|
||||
|
||||
Console.WriteLine("\nПриготовьтесь к дуэли!");
|
||||
for (int i = 3; i > 0; i--)
|
||||
{
|
||||
Console.WriteLine(i + "...");
|
||||
}
|
||||
Console.WriteLine($"\n=== СТАРТ ДУЭЛИ: {name} (HP: {hp}) VS {enemyName} (HP: {enemyHp}) ===");
|
||||
|
||||
while (hp > 0 && enemyHp > 0)
|
||||
{
|
||||
Console.WriteLine($"\n--- Раунд {roundNumber} ---");
|
||||
do
|
||||
{
|
||||
Console.Write("Выберите действие (1 - Угольки, 2 - Огненный Клык): ");
|
||||
attackChoice = int.Parse(Console.ReadLine());
|
||||
} while (attackChoice != 1 && attackChoice != 2);
|
||||
|
||||
if (attackChoice == 1)
|
||||
{
|
||||
enemyHp -= attack1BaseDamage;
|
||||
do
|
||||
{
|
||||
Console.Write($"[{attack1Name}] Проверка условия спецэффекта (1 - Сработал, 0 - Нет): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 0 && actionChoice != 1);
|
||||
|
||||
if (actionChoice == 0)
|
||||
Console.WriteLine("Результат: Спецэффект не сработал.");
|
||||
else
|
||||
{
|
||||
isEnemyDebuffed = true;
|
||||
Console.WriteLine($"Результат: Спецэффект сработал! {enemyName} потерял возможность атаковать!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Write($"[{attack2Name}] Проверка условия спецэффекта (1 - Критический урон, 0 - Обычный): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 0 && actionChoice != 1);
|
||||
|
||||
if (actionChoice == 0)
|
||||
{
|
||||
enemyHp -= attack2BaseDamage;
|
||||
Console.WriteLine("Результат: Базовый урон: " + attack2BaseDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
enemyHp -= (attack2BaseDamage + 10);
|
||||
Console.WriteLine("Результат: Условие выполнено! Нанесен усиленный урон: " + (attack2BaseDamage + 10));
|
||||
}
|
||||
}
|
||||
|
||||
if (enemyHp <= 0)
|
||||
{
|
||||
enemyHp = 0;
|
||||
Console.WriteLine($"{enemyName} нокаутирован!");
|
||||
break;
|
||||
}
|
||||
|
||||
if (isEnemyDebuffed == true)
|
||||
{
|
||||
Console.WriteLine($"\n{enemyName} пропускает ход из-за эффекта атаки!");
|
||||
isEnemyDebuffed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Write($"\nВыберите тип атаки противника (1 - Уязвимость, 2 - Устойчивость, 3 - Обычный): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 1 && actionChoice != 2 && actionChoice != 3);
|
||||
|
||||
switch (actionChoice)
|
||||
{
|
||||
case 1:
|
||||
hp -= (enemyBaseDamage * 2);
|
||||
Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2).");
|
||||
break;
|
||||
case 2:
|
||||
if(enemyBaseDamage < 20)
|
||||
{
|
||||
Console.WriteLine($"Расчёт: Противник слишком слаб. Нанесено урона : 0.");
|
||||
}
|
||||
else
|
||||
{
|
||||
hp -= (enemyBaseDamage - 20);
|
||||
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20.");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
hp -= enemyBaseDamage;
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hp <= 0)
|
||||
{
|
||||
hp = 0;
|
||||
Console.WriteLine($"{name} нокаутирован!");
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Итог раунда: {name} HP: {hp} | {enemyName} HP: {enemyHp}");
|
||||
roundNumber++;
|
||||
}
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine("=== ДУЭЛЬ ОКОНЧЕНА ===");
|
||||
if (hp == 0)
|
||||
Console.WriteLine($"Победитель: {enemyName}!");
|
||||
else
|
||||
Console.WriteLine($"Победитель: {name}!");
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
```
|
||||
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 74 KiB |
@@ -0,0 +1,166 @@
|
||||
Console.WriteLine("======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗАЦИЯ КАРТОЧКИ ПОКЕМОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write("Введите стадию развития: ");
|
||||
string stage = Console.ReadLine();
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите вид покемона: ");
|
||||
string category = Console.ReadLine();
|
||||
Console.Write("Введите название 1-й атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите эффект 1-й атаки: ");
|
||||
string attack1Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон 1-й атаки: ");
|
||||
int attack1BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите название 2-й атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
Console.Write("Введите эффект 2-й атаки: ");
|
||||
string attack2Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон 2-й атаки: ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите уязвимость: ");
|
||||
string weakness = Console.ReadLine();
|
||||
Console.Write("Введите устойчивость: ");
|
||||
string resistance = Console.ReadLine();
|
||||
Console.Write("Введите текущее HP: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
|
||||
string enemyName = ("Булбазавр");
|
||||
int enemyHp = 70;
|
||||
int enemyBaseDamage = 15;
|
||||
int roundNumber = 1;
|
||||
int actionChoice, attackChoice;
|
||||
bool isEnemyDebuffed = false;
|
||||
|
||||
Console.Clear();
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine($"[{stage}] {name} ОЖ: {hp}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"Вид: {category}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1] {attack1Name} Урон: {attack1BaseDamage}");
|
||||
Console.WriteLine($"Эффект: {attack1Desc}");
|
||||
Console.WriteLine($"\n[Атака 2] {attack2Name} Урон: {attack2BaseDamage}+");
|
||||
Console.WriteLine($"Эффект: {attack2Desc}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"Слабость: {weakness} | Устойчивость: {resistance}");
|
||||
Console.WriteLine("======================================================================");
|
||||
|
||||
Console.WriteLine("\nПриготовьтесь к дуэли!");
|
||||
for (int i = 3; i > 0; i--)
|
||||
{
|
||||
Console.WriteLine(i + "...");
|
||||
}
|
||||
Console.WriteLine($"\n=== СТАРТ ДУЭЛИ: {name} (HP: {hp}) VS {enemyName} (HP: {enemyHp}) ===");
|
||||
|
||||
while (hp > 0 && enemyHp > 0)
|
||||
{
|
||||
Console.WriteLine($"\n--- Раунд {roundNumber} ---");
|
||||
do
|
||||
{
|
||||
Console.Write("Выберите действие (1 - Угольки, 2 - Огненный Клык): ");
|
||||
attackChoice = int.Parse(Console.ReadLine());
|
||||
} while (attackChoice != 1 && attackChoice != 2);
|
||||
|
||||
if (attackChoice == 1)
|
||||
{
|
||||
enemyHp -= attack1BaseDamage;
|
||||
do
|
||||
{
|
||||
Console.Write($"[{attack1Name}] Проверка условия спецэффекта (1 - Сработал, 0 - Нет): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 0 && actionChoice != 1);
|
||||
|
||||
if (actionChoice == 0)
|
||||
Console.WriteLine("Результат: Спецэффект не сработал.");
|
||||
else
|
||||
{
|
||||
isEnemyDebuffed = true;
|
||||
Console.WriteLine($"Результат: Спецэффект сработал! {enemyName} потерял возможность атаковать!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Write($"[{attack2Name}] Проверка условия спецэффекта (1 - Критический урон, 0 - Обычный): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 0 && actionChoice != 1);
|
||||
|
||||
if (actionChoice == 0)
|
||||
{
|
||||
enemyHp -= attack2BaseDamage;
|
||||
Console.WriteLine("Результат: Базовый урон: " + attack2BaseDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
enemyHp -= (attack2BaseDamage + 10);
|
||||
Console.WriteLine("Результат: Условие выполнено! Нанесен усиленный урон: " + (attack2BaseDamage + 10));
|
||||
}
|
||||
}
|
||||
|
||||
if (enemyHp <= 0)
|
||||
{
|
||||
enemyHp = 0;
|
||||
Console.WriteLine($"{enemyName} нокаутирован!");
|
||||
break;
|
||||
}
|
||||
|
||||
if (isEnemyDebuffed == true)
|
||||
{
|
||||
Console.WriteLine($"\n{enemyName} пропускает ход из-за эффекта атаки!");
|
||||
isEnemyDebuffed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
Console.Write($"\nВыберите тип атаки противника (1 - Уязвимость, 2 - Устойчивость, 3 - Обычный): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 1 && actionChoice != 2 && actionChoice != 3);
|
||||
|
||||
switch (actionChoice)
|
||||
{
|
||||
case 1:
|
||||
hp -= (enemyBaseDamage * 2);
|
||||
Console.WriteLine($"Расчёт: Уязвимость ({weakness})! Урон удваивается (x2).");
|
||||
break;
|
||||
case 2:
|
||||
if(enemyBaseDamage < 20)
|
||||
{
|
||||
Console.WriteLine($"Расчёт: Противник слишком слаб. Нанесено урона : 0.");
|
||||
}
|
||||
else
|
||||
{
|
||||
hp -= (enemyBaseDamage - 20);
|
||||
Console.WriteLine($"Расчёт: Устойчивость ({resistance})! Урон уменьшается на 20.");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
hp -= enemyBaseDamage;
|
||||
Console.WriteLine("Расчёт: Обычный тип! Урон наносится без изменений.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hp <= 0)
|
||||
{
|
||||
hp = 0;
|
||||
Console.WriteLine($"{name} нокаутирован!");
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Итог раунда: {name} HP: {hp} | {enemyName} HP: {enemyHp}");
|
||||
roundNumber++;
|
||||
}
|
||||
|
||||
Console.WriteLine("\n======================================================================");
|
||||
Console.WriteLine("=== ДУЭЛЬ ОКОНЧЕНА ===");
|
||||
if (hp == 0)
|
||||
Console.WriteLine($"Победитель: {enemyName}!");
|
||||
else
|
||||
Console.WriteLine($"Победитель: {name}!");
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>stage_03</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="screenshots\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stage-03", "stage-03.csproj", "{840EA6D8-6D72-4FA9-873B-4E65EAB2D9B4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{840EA6D8-6D72-4FA9-873B-4E65EAB2D9B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{840EA6D8-6D72-4FA9-873B-4E65EAB2D9B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{840EA6D8-6D72-4FA9-873B-4E65EAB2D9B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{840EA6D8-6D72-4FA9-873B-4E65EAB2D9B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,231 @@
|
||||
# Stage №4
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Техническое задание:** Турнир Лиги Покемонов (Глобальный игровой цикл с коллекциями)
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```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 Ввод данных**
|
||||

|
||||
|
||||
** Рис.2 Начало турнира по аналогии с эталоном**
|
||||

|
||||
|
||||
** Рис.3 Завершение турнира**
|
||||

|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 40 KiB |
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
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("======================================================================");
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>stage_04</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="screenshots\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stage-04", "stage-04.csproj", "{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25A9FCE0-7AFA-4C4F-A96C-525DA69B3BD7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,231 @@
|
||||
# Stage №5
|
||||
|
||||
* **Студент:** Прибыткова Елизавета Дмитриевна
|
||||
* **Техническое задание:** Турнир Лиги Покемонов (Глобальный игровой цикл с коллекциями)
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```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 Ввод данных**
|
||||

|
||||
|
||||
** Рис.2 Начало турнира по аналогии с эталоном**
|
||||

|
||||
|
||||
** Рис.3 Завершение турнира**
|
||||

|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 110 KiB |
@@ -0,0 +1,38 @@
|
||||
int dmg = 30;
|
||||
int type = 2;
|
||||
Console.WriteLine(CalculateIncomingDamage(dmg, type));
|
||||
int CalculateIncomingDamage(in int baseDamage, in int attackType)
|
||||
{
|
||||
//baseDamage = 10; Нельзя менять in-параметры. Только для чтения
|
||||
switch (attackType)
|
||||
{
|
||||
case 1:
|
||||
return baseDamage * 2;
|
||||
case 2:
|
||||
if (baseDamage <= 20)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
return baseDamage - 20;
|
||||
}
|
||||
case 3:
|
||||
return baseDamage;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UseHealPotion(ref int pokemonHP, List<string> bag, out int itemsLeft)
|
||||
{
|
||||
|
||||
itemsLeft = bag.Count;
|
||||
}
|
||||
|
||||
void LogRoundEvents(params string[] events)
|
||||
{
|
||||
Console.WriteLine("\n--- ЛОГ ТЕКУЩЕГО РАУНДА ---");
|
||||
foreach (var incident in events)
|
||||
{
|
||||
Console.WriteLine($"[Бой]: {incident}");
|
||||
}
|
||||
Console.WriteLine("--------------------------");
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>stage_05</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stage-05", "stage-05.csproj", "{83F4DA8C-69EC-4BEC-9E06-573274797A6A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{83F4DA8C-69EC-4BEC-9E06-573274797A6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83F4DA8C-69EC-4BEC-9E06-573274797A6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83F4DA8C-69EC-4BEC-9E06-573274797A6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83F4DA8C-69EC-4BEC-9E06-573274797A6A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||