Revert reach combat to

This commit is contained in:
Yunfan Li
2024-08-05 00:40:34 +08:00
parent de37cfd5aa
commit e35fc087e1

View File

@@ -790,16 +790,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
float dx = cos(angle) * needToGo + bx;
float dy = sin(angle) * needToGo + by;
float dz; // = std::max(bz, tz); // calc accurate z position to avoid stuck
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD)) // target is moving forward, predict the position
{
float timeToGo = MoveDelay(abs(needToGo));
float targetMoveDist = timeToGo * target->GetSpeed(MOVE_RUN);
targetMoveDist = std::min(5.0f, targetMoveDist);
dx += targetMoveDist * cos(target->GetOrientation());
dy += targetMoveDist * sin(target->GetOrientation());
}
if (distanceToTarget > CONTACT_DISTANCE)
{
dz = bz + (tz - bz) * (needToGo / distanceToTarget);
@@ -808,11 +798,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
{
dz = tz;
}
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
bot->GetPositionZ(), dx, dy, dz))
return false;
return MoveTo(target->GetMapId(), dx, dy, dz);
}