diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2025-01-03 17:52:15 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2025-01-03 17:52:15 +0100 |
commit | 1439bd62494cf3d8c8072613ab508650111efbb1 (patch) | |
tree | 65b5a20dd5f9793c03eb6dd9b86f0435e6b2a9e5 /rules.ts | |
parent | 1298b27e451f9cbc5c784581b630577ad9d074f7 (diff) | |
download | land-and-freedom-1439bd62494cf3d8c8072613ab508650111efbb1.tar.gz |
fix: reset first player at end of turn
Diffstat (limited to 'rules.ts')
-rw-r--r-- | rules.ts | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -316,7 +316,8 @@ function setup_player_turn() { } 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'), @@ -491,7 +492,8 @@ export { game_view as view }; function game_view(state: Game, current: Player | 'Observer') { game = state; - const faction: FactionId | null = current === OBSERVER ? null : player_faction_map[current]; + const faction: FactionId | null = + current === OBSERVER ? null : player_faction_map[current]; view = { engine: game.engine, // TODO: remove @@ -501,6 +503,7 @@ function game_view(state: Game, current: Player | 'Observer') { 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], @@ -508,7 +511,10 @@ function game_view(state: Game, current: Player | 'Observer') { 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, @@ -2179,6 +2185,7 @@ function end_of_turn() { }); game.active_abilities = []; game.used_medallions = []; + game.first_player = null; if (game.turn === 4) { end_of_year(); } else { @@ -2990,9 +2997,7 @@ function get_previous_faction(faction_id: FactionId): FactionId { } function get_next_faction(faction_id: FactionId): FactionId { - 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]]; } |