teroparvinen / foundry-wire

10 stars 4 forks source link

wire doesn't seem to like using dice from a classes scale value #59

Closed Sillsoft42 closed 11 months ago

Sillsoft42 commented 12 months ago

It looks like when you try and use something like "@scale.monk.die" which access a monk's martial arts dice, wire causes the roll to fail with an error like Uncaught (in promise) Error: Roll.safeEval produced an invalid result from expression ""1"d4""" If I disable wire, the problem goes away

Sillsoft42 commented 12 months ago

Okay, I think I see the issue. The scale value of the monks martial arts dice (at least in the SRD version that comes with the system) does not list a number so when used in damage formulas, its written as 1@scale.monk.die and for some reason wire get confused by it and triggers that error. Without the module, things work fine.

teroparvinen commented 12 months ago

I found the issue and came up with a potential fix.

Background: WIRE has an extension to the roll formula system that allows doing stuff like and(@originator.isDefender, eq(@attacker.details.type.value, "undead")) for the Chill Touch spell which gives the target disadvantage on attacks against the original caster if it's undead. This is a bit tricky currently, so I need to add a special case. Foundry V12 is due to make a revision to the whole technical subsystem which will probably make these kinds of issues irrelevant in the future.