Skip to content

@dice-roller/rpg-dice-roller / dice

dice ​

Die definitions, presets, and registries for extending dice notation.

Classes ​

ClassDescription
DieRegistryDie factories by name.

Interfaces ​

InterfaceDescription
DieBehaviourOptional behaviour a die can provide, instead of the default helpers.
DieOptionsOptional settings for a preset die.
DieSnapshotThe JSON-safe values of a die, stored in results.
FacesDieDefinitionA die with a non-empty list of finite faces, e.g. dF ([-1, 0, 1]). Repeats act as weights.
RangeDieDefinitionA die defined by its inclusive bounds, e.g. d6 or d%.
ResolvedDieA die with every value resolved to a plain number, and a roll() that always exists.

Type Aliases ​

Type AliasDescription
DieDefinitionThe minimum data that defines a die.
DieFactoryCreates a die from the evaluated arguments of a DieNode, e.g. standard(6) for d6.
FudgeNonBlanksThe conventional number of faces each non-blank symbol (-, +) covers on a fudge die.
NumberOrGetterA number, or a function that returns one.

Variables ​

VariableDescription
percentileDied%: a 100-sided die, displayed as d%. Registered in the DieRegistry as percentile.

Functions ​

FunctionDescription
faceDieA die with a list of faces, e.g. faceDie([1, 1, 2, 3, 5, 8]).
fudgeDieA fudge / fate die. Registered in the DieRegistry as fudge.
rangeDieA die with every integer from min to max, e.g. rangeDie(-2, 3).
standardDieA die numbered from 1 to sides, e.g. standardDie(6) for d6.

References ​

DieLike ​

Re-exports DieLike

MIT Licensed · Credits