summaryrefslogtreecommitdiff
path: root/web/src/lib/ui/CharacterRow.svelte
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-17 23:12:38 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-17 23:12:38 +0100
commitd64cf3514e5ff1ddb1c7f3ddac9a769db3e7dde0 (patch)
tree781ec9f63220f3c15b309658e9b32ad7d9c70b3a /web/src/lib/ui/CharacterRow.svelte
parent94e2850fb73005f3fb30af8489905e5cdfb6fac5 (diff)
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
Diffstat (limited to 'web/src/lib/ui/CharacterRow.svelte')
-rw-r--r--web/src/lib/ui/CharacterRow.svelte112
1 files changed, 106 insertions, 6 deletions
diff --git a/web/src/lib/ui/CharacterRow.svelte b/web/src/lib/ui/CharacterRow.svelte
index f4fdd76..043c225 100644
--- a/web/src/lib/ui/CharacterRow.svelte
+++ b/web/src/lib/ui/CharacterRow.svelte
@@ -15,20 +15,24 @@
-->
<script lang="ts">
import type { GameSession } from '$lib/state/session';
- import type { CharacterItem } from '$lib/protocol/types';
+ import type { CharacterItem, MonsterInstance } from '$lib/protocol/types';
import { classInfo, isObjectiveOrEscort, type ClassData } from '$lib/data/classInfo';
- import { classColor, classIcon } from '$lib/game/art';
+ import { classColor, classIcon, summonImage } from '$lib/game/art';
import { conditionChipClass, conditionLabel } from '$lib/game/conditions';
+ import { standeeFigureId } from '$lib/game/stats';
import type { FigureRef } from './StatusMenu.svelte';
let {
session,
item,
- onOpenMenu
+ onOpenMenu,
+ onAddSummon
}: {
session: GameSession;
item: CharacterItem;
onOpenMenu: (figure: FigureRef) => void;
+ /** Open the add-summon menu for this character. */
+ onAddSummon: () => void;
} = $props();
const seats = session.seats;
@@ -106,8 +110,42 @@
rowId: item.id,
isObjective
});
+
+ /** A figure ref for one of the character's summon standees. */
+ function summonFigureFor(s: MonsterInstance): FigureRef {
+ return {
+ title: s.name || cs.display,
+ figureId: standeeFigureId(s),
+ ownerId: item.id,
+ kind: 'summon',
+ rowId: item.id,
+ isObjective: false
+ };
+ }
</script>
+{#if !isObjective}
+ <div class="summons">
+ {#each cs.summonList as s (standeeFigureId(s))}
+ <button
+ class="summon__box"
+ class:summon__box--dead={s.health <= 0}
+ onclick={() => onOpenMenu(summonFigureFor(s))}
+ aria-label={s.name || 'summon'}
+ >
+ <img src={summonImage(s.gfx)} alt="" loading="lazy" />
+ {#if s.standeeNr > 0}
+ <span class="summon__box-nr">{s.standeeNr}</span>
+ {/if}
+ <span class="summon__box-hp">{s.health}</span>
+ </button>
+ {/each}
+ <button class="summon__add" onclick={onAddSummon} aria-label="Add Summon">
+ ⚔+
+ </button>
+ </div>
+{/if}
+
<div
class="row row--character"
class:row--current={currentTurn}
@@ -172,9 +210,6 @@
<span class="row__xp">XP {cs.xp}</span>
{/if}
<span class="row__level">{cs.level}</span>
- {#if cs.summonList.length > 0}
- <span class="row__summon">⚔ {cs.summonList.length}</span>
- {/if}
<!-- Right-hand tap zone: initiative focus / turn done (reference). -->
<div
@@ -193,3 +228,68 @@
{#if unclaimed}
<button class="chip chip--claim" onclick={() => session.claim(item.id)}>Claim</button>
{/if}
+
+<style>
+ /* The summon standees sit above the row, like the reference. */
+ .summons {
+ display: flex;
+ align-items: stretch;
+ gap: 4px;
+ width: calc(100% - 6px);
+ margin: 2px 3px 0;
+ }
+ .summon__box {
+ position: relative;
+ width: 34px;
+ height: 44px;
+ padding: 0;
+ border: 1px solid #2196f3;
+ border-radius: 4px;
+ background: rgba(0, 0, 0, 0.45);
+ overflow: hidden;
+ cursor: pointer;
+ }
+ .summon__box:focus-visible {
+ outline: 2px solid #7ec8ff;
+ }
+ .summon__box img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+ .summon__box--dead {
+ filter: grayscale(1);
+ opacity: 0.6;
+ }
+ .summon__box-hp {
+ position: absolute;
+ right: 2px;
+ bottom: 1px;
+ font-size: 11px;
+ font-weight: 700;
+ color: #fff;
+ text-shadow: 0 0 2px #000;
+ }
+ .summon__box-nr {
+ position: absolute;
+ left: 2px;
+ top: 1px;
+ font-size: 10px;
+ font-weight: 700;
+ color: #fff;
+ text-shadow: 0 0 2px #000;
+ }
+ .summon__add {
+ width: 34px;
+ height: 44px;
+ border: 1px dashed rgba(255, 255, 255, 0.4);
+ border-radius: 4px;
+ background: rgba(0, 0, 0, 0.3);
+ color: inherit;
+ font-size: 12px;
+ cursor: pointer;
+ }
+ .summon__add:hover {
+ background: rgba(255, 255, 255, 0.12);
+ }
+</style>