Combatant side assignment for encounter difficulty #22

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

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)
## 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)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dostulata/initiative#22