SmartAI: Use same method for removing auras in EnterEvadeMode as in CreatureAI
Also fixes warnings about duplicate auras. Self-casted auras were not removed on entering evade mode in SAI as they are in CreatureAI.
This commit is contained in:
1 parent
338a0047c5
commit
7630b3c627
2 files changed
+1
-17
No files matched your search
@@ -412,26 +412,12 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
||||
MovepointReached(Data);
|
||||
}
|
||||
|
||||
void SmartAI::RemoveAuras()
|
||||
{
|
||||
/// @fixme: duplicated logic in CreatureAI::_EnterEvadeMode (could use RemoveAllAurasExceptType)
|
||||
Unit::AuraApplicationMap& appliedAuras = me->GetAppliedAuras();
|
||||
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && !aura->HasEffectType(SPELL_AURA_CLONE_CASTER) && aura->GetCasterGUID() != me->GetGUID())
|
||||
me->RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void SmartAI::EnterEvadeMode()
|
||||
{
|
||||
if (!me->IsAlive() || me->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
RemoveAuras();
|
||||
me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_CLONE_CASTER);
|
||||
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
me->DeleteThreatList();
|
||||
|
||||
Reference in new issue
Block a user