Skip to content

Comments

Fix spell upcasting bugs and add scaling editor#324

Open
Fronix wants to merge 7 commits intodevfrom
issue-321-problems-with-the-spell-upcasting
Open

Fix spell upcasting bugs and add scaling editor#324
Fronix wants to merge 7 commits intodevfrom
issue-321-problems-with-the-spell-upcasting

Conversation

@Fronix
Copy link
Collaborator

@Fronix Fronix commented Feb 20, 2026

Summary

Closes #321

  • Mana slider bugs: Safe property access prevents the 100-mana slider (Pyroclasm) and 0-mana minimum (Fiery Embrace). NPCs without mana no longer crash the dialog.
  • Tier fallback fix: Null/undefined highestUnlockedSpellTier now defaults to 9 instead of 0.
  • Separate upcast & higher level effects: New upcastEffect field separates upcast descriptions (extra mana spent) from higherLevelEffect (character-level scaling). Both display independently in the description editor, summary, chat card, and tooltip when populated.
  • World migration: Moves higherLevelEffect to upcastEffect on world load, but only for spells with upcast scaling configured. Spells without upcast scaling keep their higher level effect untouched.
  • Spell scaling editor: Visual CRUD editor for scaling mode, deltas, and choice groups. Target effect uses a dropdown from activation effects with a text fallback for new spells.
  • JSON editor fallback: Toggle between visual editor and raw JSON editing of the full spell config.
  • i18n: All editor strings use translation keys.

Test plan

  • Open Pyroclasm (tier 4) on a character with < 100 mana — slider should cap at available mana
  • Open Fiery Embrace (tier 5) — slider minimum should be 5, never 0
  • Open upcast dialog as an NPC — should not crash
  • Tier 1+ spell with upcast scaling — "Upcast Effect" tab appears in description editor
  • Cantrip — only "Base Effect" and "Higher Level Effect" tabs, no "Upcast Effect"
  • Tier 1+ spell — "Upcast" section shows in summary, chat card, and tooltip
  • Add content to both fields on a tier 1+ spell — both sections display independently
  • World migration only migrates spells with upcast/upcastChoice scaling mode (check console logs)
  • Spells with scaling.mode = 'none' keep higherLevelEffect untouched after migration
  • Scaling editor: add/edit/remove deltas and choices
  • Target effect dropdown populates from activation effects; text fallback with tooltip on new spells
  • JSON editor toggle works and shows full system data
  • Run existing tests: npx vitest run

🤖 PR description generated with Claude Code

@Fronix Fronix changed the base branch from main to dev February 20, 2026 10:04
@Fronix Fronix requested a review from trevlar February 20, 2026 10:05
@Fronix Fronix self-assigned this Feb 20, 2026
…e existing data

- Introduced upcastEffect field in spell JSON files to separate upcasting effects from higher level effects.
- Updated spell descriptions across various spells to include the new upcastEffect field.
- Created migration script to transfer existing higherLevelEffect data to upcastEffect for tier > 0 spells.
- Enhanced UI components to display upcast effects in spell cards and summary tabs.
- Updated localization files to include labels for upcast effects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems with the Spell Upcasting Dialog

1 participant