Lavaeolous / PF1-StatBlock-Converter-Module

FoundryVTT Module to convert PF1 Statblocks into Foundry Actors (PC or NPC).
MIT License
14 stars 12 forks source link

NPC Import leads to Warnings #632

Closed nemthe closed 11 months ago

nemthe commented 1 year ago

When I tried to import this NPC (https://aonprd.com/NPCDisplay.aspx?ItemName=Cyphermage), I receive this error multiple times:

There's a formula error in item Use on actor Cypher Error: Roll.safeEval produced a non-numeric result from expression "clamped(-1)" at RollPF.safeEval (foundry.js:9432:13) at MathTerm._evaluateSync (foundry.js:11137:46) at MathTerm.evaluate (foundry.js:10233:64) at foundry.js:9319:14 at Array.map () at RollPF._evaluateSync (foundry.js:9314:29) at RollPF.evaluate (foundry.js:9256:64) at RollPF.safeRoll (roll.mjs:27:41) at ItemAction.parseFormulaicAttacks (action.mjs:584:23) at ItemAction.prepareData (action.mjs:415:12) at ItemSpellPF._prepareActions (item-pf.mjs:601:16) at ItemSpellPF.prepareData (item-pf.mjs:414:27) at ItemSpellPF._safePrepareData (foundry.js:13264:12) at ActorNPCPF.prepareEmbeddedDocuments (foundry.js:13307:11) at ActorNPCPF.prepareEmbeddedDocuments (foundry.js:16560:11) at ActorNPCPF.prepareData (foundry.js:13285:10) at ActorNPCPF.prepareData (actor-pf.mjs:354:11) at ActorNPCPF._safePrepareData (foundry.js:13264:12) at ActorNPCPF._initialize (foundry.js:13089:17) at ActorNPCPF.updateSource (commons.js:5586:12) at generateNotesSection (sbcParsers.js:4848:37) at async sbcParser.parseInput (sbcParser.js:223:25) at async sbcParser.prepareInput (sbcParser.js:63:13) at async sbcInput.js:114:17 clamped(floor((@cl - 3) / 4)), 0, 2)

If I read the Error correctly, there is an error in the calculation of the Mutliple Attack penatly. Not entirely sure if this spell is fully caused by SBC, but this seems to be the initial step that leads to the error. Now this error shows up 3 times every time any Action is modified in the character sheet.

Lavaeolous commented 1 year ago

The error lies in the Scorching Ray spell, if your remove that one and change the special ability to read "Cypher Magic (Su) ..." it should work.

Technical: Scorching Ray calculates the number of additional rays via clamped(floor((@cl - 3) / 4)), 0, 2). For some reason the CL seems to be calculated incorrectly here by sbc, as the expression results in clamped(-1, 0, 2). As -1 is outside of the clamping range, the error gets thrown.