From ac4e96bad7490efe7c335c4785730418dd382f98 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 24 Feb 2021 18:58:15 -0500 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 Port From (https://github.com/TrinityCore/TrinityCore/commit/8740c2f85fe28a9396383b313f8fa2a5210e3200) --- Source/Game/Spells/Auras/Aura.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 722778573..280207ed9 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -1666,17 +1666,16 @@ namespace Game.Spells if (!prepare) return; + SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo()); + Cypher.Assert(procEntry != null); + // take one charge, aura expiration will be handled in Aura.TriggerProcOnEvent (if needed) - if (IsUsingCharges()) + if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges) && IsUsingCharges()) { --m_procCharges; SetNeedClientUpdateForTargets(); } - SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo()); - - Cypher.Assert(procEntry != null); - // cooldowns should be added to the whole aura (see 51698 area aura) AddProcCooldown(now + TimeSpan.FromMilliseconds(procEntry.Cooldown)); @@ -1862,13 +1861,15 @@ namespace Game.Spells } // Remove aura if we've used last charge to proc - if (IsUsingCharges()) + if (Global.SpellMgr.GetSpellProcEntry(m_spellInfo).AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges)) + { + ModStackAmount(-1); + } + else if (IsUsingCharges()) { if (GetCharges() == 0) Remove(); } - else if (Global.SpellMgr.GetSpellProcEntry(m_spellInfo).AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges)) - ModStackAmount(-1); } public float CalcPPMProcChance(Unit actor)