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:
@@ -532,33 +532,29 @@ 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
|
// Allow to remove by stack when aura is going to be applied on owner
|
||||||
if (GetAuraType() == AuraObjectType.DynObj)
|
if (unit != GetOwner())
|
||||||
{
|
{
|
||||||
if (unit.IsInFlight())
|
// check if not stacking aura already on target
|
||||||
addUnit = false;
|
// this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
|
||||||
}
|
foreach (var iter in unit.GetAppliedAuras())
|
||||||
// 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
|
|
||||||
if (unit != m_owner)
|
|
||||||
{
|
{
|
||||||
// check if not stacking aura already on target
|
Aura aura = iter.Value.GetBase();
|
||||||
// this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
|
if (!CanStackWith(aura))
|
||||||
foreach (var iter in unit.GetAppliedAuras())
|
|
||||||
{
|
{
|
||||||
Aura aura = iter.Value.GetBase();
|
addUnit = false;
|
||||||
if (!CanStackWith(aura))
|
break;
|
||||||
{
|
|
||||||
addUnit = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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())))
|
||||||
|
|||||||
Reference in New Issue
Block a user