From d64cf3514e5ff1ddb1c7f3ddac9a769db3e7dde0 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 17 Nov 2026 23:12:38 +0100 Subject: Phase 5: campaign meta, notes, special rules (M5) Web: - Note rows: create/edit menu (text, 12-swatch palette, player/monster link with per-standee selection, delete) with the reference's create-vs-edit commit semantics; row rendering with target-derived gradient colour, link indent + connector, standee N:/All: prefixes, tap-to-edit; whole-list drag-to-reorder (reorderList); quick per-figure note (setFigureNote) from the status menu - Special monsters: Ice Wraith "Switch Form" (deck == "Ice Wraith" gate), summon mark toggle (round-green/summon standee artwork, standee-nr badges, per-owner grayscale), character summon boxes + AddSummonMenu (class summons gated by level and standee cap, item summons from summons.json) - Ally deck show/hide in the main menu (shouldShowAlliesDeck gate); settings "clear unlocked" + Special Unlocks menu - AddSectionMenu parity: search filter, findNrFromScenarioName numeric ordering, added sections greyed + no-op, #Random Dungeon label - gameData.ts: SummonModel, ClassData.summons, summons() fetch Server: - unlock_special_command_test (last command without a test; ally-deck hide and remove-sanctuary were already covered) PLAN.md: Phase 5 boxes checked, M5 progress-log entry --- web/src/lib/data/gameData.ts | 73 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) (limited to 'web/src/lib/data') diff --git a/web/src/lib/data/gameData.ts b/web/src/lib/data/gameData.ts index 10e1c60..5925b65 100644 --- a/web/src/lib/data/gameData.ts +++ b/web/src/lib/data/gameData.ts @@ -12,6 +12,17 @@ import type { // --- Raw JSON shapes (the subset the UI needs) ---------------------------- +/** One summon of a character class (the reference `SummonModel`). */ +interface RawSummon { + level?: number; + gfx?: string; + health?: number; + move?: number; + attack?: number; + range?: number; + standees?: number; +} + interface RawClass { name: string; edition: string; @@ -22,6 +33,13 @@ interface RawClass { /** `adds`/`removes` per perk slot (the reference `PerkModel`). */ perks?: { text?: string; adds?: string[]; removes?: string[] }[]; perksFH?: { text?: string; adds?: string[]; removes?: string[] }[]; + /** Summon models, keyed by name (the reference `summons`). */ + summons?: Record; +} + +/** The generic item summons (`summons.json`). */ +interface RawSummonsFile { + summons: Record; } interface RawMonsterStats { @@ -82,6 +100,8 @@ export interface ClassData { /** The full perk-slot data (text + adds + removes) for the perks menu. */ perkDetails: PerkDetail[]; perkDetailsFH: PerkDetail[]; + /** The class's summonable figures. */ + summons: SummonModel[]; } /** One perk slot (the reference `PerkModel`). */ @@ -91,6 +111,22 @@ export interface PerkDetail { removes: string[]; } +/** + * A summonable figure (the reference `SummonModel`). `gfx` is empty for + * class summons without fixed art (a colour standee is chosen in the menu); + * item summons carry their own artwork name. + */ +export interface SummonModel { + name: string; + level: number; + standees: number; + health: number; + move: number; + attack: number; + range: number; + gfx: string; +} + export interface MonsterData { name: string; display: string; @@ -188,6 +224,38 @@ export class GameDataClient { constructor(private readonly base = '/data') {} + private summonsPromise: Promise | null = null; + + /** + * The generic item summons (the reference `itemSummonData`, from + * `summons.json`): summonable figures independent of any class. + */ + summons(): Promise { + if (this.summonsPromise) return this.summonsPromise; + this.summonsPromise = fetch(`${this.base}/summons.json`) + .then((r) => (r.ok ? r.json() : null)) + .then((raw: RawSummonsFile | null) => + Object.entries(raw?.summons ?? {}).map(([name, s]) => + this.toSummon(name, s) + ) + ) + .catch(() => [] as SummonModel[]); + return this.summonsPromise; + } + + private toSummon(name: string, s: RawSummon): SummonModel { + return { + name, + level: s.level ?? 0, + standees: s.standees ?? 1, + health: typeof s.health === 'string' ? Number(s.health) || 2 : s.health ?? 2, + move: s.move ?? 0, + attack: s.attack ?? 0, + range: s.range ?? 0, + gfx: s.gfx ?? '' + }; + } + /** The list of campaign/edition names (order from `editions.json`). */ campaigns(): Promise { if (this.campaignsCache) return Promise.resolve(this.campaignsCache); @@ -331,7 +399,10 @@ export class GameDataClient { perks: (c.perks ?? []).map((p) => p.adds ?? []), perksFH: (c.perksFH ?? []).map((p) => p.adds ?? []), perkDetails: toDetails(c.perks), - perkDetailsFH: toDetails(c.perksFH) + perkDetailsFH: toDetails(c.perksFH), + summons: Object.entries(c.summons ?? {}).map(([name, s]) => + this.toSummon(name, s) + ) }; } -- cgit v1.3.1