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

    Enumeration DegreeOfSuccess

    PF2e Degree of Success. Produced by the vs operator when comparing a roll against a Difficulty Class. Ordering is significant — natural 20 upgrades one step and natural 1 downgrades one step.

    Numeric by design: the enum members are plain numbers, so --json CLI output and JSON.stringify emit 03 and comparisons like degree >= DegreeOfSuccess.Success work.

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

    const result = roll('1d20+7 vs 15', { rng: createMockRng([12]) });
    result.degree; // DegreeOfSuccess.Success (2)
    result.natural; // 12 — the raw d20 face, used for the ±1 step
    result.rendered; // '1d20[12] + 7 vs 15 = Success'

    if (result.degree != null && result.degree >= DegreeOfSuccess.Success) {
    // hit
    }
    Index
    CriticalFailure: 0
    CriticalSuccess: 3
    Failure: 1
    Success: 2