feat(games): add the generic d6 oracle game package
Serves as the reference implementation of the game package contract: rules, spark tables, character backgrounds, and an example command.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { parseTable, rollTable } from '@solo/oracle';
|
||||
|
||||
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
/** Roll a starting background from characters/backgrounds.csv. */
|
||||
function background() {
|
||||
const file = path.join(HERE, 'characters', 'backgrounds.csv');
|
||||
const entries = parseTable(fs.readFileSync(file, 'utf8'));
|
||||
const { roll, entry } = rollTable(entries);
|
||||
const tags = entry.tags.length ? ` [${entry.tags.join(', ')}]` : '';
|
||||
console.log(`background roll ${roll} → "${entry.text}"${tags}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* A game package's default export is its manifest. See docs/games.md.
|
||||
*/
|
||||
export default {
|
||||
id: 'generic',
|
||||
title: 'Generic d6 Oracle',
|
||||
description: 'System-agnostic solo play driven by the d6 oracle and spark tables.',
|
||||
rules: 'game.md',
|
||||
commands: {
|
||||
background: {
|
||||
description: 'Roll a starting character background.',
|
||||
run: background,
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user