summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-20 01:30:04 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-20 01:30:04 +0100
commit8a16b5eb275a96d9e0dfa8d37a04969b49e319f2 (patch)
treec1f56a60d494d46aadc10f1f71ce0268de154df4
parentad43e7881da6202aecf68b22ea5a7db469df1b8e (diff)
downloadland-and-freedom-8a16b5eb275a96d9e0dfa8d37a04969b49e319f2.tar.gz
Fix iterators of hero_points and fronts.
-rw-r--r--rules.js8
-rw-r--r--rules.ts9
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) {