Multiple reroll directives are not handled correctly?
Opened this issue · 0 comments
propri commented
> const { DiceRoller } = require('dice-roller-parser')
undefined
> roller = new DiceRoller()
{ randFunction: [Function: random], maxRollCount: 1000 }
> roller.roll('1d4r1r4')
{
count: { type: 'number', value: 1, success: false, valid: true, order: 0 },
die: { type: 'number', value: 4, success: false, valid: true, order: 0 },
rolls: [
{
critical: 'success',
die: 4,
matched: false,
order: 0,
roll: 4,
success: false,
type: 'roll',
valid: false,
value: 4
},
{
critical: 'success',
die: 4,
matched: false,
order: 1,
roll: 4,
success: false,
type: 'roll',
valid: false,
value: 4
},
{
critical: 'failure',
die: 4,
matched: false,
order: 2,
roll: 1,
success: false,
type: 'roll',
valid: true,
value: 1
}
],
success: false,
type: 'die',
valid: true,
value: 1,
order: 0,
matched: false
}
With multiple rerolls in the formula, only the last one seems to be respected.
See the example, 1d4r1r4 -> 4 is rerolled, but 1 is used as last value.
The same forumla works on roll20: