Skip to content

Comments

feat(import): add smart parsing for Nimble Nexus action descriptions#323

Merged
trevlar merged 7 commits intodevfrom
tc/feat/make-nimble-nexus-importer-smarter
Feb 24, 2026
Merged

feat(import): add smart parsing for Nimble Nexus action descriptions#323
trevlar merged 7 commits intodevfrom
tc/feat/make-nimble-nexus-importer-smarter

Conversation

@trevlar
Copy link
Collaborator

@trevlar trevlar commented Feb 20, 2026

Summary

  • Adds intelligent parsing of monster action descriptions from Nimble Nexus API to build proper effect trees
  • Replaces hardcoded 'bludgeoning' damage type with smart extraction from multiple text patterns
  • Creates SavingThrowNode and ConditionNode effects based on action description content
  • Extracts range/reach/cone/line/burst information from descriptions

Changes

New Files:

  • descriptionParser.ts - Parsing utilities for damage types, saving throws, conditions, and range/reach
  • descriptionParser.test.ts - Comprehensive test suite with 132 tests using real Nimble Nexus API data

Modified Files:

  • constants.ts - Added DAMAGE_TYPE_MAP, SAVE_TYPE_ABBREVIATION_MAP, and CONDITION_MAP
  • types.ts - Added ParsedSavingThrow, ParsedCondition, ParsedDamage, and ParsedRangeReach interfaces
  • NimbleNexusParser.ts - Integrated buildEffectTree() into createActionItem()

Supported Patterns

Pattern Example Result
Damage type in formula "5d8+13 Radiant" damageType: radiant
Damage type in description "fire damage" damageType: fire
Save with damage "DC 15 DEX save or 4d6 fire" SavingThrowNode + DamageNode
Save for half "DC 21 DEX save for half" halfOnSave: true
Condition on hit "On hit: [[Slowed]]" ConditionNode in on.hit
Condition on crit "On crit: Poisoned" ConditionNode in on.criticalHit
Range in description "(Range: 8)" targets.distance: 8
Cone/Line/Burst "Cone 6", "Line 10x2" template shape

Test plan

  • All 132 description parser tests pass
  • All 407 tests across the full codebase pass
  • Import various monsters from Nimble Nexus in FoundryVTT and verify effect trees
  • Test damage rolls show correct damage types
  • Test saving throw buttons appear for save-based actions
  • Test conditions apply on appropriate triggers (hit, crit, failed save)

Parse damage types, saving throws, conditions, and range/reach from action
descriptions to build proper effect trees. This replaces hardcoded damage
types with intelligent extraction from multiple text patterns.

- Add descriptionParser.ts with parsing utilities for damage types, saves,
  conditions, and range/reach extraction
- Add comprehensive test suite with 132 tests using real Nimble Nexus data
- Extend constants.ts with DAMAGE_TYPE_MAP, SAVE_TYPE_ABBREVIATION_MAP,
  and CONDITION_MAP for canonical type lookups
- Extend types.ts with ParsedSavingThrow, ParsedCondition, ParsedDamage,
  and ParsedRangeReach interfaces
- Integrate buildEffectTree into NimbleNexusParser.createActionItem
@trevlar trevlar force-pushed the tc/feat/make-nimble-nexus-importer-smarter branch from 369de19 to 6a50bc0 Compare February 20, 2026 07:38
@trevlar trevlar changed the base branch from main to dev February 20, 2026 07:52
Actor.create doesn't always apply nested prototypeToken.texture settings.
Now explicitly update the full texture object after creation to ensure
the token image matches the actor portrait.
- Monster list preview uses 100.png (100x100 thumbnail)
- Imported actor uses 400.png (400x400 higher quality)
- Simplified import logic, removed failed CORS download attempts

Note: Token images on canvas still blocked by CORS on storage bucket.
Portrait images display correctly via HTML img tags.
Copy link
Collaborator

@Fronix Fronix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trevlar

  • Import various monsters from Nimble Nexus in FoundryVTT and verify effect trees
    • Works for the most part, we are in the hands of people not writing novels in the damage sections so there are still some that fail. We could probably work a bit with nimble.nexus and ask for a foundry-mode that puts stricter rules on the creation of the monster, then we could promote those in the importer to be more "safe to work as intended".
      Another way would be if nimble nexus used foundry-type patterns.
  • Test damage rolls show correct damage types
  • Test saving throw buttons appear for save-based actions
  • Test conditions apply on appropriate triggers (hit, crit, failed save)

    Fiiiire Ball! (1/use).
    5d6.
    Aoe, Range 8, 5x5. DEX Save DC 11. On Failure: Full damage and target gains Smoldering. On Success: Half Damage.

They get imported as shared rolls instead of on fail/pass save

Image Image

Add support for parsing "On Failure:" and "On Success:" patterns in
action descriptions, which are used by creatures like Tutor, Teaching
Golem. Previously these were imported as shared rolls without proper
failedSave/passedSave context.

Changes:
- Detect "On Success: Half Damage" pattern for halfOnSave
- Detect "On Failure:" context for bracket notation conditions
- Add "target gains <condition>" pattern matching
- Add comprehensive tests for the new patterns
@trevlar trevlar merged commit 8b8552c into dev Feb 24, 2026
5 checks passed
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.

2 participants