Files
cshap/works/lab-05/lab_5.cs
T

71 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lab_5
{
internal class Program
{
static void Main(string[] args)
{
//z1
int pokemonHp = 20;
Console.WriteLine("\n=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
Console.WriteLine("Текущее здоровье покемона: " + pokemonHp);
HealPokemon(ref pokemonHp);
Console.ReadKey();
//z2
Console.WriteLine("\n=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в траву.............");
string pkmnName;
int pkmnLevel;
SearchBushes(out pkmnName, out pkmnLevel);
Console.ReadKey();
//z3
Console.WriteLine("\n=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
string[] pokemons1 = { "Бульбазавр", "Чармандер" };
string[] pokemons2 = { "Сквиртл", "Пикачу", "Псайдак", "Мяут" };
double difficultyReg = 1.5;
RegisterTournament(in difficultyReg, pokemons1);
Console.WriteLine("--------------------------------------");
RegisterTournament(in difficultyReg, pokemons2);
Console.ReadKey();
}
static void HealPokemon(ref int pkmnHp)
{
pkmnHp += 80;
if (pkmnHp > 100)
{
pkmnHp = 100;
Console.WriteLine($"[Покецентр] Покемон полностью здоров. Текущее хп: {pkmnHp}");
}
else
{
Console.WriteLine("[Покецентр] Текущее хп после лечения " + pkmnHp);
}
}
static void SearchBushes(out string foundPokemon, out int pokemonlevel)
{
Random randomnum = new Random();
pokemonlevel = randomnum.Next(1, 15);
foundPokemon = "Пикачу";
Console.WriteLine($"Шорох!! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonlevel})!");
}
static void RegisterTournament(in double difficulty, params string[] participants)
{
//difficulty = 1,3;
Console.WriteLine("Коэффициент стадиона: " + difficulty);
Console.WriteLine("Список участников: ");
foreach (string pokemon in participants)
{
Console.WriteLine($"* {pokemon}");
}
}
}
}