/// <summary> /// Trigger proc on the caster of the spell. /// </summary> /// <param name="flags">What spell caster casted ie. ProcTriggerFlags.DoneHarmfulSpell</param> /// <param name="hitFlags">Hit result of the spell</param> private void TriggerProcOnCaster(ProcTriggerFlags flags, ProcHitFlags hitFlags) { var casterAction = new SimpleUnitAction { Attacker = CasterUnit, Spell = Spell, Victim = m_hitInfoByTarget.Count > 0 ? m_hitInfoByTarget.First().Key : null, IsCritical = hitFlags.HasAnyFlag(ProcHitFlags.CriticalHit) }; var triggerer = UnitTargets.FirstOrDefault(); CasterUnit.Proc(flags, triggerer, casterAction, true, hitFlags); }
/// <summary> /// Triggers proc on all targets of SpellCast /// </summary> /// <param name="flags">What happened to targets ie. ProcTriggerFlags.ReceivedHarmfulSpell</param> /// <returns>Combination of hit result on all targets.</returns> private ProcHitFlags TriggerProcOnTargets(ProcTriggerFlags flags) { ProcHitFlags hitFlagsCombination = ProcHitFlags.None; foreach (var hitInfo in m_hitInfoByTarget) { Unit target = hitInfo.Key; ProcHitFlags targetHitFlags = hitInfo.Value; hitFlagsCombination |= targetHitFlags; var action = new SimpleUnitAction { Attacker = CasterUnit, Spell = Spell, Victim = target, IsCritical = targetHitFlags.HasAnyFlag(ProcHitFlags.CriticalHit) }; target.Proc(flags, CasterUnit, action, true, targetHitFlags); } return(hitFlagsCombination); }