generated from admin/template
laba2
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
/* Console.WriteLine("=== Leveling up a Pokemon ===");
|
||||||
|
|
||||||
|
// запрос базовой атаки
|
||||||
|
Console.Write("Enter the Pokemon's base attack value: ");
|
||||||
|
int Attack = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
// запрос количества полученных уровней
|
||||||
|
Console.Write("Enter the number of levels gained: ");
|
||||||
|
int level = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
// расчёт итоговой атаки
|
||||||
|
int finalAttack = Attack + (level * 5);
|
||||||
|
|
||||||
|
Console.WriteLine($"Pokemon's final attack: {finalAttack}");
|
||||||
|
|
||||||
|
|
||||||
|
// баланс тренера
|
||||||
|
int balans = 1500;
|
||||||
|
Console.Write($" trainer's current balance: {balans}");
|
||||||
|
|
||||||
|
//стоимость зелья
|
||||||
|
int potion = 200;
|
||||||
|
|
||||||
|
//скок зельев хочешь то емае
|
||||||
|
Console.Write("How many potions did you buy?: ");
|
||||||
|
int quantity = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine($"you bought: {quantity} potion");
|
||||||
|
|
||||||
|
//формула пока не один, но тоже сойдет
|
||||||
|
int by = potion * quantity;
|
||||||
|
int konec = balans - by;
|
||||||
|
Console.WriteLine($"You got a good one: {quantity} potion, and there remained {konec} money");
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
//запрос хэпэ
|
||||||
|
Console.Write("Enter HP: ");
|
||||||
|
int hp = int.Parse(Console.ReadLine());
|
||||||
|
Console.WriteLine($"HP: {hp}");
|
||||||
|
|
||||||
|
if (hp <= 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("The Pokemon fainted! Return it to its Poke Ball.");
|
||||||
|
}
|
||||||
|
else if (hp >= 1 && hp <= 20)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Critical condition! Use a potion immediately!");
|
||||||
|
}
|
||||||
|
else if (hp >= 21 && hp <= 50)
|
||||||
|
{
|
||||||
|
Console.WriteLine("The Pokemon is injured; be careful.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("The Pokemon is full of energy and ready for battle!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Console.WriteLine("=== Combat Menu ===");
|
||||||
|
Console.WriteLine("1 — Attack");
|
||||||
|
Console.WriteLine("2 — Inventory");
|
||||||
|
Console.WriteLine("3 — Switch Pokemon");
|
||||||
|
Console.WriteLine("4 — Escape");
|
||||||
|
Console.Write("select action (1-4):");
|
||||||
|
|
||||||
|
int choice = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
switch (choice)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
Console.WriteLine("The Pokemon lands a quick hit!");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Console.WriteLine("You opened your bag and used a Healing Potion.");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Console.WriteLine("You recalled your Pokemon and sent out a new one!");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Console.WriteLine("You successfully escaped from the battle!");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Unknown command! You missed your turn.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,10 @@
|
|||||||
# Лабораторная работа №2
|
# Лабораторная работа №2
|
||||||
|
|
||||||
* **Студент:** [ФИО]
|
* **Студент:** [Саженина Александра]
|
||||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
* **Вариант / Карточка:** [Преобразование типов данных (Convert, Parse) и математические операции в C#.]
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Ключевой код
|
## Ключевой код
|
||||||
```csharp
|
```csharp
|
||||||
// Самая важная часть реализации (методы, структуры, логика)
|
Исходный код расположен в файле Program.cs.
|
||||||
public class Card
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int Hp { get; set; }
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user