From 60b8b91e7a18aaebd1c6cd1d9b17ff86f31b9e99 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Fri, 1 Dec 2023 13:23:23 +0800 Subject: [PATCH] Update StrategySystem.cpp --- StrategySystem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/StrategySystem.cpp b/StrategySystem.cpp index 1be549b..90efbff 100644 --- a/StrategySystem.cpp +++ b/StrategySystem.cpp @@ -2410,8 +2410,10 @@ void CStrategySystem::Goalie() { int gx = ball.position.x >= 740 && (ball.position.y <= 313 || ball.position.y >= 505) || ball.position.x >= 940 ? 965 : 950; int gy = int(((ball.position.y - ball.oldPosition.y) * 1.0 / (ball.position.x - ball.oldPosition.x) * 1.0) * gx + (ball.oldPosition.y - ((ball.position.y - ball.oldPosition.y) * 1.0 / (ball.position.x - ball.oldPosition.x) * 1.0) * ball.oldPosition.x) + 0.5); - // if (ball.position.x < ball.oldPosition.x) - if (Distance(ball.position, ball.oldPosition) >= 5) { + if (ball.position.x >= 740 && (ball.position.y <= 313 && ball.position.y <= ball.oldPosition.y || ball.position.y >= 505 && ball.position.y >= ball.oldPosition.y) && ball.position.x <= ball.oldPosition.x) { + Direction(HGOALIE, CPoint(gx, 409)); + } + else if (Distance(ball.position, ball.oldPosition) >= 5) { if (gy < 313) Direction(HGOALIE, CPoint(gx, 313)); else if (gy > 505)