From 4706f3f7f808861eccc2d7bfc43e75fe3b7ee619 Mon Sep 17 00:00:00 2001 From: Hikari Date: Sat, 7 Mar 2026 13:40:30 -0800 Subject: [PATCH] fix: backfill baseCost on adventurers from pre-existing saves --- apps/api/src/routes/game.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/api/src/routes/game.ts b/apps/api/src/routes/game.ts index 9360c70..ff41c3b 100644 --- a/apps/api/src/routes/game.ts +++ b/apps/api/src/routes/game.ts @@ -366,13 +366,17 @@ gameRouter.get("/load", async (context) => { let needsBackfill = false; - // Backfill combatPower on saves that predate the field + // Backfill combatPower and baseCost on saves that predate those fields for (const adventurer of state.adventurers) { + const defaults = DEFAULT_ADVENTURERS.find((d) => d.id === adventurer.id); if (adventurer.combatPower == null) { - const defaults = DEFAULT_ADVENTURERS.find((d) => d.id === adventurer.id); adventurer.combatPower = defaults?.combatPower ?? 1; needsBackfill = true; } + if (adventurer.baseCost == null) { + adventurer.baseCost = defaults?.baseCost ?? 10; + needsBackfill = true; + } } // Backfill equipment on saves that predate the feature