feat: More bonus (exponential) and method to list icons needed
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user