Implementing tracking for seen action cards by Yssaril#4763
Conversation
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/15211ef4-d6b5-4c43-83ab-167767d7ae01 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/15211ef4-d6b5-4c43-83ab-167767d7ae01 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/15211ef4-d6b5-4c43-83ab-167767d7ae01 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsyncTI4/TI4_map_generator_bot/sessions/e69057d1-0395-4f7e-a09f-dfb6ef6c9824 Co-authored-by: wholton <3317595+wholton@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds persistence-backed tracking of action cards a player has seen in other players’ hands (primarily via Yssaril/Mageon-style reveals) and a cards-info UI to display that tracked knowledge.
Changes:
- Introduces
KnownActionCardsServiceto remember revealed/seen action cards per viewer, forget them when cards leave a target’s hand, and render a “known cards” summary. - Hooks tracking into existing reveal flows (
ActionCardHelper.showAll,/show_ac,/show_to_all) and intoPlayer.removeActionCard(...)so knowledge is updated as hands change. - Adds a Cards Info button + handler to display known action cards; includes a new JUnit test suite for the service.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/ti4/service/actioncard/KnownActionCardsService.java | Core logic for storing/removing/rendering “known action cards” per viewer/target. |
| src/main/java/ti4/helpers/ActionCardHelper.java | Remembers full-hand knowledge after showAll(...) reveals. |
| src/main/java/ti4/game/Player.java | Forgets known cards across viewers when an action card is removed from a player’s hand. |
| src/main/java/ti4/discord/interactions/commands/cardsac/ShowACToAll.java | Tracks publicly revealed cards for all other players. |
| src/main/java/ti4/discord/interactions/commands/cardsac/ShowAC.java | Tracks a single-player reveal (but currently still mutates hand; see PR comment). |
| src/main/java/ti4/service/info/CardsInfoService.java | Adds “Show Known Action Cards” button when applicable. |
| src/main/java/ti4/discord/interactions/buttons/handlers/info/CardsInfoButtonHandler.java | Button handler sends known-action-card summary to the player’s cards info thread. |
| src/test/java/ti4/service/actioncard/KnownActionCardsServiceTest.java | Unit tests for tracking, forgetting, display text, and button visibility. |
| return; | ||
| } | ||
|
|
||
| ActionCardHelper.sendActionCardInfo(game, player); | ||
| KnownActionCardsService.rememberShownActionCard(playerToShowTo, player, acID); | ||
| MessageHelper.sendMessageToPlayerCardsInfoThread(playerToShowTo, sb); |
There was a problem hiding this comment.
This command still mutates the source player’s hand by calling player.setActionCard(acID) earlier in execute(). setActionCard adds a new copy of the card (new identifier), so using /show_ac will duplicate the shown card instead of just revealing it. Remove that setActionCard call (and any other hand mutation) so the command is read-only aside from tracking via KnownActionCardsService.
🔬 Test Results✅ JSON ValidationNo JSON files changed. ✅ Formatting Checks PassedAll files pass Spotless formatting. ✅ JUnit Tests PassedAll tests passed successfully. |
Pull request created by AI Agent