Exemple #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);
            }
        }
Exemple #2
0
        public void HealGlobalVillainTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   healthModifier = 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.AddHealthModifier(healthModifier, fromAccount);


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

                foreach (CharacterAccount characterAccount in activeGame.VillainTargets)
                {
                    Assert.IsTrue(characterAccount.HealingModList.ContainsValue(healthModifier), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Exemple #3
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 #4
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);
            }
        }
Exemple #5
0
        public void HealOneTimeModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   healthMod   = new AmountModifier("Healing Field", "Increase next healing by 1", ModifierTargets.Local, AmountModifierType.Health, 1, true);
                CharacterAccount fromAccount = activeGame.AllTargets[43];
                CharacterAccount toAccount   = activeGame.AllTargets[87];
                GameContainer.AddHealthModifier(healthMod, toAccount);

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

                GameContainer.HealCharacter(toAccount, toAccount, 1);

                int expectedHealth = 13;
                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   = toAccount.HealthMod;
                Assert.IsTrue(expectedMod == actualMod, $"{toAccount.Name} health mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Exemple #6
0
        public void HealGlobalAddNewEnvironmentModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   healthModifier = new AmountModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.EnvironmentTargets, AmountModifierType.Health, 1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                GameContainer.AddHealthModifier(healthModifier, fromAccount);

                EnvironmentTarget environmentTarget = new EnvironmentTarget("Generic Environment", 10, DamageType.Energy);

                Assert.IsTrue(environmentTarget.HealingModList.ContainsValue(healthModifier), "New environment character does not contain the expected modifier");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }