Tank face and dps behind

This commit is contained in:
Yunfan Li
2024-09-24 11:46:39 +08:00
parent c710345e8b
commit eea652f5d5
10 changed files with 216 additions and 83 deletions

View File

@@ -4,6 +4,7 @@
*/
#include "IsBehindValue.h"
#include <cmath>
#include "Playerbots.h"
@@ -14,8 +15,10 @@ bool IsBehindValue::Calculate()
return false;
float targetOrientation = target->GetOrientation();
float orientation = bot->GetOrientation();
float distance = bot->GetDistance(target);
return distance <= ATTACK_DISTANCE && abs(targetOrientation - orientation) < M_PI / 2;
float deltaAngle = Position::NormalizeOrientation(targetOrientation - target->GetAngle(bot));
if (deltaAngle > M_PI)
deltaAngle -= 2.0f * M_PI; // -PI..PI
return fabs(deltaAngle) > M_PI_2;
}