aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-03-10 00:34:03 +0100
committerQAston <none@none>2009-03-10 00:34:03 +0100
commit1fe1d6c094aac00ab5f52dfb36759293d7561b33 (patch)
tree4253783e1860cd71d577c1e0b9541a0579077216 /src
parent2cf3028e38e83d77a7aa7f71795d5b6bcc42f6e9 (diff)
Update stacking code.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp5
-rw-r--r--src/game/SpellMgr.cpp3
-rw-r--r--src/game/Unit.cpp59
3 files changed, 33 insertions, 34 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 034370f9564..99adb488eb1 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -908,11 +908,6 @@ void Aura::_AddAura()
void Aura::_RemoveAura()
{
- // Remove all triggered by aura spells vs unlimited duration
- // except same aura replace case
- if(m_removeMode!=AURA_REMOVE_BY_STACK)
- CleanupTriggeredSpells();
-
Unit* caster = GetCaster();
if(caster && IsPersistent())
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index c01b3c69ca3..9320d26d88d 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1400,6 +1400,9 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
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:
return false;
default:
break;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7ccdb5dce75..d8a41165479 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4158,7 +4158,6 @@ bool Unit::AddAura(Aura *Aur)
// passive and persistent auras can stack with themselves any number of times
if (!Aur->IsPassive() && !Aur->IsPersistent())
{
- // if StackAmount==0 not allow auras from same caster
for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair); ++i2)
{
if(i2->second->GetCasterGUID()==Aur->GetCasterGUID())
@@ -4174,30 +4173,6 @@ bool Unit::AddAura(Aura *Aur)
RemoveAura(i2,AURA_REMOVE_BY_STACK);
break;
}
-
- bool stop = false;
- switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()])
- {
- // DoT/HoT/etc
- case SPELL_AURA_PERIODIC_DAMAGE: // allow stack
- case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
- case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_PERIODIC_HEAL:
- case SPELL_AURA_OBS_MOD_HEALTH:
- case SPELL_AURA_PERIODIC_MANA_LEECH:
- case SPELL_AURA_PERIODIC_ENERGIZE:
- case SPELL_AURA_OBS_MOD_MANA:
- case SPELL_AURA_POWER_BURN_MANA:
- break;
- default: // not allow
- // can be only single (this check done at _each_ aura add
- RemoveAura(i2,AURA_REMOVE_BY_STACK);
- stop = true;
- break;
- }
-
- if(stop)
- break;
}
}
@@ -4350,8 +4325,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
uint32 i_effIndex = (*i).second->GetEffIndex();
- if(i_spellId == spellId) continue;
-
bool is_triggered_by_spell = false;
// prevent triggered aura of removing aura that triggered it
for(int j = 0; j < 3; ++j)
@@ -4408,7 +4381,22 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
continue;
}
- RemoveAurasDueToSpell(i_spellId);
+
+ // Remove all auras by aura caster
+ for (uint8 a=0;a<3;++a)
+ {
+ spellEffectPair spair = spellEffectPair((*i).second->GetId(), a);
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
+ {
+ if(iter->second->GetCasterGUID()==(*i).second->GetCasterGUID())
+ {
+ RemoveAura(iter, AURA_REMOVE_BY_STACK);
+ iter = m_Auras.lower_bound(spair);
+ }
+ else
+ ++iter;
+ }
+ }
if( m_Auras.empty() )
break;
@@ -4746,8 +4734,21 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
Aur->_RemoveAura();
- if(mode != AURA_REMOVE_BY_STACK)
+ bool stack = false;
+ spellEffectPair spair = spellEffectPair(Aur->GetId(), Aur->GetEffIndex());
+ for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
{
+ if (itr->second->GetCasterGUID()==GetGUID())
+ {
+ stack = true;
+ }
+ }
+ if (!stack)
+ {
+ // Remove all triggered by aura spells vs unlimited duration
+ CleanupTriggeredSpells();
+
+ // Remove Linked Auras
uint32 id = Aur->GetId();
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
{