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.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 350e9d7ee13..2fc4cf938cf 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -97,6 +97,33 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
AttackStart(who->getVictim());
}
+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::UpdateVictimByReact()
{
if(!me->isInCombat())