Skip to content

Commit 89fdfd3

Browse files
committed
[feature] Rule change: Merge pushing (partially) and touch keeper
* When a robot touches any robot that is at least partially inside its own defense area, this is AttackerTouchedOpponentInDefenseArea. * AttackerInDefenseArea renamed to AttackerInDefenseArea to clearly distinguish it from AttackerTouchedOpponentInDefenseArea * AttackerTouchedOpponentInDefenseArea is eligible for advantage choice
1 parent 7005b21 commit 89fdfd3

13 files changed

+553
-656
lines changed

internal/app/controller/engine.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ func (e *Engine) CommandForEvent(event *GameEvent) (command RefCommand, forTeam
329329
GameEventBotKickedBallTooFast,
330330
GameEventBotDribbledBallTooFar,
331331
GameEventAttackerDoubleTouchedBall,
332-
GameEventAttackerInDefenseArea,
333-
GameEventAttackerTouchedKeeper,
332+
GameEventAttackerTouchedBallInDefenseArea,
333+
GameEventAttackerTouchedOpponentInDefenseArea,
334334
GameEventKickTimeout,
335335
GameEventKeeperHeldBall:
336336
command = CommandIndirect

internal/app/controller/gameEvent.go

Lines changed: 82 additions & 264 deletions
Large diffs are not rendered by default.

internal/app/controller/placementPos.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ func (e *Engine) BallPlacementPos() *Location {
7373
return e.validateProtoLocation(event.Details.AttackerDoubleTouchedBall.Location)
7474
case GameEventAttackerTooCloseToDefenseArea:
7575
return e.validateProtoLocation(event.Details.AttackerTooCloseToDefenseArea.Location)
76-
case GameEventAttackerInDefenseArea:
77-
return e.validateProtoLocation(event.Details.AttackerInDefenseArea.Location)
78-
case GameEventAttackerTouchedKeeper:
79-
return e.validateProtoLocation(event.Details.AttackerTouchedKeeper.Location)
76+
case GameEventAttackerTouchedBallInDefenseArea:
77+
return e.validateProtoLocation(event.Details.AttackerTouchedBallInDefenseArea.Location)
78+
case GameEventAttackerTouchedOpponentInDefenseArea:
79+
return e.validateProtoLocation(event.Details.AttackerTouchedOpponentInDefenseArea.Location)
8080
case GameEventDefenderTooCloseToKickPoint:
8181
return e.validateLocation(e.State.PlacementPos)
8282
case GameEventDefenderInDefenseAreaPartially:

internal/app/controller/teamConnection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ func (c *GameController) askForTeamDecisionIfRequired(event Event) (handled bool
110110
*choice.Foul = refproto.AdvantageChoice_PUSHING
111111
choice.BotPushedBot = new(refproto.GameEvent_BotPushedBot)
112112
*choice.BotPushedBot = *event.GameEvent.Details.BotPushedBot
113+
} else if event.GameEvent.Details.AttackerTouchedOpponentInDefenseArea != nil {
114+
byTeamProto = *event.GameEvent.Details.AttackerTouchedOpponentInDefenseArea.ByTeam
115+
*choice.Foul = refproto.AdvantageChoice_ATTACKER_TOUCHED_OPPONENT_IN_DEFENSE_AREA
116+
choice.AttackerTouchedOpponentInDefenseArea = new(refproto.GameEvent_AttackerTouchedOpponentInDefenseArea)
117+
*choice.AttackerTouchedOpponentInDefenseArea = *event.GameEvent.Details.AttackerTouchedOpponentInDefenseArea
113118
}
114119

115120
forTeam := NewTeam(byTeamProto).Opposite()

pkg/refproto/ssl_game_controller_auto_ref.pb.go

Lines changed: 30 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/refproto/ssl_game_controller_team.pb.go

Lines changed: 57 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/refproto/ssl_game_controller_team.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ message AdvantageChoice {
5858
optional GameEvent.BotCrashUnique bot_crash_unique = 2;
5959
// the bot push event that was the source for this advantage choice
6060
optional GameEvent.BotPushedBot bot_pushed_bot = 3;
61+
// the bot push event that was the source for this advantage choice
62+
optional GameEvent.AttackerTouchedOpponentInDefenseArea attacker_touched_opponent_in_defense_area = 4;
6163

6264
enum Foul {
6365
// default value when not set
@@ -66,5 +68,7 @@ message AdvantageChoice {
6668
COLLISION = 1;
6769
// an opponent bot has pushed one of your bots
6870
PUSHING = 2;
71+
// an opponent has touched one of your bots while your bot has been at least partially inside the defense area
72+
ATTACKER_TOUCHED_OPPONENT_IN_DEFENSE_AREA = 3;
6973
}
7074
}

0 commit comments

Comments
 (0)