Skip to content

@dice-roller/rpg-dice-roller / ast / DieNode

Interface: DieNode ​

Defined in: src/ast/nodes.ts:67

The die of a pool: a reference to a die factory in the DieRegistry, and its arguments.

The evaluator evaluates the argument expressions, then calls registry.create(name, ...args). Registering a replacement for standard changes what d6 rolls in that registry. Computed sides (d(2+3)) are expressions too. Custom factory names can be constructed with die(); their displayed notation is not necessarily parseable.

  • d6: { name: "standard", args: [6] }
  • d(2+3): { name: "standard", args: [(2+3)] }
  • d%: { name: "percentile", args: [] }
  • dF / dF.1 / dF.2: { name: "fudge", args: [] } / [1] / [2]

Properties ​

args ​

readonly args: readonly ExpressionNode[]

Defined in: src/ast/nodes.ts:71


name ​

readonly name: string

Defined in: src/ast/nodes.ts:70

The registered name: a BuiltInDieName, or the name of a user-registered die.


type ​

readonly type: "die"

Defined in: src/ast/nodes.ts:68

MIT Licensed · Credits