Exemple #1
0
        public void Only_one_character_alive_after_battle_encounter_2()
        {
            Satan        satan        = new Satan(10, 9000, 0);
            ShadowHunter shadowHunter = new ShadowHunter(1, 10, 10);

            BattleEncounter encounter = new BattleEncounter(shadowHunter, satan);

            encounter.RunEncounter();

            int heroesAlive   = 0;
            int villainsAlive = 0;

            foreach (var hero in encounter.Heroes)
            {
                if (hero.IsAlive())
                {
                    heroesAlive++;
                }
            }
            foreach (var villain in encounter.Villains)
            {
                if (villain.IsAlive())
                {
                    villainsAlive++;
                }
            }


            Assert.IsTrue((heroesAlive == 0 && villainsAlive == 1) ||
                          (villainsAlive == 0 && heroesAlive == 1));
        }
        public IEnemy Make(Enemies enemyType)
        {
            IEnemy enemy;

            switch (enemyType)
            {
            case Enemies.Spider:
                enemy = new Spider();
                break;

            case Enemies.Ghost:
                enemy = new Ghost();
                break;

            case Enemies.Satan:
                enemy = new Satan();
                break;

            default:
                throw new ArgumentOutOfRangeException("Enemy type " + enemyType + " is not supported");
            }

            enemy.SetHp(100);
            enemy.SetMp(100);
            enemy.SetLevel(1);

            return(enemy);
        }
Exemple #3
0
        public void Hp_cannot_be_lower_than_0()
        {
            Elf   elf   = new Elf(10, 10, 10);
            Satan satan = new Satan(10, 999999999, 10);

            satan.Attack(elf);

            Assert.IsTrue(elf.Hp >= 0);
        }
Exemple #4
0
        public void Libro_de_la_sabiduria_works_correctly()
        {
            Elf    elf    = new Elf(10, 20, 30);
            Satan  satan  = new Satan(100, 100, 100);
            Wizard wizard = new Wizard(1, 1, 1);

            satan.Attack(elf);

            Assert.IsTrue(!elf.IsAlive() &&
                          Wizard.LibroDeLaSabiduria[satan.ToString() + $"({satan.Id})"].Contains(elf.ToString()));
        }
Exemple #5
0
        public void Only_one_character_alive_after_battle_encounter_1()
        {
            Satan  satan  = new Satan(10, 9000, 0);
            Dragon dragon = new Dragon(56, 52, 34);
            Orc    orc    = new Orc(23, 34, 4);

            ShadowHunter shadowHunter = new ShadowHunter(1, 10, 10);
            Angel        angel        = new Angel(231, 223, 343);
            Archer       archer       = new Archer(2323, 323, 32);
            Knight       knight       = new Knight(23, 3334, 132);

            BattleEncounter encounter = new BattleEncounter(new List <AbstractHero>()
            {
                shadowHunter,
                angel,
                archer,
                knight
            },
                                                            new List <AbstractVillain>()
            {
                satan,
                dragon,
                orc
            });

            encounter.RunEncounter();

            int heroesAlive   = 0;
            int villainsAlive = 0;

            foreach (var hero in encounter.Heroes)
            {
                if (hero.IsAlive())
                {
                    heroesAlive++;
                }
            }
            foreach (var villain in encounter.Villains)
            {
                if (villain.IsAlive())
                {
                    villainsAlive++;
                }
            }


            Assert.IsTrue(heroesAlive == 0 || villainsAlive == 0);
        }
Exemple #6
0
        public void Expected_battle_result_2()
        {
            Satan        satan        = new Satan(10, 9000, 0);
            ShadowHunter shadowHunter = new ShadowHunter(1, 10, 10);

            BattleEncounter encounter = new BattleEncounter(new List <AbstractHero>()
            {
                shadowHunter
            },
                                                            new List <AbstractVillain>()
            {
                satan
            });


            Assert.IsFalse(encounter.RunEncounter());
        }