summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-05-26 16:21:49 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commit006c34ed997c8aeb9836ad6a41d5ab3fe4a44a33 (patch)
treefd3979c11a28c90c7e34d5e8b00799b4f40fbeea
parentc0e0e5e1a9da05b7187fdf9a7e4ee7d3868f1a85 (diff)
downloadpax-pamir-006c34ed997c8aeb9836ad6a41d5ab3fe4a44a33.tar.gz
Manually discard events and instability dominance checks.
-rw-r--r--rules.js59
1 files changed, 47 insertions, 12 deletions
diff --git a/rules.js b/rules.js
index 3804aa6..5862763 100644
--- a/rules.js
+++ b/rules.js
@@ -2357,6 +2357,14 @@ states.cleanup_hand = {
}
}
+function goto_discard_events() {
+ if (is_event_card(game.market_cards[0][0]) || is_event_card(game.market_cards[1][0])) {
+ game.state = 'discard_events';
+ } else {
+ goto_refill_market();
+ }
+}
+
function do_discard_event(row, c) {
game.market_cards[row][0] = 0;
logbr();
@@ -2368,14 +2376,22 @@ function do_discard_event(row, c) {
}
}
-function goto_discard_events() {
- if (is_event_card(game.market_cards[0][0])) {
- do_discard_event(0, game.market_cards[0][0]);
- } else if (is_event_card(game.market_cards[1][0])) {
- do_discard_event(1, game.market_cards[1][0]);
- } else {
- goto_refill_market();
- }
+states.discard_events = {
+ inactive: "discard event cards",
+ prompt() {
+ view.prompt = `Discard any event cards in the leftmost column of the market.`;
+ if (is_event_card(game.market_cards[0][0]))
+ gen_action('card', game.market_cards[0][0]);
+ else if (is_event_card(game.market_cards[1][0]))
+ gen_action('card', game.market_cards[1][0]);
+ },
+ card(c) {
+ push_undo();
+ if (c === game.market_cards[0][0])
+ do_discard_event(0, c);
+ else
+ do_discard_event(1, c);
+ },
}
function discard_instability_cards() {
@@ -2418,6 +2434,8 @@ function goto_refill_market() {
}
}
+ clear_undo();
+
// Fill with new cards from left (top row in each column first)
for (let col = 0; col < 6; ++col) {
for (let row = 0; row < 2; ++row) {
@@ -2426,10 +2444,8 @@ function goto_refill_market() {
let c = game.deck.pop();
game.market_cards[row][col] = c;
if (instability > 0 && is_dominance_check(c)) {
- logbr();
- log(`Instability!`);
- discard_instability_cards();
- return do_dominance_check('instability');
+ game.state = 'instability';
+ return;
}
}
}
@@ -2439,6 +2455,25 @@ function goto_refill_market() {
goto_next_player();
}
+states.instability = {
+ prompt() {
+ view.prompt = "Instability \u2014 perform a Dominance Check immediately.";
+ for (let row = 0; row < 2; ++row) {
+ for (let col = 0; col < 6; ++col) {
+ let c = game.market_cards[row][col];
+ if (is_dominance_check(c))
+ gen_action('card', c);
+ }
+ }
+ },
+ card(c) {
+ logbr();
+ log(`Instability!`);
+ discard_instability_cards();
+ do_dominance_check('instability');
+ }
+}
+
// EVENTS: IF DISCARDED
const events_if_discarded = {