roll-parser - v3.4.0
    Preparing search index...

    Type Alias DieResult

    One physical die and everything the evaluator learned about it.

    The same object is shared between RollResult.rolls and the rolls[] of the RollPart that produced it — there is no deep clone, so mutating a die is visible through both views.

    import { roll } from 'roll-parser';
    import { createMockRng } from 'roll-parser/testing';

    const result = roll('4d6kh3', { rng: createMockRng([3, 6, 2, 5]) });
    result.rolls[1];
    // { sides: 6, result: 6, modifiers: ['kept'], critical: true, fumble: false }
    result.rolls[2];
    // { sides: 6, result: 2, modifiers: ['dropped'], critical: false, fumble: false }
    type DieResult = {
        critical: boolean;
        fumble: boolean;
        initialResult?: number;
        modifiers: DieModifier[];
        result: number;
        sides: number;
    }
    Index
    critical: boolean

    True if the die met its critical criteria — by default, rolling the maximum face on a die with more than one side. That default never fires on d1 or on Fate dice (sides = 0 has no maximum face), but an explicit cs threshold does: 4dFcs>0 flags every +1.

    fumble: boolean

    True if the die met its fumble criteria — by default, rolling a 1 on a die with more than one side. As with DieResult.critical, the default never fires on d1 or Fate dice, while an explicit cf threshold does: 4dFcf=-1 flags every -1.

    initialResult?: number

    Raw first roll before any mutation — compound-explode accumulation, the !p decrement, or a minN/maxN clamp. Only populated when result has been overwritten with a computed value. Consumers that need the original face (nat-20 / nat-1 detection) should read initialResult ?? result.

    modifiers: DieModifier[]

    Modifiers applied to this die

    result: number

    The rolled value

    sides: number

    Number of sides on the die. Normal dice use sides >= 1. Fate/Fudge dice use sides = 0 as a sentinel — they have no configurable sides and always produce results in {-1, 0, +1}.