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)
This commit is contained in:
hondacrx
2021-02-24 18:58:15 -05:00
parent 5e5cf97963
commit ac4e96bad7
+9 -8
View File
@@ -1666,17 +1666,16 @@ namespace Game.Spells
if (!prepare) if (!prepare)
return; return;
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
Cypher.Assert(procEntry != null);
// take one charge, aura expiration will be handled in Aura.TriggerProcOnEvent (if needed) // take one charge, aura expiration will be handled in Aura.TriggerProcOnEvent (if needed)
if (IsUsingCharges()) if (!procEntry.AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges) && IsUsingCharges())
{ {
--m_procCharges; --m_procCharges;
SetNeedClientUpdateForTargets(); SetNeedClientUpdateForTargets();
} }
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetSpellInfo());
Cypher.Assert(procEntry != null);
// cooldowns should be added to the whole aura (see 51698 area aura) // cooldowns should be added to the whole aura (see 51698 area aura)
AddProcCooldown(now + TimeSpan.FromMilliseconds(procEntry.Cooldown)); AddProcCooldown(now + TimeSpan.FromMilliseconds(procEntry.Cooldown));
@@ -1862,13 +1861,15 @@ namespace Game.Spells
} }
// Remove aura if we've used last charge to proc // 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) if (GetCharges() == 0)
Remove(); Remove();
} }
else if (Global.SpellMgr.GetSpellProcEntry(m_spellInfo).AttributesMask.HasAnyFlag(ProcAttributes.UseStacksForCharges))
ModStackAmount(-1);
} }
public float CalcPPMProcChance(Unit actor) public float CalcPPMProcChance(Unit actor)