Exemple #1
0
        public void DamageGivenGlobalVillainTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

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


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

                foreach (CharacterAccount characterAccount in activeGame.VillainTargets)
                {
                    Assert.IsTrue(characterAccount.DamageGivenModList.ContainsValue(damageGivenMod), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Exemple #2
0
        public void DamageGivenOneTimeModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   damageGivenMod = new AmountModifier("Critical Multiplier", "Increase next damage by 1", ModifierTargets.Local, AmountModifierType.DamageGiven, 1, true);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageGivenModifier(damageGivenMod, fromAccount);

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

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

                int expectedMod = 0;
                int actualMod   = fromAccount.DamageGivenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{fromAccount.Name} damage given mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Exemple #3
0
        public void DamageGivenGlobalAllTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

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

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

                int expectedHealth = 10;
                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   = fromAccount.DamageGivenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{fromAccount.Name} damage given mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
                Assert.IsTrue(activeGame.GlobalEnvironmentModifiers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");
                Assert.IsTrue(activeGame.GlobalHeroModifers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");
                Assert.IsTrue(activeGame.GlobalVillainModifiers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");

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