Skip to content

[E-PF2E-1] Core roll and degrees of success #966

@alxjrvs

Description

@alxjrvs

Part of #942

Phase 1: Core roll and degrees of success

Updated 2026-03-24: Game packages now use .randsum.json specs + codegen, not standalone TypeScript packages. See existing games in packages/games/ for the pattern.

Scope

Implement the PF2e core roll mechanic: 1d20 + modifier vs DC, with full degrees of success including the natural 1/20 shift rule.

Acceptance Criteria

  • pf2e.randsum.json spec in packages/games/ expressing 1d20 + modifier vs DC
  • Codegen produces src/pf2e.generated.ts — accessible via import { roll } from '@randsum/games/pf2e'
  • DegreeOfSuccess result values: CRITICAL_SUCCESS, SUCCESS, FAILURE, CRITICAL_FAILURE
  • Degree calculation: beat DC by 10+ -> Critical Success; meet or beat -> Success; miss by 1-9 -> Failure; miss by 10+ -> Critical Failure
  • Natural 20 shifts degree up one (clamped at Critical Success)
  • Natural 1 shifts degree down one (clamped at Critical Failure)
  • Edge cases: nat 20 on already-Critical-Success (no-op), nat 1 on Critical-Failure (no-op), nat 1 overriding a DC+10 beat (resolves to Success)
  • Result includes human-readable description alongside degree value
  • Spec validated against boundary test cases: exactly DC, DC+-9, DC+-10

Mechanics Reference

  • Beat DC by 10+: Critical Success
  • Meet or beat DC: Success
  • Miss DC by 1-9: Failure
  • Miss DC by 10+: Critical Failure
  • Natural 20: shift result one step up
  • Natural 1: shift result one step down
  • Shifts are clamped

Out of Scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgame-packageA game-specific dice packagephaseA phase within an epic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions