Character writeback on encounter end

Campaign-level toggle (CharacterManager, live flip). When ON, ending an
encounter writes each character participant's current HP, Max HP, and AC back
to the campaign roster so they carry into the next encounter.

- shared: buildCharacterParticipant uses defaultCurrentHp (fallback maxHp)
- endEncounter: syncs maxHp/ac/currentHp to campaign players if syncCharacters,
  snapshots old values into undo payload for restore. Works retroactive
  (ctx.campaignId fallback for encounters lacking campaignId field).
- New encounters store campaignId field.
- Undo end-encounter restores character values client-side.
- CharacterManager: styled sync toggle (checkbox badge), stat badges in list
  (HP/Current HP/AC/Init), edit box supports Current HP field.

Tests: 5 writeback cases (off/on/skip monsters/undo snapshot/missing char).
This commit is contained in:
david raistrick
2026-07-08 16:33:21 -04:00
parent 96770099f6
commit fd03ae48c8
4 changed files with 263 additions and 16 deletions
+6 -1
View File
@@ -20,7 +20,12 @@ maybe campaign toggle in charc section (choosing each end is DM overload will be
hp wont go over max and no temp hp support
refresh/reload/code update causes UI to update to top unselected cambpaign have to drill all the way back down to active encounter....every time. siemtmes?
x refresh/reload/code update causes UI to update to top unselected cambpaign have to drill all the way back down to active encounter....every time. siemtmes?
I wonder...if a charcter-list-character should have a isNPC option vailble to them - for longer lived
npcs.....