Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Study
- {
- class Program
- {
- static void Main(string[] args)
- {
- Spartak spartak = new Spartak(100,5, 50);
- Kriks kriks = new Kriks(100, 1, 20, 20);
- Gannik gannik = new Gannik(75,16, 25);
- Kast kast = new Kast(80, 10, 30);
- Narciss narciss = new Narciss(60, 30, 15);
- string playerSelection;
- Gladiator[] gladiators = { spartak, kriks, gannik, kast, narciss };
- int gladiatorIndex;
- for (int i = 0; i < gladiators.Length; i++)
- {
- Console.Write(i + " ");
- gladiators[i].ShowInfo();
- }
- Console.WriteLine("Молитва прибавляет 2 к броне. ВААГХ!-забирает 2 единицы брони. Прибавляет 10 единиц здоровья. Берсерк убирает 2 единицы брони. Прибавляет 5 единиц урона.Аптечка-прибавляет 5 единиц здоровья. Кровавое заклятие забирает 5 единиц здоровья. Прибавляет 5 единиц урона");
- Console.Write("Выберите бойца правых ворот:");
- gladiatorIndex = Convert.ToInt32(Console.ReadLine());
- Gladiator rightGladiator = gladiators[gladiatorIndex];
- Console.Write("Выберите бойца левых ворот:");
- gladiatorIndex = Convert.ToInt32(Console.ReadLine());
- Gladiator leftGladiator = gladiators[gladiatorIndex];
- while (leftGladiator.Health > 0 && rightGladiator.Health > 0)
- {
- Console.WriteLine("Ходит боец правых ворот. Выберите 1 для простой атаки. Выберите 2 для спецатаки");
- playerSelection = Console.ReadLine();
- switch (playerSelection)
- {
- case "1":
- leftGladiator.TakeDamage(rightGladiator.Damage);
- break;
- case "2":
- Console.WriteLine("Спецатака");
- break;
- default:
- Console.WriteLine("Выберети команду");
- break;
- }
- leftGladiator.ShowInfo();
- rightGladiator.ShowInfo();
- Console.WriteLine("Ходит боец левых ворот. Выберите 1 для простой атаки. Выберите 2 для спецатаки");
- playerSelection = Console.ReadLine();
- switch (playerSelection)
- {
- case "1":
- rightGladiator.TakeDamage(leftGladiator.Damage);
- break;
- case "2":
- Console.WriteLine("Спецатака");
- break;
- default:
- Console.WriteLine("Выберети команду");
- break;
- }
- leftGladiator.ShowInfo();
- rightGladiator.ShowInfo();
- if (leftGladiator.Health < 0)
- {
- Console.WriteLine("Победил боец правых ворот");
- }
- else
- {
- Console.WriteLine("Победил боец левых ворот");
- }
- }
- }
- }
- class Gladiator
- {
- protected int _health;
- protected int _armor;
- protected int _damage;
- protected string _name;
- protected string _specialAbility;
- public int Health
- {
- get
- {
- return _health;
- }
- }
- public int Damage
- {
- get
- {
- return _damage;
- }
- }
- public Gladiator(string name,int health, int armor, int damage, string specialAbility)
- {
- _health = health;
- _armor = armor;
- _damage = damage;
- _name = name;
- _specialAbility = specialAbility;
- }
- public void TakeDamage(int damage)
- {
- _health -= damage - _armor;
- }
- public void ShowInfo()
- {
- Console.WriteLine("Имя " + _name + " Количество жизни " + _health + " Броня " + _armor + " Урон " + _damage + " Спецспособность "+ _specialAbility);
- }
- }
- class Spartak : Gladiator
- {
- public Spartak(int health,int armor, int damage) : base("Spartak", health, armor, damage, "Молитва")
- {
- }
- public void Pray()
- {
- _armor += 2;
- }
- }
- class Kriks : Gladiator
- {
- public int AttackSpeed;
- public Kriks(int health, int armor, int damage, int attackSpeed) : base("Kriks",health, armor, damage * attackSpeed, "ВАААГХ!!")
- {
- AttackSpeed = attackSpeed;
- }
- public void specialAbility()
- {
- _armor -= 2;
- _health += 10;
- }
- }
- class Gannik : Gladiator
- {
- public Gannik (int health, int armor, int damage) : base("Gannik",health, armor, damage, "Берсерк")
- {
- }
- public void specialAbility()
- {
- _armor -= 2;
- _damage += 5;
- }
- }
- class Kast : Gladiator
- {
- public Kast(int health, int armor, int damage) : base("Kast",health, armor, damage, "Аптечка")
- {
- }
- public void specialAbility()
- {
- _health += 5;
- }
- }
- class Narciss : Gladiator
- {
- public Narciss(int health, int armor, int damage) : base("Narciss",health, armor, damage,"Кровавое заклятие")
- {
- }
- public void specialAbility()
- {
- _damage += 5;
- _health -= 5;
- }
- }
- }
Add Comment
Please, Sign In to add comment