Allow assigning combatants to party or enemy side for the difficulty calculation. Allied NPCs (party-side combatants with CR) subtract their XP from the monster total instead of adding to it. Accessed via the difficulty breakdown panel (issue #21).
Acceptance Criteria
Combatant supports an optional side field ("party" | "enemy")
PC combatants default to party side, all other combatants default to enemy side when side is undefined
Party-side combatants with CR subtract their XP from the monster total
Party-side combatants with level contribute to the party budget
These two effects are independent — a combatant with both level and CR on party side contributes to budget AND subtracts from monster XP
Enemy-side combatants with CR add to the monster total (existing behavior)
Net monster XP is floored at 0 (allied NPC XP cannot make difficulty negative)
The difficulty breakdown panel (issue #21) shows party and enemy columns, with a toggle to switch a combatant's side
Side assignment persists within the encounter (reload, export/import round-trip)
The breakdown panel shows two columns: Party and Enemy
Above the columns, a brief rules-oriented explanation: "Allied NPC XP is subtracted from encounter difficulty" (exact copy can be refined, but the tone should be mechanical/rules-focused, not abstract — pen and paper players expect language that maps to the XP budget system)
Combatants are switched between sides via a toggle in each row, not drag-and-drop
Notes
Depends on: issue #21 (manual CR assignment / breakdown panel) — the side toggle needs the panel UI
Signature change: The current calculateEncounterDifficulty(partyLevels[], monsterCrs[]) can no longer express side assignment. The domain function will need richer input — likely a list of combatant descriptors with { level?, cr?, side } so it can partition internally. The useDifficulty hook resolves defaults (PC → party, others → enemy) before calling the domain function.
Purely affects the difficulty calculation — no impact on turn tracking, display order, or combatant row styling
Defaults mean users who don't care about sides never see the feature — it's opt-in via the breakdown panel
MVP baseline does not include visual grouping by side in the main combatant list
## Summary
Allow assigning combatants to party or enemy side for the difficulty calculation. Allied NPCs (party-side combatants with CR) subtract their XP from the monster total instead of adding to it. Accessed via the difficulty breakdown panel (issue #21).
## Acceptance Criteria
- [ ] `Combatant` supports an optional `side` field (`"party" | "enemy"`)
- [ ] PC combatants default to party side, all other combatants default to enemy side when `side` is undefined
- [ ] Party-side combatants with CR subtract their XP from the monster total
- [ ] Party-side combatants with level contribute to the party budget
- [ ] These two effects are independent — a combatant with both level and CR on party side contributes to budget AND subtracts from monster XP
- [ ] Enemy-side combatants with CR add to the monster total (existing behavior)
- [ ] Net monster XP is floored at 0 (allied NPC XP cannot make difficulty negative)
- [ ] The difficulty breakdown panel (issue #21) shows party and enemy columns, with a toggle to switch a combatant's side
- [ ] Side assignment persists within the encounter (reload, export/import round-trip)
- [ ] Existing difficulty indicator visibility rules unchanged
## UX Guidance
- The breakdown panel shows two columns: Party and Enemy
- Above the columns, a brief rules-oriented explanation: "Allied NPC XP is subtracted from encounter difficulty" (exact copy can be refined, but the tone should be mechanical/rules-focused, not abstract — pen and paper players expect language that maps to the XP budget system)
- Combatants are switched between sides via a toggle in each row, not drag-and-drop
## Notes
- **Depends on**: issue #21 (manual CR assignment / breakdown panel) — the side toggle needs the panel UI
- **Signature change**: The current `calculateEncounterDifficulty(partyLevels[], monsterCrs[])` can no longer express side assignment. The domain function will need richer input — likely a list of combatant descriptors with `{ level?, cr?, side }` so it can partition internally. The `useDifficulty` hook resolves defaults (PC → party, others → enemy) before calling the domain function.
- Purely affects the difficulty calculation — no impact on turn tracking, display order, or combatant row styling
- Defaults mean users who don't care about sides never see the feature — it's opt-in via the breakdown panel
- MVP baseline does not include visual grouping by side in the main combatant list
## Context
- Extends spec 008 (encounter difficulty indicator)
- Related: issue #21 (manual CR assignment / breakdown panel)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Allow assigning combatants to party or enemy side for the difficulty calculation. Allied NPCs (party-side combatants with CR) subtract their XP from the monster total instead of adding to it. Accessed via the difficulty breakdown panel (issue #21).
Acceptance Criteria
Combatantsupports an optionalsidefield ("party" | "enemy")sideis undefinedUX Guidance
Notes
calculateEncounterDifficulty(partyLevels[], monsterCrs[])can no longer express side assignment. The domain function will need richer input — likely a list of combatant descriptors with{ level?, cr?, side }so it can partition internally. TheuseDifficultyhook resolves defaults (PC → party, others → enemy) before calling the domain function.Context