Manual CR assignment for custom combatants #21

Open
opened 2026-03-27 22:17:24 +01:00 by dostulata · 0 comments
Owner

Summary

Allow assigning a CR to custom (non-bestiary) combatants so they contribute to the encounter difficulty calculation. Accessed via a difficulty breakdown panel opened by tapping the difficulty indicator. This bundles the breakdown panel and CR assignment as one feature since the panel is the natural UI for the assignment.

Acceptance Criteria

  • Combatant supports an optional cr field (string, same format as bestiary CRs)
  • The difficulty indicator is tappable — opens a breakdown panel showing party budget, per-monster XP contributions, and total
  • Custom combatants without CR appear in the panel as "unassigned" with a CR picker offering standard 5e values (0, 1/8, 1/4, 1/2, 1-30)
  • Assigning CR to a custom combatant immediately updates the XP total and difficulty tier
  • Bestiary-linked combatants derive CR from creature data — the manual cr field is ignored when creatureId is present. The panel shows bestiary-linked CRs as read-only with the source name visible, making the precedence clear.
  • CR assignment persists within the encounter (survives page reload via encounter storage, round-trips through JSON export/import)
  • Existing difficulty indicator visibility rules unchanged (hides when no PCs with levels or no combatants with CR)

Notes

  • This is a bigger chunk of work than issue #20 — two coupled features in one issue. The breakdown panel could be split out if needed, but the CR picker needs a home.
  • Adding cr to Combatant means another field for rehydrateCombatant to handle — if issue #20 (domain rehydration) lands first, this just means updating the domain function. If not, it's another instance of the shotgun surgery problem.
  • MVP baseline does not include assigning combatants to party/enemy sides — all combatants with CR are counted as enemies.

Context

  • Extends spec 008 (encounter difficulty indicator)
  • Related: issue #20 (move entity rehydration to domain layer)
  • Research: docs/agents/research/2026-03-25-combat-state.md
## Summary Allow assigning a CR to custom (non-bestiary) combatants so they contribute to the encounter difficulty calculation. Accessed via a difficulty breakdown panel opened by tapping the difficulty indicator. This bundles the breakdown panel and CR assignment as one feature since the panel is the natural UI for the assignment. ## Acceptance Criteria - [ ] `Combatant` supports an optional `cr` field (string, same format as bestiary CRs) - [ ] The difficulty indicator is tappable — opens a breakdown panel showing party budget, per-monster XP contributions, and total - [ ] Custom combatants without CR appear in the panel as "unassigned" with a CR picker offering standard 5e values (0, 1/8, 1/4, 1/2, 1-30) - [ ] Assigning CR to a custom combatant immediately updates the XP total and difficulty tier - [ ] Bestiary-linked combatants derive CR from creature data — the manual `cr` field is ignored when `creatureId` is present. The panel shows bestiary-linked CRs as read-only with the source name visible, making the precedence clear. - [ ] CR assignment persists within the encounter (survives page reload via encounter storage, round-trips through JSON export/import) - [ ] Existing difficulty indicator visibility rules unchanged (hides when no PCs with levels or no combatants with CR) ## Notes - This is a bigger chunk of work than issue #20 — two coupled features in one issue. The breakdown panel could be split out if needed, but the CR picker needs a home. - Adding `cr` to `Combatant` means another field for `rehydrateCombatant` to handle — if issue #20 (domain rehydration) lands first, this just means updating the domain function. If not, it's another instance of the shotgun surgery problem. - MVP baseline does not include assigning combatants to party/enemy sides — all combatants with CR are counted as enemies. ## Context - Extends spec 008 (encounter difficulty indicator) - Related: issue #20 (move entity rehydration to domain layer) - Research: `docs/agents/research/2026-03-25-combat-state.md`
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dostulata/initiative#21