generated from admin/template
Compare commits
3
Commits
275acb4919
...
52465c5b3e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52465c5b3e | ||
|
|
68d43823aa | ||
|
|
39b1463ece |
@@ -0,0 +1,114 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
*Первое задание*
|
||||
```csharp
|
||||
public class ex1
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string pokemon1Name = "Пикачу";
|
||||
int pokemon1Hp = 50;
|
||||
int pokemon1Attack = 12;
|
||||
string pokemon2Name = "Булбазавар";
|
||||
int pokemon2Hp = 55;
|
||||
int pokemon2Attack = 10;
|
||||
|
||||
Console.WriteLine("Приготовтесь!");
|
||||
for (int i = 3; i >= 1; i--)
|
||||
{
|
||||
Console.WriteLine($"{i}...");
|
||||
}
|
||||
|
||||
Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ===");
|
||||
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
*Второе задание*
|
||||
```csharp
|
||||
public class ex2
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int choice;
|
||||
do
|
||||
{
|
||||
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
|
||||
choice = int.Parse(Console.ReadLine());
|
||||
|
||||
if (choice != 1 && choice != 0)
|
||||
{
|
||||
Console.WriteLine("Некорректная команда! Попробуйте снова.");
|
||||
}
|
||||
|
||||
} while (choice != 0 && choice != 1);
|
||||
|
||||
if (choice == 0)
|
||||
{
|
||||
Console.WriteLine("Вы отменили бой!");
|
||||
}
|
||||
|
||||
if (choice == 1)
|
||||
{
|
||||
Console.WriteLine("Вы начали бой!");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
*Третье задание*
|
||||
```csharp
|
||||
public class ex3
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
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 = pokemon2Hp - pokemon1Attack;
|
||||
if (pokemon2Hp <= 0)
|
||||
{
|
||||
Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} по {pokemon2Name}");
|
||||
Console.WriteLine($"{pokemon2Name} потерял сознание");
|
||||
pokemon2Hp = 0;
|
||||
break;
|
||||
}
|
||||
pokemon1Hp = pokemon1Hp - pokemon2Attack;
|
||||
if (pokemon1Hp <= 0)
|
||||
{
|
||||
Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} по {pokemon1Name}");
|
||||
Console.WriteLine($"{pokemon1Name} потерял сознание");
|
||||
pokemon1Hp = 0;
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}");
|
||||
roundNumber++;
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("=== Бой окончен ===");
|
||||
if (pokemon2Hp == 0)
|
||||
{
|
||||
Console.WriteLine($"Победитель: {pokemon1Name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Победитель: {pokemon2Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -10,7 +10,6 @@ public class ex1
|
||||
string pokemon2Name = "Булбазавар";
|
||||
int pokemon2Hp = 55;
|
||||
int pokemon2Attack = 10;
|
||||
//int roundNumber = 1;
|
||||
|
||||
Console.WriteLine("Приготовтесь!");
|
||||
for (int i = 3; i >= 1; i--)
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
*Задание 1*
|
||||
```csharp
|
||||
public class ex_1
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ===");
|
||||
string[] pokemonNames = new string[3];
|
||||
for (int i = 0; i < pokemonNames.Length; i++)
|
||||
{
|
||||
Console.Write($"Видите имя покемона №{i + 1}: ");
|
||||
pokemonNames[i] = Console.ReadLine();
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("--- Ваша команда на этот бой ---");
|
||||
Console.WriteLine($"1. {pokemonNames[0]}");
|
||||
Console.WriteLine($"2. {pokemonNames[1]}");
|
||||
Console.WriteLine($"1. {pokemonNames[0]}");
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
*Задание 2*
|
||||
```csharp
|
||||
namespace DefaultNamespace;
|
||||
using System.Collections.Generic;
|
||||
public class ex_2
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
List<string> backpack = new List<string>();
|
||||
backpack.Add("Зелья HP");
|
||||
backpack.Add("Покебол");
|
||||
backpack.Add("Антидот");
|
||||
|
||||
Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count);
|
||||
|
||||
backpack.Remove("Покебол");
|
||||
Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!");
|
||||
|
||||
Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
*Задание 3*
|
||||
```csharp
|
||||
public class ex_3
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
List<string> backpack = new List<string>();
|
||||
backpack.Add("Зелья HP");
|
||||
backpack.Add("Покебол");
|
||||
backpack.Add("Антидот");
|
||||
|
||||
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
||||
Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count);
|
||||
|
||||
backpack.Remove("Покебол");
|
||||
Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!");
|
||||
|
||||
Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count);
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("--- Содержимое вашей сумки ---");
|
||||
foreach (string item in backpack)
|
||||
{
|
||||
Console.WriteLine($"[Предмет] -> {item}");
|
||||
|
||||
}
|
||||
Console.WriteLine("=============================");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.Write("Введите, пожалуйста, стадию карточки: ");
|
||||
string stage = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, вид покемона: ");
|
||||
string category = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, название первой атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, описание первой атаки: ");
|
||||
string attack1Desc = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, название второй атаки: ");
|
||||
string attacck2Name = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, описание второй атаки: ");
|
||||
string attacck2Desc = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, слабость покемона: ");
|
||||
string weakness = Console.ReadLine();
|
||||
|
||||
Console.Write("Введите, пожалуйста, сопротивление покемона: ");
|
||||
string resistance = Console.ReadLine();
|
||||
|
||||
|
||||
int hp = 60;
|
||||
int number = 25;
|
||||
double height = 0.4;
|
||||
double weight = 1.0;
|
||||
int attack2Damage = 20;
|
||||
int retreatCost = 1;
|
||||
Console.Clear();
|
||||
|
||||
Console.WriteLine("======================================================================");
|
||||
Console.WriteLine($"[{stage}]{name} ОЖ: {hp}[⚡]" );
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"№ {number} | Вид: {category} | Рост: {height} | Вес: {weight}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1]{attack1Name}");
|
||||
Console.WriteLine($"Эффект: {attack1Desc}");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"[Атака] {attacck2Name} Урон: {attack2Damage}+");
|
||||
Console.WriteLine($"Эффект: {attacck2Desc}");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"Слабость: {weakness}");
|
||||
Console.WriteLine($"Устойчиов: {resistance}");
|
||||
Console.WriteLine($"Отступление: {retreatCost} энергия");
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,104 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
public class main
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите название атаки 1: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите название атаки 2: " );
|
||||
string attack2Name = Console.ReadLine();
|
||||
Console.WriteLine("======================================================================");
|
||||
Console.WriteLine("ИНИЦИАЛИЗА КАРТОЧКИ");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
|
||||
Console.Write($"Введите текущее HP {name}: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите базовый урон атаки Быстрая Атака: ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
|
||||
int finalIncomingDamage = 0;
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine("ИСПОЛЬЗОВАНИЕ АТАК");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine($"[Атака 1: {attack1Name}]");
|
||||
int coinFlip1 = Random.Shared.Next(0, 2);
|
||||
Console.WriteLine($"Бросок монеты (1 - Орёл, 0 - Решка): {coinFlip1}");
|
||||
if (coinFlip1 == 1)
|
||||
{
|
||||
Console.WriteLine("Результат: Активный Покемон противника парализован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Результат: Эффект паралича не сработал.");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"[Атака 2: {attack2Name}]");
|
||||
int coinFlip2 = Random.Shared.Next(0, 2);
|
||||
Console.WriteLine($"Бросок монеты (1 - Орёл, 0 - Решка): {coinFlip2}");
|
||||
if (coinFlip2 == 1)
|
||||
{
|
||||
Console.WriteLine($"Результат: Выпал орёл! Итоговый урон: {attack2BaseDamage + 10}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Результат: Выпала решка! Итоговый урон: {attack2BaseDamage}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.WriteLine("ПОЛУЧЕНИЕ УРОНА");
|
||||
Console.WriteLine("----------------------------------------------------------------------");
|
||||
Console.Write($"Введите базовый урон атаки противника: ");
|
||||
int incomingDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write($"Выберите тип атаки противника (1 - Боевой, 2 - Стальной, 3 - Обычный): ");
|
||||
int choose = int.Parse(Console.ReadLine());
|
||||
|
||||
Console.WriteLine();
|
||||
switch (choose)
|
||||
{
|
||||
case 1:
|
||||
finalIncomingDamage = incomingDamage * 20;
|
||||
Console.WriteLine("Расчёт: Боевой тип! Урон удваивается (x2).");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
finalIncomingDamage = incomingDamage - 20;
|
||||
Console.WriteLine("Расчёт: Стальной тип! Урон уменьшается на 20 (Resistance: -20).");
|
||||
break;
|
||||
case 3:
|
||||
finalIncomingDamage = incomingDamage;
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Ошибка: Выбран неизвестный тип атаки!");
|
||||
break;
|
||||
}
|
||||
|
||||
int finalHP = hp - finalIncomingDamage;
|
||||
Console.WriteLine($"Итоговой урон: {finalHP}");
|
||||
|
||||
if (finalHP <= 0)
|
||||
{
|
||||
Console.WriteLine($"{name} нокаутирован!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{name} выдержал удар! Остаток HP: {finalHP}");
|
||||
}
|
||||
Console.WriteLine("======================================================================");
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
# Лабораторная работа №1
|
||||
|
||||
* **Студент:** [ФИО]
|
||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
||||
|
||||
---
|
||||
|
||||
## Ключевой код
|
||||
```csharp
|
||||
// Самая важная часть реализации (методы, структуры, логика)
|
||||
public class Card
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Hp { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
namespace DefaultNamespace;
|
||||
|
||||
public class Programm
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.Write("Введите стадию развития покемона: ");
|
||||
string stage = Console.ReadLine();
|
||||
Console.Write("Введите имя покемона: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Введите вид покемона: ");
|
||||
string category = Console.ReadLine();
|
||||
Console.Write("Введите название первой атаки: ");
|
||||
string attack1Name = Console.ReadLine();
|
||||
Console.Write("Введите описание первой атаки: ");
|
||||
string attack1Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон первой атаки: ");
|
||||
int attack1BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите название второй атаки: ");
|
||||
string attack2Name = Console.ReadLine();
|
||||
Console.Write("Введите описание второй атаки: ");
|
||||
string attack2Desc = Console.ReadLine();
|
||||
Console.Write("Введите базовый урон второй атаки: ");
|
||||
int attack2BaseDamage = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите слабость покемона (Weakness): ");
|
||||
string weakness = Console.ReadLine();
|
||||
Console.Write("Введите сопротивление покемона (Resistance): ");
|
||||
string resistance = Console.ReadLine();
|
||||
Console.Write("Введите тякущее HP: ");
|
||||
int hp = int.Parse(Console.ReadLine());
|
||||
|
||||
string enemyName = "Бубазавар";
|
||||
int enemyHP = 70;
|
||||
int enemyBaseDamage = 15;
|
||||
int roundNumber = 1;
|
||||
int actionChoice;
|
||||
bool isEnemyDebuffed = false;
|
||||
|
||||
|
||||
Console.WriteLine("Приготовьтесь к дуэли!");
|
||||
for (int i = 3; i >= 1; i--)
|
||||
{
|
||||
Console.WriteLine($"{i}...");
|
||||
}
|
||||
|
||||
while (hp > 0 && enemyHP > 0)
|
||||
{
|
||||
Console.WriteLine($"--- Раунд {roundNumber} ---");
|
||||
|
||||
do
|
||||
{
|
||||
Console.Write($"Выберите действие (1 - {attack1Name}, 2 - {attack2Name}): ");
|
||||
actionChoice = int.Parse(Console.ReadLine());
|
||||
} while (actionChoice != 1 && actionChoice != 2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user