From 5d3860c63be69ca4f2669b2d2ff058052b2f516a Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 24 Dec 2022 20:56:09 -0600 Subject: [PATCH] Fix NaN after buying loaders --- src/data/layers/packing.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/data/layers/packing.tsx b/src/data/layers/packing.tsx index 278db8c..4bbf995 100644 --- a/src/data/layers/packing.tsx +++ b/src/data/layers/packing.tsx @@ -249,9 +249,14 @@ const layer = createLayer(id, function (this: BaseLayer) { ); }, onPurchase() { - metal.metal.value = Decimal.sub(metal.metal.value, this.metalCost.value); - oil.oil.value = Decimal.sub(oil.oil.value, this.oilCost.value); - this.amount.value = Decimal.add(this.amount.value, 1); + const metalCost = Decimal.pow(1.2, Decimal.sub(helpers.loader.amount.value, 1)).times( + 1e70 + ); + const oilCost = Decimal.pow(1.2, Decimal.sub(helpers.loader.amount.value, 1)).times( + 1e25 + ); + metal.metal.value = Decimal.sub(metal.metal.value, metalCost); + oil.oil.value = Decimal.sub(oil.oil.value, oilCost); }, inverseCost() { const metalAmount = Decimal.div(metal.metal.value, 1e70).log(1.2);