Skip to content

@dice-roller/rpg-dice-roller / modifiers / ModifierInput

Interface: ModifierInput<N> โ€‹

Defined in: src/modifiers/types.ts:21

Context and modifier node supplied to a handler alongside its items.

Type Parameters โ€‹

N โ€‹

N extends ModifierNode = ModifierNode

Properties โ€‹

ctx โ€‹

readonly ctx: RollContext

Defined in: src/modifiers/types.ts:28

Roll mode, random generator, and safety limits for this evaluation.


die? โ€‹

readonly optional die?: ResolvedDie

Defined in: src/modifiers/types.ts:35

The pool's die (pools only).


evaluateExpression? โ€‹

readonly optional evaluateExpression?: (node, bindings) => Generator<EvaluationDrawRequest, ExpressionResult, number>

Defined in: src/modifiers/types.ts:30

Evaluates an expression in an immutable child scope of the current context.

Parameters โ€‹

node โ€‹

ExpressionNode

bindings โ€‹

Readonly<Record<string, unknown>>

Returns โ€‹

Generator<EvaluationDrawRequest, ExpressionResult, number>


modifier โ€‹

readonly modifier: N

Defined in: src/modifiers/types.ts:26

The modifier node from the AST for numeric quantities; computed Keep/Drop quantities arrive as a temporary numeric view while their original expressions remain on the source AST and result.


rollBatch? โ€‹

readonly optional rollBatch?: (count) => Generator<EvaluationDrawRequest, readonly DieResult[] | undefined, number>

Defined in: src/modifiers/types.ts:43

Rolls a complete batch atomically, or returns undefined without drawing if the remaining per-pool budget is insufficient.

Parameters โ€‹

count โ€‹

number

Returns โ€‹

Generator<EvaluationDrawRequest, readonly DieResult[] | undefined, number>


rollDie? โ€‹

readonly optional rollDie?: () => Generator<EvaluationDrawRequest, DieResult | undefined, number>

Defined in: src/modifiers/types.ts:37

Rolls one more die of the pool, or returns undefined when its per-pool budget is spent. Initial dice are excluded; repeating handlers must handle exhaustion and keep the results rolled so far.

Returns โ€‹

Generator<EvaluationDrawRequest, DieResult | undefined, number>

MIT Licensed ยท Credits