aboutsummaryrefslogtreecommitdiff
path: root/src/game/CreatureAI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/CreatureAI.cpp')
-rw-r--r--src/game/CreatureAI.cpp59
1 files changed, 5 insertions, 54 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 20acf216c82..53d9286fba7 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -125,42 +125,6 @@ void CreatureAI::SelectNearestTarget(Unit *who)
}
}
-void CreatureAI::SetGazeOn(Unit *target)
-{
- if(me->canAttack(target))
- {
- AttackStart(target);
- me->SetReactState(REACT_PASSIVE);
- }
-}
-
-bool CreatureAI::UpdateVictimWithGaze()
-{
- if(!me->isInCombat())
- return false;
-
- if(me->HasReactState(REACT_PASSIVE))
- {
- if(me->getVictim())
- return true;
- else
- me->SetReactState(REACT_AGGRESSIVE);
- }
-
- if(Unit *victim = me->SelectVictim())
- AttackStart(victim);
- return me->getVictim();
-}
-
-bool CreatureAI::UpdateVictim()
-{
- if(!me->isInCombat())
- return false;
- if(Unit *victim = me->SelectVictim())
- AttackStart(victim);
- return me->getVictim();
-}
-
bool CreatureAI::UpdateCombatState()
{
if(!me->isInCombat())
@@ -181,26 +145,13 @@ bool CreatureAI::UpdateCombatState()
return true;
}
-bool CreatureAI::_EnterEvadeMode()
-{
- if(me->IsInEvadeMode() || !me->isAlive())
- return false;
-
- me->RemoveAllAuras();
- me->DeleteThreatList();
- me->CombatStop(true);
- me->LoadCreaturesAddon();
- me->SetLootRecipient(NULL);
- me->ResetPlayerDamageReq();
-
- return true;
-}
-
void CreatureAI::EnterEvadeMode()
{
if(!_EnterEvadeMode())
return;
+ sLog.outDebug("Creature %u enters evade mode.", me->GetEntry());
+
if(!me->GetVehicle()) // otherwise me will be in evade mode forever
{
if(Unit *owner = me->GetCharmerOrOwner())
@@ -212,10 +163,10 @@ void CreatureAI::EnterEvadeMode()
me->GetMotionMaster()->MoveTargetedHome();
}
- if(me->IsVehicle())
- me->GetVehicleKit()->InstallAllAccessories();
-
Reset();
+
+ if(me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
+ me->GetVehicleKit()->Reset();
}
/*void CreatureAI::AttackedBy( Unit* attacker )