0.0.13 • Published 1 year ago

dnd5e-dice-roller v0.0.13

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

dnd5e-dice-roller

npm Version Build NPM License size

Generate dice rolls based on standard ttrpg dice string.

For example:s

  • 1d4 - 1 roll of a 4 sided dice. Returns a result between 1 and 4
  • d6 - 1 roll of a 6 sided dice. Returns a result between 1 and 6
  • 3d8 - 3 rolls of an 8 sided dice. Returns a result between 3 and 24
  • 1d6+2 - 1 roll of a 6 sided dice, plus 2. Returns a result between 3 and 8
  • 1d4-1 - 1 roll of a 4 sided dice, minus 1. Returns a result between 0 and 3
  • 4d6dl1 - 4 rolls of a 6 sided dice, dropping the lowest. Returns a result between 3 and 18
  • 2d20dh1 - 2 rolls of a 20 sided dice, dropping the lowest. (i.e. Rolling with disadvantage)
  • 2d20d1+3 - 2 rolls of a 20 sided dice, dropping the lowest, plus 3. (i.e. Rolling with advantage with a modifier)

Usage

Default export returns the total and the the rolls of each die

import diceRoller  from 'dnd5e-dice-roller';

diceRoller("2d8+3"); // Returns { total: 17, rolls: [8, 6], rollStr: "2d8+3"  }

Named exports of diceRoller (behaves the same as the default) and roll to just return the total

import { diceRoller, roll }  from 'dnd5e-dice-roller';

diceRoller("2d8+3"); // Returns { total: 17, rolls: [8, 6], rollStr: "2d8+3"  }
roll("2d8+3"); // Returns 17
0.0.12

1 year ago

0.0.13

1 year ago

0.0.10

2 years ago

0.0.11

1 year ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago