diff options
author | Nay <dnpd.dd@gmail.com> | 2013-08-11 15:52:23 +0100 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2013-08-11 15:52:23 +0100 |
commit | d0bde02b21241773c908c18ade368a1bbb5ee8bb (patch) | |
tree | aef9ed52c604bb476785c6530a7845811e6661ad | |
parent | 54d2b73f3cf98402b3429124fd4ebbd24e11dba1 (diff) |
Core/CreatureAI: Do not remove clone_caster auras on evade (in addition to control_vehicle auras)
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 5 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 29 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 1 |
3 files changed, 29 insertions, 6 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index a494507919a..cbb79b47958 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -225,8 +225,9 @@ bool CreatureAI::_EnterEvadeMode() if (!me->IsAlive()) return false; - // dont remove vehicle auras, passengers arent supposed to drop off the vehicle - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + // don't remove vehicle auras, passengers aren't supposed to drop off the vehicle + // don't remove clone caster on evade (to be verified) + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_CLONE_CASTER); // sometimes bosses stuck in combat? me->DeleteThreatList(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 327c4b96c34..fc3a9efb908 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4068,19 +4068,40 @@ void Unit::RemoveAllAurasExceptType(AuraType type) for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { Aura const* aura = iter->second->GetBase(); - if (!aura->GetSpellInfo()->HasAura(type)) - _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); - else + if (aura->GetSpellInfo()->HasAura(type)) ++iter; + else + _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); } for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) { Aura* aura = iter->second; - if (!aura->GetSpellInfo()->HasAura(type)) + if (aura->GetSpellInfo()->HasAura(type)) + ++iter; + else RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); + } +} + +void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2) +{ + for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) + { + Aura const* aura = iter->second->GetBase(); + if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2)) + ++iter; else + _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); + } + + for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) + { + Aura* aura = iter->second; + if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2)) ++iter; + else + RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 56f4e7142a2..5e2e746ae63 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1743,6 +1743,7 @@ class Unit : public WorldObject void RemoveAllAurasOnDeath(); void RemoveAllAurasRequiringDeadTarget(); void RemoveAllAurasExceptType(AuraType type); + void RemoveAllAurasExceptType(AuraType type1, AuraType type2); /// @todo: once we support variadic templates use them here void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime); void _RemoveAllAuraStatMods(); |