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
@@ -1762,7 +1762,7 @@ namespace Framework.Constants
RemoveEnteringArena = 0x04, // Remove Entering Arena Description Force This Aura To Be Removed On Entering Arena, Regardless Of Other Properties
AllowWhileStunned = 0x08, // Allow While Stunned
TriggersChanneling = 0x10, // Triggers Channeling
LimitN = 0x20, /*Incomplete Impl*/ // Limit N Description Remove Previous Application To Another Unit If Applied
LimitN = 0x20, // Limit N Description Remove Previous Application To Another Unit If Applied
IgnoreAreaEffectPvpCheck = 0x40, /*Nyi*/ // Ignore Area Effect Pvp Check
NotOnPlayer = 0x80, /*Nyi*/ // Not On Player
NotOnPlayerControlledNpc = 0x100, /*Nyi*/ // Not On Player Controlled Npc
+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();
}
}
}
+1 -1
View File
@@ -4379,7 +4379,7 @@ namespace Game.Entities
if (spellInfo.ActiveIconFileDataId == 135754) // flight
spellInfo.Attributes |= SpellAttr0.Passive;
if (spellInfo.IsSingleTarget())
if (spellInfo.IsSingleTarget() && spellInfo.MaxAffectedTargets == 0)
spellInfo.MaxAffectedTargets = 1;
}