summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-05 23:08:23 +0200
committerTor Andersson <tor@ccxvii.net>2023-06-05 23:08:23 +0200
commitdce4ca258b4b63dc520b2a7ce3497c00f8716142 (patch)
tree38d48a1c9839a1c166fea22d6e77630601e500e2
parent06b13fbc1a642125fbae14bafba36685ac0d1544 (diff)
downloadandean-abyss-dce4ca258b4b63dc520b2a7ce3497c00f8716142.tar.gz
Show propaganda cards left in deck.
-rw-r--r--play.js2
-rw-r--r--rules.js10
2 files changed, 10 insertions, 2 deletions
diff --git a/play.js b/play.js
index 7a539a3..e8ce8b1 100644
--- a/play.js
+++ b/play.js
@@ -1127,7 +1127,7 @@ function on_update() {
ui.next_card.className = view.deck[1] > 0 ? "card card_" + view.deck[1] : "hide"
if (view.deck[2] > 0) {
ui.deck_outer.className = "card card_back"
- ui.deck_size.textContent = view.deck[2]
+ ui.deck_size.textContent = `${view.deck[2]} (${view.deck[3]})`
} else {
ui.deck_outer.className = "hide"
}
diff --git a/rules.js b/rules.js
index d5634b4..fe56e65 100644
--- a/rules.js
+++ b/rules.js
@@ -8106,6 +8106,14 @@ function is_current_role(role) {
return false
}
+function count_propaganda_left() {
+ let n = 0
+ for (let i = 2; i < game.deck.length; ++i)
+ if (game.deck[i] === PROPAGANDA)
+ ++n
+ return n
+}
+
exports.view = function (state, role) {
load_game(state)
@@ -8120,7 +8128,7 @@ exports.view = function (state, role) {
scenario: game.scenario,
current: game.current,
- deck: [ this_card, next_card, deck_size ],
+ deck: [ this_card, next_card, deck_size, count_propaganda_left() ],
capabilities: game.capabilities,
momentum: game.momentum,
president: game.president,