File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ func (e GameEvent) IsSecondary() bool {
182182 GameEventUnsportingBehaviorMinor ,
183183 GameEventUnsportingBehaviorMajor ,
184184 GameEventMultipleFouls ,
185+ GameEventMultiplePlacementFailures ,
185186 GameEventBotCrashUniqueSkipped ,
186187 GameEventBotPushedBotSkipped ,
187188 GameEventPlacementFailedByTeamInFavor ,
Original file line number Diff line number Diff line change 66 "math"
77)
88
9- // BallPlacementPos determines the ball placement position based on the game event
9+ // BallPlacementPos determines the ball placement position based on the primary game event
1010func (e * Engine ) BallPlacementPos () * Location {
1111 event := e .State .PrimaryGameEvent ()
1212 if event == nil {
Original file line number Diff line number Diff line change @@ -394,13 +394,16 @@ func (s State) BotSubstitutionIntend() Team {
394394 return TeamUnknown
395395}
396396
397- func (s State ) PrimaryGameEvent () * GameEvent {
397+ func (s State ) PrimaryGameEvent () (e * GameEvent ) {
398+ e = nil
398399 for i := len (s .GameEvents ) - 1 ; i >= 0 ; i -- {
399- if ! s .GameEvents [i ].IsSecondary () {
400- return s .GameEvents [i ]
400+ e = s .GameEvents [i ]
401+ if e .Type == GameEventMultipleCards {
402+ // only this event causes a penalty kick and must be prioritized.
403+ return
401404 }
402405 }
403- return nil
406+ return
404407}
405408
406409func newTeamInfo () (t TeamInfo ) {
You can’t perform that action at this time.
0 commit comments