Skip to content

Commit dfb1a5b

Browse files
committed
Fix: Give free kick to ball placing team
1 parent e0cb63a commit dfb1a5b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/app/statemachine/change_gameevent.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ func (s *StateMachine) processChangeAddGameEvent(newState *state.State, change *
199199
if *newState.TeamInfo(byTeam).BallPlacementFailures > 0 {
200200
*newState.TeamInfo(byTeam).BallPlacementFailures--
201201
}
202+
203+
if *newState.Division == state.Division_DIV_A &&
204+
ballLeftField(newState) &&
205+
newState.NextCommand != nil &&
206+
*newState.NextCommand.Type == state.Command_DIRECT &&
207+
*newState.TeamInfo(byTeam.Opposite()).BallPlacementFailuresReached {
208+
// In divA, if the ball left the field (no foul) and the other team has too many ball placement failures,
209+
// and the team succeeded placement, the direct kick is given to the team that succeeded placement
210+
newState.NextCommand = state.NewCommand(state.Command_DIRECT, byTeam)
211+
}
202212
}
203213

204214
// defender too close to kick point

0 commit comments

Comments
 (0)