summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js36
1 files changed, 20 insertions, 16 deletions
diff --git a/rules.js b/rules.js
index a7c9248..19a9b45 100644
--- a/rules.js
+++ b/rules.js
@@ -76,7 +76,7 @@ function gen_spend_hero_points() {
gen_action('spend_hp');
}
}
-const multiactive_states = ['choose_card', 'end_of_year_discard'];
+const multiactive_states = ['choose_card', 'end_of_year_discard', 'choose_final_bid'];
function action(state, player, action, arg) {
game = state;
if (action !== 'undo' && !multiactive_states.includes(game.state)) {
@@ -140,8 +140,7 @@ function setup_choose_card() {
function setup_final_bid() {
game.fascist = 0;
log_header('Final Bid', 't');
- const player_order = get_player_order();
- game.engine = player_order.map((faction_id) => create_state_node('choose_final_bid', faction_id));
+ game.engine = [create_state_node('choose_final_bid', 'all')];
game.engine.push(create_function_node('checkpoint'));
game.engine.push(create_function_node('resolve_final_bid'));
game.engine.push(create_function_node('setup_choose_card'));
@@ -998,7 +997,6 @@ states.play_card = {
states.choose_card = {
inactive: 'play a card for this turn',
prompt(player) {
- gen_spend_hero_points();
view.prompt = 'Play a card for this turn.';
const faction = player_faction_map[player];
if (game.selected_cards[faction].length === 0) {
@@ -1018,9 +1016,6 @@ states.choose_card = {
gen_action('skip');
}
},
- spend_hp() {
- resolve_spend_hp();
- },
card(c, player) {
const faction = player_faction_map[player];
game.selected_cards[faction] = [c];
@@ -1044,8 +1039,8 @@ states.choose_card = {
};
states.choose_final_bid = {
inactive: 'add cards to the Final Bid',
- prompt() {
- const faction = get_active_faction();
+ prompt(player) {
+ const faction = player_faction_map[player];
const number_selected = game.selected_cards[faction].length;
const number_hand = game.hands[faction].length;
if (number_selected < 3 && !(number_hand < 4 && number_selected === number_hand - 1)) {
@@ -1060,18 +1055,26 @@ states.choose_final_bid = {
n += cards[c].strength;
}
if (n > 0)
- view.prompt = `Final Bid for Glory: Discard up to 3 cards for ${n} strength.`;
+ view.prompt = `Final Bid for Glory: Discard up to 3 cards. Your bid is ${n} strength.`;
else
view.prompt = `Final Bid for Glory: Discard up to 3 cards for strength.`;
gen_action('confirm');
+ if (game.selected_cards[faction].length > 0)
+ gen_action('undo');
},
- card(c) {
- const faction = get_active_faction();
+ card(c, player) {
+ const faction = player_faction_map[player];
game.selected_cards[faction].push(c);
- next();
},
- confirm() {
- resolve_active_and_proceed(true);
+ undo(_, player) {
+ const faction = player_faction_map[player];
+ game.selected_cards[faction].length--;
+ },
+ confirm(_, player) {
+ set_delete(game.active, player);
+ if (game.active.length === 0) {
+ resolve_active_and_proceed();
+ }
},
};
function setup_momentum() {
@@ -2825,7 +2828,8 @@ function resolve_effect(effect, source) {
}
function win_final_bid(faction_id) {
log_br();
- log(`${faction_player_map[faction_id]} won the Final Bid.`);
+ log(`${faction_player_map[faction_id]} won the Final Bid:`);
+ logi("Placed T" + faction_id);
game.glory.push(faction_id);
}
function win_game(player, glory) {