void HealCaster() { if (caster) { DrainEffect incumbentDrain = caster.GetComponent <EntityEffectManager>().FindDrainStatIncumbent(drainStat); if (incumbentDrain != null) { incumbentDrain.Heal(lastMagnitudeIncreaseAmount); } } }
public override void MagicRound() { base.MagicRound(); DrainEffect incumbentDrain = manager.FindDrainStatIncumbent(healStat); if (incumbentDrain != null) { int magnitude = GetMagnitude(caster); incumbentDrain.Heal(magnitude); Debug.LogFormat("Healed {0} Drain {1} by {2} points", GetPeeredEntityBehaviour(manager).name, incumbentDrain.DrainStat.ToString(), magnitude); } else { Debug.LogFormat("Could not find incumbent Drain {0} on target", healStat.ToString()); } }
DrainEffect FindDrainStatIncumbent() { // Search for any matching incumbents on this host EntityEffectManager.InstancedBundle[] bundles = manager.EffectBundles; foreach (EntityEffectManager.InstancedBundle bundle in bundles) { foreach (IEntityEffect effect in bundle.liveEffects) { if (effect is DrainEffect) { // Heal stat must match drain stat DrainEffect drainEffect = effect as DrainEffect; if (drainEffect.IsIncumbent && drainEffect.DrainStat == healStat) { return(drainEffect); } } } } return(null); }