Skip to content

Commit

Permalink
[12316] Add Unit::RemoveAllAurasOnEvade
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmoozerd committed Dec 17, 2012
1 parent 0ef988e commit 6bba6bb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game/AggressorAI.cpp
Expand Up @@ -106,7 +106,7 @@ void AggressorAI::EnterEvadeMode()

if (!m_creature->isCharmed())
{
m_creature->RemoveAllAuras();
m_creature->RemoveAllAurasOnEvade();

// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
Expand Down
2 changes: 1 addition & 1 deletion src/game/CreatureEventAI.cpp
Expand Up @@ -909,7 +909,7 @@ void CreatureEventAI::JustReachedHome()

void CreatureEventAI::EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->RemoveAllAurasOnEvade();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);

Expand Down
2 changes: 1 addition & 1 deletion src/game/GuardAI.cpp
Expand Up @@ -93,7 +93,7 @@ void GuardAI::EnterEvadeMode()
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim out run him [guid=%u]", m_creature->GetGUIDLow());
}

m_creature->RemoveAllAuras();
m_creature->RemoveAllAurasOnEvade();
m_creature->DeleteThreatList();
i_victimGuid.Clear();
m_creature->CombatStop(true);
Expand Down
2 changes: 1 addition & 1 deletion src/game/ReactorAI.cpp
Expand Up @@ -109,7 +109,7 @@ ReactorAI::EnterEvadeMode()
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, victim %s [guid=%u]", victim->isAlive() ? "out run him" : "is dead", m_creature->GetGUIDLow());
}

m_creature->RemoveAllAuras();
m_creature->RemoveAllAurasOnEvade();
m_creature->DeleteThreatList();
i_victimGuid.Clear();
m_creature->CombatStop(true);
Expand Down
17 changes: 17 additions & 0 deletions src/game/Unit.cpp
Expand Up @@ -4981,6 +4981,23 @@ void Unit::RemoveAllAurasOnDeath()
}
}

void Unit::RemoveAllAurasOnEvade()
{
// used when evading to remove all auras except some special auras
// Vehicle control auras should not be removed on evade - neither should linked auras
for (SpellAuraHolderMap::iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end();)
{
SpellEntry const* proto = iter->second->GetSpellProto();
if (!IsSpellHaveAura(proto, SPELL_AURA_CONTROL_VEHICLE))
{
RemoveSpellAuraHolder(iter->second, AURA_REMOVE_BY_DEFAULT);
iter = m_spellAuraHolders.begin();
}
else
++iter;
}
}

void Unit::DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid)
{
SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId);
Expand Down
1 change: 1 addition & 0 deletions src/game/Unit.h
Expand Up @@ -1560,6 +1560,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void RemoveAllAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveArenaAuras(bool onleave = false);
void RemoveAllAurasOnDeath();
void RemoveAllAurasOnEvade();

// removing specific aura FROM stack by diff reasons and selections
void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, ObjectGuid casterGuid = ObjectGuid(), AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12315"
#define REVISION_NR "12316"
#endif // __REVISION_NR_H__

1 comment on commit 6bba6bb

@VladimirMangos
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add special inline function to similar existed: IsSpellAuraPersistentAtEvade() and use it instead direct check. This let have like info for different cases in one place.. Hmm, or maybe this will hard in existed way aura search (

Please sign in to comment.