Class

RezDie

RezDie()

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.

View Source rez_die.js, line 5

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

number

# sides

The number of sides on this die.

View Source rez_die.js, line 41

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.

View Source rez_die.js, line 65

The total of all rolls

number
Example
// On a d6, rolling 6, 6, 3 would return 15

# roll() → {number}

Rolls the die once.

View Source rez_die.js, line 50

A random value between 1 and the number of sides

number

# static constructor(sidesopt)

Creates a new die.

Parameters:
Name Type Attributes Default Description
sides number <optional>
6

The number of sides on the die

View Source rez_die.js, line 26