From 8a16b5eb275a96d9e0dfa8d37a04969b49e319f2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 20 Mar 2025 01:30:04 +0100 Subject: Fix iterators of hero_points and fronts. --- rules.js | 8 ++++---- rules.ts | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/rules.js b/rules.js index 9dd728d..714a227 100644 --- a/rules.js +++ b/rules.js @@ -2167,8 +2167,8 @@ function determine_winner() { resolve_active_and_proceed(); } function end_of_turn() { - Object.keys(game.fronts).forEach((front_id) => { - game.fronts[front_id].contributions = []; + game.fronts.forEach(front => { + front.contributions = []; }); game.active_abilities = []; game.used_medallions = []; @@ -2902,8 +2902,8 @@ function get_source_name(source) { function get_factions_with_most_hero_poins() { let most_hero_points = null; let faction_ids = []; - Object.entries(game.hero_points).forEach(([id, value]) => { - if (id === 'pool') { + game.hero_points.forEach((value, id) => { + if (id === POOL_ID) { return; } if (most_hero_points === null || value > most_hero_points) { diff --git a/rules.ts b/rules.ts index 4057e40..c88b8d7 100644 --- a/rules.ts +++ b/rules.ts @@ -7,7 +7,6 @@ import { EngineNode, EventCard, FactionId, - Front, FrontId, FunctionNode, Game, @@ -2673,8 +2672,8 @@ function determine_winner() { } function end_of_turn() { - Object.keys(game.fronts).forEach((front_id) => { - game.fronts[front_id].contributions = []; + game.fronts.forEach(front => { + front.contributions = []; }); game.active_abilities = []; game.used_medallions = []; @@ -3645,8 +3644,8 @@ function get_source_name(source: EffectSource): string { function get_factions_with_most_hero_poins(): FactionId[] { let most_hero_points = null; let faction_ids = []; - Object.entries(game.hero_points).forEach(([id, value]) => { - if (id === 'pool') { + game.hero_points.forEach((value, id) => { + if (id === POOL_ID) { return; } if (most_hero_points === null || value > most_hero_points) { -- cgit v1.2.3