summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-23 12:41:35 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-23 12:41:35 +0100
commite017dd5f28576a31df6a767907f1dfa28472c4b0 (patch)
tree6fc52acea6a9297a48167c89b86188d42c42d0c3
parent132d8e5f7a39247aaa64cea18947a38d932b77b8 (diff)
downloadland-and-freedom-e017dd5f28576a31df6a767907f1dfa28472c4b0.tar.gz
Log discarded end of year cards.
-rw-r--r--play.css1
-rw-r--r--rules.js17
-rw-r--r--rules.ts20
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<EndOfYearDiscardArgs>();
+ 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();