Esempio n. 1
0
 public override void UseSpecialAttack(Fighter enemyFighter)
 {
     BlockDamage(enemyFighter);
 }
Esempio n. 2
0
 public void BlockDamage(Fighter enemyFighter)
 {
     HpCount += enemyFighter.CurrentDamage;
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Random random = new Random();

            Fighter[] fighterArray = { new FighterTank(), new FighterMage(), new FighterSupport(), new FighterRifleman(), new FighterSwordman() };

            Console.WriteLine("Выберите 2 бойцов");
            for (int i = 0; i < fighterArray.Length; i++)
            {
                Console.Write($"{i + 1})");
                fighterArray[i].ShowName();
            }

            int firstFighterIndex  = int.Parse(Console.ReadLine()) - 1;
            int secondFighterIndex = int.Parse(Console.ReadLine()) - 1;

            Fighter firstFighter  = fighterArray[firstFighterIndex];
            Fighter secondFighter = fighterArray[secondFighterIndex];

            firstFighter.ShowInfo(false);
            secondFighter.ShowInfo(false);

            while (firstFighter.HpCount > 0 && secondFighter.HpCount > 0)
            {
                Console.ReadKey();
                Console.WriteLine();

                bool isCryticalDamageFirstFighter  = CheckChance(random, firstFighter.CriticalDamageChance);
                bool isCryticalDamageSecondFighter = CheckChance(random, secondFighter.CriticalDamageChance);

                bool isSpecialAttackFirstFighter  = CheckChance(random, firstFighter.CriticalDamageChance);
                bool isSpecialAttackSecondFighter = CheckChance(random, secondFighter.CriticalDamageChance);

                firstFighter.Attack(secondFighter, isCryticalDamageFirstFighter);
                secondFighter.Attack(firstFighter, isCryticalDamageSecondFighter);

                if (isSpecialAttackFirstFighter == true)
                {
                    firstFighter.UseSpecialAttack(secondFighter);
                }
                if (isSpecialAttackSecondFighter == true)
                {
                    secondFighter.UseSpecialAttack(firstFighter);
                }

                firstFighter.ShowInfo(isSpecialAttackFirstFighter);
                secondFighter.ShowInfo(isSpecialAttackSecondFighter);

                firstFighter.EstablishOriginDamage();
                secondFighter.EstablishOriginDamage();
            }

            if (firstFighter.HpCount <= 0 && secondFighter.HpCount <= 0)
            {
                Console.WriteLine("Ничья");
            }
            else
            {
                if (firstFighter.HpCount <= 0)
                {
                    Console.WriteLine("Второй игрок победил");
                }
                if (secondFighter.HpCount <= 0)
                {
                    Console.WriteLine("Первый игрок победил");
                }
            }

            Console.ReadLine();
        }
Esempio n. 4
0
 public abstract void UseSpecialAttack(Fighter enemyFighter);
Esempio n. 5
0
 public void SpellVampirism(Fighter enemyFighter)
 {
     CurrentDamage = enemyFighter.HpCount / 5;
     HpCount      += CurrentDamage;
     Attack(enemyFighter, false);
 }
Esempio n. 6
0
 public override void UseSpecialAttack(Fighter enemyFighter)
 {
     Heal();
 }
Esempio n. 7
0
 public override void UseSpecialAttack(Fighter enemyFighter)
 {
     SpellVampirism(enemyFighter);
 }
Esempio n. 8
0
 public void KillEnemyInstantly(Fighter enemyFighter)
 {
     CurrentDamage = enemyFighter.HpCount;
     Attack(enemyFighter, false);
 }
Esempio n. 9
0
 public override void UseSpecialAttack(Fighter enemyFighter)
 {
     KillEnemyInstantly(enemyFighter);
 }
Esempio n. 10
0
 public void ReflectDamage(Fighter enemyFighter)
 {
     CurrentDamage = enemyFighter.CurrentDamage;
     HpCount      += enemyFighter.CurrentDamage;
     Attack(enemyFighter, false);
 }
Esempio n. 11
0
 public override void UseSpecialAttack(Fighter enemyFighter)
 {
     ReflectDamage(enemyFighter);
 }