mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Spell: do not allow auras from dynamic objects to stack if they come from the same spell cast by the same caster.
(cherry picked from commit b87350807d)
This commit is contained in:
@@ -654,30 +654,25 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
|
||||
if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
|
||||
addUnit = false;
|
||||
|
||||
// Dynobj auras don't hit flying targets
|
||||
if (GetType() == DYNOBJ_AURA_TYPE && itr->first->IsInFlight())
|
||||
addUnit = false;
|
||||
|
||||
// Do not apply aura if it cannot stack with existing auras
|
||||
if (addUnit)
|
||||
{
|
||||
// persistent area aura does not hit flying targets
|
||||
if (GetType() == DYNOBJ_AURA_TYPE)
|
||||
// Allow to remove by stack when aura is going to be applied on owner
|
||||
if (itr->first != GetOwner())
|
||||
{
|
||||
if (itr->first->IsInFlight())
|
||||
addUnit = false;
|
||||
}
|
||||
// unit auras can not stack with each other
|
||||
else // (GetType() == UNIT_AURA_TYPE)
|
||||
{
|
||||
// Allow to remove by stack when aura is going to be applied on owner
|
||||
if (itr->first != GetOwner())
|
||||
// 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
|
||||
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
|
||||
{
|
||||
// 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
|
||||
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (!CanStackWith(aura))
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (!CanStackWith(aura))
|
||||
{
|
||||
addUnit = false;
|
||||
break;
|
||||
}
|
||||
addUnit = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1571,12 +1566,16 @@ bool Aura::CanStackWith(Aura const* existingAura) const
|
||||
if (this == existingAura)
|
||||
return true;
|
||||
|
||||
// Dynobj auras always stack
|
||||
if (GetType() == DYNOBJ_AURA_TYPE || existingAura->GetType() == DYNOBJ_AURA_TYPE)
|
||||
return true;
|
||||
|
||||
SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
|
||||
bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
|
||||
SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
|
||||
|
||||
// Dynobj auras do not stack when they come from the same spell cast by the same caster
|
||||
if (GetType() == DYNOBJ_AURA_TYPE || existingAura->GetType() == DYNOBJ_AURA_TYPE)
|
||||
{
|
||||
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
|
||||
if (IsPassive() && sameCaster && (m_spellInfo->IsDifferentRankOf(existingSpellInfo) || (m_spellInfo->Id == existingSpellInfo->Id && m_castItemGuid.IsEmpty())))
|
||||
|
||||
Reference in New Issue
Block a user