Fix exhancers sell issue

This commit is contained in:
thepaperpilot 2023-04-02 22:23:14 -05:00
parent a646a30412
commit b5910cd542

View file

@ -214,8 +214,7 @@ const layer = createLayer(id, () => {
}));
const upgrades = [generatorUpgrade, lollipopMultiplierUpgrade, unlockIlluminatiUpgrade];
const exhancers = createRepeatable(() => ({
requirements: createCostRequirement(() => ({
const exhancersCost = createCostRequirement(() => ({
resource: noPersist(points),
cost() {
let x = new Decimal(exhancers.amount.value);
@ -230,7 +229,9 @@ const layer = createLayer(id, () => {
spentOnBuyables.value = Decimal.add(spentOnBuyables.value, cost ?? 0);
this.resource.value = Decimal.sub(this.resource.value, cost).max(0);
}
})),
}));
const exhancers = createRepeatable(() => ({
requirements: exhancersCost,
display() {
return {
title: "Exhancers",
@ -280,7 +281,7 @@ const layer = createLayer(id, () => {
return;
}
exhancers.amount.value = Decimal.sub(exhancers.amount.value, 1);
const cost = (exhancers.requirements.cost as Ref<DecimalSource>).value;
const cost = (exhancersCost.cost as Ref<DecimalSource>).value;
points.value = Decimal.add(points.value, cost);
spentOnBuyables.value = Decimal.sub(spentOnBuyables.value, cost);
}