Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple reroll directives are not handled correctly? #5

Open
propri opened this issue Feb 21, 2021 · 0 comments
Open

Multiple reroll directives are not handled correctly? #5

propri opened this issue Feb 21, 2021 · 0 comments

Comments

@propri
Copy link

propri commented Feb 21, 2021

> 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:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant