Files
ShadowrunCharSheet/.plan/issue-92-spells-adept-powers.md
T

3.6 KiB

Plan: Issue #92 - Spells and Adept Powers System

Summary

Implement a complete spells and adept powers tracking system for Shadowrun 5e characters, including data models for spells (with type, range, duration, drain) and adept powers (with power point cost), UI panels for adding/removing/viewing both, drain value display per spell, power point budget for adepts based on Magic attribute, and full serialization support. This follows existing patterns from the Augmentation system (model + panel + edit dialog + string resources + test tags + migration).

Acceptance Criteria Checklist

  1. Data model for spells with type (Combat/Detection/Health/Illusion/Manipulation), range, duration, and drain
  2. Data model for adept powers with power point cost
  3. UI to add/remove/view spells and adept powers
  4. Drain value displayed per spell
  5. Power point budget shown for Adepts (based on Magic attribute)
  6. Serialization support for spell/power data

Implementation Steps

Step 1: Add Magic attribute to Attributes

  • Add magic field to Attributes data class (default 0, meaning mundane)
  • Add Magic to AttributeType enum
  • Update getAttributeByType, getAllAttributes, withAttribute to handle Magic
  • Update MetatypeAttributeLimits if needed

Step 2: Create Spell data model

  • New file: model/magic/Spell.kt
  • SpellType enum: Combat, Detection, Health, Illusion, Manipulation
  • SpellRange enum: Touch, LineOfSight, Area (or similar SR5e ranges)
  • SpellDuration enum: Instant, Sustained, Permanent
  • Spell data class: name, type, range, duration, drain, description, sustained (boolean for tracking)
  • All classes @Serializable

Step 3: Create Adept Power data model

  • New file: model/magic/AdeptPower.kt
  • AdeptPower data class: name, powerPointCost (Float), description
  • @Serializable

Step 4: Add spells and adept powers to ShadowrunCharacter

  • Add spells: List<Spell> = emptyList() field
  • Add adeptPowers: List<AdeptPower> = emptyList() field
  • Add helper functions: totalPowerPointsUsed(), powerPointBudget() (= magic attribute value)
  • Add activeSustainedSpells() count for penalty tracking

Step 5: Create SpellPanel UI

  • New file: lib/components/charactermodel/SpellPanel.kt
  • Follow AugmentationPanel pattern: Card with list, add/edit/remove buttons
  • Show spell name, type, range, duration, drain value per spell
  • SpellEditDialog for add/edit with dropdowns for type, range, duration, drain input

Step 6: Create AdeptPowerPanel UI

  • New file: lib/components/charactermodel/AdeptPowerPanel.kt
  • Show power point budget: "X / Y PP" (used / available from Magic)
  • List adept powers with name, cost, description
  • AdeptPowerEditDialog for add/edit

Step 7: Add new tab "Magic" to CharacterSheetPage

  • Add Magic to CharacterTab enum
  • Create MagicContent composable that shows SpellPanel and AdeptPowerPanel
  • Wire up onUpdateCharacter callbacks

Step 8: Add string resources

  • Add all new UI strings to strings.xml following existing patterns

Step 9: Add TestTags

  • Add spell panel, adept power panel, and dialog test tags to TestTags.kt

Step 10: Schema migration v0.2 -> v0.3

  • Create MigrationV02ToV03.kt adding empty spells/adeptPowers lists and magic=0
  • Update SchemaVersion.CURRENT to "v0.3"
  • Register migration in MigrationRegistry
  • Update MigrationV01ToV02 to add missing fields for forward compatibility

Step 11: Update Defaults

  • Update EXAMPLE_CHARACTER and createNewCharacter to include new fields (they get defaults from data class)
  • Add magic attribute to EXAMPLE_ATTRIBUTES and DEFAULT_ATTRIBUTES