Example #1
0
        public void BattleEncounterWithArmorAndWeaponsTest()
        {
            Scenario scenario = new Scenario();
            Dwarf    gimli    = new Dwarf();
            Orc      orc      = new Orc();

            BasicSword sword = new BasicSword();
            ChainMail  armor = new ChainMail();
            GoldenCoat coat  = new GoldenCoat();

            orc.AddItem(sword);
            orc.AddItem(armor);
            orc.AddItem(coat);

            List <CharacterClass> heroes = new List <CharacterClass>()
            {
                gimli
            };
            List <CharacterClass> villains = new List <CharacterClass>()
            {
                orc
            };

            BattleEncounter battle = new BattleEncounter(heroes, villains);

            List <List <CharacterClass> > everything = battle.PlayEncounter();

            Assert.AreEqual(0, everything[0][0].HealthActual);
        }
Example #2
0
        public void HealthReductedTest()
        {
            Dwarf        gimli = new Dwarf();
            StygianBlade sword = new StygianBlade();
            Orc          dummy = new Orc();
            GoldenCoat   coat  = new GoldenCoat();

            gimli.AddItem(sword);
            dummy.AddItem(coat);

            dummy.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy.HealthMax - dummy.HealthActual, gimli.BaseAttackPower + sword.AttackPower - dummy.BaseDefensePower - coat.DefensePower);
        }
Example #3
0
        public void TwoDefenseItemsTest()
        {
            Dwarf  gimli = new Dwarf();
            Dragon dummy = new Dragon();

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint1 = gimli.HealthMax - gimli.HealthActual;

            gimli.Healing(1000);
            ChainMail  armor = new ChainMail();
            GoldenCoat coat  = new GoldenCoat();

            gimli.AddItem(armor);
            gimli.AddItem(coat);

            gimli.ReceiveDamage(dummy.Attack());
            int checkPoint2 = gimli.HealthMax - gimli.HealthActual;

            Assert.AreEqual(checkPoint1 - checkPoint2, armor.DefensePower + coat.DefensePower);
        }