summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-23 11:01:11 +0100
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-11-23 11:01:11 +0100
commitb252960c920e5f41c1b45b09c7af5c2fa0a2e300 (patch)
tree905075c78d1f6c781a569a0974fd9f71725fc779
parent9dd700c33bea438152e9a232189d88947aaf3523 (diff)
downloadvotes-for-women-b252960c920e5f41c1b45b09c7af5c2fa0a2e300.tar.gz
counter strat
-rw-r--r--events.txt2
-rw-r--r--play.html3
-rw-r--r--play.js8
-rw-r--r--rules.js34
4 files changed, 40 insertions, 7 deletions
diff --git a/events.txt b/events.txt
index fdc4130..1af104a 100644
--- a/events.txt
+++ b/events.txt
@@ -604,7 +604,7 @@ CARD 114 - Transportation
CARD 115 - Counter Strat
# Remove one card that is “in effect for the remainder of the turn” and place it in the appropriate discard pile.
- todo
+ counter_strat
CARD 116 - National Focus
# Add 2 :purple_or_yellow_cube or 2 :red_cube in one state of each region.
diff --git a/play.html b/play.html
index 5e5587d..d70e1cb 100644
--- a/play.html
+++ b/play.html
@@ -214,6 +214,9 @@ div.persistent_box {
}
.persistent_card.support { background-color: var(--suf-85); }
.persistent_card.opposition { background-color: var(--opp-85); }
+.persistent_card.action {
+ box-shadow: 0 0 0 3px yellow;
+}
div.congress_box {
position: absolute;
diff --git a/play.js b/play.js
index 0d45669..da42be1 100644
--- a/play.js
+++ b/play.js
@@ -634,8 +634,11 @@ function on_update() { // eslint-disable-line no-unused-vars
for (let c of view[id] || []) {
let elt = create("div", {
className: `persistent_card ${CARDS[c].type}`,
- innerHTML: sub_card_name(null, c)
+ innerHTML: sub_card_name(null, c),
+ my_card: c
})
+ elt.addEventListener("click", on_click_card)
+ elt.classList.toggle("action", is_card_enabled(c))
document.getElementById(id).appendChild(elt)
}
}
@@ -758,9 +761,6 @@ function on_update() { // eslint-disable-line no-unused-vars
action_button("pass", "Pass")
action_button("done", "Done")
action_button("undo", "Undo")
-
- // XXX
- action_button("restart", "Restart")
}
build_user_interface()
diff --git a/rules.js b/rules.js
index 7da6a2b..a6ebfec 100644
--- a/rules.js
+++ b/rules.js
@@ -411,6 +411,10 @@ function gen_action(action, argument) {
}
}
+function gen_action_card(c) {
+ gen_action("card", c)
+}
+
function gen_action_region(r) {
gen_action("region", r)
}
@@ -1085,12 +1089,17 @@ states.cleanup_phase = {
function discard_persistent_card(cards, c) {
log(`C${c} discarded.`)
array_remove_item(cards, c)
+
+ // TODO does it matter where we discard them?
+ // I see no value in having multiple discard piles.
if (is_support_card(c)) {
game.support_discard.push(c)
} else if (is_opposition_card(c)) {
game.opposition_discard.push(c)
+ } else if (game.active === SUF) {
+ game.support_discard.push(c)
} else {
- throw Error(`Unexpected card type ${c}`)
+ game.opposition_discard.push(c)
}
}
@@ -2077,6 +2086,10 @@ function vm_todo() {
vm_next()
}
+function vm_counter_strat() {
+ game.state = "vm_counter_strat"
+}
+
function vm_draw_2_play_1_event() {
log("TODO draw_2_play_1_event")
vm_next()
@@ -2632,6 +2645,23 @@ states.move_each_player_campaigner_free = {
}
}
+states.vm_counter_strat = {
+ inactive: "remove a persistent event card.",
+ prompt() {
+ event_prompt("Select a persistent event card to discard.")
+ for (let c of game.persistent_turn)
+ gen_action_card(c)
+
+ },
+ card(c) {
+ push_undo()
+ discard_persistent_card(game.persistent_turn, c)
+ vm_next()
+ }
+}
+
+
+
// #endregion
@@ -3699,7 +3729,7 @@ CODE[114] = [ // Transportation
]
CODE[115] = [ // Counter Strat
- [ vm_todo ],
+ [ vm_counter_strat ],
[ vm_return ],
]