Core/Auras: Added support for SPELL_ATTR5_LIMIT_N limit to other number than just 1

Port From (https://github.com/TrinityCore/TrinityCore/commit/d818add0e20fcf2c86ef46b5cd94f942488511a0)
This commit is contained in:
hondacrx
2022-06-01 13:51:21 -04:00
parent 35b5a28821
commit c7ea51d1dd
3 changed files with 13 additions and 9 deletions
+11 -7
View File
@@ -3934,14 +3934,18 @@ namespace Game.Entities
// register single target aura
caster.m_scAuras.Add(aura);
// remove other single target auras
var scAuras = caster.GetSingleCastAuras();
for (var i = 0; i < scAuras.Count; ++i)
{
var aur = scAuras[i];
if (aur != aura && aur.IsSingleTargetWith(aura))
aur.Remove();
Queue<Aura> aurasSharingLimit = new();
// remove other single target auras
foreach (Aura scAura in caster.GetSingleCastAuras())
if (scAura != aura && scAura.IsSingleTargetWith(aura))
aurasSharingLimit.Enqueue(scAura);
uint maxOtherAuras = aura.GetSpellInfo().MaxAffectedTargets - 1;
while (aurasSharingLimit.Count > maxOtherAuras)
{
aurasSharingLimit.Peek().Remove();
aurasSharingLimit.Dequeue();
}
}
}