Exemplo n.º 1
0
        public void ApplyDamageTest()
        {
            Character c1Clone = c1.Copy();
            Character c2Clone = c2.Copy();

            h1.ApplyDamage(c1Clone);
            h1.ApplyDamage(c2Clone);

            //  Character1 effectively died.
            Assert.AreEqual(c1Clone.HP, 0);

            // Character2 only lost 1 HP, regardless of hazard having 0 strength
            Assert.AreEqual(c2Clone.HP, 3);

            h2.ApplyDamage(c2Clone);

            //Character2 died because hazard 2 has 10 strength
            Assert.IsTrue(c2Clone.HP <= 0);
        }
Exemplo n.º 2
0
        public void LevelUpTest()
        {
            // Character with initial resistance of 0
            Character c4Clone = c4.Copy();

            // Hazard that deals 4 HP
            Hazard h3Clone = h3.Copy();

            // Destructible with 5 HP
            Destructible d2Clone = d2.Copy();

            h3Clone.ApplyDamage(c4Clone);

            // Since C4 has no resistance, hazard deals full damage
            Assert.AreEqual(c4Clone.HP, 7);

            for (int i = 0; i < 5; i++)
            {
                c4Clone.LevelUp();
            }

            // Character 1 grew up 5 levels
            Assert.AreEqual(c4Clone.Level, 6);

            //(int)System.Math.Ceiling(0 + (1 * (6 - 1) * 0.25)); = 2
            Assert.AreEqual(c4Clone.Resistance, 2);

            h3Clone.ApplyDamage(c4Clone);

            // After leveling up, hazard deals 1HP
            Assert.AreEqual(c4Clone.HP, 6);

            c4Clone.ApplyDamage(d2Clone);

            // After leveling up, C4 has 3 strength
            Assert.AreEqual(d2Clone.HP, 2);
        }