Skip to content

Commit

Permalink
Fix: Give free kick to ball placing team
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Apr 18, 2024
1 parent e0cb63a commit dfb1a5b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/app/statemachine/change_gameevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ func (s *StateMachine) processChangeAddGameEvent(newState *state.State, change *
if *newState.TeamInfo(byTeam).BallPlacementFailures > 0 {
*newState.TeamInfo(byTeam).BallPlacementFailures--
}

if *newState.Division == state.Division_DIV_A &&
ballLeftField(newState) &&
newState.NextCommand != nil &&
*newState.NextCommand.Type == state.Command_DIRECT &&
*newState.TeamInfo(byTeam.Opposite()).BallPlacementFailuresReached {
// In divA, if the ball left the field (no foul) and the other team has too many ball placement failures,
// and the team succeeded placement, the direct kick is given to the team that succeeded placement
newState.NextCommand = state.NewCommand(state.Command_DIRECT, byTeam)
}
}

// defender too close to kick point
Expand Down

0 comments on commit dfb1a5b

Please sign in to comment.