The table survives synthetic spell ids — fixes the blank screen
The Sticky Wand attaches its webs as a sustained effect with the
engine-internal id "sticky-web", which is not a printed card — and
cardDef throws on unknown ids. The scoresheet's new spell chips and
the chronicle's settles-over/wears-off lines both called it on
sustained ids, so the first webbing killed every render: mid-game the
actions bar died, and after a reload the whole table came up blank.
A spellName lookup now names synthetic effects properly ("Sticky
Wand webs") and falls back to the raw id rather than ever throwing,
and the chip peek only opens ids the card library can actually show.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
45803a2664
commit
3f3e6d9853
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { attentionLabel, net } from "./net.svelte";
|
||||
import { attentionLabel, net, spellName } from "./net.svelte";
|
||||
import Board from "./Board.svelte";
|
||||
import { PLAYER_COLORS, wizardColor } from "./colors";
|
||||
import Card from "./Card.svelte";
|
||||
@@ -432,6 +432,11 @@
|
||||
tacks: "handful-of-tacks", pit: "create-pit", safe: "safe",
|
||||
};
|
||||
|
||||
/** Sustained ids include engine constructs the card library cannot show. */
|
||||
function realCard(cardId: string): boolean {
|
||||
try { cardDef(cardId); return true; } catch { return false; }
|
||||
}
|
||||
|
||||
function creatureStats(c: NonNullable<GameView["creatures"]>[number]): string {
|
||||
const hp = Number.isFinite(c.maxDamage)
|
||||
? `${c.maxDamage - c.damage} of ${c.maxDamage} hits left`
|
||||
@@ -1073,10 +1078,11 @@
|
||||
{/each}
|
||||
{#each spellsOn as e (e.id)}
|
||||
<button class="table-card spell-chip" onclick={() => {
|
||||
if (!realCard(e.cardId)) return;
|
||||
peekCard = { instanceId: `peek-${e.id}`, cardId: e.cardId };
|
||||
peekCreatureId = null;
|
||||
}}>
|
||||
✦ {cardDef(e.cardId).name} · {e.remainingTurns}
|
||||
✦ {spellName(e.cardId)} · {e.remainingTurns}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user