RedReign / FoundryVTT-BetterRolls5e

A module for modifying certain sheet functions on Foundry VTT Character sheets for D&D 5th Edition.
GNU General Public License v3.0
36 stars 67 forks source link

Critical damage doesn't work when there are [descriptions] on non-dice terms #346

Closed cs96and closed 2 years ago

cs96and commented 2 years ago

Foundry: 0.8.9 dnd5e: 1.5.5 BetterRolls: 1.6.16

If a damage formula contains a description on a non-dice term e.g. 1d8 + @mod + 2[dueling], or 1d8 + @mod[dex] + 2, then Better Rolls produces an error when it tries to roll critical damage...

Uncaught (in promise) Error: Unresolved StringTerm 1d8  [dueling] requested for evaluation
[Detected 1 package: betterrolls5e]
    at StringTerm.evaluate (foundry.js:7896)
    at Roll._evaluateSync (foundry.js:5523)
    at Roll.evaluate (foundry.js:5454)
    at Roll.roll (foundry.js:5554)
    at Function.getCritRoll (utils.js:643)
    at Function.constructDamageRoll (fields.js:279)
    at Function.constructItemDamageRange (fields.js:380)
    at Function.constructModelsFromField (fields.js:446)
    at CustomItemRoll._processField (custom-roll.js:975)
    at async CustomItemRoll.roll (custom-roll.js:700)
    at async CustomItemRoll.toMessage (custom-roll.js:823)
    at async CustomItemRoll.repeat (custom-roll.js:901)
    at async BetterRollsChatCard._performAction (chat-message.js:350)
    at async HTMLDivElement.<anonymous> (chat-message.js:328)

If you put the description on a dice term, e.g. 1d8[piercing] + @mod + 2, then it works OK.

CarlosFdez commented 2 years ago

Should be fixed in v1.7.1