gizgame/progression
3-Layer Meta-Progression & Buildcraft Synergy Engine: declarative perks, deterministic 3-choice upgrade drafting, tag-driven synergy activation, and aggregated combat/movement stat multipliers.
import * as Progression from "gizgame/progression";Types
Perk
type Perk = { id: string; name: string; rarity: string; tags: Vec<string>; maxRank: i64; damagePct: f64; speedPct: f64; hpBonus: i64; critPct: f64; cooldownPct: f64; }A collectible perk, relic, or upgrade node.
id:stringname:stringrarity:stringtags:Vec<string>maxRank:i64damagePct:f64speedPct:f64hpBonus:i64critPct:f64cooldownPct:f64
SynergyRule
type SynergyRule = { id: string; name: string; requires: Vec<string>; damageBonusPct: f64; critBonusPct: f64; }A synergy unlocked when a build holds all required tags.
id:stringname:stringrequires:Vec<string>damageBonusPct:f64critBonusPct:f64
BuildStats
type BuildStats = { damageMult: f64; speedMult: f64; hpBonus: i64; critChance: f64; cooldownMult: f64; activeSynergies: Vec<string>; }Aggregated multipliers computed from all owned perks and active synergies.
damageMult:f64speedMult:f64hpBonus:i64critChance:f64cooldownMult:f64activeSynergies:Vec<string>
BuildState
class BuildState { ranks: Map<string, i64> = new Map<string, i64>(); level: i64 = 1; xp: i64 = 0; rankOf(id: string): i64 { return this.ranks.get(id) ?? 0; } pick(perk: Perk): bool { const cur = this.rankOf(perk.id); if (cur> = perk.maxRank) { return false; } this.ranks.set(perk.id, cur + 1); return true; } rollChoices(pool: Vec<Perk>, seed: i64, count: i64 = 3): Vec<Perk> { let eligible: Vec<Perk> = []; for (const p of pool) { if (this.rankOf(p.id) <p.maxRank) { eligible.push(p); } } if (eligible.length <= count) { return eligible; } let out: Vec<Perk> = []; let used: Vec<i64> = []; let state = seed <0 ? -seed: seed; while (out.length <count && used.length <eligible.length) { state = (state * 1103515245 + 12345) % 2147483647; const idx = state % eligible.length; if (!used.includes(idx)) { used.push(idx); out.push(eligible[idx]); } } return out; } evaluate(pool: Vec<Perk>, synergies: Vec<SynergyRule>): BuildStats { let dmg = 1.0; let spd = 1.0; let hp: i64 = 0; let crit = 0.05; let cd = 1.0; let tags: Vec<string> = []; for (const p of pool) { const r = this.rankOf(p.id); if (r <= 0) { continue; } dmg + = p.damagePct * f64(r); spd + = p.speedPct * f64(r); hp + = p.hpBonus * r; crit + = p.critPct * f64(r); cd - = p.cooldownPct * f64(r); for (const t of p.tags) { if (!tags.includes(t)) { tags.push(t); } } } let active: Vec<string> = []; for (const syn of synergies) { let ok = syn.requires.length> 0; for (const req of syn.requires) { if (!tags.includes(req)) { ok = false; break; } } if (ok) { active.push(syn.id); dmg + = syn.damageBonusPct; crit + = syn.critBonusPct; } } return { damageMult: Math.max(0.1, dmg), speedMult: Math.max(0.2, spd), hpBonus: hp, critChance: Math.max(0.0, Math.min(1.0, crit)), cooldownMult: Math.max(0.25, cd), activeSynergies: active }; } }Player's current run or meta build state.
ranks:_gizlang_sdk_collections.Map<string, i64>level:i64xp:i64
Methods
BuildState.rankOf
rankOf(id: string): i64Returns current rank of perk ID (0 if not owned).
Effects: fail, read.
BuildState.pick
pick(perk: Perk): boolPicks a perk if below maxRank; returns true on upgrade.
Effects: fail, read, write, alloc.
BuildState.rollChoices
rollChoices(pool: Vec<Perk>, seed: i64, count: i64 = 3): Vec<Perk>Deterministically drafts up to COUNT eligible perks not yet at maxRank.
Effects: fail, read, alloc.
BuildState.evaluate
evaluate(pool: Vec<Perk>, synergies: Vec<SynergyRule>): BuildStatsComputes total stat multipliers and activated tag synergies across all owned perks.
Effects: fail, read, alloc.