/** * Exploding dice modifier implementations. * * Standard (`!`): re-roll on match, append each new die to the pool. * Compound (`!!`): re-roll on match, accumulate into the original die's `result`. * Penetrating (`!p`): re-roll on match, append with `result = rawRoll - 1`. * * @module evaluator/modifiers/explode */ import type { RNG } from '../../rng/types.js'; import type { CompareOp, DieResult } from '../../types.js'; import { type EvalEnv } from '../env.js'; /** * Default value of `EvaluationOptions.maxExplodeIterations`: how many times a * single die may explode before `EXPLODE_LIMIT_EXCEEDED` is thrown. * * Per die, not per pool — it bounds notations like `1d1!`, where the * explosion condition can never stop being true. * * @category Limits */ export declare const DEFAULT_MAX_EXPLODE_ITERATIONS = 1000; /** * Predicate deciding whether a die with the given latest raw roll continues * to explode. `sides` is passed separately because the default predicate * ("explode on max face") uses `result === sides`. */ export type ShouldExplode = (rawResult: number, sides: number) => boolean; /** * Builds an explosion predicate from an optional ComparePoint. When no * threshold is given, explode when the raw result equals the die's max face. */ export declare function buildShouldExplode(operator: CompareOp | undefined, thresholdValue: number | undefined): ShouldExplode; /** * Standard explode: append each new die to the pool. The original die keeps * its modifiers untouched; new dice carry `['exploded', 'kept']`. */ export declare function applyStandardExplode(pool: DieResult[], shouldExplode: ShouldExplode, rng: RNG, env: EvalEnv): DieResult[]; /** * Compound explode: pool length stays the same. Each original die's `result` * accumulates every explosion roll, and gains the `'exploded'` modifier once * it actually exploded at least once. * * Mutates exploded dice in place — the same `DieResult` objects are shared * between `RollResult.rolls` and the `RollPart` tree, and both must reflect * post-explosion state. */ export declare function applyCompoundExplode(pool: DieResult[], shouldExplode: ShouldExplode, rng: RNG, env: EvalEnv): DieResult[]; /** * Penetrating explode: like standard, but each appended die stores * `result = rawRoll - 1`. The explosion predicate runs on the RAW roll * (pre-decrement), so a max face still chains even though its stored value * is one lower. */ export declare function applyPenetratingExplode(pool: DieResult[], shouldExplode: ShouldExplode, rng: RNG, env: EvalEnv): DieResult[]; //# sourceMappingURL=explode.d.ts.map