Implement the 014-inline-hp-delta feature that replaces the damage/heal mode toggle with explicit action buttons and Enter-to-damage keyboard shortcut

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-05 23:52:03 +01:00
parent 97d3918cef
commit 56bced8481
8 changed files with 521 additions and 49 deletions

View File

@@ -0,0 +1,42 @@
# Data Model: Inline HP Delta Input
## No data model changes
This feature does not modify any domain entities, events, or state transitions. The existing data model fully supports the new UI:
### Existing Entities (unchanged)
**Combatant**
- `id`: CombatantId (branded string)
- `name`: string
- `initiative?`: number
- `maxHp?`: number
- `currentHp?`: number
**Encounter**
- `combatants`: readonly Combatant[]
- `activeIndex`: number
- `roundNumber`: number
### Existing Domain Function (unchanged)
**adjustHp(encounter, combatantId, delta) -> AdjustHpSuccess | DomainError**
- Negative delta = damage, positive delta = heal
- Clamps result to [0, maxHp]
- Emits `CurrentHpAdjusted` event
### Existing Domain Event (unchanged)
**CurrentHpAdjusted**
- `combatantId`: CombatantId
- `previousHp`: number
- `newHp`: number
- `delta`: number
### UI State Changes
The only state change is in the QuickHpInput component:
- **Removed**: `mode: "damage" | "heal"` state variable
- **Kept**: `value: string` state variable for the input field
The action (damage vs heal) is now determined at invocation time by which button/key triggered it, not by a stored mode.