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 0–3 and comparisons like
degree >= DegreeOfSuccess.Success work.
constresult = 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 }
PF2e Degree of Success. Produced by the
vsoperator 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
--jsonCLI output andJSON.stringifyemit0–3and comparisons likedegree >= DegreeOfSuccess.Successwork.Example