3.6 KiB
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
- Data model for spells with type (Combat/Detection/Health/Illusion/Manipulation), range, duration, and drain
- Data model for adept powers with power point cost
- UI to add/remove/view spells and adept powers
- Drain value displayed per spell
- Power point budget shown for Adepts (based on Magic attribute)
- Serialization support for spell/power data
Implementation Steps
Step 1: Add Magic attribute to Attributes
- Add
magicfield toAttributesdata class (default 0, meaning mundane) - Add
MagictoAttributeTypeenum - Update
getAttributeByType,getAllAttributes,withAttributeto handle Magic - Update
MetatypeAttributeLimitsif needed
Step 2: Create Spell data model
- New file:
model/magic/Spell.kt SpellTypeenum: Combat, Detection, Health, Illusion, ManipulationSpellRangeenum: Touch, LineOfSight, Area (or similar SR5e ranges)SpellDurationenum: Instant, Sustained, PermanentSpelldata 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 AdeptPowerdata 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
MagictoCharacterTabenum - Create
MagicContentcomposable 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.ktadding 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