feat: Making the game harder to 'beat'

This commit is contained in:
gauvainboiche
2026-10-08 17:17:21 +02:00
parent 2f7c307f0e
commit 8b15c76b14
20 changed files with 637 additions and 91 deletions
+20 -4
View File
@@ -5,11 +5,27 @@
import { modifiersFor } from './modifiers.js';
import { createState, META_KEYS } from './state.js';
/** Points a restart would grant right now (0 until the run is big enough). */
/**
* How many points a lifetime production deserves in total. Diminishing returns
* (a power below 1) on EVERYTHING ever produced, not on a single run: each
* further point needs far more production than the last, so restarting more and
* more often cannot snowball.
*/
export function pointsFor(lifetimeProduced, ctx, mods) {
const { threshold, exponent } = ctx.rules.legacy;
if (!(lifetimeProduced >= threshold)) return 0;
return Math.floor((lifetimeProduced / threshold) ** exponent * mods.legacyGain);
}
/** Lifetime production at which the next point is earned (ignoring bonuses to point gains). */
export function nextPointAt(state, ctx) {
const { threshold, exponent } = ctx.rules.legacy;
return threshold * (state.legacy.earned + 1) ** (1 / exponent);
}
/** Points a restart would grant right now (0 until the next point is within reach). */
export function legacyGain(state, ctx, mods) {
const { threshold } = ctx.rules.legacy;
if (state.totalProduced < threshold) return 0;
return Math.floor(Math.sqrt(state.totalProduced / threshold) * mods.legacyGain);
return Math.max(0, pointsFor(state.lifetimeProduced, ctx, mods) - state.legacy.earned);
}
export function perkLevel(state, perk) {