From a3e2d6b2c7b22a516af59b2dc3df8f806c79d507 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 31 Jul 2024 18:06:21 +0200 Subject: v2: reverse order of drafting provinces. --- rules.js | 40 +++++++++++++++++++++++++++++++--------- 1 file 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() } -- cgit v1.2.3