DicePool

DicePool

A dice pool represents a set of Roll expressions which are collectively modified to compute an effective total across all Rolls in the pool. The final total for the pool is defined as the sum over kept rolls, relative to any success count or margin.

Constructor

new DicePool()

Source:
Examples
// Consider 3 rolls
let r1 = new Roll("4d6");
let r2 = new Roll("3d8");
let r3 = new Roll("2d10");
// Keep the highest of the 3 roll expressions
let pool = new DicePool([r1,r2,r3], "kh");
// Construct a DicePool from a string formula
let pool = DicePool.fromFormula("{4d6,3d8,2d10}kh");

Members

dice :Array

Source:

An Array of rolled Die instances created through this Pool

Type:

modifiers :string

Source:

The string modifiers applied to resolve the pool

Type:
  • string

rolls :Array.<Roll>

Source:

The elements of a Dice Pool must be Roll objects

Type:

total :number|null

Source:

The final numeric total resulting from the rolled DicePool

Type:
  • number | null

Methods

(static) fromData(data) → {DicePool}

Source:

Reconstruct a DicePool instance from a provided data Object

Parameters:
Name Type Description
data Object

The provided data

Returns:

The constructed Dice Pool

Type
DicePool

(static) fromFormula(formula) → {DicePool|null}

Source:

Given a string formula, create and return an evaluated DicePool object

Parameters:
Name Type Description
formula string

The string formula to parse

Returns:

The evaluated DicePool object or null if the formula is invalid

Type
DicePool | null

(static) fromJSON(json) → {DicePool}

Source:

Reconstruct a DicePool instance from a provided data Object

Parameters:
Name Type Description
json string

The serialized JSON string

Returns:

The constructed Dice Pool

Type
DicePool

roll()

Source:

For now, for testing purposes, choose the maximum result always

toJSON() → {Object}

Source:

Convert the DicePool instance into an Object which can be serialized to JSON

Returns:

The converted data

Type
Object