summaryrefslogtreecommitdiff
path: root/rules.ts
diff options
context:
space:
mode:
Diffstat (limited to 'rules.ts')
-rw-r--r--rules.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/rules.ts b/rules.ts
index 0692e79..e620ad8 100644
--- a/rules.ts
+++ b/rules.ts
@@ -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]];
}