summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorFrans Bongers <fransbongers@macbookpro.home>2025-03-22 20:09:42 +0100
committerFrans Bongers <fransbongers@macbookpro.home>2025-03-22 20:09:42 +0100
commit3edb3e8c15ac307c8adc6415408091c5037bad52 (patch)
treed21a9a57ae54a5b2569880a2d4abc0eb35a667ec /rules.js
parente0be8aea7bc4d8de52ee0e8750968d70f86c979d (diff)
downloadland-and-freedom-3edb3e8c15ac307c8adc6415408091c5037bad52.tar.gz
skip a players turn if they cannot play a card
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index bd6e116..eb0b138 100644
--- a/rules.js
+++ b/rules.js
@@ -155,11 +155,16 @@ function setup_player_turn(faction_id) {
if (game.first_player === null) {
game.first_player = next_faction;
}
- game.engine = [
- create_function_node('start_of_player_turn', { f: next_faction }),
- create_state_node('player_turn', next_faction),
- ];
- next();
+ if (game.selected_cards[next_faction].length > 0) {
+ game.engine = [
+ create_function_node('start_of_player_turn', { f: next_faction }),
+ create_state_node('player_turn', next_faction),
+ ];
+ next();
+ }
+ else {
+ setup_player_turn(get_next_faction_in_player_order(next_faction));
+ }
}
function check_end_of_year_discard() {
const { f: faction } = get_active_node_args();
@@ -1029,6 +1034,9 @@ states.choose_card = {
view.actions.undo = 1;
view.actions.confirm = 1;
}
+ if (game.selected_cards[faction].length === 0 && game.hands[faction].length === 0) {
+ gen_action('skip');
+ }
},
spend_hp() {
resolve_spend_hp();
@@ -1047,6 +1055,12 @@ states.choose_card = {
resolve_active_and_proceed();
}
},
+ skip(_, player) {
+ set_delete(game.active, player);
+ if (game.active.length === 0) {
+ resolve_active_and_proceed();
+ }
+ },
};
states.choose_final_bid = {
inactive: 'choose Final Bid',