aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index bf2dfcdb102..485638fd7e0 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -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
+ 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;
-
- SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
- bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
+ }
// 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())))