This commit is contained in:
328p
2026-09-30 15:19:17 +03:00
parent 27548ae05a
commit 4392a0e6e9
7 changed files with 204 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lesson3", "lesson3\lesson3.csproj", "{9597D2EA-9460-4541-9774-C3CC4E05DC83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9597D2EA-9460-4541-9774-C3CC4E05DC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9597D2EA-9460-4541-9774-C3CC4E05DC83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9597D2EA-9460-4541-9774-C3CC4E05DC83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9597D2EA-9460-4541-9774-C3CC4E05DC83}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -0,0 +1,91 @@
Console.WriteLine("Приготовьтесь!");
for (int i = 3; i >= 1; i--)
{
Console.WriteLine($"{i}...");
}
Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ===");
/*string pokemon1Name = "Пикачу";
int pokemon1Hp = 50;
int pokemon1Attack = 12;
string pokemon2Name = "Булбазавр";
int pokemon2Hp = 55;
int pokemon2Attack = 10;
int roundNumber = 1;
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
int choice;
do
{
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
choice = int.Parse(Console.ReadLine());
if (choice != 1 && choice != 0)
{
Console.WriteLine("Некорректная команда! Попробуйте снова.");
}
} while (choice != 1 && choice != 0);
if (choice == 0)
{
Console.WriteLine("Вы отменили бой!");
return;
}
Console.WriteLine("Бой начинается...");*/
string pokemon1Name = "Пикачу";
int pokemon1Hp = 50;
int pokemon1Attack = 12;
string pokemon2Name = "Булбазавр";
int pokemon2Hp = 55;
int pokemon2Attack = 10;
int roundNumber = 1;
while (pokemon1Hp > 0 && pokemon2Hp > 0)
{
Console.WriteLine($"--- Раунд {roundNumber} ---");
pokemon2Hp -= pokemon1Attack;
Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!");
if (pokemon2Hp <= 0)
{
pokemon2Hp = 0;
Console.WriteLine($"{pokemon2Name} потерял сознание!");
break;
}
pokemon1Hp -= pokemon2Attack;
Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} урона по {pokemon1Name}!");
if (pokemon1Hp <= 0)
{
pokemon1Hp = 0;
Console.WriteLine($"{pokemon1Name} потерял сознание!");
break;
}
Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}");
Console.WriteLine();
roundNumber++;
}
Console.WriteLine("\n=== БОЙ ОКОНЧЕН ===");
if (pokemon1Hp > 0)
{
Console.WriteLine($"Победитель: {pokemon1Name}!");
}
else
{
Console.WriteLine($"Победитель: {pokemon2Name}!");
}
@@ -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>