*Fix mounts.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-03-10 17:11:10 +01:00
parent 19af8f62ad
commit 8ba090d0b4
+30 -5
View File
@@ -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))