mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
[Game] Reveal multiple distinct random hand cards to a recipient (#7753)
* Add distinct random hand reveals with private recipient delivery * Route random hand reveals through PlayerActions Keep command creation, dispatch and response handling in the game action layer. HandMenu requests the typed operation and presents the count and failure dialogs. Show the chosen recipient, distinguish the count action from the immediate single-card reveal, and use the game window as parent. * Apply project formatting to random-reveal warning construction * Simplify random reveal to follow existing command patterns Forward server dispatch through cmdRevealRandomCards and use ordinary PlayerActions command sending. Remove the bespoke server-version error UI and long-lived-object guards. Reduce the test from 246 to 150 lines with two focused cases using the current RoleInfo player API, preserving distinct-card, private-event and rejected-count coverage. * Extract the shared reveal helper and name the test's CardRef fields RickyRister asked for cmdRevealCards and cmdRevealRandomCards to share a helper instead of threading a randomCount parameter through the reveal virtual. Restore the three-argument cmdRevealCards signature, resolve the reveal preconditions and zone in resolveRevealZone, and let both commands build their card list and hand it to revealCards, which owns the private and public Event_RevealCards construction and the enqueue. The random command no longer fabricates a Command_RevealCards with the -2 sentinel to re-enter the legacy path; its behaviour is unchanged. Name the CardRef fields in random_reveal_test instead of relying on declaration order, and state in the user documentation that a rejected reveal is not reported in the client, matching what the client does. --------- Co-authored-by: Lukas Brübach <44814898+BruebachL@users.noreply.github.com>
This commit is contained in:
parent
39220a2ea9
commit
078d0858a3
14 changed files with 375 additions and 17 deletions
|
|
@ -10,3 +10,13 @@ message Command_RevealCards {
|
|||
optional bool grant_write_access = 4;
|
||||
optional sint32 top_cards = 5 [default = -1];
|
||||
}
|
||||
|
||||
// Separate extension so older servers reject the operation without revealing any cards.
|
||||
message Command_RevealRandomCards {
|
||||
extend GameCommand {
|
||||
optional Command_RevealRandomCards ext = 1036;
|
||||
}
|
||||
optional string zone_name = 1;
|
||||
optional sint32 number_of_cards = 2;
|
||||
optional sint32 player_id = 3 [default = -1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,11 @@ message GameCommand {
|
|||
/// Server: Server_AbstractParticipant::cmdSetPlayerOrder
|
||||
/// Client: reflected via Event_PlayerOrderChanged
|
||||
SET_PLAYER_ORDER = 1206;
|
||||
|
||||
/// Reveal a distinct random sample without exposing identities to other recipients.
|
||||
/// Server: Server_AbstractPlayer::cmdRevealCards
|
||||
/// Client: PlayerEventHandler::eventRevealCards
|
||||
REVEAL_RANDOM_CARDS = 1036;
|
||||
}
|
||||
|
||||
extensions 100 to max;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue