Implement D&D 5e death-save state machine and cleanup combat ordering
- Add status-driven death-save model: - status: conscious | dying | stable | dead - deathSaveSuccesses/deathSaveFailures as display counters - remove old death-save fields as source of truth - Add death-save actions: - success, fail, nat1, nat20 - stabilize participant - revive dead participant to 0 HP, stable, unconscious - Apply 5e HP transition rules: - characters and NPCs at 0 HP become dying - stable/dying participants gain unconscious condition - healing clears death saves and returns conscious - massive damage kills - non-NPC monsters at 0 HP become dead and inactive - Split NPCs from monsters with type="npc": - NPCs use death saves like characters - NPCs remain DM-controlled/monster-colored in UI - new NPCs no longer persist isNpc flag - Keep dead PCs/NPCs in encounter and initiative until DM removes or deactivates - Allow DM active/inactive toggle for dead participants - Hide inactive participants from player display - Improve DM and player death-state UI: - show Dying/Dead/Unconscious states consistently - add revive button for dead participants - distinguish dead visual from inactive visual in DM view - Fix initiative drag/reorder behavior: - downward drag now changes order instead of no-op - paused combat can reorder across current turn pointer - turnOrderIds stay synced to participants order - Persist campaign collapse state in localStorage - Update death-save docs and encounter builder docs - Add/expand tests for: - death saves and HP transitions - dead/active/inactive behavior - NPC death-save behavior - player display visibility - drag reorder semantics - logging expectations Tests: - npm run test:all - app: 94 passed - shared: 158 passed, 5 skipped - server: 32 passed
This commit is contained in:
@@ -4,6 +4,37 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
|
||||
|
||||
## Open
|
||||
|
||||
### FEAT: critical damage button for dying/stable participants
|
||||
- Shared logic already supports `applyHpChange(..., { isCriticalHit:true })`.
|
||||
- UI only has normal Damage, which adds 1 failure at 0 HP.
|
||||
- Add button near Revive/Stabilize: **Crit Damage** / **Critical Hit**.
|
||||
- Use only for dying/stable character/NPC at 0 HP; adds 2 death-save failures.
|
||||
- Dead target remains dead; no action.
|
||||
|
||||
### dm list - keep active particpant in view (scroll)
|
||||
|
||||
|
||||
#### debug feature - button to delet all campaigns - only in dev builds
|
||||
|
||||
### bug - start/end/resume combat should not be in undo I think...
|
||||
|
||||
### combat.js doesnt seem to actually exercise the add characters. there are no characters in the campaign. only in the encounter..
|
||||
|
||||
|
||||
## dying>stabe state - add +1hp in 1d4 hours DISPLAY (maybe show a rolled hours too) for while stable
|
||||
|
||||
### FEAT: player display fade transitions for inactive state
|
||||
- Inactive is DM-triggered via Mark Inactive.
|
||||
- Player display should fade inactive participant out, then remove from display list.
|
||||
- Reactivating should fade participant in.
|
||||
- DM display keeps inactive participant visible.
|
||||
- Dead state does not imply inactive/disabled.
|
||||
- Dying/stable must not fade out or leave layout holes.
|
||||
- Dead can keep skull/Dead label; create some good visual cues, no removal.
|
||||
-
|
||||
|
||||
|
||||
|
||||
### TEST GAP: current branch changes need focused coverage
|
||||
- Storage `where()` contract: firebase + server adapters should honor `[where('encounterPath','==',x), orderBy('ts','desc'), limit(n)]`.
|
||||
- Server SQL query test: `where + orderBy + limit` should return latest logs for one encounter only.
|
||||
@@ -45,7 +76,12 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
|
||||
- Decide UX before fix.
|
||||
|
||||
|
||||
### death saves feature - dead PCs should not get removed from initiative! DAMMIT!
|
||||
### FEAT: generic/non-5e rules mode
|
||||
- Campaign/encounter ruleset toggle: `5e` vs `generic`.
|
||||
- Generic mode turns off death saves/state machine.
|
||||
- Generic mode allows negative HP.
|
||||
- 5e mode rejects negative damage/heal and clamps HP at 0.
|
||||
|
||||
|
||||
|
||||
### FEAT: clarify "Is NPC" in add-participant
|
||||
@@ -120,12 +156,13 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
|
||||
case-insensitive. maxLength 40. Combat + replay tests prove arbitrary
|
||||
string ids survive round-trip.
|
||||
|
||||
### Death saves: D&D 5e model (DONE)
|
||||
- Separate success/fail tracking. deathSave(enc, id, type, n),
|
||||
type='success'|'fail'. Fields: deathSaves, deathFails, isStable, isDying.
|
||||
3 success=stable, 3 fail=dead. Returns {patch, log, status, isDying}.
|
||||
Old single-counter broken (successes missing). Old data lost (feature
|
||||
never worked in prod). UI: green ✓ + red ✕ rows, Stabilized/Dying badges.
|
||||
### Death saves: D&D 5e status model (DONE)
|
||||
- `status` is source of truth: conscious, dying, stable, dead.
|
||||
- Characters and NPCs use death saves; monsters skip death saves and become dead/inactive at 0 HP.
|
||||
- Death-save actions: Success, Fail, Nat1, Nat20, Stabilize.
|
||||
- Revive: dead → 0 HP, stable/unconscious, active.
|
||||
- Dead characters/NPCs stay in encounter/initiative until DM removes or marks inactive.
|
||||
- Player display hides inactive participants; DM display keeps them visible.
|
||||
|
||||
### FEAT-3: initiative first-class entry (DONE)
|
||||
- Initiative field at add-char, add-monster, edit participant.
|
||||
@@ -199,9 +236,9 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
|
||||
### BUG-18: stale comments reference deleted memory adapter
|
||||
- FIXED.
|
||||
|
||||
### FEAT-1: Dead participants stay in turn order
|
||||
- DONE --- applyHpChange no longer flips isActive on death. Dead stay in
|
||||
rotation, nextTurn visits them, PCs get death-save turn.
|
||||
### FEAT-1: Dead characters/NPCs stay in turn order
|
||||
- DONE --- character/NPC death does not auto-remove. DM controls inactive/remove.
|
||||
- Non-NPC monsters still become inactive automatically at death.
|
||||
|
||||
### combat.scenario 100 rounds not turns
|
||||
- DONE --- loops by actual round-wrap count.
|
||||
|
||||
Reference in New Issue
Block a user