43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# 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.
|