Salvage Union

@randsum/salvageunion

Salvage Union mechanics for mech-based tabletop RPG gameplay.

Overview

@randsum/salvageunion provides mechanics for Salvage Union, a mech-based tabletop RPG. This package includes mech combat rolls, salvage mechanics, and all the core systems needed to run Salvage Union games.

Installation

Installation

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

Examples

Basic Roll

import { rollTable } from "@randsum/salvageunion"
import type { SalvageUnionTableResult } from "@randsum/salvageunion"

// Basic roll with default table
const result = rollTable()
// Returns table result with hit type, label, description, and roll value

Roll with Specific Table

import { rollTable } from "@randsum/salvageunion"

// Roll with specific table
const result = rollTable("Morale")

Type-Safe Result Handling

import { rollTable } from "@randsum/salvageunion"

const { hit, label, description, roll } = rollTable("Core Mechanic")
switch (hit) {
  case "Nailed It":
    // 20
    break
  case "Success":
    // 11-19
    break
  case "Tough Choice":
    // 6-10
    break
}