feat: More bonus (exponential) and method to list icons needed

This commit is contained in:
gauvainboiche
2026-10-08 14:20:58 +02:00
parent fc0d5e3ba4
commit a88b8f5f14
25 changed files with 977 additions and 40 deletions
+11
View File
@@ -56,6 +56,7 @@ export function createState(ctx, now = Date.now()) {
materialFactor: 1,
generators: Object.fromEntries(ctx.generators.map((g) => [g.id, 0])),
upgrades: [],
endless: {},
invest: newInvest(ctx),
chips: 0,
reliabilityLevel: 0,
@@ -107,6 +108,15 @@ function sanitizeInvest(raw, ctx, base) {
return out;
}
function sanitizeEndless(raw, ctx) {
const levels = {};
for (const line of ctx.endless) {
const level = int(raw?.[line.id], line.maxLevel);
if (level > 0) levels[line.id] = level;
}
return levels;
}
function sanitizeContracts(raw, ctx) {
const templates = new Set(ctx.rules.contracts.templates.map((t) => t.id));
const rewardTypes = new Set(ctx.rules.contracts.rewards);
@@ -186,6 +196,7 @@ export function sanitizeState(raw, ctx, now = Date.now()) {
materialFactor: num(raw.materialFactor, 1, materialMarket.minFactor, materialMarket.maxFactor),
generators,
upgrades: knownIds(raw.upgrades, ctx.upgradesById),
endless: sanitizeEndless(raw.endless, ctx),
invest: sanitizeInvest(raw.invest, ctx, base.invest),
chips: int(raw.chips, gamble.maxChips),
reliabilityLevel: int(raw.reliabilityLevel, gamble.reliability.maxLevel),