summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts30
1 files changed, 24 insertions, 6 deletions
diff --git a/rules.ts b/rules.ts
index 9484e7b..98f4f8e 100644
--- a/rules.ts
+++ b/rules.ts
@@ -276,12 +276,20 @@ function setup_player_turn(faction_id: FactionId) {
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 {
+ /**
+ * Edge case situation where a player was not able to play a card due to
+ * having played Momentum medallion in a previous turn.
+ * This will skip their turn
+ */
+ setup_player_turn(get_next_faction_in_player_order(next_faction))
+ }
}
// Check if player needs to discard cards. If so inserts state node
@@ -1307,6 +1315,10 @@ states.choose_card = {
view.actions.undo = 1;
view.actions.confirm = 1;
}
+ // Edge case situation where player does not have any cards due to Momentum
+ if (game.selected_cards[faction].length === 0 && game.hands[faction].length === 0) {
+ gen_action('skip');
+ }
},
spend_hp() {
resolve_spend_hp();
@@ -1325,6 +1337,12 @@ states.choose_card = {
resolve_active_and_proceed();
}
},
+ skip(_, player: Player) {
+ set_delete(game.active as Player[], player);
+ if (game.active.length === 0) {
+ resolve_active_and_proceed();
+ }
+ },
};
states.choose_final_bid = {