diff options
Diffstat (limited to 'web/src/lib/ui/MonsterRow.svelte')
| -rw-r--r-- | web/src/lib/ui/MonsterRow.svelte | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/web/src/lib/ui/MonsterRow.svelte b/web/src/lib/ui/MonsterRow.svelte index e2a4383..ffab021 100644 --- a/web/src/lib/ui/MonsterRow.svelte +++ b/web/src/lib/ui/MonsterRow.svelte @@ -8,7 +8,7 @@ import type { GameSession } from '$lib/state/session'; import type { MonsterItem } from '$lib/protocol/types'; import type { CampaignData } from '$lib/data/gameData'; - import { monsterImage } from '$lib/game/art'; + import { monsterImage, summonImage } from '$lib/game/art'; import { standeeFigureId } from '$lib/game/stats'; import { isFrosthavenStyleForMonster } from '$lib/game/rules'; import { styleTheme } from '$lib/settings'; @@ -80,6 +80,24 @@ if (gs == null || model == null) return false; return isFrosthavenStyleForMonster(model.edition, gs, $styleTheme); }); + + // --- standee images (the reference `MonsterBoxBody`) -------------------- + + /** + * Summon standees show their summon art; a normal standee marked as + * "summoned this round" gets the green summon overlay instead. + */ + function standeeImage(standee: (typeof instances)[number]): string { + if (standee.type === 3) return summonImage(standee.gfx); + if (standee.roundSummoned !== -1) return summonImage('green'); + return monsterImage(standee.gfx); + } + + // Grayscaled while its owner's turn is current (the reference + // `isSummonedThisTurn`: marked this round AND the owner's turn). + function standeeGrayed(standee: (typeof instances)[number]): boolean { + return standee.roundSummoned === ($gameState?.round ?? 0) && currentTurn; + } </script> <div class="row row--monster" class:row--current={currentTurn} class:row--done={gray}> @@ -127,10 +145,15 @@ <button class="monster__box" class:monster__box--dead={standee.health <= 0} + class:monster__box--summon={standee.type === 3} + class:monster__box--grayed={standeeGrayed(standee)} onclick={() => onOpenMenu(figureFor(i))} aria-label={item.id} > - <img src={monsterImage(standee.gfx)} alt="" loading="lazy" /> + <img src={standeeImage(standee)} alt="" loading="lazy" /> + {#if standee.standeeNr > 0} + <span class="monster__box-nr">{standee.standeeNr}</span> + {/if} <span class="monster__box-hp">{standee.health}</span> </button> {/each} |
