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

            try
            {
                ImmunityModifier DamageImmunityMod = new ImmunityModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.VillainTargets, DamageType.All);
                CharacterAccount fromAccount       = activeGame.AllTargets[43];
                CharacterAccount toAccount         = activeGame.AllTargets[87];
                GameContainer.AddDamageImmunityModifier(DamageImmunityMod, fromAccount);


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

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

            try
            {
                ImmunityModifier immunityMod = new ImmunityModifier("Flesh of the Sun God", "Ra is Immune to Fire Damage", ModifierTargets.Local, DamageType.Fire);
                CharacterAccount fromAccount = activeGame.AllTargets[43];
                CharacterAccount toAccount   = activeGame.AllTargets[87];
                GameContainer.AddDamageImmunityModifier(immunityMod, toAccount);

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

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

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

                expectedHealth = 11;
                actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health for Fire test. Expected {expectedHealth}, actually {actualhealth}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
Beispiel #3
0
        public void CanTrackImmunitiesAndOtherSpecialAbilites()
        {
            var def = new DefenseStats(
                new AbilityScores(),
                new SizeStats(),
                new Inventory());
            var immune = new ImmunityModifier();

            def.ProcessSpecialAbilities(immune);

            Assert.AreEqual("vs. Fire", def.Immunities.First().Condition);
            Assert.AreEqual("Evasion", def.DefensiveAbilities.First().Condition);
        }