private SpellCastResult ValidateAuras() { if (spellCastFlags.HasTargetFlag(SpellCastFlags.IgnoreCasterAuras)) { return(SpellCastResult.Success); } bool usableWhileStunned = SpellInfo.HasAttribute(SpellExtraAttributes.UsableWhileStunned); bool usableWhileConfused = SpellInfo.HasAttribute(SpellExtraAttributes.UsableWhileConfused); bool usableWhileFeared = SpellInfo.HasAttribute(SpellExtraAttributes.UsableWhileFeared); if (Caster.HasFlag(UnitFlags.Stunned)) { if (usableWhileStunned) { SpellCastResult result = ValidateMechanics(AuraEffectType.StunState); if (result != SpellCastResult.Success) { return(result); } } else if (!WillCancelStun()) { return(SpellCastResult.Stunned); } } if (SpellInfo.PreventionType != 0) { if (SpellInfo.PreventionType.HasTargetFlag(SpellPreventionType.Pacify) && Caster.HasFlag(UnitFlags.Pacified) && !WillCancelPacify()) { return(SpellCastResult.Pacified); } if (SpellInfo.PreventionType.HasTargetFlag(SpellPreventionType.Silence) && Caster.HasFlag(UnitFlags.Silenced) && !WillCancelSilence()) { return(SpellCastResult.Silenced); } } if (Caster.HasFlag(UnitFlags.Fleeing)) { if (usableWhileFeared) { SpellCastResult result = ValidateMechanics(AuraEffectType.ModFear); if (result != SpellCastResult.Success) { return(result); } } else if (!WillCancelFear()) { return(SpellCastResult.Fleeing); } } if (Caster.HasFlag(UnitFlags.Confused)) { if (usableWhileConfused) { SpellCastResult result = ValidateMechanics(AuraEffectType.ConfusionState); if (result != SpellCastResult.Success) { return(result); } } else if (!WillCancelConfuse()) { return(SpellCastResult.Confused); } } return(SpellCastResult.Success); bool WillCancelStun() { return(SpellInfo.CanCancelAuraType(AuraEffectType.StunState, Caster) && SpellInfo.CanCancelAuraType(AuraEffectType.Strangulate, Caster)); } bool WillCancelSilence() { return(SpellInfo.CanCancelAuraType(AuraEffectType.Silence, Caster) && SpellInfo.CanCancelAuraType(AuraEffectType.SilencePacify, Caster)); } bool WillCancelPacify() { return(SpellInfo.CanCancelAuraType(AuraEffectType.Pacify, Caster) && SpellInfo.CanCancelAuraType(AuraEffectType.SilencePacify, Caster)); } bool WillCancelFear() { return(SpellInfo.CanCancelAuraType(AuraEffectType.ModFear, Caster)); } bool WillCancelConfuse() { return(SpellInfo.CanCancelAuraType(AuraEffectType.ConfusionState, Caster)); } }