forked from WikiDeck/wikideck
sim-balance: Culture home-stat keyword option, critic v1.1 variant
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,8 @@ function percentile(score: number, c: number[]): number {
|
||||
return Math.floor(below + equal / 2);
|
||||
}
|
||||
|
||||
export interface PoolOptions { costThresholds?: number[]; keywords?: 'faction' | 'none'; table?: string }
|
||||
export interface PoolOptions { costThresholds?: number[]; keywords?: 'faction' | 'none'; table?: string; /** v1.1 proposal: Culture takes its home-stat keyword. */ cultureKeyword?: 'faction' | 'home' }
|
||||
const CULTURE_HOME: Record<Stat, string> = { attention: 'viral', depth: 'encyclopedic', reach: 'translated' };
|
||||
|
||||
export function loadPool(file: string, opts: PoolOptions = {}): GameCard[] {
|
||||
const raw = JSON.parse(readFileSync(file, 'utf8')).cards as RawCard[];
|
||||
@@ -40,7 +41,7 @@ export function loadPool(file: string, opts: PoolOptions = {}): GameCard[] {
|
||||
let home: Stat = HOME_TIE[0];
|
||||
for (const s of HOME_TIE) { const v = pct[s], cur = pct[home]; if (v !== null && (cur === null || v > cur)) home = s; }
|
||||
const faction = (c.category ?? c.legacyCategory ?? 'Culture') as GameCard['faction'];
|
||||
const kw = FACTION_KEYWORD[faction];
|
||||
const kw = faction === 'Culture' && opts.cultureKeyword === 'home' ? CULTURE_HOME[home] : FACTION_KEYWORD[faction];
|
||||
const keyword = cost === 1 || opts.keywords === 'none' || !kw || !(KEYWORD_IDS as readonly string[]).includes(kw) ? null : kw;
|
||||
return {
|
||||
cardId: `loaner:${c.pageId}`, pageId: c.pageId, title: c.title, faction, rarity: 'Common', cost, power: 0,
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export async function loadEngine(name: string): Promise<EngineAdapter<any, any>>
|
||||
if (process.env.SIM_STARTERS) extraDecks.push(...cp.loadStarterDecks(process.env.SIM_STARTERS));
|
||||
if (process.env.SIM_POOL) {
|
||||
const { loadPool } = cp;
|
||||
pool = loadPool(process.env.SIM_POOL, { keywords: process.env.SIM_KEYWORDS === 'none' ? 'none' : 'faction', costThresholds: process.env.SIM_COST_THRESHOLDS ? JSON.parse(process.env.SIM_COST_THRESHOLDS) : undefined });
|
||||
pool = loadPool(process.env.SIM_POOL, { keywords: process.env.SIM_KEYWORDS === 'none' ? 'none' : 'faction', costThresholds: process.env.SIM_COST_THRESHOLDS ? JSON.parse(process.env.SIM_COST_THRESHOLDS) : undefined, cultureKeyword: process.env.SIM_CULTURE_KW === 'home' ? 'home' : 'faction' });
|
||||
}
|
||||
if (pool && process.env.SIM_OWNED) extraDecks.push(...cp.ownedDecks(pool, Number(process.env.SIM_OWNED)));
|
||||
return makeGameEngine({ rulesets, pool, extraDecks });
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"v1.1-critic": { "keywordParams": {
|
||||
"rising": { "amount": 1, "cap": 2, "powerDelta": -1 },
|
||||
"viral": { "amount": 1, "cap": 2, "powerDelta": 1 },
|
||||
"encyclopedic": { "amount": 2, "powerDelta": 1 } } }
|
||||
}
|
||||
Reference in New Issue
Block a user