summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-09-14 15:57:22 +0200
committerTor Andersson <tor@ccxvii.net>2024-09-15 00:20:09 +0200
commit23b5aaf4062756c2d04d7c70af3ee486678aa213 (patch)
treeba2ef5462c4a9b10d5256969420ddfcc79dbeadb /play.js
parentb470901e800b412918e6ec55a013597d7507cde7 (diff)
downloadwilderness-war-23b5aaf4062756c2d04d7c70af3ee486678aa213.tar.gz
Make events more forgiving for undo by adding pauses to roll/draw/etc.
Diffstat (limited to 'play.js')
-rw-r--r--play.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/play.js b/play.js
index b671484..3973ce6 100644
--- a/play.js
+++ b/play.js
@@ -408,6 +408,9 @@ let ui = {
pieces: document.getElementById("pieces"),
cards: document.getElementById("cards"),
last_card: document.getElementById("last_card"),
+ bpa_reluctant: document.getElementById("bpa_reluctant"),
+ bpa_supportive: document.getElementById("bpa_supportive"),
+ bpa_enthusiastic: document.getElementById("bpa_enthusiastic"),
space_list: [],
}
@@ -1005,6 +1008,10 @@ for (let p = 0; p < pieces.length; ++p)
else
build_unit(p)
+ui.bpa_reluctant.onclick = () => send_action("reluctant")
+ui.bpa_supportive.onclick = () => send_action("supportive")
+ui.bpa_enthusiastic.onclick = () => send_action("enthusiastic")
+
document.getElementById("last_card").addEventListener("mouseenter", on_focus_last_card)
document.getElementById("last_card").addEventListener("mouseleave", on_blur_last_card)
@@ -1388,6 +1395,7 @@ function update_card(id) {
card.element.classList.add('highlight')
else
card.element.classList.remove('highlight')
+ card.element.classList.toggle('selected', id === view.selected_card)
if (view.hand.includes(id))
card.element.classList.add("show")
else
@@ -1440,6 +1448,10 @@ function update_map() {
for (let i = 0; i < pieces.length; ++i)
update_piece(i)
+ ui.bpa_reluctant.classList.toggle("highlight", !!(view.actions && view.actions.reluctant))
+ ui.bpa_supportive.classList.toggle("highlight", !!(view.actions && view.actions.supportive))
+ ui.bpa_enthusiastic.classList.toggle("highlight", !!(view.actions && view.actions.enthusiastic))
+
if (focus && focus.length === 0)
focus = null
@@ -1545,6 +1557,9 @@ function update_map() {
"PASS on playing \"Foul Weather\" for the rest of this ACTION PHASE?"
)
+ action_button("roll", "Roll")
+ action_button("draw", "Draw")
+
action_button("pass", "Pass")
action_button("next", "Next")
action_button("end_construction", "End construction")