Skip to content

@dice-roller/rpg-dice-roller / modifiers / explodeHandler

Variable: explodeHandler ​

const explodeHandler: ModifierHandler<ExplodeNode>

Defined in: src/modifiers/handlers/explode.ts:30

!, !!, !p, !!p: rolls another die whenever a roll matches the compare point (the die's max by default), up to the modifier limit or ctx.limits.maxIterations times per initial die (default 1000 generations). :amount generates that many children per match, visited depth-first. At the per-die generation limit the last extra roll is retained even if it matches. If the per-pool generated-roll budget is spent, pending branches stop and only dice that actually generated children are flagged as triggers.

  • compound (!!): adds the extra rolls to the original roll (flags explode and compound)
  • penetrate (p): subtracts 1 from each extra roll (flag penetrate); whether it explodes again is checked before subtracting
  • otherwise each extra roll is a new die result, after the roll that exploded (flag explode)

Throws ​

the pool die or rollDie is missing, or the die can only roll one value, even if no roll matches

MIT Licensed · Credits