Files
wikideck/shared/game/starter.ts
T
claudeandClaude Opus 5.5 0f2363199b game: v1 keywords and Portals (DESIGN cf2fceb §10), card derivation (§1, §10.1), unit/property/golden tests
- keywords.ts: viral, rising, local, encyclopedic, nostalgic, translated (v1);
  edition, obscure, wildcard (off by default); §10.3 Portals with capacity,
  allOnTopic and topicBonus hooks; isOnTopic, keywordEnabled, hiddenFrom
- ruleset.ts: §10.3 default Topic pool, keyword/portal param defaults
- starter.ts: placeholder loaners carry their faction keyword (§10.1)
- derive.ts: percentile -> fame -> cost -> power, home, trend, keyword choice
- tests: game-keywords, game-derive, game-property, game-golden (§12, todo
  until core implements the frozen §3-§7 rules)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 23:12:38 -05:00

62 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* PLACEHOLDER loaner cards and starter decks (DESIGN §2) so the engine, UI and
* sims can run before council-data's docs/game/starter-cards.json lands.
* Loaners are off-chain preview cards: not NFTs, never minted or moved.
* engine-b / council-data replace STARTER_POOL with derived cards (cards.ts).
*/
import { Rng } from './rng.ts';
import { FACTION_KEYWORD } from './keywords.ts';
import type { Faction, GameCard, Stat } from './types.ts';
type Spec = [pageId: number, title: string, faction: Faction, cost: number, home: Stat, keyword: string | null];
/** Power follows DESIGN §1.3 powerByCost [0,1,2,4,5,7,9]. pageIds outside shared/catalog.ts are unverified. */
const POWER_BY_COST = [0, 1, 2, 4, 5, 7, 9];
export const STARTER_POOL: readonly Spec[] = [
[22780, 'Octopus', 'Nature', 1, 'depth', null],
[19331, 'Moon', 'Space', 1, 'reach', 'anchor'],
[23053, 'Periodic table', 'Science', 1, 'depth', null],
[3383, 'Bronze Age', 'History', 1, 'depth', 'rally'],
[5843419, 'Chess', 'Culture', 2, 'attention', null],
[9228, 'Earth', 'Space', 2, 'reach', 'rally'],
[2008, 'Ada Lovelace', 'People', 2, 'attention', null],
[21830, 'Honey bee', 'Nature', 2, 'depth', 'anchor'],
[736, 'Albert Einstein', 'People', 3, 'reach', null],
[10979, 'Fungus', 'Nature', 3, 'depth', 'rally'],
[26903, 'Solar System', 'Space', 3, 'reach', null],
[30758, 'Roman Empire', 'History', 3, 'depth', 'anchor'],
[9649, 'Evolution', 'Science', 4, 'depth', null],
[8424, 'Jazz', 'Culture', 4, 'attention', 'rally'],
[12898, 'Marie Curie', 'People', 4, 'reach', null],
[14533, 'Silk Road', 'History', 4, 'reach', 'anchor'],
[19468, 'Mount Everest', 'Nature', 5, 'attention', null],
[22936, 'Photosynthesis', 'Science', 5, 'depth', 'rally'],
[18110, 'Leonardo da Vinci', 'People', 5, 'reach', null],
[14627, 'Ancient Egypt', 'History', 5, 'attention', 'anchor'],
[4177, 'Black hole', 'Space', 6, 'attention', null],
[25443, 'Quantum mechanics', 'Science', 6, 'depth', 'rally'],
[17867, 'Library of Alexandria', 'History', 6, 'depth', 'anchor'],
[20217, 'Music', 'Culture', 6, 'reach', null],
];
export function loanerCard(spec: Spec, copy = 0): GameCard {
const [pageId, title, faction, cost, home, spec5] = spec;
// §10.1: cost-1 cards are vanilla; a placeholder keyword marks "gets its faction's keyword".
const keyword = cost > 1 && spec5 !== null ? FACTION_KEYWORD[faction] : null;
return { cardId: `loaner:${pageId}:${copy}`, pageId, title, faction, rarity: 'Common', cost, power: POWER_BY_COST[cost], home, trend: 0, keyword, source: 'loaner' };
}
/** Every placeholder loaner card, once each (24 cards). Draft modes can sample from this. */
export function previewPool(): GameCard[] { return STARTER_POOL.map(spec => loanerCard(spec)); }
/** A deterministic 12-card loaner deck: 2 cards of each cost 1–6, chosen by `seed`. */
export function starterDeck(seed: number | string): GameCard[] {
const rng = Rng.fromSeed(`starter:${seed}`);
const deck: GameCard[] = [];
for (let cost = 1; cost <= 6; cost++) {
deck.push(...rng.shuffle(STARTER_POOL.filter(spec => spec[3] === cost)).slice(0, 2).map(spec => loanerCard(spec)));
}
return deck;
}