Skip to content

Commit

Permalink
Force charge destination while charging.
Browse files Browse the repository at this point in the history
  • Loading branch information
ratkosrb committed Jan 22, 2025
1 parent 9f46023 commit 97a5629
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/game/Movement/PointMovementGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ void ChargeMovementGenerator<T>::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;
Expand All @@ -305,7 +306,7 @@ void ChargeMovementGenerator<T>::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);
}
}
Expand Down Expand Up @@ -357,7 +358,7 @@ bool ChargeMovementGenerator<T>::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();
Expand Down
3 changes: 2 additions & 1 deletion src/game/Movement/PointMovementGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -124,6 +124,7 @@ class ChargeMovementGenerator
bool m_triggerAttack;
uint32 m_extrapolateDelay;
bool m_scheduleStopMoving;
bool m_forceDestination;
float m_speed;
float m_meleeReach;
};
Expand Down

0 comments on commit 97a5629

Please sign in to comment.