summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js37
1 files changed, 33 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index fd69ba7..75c538f 100644
--- a/rules.js
+++ b/rules.js
@@ -306,9 +306,12 @@ function discard_card(c, reason) {
function can_exchange_for_discard(c) {
if (game.did_discard_event) {
- if (game.active === P_BRITAIN)
- return true
- return CARDS[c].count > 1
+ let card = CARDS[c]
+ if (card.type === "ops") {
+ if (game.active === P_BRITAIN)
+ return CARDS[c].count > 0
+ return CARDS[c].count > 1
+ }
}
return false
}
@@ -1268,8 +1271,11 @@ states.strategy_phase = {
inactive: "to play a strategy card",
prompt() {
view.prompt = "Play a strategy card."
- for (let c of active_hand())
+ for (let c of active_hand()) {
gen_action_card("card", c)
+ if (can_exchange_for_discard(c))
+ view.actions.exchange = 1
+ }
},
card(c) {
push_undo()
@@ -1284,6 +1290,29 @@ states.strategy_phase = {
break
}
},
+ exchange() {
+ push_undo()
+ let d = game.did_discard_event
+ set_add(active_hand(), d)
+ logp("picked up up #" + d)
+ game.state = "exchange"
+ },
+}
+
+states.exchange = {
+ inactive: "to play a strategy card",
+ prompt() {
+ view.prompt = "Exchange an OPS card for the event card."
+ view.selected_card = game.did_discard_event
+ for (let c of active_hand())
+ if (can_exchange_for_discard(c))
+ gen_action_card("card", c)
+ },
+ card(c) {
+ game.did_discard_event = 0
+ discard_card(c, "exchange")
+ game.state = "strategy_phase"
+ },
}
states.strategy_phase_ops = {