Skip to content

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

results ​

Result types and helpers for inspecting evaluated expressions.

Interfaces ​

InterfaceDescription
BinaryResultA binary operation and its evaluated operands.
DieResultA single die roll in a pool.
FunctionResultA maths function and its evaluated arguments.
GroupMemberResultOne expression of a roll group, with scoring separate from its nested expression result.
GroupResultA group of evaluated members after its modifiers have been applied.
NumberResultThe result of a numeric literal.
ParenResultA parenthesised expression and its evaluated inner result.
PoolResultA pool's evaluated quantity, die arguments, die snapshot and modified rolls.
ScoredItemA die roll or group member that modifier handlers can transform using the result helpers.
UnaryResultA unary operation and its evaluated operand.

Type Aliases ​

Type AliasDescription
ExpressionResultTypeThe type of every expression result.
RESULT_FLAGSSemantic flags recording what happened to a die or group member.
ResultFlagA semantic marker on a scored die or group member, interpreted by presenters.

Functions ​

FunctionDescription
createDieResultA fresh included die result with no flags: value, initialValue and calculationValue all equal value.
excludeFromTotalReturns a copy excluded from the total (useInTotal: false); does not add a drop flag.
withCalculationValueReturns a copy with a new calculationValue, keeping value.
withFlagsReturns a copy with flags deduplicated in first-occurrence order; does not change scoring.
withValueReturns a copy with a new value and calculationValue; preserves a die's initialValue.

References ​

ExpressionResult ​

Re-exports ExpressionResult

MIT Licensed · Credits