summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-07-31 18:06:21 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-05 20:46:48 +0200
commita3e2d6b2c7b22a516af59b2dc3df8f806c79d507 (patch)
treeb195d416df93346b51f7fe259831b4e6c2c6d10d /rules.js
parent4a995d6c2a2e680a8e0a3fa49f4a6b6227444316 (diff)
downloadtime-of-crisis-a3e2d6b2c7b22a516af59b2dc3df8f806c79d507.tar.gz
v2: reverse order of drafting provinces.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js40
1 files changed, 31 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index 9362b8e..1f9a68c 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()
@@ -5361,7 +5378,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()
@@ -5423,11 +5440,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]
@@ -5660,7 +5677,12 @@ exports.setup = function (seed, scenario, options) {
reset_neutral_italia()
- game.first = game.current = random(player_count)
+ game.first = random(player_count)
+
+ if (is_classic())
+ game.current = first_player()
+ else
+ game.current = last_player()
return save_game()
}