Constructor
# new RezDie()
Represents a single die with a configurable number of sides.
Provides basic rolling functionality including standard rolls and "open" (exploding) rolls where rolling the maximum value causes a re-roll that adds to the total.
Examples
const d6 = new RezDie(6);
const result = d6.roll(); // Returns 1-6
// Open roll - if you roll max, roll again and add
const d6 = new RezDie(6);
const result = d6.open_roll(); // Could return 7+ if 6 was rolled
Members
Methods
# open_roll() → {number}
Performs an "open" or "exploding" roll.
If the maximum value is rolled, the die is rolled again and the results are summed. This continues until a non-maximum value is rolled.
The total of all rolls
number
Example
// On a d6, rolling 6, 6, 3 would return 15
# static constructor(sidesopt)
Creates a new die.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
sides |
number
|
<optional> |
6 | The number of sides on the die |