mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 12:52:25 +01:00
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:
@@ -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);
|
||||
|
||||
@@ -193,6 +193,8 @@ class SmartAI : public CreatureAI
|
||||
mDespawnState = t ? 1 : 0;
|
||||
}
|
||||
void StartDespawn() { mDespawnState = 2; }
|
||||
|
||||
void RemoveAuras();
|
||||
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
|
||||
Reference in New Issue
Block a user