Core/SAI: Self-casted auras should not be removed when the NPC resets

Signed-off-by: Subv2112 <s.v.h21@hotmail.com>
This commit is contained in:
Subv2112
2012-01-05 15:09:55 -05:00
parent 8197c37a92
commit d889edb436
2 changed files with 28 additions and 2 deletions

View File

@@ -431,13 +431,37 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
MovepointReached(Data);
}
void SmartAI::RemoveAuras()
{
Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !(iter->second->GetTarget() == me && aura->GetCaster() == me))
me->_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
}
Unit::AuraMap ownedAuras = me->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();)
{
Aura* aura = iter->second;
if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE))
me->RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
}
me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE);
}
void SmartAI::EnterEvadeMode()
{
if (!me->isAlive())
return;
// Vehicles should not dismount their passengers on evade mode
me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE);
RemoveAuras();
me->DeleteThreatList();
me->CombatStop(true);

View File

@@ -193,6 +193,8 @@ class SmartAI : public CreatureAI
mDespawnState = t ? 1 : 0;
}
void StartDespawn() { mDespawnState = 2; }
void RemoveAuras();
private:
uint32 mFollowCreditType;