move & knockback

This commit is contained in:
Yunfan Li
2023-09-02 10:43:13 +08:00
parent 62e49a966d
commit 5f5faf00cd
5 changed files with 103 additions and 75 deletions

View File

@@ -3,6 +3,7 @@
*/
#include "MovementActions.h"
#include "MotionMaster.h"
#include "MovementGenerator.h"
#include "ObjectDefines.h"
#include "ObjectGuid.h"
@@ -168,9 +169,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
bot->CastStop();
botAI->InterruptSpell();
}
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
!bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
// char speak[100];
// sprintf(speak, "Move to : (%.2f, %.2f, %.2f), generatePath: %d", x, y, z, generatePath);
// bot->Say(speak, LANG_UNIVERSAL);
MotionMaster &mm = *bot->GetMotionMaster();
mm.Clear();
mm.MovePoint(mapId, x, y, z, generatePath);
@@ -752,6 +755,9 @@ bool MovementAction::IsMovingAllowed()
bot->HasUnitState(UNIT_STATE_LOST_CONTROL))
return false;
if (bot->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_CONTROLLED)) {
return false;
}
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
}