diff --git a/src/game/Movement/PointMovementGenerator.cpp b/src/game/Movement/PointMovementGenerator.cpp index 198e576dd75..0e9a44d5113 100644 --- a/src/game/Movement/PointMovementGenerator.cpp +++ b/src/game/Movement/PointMovementGenerator.cpp @@ -280,7 +280,8 @@ void ChargeMovementGenerator::ComputePath(T& attacker, Unit& victim) victim.GetPosition(victimPos.x, victimPos.y, victimPos.z); // Base path is to current victim position - path.calculate(victimPos.x, victimPos.y, victimPos.z, false); + m_forceDestination = attacker.HasUnitMovementFlag(MOVEFLAG_FALLINGFAR) && attacker.GetPositionZ() > victim.GetPositionZ(); + path.calculate(victimPos.x, victimPos.y, victimPos.z, m_forceDestination); Player* victimPlayer = sWorld.getConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_CHARGE) ? victim.ToPlayer() : nullptr; @@ -305,7 +306,7 @@ void ChargeMovementGenerator::ComputePath(T& attacker, Unit& victim) if (victimPlayer->ExtrapolateMovement(victimPlayer->m_movementInfo, m_extrapolateDelay, victimPos.x, victimPos.y, victimPos.z, o)) { victim.UpdateAllowedPositionZ(victimPos.x, victimPos.y, victimPos.z); - path.calculate(victimPos.x, victimPos.y, victimPos.z, false); + path.calculate(victimPos.x, victimPos.y, victimPos.z, m_forceDestination); path.UpdateForMelee(&victim, m_meleeReach); } } @@ -357,7 +358,7 @@ bool ChargeMovementGenerator::Update(T& unit, uint32 const& diff) if (!unit.movespline->Finalized() && m_recalculateSpeed) { m_recalculateSpeed = false; - path.calculate(path.getEndPosition().x, path.getEndPosition().y, path.getEndPosition().z, false); + path.calculate(path.getEndPosition().x, path.getEndPosition().y, path.getEndPosition().z, m_forceDestination); Initialize(unit); } return !unit.movespline->Finalized(); diff --git a/src/game/Movement/PointMovementGenerator.h b/src/game/Movement/PointMovementGenerator.h index b3d5f8d387c..b26dc0a924d 100644 --- a/src/game/Movement/PointMovementGenerator.h +++ b/src/game/Movement/PointMovementGenerator.h @@ -103,7 +103,7 @@ class ChargeMovementGenerator { public: ChargeMovementGenerator(T& attacker, Unit& victim, uint32 extrapolationDelay = 0, bool triggerAttack = false, float speed = 0.0f, float meleeReach = 0.0f) : - path(&attacker), m_victimGuid(victim.GetObjectGuid()), m_recalculateSpeed(false), m_triggerAttack(triggerAttack), m_extrapolateDelay(extrapolationDelay), m_scheduleStopMoving(false), m_speed(speed), m_meleeReach(meleeReach) + path(&attacker), m_victimGuid(victim.GetObjectGuid()), m_recalculateSpeed(false), m_triggerAttack(triggerAttack), m_extrapolateDelay(extrapolationDelay), m_scheduleStopMoving(false), m_forceDestination(false), m_speed(speed), m_meleeReach(meleeReach) { ComputePath(attacker, victim); } @@ -124,6 +124,7 @@ class ChargeMovementGenerator bool m_triggerAttack; uint32 m_extrapolateDelay; bool m_scheduleStopMoving; + bool m_forceDestination; float m_speed; float m_meleeReach; };