From e017dd5f28576a31df6a767907f1dfa28472c4b0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 23 Mar 2025 12:41:35 +0100 Subject: Log discarded end of year cards. --- play.css | 1 + rules.js | 17 +++++++++++++---- rules.ts | 20 ++++++++++++++------ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/play.css b/play.css index 48223ac..556db15 100644 --- a/play.css +++ b/play.css @@ -66,6 +66,7 @@ body header.fascist.your_turn { background-color: hsl(30, 35%, 65%); } #log .tip { cursor: pointer; } #log .tip:hover { text-decoration: underline; } +#log :not(.h) .tip { font-style: italic; } #mapwrap { width: 1650px; diff --git a/rules.js b/rules.js index 1754c45..db7e2e1 100644 --- a/rules.js +++ b/rules.js @@ -1279,10 +1279,6 @@ states.end_of_year_discard = { discarded[faction_id].t.push(c); } game.discard[faction_id].push(c); - if (game.hands[faction_id].length <= get_hand_limit(faction_id) && - game.tableaus[faction_id].length <= game.year) { - log(`${player} discarded cards.`); - } }, undo(_, player) { const faction_id = player_faction_map[player]; @@ -1298,6 +1294,19 @@ states.end_of_year_discard = { } }, confirm(_, player) { + const faction_id = player_faction_map[player]; + const { d: discarded } = get_active_node_args(); + log_br(); + log(player + " discarded:"); + for (let c of discarded[faction_id].t) + log(">C" + c); + const n = discarded[faction_id].h.length; + if (n === 1) + log(">" + n + " card from hand"); + else if (n > 1) + log(">" + n + " cards from hand"); + else + log(">No cards from hand"); set_delete(game.active, player); if (game.active.length === 0) { resolve_active_and_proceed(); diff --git a/rules.ts b/rules.ts index d11e9dc..5867403 100644 --- a/rules.ts +++ b/rules.ts @@ -1589,12 +1589,6 @@ states.end_of_year_discard = { } game.discard[faction_id].push(c); - if ( - game.hands[faction_id].length <= get_hand_limit(faction_id) && - game.tableaus[faction_id].length <= game.year - ) { - log(`${player} discarded cards.`); - } }, undo(_, player: Player) { const faction_id = player_faction_map[player]; @@ -1609,6 +1603,20 @@ states.end_of_year_discard = { } }, confirm(_, player: Player) { + const faction_id = player_faction_map[player] + const {d: discarded} = get_active_node_args(); + log_br() + log(player + " discarded:") + for (let c of discarded[faction_id].t) + log(">C" + c) + const n = discarded[faction_id].h.length + if (n === 1) + log(">" + n + " card from hand") + else if (n > 1) + log(">" + n + " cards from hand") + else + log(">No cards from hand") + set_delete(game.active as Player[], player); if (game.active.length === 0) { resolve_active_and_proceed(); -- cgit v1.2.3