Files
ShadowrunCharSheet/.plan/issue-102-healing-recovery.md
T

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

  1. Healing action button on damage monitor
  2. Stun damage heals faster than physical (different intervals)
  3. Healing test calculates boxes healed from successes
  4. Recovery state tracked and displayed
  5. 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 healed
  • fun calculateHealingPool(healingType, body, willpower): Int - Body+Willpower for natural healing
  • fun performHealingTest(pool): HealingResult - uses existing DiceRoll to roll, successes = boxes healed
  • fun 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 boxes
  • fun healPhysical(boxes: Int): DamageMonitor - reduce physical damage by N boxes
  • fun recoveryState(): RecoveryState - compute current state from damage levels
  • fun isOverflowing(): Boolean - true if overflow > 0
  • fun 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 onUpdateCharacter to DamageMonitorPanel
  • The DamageMonitorPanel's onDamageChanged callback handles updates