feat: encounter UX, tracked effects, and character state improvements #10

Open
keen wants to merge 14 commits from fix/encounter-ux into main
pull from: fix/encounter-ux
14 Commits
Author SHA1 Message Date
david raistrick 5c4fc8a88e docs: update TODO list 2026-11-18 11:14:22 -05:00
david raistrick dda8ed9790 Add spec vetting and PC hard rules to encounter builder skill
Spec files are ephemeral (/tmp fine); the server DB is the durable
record — encounter docs carry hpFormula/ac/init, so past builds can be
reconstructed by querying live data, not from kept files.

Vetting before any write (vetSpec):
- monster/npc with neither maxHp nor hpFormula = hard reject (exit 3);
  silent 10 HP defaults caused real damage. --allow-defaults escape
  hatch warns loudly.
- character type in build spec = hard reject. PCs are added only from
  campaign roster verbatim; tooling never invents or edits PC stats.
- missing ac or initMod/initiative = warning, build continues.
- duplicate participant names in one encounter = warning.

Flag parsing: --flags split from args, usage updated.
2026-11-18 11:11:56 -05:00
david raistrick 15347bfdc8 feat: add encounter roster visibility and kill actions
- persist independent Hide Disabled and Hide Dead encounter controls
- keep dead PCs exempt from Hide Dead while allowing Hide Disabled to hide any inactive participant
- add confirmed Kill action that sets zero HP, dead, and inactive without deleting
- add undoable Heal Full action above Revive
- fix random initiative reroll test flake
2026-11-18 11:11:03 -05:00
david raistrick 0e7bc7c099 feat: make tracked effect owners editable
Default effect ownership to active participant, allow inline reassignment or clearing, move owner-linked effects between participant cards, and add direct turns-left editing coverage.
2026-10-20 18:18:54 -04:00
david raistrick 295c7e06b4 feat: add round-based tracked effects
- add generic encounter effects with round countdown, damage expiry, logs, and undo/redo
- add 5e Turned and Spiritual Weapon presets inside existing Conditions panel
- support custom participant or encounter effects with owner, notes, duration, and player visibility
- convert 5e minute durations to rounds while keeping generic rules round-only
- show prominent or compact effects on player and DM participant cards
- attach owner-linked encounter effects to owner card with global fallback for ownerless effects
- add direct turns-left editing plus step controls
2026-10-20 18:09:56 -04:00
david raistrick bca406fca9 fix: carry roster stats into encounters and add one-time sync choice
- use shared character participant builder for single-add and Add All so saved current HP, Max HP, AC, and stable state carry forward
- add End Encounter checkbox to override character writeback for one action
- default transient checkbox from campaign preference without persisting changes
- support explicit writeback override in shared endEncounter logic
- cover both add paths and modal enable/disable/reset behavior
2026-10-13 22:18:35 -04:00
david raistrick 8d71f0ba4b feat: death-save display, stable-hour recovery, reroll-all initiative
- Player display: death-save pips for dying participants (3 successes / 3 failures), stable shows note without pips
- stableRegainHours: 1d4 hours rolled on natural stabilization (3rd save success, manual stabilize, revive-to-stable); cleared on heal, damage-while-stable, inline HP edit, and death; undo/redo round-trips through all paths
- Roster writeback: end-of-encounter sync writes stable hours to characters (stable -> hours, conscious -> null); character card badge shows hours; stable state carried into new encounters via buildCharacterParticipant; editor Cur HP > 0 clears
- End-combat message corrected: states turn position and round reset while initiative values are kept
- Reroll All Initiative: d20 + initMod for every participant in a single write, undoable, pre-combat or paused only; confirmation modal in UI, hidden during active combat
- Add All (Roll Init) hoisted to Add Participants header row so it stays visible when the section is collapsed; header title remains the collapse toggle
2026-09-23 20:39:28 -04:00
david raistrick 8ecd31d570 feat: reroll initiative in participant editor with persisted init mod
Add a dice button beside the Initiative field in the participant edit modal that rolls d20 + Init Mod; Cancel/Save guard accidental changes. Persist initMod on participant creation (quick-add monster, roster character/NPC, Add All) and expose it as an editable field in the modal. Roster NPCs added via the character dropdown now enter as npc type, and the duplicate guard keys on originalCharacterId regardless of type.
2026-09-23 16:24:46 -04:00
david raistrick 05e8c262b7 feat: stateful caffeine button with icon-only display
Replace moon/coffee action-label toggle with coffee icon plus slash overlay. ON shows amber; OFF shows a slash with no color. Accessible name (Caffeine ON/OFF) and aria-pressed carry state. Applied to admin header, encounter header, and both player display states.
2026-09-23 15:31:55 -04:00
david raistrick f5b387beb5 feat: edit campaign creation settings
Add an Edit action to campaign cards with a prefilled form for name, player-display background URL, and default ruleset. Update only those campaign fields, preserving roster and existing encounter rulesets. Cover save, clearing values, cancel, and invalid name.
2026-09-23 15:07:23 -04:00
david raistrick e8a0ba2b60 chore: add bee-targeted Docker restart wrapper 2026-09-23 14:38:19 -04:00
david raistrick 3b166403e8 feat: add configurable encounter popout and completed collapse
Open selected encounters in a focused full-page panel by default, with a Back control and scroll lock. Add per-device switches in the Encounters header to disable open-on-top or completed-group collapsing. Cover selection, return-to-list, display updates, and preference persistence.
2026-09-23 12:20:18 -04:00
david raistrick 6122c19cf1 feat: inline rename for encounters
Pencil button on each encounter card opens an inline input prefilled
with the current name. Enter or the save button commits via updateDoc;
Escape or the cancel button discards. Empty/whitespace names are
ignored. Covers save, cancel, and empty-name cases in tests.
2026-09-23 10:57:09 -04:00
david raistrick 83693d4aa9 feat: group encounter list into In Progress / Ready / Completed sections
Completed encounters collapse behind a toggle so reusable ended
encounters stay reachable without cluttering the active list. Group
headers show counts. Cards keep drag-reorder, player-display toggle,
live badge, and delete controls.
2026-09-23 10:56:51 -04:00