Class

RezDieRoll

RezDieRoll()

Constructor

# 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

View Source rez_die.js, line 79

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.

View Source rez_die.js, line 203

number

# count

Number of dice to roll.

View Source rez_die.js, line 143

RezDie

# die

The underlying die object.

View Source rez_die.js, line 151

boolean

# disadvantage

Enables or disables disadvantage.

When enabled, rolls twice and takes the lower result. Mutually exclusive with exploding and advantage.

View Source rez_die.js, line 219

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.

View Source rez_die.js, line 187

number

# modifier

Flat modifier added to the roll result.

View Source rez_die.js, line 167

number

# rounds

Number of rounds to roll (results are averaged).

View Source rez_die.js, line 175

number

# sides

Number of sides on each die.

View Source rez_die.js, line 159

Methods

# copy() → {RezDieRoll}

Creates a copy of this dice roll configuration.

View Source rez_die.js, line 232

A new RezDieRoll with the same settings

RezDieRoll

# desc_count() → {string}

Returns the count portion of the dice notation.

View Source rez_die.js, line 326

The count as a string, or empty if count is 0

string

# desc_mod() → {string}

Returns the modifier portion of the dice notation.

View Source rez_die.js, line 339

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").

View Source rez_die.js, line 317

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.

View Source rez_die.js, line 301

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.

View Source rez_die.js, line 247

The total of all dice plus modifier

number

# rollRound() → {number}

Performs a single round of rolling, applying advantage/disadvantage if set.

View Source rez_die.js, line 283

The result of this round

number

# rollWithAdvantage() → {number}

Rolls twice and returns the higher result.

View Source rez_die.js, line 265

The higher of two roll results

number

# rollWithDisadvange() → {number}

Rolls twice and returns the lower result.

View Source rez_die.js, line 274

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)

View Source rez_die.js, line 119