summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-12-04 16:18:07 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-12-04 16:18:07 +0100
commitd9b77f780cbf075df18490598bff0a6b51a8b750 (patch)
treec10af9053cc4ef39ca24b1a995860bda2badebe5
parentd1544267c96cb2242230a78c9c992665651b6b2b (diff)
downloadvotes-for-women-d9b77f780cbf075df18490598bff0a6b51a8b750.tar.gz
popup to confirm card selection
-rw-r--r--play.html6
-rw-r--r--play.js7
-rw-r--r--rules.js5
3 files changed, 14 insertions, 4 deletions
diff --git a/play.html b/play.html
index ceb9d93..7c3710a 100644
--- a/play.html
+++ b/play.html
@@ -745,6 +745,12 @@ div.button_box .button {
<li data-action="card_lobbying"> &#x1F3DB; &nbsp; Lobbying Action
</menu>
+<menu id="popup_select_card">
+ <li class="title">TITLE
+ <li class="separator">
+ <li data-action="card_select"> &#x1f3b4; &nbsp; Select Card
+</menu>
+
<header>
<div id="toolbar">
<details>
diff --git a/play.js b/play.js
index 41149c2..6a78abc 100644
--- a/play.js
+++ b/play.js
@@ -208,12 +208,15 @@ function show_popup_menu(evt, menu_id, target_id, title) {
function hide_popup_menu() {
document.getElementById("popup").style.display = "none"
+ document.getElementById("popup_select_card").style.display = "none"
}
function is_card_enabled(card) {
if (view.actions) {
if (card_action_menu.some(a => view.actions[a] && view.actions[a].includes(card)))
return true
+ if (view.actions.card_select && view.actions.card_select.includes(card))
+ return true
if (view.actions.card && view.actions.card.includes(card))
return true
}
@@ -283,8 +286,8 @@ function on_focus_us_state(evt) {
function on_click_card(evt) {
let card = evt.target.my_card
- if (is_action('card', card)) {
- send_action('card', card)
+ if (is_action('card_select', card)) {
+ show_popup_menu(evt, "popup_select_card", card, CARDS[card].name)
} else {
show_popup_menu(evt, "popup", card, CARDS[card].name)
}
diff --git a/rules.js b/rules.js
index bc08172..b64a5af 100644
--- a/rules.js
+++ b/rules.js
@@ -881,6 +881,7 @@ states.strategy_phase = {
function claim_strategy_card(c) {
log(`${game.active} selected C${c}.`)
+ clear_undo()
array_remove_item(game.strategy_draw, c)
set_add(player_claimed(), c)
if (game.strategy_deck.length)
@@ -892,9 +893,9 @@ states.select_strategy_card = {
prompt() {
view.prompt = "Select Strategy card."
for (let c of game.strategy_draw)
- gen_action("card", c)
+ gen_action("card_select", c)
},
- card(c) {
+ card_select(c) {
claim_strategy_card(c)
if (game.vm) {
vm_next()