This commit is contained in:
2026-10-14 10:26:36 +03:00
6 changed files with 136 additions and 45 deletions
+27 -20
View File
@@ -10,20 +10,21 @@ namespace lab5
Console.WriteLine("Задание 1. Лечение в Покецентре (Использование ref)");
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
int pokemonHP = 20;
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP");
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP");
static void HealPokemon(ref int myPokemonHP)
{
myPokemonHP+= 80;
{
myPokemonHP += 80;
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
}
HealPokemon(ref pokemonHP);
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP");
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP");
Console.WriteLine("\nЗадание 2. Поиск дикого покемона в высокой траве (Использование out)");
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в высокую траву...");
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
@@ -31,25 +32,31 @@ namespace lab5
Random rnd = new Random();
pokemonLevel = rnd.Next(1, 15);
}
SearchBushes(out string Pokemon, out int Level);
Console.WriteLine($"Шорох! Из кустов появляется дикий {Pokemon} (Уровень: {Level})!");
Console.WriteLine($"Шорох! Из кустов появляется дикий {Pokemon} (Уровень: {Level})!");
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
static void RegisterTournament (in double difficulty)
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
RegisterTournament(1.5, "Бульбазавр", "Чармандер");
Console.WriteLine("-----------------------------");
RegisterTournament(1.5, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");
static void RegisterTournament(in double difficulty, params string[] participants)
{
Console.WriteLine($"Правила боя: {difficulty}");
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
Console.WriteLine($"Список участников:");
foreach (string pokemon in participants)
{
Console.WriteLine($"* {pokemon}");
}
}
string currentRules = "Использовать только одного покемона.";
PrintArenaRules(in currentRules);
static void ShowTeam(params string[] participants)
{
// pokemons внутри метода работает как обычный массив
}
}
}
}