aboutsummaryrefslogtreecommitdiff
path: root/src/game/NullCreatureAI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/NullCreatureAI.cpp')
-rw-r--r--src/game/NullCreatureAI.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/game/NullCreatureAI.cpp b/src/game/NullCreatureAI.cpp
index 4c1cb592967..164aa2f7974 100644
--- a/src/game/NullCreatureAI.cpp
+++ b/src/game/NullCreatureAI.cpp
@@ -19,7 +19,23 @@
*/
#include "NullCreatureAI.h"
+#include "Creature.h"
-NullCreatureAI::~NullCreatureAI()
+void PassiveAI::UpdateAI(const uint32)
{
+ if(me->isInCombat() && me->getAttackers().empty())
+ EnterEvadeMode();
+}
+
+void CritterAI::DamageTaken(Unit *done_by, uint32 &)
+{
+ if(!me->hasUnitState(UNIT_STAT_FLEEING))
+ me->SetControlled(true, UNIT_STAT_FLEEING);
+}
+
+void CritterAI::EnterEvadeMode()
+{
+ if(me->hasUnitState(UNIT_STAT_FLEEING))
+ me->SetControlled(false, UNIT_STAT_FLEEING);
+ CreatureAI::EnterEvadeMode();
}