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.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 9f06ca38b56..165bb2411ec 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -91,6 +91,13 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
pPlayer->SetInCombatWith(creature);
creature->AddThreat(pPlayer, 0.0f);
}
+
+ for(Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr)
+ {
+ creature->SetInCombatWith(*itr);
+ (*itr)->SetInCombatWith(creature);
+ creature->AddThreat(*itr, 0.0f);
+ }
}
}
}
@@ -148,7 +155,6 @@ bool CreatureAI::UpdateVictim()
{
if(!me->isInCombat())
return false;
-
if(Unit *victim = me->SelectVictim())
AttackStart(victim);
return me->getVictim();
@@ -194,10 +200,16 @@ void CreatureAI::EnterEvadeMode()
if(!_EnterEvadeMode())
return;
- if(Unit *owner = me->GetCharmerOrOwner())
- me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, MOTION_SLOT_IDLE);
- else
- me->GetMotionMaster()->MoveTargetedHome();
+ if(!me->m_Vehicle) // otherwise me will be in evade mode forever
+ {
+ if(Unit *owner = me->GetCharmerOrOwner())
+ {
+ me->GetMotionMaster()->Clear(false);
+ me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE);
+ }
+ else
+ me->GetMotionMaster()->MoveTargetedHome();
+ }
Reset();
}