Ejemplo n.º 1
0
        public void DamageTakenModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   damageTakenMod = new AmountModifier("HeavyPlating", "Decrease damage taken by 1", ModifierTargets.Local, AmountModifierType.DamageTaken, -1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageTakenModifier(damageTakenMod, toAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                int expectedHealth = 12;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health. Expected {expectedHealth}, actually {actualhealth}");

                int expectedMod = -1;
                int actualMod   = toAccount.DamageTakenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{toAccount.Name} damage taken mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Ejemplo n.º 2
0
        public void DamageTakenGlobalVillainTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   DamageTakenMod = new AmountModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.VillainTargets, AmountModifierType.DamageTaken, 1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageTakenModifier(DamageTakenMod, fromAccount);


                Assert.IsTrue(!activeGame.GlobalEnvironmentModifiers.ContainsValue(DamageTakenMod), "Global Environment Mods List incorrectly contains expected modifier");
                Assert.IsTrue(!activeGame.GlobalHeroModifers.ContainsValue(DamageTakenMod), "Global Environment Mods List incorrectly contains expected modifier");
                Assert.IsTrue(activeGame.GlobalVillainModifiers.ContainsValue(DamageTakenMod), "Global Environment Mods List does not contain expected modifier");

                foreach (CharacterAccount characterAccount in activeGame.VillainTargets)
                {
                    Assert.IsTrue(characterAccount.DamageTakenModList.ContainsValue(DamageTakenMod), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }