Skip to content

@dice-roller/rpg-dice-roller / modifiers / uniqueHandler

Variable: uniqueHandler ​

const uniqueHandler: ModifierHandler<UniqueNode>

Defined in: src/modifiers/handlers/unique.ts:23

u, uo and numeric limits: re-roll rolls whose value an earlier roll already has (optionally only those matching the compare point), replacing the value (the initial value is kept). The first roll is never re-rolled.

u repeats while the current value is a matching duplicate (up to its optional limit or ctx.limits.maxIterations per roll, default 1000, flag unique); uo re-rolls once (flag unique-once). Both can leave duplicates: a per-die limit can be reached, a replacement can fall outside the compare point, or the per-pool generated-roll budget can be spent. At the pool budget, the current value is kept and later items pass through unchanged.

Throws ​

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

MIT Licensed · Credits