From ed0afee8fbe5156c7c21547365127165991da914 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 1 May 2025 12:13:37 +0200 Subject: Core/Auras: Interrupt spells with SPELL_PREVENTION_TYPE_PACIFY when applying SPELL_AURA_MOD_PACIFY (cherry picked from commit 150d6995bdc966a5118e65d9bf6b6171faf9c62c) --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7b7f31360b4..32e6044443b 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2472,6 +2472,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)) @@ -2484,12 +2494,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, target->SetUnitFlag(UNIT_FLAG_SILENCED); // 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 { @@ -2509,7 +2514,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 @@ -2557,12 +2567,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 { -- cgit v1.2.3