diff options
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0bc04b4a0b1..70ee3420928 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2490,6 +2490,16 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, target->UpdateDamagePhysical(attType); } +static void InterruptSpellsWithPreventionTypeOnAuraApply(Unit* target, SpellPreventionType preventionType) +{ + // Stop cast only spells vs PreventionType + for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) + if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) + if (spell->m_spellInfo->PreventionType & preventionType) + // Stop spells on prepare or casting state + target->InterruptSpell(CurrentSpellTypes(i), false); +} + void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const { if (!(mode & AURA_EFFECT_HANDLE_REAL)) @@ -2502,12 +2512,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, target->SetSilencedSchoolMask(SpellSchoolMask(GetMiscValue())); // call functions which may have additional effects after changing state of unit - // Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE - for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) - if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) - if (spell->m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_SILENCE) - // Stop spells on prepare or casting state - target->InterruptSpell(CurrentSpellTypes(i), false); + InterruptSpellsWithPreventionTypeOnAuraApply(target, SPELL_PREVENTION_TYPE_SILENCE); } else { @@ -2530,7 +2535,12 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); if (apply) + { target->SetUnitFlag(UNIT_FLAG_PACIFIED); + + // call functions which may have additional effects after changing state of unit + InterruptSpellsWithPreventionTypeOnAuraApply(target, SPELL_PREVENTION_TYPE_PACIFY); + } else { // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit @@ -2578,12 +2588,7 @@ void AuraEffect::HandleAuraModNoActions(AuraApplication const* aurApp, uint8 mod target->SetUnitFlag2(UNIT_FLAG2_NO_ACTIONS); // call functions which may have additional effects after chainging state of unit - // Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_NO_ACTIONS - for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) - if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) - if (spell->m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_NO_ACTIONS) - // Stop spells on prepare or casting state - target->InterruptSpell(CurrentSpellTypes(i), false); + InterruptSpellsWithPreventionTypeOnAuraApply(target, SPELL_PREVENTION_TYPE_NO_ACTIONS); } else { |