summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-23 11:41:06 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit01a272e63afb8a051aa7583ad596bc40f992111a (patch)
tree37b33f5e250c5561a11ac3a160c7097317b02b7d
parenta8fcb2967be58b869c3c9a09b6d612282f74494f (diff)
downloadandean-abyss-01a272e63afb8a051aa7583ad596bc40f992111a.tar.gz
Improve display of this card/next card/deck at the edge of time.
-rw-r--r--play.html4
-rw-r--r--play.js10
-rw-r--r--rules.js4
3 files changed, 12 insertions, 6 deletions
diff --git a/play.html b/play.html
index b5e55a2..04f29ac 100644
--- a/play.html
+++ b/play.html
@@ -98,8 +98,8 @@
<main>
<div id="card_panel">
-<div id="this_card" class="card"><div id="unshaded_event"></div><div id="shaded_event"></div></div>
-<div id="next_card" class="card"></div>
+<div id="this_card" class="hide"><div id="unshaded_event"></div><div id="shaded_event"></div></div>
+<div id="next_card" class="hide"></div>
<div id="deck_outer" class="card card_back"><div id="deck_size"></div></div>
</div>
diff --git a/play.js b/play.js
index 6af65e3..0c8c176 100644
--- a/play.js
+++ b/play.js
@@ -305,6 +305,7 @@ let ui = {
this_card: document.getElementById("this_card"),
shaded_event: document.getElementById("shaded_event"),
unshaded_event: document.getElementById("unshaded_event"),
+ deck_outer: document.getElementById("deck_outer"),
deck_size: document.getElementById("deck_size"),
tokens: {
aid: document.getElementById("token_aid"),
@@ -1091,8 +1092,13 @@ function on_update() {
}
ui.this_card.className = make_card_class_name(view.deck[0])
- ui.next_card.className = "card card_" + view.deck[1]
- ui.deck_size.textContent = view.deck[2]
+ 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]
+ } else {
+ ui.deck_outer.className = "hide"
+ }
ui.this_card.classList.toggle("action", !!(view.actions && view.actions.event === 1))
ui.shaded_event.classList.toggle("action", !!(view.actions && view.actions.shaded === 1))
diff --git a/rules.js b/rules.js
index b856326..29d8da9 100644
--- a/rules.js
+++ b/rules.js
@@ -7661,8 +7661,8 @@ function is_current_role(role) {
exports.view = function (state, role) {
load_game(state)
- let this_card = game.deck[0]
- let next_card = game.deck[1]
+ let this_card = game.deck[0] | 0
+ let next_card = game.deck[1] | 0
let deck_size = Math.max(0, game.deck.length - 2)
view = {