Exercise death-save edge cases in combat replay and scenario tests

Replay (scripts/combat/replay.js):
- Merchant now type=npc via asNpc (was stale isNpc)
- Death-save eligibility keyed on type (character|npc), not removed isNpc
- Rotate outcomes success/fail/nat1/nat20 (was success-only)
- Import stabilizeParticipant, reviveParticipant
- Between-round revive: dead -> reviveParticipant, stable -> heal,
  inactive -> reactivate (heal was no-op on dead, leaving active-dead monsters)
- Fix deathSave return unwrap: it returns {enc, status}; callStep runner
  must extract .enc or state corrupts (round undefined, combat auto-ends)
- describe() fix: death-save arg is outcome, not type

Scenario (src/tests/Combat.scenario.test.js):
- Import stabilizeParticipant, reviveParticipant
- applyDamage accepts options (crit at 0 HP)
- Add stabilizeAction, reviveAction helpers
- addAllCharacters now actually exercises batch add (was no-op)
- New deterministic edge-case test: monster death (dead+inactive),
  NPC nat20, NPC nat1+damage+revive+heal, character stable->damage->crit,
  massive damage
This commit is contained in:
david raistrick
2026-07-06 17:10:01 -04:00
parent 1d4ec873dc
commit c80ac6882f
3 changed files with 123 additions and 28 deletions
+9 -5
View File
@@ -4,6 +4,14 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
## Open
### REview undo/redo around death stuff. doesnt work.
suspect not writing to undo log?
### bug - start/end/resume combat should not be in undo I think...
## dying>stabe state - add +1hp in 1d4 hours DISPLAY (maybe show a rolled hours too) for while stable
## dying>stabe state - add +1hp in 1d4 hours DISPLAY (maybe show a rolled hours too) for while stable
### 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.
@@ -13,15 +21,11 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
### dm list - keep active particpant in view (scroll)
### combat.js doesnt seem to actually exercise the add characters. there are no characters in the campaign. only in the encounter..
#### 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.