diff options
author | megamage <none@none> | 2009-05-16 16:52:57 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-16 16:52:57 -0500 |
commit | c583767ad681dfe006fbdcfe9768f096d19c347f (patch) | |
tree | cd635f772778880dc5722417874911d0faece1cd /src/game/CreatureAI.cpp | |
parent | a0ba5dc20608c5f415f05bbd52480944909b4ad2 (diff) |
*Update gluth script.
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAI.cpp')
-rw-r--r-- | src/game/CreatureAI.cpp | 27 |
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()) |