|
16 | 16 |
|
17 | 17 |
|
18 | 18 | class FormularBot(GoslingAgent): |
19 | | - #Responds to quickchats receieved from other players |
20 | | - global ally_taking_kickoff |
21 | | - def handle_quick_chat(self, index, team, quick_chat): |
22 | | - try: |
23 | | - a = ally_taking_kickoff |
24 | | - except: |
25 | | - ally_taking_kickoff = 'False' |
26 | | - if team == self.team: |
27 | | - if self.kickoff_flag: |
28 | | - if quick_chat == QuickChats.Information_IGotIt and ally_taking_kickoff != True: |
29 | | - self.send_quick_chat(QuickChats.CHAT_TEAM_ONLY, QuickChats.Information_Defending) |
30 | | - ally_taking_kickoff = True |
31 | | - if quick_chat == QuickChats.Information_Defending: |
32 | | - self.send_quick_chat(QuickChats.CHAT_TEAM_ONLY, QuickChats.Information_IGotIt) |
33 | | - ally_taking_kickoff = False |
34 | | - else: |
35 | | - print('ignoring message from other team') |
36 | 19 | def run(agent): |
37 | | - if agent.kickoff_finished: |
38 | | - ally_taking_kickoff = 'False' |
39 | | - try: |
40 | | - a = ally_taking_kickoff |
41 | | - except: |
42 | | - ally_taking_kickoff = 'False' |
43 | | - |
44 | 20 | global stack |
45 | 21 | distance_ball_friendly_goal = (agent.ball.location - agent.friend_goal.location).magnitude() |
46 | 22 | distance_ball_foe_goal = (agent.ball.location - agent.foe_goal.location).magnitude() |
@@ -84,7 +60,7 @@ def run(agent): |
84 | 60 | closest_ally_friendly_goal_distance = ally_to_friendly_goal_distance |
85 | 61 |
|
86 | 62 | closest_to_ball = distance_to_ball < closest_ally_to_ball_distance |
87 | | - joint_closest_to_ball = round(distance_to_ball) == round(closest_ally_to_ball_distance) |
| 63 | + joint_closest_to_ball = distance_to_ball == closest_ally_to_ball_distance |
88 | 64 | closest_to_friendly_goal = distance_to_friendly_goal <= closest_ally_friendly_goal_distance |
89 | 65 |
|
90 | 66 | #Works out kickoff position and passes that variable onto kickoff function in routines |
@@ -114,7 +90,6 @@ def run(agent): |
114 | 90 | else: |
115 | 91 | goalie = False |
116 | 92 |
|
117 | | - |
118 | 93 | #Only go for kickoff if closest or joint closest and on left side |
119 | 94 | if agent.kickoff_flag and (closest_to_ball or (joint_closest_to_ball and (kickoff_position == 'diagonal_left' or kickoff_position == 'back_left'))): |
120 | 95 | go_for_kickoff = True |
|
0 commit comments