public void HealGlobalAllTargetsModTest() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { AmountModifier healModifier = new AmountModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.AllTargets, AmountModifierType.Health, 1, false); CharacterAccount fromAccount = activeGame.AllTargets[43]; CharacterAccount toAccount = activeGame.AllTargets[87]; GameContainer.AddHealthModifier(healModifier, fromAccount); GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee); Assert.IsTrue(activeGame.GlobalEnvironmentModifiers.ContainsValue(healModifier), "Global Environment Mods List does not contain expected modifier"); Assert.IsTrue(activeGame.GlobalHeroModifers.ContainsValue(healModifier), "Global Environment Mods List does not contain expected modifier"); Assert.IsTrue(activeGame.GlobalVillainModifiers.ContainsValue(healModifier), "Global Environment Mods List does not contain expected modifier"); foreach (CharacterAccount characterAccount in activeGame.AllTargets.Values) { Assert.IsTrue(characterAccount.HealingModList.ContainsValue(healModifier), $"{characterAccount} does not contain the expected modifier"); } } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
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); } }
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); } }
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); } }
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); } }
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); } }
private void DealDamage(int amount, CharacterAccount to) { CharacterAccount from = selectedCharacter; DamageType dmgType = (DamageType)cbDamageTypeList.SelectedItem; GameContainer.DealDamage(from, to, amount, dmgType); }
public void HeroTargetGetsDestroyed() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { CharacterAccount heroTarget = activeGame.AllTargets[88]; GameContainer.DealDamage(activeGame.AllTargets[55], heroTarget, 4, DamageType.Fire); Assert.IsTrue(!activeGame.HeroTargets.Contains(heroTarget), "Raptor Bot is incorrectly still a member of the HeroTargetsList"); Assert.IsTrue(!activeGame.AllTargets.ContainsKey(heroTarget.UniqueId), "Raptor Bot is incorrectly still a member of the dictionary AllTargets"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void HeroTargetDamagesHeroTarget() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { GameContainer.DealDamage(activeGame.AllTargets[88], activeGame.AllTargets[88], 1, DamageType.Melee); int expectedHealth = 1; int actualHealth = activeGame.AllTargets[88].CurrentHealth; Assert.IsTrue(expectedHealth == actualHealth, $"Raptor Bot is not at the expected health. Expected {expectedHealth}, Actual {actualHealth}"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void VillainDamagesEnvironment() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { GameContainer.DealDamage(activeGame.AllTargets[87], activeGame.AllTargets[87], 5, DamageType.Melee); int expectedHealth = 10; int actualHealth = activeGame.AllTargets[87].CurrentHealth; Assert.IsTrue(expectedHealth == actualHealth, $"Enraged T-Rex is not at the expected health. Expected {expectedHealth}, Actual {actualHealth}"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void PlayerDamagesPlayer() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { GameContainer.DealDamage(activeGame.AllTargets[43], activeGame.AllTargets[43], 5, DamageType.Melee); int expectedHealth = 27; int actualHealth = activeGame.AllTargets[43].CurrentHealth; Assert.IsTrue(expectedHealth == actualHealth, $"Legacy is not at the expected health. Expected {expectedHealth}, Actual {actualHealth}"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void PlayerDamagesVillain() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { GameContainer.DealDamage(activeGame.AllTargets[55], activeGame.AllTargets[86], 5, DamageType.Fire); int expectedHealth = 45; int actualHealth = activeGame.AllTargets[86].CurrentHealth; Assert.IsTrue(expectedHealth == actualHealth, $"Baron Blade is not at the expected health. Expected {expectedHealth}, Actual {actualHealth}"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void EnvironmentTargetGetsDestroyed() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { CharacterAccount environmentTarget = activeGame.AllTargets[87]; GameContainer.DealDamage(activeGame.AllTargets[55], environmentTarget, 17, DamageType.Fire); Assert.IsTrue(!activeGame.EnvCharacters.Contains(environmentTarget), "Enraged T-Rex is incorrectly still a member of the EnvironmentTargetList"); Assert.IsTrue(!activeGame.NonHeroTargets.Contains(environmentTarget), "Enraged T-Rex is incorrectly still a member of the NonHeroTargetsList"); Assert.IsTrue(!activeGame.AllTargets.ContainsKey(environmentTarget.UniqueId), "Enraged T-Rex is incorrectly still a member of the dictionary AllTargets"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void VillainTargetGetsDestroyed() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { CharacterAccount villainTarget = activeGame.AllTargets[86]; GameContainer.DealDamage(activeGame.AllTargets[55], villainTarget, 52, DamageType.Fire); Assert.IsTrue(!activeGame.VillainTargets.Contains(villainTarget), "Baron Blade is incorrectly still a member of the VillainTargetList"); Assert.IsTrue(!activeGame.NonHeroTargets.Contains(villainTarget), "Baron Blade is incorrectly still a member of the NonHeroTargetsList"); Assert.IsTrue(!activeGame.AllTargets.ContainsKey(villainTarget.UniqueId), "Baron Blade is incorrectly still a member of the dictionary AllTargets"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }
public void HeroPlayerGetsDestroyed() { Setup.SetupTestInfrastructure(); ActiveGame activeGame = GameContainer.ActiveGame; try { CharacterAccount heroTarget = activeGame.AllTargets[43]; GameContainer.DealDamage(activeGame.AllTargets[55], heroTarget, 33, DamageType.Fire); Assert.IsTrue(!activeGame.HeroTargets.Contains(heroTarget), "Legacy is incorrectly still a member of the HeroTargetsList"); Assert.IsTrue(activeGame.HeroPlayers.Contains(heroTarget), "Legacy is incorrectly not a member of the HeroPlayersList"); Assert.IsTrue(!activeGame.AllTargets.ContainsKey(heroTarget.UniqueId), "Legacy is incorrectly still a member of the dictionary AllTargets"); Assert.IsTrue(((HeroPlayer)heroTarget).Incapped, "Legacy was not marked as incapped"); } catch (Exception e) { Assert.Fail("Test failed: " + e); } }