/// <summary> /// Trigger all procs that can be triggered by the given action /// </summary> /// <param name="active">Whether the triggerer is the attacker/caster (true), or the victim (false)</param> public void Proc(ProcTriggerFlags flags, Unit triggerer, IUnitAction action, bool active) { if (m_brain != null && m_brain.CurrentAction != null && (m_brain.CurrentAction.InterruptFlags & flags) != 0) { // check if the current action has been interrupted m_brain.StopCurrentAction(); } if (m_procHandlers == null) { return; } if (flags.And(ProcTriggerFlags.GainExperience) && !YieldsXpOrHonor) { flags ^= ProcTriggerFlags.GainExperience; } if (flags == ProcTriggerFlags.None) { return; } if (triggerer == null) { log.Error("triggerer was null when triggering Proc by action: {0} (Flags: {1})", action, flags); return; } for (var i = 0; i < m_procHandlers.Count; i++) { var proc = m_procHandlers[i]; if ((proc.ProcTriggerFlags & flags) != 0 && proc.CanBeTriggeredBy(triggerer, action, active)) { if (Utility.Random(0, 101) <= proc.ProcChance) { var charges = proc.StackCount; proc.TriggerProc(triggerer, action); if (charges > 0 && proc.StackCount == 0) { proc.Dispose(); } } } } }