Skip to content

Type Alias: RollSpec ​

ts
type RollSpec = DiceGroup & object;

Defined in: src/dice.ts:174

What to roll: the dice, the bonus, and the rules. A roll of one kind of die is { count, sides, modifier, keep } and whichever optional fields it uses. A roll of several kinds keeps its first kind there and the others in more, so a one-kind spec is the same object it always was.

Type Declaration ​

modifier ​

ts
modifier: number;

Added to the total, as in 1d20+5.

more? ​

ts
optional more?: DiceGroup[];

The other kinds of dice in the roll, in order. Left out when there is one kind.

times? ​

ts
optional times?: number;

How many times rollMany throws the roll, as a set: 6 for 6#4d6dl1. Left out when it is once. roll throws it once whatever this says.

math? ​

ts
optional math?: MathNode;

How the kinds' totals are put together, when that is not simply adding them: (2d6+3)*2, 1d20-1d4, floor(4d6/2). It names each kind of dice once, by its place. With a formula the bonus is part of it, and modifier is 0. Left out of a roll whose kinds are added.

label? ​

ts
optional label?: string;

What the roll is for, in a few words: "fire damage". Text, only ever shown as text. 2d6 # fire damage in notation. Left out when there is none.

MIT © John Morris