From db683078a7b2bfcc5f9f53a27bd88c81bc895abc Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 24 Feb 2021 23:09:57 +0100 Subject: [PATCH] Core/Auras: Improve PROC_ATTR_USE_STACKS_FOR_CHARGES implementation to give stacks priority over charges if both are present in spell data --- src/server/game/Spells/Auras/SpellAuras.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 94cc4ea76e6..ae3511011d1 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1693,16 +1693,16 @@ void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInf if (!prepare) return; + SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()); + ASSERT(procEntry); + // take one charge, aura expiration will be handled in Aura::TriggerProcOnEvent (if needed) - if (IsUsingCharges() && (!eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR6_DONT_CONSUME_PROC_CHARGES))) + if (!(procEntry->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES)&& IsUsingCharges() && (!eventInfo.GetSpellInfo() || !eventInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR6_DONT_CONSUME_PROC_CHARGES))) { --m_procCharges; SetNeedClientUpdateForTargets(); } - SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()); - ASSERT(procEntry); - // cooldowns should be added to the whole aura (see 51698 area aura) AddProcCooldown(now + procEntry->Cooldown); } @@ -1873,13 +1873,15 @@ void Aura::TriggerProcOnEvent(uint8 procEffectMask, AuraApplication* aurApp, Pro } // Remove aura if we've used last charge to proc - if (IsUsingCharges()) + if (ASSERT_NOTNULL(sSpellMgr->GetSpellProcEntry(GetId()))->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES) + { + ModStackAmount(-1); + } + else if (IsUsingCharges()) { if (!GetCharges()) Remove(); } - else if (ASSERT_NOTNULL(sSpellMgr->GetSpellProcEntry(m_spellInfo->Id))->AttributesMask & PROC_ATTR_USE_STACKS_FOR_CHARGES) - ModStackAmount(-1); } void Aura::_DeleteRemovedApplications()