This commit is contained in:
Цапенков Кирилл
2026-09-08 21:13:03 +03:00
parent 5200656f37
commit 3c072bd0bb
9 changed files with 192 additions and 34 deletions
-16
View File
@@ -1,16 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{7BD59473-A1D0-4231-AE4D-9FBFAFFF6CE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7BD59473-A1D0-4231-AE4D-9FBFAFFF6CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BD59473-A1D0-4231-AE4D-9FBFAFFF6CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BD59473-A1D0-4231-AE4D-9FBFAFFF6CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BD59473-A1D0-4231-AE4D-9FBFAFFF6CE2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -1,8 +0,0 @@
Console.WriteLine("=== Прокачка покемона ===");
Console.WriteLine("Введите базовое значение атаки покемона");
string atackPokemon = Console.ReadLine();
Console.WriteLine("Введите количество полученных уровней");
string lvlBased = Console.ReadLine();
int atack1 = int.Parse(atackPokemon);
int atack2 = int.Parse(lvlBased);
Console.WriteLine(atack1+(atack2*5));
@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A1832730-5C4C-4C7D-97C3-3DB766AE62C3}|laba2.csproj|c:\\users\\spokt\\onedrive\\desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A1832730-5C4C-4C7D-97C3-3DB766AE62C3}|laba2.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\Program.cs*",
"RelativeToolTip": "Program.cs*",
"ViewState": "AgIAAAAAAAAAAAAAAAAAACIAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-09-08T17:56:20.867Z",
"EditorCaption": ""
}
]
}
]
}
]
}
@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A1832730-5C4C-4C7D-97C3-3DB766AE62C3}|laba2.csproj|c:\\users\\spokt\\onedrive\\desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A1832730-5C4C-4C7D-97C3-3DB766AE62C3}|laba2.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\Program.cs",
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "C:\\Users\\spokt\\OneDrive\\Desktop\\charp-tsapenkov\\works\\lab-02\\lab 2\\laba2\\Program.cs*",
"RelativeToolTip": "Program.cs*",
"ViewState": "AgIAAEkAAAAAAAAAAAAAAGkAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-09-08T17:56:20.867Z",
"EditorCaption": ""
}
]
}
]
}
]
}
+105
View File
@@ -0,0 +1,105 @@
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("========== ЗАДАНИЕ 2.1 ==========");
Console.WriteLine("=== Проверка состояния покемона ===\n");
Console.Write("Введите текущее количество HP покемона (целое число): ");
string hpInput = Console.ReadLine();
int hp = int.Parse(hpInput);
Console.WriteLine($"\nТекущее HP: {hp}");
if (hp <= 0)
{
Console.WriteLine("Покемон потерял сознание! Верните его в покебол.");
}
else if (hp <= 20)
{
Console.WriteLine("Критическое состояние! Срочно используйте зелье!");
}
else if (hp <= 50)
{
Console.WriteLine("Покемон ранен, будьте осторожны.");
}
else
{
Console.WriteLine("Покемон полон сил и готов к бою!");
}
Console.WriteLine("\nНажмите любую клавишу для перехода к заданию 2.2...");
Console.ReadKey();
Console.Clear();
ShowBattleMenu();
}
static void ShowBattleMenu()
{
Console.WriteLine("========== ЗАДАНИЕ 2.2 ==========");
Console.WriteLine("=== Консольное меню боя ===\n");
bool inBattle = true;
while (inBattle)
{
Console.WriteLine("1 — Атака");
Console.WriteLine("2 — Инвентарь");
Console.WriteLine("3 — Сменить покемона");
Console.WriteLine("4 — Побег");
Console.WriteLine("0 — Выйти");
Console.Write("\nВыберите действие: ");
string input = Console.ReadLine();
if (!int.TryParse(input, out int choice))
{
Console.WriteLine("\nОшибка: введите число!\n");
continue;
}
Console.WriteLine();
switch (choice)
{
case 1:
Console.WriteLine("Покемон наносит быстрый удар!");
break;
case 2:
Console.WriteLine("Вы открыли сумку и применили Зелье Лечения.");
break;
case 3:
Console.WriteLine("Вы отозвали покемона и выпустили нового!");
break;
case 4:
Console.WriteLine("Вы успешно сбежали из боя!");
inBattle = false;
break;
case 0:
Console.WriteLine("Выход из программы...");
return;
default:
Console.WriteLine("Неизвестная команда! Вы пропустили ход.");
break;
}
if (inBattle)
{
Console.WriteLine("\nНажмите любую клавишу для продолжения...");
Console.ReadKey();
Console.Clear();
}
}
Console.WriteLine("\nБой завершен. Спасибо за игру!");
Console.ReadKey();
}
}
+10
View File
@@ -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>
+3
View File
@@ -0,0 +1,3 @@
<Solution>
<Project Path="laba2.csproj" />
</Solution>