Powered by the Apocalypse

@randsum/pbta ...

Generic PbtA mechanics for Dungeon World, Monster of the Week, Apocalypse World, Masks, and more.

Installation

npm install @randsum/pbta
# or
bun add @randsum/pbta

Examples

Basic Roll

import { roll } from "@randsum/pbta"

// Basic roll with stat modifier
const result = roll({ stat: 2 })
// result.result: 'strong_hit' | 'weak_hit' | 'miss'

With Bonuses

import { roll } from "@randsum/pbta"

// With forward and ongoing bonuses
const result = roll({
  stat: 1,
  forward: 1,  // One-time bonus
  ongoing: 0   // Persistent bonus
})

With Advantage

import { roll } from "@randsum/pbta"

// Roll with advantage (3d6, keep 2 highest)
const result = roll({
  stat: 2,
  advantage: true
})

Installation

npm install @randsum/pbta
# or
bun add @randsum/pbta

About Powered by the Apocalypse

The @randsum/pbta package provides generic mechanics for Powered by the Apocalypse (PbtA) games, a family of tabletop RPGs that share core mechanics.

Standard PbtA roll mechanics:

  • Roll 2d6 + stat modifier
  • 10+ = strong hit (complete success)
  • 7-9 = weak hit (partial success, success with cost)
  • 6- = miss (failure)

This package supports advantage/disadvantage (roll 3d6, keep 2), and bonuses (forward/ongoing).

For more information, see the package source code .