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/ui/CharacterRow.svelte | 112 +++++++++- web/src/lib/ui/MainList.svelte | 107 ++++++++-- web/src/lib/ui/MainMenu.svelte | 29 +++ web/src/lib/ui/MonsterRow.svelte | 27 ++- web/src/lib/ui/NoteRow.svelte | 187 +++++++++++++---- web/src/lib/ui/StatusMenu.svelte | 115 +++++++++++ web/src/lib/ui/menus/AddNoteRowMenu.svelte | 113 ----------- web/src/lib/ui/menus/AddSectionMenu.svelte | 103 ++++++++-- web/src/lib/ui/menus/AddSummonMenu.svelte | 261 ++++++++++++++++++++++++ web/src/lib/ui/menus/FigureNoteMenu.svelte | 83 ++++++++ web/src/lib/ui/menus/NoteRowMenu.svelte | 270 +++++++++++++++++++++++++ web/src/lib/ui/menus/SettingsMenu.svelte | 63 +++++- web/src/lib/ui/menus/SpecialUnlocksMenu.svelte | 83 ++++++++ 13 files changed, 1357 insertions(+), 196 deletions(-) delete mode 100644 web/src/lib/ui/menus/AddNoteRowMenu.svelte create mode 100644 web/src/lib/ui/menus/AddSummonMenu.svelte create mode 100644 web/src/lib/ui/menus/FigureNoteMenu.svelte create mode 100644 web/src/lib/ui/menus/NoteRowMenu.svelte create mode 100644 web/src/lib/ui/menus/SpecialUnlocksMenu.svelte (limited to 'web/src/lib/ui') 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 @@ --> +{#if !isObjective} +
+ {#each cs.summonList as s (standeeFigureId(s))} + + {/each} + +
+{/if} +
XP {cs.xp} {/if} {cs.level} - {#if cs.summonList.length > 0} - ⚔ {cs.summonList.length} - {/if}
session.claim(item.id)}>Claim {/if} + + diff --git a/web/src/lib/ui/MainList.svelte b/web/src/lib/ui/MainList.svelte index f594778..87f83b9 100644 --- a/web/src/lib/ui/MainList.svelte +++ b/web/src/lib/ui/MainList.svelte @@ -1,13 +1,13 @@
{#if $gameState} - {#each $gameState.currentList as item (item.id)} - {#if isCharacter(item)} - - {:else if isMonster(item)} - - {:else if isNoteRow(item)} - - {/if} + {#each $gameState.currentList as item, i (item.id)} +
onDragStart(e, i)} + ondragover={(e) => onDragOver(e, i)} + ondrop={onDrop} + ondragend={onDragEnd} + ondragleave={() => { + if (dropIndex === i) dropIndex = null; + }} + > + {#if isCharacter(item)} + onAddSummon(item)} + /> + {:else if isMonster(item)} + + {:else if isNoteRow(item)} + + {/if} +
{/each} {#if $gameState.currentList.length === 0}

@@ -57,3 +114,17 @@ {/if} {/if}

+ + diff --git a/web/src/lib/ui/MainMenu.svelte b/web/src/lib/ui/MainMenu.svelte index f0aca7a..59386a2 100644 --- a/web/src/lib/ui/MainMenu.svelte +++ b/web/src/lib/ui/MainMenu.svelte @@ -6,6 +6,7 @@ --> {#if open} @@ -81,6 +100,16 @@ + {#if showShowAllyDeck} + + {/if} + {#if showHideAllyDeck} + + {/if}
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; + }
@@ -127,10 +145,15 @@ {/each} diff --git a/web/src/lib/ui/NoteRow.svelte b/web/src/lib/ui/NoteRow.svelte index 34af63e..f237c13 100644 --- a/web/src/lib/ui/NoteRow.svelte +++ b/web/src/lib/ui/NoteRow.svelte @@ -1,57 +1,174 @@ -
-
- {#if editing} - { - if (e.key === 'Enter') commit(); - }} - /> - {:else} - - {/if} -
+
onEdit(item)} + onkeydown={(e) => { + if (e.key === 'Enter' || e.key === ' ') onEdit(item); + }} + style="margin-left: {linked ? 27 : 3}px; margin-right: 3px; + background: linear-gradient(180deg, {gradTop} 0%, {gradBottom} 100%); + border: 1.3px solid {borderCss}; + color: {fg}" +> + {linked ? '›' : '✎'} + {#if linked && targetIsMonster && target} + + {item.standeeNr > 0 ? item.standeeNr + ':' : t('noteRowAll') + ':'} + + {/if} + + {empty ? t('noteRowHint') : item.text} +
+ + diff --git a/web/src/lib/ui/StatusMenu.svelte b/web/src/lib/ui/StatusMenu.svelte index 46f6325..e968883 100644 --- a/web/src/lib/ui/StatusMenu.svelte +++ b/web/src/lib/ui/StatusMenu.svelte @@ -21,7 +21,9 @@ import { isObjectiveOrEscort } from '$lib/data/classInfo'; import { CONDITIONS } from '$lib/game/conditions'; import { t } from '$lib/i18n'; + import type { CampaignData } from '$lib/data/gameData'; import Menu from './Menu.svelte'; + import FigureNoteMenu from './menus/FigureNoteMenu.svelte'; export interface FigureRef { title: string; @@ -38,10 +40,16 @@ let { session, figure, + campaignData, + onAddNoteRow, open = $bindable(true) }: { session: GameSession; figure: FigureRef; + /** Campaign data (monster model lookup for the Ice Wraith gate). */ + campaignData?: CampaignData | null; + /** Open the note-row editor with a preset link target. */ + onAddNoteRow: (presetLinkId: string) => void; open?: boolean; } = $props(); @@ -131,6 +139,62 @@ if (conditions.includes(index)) cmd('removeCondition', args); else cmd('addCondition', args); } + + // --- Phase 5 extras ------------------------------------------------------ + + /** The owning monster's model (Ice Wraith gate), for monster figures. */ + const monsterModel = $derived.by(() => { + if (figure.kind !== 'monster' || !campaignData) return null; + const owner = liveOwner; + if (owner == null || !('monsterInstances' in owner)) return null; + return ( + campaignData.monsters.find( + (m) => m.name === owner.type || m.display === owner.type + ) ?? null + ); + }); + + const isIceWraith = $derived(monsterModel?.deck === 'Ice Wraith'); + const isElite = $derived(liveStandee?.type === 1); + + function switchForm() { + // The command takes the *current* elite state and toggles it. + cmd('iceWraithChangeForm', { + isElite, + ownerId: figure.ownerId ?? '', + figureId: figure.figureId + }); + } + + // The summon mark (the reference `StatusMenuSummonButton`). + const summonMarked = $derived(liveStandee?.roundSummoned !== -1); + + function toggleSummon() { + cmd('setAsSummon', { + summoned: !summonMarked, + figureId: figure.figureId, + ownerId: figure.ownerId ?? '' + }); + } + + // The figure's quick note (characters and monsters; not summons). + const noteFigure = $derived.by(() => { + if (figure.kind === 'character') return liveCharacter; + if (figure.kind === 'monster') + return liveOwner && 'note' in liveOwner ? liveOwner : null; + return null; + }); + + let noteOpen = $state(false); + + function openNote() { + noteOpen = true; + } + + /** The link target preset when adding a note row from here. */ + function presetLinkTarget(): string { + return figure.ownerId ?? figure.figureId; + } @@ -197,6 +261,48 @@ {/each}
+
+ {#if isIceWraith} + + {/if} + {#if figure.kind === 'monster' && liveStandee} + + {/if} + {#if noteFigure} + + {/if} + +
+ {#if roundState === 1}
- {/each} -
- - - -
- {t('noteRowWholeGroup')} - -
- -
- -
- diff --git a/web/src/lib/ui/menus/AddSectionMenu.svelte b/web/src/lib/ui/menus/AddSectionMenu.svelte index 991b6a5..8fdef55 100644 --- a/web/src/lib/ui/menus/AddSectionMenu.svelte +++ b/web/src/lib/ui/menus/AddSectionMenu.svelte @@ -2,6 +2,15 @@ Add Section (the reference `AddSectionMenu`): lists the addable sections of the current scenario (its rooms after the start room, minus spawns) and adds one via `setScenario { scenario, section: true }`. + + Reference behaviors ported here: + - case-insensitive search filter over the section names; + - ordering by the section number (`findNrFromScenarioName`) with a + string-compare fallback; + - sections already in the scenario are greyed out and tapping them is a + no-op; + - the search label is "Add Random Dungeon Card" when the scenario is + "#Random Dungeon". --> {#if !$gameState?.scenario} -

{t('web:noScenario')}

- {:else if sections === null} -

{t('connecting')}

- {:else if sections.length === 0} -

{t('noResultsFound')}

+

{t('web:noScenario')}

{:else} - + + {#if sections === null} +

{t('connecting')}

+ {:else if shown.length === 0} +

{t('noResultsFound')}

+ {:else} + + {/if} {/if}
+ + diff --git a/web/src/lib/ui/menus/AddSummonMenu.svelte b/web/src/lib/ui/menus/AddSummonMenu.svelte new file mode 100644 index 0000000..a60cb42 --- /dev/null +++ b/web/src/lib/ui/menus/AddSummonMenu.svelte @@ -0,0 +1,261 @@ + + + + +
+ {#each COLORS as c (c)} + + {/each} +
+ +
+ {#each NUMBERS as n (n)} + + {/each} +
+ + {#if $gameState} +
    + {#each entries as model (model.name + model.gfx)} +
  • + +
  • + {/each} +
+ {/if} +
+ + diff --git a/web/src/lib/ui/menus/FigureNoteMenu.svelte b/web/src/lib/ui/menus/FigureNoteMenu.svelte new file mode 100644 index 0000000..0f79578 --- /dev/null +++ b/web/src/lib/ui/menus/FigureNoteMenu.svelte @@ -0,0 +1,83 @@ + + + + + + {#if $player} +
+ +
+ {/if} +
+ + diff --git a/web/src/lib/ui/menus/NoteRowMenu.svelte b/web/src/lib/ui/menus/NoteRowMenu.svelte new file mode 100644 index 0000000..78f25f9 --- /dev/null +++ b/web/src/lib/ui/menus/NoteRowMenu.svelte @@ -0,0 +1,270 @@ + + + + + + + {#if canAct} +
{t('noteRowColourLabel')}
+
+ {#each PALETTE as c (c)} + + {/each} +
+ +
{t('noteRowConnectLabel')}
+ + + {#if linkedMonster} + + {/if} + +
+ {#if isEdit && note} + + {:else} + + {/if} + {#if isEdit} + + {:else} + + {/if} +
+ {/if} +
+ + diff --git a/web/src/lib/ui/menus/SettingsMenu.svelte b/web/src/lib/ui/menus/SettingsMenu.svelte index ef5a91a..4a6699a 100644 --- a/web/src/lib/ui/menus/SettingsMenu.svelte +++ b/web/src/lib/ui/menus/SettingsMenu.svelte @@ -1,20 +1,35 @@ @@ -47,4 +62,46 @@ {/each}
+ +
+ +
+
+ +
+ +{#if unlocksOpen} + +{/if} + + diff --git a/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte b/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte new file mode 100644 index 0000000..e565c33 --- /dev/null +++ b/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte @@ -0,0 +1,83 @@ + + + + +
    + {#each UNLOCKS as u (u.id)} +
  • + +
  • + {/each} +
+
+ + -- cgit v1.3.1