Add hardcap to workshop

This commit is contained in:
thepaperpilot 2022-12-15 00:53:40 -06:00
parent 36f78951b5
commit f81c469373
2 changed files with 16 additions and 6 deletions

View file

@ -8,6 +8,7 @@ import { main } from "data/projEntry";
import { createBar } from "features/bars/bar";
import { createClickable } from "features/clickables/clickable";
import {
addHardcap,
addSoftcap,
createIndependentConversion,
createPolynomialScaling
@ -42,10 +43,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
const foundationProgress = createResource<DecimalSource>(0, "foundation progress");
const foundationConversion = createIndependentConversion(() => ({
scaling: addSoftcap(
addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1 / 1e10),
1e20,
3e8
scaling: addHardcap(
addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1 / 1e10), 1e20, 3e8),
computed(() =>
management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100
)
),
baseResource: trees.logs,
gainResource: noPersist(foundationProgress),

View file

@ -8,9 +8,9 @@ import {
} from "features/feature";
import { BaseLayer, createLayer, GenericLayer, layers } from "game/layers";
import { persistent } from "game/persistence";
import type { PlayerData } from "game/player";
import type { LayerData, PlayerData } from "game/player";
import player from "game/player";
import { format, formatTime } from "util/bignum";
import Decimal, { format, formatTime } from "util/bignum";
import { Computable, convertComputable, ProcessedComputable } from "util/computed";
import { createLazyProxy } from "util/proxies";
import { renderRow, VueFeature } from "util/vue";
@ -469,6 +469,14 @@ export function fixOldSave(
if (!["0.0", "0.1", "0.2", "0.3", "0.4"].includes(oldVersion ?? "")) {
return;
}
if ((player.layers?.workshop as LayerData<typeof workshop> | undefined)?.foundationProgress) {
(player.layers?.workshop as LayerData<typeof workshop> | undefined)!.foundationProgress =
Decimal.min(
(player.layers!.workshop as LayerData<typeof workshop> | undefined)!
.foundationProgress!,
1000
);
}
/*player.offlineProd = false;
delete player.layers?.management;
if ((player.layers?.main as LayerData<typeof main> | undefined)?.days?.[11]) {