aboutsummaryrefslogtreecommitdiff
path: root/src/game/MotionMaster.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-21 10:48:00 -0500
committermegamage <none@none>2009-05-21 10:48:00 -0500
commit67c84b1f3d74985fd2521feb9e536e56b9c9f2e9 (patch)
tree8bad07c2da1392ecaed20b4f295a78e5e2e90545 /src/game/MotionMaster.cpp
parentb7053ecc0d565ba2f91d56f34a616d1992a91562 (diff)
Mobs fleeing and getting assistance feature implementaion. Author: Neo2003
--HG-- branch : trunk
Diffstat (limited to 'src/game/MotionMaster.cpp')
-rw-r--r--src/game/MotionMaster.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index 52b9ba56e3e..da811ab02ed 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -365,7 +365,37 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed)
}
void
-MotionMaster::MoveFleeing(Unit* enemy)
+MotionMaster::MoveSeekAssistance(float x, float y, float z)
+{
+ if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ {
+ sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
+ }
+ else
+ {
+ DEBUG_LOG("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
+ i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z );
+ Mutate(new AssistanceMovementGenerator(x,y,z), MOTION_SLOT_ACTIVE);
+ }
+}
+
+void
+MotionMaster::MoveSeekAssistanceDistract(uint32 time)
+{
+ if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ {
+ sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
+ }
+ else
+ {
+ DEBUG_LOG("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
+ i_owner->GetEntry(), i_owner->GetGUIDLow(), time );
+ Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
+ }
+}
+
+void
+MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
if(!enemy)
return;
@@ -382,11 +412,15 @@ MotionMaster::MoveFleeing(Unit* enemy)
}
else
{
- DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)",
+ DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
- enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
- Mutate(new FleeingMovementGenerator<Creature>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
+ enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
+ time ? " for a limited time" : "");
+ if (time)
+ Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
+ else
+ Mutate(new FleeingMovementGenerator<Creature>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
}