|
3 | 3 | from pyrusgeom.soccer_math import * |
4 | 4 | from pyrusgeom.geom_2d import * |
5 | 5 | from service_pb2 import * |
6 | | -from src.behaviors.bhv_starter_clearball import ClearBall |
7 | | -from src.behaviors.bhv_starter_pass import Pass |
8 | | -from src.behaviors.bhv_starter_dribble import Dribble |
9 | | -from src.behaviors.bhv_starter_shoot import Shoot |
| 6 | +from src.behaviors.bhv_starter_clearball import BhvStarterClearBall |
| 7 | +from src.behaviors.bhv_starter_pass import BhvStarterPass |
| 8 | +from src.behaviors.bhv_starter_dribble import BhvStarterDribble |
| 9 | +from src.behaviors.bhv_starter_shoot import BhvStarterShoot |
10 | 10 | from src.utils.tools import Tools |
11 | 11 |
|
12 | 12 | class BhvStarterKickPlanner(IBehavior): |
13 | 13 | def __init__(self): |
14 | | - self.shoot = Shoot() |
15 | | - self.clear_ball = ClearBall() |
16 | | - self.dribble = Dribble() |
17 | | - self.pass_ball = Pass() |
| 14 | + self.starter_shoot = BhvStarterShoot() |
| 15 | + self.starter_clear_ball = BhvStarterClearBall() |
| 16 | + self.starter_dribble = BhvStarterDribble() |
| 17 | + self.starter_pass = BhvStarterPass() |
18 | 18 |
|
19 | 19 | def execute(self, agent: IAgent): |
20 | 20 | agent.logger.debug("BhvStarterKickPlanner.execute") |
21 | 21 | from src.sample_player_agent import SamplePlayerAgent # Local import to avoid circular import |
22 | 22 | actions = [] |
23 | | - actions += [shoot] if (shoot := self.shoot.execute(agent)) is not None else [] |
| 23 | + actions += [shoot] if (shoot := self.starter_shoot.execute(agent)) is not None else [] |
24 | 24 | opps = Tools.OpponentsFromSelf(agent) |
25 | 25 | nearest_opp = opps[0] if opps else None |
26 | 26 | nearest_opp_dist = nearest_opp.dist_from_self if nearest_opp else 1000.0 |
27 | 27 |
|
28 | 28 | if nearest_opp_dist < 10: |
29 | | - actions += [passing] if (passing := self.pass_ball.execute(agent)) is not None else [] |
| 29 | + actions += [passing] if (passing := self.starter_pass.execute(agent)) is not None else [] |
30 | 30 |
|
31 | | - actions += [dribble] if (dribble := self.dribble.execute(agent)) is not None else [] |
| 31 | + actions += [dribble] if (dribble := self.starter_dribble.execute(agent)) is not None else [] |
32 | 32 |
|
33 | 33 | if nearest_opp_dist > 2.5: |
34 | 34 | actions.append(PlayerAction(body_hold_ball=Body_HoldBall())) |
35 | 35 |
|
36 | | - actions.append(self.clear_ball.execute(agent)) |
| 36 | + actions.append(self.starter_clear_ball.execute(agent)) |
37 | 37 |
|
38 | 38 | #Sending actions' queue |
39 | 39 | for i in actions: |
|
0 commit comments