summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()
}