fvtt-fria-ligan / forbidden-lands-foundry-vtt

This is a Forbidden Lands game System for the Foundry Virtual Tabletop. Made by @Perfectro, @patrys and @aMediocreDad. Maintained by @aMediocreDad
https://foundryvtt.com/packages/forbidden-lands/
Other
40 stars 43 forks source link

Item Gear Bonuses buggy #409

Closed bblonski closed 2 months ago

bblonski commented 4 months ago

Describe the bug

I've noticed 2 different bugs around roll modifiers from gear/talents. When I have a talent like swordfighter and I level it up to give a +1 and a +d8, I modify the Roll Modifier to match. However if I set the dice code to 1+d8, I'll only the d8 is applied when selecting it from modifiers in the roll dialogue. The +1 is missing from the modifiers section, and has to be entered manually. However, if I change the code to d8+1, it properly applies the d8 and +1 to the roll modifiers.

The second issue is if you enter a dice code (e.g. d8) into the roll modifier, but the check "Use Gear Bonus", you'll see d8 code as the modifier in the roll dialog, and if you try to roll with it selected, you'll get an error like the following.

Uncaught (in promise) Error: Invalid roll formula: 3db[Wits] + 2ds[Lore] + NaNdg[Maidenshard] + 1d8[Gear]
    at FBLRoll.forge (forbidden-lands.js:17:40697)
    at _FBLRollHandler.executeRoll (forbidden-lands.js:17:35837)
    at _FBLRollHandler._handleYZRoll (forbidden-lands.js:17:33542)
    at _FBLRollHandler._updateObject (forbidden-lands.js:17:31866)
    at _FBLRollHandler._onSubmit (foundry.js:6626:18)

I assume it's hiding the d8 instead of deleting it, then when it comes time for the roll, the formula is getting confused on what the gear dice should be.

Reproduction

Bug 1

Bug 2

System Info

OS: Linux Host, Windows Client
Client: Chrome
Foundry Version: 11 build 315
Forbidden Lands Version: 11.5.0

Logs

No response

Validations

aMediocreDad commented 3 months ago

Bug 1. Is simply using it incorrectly. The modifier field does not handle arbitrary expressions. The correct way of going about it is to add two separate roll modifiers +1 and 1d8.

Bug 2. Is definitely something that needs to be looked into.