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