Core/Spell: do not allow auras from dynamic objects to stack if they come from the same spell cast by the same caster.

Port From (https://github.com/TrinityCore/TrinityCore/commit/55611104bedefc301eb4bee8bc282057307ebde4)
This commit is contained in:
hondacrx
2021-12-27 15:35:20 -05:00
parent 13a3b6f06c
commit 0464fe61bb
+16 -16
View File
@@ -532,19 +532,15 @@ namespace Game.Spells
if (addUnit && !unit.IsHighestExclusiveAura(this, true)) if (addUnit && !unit.IsHighestExclusiveAura(this, true))
addUnit = false; addUnit = false;
// Dynobj auras don't hit flying targets
if (GetAuraType() == AuraObjectType.DynObj && unit.IsInFlight())
addUnit = false;
// Do not apply aura if it cannot stack with existing auras
if (addUnit) if (addUnit)
{
// persistent area aura does not hit flying targets
if (GetAuraType() == AuraObjectType.DynObj)
{
if (unit.IsInFlight())
addUnit = false;
}
// unit auras can not stack with each other
else // (GetAuraType() == UNIT_AURA_TYPE)
{ {
// Allow to remove by stack when aura is going to be applied on owner // Allow to remove by stack when aura is going to be applied on owner
if (unit != m_owner) if (unit != GetOwner())
{ {
// check if not stacking aura already on target // check if not stacking aura already on target
// this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners // this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
@@ -558,7 +554,7 @@ namespace Game.Spells
} }
} }
} }
}
} }
if (!addUnit) if (!addUnit)
@@ -1496,12 +1492,16 @@ namespace Game.Spells
if (this == existingAura) if (this == existingAura)
return true; return true;
// Dynobj auras always stack
if (GetAuraType() == AuraObjectType.DynObj || existingAura.GetAuraType() == AuraObjectType.DynObj)
return true;
SpellInfo existingSpellInfo = existingAura.GetSpellInfo();
bool sameCaster = GetCasterGUID() == existingAura.GetCasterGUID(); bool sameCaster = GetCasterGUID() == existingAura.GetCasterGUID();
SpellInfo existingSpellInfo = existingAura.GetSpellInfo();
// Dynobj auras do not stack when they come from the same spell cast by the same caster
if (GetAuraType() == AuraObjectType.DynObj || existingAura.GetAuraType() == AuraObjectType.DynObj)
{
if (sameCaster && m_spellInfo.Id == existingSpellInfo.Id)
return false;
return true;
}
// passive auras don't stack with another rank of the spell cast by same caster // passive auras don't stack with another rank of the spell cast by same caster
if (IsPassive() && sameCaster && (m_spellInfo.IsDifferentRankOf(existingSpellInfo) || (m_spellInfo.Id == existingSpellInfo.Id && m_castItemGuid.IsEmpty()))) if (IsPassive() && sameCaster && (m_spellInfo.IsDifferentRankOf(existingSpellInfo) || (m_spellInfo.Id == existingSpellInfo.Id && m_castItemGuid.IsEmpty())))