Powered by the Apocalypse

@randsum/pbta ...

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

Overview

@randsum/pbta provides generic support for Powered by the Apocalypse (PbtA) game mechanics. This package works for any PbtA game including Dungeon World, Monster of the Week, Apocalypse World, Masks, and many others.

Installation

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
})