2.9 KiB
2.9 KiB
Issue #102: Healing and Recovery Tracking System
Summary
Implement a healing and recovery system for the Shadowrun 5e character sheet. This adds healing actions to the damage monitor, implements Shadowrun 5e healing rules (natural and magical healing with different timescales for stun vs physical), healing test dice rolls, recovery state tracking, and overflow/death threshold warnings.
Acceptance Criteria Checklist
- Healing action button on damage monitor
- Stun damage heals faster than physical (different intervals)
- Healing test calculates boxes healed from successes
- Recovery state tracked and displayed
- Overflow damage / death threshold warnings
Implementation Plan
Step 1: Model - HealingSystem.kt
Create /workspace/repo/sharedUI/src/commonMain/kotlin/org/shahondin1624/model/charactermodel/HealingSystem.kt:
enum class HealingType { Natural, FirstAid, Magical }enum class RecoveryState { Healthy, Injured, Critical, Stabilized, BleedingOut, Dead }data class HealingResult- holds dice pool, successes (boxes healed), damage track healedfun calculateHealingPool(healingType, body, willpower): Int- Body+Willpower for natural healingfun performHealingTest(pool): HealingResult- uses existing DiceRoll to roll, successes = boxes healedfun getHealingInterval(damageTrack, healingType): String- returns human-readable interval (Stun: 1 hour natural, Physical: 1 day natural)
Step 2: Model - Update DamageMonitor.kt
Add methods to DamageMonitor:
fun healStun(boxes: Int): DamageMonitor- reduce stun damage by N boxesfun healPhysical(boxes: Int): DamageMonitor- reduce physical damage by N boxesfun recoveryState(): RecoveryState- compute current state from damage levelsfun isOverflowing(): Boolean- true if overflow > 0fun deathThresholdWarning(): Boolean- true if overflow >= overflowMax
Step 3: UI - HealingDialog.kt
Create a dialog composable for healing actions:
- Shows healing type selector (Natural / First Aid / Magical)
- Displays the healing interval for context
- Shows the dice pool calculation
- "Roll Healing Test" button that performs the test
- Displays result: number of boxes healed
- Applies healing on confirmation
Step 4: UI - Update DamageMonitorPanel.kt
- Add a "Heal" button to each damage track (Stun and Physical)
- Display recovery state badge/chip (Healthy/Injured/Critical/Stabilized/BleedingOut)
- Add overflow/death threshold warning when overflow damage is present
- Wire healing dialog to the damage monitor update callback
Step 5: Update TestTags.kt
Add test tags for new components:
- HEALING_DIALOG, HEALING_TYPE_SELECTOR, HEALING_ROLL_BUTTON, HEALING_RESULT
- RECOVERY_STATE_BADGE, DEATH_WARNING
Step 6: Wire up in CharacterSheetPage.kt
- No changes needed - CombatContent already passes
onUpdateCharacterto DamageMonitorPanel - The DamageMonitorPanel's
onDamageChangedcallback handles updates