public void AssignGlobalModifiers(CharacterAccount characterAccount, Dictionary <int, Modifier> modifiers) { foreach (Modifier modifier in modifiers.Values) { if (modifier.GetType() == typeof(AmountModifier)) { AmountModifier amountModifier = (AmountModifier)modifier; switch (amountModifier.ModifierType) { case AmountModifierType.DamageGiven: characterAccount.AddDamageGivenMod(amountModifier); break; case AmountModifierType.DamageTaken: characterAccount.AddDamageTakenMod(amountModifier); break; case AmountModifierType.Health: characterAccount.AddHealthMod(amountModifier); break; default: break; } } else if (modifier.GetType() == typeof(ImmunityModifier)) { characterAccount.AddDamageImmunityMod((ImmunityModifier)modifier); } else if (modifier.GetType() == typeof(DamageTypeModifier)) { characterAccount.AddDamageTypeMod((DamageTypeModifier)modifier); } } }
public static void AddDamageGivenModifier(AmountModifier modifier, CharacterAccount characterAccount) { switch (modifier.Target) { case ModifierTargets.Local: characterAccount.AddDamageGivenMod(modifier); break; case ModifierTargets.AllTargets: ActiveGame.GlobalEnvironmentModifiers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalHeroModifers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalVillainModifiers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalAllModifiers.Add(modifier); foreach (CharacterAccount character in ActiveGame.AllTargets.Values) { character.AddDamageGivenMod(modifier); } break; case ModifierTargets.EnvironmentTargets: ActiveGame.GlobalEnvironmentModifiers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalAllModifiers.Add(modifier); foreach (CharacterAccount character in ActiveGame.EnvCharacters) { character.AddDamageGivenMod(modifier); } break; case ModifierTargets.HeroTargets: ActiveGame.GlobalHeroModifers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalAllModifiers.Add(modifier); foreach (CharacterAccount character in ActiveGame.HeroTargets) { character.AddDamageGivenMod(modifier); } break; case ModifierTargets.VillainTargets: ActiveGame.GlobalVillainModifiers.Add(modifier.UniqueId, modifier); ActiveGame.GlobalAllModifiers.Add(modifier); foreach (CharacterAccount character in ActiveGame.VillainTargets) { character.AddDamageGivenMod(modifier); } break; default: break; } }