# new RezDieRoll()
Represents a dice roll configuration with multiple dice, modifiers, and special rules.
Supports:
- Multiple dice of the same type (e.g., 3d6)
- Numeric modifiers (e.g., 2d6+3)
- Exploding dice (re-roll and add on max)
- Advantage (roll twice, take higher)
- Disadvantage (roll twice, take lower)
- Multiple rounds with averaging
Examples
// Roll 2d6+3
const roll = new RezDieRoll(2, 6, 3);
const result = roll.roll();
// Roll with advantage
const roll = new RezDieRoll(1, 20, 0);
roll.advantage = true;
const result = roll.roll(); // Rolls twice, takes higher
Members
boolean
# advantage
Enables or disables advantage.
When enabled, rolls twice and takes the higher result. Mutually exclusive with exploding and disadvantage.
boolean
# disadvantage
Enables or disables disadvantage.
When enabled, rolls twice and takes the lower result. Mutually exclusive with exploding and advantage.
boolean
# exploding
Enables or disables exploding dice.
When enabled, rolling the maximum value causes a re-roll that adds to the total. Mutually exclusive with advantage and disadvantage.
Methods
# copy() → {RezDieRoll}
Creates a copy of this dice roll configuration.
A new RezDieRoll with the same settings
# desc_count() → {string}
Returns the count portion of the dice notation.
The count as a string, or empty if count is 0
string
# desc_mod() → {string}
Returns the modifier portion of the dice notation.
The modifier with sign (e.g., "+3" or "-2"), or empty if 0
string
# description() → {string}
Returns a string description of this dice roll (e.g., "2d6+3").
The dice notation string
string
# roll() → {number}
Performs the complete roll.
If multiple rounds are configured, rolls each round and returns the ceiling average of all rounds.
The final roll result
number
# rollDice() → {number}
Rolls all dice once and returns the sum plus modifier.
If exploding is enabled, uses open rolls for each die.
The total of all dice plus modifier
number
# rollRound() → {number}
Performs a single round of rolling, applying advantage/disadvantage if set.
The result of this round
number
# rollWithAdvantage() → {number}
Rolls twice and returns the higher result.
The higher of two roll results
number
# rollWithDisadvange() → {number}
Rolls twice and returns the lower result.
The lower of two roll results
number
# static constructor(count, sidesopt, modifieropt, roundsopt)
Creates a new dice roll configuration.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
count |
number
|
Number of dice to roll |
||
sides |
number
|
<optional> |
6 | Number of sides per die |
modifier |
number
|
<optional> |
0 | Flat modifier to add to the result |
rounds |
number
|
<optional> |
1 | Number of rounds to roll (results are averaged) |