Core/SAI: Fixed the behaviour of SmartAI::RemoveAuras, it should only remove the auras that are applied on the unit by casters other than the unit
Signed-off-by: Subv2112 <[email protected]>
This commit is contained in:
@@ -433,24 +433,13 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
|||||||
|
|
||||||
void SmartAI::RemoveAuras()
|
void SmartAI::RemoveAuras()
|
||||||
{
|
{
|
||||||
|
// Only loop throught the applied auras, because here is where all auras on the current unit are stored
|
||||||
Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
|
Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
|
||||||
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
|
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter)
|
||||||
{
|
{
|
||||||
Aura const* aura = iter->second->GetBase();
|
Aura const* aura = iter->second->GetBase();
|
||||||
if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !(iter->second->GetTarget() == me && aura->GetCaster() == me))
|
if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCaster() != me)
|
||||||
me->_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
|
me->RemoveAurasDueToSpell(aura->GetId());
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user