A flexible, type-safe dice roller for the Root RPG system
npm install @randsum/root-rpg





A small collection of utilities for Root RPG!
- đ˛ Standard Root RPG (2d6+N) rolls
- đ¯ Automatic handling of modifiers
- đ Full TypeScript support
- đĒļ smol (not larger than a wolf)
``bash`
npm install @randsum/root-rpgor
yarn add @randsum/root-rpgor
bun add @randsum/root-rpg
`typescript
import { rollRootRpg } from "@randsum/root-rpg"
import type { RootRpgRollResult } from "@randsum/root-rpg"
// Basic roll with modifier
const { outcome, roll, result } = rollRootRpg(2)
// outcome: 'Strong Hit' | 'Weak Hit' | 'Miss'
// roll: numeric total, result: detailed roll information
// Type-safe result handling
const { outcome } = rollRootRpg(0)
switch (outcome) {
case "Strong Hit":
// 10 or higher
break
case "Weak Hit":
// 7-9
break
case "Miss":
// 6 or lower
break
}
`
Makes a 2d6 roll following Root RPG rules, returning an object with the interpreted result and numeric details.
`typescript`
function rollRootRpg(bonus: number): RootRpgRollResult
`typescript``
type RootResult = RootStrongHit | RootWeakHit | RootMiss
type RootStrongHit = "Strong Hit"
type RootWeakHit = "Weak Hit"
type RootMiss = "Miss"
- @randsum/roller: Core dice rolling implementation