summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-07-31 18:06:21 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-27 12:00:41 +0100
commitd8f66c8614a8313b3fe59759222c752b2c87e355 (patch)
tree6c79a7f2f06f936f6103a4e210447256a5a07f77
parent30683b8d9976259fb1ccdf8f61049a5bb650acfb (diff)
downloadtime-of-crisis-d8f66c8614a8313b3fe59759222c752b2c87e355.tar.gz
v2: reverse order of drafting provinces.
-rw-r--r--rules.js38
1 files changed, 29 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index e3b6471..a993763 100644
--- a/rules.js
+++ b/rules.js
@@ -661,6 +661,14 @@ function prev_player() {
return (game.current + get_player_count() - 1) % get_player_count()
}
+function first_player() {
+ return game.first
+}
+
+function last_player() {
+ return (game.first + get_player_count() - 1) % get_player_count()
+}
+
function find_unused_legion() {
for (let ix = 0; ix < LEGION_COUNT; ++ix)
if (get_legion_location(ix) === AVAILABLE)
@@ -1249,16 +1257,25 @@ states.setup_province = {
reset_neutral_italia()
clear_undo()
- game.current = next_player()
- // Go backwards for simultaneous selection of cards.
- if (game.current === game.first) {
+ if (is_classic()) {
+ game.current = next_player()
+ if (game.current === first_player())
+ goto_setup_hand()
+ } else {
game.current = prev_player()
- game.state = "setup_hand"
+ if (game.current === last_player())
+ goto_setup_hand()
}
},
}
+function goto_setup_hand() {
+ // Go backwards for simultaneous selection of cards.
+ game.current = last_player()
+ game.state = "setup_hand"
+}
+
states.setup_hand = {
inactive: "Setup",
prompt() {
@@ -1280,7 +1297,7 @@ states.setup_hand = {
done() {
clear_undo()
- if (game.current === game.first)
+ if (game.current === first_player())
goto_start_turn()
else
game.current = prev_player()
@@ -5363,7 +5380,7 @@ states.refill_hand = {
function end_refill_hand() {
clear_undo()
game.current = next_player()
- if (game.current === game.first && game.end)
+ if (game.current === first_player() && game.end)
goto_game_end()
else
goto_start_turn()
@@ -5425,11 +5442,11 @@ function goto_game_end() {
award_emperor_turns(0, n, cutoff)
log_h3("Final Score:")
- game.current = game.first
+ game.current = first_player()
do {
logi(PLAYER_NAME[game.current] + " " + game.legacy[game.current])
game.current = next_player()
- } while (game.current !== game.first)
+ } while (game.current !== first_player())
let victor = game.legacy.map((legacy,p) => [vp_tie(p),p]).sort((a,b) => b[0] - a[0])[0][1]
@@ -5667,7 +5684,10 @@ exports.setup = function (seed, scenario, options) {
else
game.first = random(player_count)
- game.current = game.first
+ if (is_classic())
+ game.current = first_player()
+ else
+ game.current = last_player()
return save_game()
}