summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-12-17 13:03:21 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:38 +0100
commitb55212891e228ffa3123f1a50112f6aca03aaf1d (patch)
treec7583bf7ef493fca5e39a1496ec0ddba4d01717d /play.js
parentbf4e77c7d4fe7f9bc79e07700ca0a1e9a42ebc37 (diff)
downloadnevsky-b55212891e228ffa3123f1a50112f6aca03aaf1d.tar.gz
Arts of War panel instead of dialog.
Diffstat (limited to 'play.js')
-rw-r--r--play.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/play.js b/play.js
index 680db16..8939fd2 100644
--- a/play.js
+++ b/play.js
@@ -1119,13 +1119,24 @@ function update_plan() {
}
function update_cards() {
- if (view.show_arts_of_war) {
+ if (Array.isArray(view.show_arts_of_war)) {
+ ui.arts_of_war_dialog.classList.remove("hide")
+ ui.arts_of_war_list.replaceChildren()
+ for (let c of view.show_arts_of_war) {
+ let elt = ui.cards[c]
+ ui.arts_of_war_list.appendChild(ui.cards[c])
+ elt.classList.toggle("selected", c === view.what)
+ elt.classList.toggle("action", is_card_action(c))
+ elt.classList.remove("disabled")
+ }
+ } else if (view.show_arts_of_war === 1) {
ui.arts_of_war_dialog.classList.remove("hide")
ui.arts_of_war_list.replaceChildren()
for_each_friendly_card(c => {
if (!is_card_in_use(c)) {
let elt = ui.cards[c]
ui.arts_of_war_list.appendChild(elt)
+ elt.classList.toggle("selected", c === view.what)
elt.classList.toggle("action", is_card_action(c))
elt.classList.toggle("disabled", !is_card_action(c))
}
@@ -1134,8 +1145,9 @@ function update_cards() {
ui.arts_of_war_dialog.classList.add("hide")
for (let c = 0; c < 42; ++c) {
let elt = ui.cards[c]
+ elt.classList.toggle("selected", false)
elt.classList.toggle("action", is_card_action(c))
- elt.classList.remove("disabled")
+ elt.classList.toggle("disabled", false)
}
}