aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Unit.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index bb337ec9d7f..84e2e2dc0ed 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4155,23 +4155,45 @@ bool Unit::AddAura(Aura *Aur)
spellEffectPair spair = spellEffectPair(Aur->GetId(), Aur->GetEffIndex());
+ bool stackModified=false;
// passive and persistent auras can stack with themselves any number of times
if (!Aur->IsPassive() && !Aur->IsPersistent())
{
- for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair); ++i2)
+ for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair);)
{
if(i2->second->GetCasterGUID()==Aur->GetCasterGUID())
{
// replace aura if next will > spell StackAmount
- if(aurSpellInfo->StackAmount)
+ if(aurSpellInfo->StackAmount && !stackModified)
{
+ // prevent adding stack more than once
+ stackModified=true;
Aur->SetStackAmount(i2->second->GetStackAmount());
if(Aur->GetStackAmount() < aurSpellInfo->StackAmount)
Aur->SetStackAmount(Aur->GetStackAmount()+1);
+ RemoveAura(i2,AURA_REMOVE_BY_STACK);
+ i2=m_Auras.lower_bound(spair);
+ continue;
}
- // can be only single (this check done at _each_ aura add
- RemoveAura(i2,AURA_REMOVE_BY_STACK);
- break;
+ }
+ switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()])
+ {
+ // DOT or HOT from different casters will stack
+ case SPELL_AURA_PERIODIC_DAMAGE:
+ case SPELL_AURA_PERIODIC_HEAL:
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
+ case SPELL_AURA_PERIODIC_ENERGIZE:
+ case SPELL_AURA_PERIODIC_MANA_LEECH:
+ case SPELL_AURA_PERIODIC_LEECH:
+ case SPELL_AURA_POWER_BURN_MANA:
+ case SPELL_AURA_OBS_MOD_MANA:
+ case SPELL_AURA_OBS_MOD_HEALTH:
+ ++i2;
+ continue;
+ default:
+ RemoveAura(i2,AURA_REMOVE_BY_STACK);
+ i2=m_Auras.lower_bound(spair);
+ continue;
}
}
}
@@ -4313,6 +4335,9 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
uint32 i_spellId = i_spellProto->Id;
+ if (spellId==i_spellId)
+ continue;
+
if(IsPassiveSpell(i_spellId))
{
if(IsPassiveStackableSpell(i_spellId))