Example #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));
        }
Example #2
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);
        }
Example #3
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());
        }
Example #4
0
        public void Heroes_win_battle_encounter()
        {
            Dwarf  dwarf  = new Dwarf(1000, 80, 0);
            Elf    elf    = new Elf(67060, 45, 0);
            Wizard wizard = new Wizard(9595, 54, 0);


            Demon  demon  = new Demon(23, 1, 24);
            Dragon dragon = new Dragon(10, 10, 0);
            Orc    orc    = new Orc(24, 4, 1);

            var heroes = new List <AbstractHero> {
                dwarf, elf, wizard
            };
            var villains = new List <AbstractVillain> {
                demon, dragon, orc
            };

            BattleEncounter encounter = new BattleEncounter(heroes, villains);

            Assert.IsTrue(encounter.RunEncounter());
        }
Example #5
0
        public void Villains_win_battle_encounter()
        {
            Dwarf  dwarf  = new Dwarf(9, 1, 0);
            Elf    elf    = new Elf(10, 3, 0);
            Wizard wizard = new Wizard(8, 4, 0);


            Demon  demon  = new Demon(23, 6547, 24);
            Dragon dragon = new Dragon(10, 10, 0);
            Orc    orc    = new Orc(24, 4, 1);

            var heroes = new List <AbstractHero> {
                dwarf, elf, wizard
            };
            var villains = new List <AbstractVillain> {
                demon, dragon, orc
            };

            BattleEncounter encounter = new BattleEncounter(heroes, villains);

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