From 1439bd62494cf3d8c8072613ab508650111efbb1 Mon Sep 17 00:00:00 2001 From: Frans Bongers Date: Fri, 3 Jan 2025 17:52:15 +0100 Subject: fix: reset first player at end of turn --- rules.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index b735703..30dc65e 100644 --- a/rules.js +++ b/rules.js @@ -162,7 +162,8 @@ function setup_player_turn() { next(); } function end_of_player_turn() { - if (get_next_faction(get_active_faction()) === game.first_player) { + const { f: faction } = get_active_node_args(); + if (get_next_faction(faction) === game.first_player) { game.engine = [ create_function_node('resolve_fascist_test'), create_function_node('setup_bag_of_glory'), @@ -309,6 +310,7 @@ function game_view(state, current) { bonuses: game.bonuses, current, current_events: game.current_events, + first_player: game.first_player, fronts: game.fronts, glory: game.glory, hand: faction === null ? [] : game.hands[faction], @@ -316,7 +318,9 @@ function game_view(state, current) { initiative: game.initiative, medallions: game.medallions, played_card: game.played_card, - player_order: current === OBSERVER ? game.player_order : get_player_order(faction).map((id) => faction_player_map[id]), + player_order: current === OBSERVER + ? game.player_order + : get_player_order(faction).map((id) => faction_player_map[id]), selectable_cards: game.selectable_cards, selected_cards: current === OBSERVER ? [] : game.selected_cards[faction], tableaus: game.tableaus, @@ -1764,6 +1768,7 @@ function end_of_turn() { }); game.active_abilities = []; game.used_medallions = []; + game.first_player = null; if (game.turn === 4) { end_of_year(); } @@ -2348,9 +2353,7 @@ function get_previous_faction(faction_id) { return player_faction_map[game.player_order[index - 1]]; } function get_next_faction(faction_id) { - console.log('get_next', faction_id); const index = game.player_order.indexOf(faction_player_map[faction_id]); - console.log('index', index); if (index === 2) { return player_faction_map[game.player_order[0]]; } -- cgit v1.2.3