summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-23 11:39:44 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-23 11:39:50 +0100
commit846df22740ec71f9aba3fa52351ce8de1a34435f (patch)
tree9eabaf9454c527ca38131f964ef164c10feeb48a
parente86fbf3dccea6aa7d58a7ab09396fcf35506656e (diff)
downloadland-and-freedom-846df22740ec71f9aba3fa52351ce8de1a34435f.tar.gz
Skip player turn when they had no cards to play.
More robust handling of edge case.
-rw-r--r--rules.js11
-rw-r--r--rules.ts11
2 files changed, 12 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index a1ec804..aaaa0b3 100644
--- a/rules.js
+++ b/rules.js
@@ -163,11 +163,12 @@ function setup_player_turn(faction_id) {
next();
}
else {
- const next_next_faction = get_next_faction_in_player_order(next_faction);
- if (game.selected_cards[next_next_faction].length > 0)
- setup_player_turn(get_next_faction_in_player_order(next_next_faction));
- else
- throw new Error("impossible situation");
+ log_header("Skipped Turn", next_faction);
+ log("No cards in hand.");
+ game.engine = [
+ create_function_node('end_of_player_turn', { f: next_faction })
+ ];
+ next();
}
}
function check_end_of_year_discard() {
diff --git a/rules.ts b/rules.ts
index 7a9fef4..1469ece 100644
--- a/rules.ts
+++ b/rules.ts
@@ -289,11 +289,12 @@ function setup_player_turn(faction_id: FactionId) {
* having played Momentum medallion in a previous turn.
* This will skip their turn
*/
- const next_next_faction = get_next_faction_in_player_order(next_faction);
- if (game.selected_cards[next_next_faction].length > 0)
- setup_player_turn(get_next_faction_in_player_order(next_next_faction));
- else
- throw new Error("impossible situation");
+ log_header("Skipped Turn", next_faction);
+ log("No cards in hand.");
+ game.engine = [
+ create_function_node('end_of_player_turn', { f: next_faction })
+ ];
+ next();
}
}