Add PF2e persistent damage condition tags
Persistent damage displayed as compact tags with damage type icon and formula (e.g., Flame + "2d6"). Supports fire, bleed, acid, cold, electricity, poison, and mental types. One instance per type, added via sub-picker in the condition picker. PF2e only, persists across reload. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ interface Combatant {
|
||||
readonly ac?: number; // non-negative integer
|
||||
readonly conditions?: readonly ConditionEntry[];
|
||||
readonly isConcentrating?: boolean;
|
||||
readonly persistentDamage?: readonly PersistentDamageEntry[]; // PF2e only
|
||||
readonly creatureId?: CreatureId; // link to bestiary entry
|
||||
}
|
||||
|
||||
@@ -32,6 +33,11 @@ interface ConditionEntry {
|
||||
readonly id: ConditionId;
|
||||
readonly value?: number; // PF2e valued conditions (e.g., Clumsy 2); undefined for D&D
|
||||
}
|
||||
|
||||
interface PersistentDamageEntry {
|
||||
readonly type: PersistentDamageType; // "fire" | "bleed" | "acid" | "cold" | "electricity" | "poison" | "mental"
|
||||
readonly formula: string; // e.g., "2d6", "1d4+2"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
@@ -346,6 +352,19 @@ Acceptance scenarios:
|
||||
4. **Given** the game system is D&D (5e or 5.5e), **When** interacting with conditions, **Then** no maximum enforcement is applied.
|
||||
5. **Given** a PF2e valued condition without a defined maximum (e.g., Frightened, Clumsy), **When** incrementing, **Then** no cap is enforced — the value can increase without limit.
|
||||
|
||||
**Story CC-11 — Persistent Damage Tags (P2)**
|
||||
As a DM running a PF2e encounter, I want to apply persistent damage to a combatant as a compact tag showing a damage type icon and formula so I can track ongoing damage effects without manual bookkeeping.
|
||||
|
||||
Acceptance scenarios:
|
||||
1. **Given** the game system is Pathfinder 2e and the condition picker is open, **When** the user clicks "Persistent Damage", **Then** a sub-picker opens with a damage type dropdown (fire, bleed, acid, cold, electricity, poison, mental) and a formula text input.
|
||||
2. **Given** the sub-picker is open, **When** the user selects "fire" and types "2d6" and confirms, **Then** a compact tag appears on the combatant row showing a fire icon and "2d6".
|
||||
3. **Given** a combatant has persistent fire 2d6, **When** the user adds persistent bleed 1d4, **Then** both tags appear on the row simultaneously.
|
||||
4. **Given** a combatant has persistent fire 2d6, **When** the user adds persistent fire 3d6, **Then** the existing fire entry is replaced with 3d6 (one instance per type).
|
||||
5. **Given** a combatant has a persistent damage tag, **When** the user clicks the tag on the row, **Then** the persistent damage entry is removed.
|
||||
6. **Given** a combatant has a persistent damage tag, **When** the user hovers over it, **Then** a tooltip shows the full description (e.g., "Persistent Fire 2d6 — Take damage at end of turn. DC 15 flat check to end.").
|
||||
7. **Given** the game system is D&D (5e or 5.5e), **When** viewing the condition picker, **Then** no "Persistent Damage" option is available.
|
||||
8. **Given** a combatant has persistent damage entries, **When** the page is reloaded, **Then** all entries are restored exactly.
|
||||
|
||||
### Requirements
|
||||
|
||||
- **FR-032**: When a D&D game system is active, the system MUST support the following 15 standard D&D 5e/5.5e conditions: blinded, charmed, deafened, exhaustion, frightened, grappled, incapacitated, invisible, paralyzed, petrified, poisoned, prone, restrained, stunned, unconscious. When Pathfinder 2e is active, the system MUST support the PF2e condition set (see FR-103).
|
||||
@@ -401,6 +420,15 @@ Acceptance scenarios:
|
||||
- **FR-110**: Maximum value enforcement MUST only apply when the Pathfinder 2e game system is active. D&D conditions are unaffected.
|
||||
- **FR-111**: When Pathfinder 2e is the active game system, the concentration UI (Brain icon toggle, purple left border accent, damage pulse animation) MUST be hidden entirely. The Brain icon MUST NOT be shown on hover or at rest, and the concentration toggle MUST NOT be interactive.
|
||||
- **FR-112**: Switching the game system MUST NOT clear or modify `isConcentrating` state on any combatant. The state MUST be preserved in storage and restored to the UI when switching back to a D&D game system.
|
||||
- **FR-117**: When Pathfinder 2e is active, the condition picker MUST include a "Persistent Damage" entry that opens a sub-picker instead of toggling directly.
|
||||
- **FR-118**: The persistent damage sub-picker MUST contain a dropdown of common PF2e damage types (fire, bleed, acid, cold, electricity, poison, mental) and a text input for the damage formula (e.g., "2d6").
|
||||
- **FR-119**: Each persistent damage entry MUST be displayed as a compact tag on the combatant row showing a damage type icon and the formula text (e.g., fire icon + "2d6").
|
||||
- **FR-120**: Only one persistent damage entry per damage type is allowed per combatant. Adding the same damage type MUST replace the existing formula.
|
||||
- **FR-121**: Clicking a persistent damage tag on the combatant row MUST remove that entry.
|
||||
- **FR-122**: Hovering a persistent damage tag MUST show a tooltip with the full description: "{Type} {formula} — Take damage at end of turn. DC 15 flat check to end."
|
||||
- **FR-123**: Persistent damage MUST NOT be available when a D&D game system is active.
|
||||
- **FR-124**: Persistent damage entries MUST persist across page reloads via the existing persistence mechanism.
|
||||
- **FR-125**: Persistent damage tags MUST be displayed inline after condition icons, following the same wrapping behavior as conditions (FR-041).
|
||||
|
||||
### Edge Cases
|
||||
|
||||
@@ -417,7 +445,11 @@ Acceptance scenarios:
|
||||
- When the game system is switched from D&D to PF2e, existing D&D conditions on combatants are hidden (not deleted). Switching back to D&D restores them.
|
||||
- PF2e valued condition at value 0 is treated as removed — it MUST NOT appear on the row.
|
||||
- Dying, doomed, wounded, and slowed have enforced maximum values in PF2e (4, 3, 3, 3 respectively). The `[+]` button is disabled at the cap. The dynamic dying cap based on doomed value (dying max = 4 − doomed) is not enforced — only the static maximum applies.
|
||||
- Persistent damage is excluded from the PF2e MVP condition set. It can be added as a follow-up feature.
|
||||
- Persistent damage tags are separate from the `conditions` array — they use a dedicated `persistentDamage` field on `Combatant`.
|
||||
- Adding persistent damage with an empty formula is rejected; the formula field must be non-empty.
|
||||
- When the game system is switched from PF2e to D&D, existing persistent damage entries are preserved in storage but hidden from display, consistent with condition behavior (FR-107).
|
||||
- Persistent damage has no automation — the system does not auto-apply damage or prompt for flat checks. It is a visual reminder only.
|
||||
- The persistent damage sub-picker closes when the user clicks outside of it or confirms an entry.
|
||||
- When PF2e is active, concentration state (`isConcentrating`) is preserved in storage but the entire concentration UI is hidden. Switching back to D&D restores Brain icons, purple borders, and pulse behavior without data loss.
|
||||
|
||||
---
|
||||
@@ -622,3 +654,5 @@ Acceptance scenarios:
|
||||
- **SC-035**: PF2e valued conditions display their current value and can be incremented/decremented within 1 click each.
|
||||
- **SC-036**: Switching game system immediately changes the available conditions, bestiary search results, stat block layout, and initiative calculation — no page reload required.
|
||||
- **SC-037**: The game system preference survives a full page reload.
|
||||
- **SC-038**: A persistent damage entry can be added to a combatant in 3 clicks or fewer (click "+", click "Persistent Damage", select type + enter formula + confirm).
|
||||
- **SC-039**: Persistent damage tags are visually distinguishable from conditions by their icon + formula format.
|
||||
|
||||
Reference in New Issue
Block a user