From 1a1e5d167c3e289ded7db66bee840b47af7ec41c Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 14 Dec 2022 22:20:15 -0600 Subject: [PATCH] Make joy and faith buy maxable --- src/data/layers/elves.tsx | 9 +++++++-- src/data/layers/management.tsx | 7 +++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/data/layers/elves.tsx b/src/data/layers/elves.tsx index 4b386f9..66ab1df 100644 --- a/src/data/layers/elves.tsx +++ b/src/data/layers/elves.tsx @@ -584,6 +584,7 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase?: VoidFunction; // Will get overriden by the custom onpurchase, but that's fine canBuy?: Computable; buyMax?: Computable; + independent?: Computable; // Whether or not the cost is independent of the current buyable amount } & Partial ) { const buyProgress = persistent(0); @@ -594,6 +595,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const isActive = convertComputable(options.canBuy ?? true); const buyMax = convertComputable(options.buyMax ?? false); + const independent = convertComputable(options.independent ?? false); function update(diff: number) { if (upgrade.bought.value && unref(isActive)) { @@ -615,7 +617,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const buyAmount = Decimal.min( Decimal.sub( buyable.inverseCost(buyable.resource?.value), - buyable.amount.value + unref(independent) ? 0 : buyable.amount.value ).add(1), maxBuyAmount ); @@ -747,6 +749,7 @@ const layer = createLayer(id, function (this: BaseLayer) { "Joy will automatically purchase small fires you can afford, without actually spending any logs. You can toggle whether or not to enable the purchased small fires automatically. Small fires will start giving a boost to ash and coal gain.", buyable: coal.buildFire, cooldownModifier: smallFireCooldown, + buyMax: () => management.elfTraining.heatedCutterElfTraining.milestones[2].earned.value, visibility: () => showIf(boxes.upgrades.logsUpgrade.bought.value), hasToggle: true, toggleDesc: "Activate auto-purchased small fires", @@ -765,6 +768,7 @@ const layer = createLayer(id, function (this: BaseLayer) { "Faith will automatically purchase bonfires you can afford. You can toggle whether or not to enable the purchased bonfires automatically. Bonfires will start giving a boost to ash and coal gain.", buyable: coal.buildBonfire, cooldownModifier: bonfireCooldown, + buyMax: () => management.elfTraining.heatedPlanterElfTraining.milestones[2].earned.value, visibility: () => showIf(boxes.upgrades.ashUpgrade.bought.value), hasToggle: true, toggleDesc: "Activate auto-purchased bonfires", @@ -779,7 +783,8 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase() { main.days[4].recentlyUpdated.value = true; }, - canBuy: coal.unlockBonfire.bought + canBuy: coal.unlockBonfire.bought, + independent: true }); const kilnElf = createElf({ name: "Snowball", diff --git a/src/data/layers/management.tsx b/src/data/layers/management.tsx index b5af6e4..feb73b9 100644 --- a/src/data/layers/management.tsx +++ b/src/data/layers/management.tsx @@ -415,8 +415,7 @@ const layer = createLayer(id, () => { createMilestone(() => ({ display: { requirement: "Hope Level 3", - effectDisplay: - "The workshop can be expanded past 100%, but costs scale faster. It also buys max now." + effectDisplay: "The workshop can be expanded past 100%, but costs scale faster." }, visibility: () => showIf(expanderElfMilestones[1].earned.value), shouldEarn: () => expandersElfTraining.level.value >= 3 @@ -457,7 +456,7 @@ const layer = createLayer(id, () => { createMilestone(() => ({ display: { requirement: "Jack Level 3", - effectDisplay: "Jack now buys max." + effectDisplay: "Jack and Joy now buy max." }, visibility: () => showIf(heatedCutterElfMilestones[1].earned.value), shouldEarn: () => heatedCutterElfTraining.level.value >= 3 @@ -504,7 +503,7 @@ const layer = createLayer(id, () => { createMilestone(() => ({ display: { requirement: "Mary Level 3", - effectDisplay: "Mary now buys max." + effectDisplay: "Mary and Faith now buy max." }, visibility: () => showIf(heatedPlanterElfMilestones[1].earned.value), shouldEarn: () => heatedPlanterElfTraining.level.value >= 3