mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Movement] Modify combat reach calculation
This commit is contained in:
@@ -827,11 +827,12 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
|||||||
float shortenTo = distance;
|
float shortenTo = distance;
|
||||||
|
|
||||||
// Avoid walking too far when moving towards each other
|
// Avoid walking too far when moving towards each other
|
||||||
if (bot->GetDistance(tx, ty, tz) >= 10.0f)
|
float disToGo = bot->GetExactDist(tx, ty, tz) - distance;
|
||||||
shortenTo = std::max(distance, bot->GetDistance(tx, ty, tz) / 2);
|
if (disToGo >= 10.0f)
|
||||||
|
shortenTo = disToGo / 2 + distance;
|
||||||
|
|
||||||
if (bot->GetExactDist(tx, ty, tz) <= shortenTo)
|
// if (bot->GetExactDist(tx, ty, tz) <= shortenTo)
|
||||||
return false;
|
// return false;
|
||||||
|
|
||||||
path.ShortenPathUntilDist(G3D::Vector3(tx, ty, tz), shortenTo);
|
path.ShortenPathUntilDist(G3D::Vector3(tx, ty, tz), shortenTo);
|
||||||
G3D::Vector3 endPos = path.GetPath().back();
|
G3D::Vector3 endPos = path.GetPath().back();
|
||||||
@@ -2313,7 +2314,7 @@ bool TankFaceAction::Execute(Event event)
|
|||||||
if (!bot->GetGroup())
|
if (!bot->GetGroup())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!bot->IsWithinMeleeRange(target))
|
if (!bot->IsWithinMeleeRange(target) || target->isMoving())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!AI_VALUE2(bool, "has aggro", "current target"))
|
if (!AI_VALUE2(bool, "has aggro", "current target"))
|
||||||
@@ -2513,7 +2514,7 @@ bool SetBehindTargetAction::Execute(Event event)
|
|||||||
if (target->GetVictim() == bot)
|
if (target->GetVictim() == bot)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!bot->IsWithinMeleeRange(target))
|
if (!bot->IsWithinMeleeRange(target) || target->isMoving())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float deltaAngle = Position::NormalizeOrientation(target->GetOrientation() - target->GetAngle(bot));
|
float deltaAngle = Position::NormalizeOrientation(target->GetOrientation() - target->GetAngle(bot));
|
||||||
|
|||||||
Reference in New Issue
Block a user