From 2432d2242aecf73584c41175d79b1f9d68221d0d Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:04:40 -0800 Subject: [PATCH 01/27] start day 17 --- src/data/layers/toys.tsx | 871 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 871 insertions(+) create mode 100644 src/data/layers/toys.tsx diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx new file mode 100644 index 0000000..81d5805 --- /dev/null +++ b/src/data/layers/toys.tsx @@ -0,0 +1,871 @@ +/** + * @module + * @hidden + */ +import Spacer from "components/layout/Spacer.vue"; +import Modal from "components/Modal.vue"; +import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; +import { main } from "data/projEntry"; +import { createBar } from "features/bars/bar"; +import { createBuyable, GenericBuyable } from "features/buyable"; +import { createClickable } from "features/clickables/clickable"; +import { jsx, showIf } from "features/feature"; +import { createHotkey } from "features/hotkey"; +import MainDisplay from "features/resources/MainDisplay.vue"; +import { createResource, Resource } from "features/resources/resource"; +import { createUpgrade } from "features/upgrades/upgrade"; +import { globalBus } from "game/events"; +import { BaseLayer, createLayer } from "game/layers"; +import { + createAdditiveModifier, + createExponentialModifier, + createMultiplicativeModifier, + createSequentialModifier, + Modifier +} from "game/modifiers"; +import { noPersist, persistent } from "game/persistence"; +import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum"; +import { Direction, WithRequired } from "util/common"; +import { render, renderGrid, renderRow } from "util/vue"; +import { computed, ref } from "vue"; +import boxes from "./boxes"; +import cloth from "./cloth"; +import coal from "./coal"; +import dyes from "./dyes"; +import elves, { ElfBuyable } from "./elves"; +import management from "./management"; +import paper from "./paper"; +import workshop from "./workshop"; +import wrappingPaper from "./wrapping-paper"; +const id = "toys"; +const day = 17; + +// how much to prioritize this' income +// vs the previous ones +const SMOOTHING_FACTOR = 0.1; +const layer = createLayer(id, function (this: BaseLayer) { + const name = "Toys"; + const colorBright = "#4BDC13"; + const colorDark = "green"; + + const logs = createResource(0, "logs"); + // Think of saplings as spent trees + const saplings = createResource(0, "saplings"); + + const ema = ref(0); + + const lastAutoCuttingAmount = ref(0); + const lastAutoPlantedAmount = ref(0); + + const totalTrees = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: () => Decimal.times(expandingForestBuyable.amount.value, 10), + description: "Expand Forest", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 2), + description: "75% Foundation Completed", + enabled: workshop.milestones.morePlantsMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "5 Elves Trained", + enabled: elves.milestones[4].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "8 Elves Trained", + enabled: elves.milestones[7].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Boots", + enabled: cloth.treesUpgrades.treesUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: dyes.boosts.blue1, + description: "Blue Dye Boost 1", + enabled: () => Decimal.gte(dyes.dyes.blue.amount.value, 1) + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.pow(computedManualCuttingAmount.value, 0.99), + description: "Hope Level 1", + enabled: management.elfTraining.expandersElfTraining.milestones[0].earned + })) + ]) as WithRequired; + const trees = createResource( + computed(() => Decimal.sub(totalTrees.apply(10), saplings.value)), + "trees" + ); + const computedTotalTrees = computed(() => totalTrees.apply(10)); + + const manualCutUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 10, + display: { + title: "Wooden Fingers", + description: "Cut down an additional tree per click" + } + })); + const manualPlantUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 10, + display: { + title: "Leafy Fingers", + description: "Plant an additional tree per click" + } + })); + const autoCutUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 25, + display: { + title: "Automated Knives", + description: "Cut down a tree every second" + } + })); + const autoPlantUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 25, + display: { + title: "Automated Spade", + description: "Plant a tree every second" + } + })); + const researchUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 40, + display: { + title: "Research I", + description: "Trees give 25% more logs, and unlock more upgrades" + } + })); + const row1Upgrades = [ + manualCutUpgrade1, + manualPlantUpgrade1, + autoCutUpgrade1, + autoPlantUpgrade1, + researchUpgrade1 + ]; + + const manualCutUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 50, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Sharper Fingers", + description: "Manually cut trees twice as often" + } + })); + const manualPlantUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 50, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Greener Fingers", + description: "Manually Plant trees twice as often" + } + })); + const manualCutUpgrade3 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 150, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Smart Knives", + description: + "Each time you manually chop trees, gain 1s of automatic tree chopping production" + } + })); + const manualPlantUpgrade3 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 150, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Smart Spades", + description: + "Each time you manually plant trees, gain 1s of automatic tree planting production" + } + })); + const researchUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 300, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Research II", + description: "Trees give 25% more logs, and unlock repeatable purchases" + } + })); + const row2Upgrades = [ + manualCutUpgrade2, + manualPlantUpgrade2, + manualCutUpgrade3, + manualPlantUpgrade3, + researchUpgrade2 + ]; + + const autoCuttingBuyable1 = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); + if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); + if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); + if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); + v = Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value).times(v); + return Decimal.times(100, v).add(200); + }, + inverseCost(x: DecimalSource) { + let v = Decimal.sub(x, 200).div(100); + v = v.div(Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value)); + if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); + if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); + if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); + if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Generic Cutters", + description: "Each cutter cuts down 1 tree/s" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const autoPlantingBuyable1 = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); + if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); + if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); + if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); + v = Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value).times(v); + let cost = Decimal.times(100, v).add(200); + if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { + cost = Decimal.div(cost, 10); + } + return cost; + }, + inverseCost(x: DecimalSource) { + if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { + x = Decimal.mul(x, 10); + } + let v = Decimal.sub(x, 200).div(100); + v = v.div(Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value)); + if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); + if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); + if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); + if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Generic Planters", + description: "Each planter plants 0.5 trees/s" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const expandingForestBuyable = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 100)) v = Decimal.pow(v, 2).div(100); + if (Decimal.gte(v, 1e5)) v = Decimal.pow(v, 2).div(1e5); + if (Decimal.gte(v, 1e15)) v = Decimal.pow(v, 10).div(1e135); + v = Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value).times(v); + return Decimal.pow(Decimal.add(v, 1), 1.5).times(500); + }, + inverseCost(x: DecimalSource) { + let v = Decimal.div(x, 500).root(1.5).sub(1); + v = v.div(Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value)); + if (Decimal.gte(v, 1e15)) v = Decimal.mul(v, 1e135).root(10); + if (Decimal.gte(v, 1e5)) v = Decimal.mul(v, 1e5).root(2); + if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Expand Forest", + description: "Add 10 trees to the forest" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const row1Buyables = [autoCuttingBuyable1, autoPlantingBuyable1, expandingForestBuyable]; + + const manualCuttingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Wooden Fingers", + enabled: manualCutUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: computedAutoCuttingAmount, + description: "Smart Knives", + enabled: manualCutUpgrade3.bought + })) + ]); + const computedManualCuttingAmount = computed(() => manualCuttingAmount.apply(1)); + const manualCuttingCooldown = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 0.5, + description: "Sharper Fingers", + enabled: manualCutUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(0.5, elves.totalElves.value), + description: "1 Elf Trained", + enabled: elves.milestones[0].earned + })) + ]); + const computedManualCuttingCooldown = computed(() => manualCuttingCooldown.apply(1)); + + const autoCuttingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Automated Knives", + enabled: autoCutUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: autoCuttingBuyable1.amount, + description: "Generic Cutters", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 5).floor(), + description: "10% Foundation Completed", + enabled: workshop.milestones.autoCutMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "30% Foundation Completed", + enabled: workshop.milestones.autoCutMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Warmer Cutters", + enabled: coal.warmerCutters.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedHeatedCutterEffect, + description: "Heated Cutters", + enabled: () => Decimal.gt(coal.heatedCutters.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Jeans", + enabled: cloth.treesUpgrades.treesUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(1.1, main.day.value), + description: "Holly Level 4", + enabled: management.elfTraining.cutterElfTraining.milestones[3].earned + })), + createAdditiveModifier(() => ({ + addend: () => + Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0), + description: "Ivy Level 5", + enabled: management.elfTraining.planterElfTraining.milestones[4].earned + })) + ]) as WithRequired; + const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); + + const manualPlantingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Leafy Fingers", + enabled: manualPlantUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: computedAutoPlantingAmount, + description: "Smart Spades", + enabled: manualPlantUpgrade3.bought + })) + ]); + const computedManualPlantingAmount = computed(() => manualPlantingAmount.apply(1)); + const manualPlantingCooldown = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 0.5, + description: "Greener Fingers", + enabled: manualPlantUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(0.5, elves.totalElves.value), + description: "1 Elf Trained", + enabled: elves.milestones[0].earned + })) + ]); + const computedManualPlantingCooldown = computed(() => manualPlantingCooldown.apply(1)); + + const autoPlantingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Automated Spade", + enabled: autoPlantUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(autoPlantingBuyable1.amount.value, 2), + description: "Generic Planters", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 10).floor(), + description: "20% Foundation Completed", + enabled: workshop.milestones.autoPlantMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "40% Foundation Completed", + enabled: workshop.milestones.autoPlantMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Warmer Planters", + enabled: coal.warmerPlanters.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedHeatedPlanterEffect, + description: "Heated Planters", + enabled: () => Decimal.gt(coal.heatedPlanters.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Plaid", + enabled: cloth.treesUpgrades.treesUpgrade3.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Ivy Level 1", + enabled: management.elfTraining.planterElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(trees.value, 0.2).max(1).log10().pow_base(2), + description: "Ivy Level 3", + enabled: management.elfTraining.planterElfTraining.milestones[2].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Mary Level 4", + enabled: management.elfTraining.heatedPlanterElfTraining.milestones[3].earned + })), + createAdditiveModifier(() => ({ + addend: () => + Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0), + description: "Ivy Level 5", + enabled: management.elfTraining.planterElfTraining.milestones[4].earned + })) + ]) as WithRequired; + const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); + + const logGain = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Research I", + enabled: researchUpgrade1.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Research II", + enabled: researchUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => + workshop.milestones.extraExpansionMilestone1.earned.value + ? Decimal.pow(1.02, workshop.foundationProgress.value) + : Decimal.div(workshop.foundationProgress.value, 20).add(1), + description: "1% Foundation Completed", + enabled: workshop.milestones.logGainMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "50% Foundation Completed", + enabled: workshop.milestones.logGainMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Ashy Soil", + enabled: coal.basicFertilizer.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedFertilizerEffect, + description: "Fertilized Soil", + enabled: () => Decimal.gt(coal.moreFertilizer.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "4 Elves Trained", + enabled: elves.milestones[3].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Carry logs in boxes", + enabled: boxes.upgrades.logsUpgrade.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.div(boxes.buyables.logBoxesBuyable.amount.value, 2).add(1), + description: "Carry more logs", + enabled: boxes.upgrades.logsUpgrade.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 10, + description: "Felt-Gripped Axe", + enabled: cloth.treesUpgrades.treesUpgrade4.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: computed(() => + Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1) + ), + description: "Is Blue Dye just Water?", + enabled: dyes.upgrades.blueDyeUpg.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(9)), + description: "Holly Level 1", + enabled: management.elfTraining.cutterElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.sqrt(management.totalElfLevels.value), + description: "Noel Level 1", + enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: wrappingPaper.boosts.christmas1, + description: "Christmas Wrapping Paper", + enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) + })), + createExponentialModifier(() => ({ + exponent: 1.2, + description: "100% Foundation Completed", + enabled: workshop.milestones.logGainMilestone3.earned + })), + createExponentialModifier(() => ({ + exponent: 1.05, + description: "Un-Processing", + enabled: paper.upgrades2.treeUpgrade.bought + })) + ]); + + const manualCutProgress = persistent(0); + const manualCutProgressBar = createBar(() => ({ + direction: Direction.Right, + width: 100, + height: 10, + style: "margin-top: 8px", + baseStyle: "margin-top: -1px", + fillStyle: "margin-top: -1px; transition-duration: 0s", + progress: () => Decimal.div(manualCutProgress.value, computedManualCuttingCooldown.value) + })); + + const cutTree = createClickable(() => ({ + display: { + title: "Cut trees", + description: jsx(() => ( + <> + Cut down up to {formatWhole(Decimal.floor(computedManualCuttingAmount.value))}{" "} + tree + {Decimal.eq(computedManualCuttingAmount.value, 1) ? "" : "s"} at once! +
+ {render(manualCutProgressBar)} + + )) + }, + style: { + minHeight: "80px" + }, + canClick: () => + Decimal.gte(trees.value, 1) && + Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value), + onClick() { + if (Decimal.lt(manualCutProgress.value, computedManualCuttingCooldown.value)) { + return; + } + const amount = Decimal.floor( + Decimal.min( + trees.value, + Decimal.times( + computedManualCuttingAmount.value, + Decimal.div( + manualCutProgress.value, + computedManualCuttingCooldown.value + ).floor() + ) + ) + ); + logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount)); + saplings.value = Decimal.add(saplings.value, amount); + manualCutProgress.value = 0; + } + })); + + const manualPlantProgress = persistent(0); + const manualPlantProgressBar = createBar(() => ({ + direction: Direction.Right, + width: 100, + height: 10, + style: "margin-top: 8px", + baseStyle: "margin-top: -1px", + fillStyle: "margin-top: -1px; transition-duration: 0s", + progress: () => Decimal.div(manualPlantProgress.value, computedManualPlantingCooldown.value) + })); + const plantTree = createClickable(() => ({ + display: { + title: "Plant trees", + description: jsx(() => ( + <> + Plant up to {formatWhole(Decimal.floor(computedManualPlantingAmount.value))}{" "} + tree + {Decimal.eq(computedManualPlantingAmount.value, 1) ? "" : "s"} at once! +
+ {render(manualPlantProgressBar)} + + )) + }, + style: { + minHeight: "80px" + }, + canClick: () => + Decimal.gte(saplings.value, 1) && + Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value), + onClick() { + if (Decimal.lt(manualPlantProgress.value, computedManualPlantingCooldown.value)) { + return; + } + const amount = Decimal.floor( + Decimal.min( + saplings.value, + Decimal.times( + computedManualPlantingAmount.value, + Decimal.div( + manualPlantProgress.value, + computedManualPlantingCooldown.value + ).floor() + ) + ) + ); + saplings.value = Decimal.sub(saplings.value, amount); + manualPlantProgress.value = 0; + } + })); + + const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ + { + title: "Logs per Tree", + modifier: logGain, + base: 1, + visible: researchUpgrade1.bought + }, + { + title: "Manual Cutting Amount", + modifier: manualCuttingAmount, + base: 1, + visible: manualCutUpgrade1.bought, + unit: "/click" + }, + { + title: "Manual Cutting Cooldown", + modifier: manualCuttingCooldown, + base: 1, + visible: manualCutUpgrade1.bought, + unit: "s" + }, + { + title: "Manual Planting Amount", + modifier: manualPlantingAmount, + base: 1, + visible: manualPlantUpgrade1.bought, + unit: "/click" + }, + { + title: "Manual Planting Cooldown", + modifier: manualPlantingCooldown, + base: 1, + visible: manualPlantUpgrade1.bought, + unit: "s" + }, + { + title: `Auto Cutting Amount`, + modifier: autoCuttingAmount, + base: 0, + visible: autoCutUpgrade1.bought, + unit: "/s" + }, + { + title: `Auto Planting Amount`, + modifier: autoPlantingAmount, + base: 0, + visible: autoPlantUpgrade1.bought, + unit: "/s" + }, + { + title: `Forest Size`, + modifier: totalTrees, + base: 10, + visible: researchUpgrade2.bought + } + ]); + const showModifiersModal = ref(false); + const modifiersModal = jsx(() => ( + (showModifiersModal.value = value)} + v-slots={{ + header: () =>

{name} Modifiers

, + body: generalTab + }} + /> + )); + + globalBus.on("update", diff => { + if (Decimal.lt(main.day.value, day)) { + return; + } + + if (Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value)) { + manualCutProgress.value = computedManualCuttingCooldown.value; + } else { + manualCutProgress.value = Decimal.add(manualCutProgress.value, diff); + if (cutTree.isHolding.value) { + cutTree.onClick(); + } + } + if (Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value)) { + manualPlantProgress.value = computedManualPlantingCooldown.value; + } else { + manualPlantProgress.value = Decimal.add(manualPlantProgress.value, diff); + if (plantTree.isHolding.value) { + plantTree.onClick(); + } + } + + const plantingAmount = Decimal.sub( + computedAutoPlantingAmount.value, + Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0) + ); + const cuttingAmount = Decimal.sub( + computedAutoCuttingAmount.value, + Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0) + ); + lastAutoPlantedAmount.value = Decimal.isNaN(plantingAmount) ? 0 : plantingAmount; + lastAutoCuttingAmount.value = Decimal.isNaN(cuttingAmount) ? 0 : cuttingAmount; + + const amountCut = Decimal.min( + trees.value, + Decimal.times(computedAutoCuttingAmount.value, diff) + ); + const logsGained = Decimal.mul(logGain.apply(1), amountCut); + + const effectiveLogsGained = Decimal.div(logsGained, diff); + ema.value = Decimal.mul(effectiveLogsGained, SMOOTHING_FACTOR).add( + Decimal.mul(ema.value, Decimal.dOne.sub(SMOOTHING_FACTOR)) + ); + + logs.value = Decimal.add(logs.value, logsGained); + saplings.value = Decimal.add(saplings.value, amountCut); + + const amountPlanted = Decimal.min( + saplings.value, + Decimal.times(computedAutoPlantingAmount.value, diff) + ); + saplings.value = Decimal.sub(saplings.value, amountPlanted); + }); + + const netSaplingGain = computed(() => + Decimal.sub(computedAutoCuttingAmount.value, computedAutoPlantingAmount.value) + ); + const netTreeGain = computed(() => + Decimal.sub(computedAutoPlantingAmount.value, computedAutoCuttingAmount.value) + ); + + const cutTreeHK = createHotkey(() => ({ + key: "c", + description: 'Press the "Cut trees" button.', + onPress: () => { + if (cutTree.canClick.value) cutTree.onClick(); + } + })); + const plantTreeHK = createHotkey(() => ({ + key: "p", + description: 'Press the "Plant trees" button.', + onPress: () => { + if (plantTree.canClick.value) plantTree.onClick(); + } + })); + + const { total: totalLogs, trackerDisplay } = setUpDailyProgressTracker({ + resource: logs, + goal: 1e4, + name, + day, + color: colorDark, + modal: { + show: showModifiersModal, + display: modifiersModal + } + }); + + return { + name, + color: colorBright, + logs, + totalLogs, + trees, + saplings, + cutTree, + plantTree, + cutTreeHK, + plantTreeHK, + row1Upgrades, + row2Upgrades, + row1Buyables, + manualCutProgress, + manualPlantProgress, + generalTabCollapsed, + computedAutoCuttingAmount, + minWidth: 700, + display: jsx(() => ( + <> + {render(trackerDisplay)} + + equilibrium: +${formatLimit( + [ + [computedAutoCuttingAmount.value, "cutting speed"], + [computedAutoPlantingAmount.value, "planting speed"], + [Decimal.mul(computedTotalTrees.value, 20), "forest cap"] + ], + "/s", + logGain.apply(1) + )}` + : undefined + } + /> + + + + {renderRow(cutTree, plantTree)} +
Tip: You can hold down on actions to perform them automatically
+ + {renderGrid(row1Upgrades, row2Upgrades)} + + {renderRow(...row1Buyables)} + + )), + minimizedDisplay: jsx(() => ( +
+ {name} - {format(logs.value)} {logs.displayName} +
+ )) + }; +}); + +export default layer; From 46eb86fd4847a0d51a5a8f109e0a32ca111b916f Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:13:44 +0000 Subject: [PATCH 02/27] do toy stuff? --- src/data/layers/toys.tsx | 765 ++------------------------------------- 1 file changed, 22 insertions(+), 743 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 81d5805..1beb8ab 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -48,654 +48,19 @@ const layer = createLayer(id, function (this: BaseLayer) { const colorBright = "#4BDC13"; const colorDark = "green"; - const logs = createResource(0, "logs"); - // Think of saplings as spent trees - const saplings = createResource(0, "saplings"); - - const ema = ref(0); - - const lastAutoCuttingAmount = ref(0); - const lastAutoPlantedAmount = ref(0); - - const totalTrees = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: () => Decimal.times(expandingForestBuyable.amount.value, 10), - description: "Expand Forest", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 2), - description: "75% Foundation Completed", - enabled: workshop.milestones.morePlantsMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "5 Elves Trained", - enabled: elves.milestones[4].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "8 Elves Trained", - enabled: elves.milestones[7].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Boots", - enabled: cloth.treesUpgrades.treesUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: dyes.boosts.blue1, - description: "Blue Dye Boost 1", - enabled: () => Decimal.gte(dyes.dyes.blue.amount.value, 1) - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.pow(computedManualCuttingAmount.value, 0.99), - description: "Hope Level 1", - enabled: management.elfTraining.expandersElfTraining.milestones[0].earned - })) - ]) as WithRequired; - const trees = createResource( - computed(() => Decimal.sub(totalTrees.apply(10), saplings.value)), - "trees" - ); - const computedTotalTrees = computed(() => totalTrees.apply(10)); - - const manualCutUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 10, - display: { - title: "Wooden Fingers", - description: "Cut down an additional tree per click" - } - })); - const manualPlantUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 10, - display: { - title: "Leafy Fingers", - description: "Plant an additional tree per click" - } - })); - const autoCutUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 25, - display: { - title: "Automated Knives", - description: "Cut down a tree every second" - } - })); - const autoPlantUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 25, - display: { - title: "Automated Spade", - description: "Plant a tree every second" - } - })); - const researchUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 40, - display: { - title: "Research I", - description: "Trees give 25% more logs, and unlock more upgrades" - } - })); - const row1Upgrades = [ - manualCutUpgrade1, - manualPlantUpgrade1, - autoCutUpgrade1, - autoPlantUpgrade1, - researchUpgrade1 - ]; - - const manualCutUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 50, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Sharper Fingers", - description: "Manually cut trees twice as often" - } - })); - const manualPlantUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 50, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Greener Fingers", - description: "Manually Plant trees twice as often" - } - })); - const manualCutUpgrade3 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 150, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Smart Knives", - description: - "Each time you manually chop trees, gain 1s of automatic tree chopping production" - } - })); - const manualPlantUpgrade3 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 150, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Smart Spades", - description: - "Each time you manually plant trees, gain 1s of automatic tree planting production" - } - })); - const researchUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 300, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Research II", - description: "Trees give 25% more logs, and unlock repeatable purchases" - } - })); - const row2Upgrades = [ - manualCutUpgrade2, - manualPlantUpgrade2, - manualCutUpgrade3, - manualPlantUpgrade3, - researchUpgrade2 - ]; - - const autoCuttingBuyable1 = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); - if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); - if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); - if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); - v = Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value).times(v); - return Decimal.times(100, v).add(200); - }, - inverseCost(x: DecimalSource) { - let v = Decimal.sub(x, 200).div(100); - v = v.div(Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value)); - if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); - if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); - if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); - if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Generic Cutters", - description: "Each cutter cuts down 1 tree/s" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const autoPlantingBuyable1 = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); - if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); - if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); - if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); - v = Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value).times(v); - let cost = Decimal.times(100, v).add(200); - if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { - cost = Decimal.div(cost, 10); - } - return cost; - }, - inverseCost(x: DecimalSource) { - if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { - x = Decimal.mul(x, 10); - } - let v = Decimal.sub(x, 200).div(100); - v = v.div(Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value)); - if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); - if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); - if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); - if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Generic Planters", - description: "Each planter plants 0.5 trees/s" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const expandingForestBuyable = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 100)) v = Decimal.pow(v, 2).div(100); - if (Decimal.gte(v, 1e5)) v = Decimal.pow(v, 2).div(1e5); - if (Decimal.gte(v, 1e15)) v = Decimal.pow(v, 10).div(1e135); - v = Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value).times(v); - return Decimal.pow(Decimal.add(v, 1), 1.5).times(500); - }, - inverseCost(x: DecimalSource) { - let v = Decimal.div(x, 500).root(1.5).sub(1); - v = v.div(Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value)); - if (Decimal.gte(v, 1e15)) v = Decimal.mul(v, 1e135).root(10); - if (Decimal.gte(v, 1e5)) v = Decimal.mul(v, 1e5).root(2); - if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Expand Forest", - description: "Add 10 trees to the forest" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const row1Buyables = [autoCuttingBuyable1, autoPlantingBuyable1, expandingForestBuyable]; - - const manualCuttingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Wooden Fingers", - enabled: manualCutUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: computedAutoCuttingAmount, - description: "Smart Knives", - enabled: manualCutUpgrade3.bought - })) + const toys = createResource(0, "toys"); + const toys2 = createResource(0, "toys2"); + const toys3 = createResource(0, "toys3"); + const toyGain = createSequentialModifier(() => [ + ]); - const computedManualCuttingAmount = computed(() => manualCuttingAmount.apply(1)); - const manualCuttingCooldown = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 0.5, - description: "Sharper Fingers", - enabled: manualCutUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(0.5, elves.totalElves.value), - description: "1 Elf Trained", - enabled: elves.milestones[0].earned - })) - ]); - const computedManualCuttingCooldown = computed(() => manualCuttingCooldown.apply(1)); - - const autoCuttingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Automated Knives", - enabled: autoCutUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: autoCuttingBuyable1.amount, - description: "Generic Cutters", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 5).floor(), - description: "10% Foundation Completed", - enabled: workshop.milestones.autoCutMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "30% Foundation Completed", - enabled: workshop.milestones.autoCutMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Warmer Cutters", - enabled: coal.warmerCutters.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedHeatedCutterEffect, - description: "Heated Cutters", - enabled: () => Decimal.gt(coal.heatedCutters.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Jeans", - enabled: cloth.treesUpgrades.treesUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(1.1, main.day.value), - description: "Holly Level 4", - enabled: management.elfTraining.cutterElfTraining.milestones[3].earned - })), - createAdditiveModifier(() => ({ - addend: () => - Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0), - description: "Ivy Level 5", - enabled: management.elfTraining.planterElfTraining.milestones[4].earned - })) - ]) as WithRequired; - const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); - - const manualPlantingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Leafy Fingers", - enabled: manualPlantUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: computedAutoPlantingAmount, - description: "Smart Spades", - enabled: manualPlantUpgrade3.bought - })) - ]); - const computedManualPlantingAmount = computed(() => manualPlantingAmount.apply(1)); - const manualPlantingCooldown = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 0.5, - description: "Greener Fingers", - enabled: manualPlantUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(0.5, elves.totalElves.value), - description: "1 Elf Trained", - enabled: elves.milestones[0].earned - })) - ]); - const computedManualPlantingCooldown = computed(() => manualPlantingCooldown.apply(1)); - - const autoPlantingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Automated Spade", - enabled: autoPlantUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(autoPlantingBuyable1.amount.value, 2), - description: "Generic Planters", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 10).floor(), - description: "20% Foundation Completed", - enabled: workshop.milestones.autoPlantMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "40% Foundation Completed", - enabled: workshop.milestones.autoPlantMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Warmer Planters", - enabled: coal.warmerPlanters.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedHeatedPlanterEffect, - description: "Heated Planters", - enabled: () => Decimal.gt(coal.heatedPlanters.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Plaid", - enabled: cloth.treesUpgrades.treesUpgrade3.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Ivy Level 1", - enabled: management.elfTraining.planterElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(trees.value, 0.2).max(1).log10().pow_base(2), - description: "Ivy Level 3", - enabled: management.elfTraining.planterElfTraining.milestones[2].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Mary Level 4", - enabled: management.elfTraining.heatedPlanterElfTraining.milestones[3].earned - })), - createAdditiveModifier(() => ({ - addend: () => - Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0), - description: "Ivy Level 5", - enabled: management.elfTraining.planterElfTraining.milestones[4].earned - })) - ]) as WithRequired; - const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); - - const logGain = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Research I", - enabled: researchUpgrade1.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Research II", - enabled: researchUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => - workshop.milestones.extraExpansionMilestone1.earned.value - ? Decimal.pow(1.02, workshop.foundationProgress.value) - : Decimal.div(workshop.foundationProgress.value, 20).add(1), - description: "1% Foundation Completed", - enabled: workshop.milestones.logGainMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "50% Foundation Completed", - enabled: workshop.milestones.logGainMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Ashy Soil", - enabled: coal.basicFertilizer.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedFertilizerEffect, - description: "Fertilized Soil", - enabled: () => Decimal.gt(coal.moreFertilizer.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "4 Elves Trained", - enabled: elves.milestones[3].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Carry logs in boxes", - enabled: boxes.upgrades.logsUpgrade.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.div(boxes.buyables.logBoxesBuyable.amount.value, 2).add(1), - description: "Carry more logs", - enabled: boxes.upgrades.logsUpgrade.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 10, - description: "Felt-Gripped Axe", - enabled: cloth.treesUpgrades.treesUpgrade4.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: computed(() => - Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1) - ), - description: "Is Blue Dye just Water?", - enabled: dyes.upgrades.blueDyeUpg.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(9)), - description: "Holly Level 1", - enabled: management.elfTraining.cutterElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.sqrt(management.totalElfLevels.value), - description: "Noel Level 1", - enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: wrappingPaper.boosts.christmas1, - description: "Christmas Wrapping Paper", - enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) - })), - createExponentialModifier(() => ({ - exponent: 1.2, - description: "100% Foundation Completed", - enabled: workshop.milestones.logGainMilestone3.earned - })), - createExponentialModifier(() => ({ - exponent: 1.05, - description: "Un-Processing", - enabled: paper.upgrades2.treeUpgrade.bought - })) - ]); - - const manualCutProgress = persistent(0); - const manualCutProgressBar = createBar(() => ({ - direction: Direction.Right, - width: 100, - height: 10, - style: "margin-top: 8px", - baseStyle: "margin-top: -1px", - fillStyle: "margin-top: -1px; transition-duration: 0s", - progress: () => Decimal.div(manualCutProgress.value, computedManualCuttingCooldown.value) - })); - - const cutTree = createClickable(() => ({ - display: { - title: "Cut trees", - description: jsx(() => ( - <> - Cut down up to {formatWhole(Decimal.floor(computedManualCuttingAmount.value))}{" "} - tree - {Decimal.eq(computedManualCuttingAmount.value, 1) ? "" : "s"} at once! -
- {render(manualCutProgressBar)} - - )) - }, - style: { - minHeight: "80px" - }, - canClick: () => - Decimal.gte(trees.value, 1) && - Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value), - onClick() { - if (Decimal.lt(manualCutProgress.value, computedManualCuttingCooldown.value)) { - return; - } - const amount = Decimal.floor( - Decimal.min( - trees.value, - Decimal.times( - computedManualCuttingAmount.value, - Decimal.div( - manualCutProgress.value, - computedManualCuttingCooldown.value - ).floor() - ) - ) - ); - logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount)); - saplings.value = Decimal.add(saplings.value, amount); - manualCutProgress.value = 0; - } - })); - - const manualPlantProgress = persistent(0); - const manualPlantProgressBar = createBar(() => ({ - direction: Direction.Right, - width: 100, - height: 10, - style: "margin-top: 8px", - baseStyle: "margin-top: -1px", - fillStyle: "margin-top: -1px; transition-duration: 0s", - progress: () => Decimal.div(manualPlantProgress.value, computedManualPlantingCooldown.value) - })); - const plantTree = createClickable(() => ({ - display: { - title: "Plant trees", - description: jsx(() => ( - <> - Plant up to {formatWhole(Decimal.floor(computedManualPlantingAmount.value))}{" "} - tree - {Decimal.eq(computedManualPlantingAmount.value, 1) ? "" : "s"} at once! -
- {render(manualPlantProgressBar)} - - )) - }, - style: { - minHeight: "80px" - }, - canClick: () => - Decimal.gte(saplings.value, 1) && - Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value), - onClick() { - if (Decimal.lt(manualPlantProgress.value, computedManualPlantingCooldown.value)) { - return; - } - const amount = Decimal.floor( - Decimal.min( - saplings.value, - Decimal.times( - computedManualPlantingAmount.value, - Decimal.div( - manualPlantProgress.value, - computedManualPlantingCooldown.value - ).floor() - ) - ) - ); - saplings.value = Decimal.sub(saplings.value, amount); - manualPlantProgress.value = 0; - } - })); const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ - { - title: "Logs per Tree", - modifier: logGain, + { + title: `Toy Gain`, + modifier: toyGain, base: 1, - visible: researchUpgrade1.bought - }, - { - title: "Manual Cutting Amount", - modifier: manualCuttingAmount, - base: 1, - visible: manualCutUpgrade1.bought, - unit: "/click" - }, - { - title: "Manual Cutting Cooldown", - modifier: manualCuttingCooldown, - base: 1, - visible: manualCutUpgrade1.bought, - unit: "s" - }, - { - title: "Manual Planting Amount", - modifier: manualPlantingAmount, - base: 1, - visible: manualPlantUpgrade1.bought, - unit: "/click" - }, - { - title: "Manual Planting Cooldown", - modifier: manualPlantingCooldown, - base: 1, - visible: manualPlantUpgrade1.bought, - unit: "s" - }, - { - title: `Auto Cutting Amount`, - modifier: autoCuttingAmount, - base: 0, - visible: autoCutUpgrade1.bought, - unit: "/s" - }, - { - title: `Auto Planting Amount`, - modifier: autoPlantingAmount, - base: 0, - visible: autoPlantUpgrade1.bought, - unit: "/s" - }, - { - title: `Forest Size`, - modifier: totalTrees, - base: 10, - visible: researchUpgrade2.bought + visible: true } ]); const showModifiersModal = ref(false); @@ -715,79 +80,12 @@ const layer = createLayer(id, function (this: BaseLayer) { return; } - if (Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value)) { - manualCutProgress.value = computedManualCuttingCooldown.value; - } else { - manualCutProgress.value = Decimal.add(manualCutProgress.value, diff); - if (cutTree.isHolding.value) { - cutTree.onClick(); - } - } - if (Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value)) { - manualPlantProgress.value = computedManualPlantingCooldown.value; - } else { - manualPlantProgress.value = Decimal.add(manualPlantProgress.value, diff); - if (plantTree.isHolding.value) { - plantTree.onClick(); - } - } - - const plantingAmount = Decimal.sub( - computedAutoPlantingAmount.value, - Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0) - ); - const cuttingAmount = Decimal.sub( - computedAutoCuttingAmount.value, - Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0) - ); - lastAutoPlantedAmount.value = Decimal.isNaN(plantingAmount) ? 0 : plantingAmount; - lastAutoCuttingAmount.value = Decimal.isNaN(cuttingAmount) ? 0 : cuttingAmount; - - const amountCut = Decimal.min( - trees.value, - Decimal.times(computedAutoCuttingAmount.value, diff) - ); - const logsGained = Decimal.mul(logGain.apply(1), amountCut); - - const effectiveLogsGained = Decimal.div(logsGained, diff); - ema.value = Decimal.mul(effectiveLogsGained, SMOOTHING_FACTOR).add( - Decimal.mul(ema.value, Decimal.dOne.sub(SMOOTHING_FACTOR)) - ); - - logs.value = Decimal.add(logs.value, logsGained); - saplings.value = Decimal.add(saplings.value, amountCut); - - const amountPlanted = Decimal.min( - saplings.value, - Decimal.times(computedAutoPlantingAmount.value, diff) - ); - saplings.value = Decimal.sub(saplings.value, amountPlanted); + }); - const netSaplingGain = computed(() => - Decimal.sub(computedAutoCuttingAmount.value, computedAutoPlantingAmount.value) - ); - const netTreeGain = computed(() => - Decimal.sub(computedAutoPlantingAmount.value, computedAutoCuttingAmount.value) - ); - const cutTreeHK = createHotkey(() => ({ - key: "c", - description: 'Press the "Cut trees" button.', - onPress: () => { - if (cutTree.canClick.value) cutTree.onClick(); - } - })); - const plantTreeHK = createHotkey(() => ({ - key: "p", - description: 'Press the "Plant trees" button.', - onPress: () => { - if (plantTree.canClick.value) plantTree.onClick(); - } - })); - - const { total: totalLogs, trackerDisplay } = setUpDailyProgressTracker({ - resource: logs, + const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ + resource: toys, goal: 1e4, name, day, @@ -801,32 +99,20 @@ const layer = createLayer(id, function (this: BaseLayer) { return { name, color: colorBright, - logs, - totalLogs, - trees, - saplings, - cutTree, - plantTree, - cutTreeHK, - plantTreeHK, - row1Upgrades, - row2Upgrades, - row1Buyables, - manualCutProgress, - manualPlantProgress, + toys, + totalToys, generalTabCollapsed, - computedAutoCuttingAmount, minWidth: 700, display: jsx(() => ( <> {render(trackerDisplay)} equilibrium: +${formatLimit( [ [computedAutoCuttingAmount.value, "cutting speed"], @@ -836,33 +122,26 @@ const layer = createLayer(id, function (this: BaseLayer) { "/s", logGain.apply(1) )}` - : undefined + : */undefined } /> - - {renderRow(cutTree, plantTree)} -
Tip: You can hold down on actions to perform them automatically
- - {renderGrid(row1Upgrades, row2Upgrades)} - - {renderRow(...row1Buyables)} )), minimizedDisplay: jsx(() => (
- {name} - {format(logs.value)} {logs.displayName} + {name} - {format(toys.value)} {toys.displayName}
)) }; From 6bc0a53ce3148895621b1825bbcd48606da69b3d Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:17:18 +0000 Subject: [PATCH 03/27] add toys to advent --- src/data/layers/toys.tsx | 3 --- src/data/projEntry.tsx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 1beb8ab..f73457c 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -40,9 +40,6 @@ import wrappingPaper from "./wrapping-paper"; const id = "toys"; const day = 17; -// how much to prioritize this' income -// vs the previous ones -const SMOOTHING_FACTOR = 0.1; const layer = createLayer(id, function (this: BaseLayer) { const name = "Toys"; const colorBright = "#4BDC13"; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index a7a5bba..8ccc0fe 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -311,7 +311,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 17, shouldNotify: false, - layer: null, // "toys 1" + layer: "toys 1", // "toys 1" symbol: "", story: "", completedStory: "" From 6217b521b6f8e97172b718eb6b64b006cd45d390 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:43:22 +0000 Subject: [PATCH 04/27] fix toy thing --- src/data/layers/toys.tsx | 2 +- src/data/projEntry.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index f73457c..e60c0d3 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -41,7 +41,7 @@ const id = "toys"; const day = 17; const layer = createLayer(id, function (this: BaseLayer) { - const name = "Toys"; + const name = "toys"; const colorBright = "#4BDC13"; const colorDark = "green"; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 8ccc0fe..0c7fa36 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -311,7 +311,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 17, shouldNotify: false, - layer: "toys 1", // "toys 1" + layer: "toys", // "toys1" symbol: "", story: "", completedStory: "" @@ -319,7 +319,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 18, shouldNotify: false, - layer: null, // "toys 2" + layer: null, // "toys2" symbol: "", story: "", completedStory: "" @@ -327,7 +327,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 19, shouldNotify: false, - layer: null, // "toys 3" + layer: null, // "toys3" symbol: "", story: "", completedStory: "" From c629b7794630eaae01c97b1513c255f05df3fa21 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 01:10:07 +0000 Subject: [PATCH 05/27] fix toy sum --- src/data/layers/toys.tsx | 26 ++++++++++++++------------ src/data/projEntry.tsx | 4 +++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index e60c0d3..77ecec7 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -41,17 +41,17 @@ const id = "toys"; const day = 17; const layer = createLayer(id, function (this: BaseLayer) { - const name = "toys"; + const name = "Toys"; const colorBright = "#4BDC13"; const colorDark = "green"; - const toys = createResource(0, "toys"); - const toys2 = createResource(0, "toys2"); - const toys3 = createResource(0, "toys3"); + const clothes = createResource(0, "clothes"); + const teddybears = createResource(0, " teddy bears"); + const trains = createResource(0, "trains"); const toyGain = createSequentialModifier(() => [ - - ]); + ]); + const toySum = createResource(computed(() => Decimal.add(clothes.value, teddybears.value).add(trains.value)), "toy sum") const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -82,7 +82,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ - resource: toys, + resource: toySum, goal: 1e4, name, day, @@ -95,8 +95,10 @@ const layer = createLayer(id, function (this: BaseLayer) { return { name, + day, color: colorBright, - toys, + clothes, + teddybears, totalToys, generalTabCollapsed, minWidth: 700, @@ -105,7 +107,7 @@ const layer = createLayer(id, function (this: BaseLayer) { {render(trackerDisplay)} (
- {name} - {format(toys.value)} {toys.displayName} + {name} - {format(toySum.value)} {"total toys"}
)) }; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 0c7fa36..5d68d71 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -33,6 +33,7 @@ import plastic from "./layers/plastic"; import trees from "./layers/trees"; import workshop from "./layers/workshop"; import wrappingPaper from "./layers/wrapping-paper"; +import toys from "./layers/toys"; import boxesSymbol from "./symbols/cardboardBox.png"; import clothSymbol from "./symbols/cloth.png"; import coalSymbol from "./symbols/coal.png"; @@ -447,7 +448,8 @@ export const getInitialLayers = ( dyes, wrappingPaper, management, - letters + letters, + toys, ]; /** From b9ac4ee40e40c445a78629a0acfe0287f4244dff Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 01:14:51 +0000 Subject: [PATCH 06/27] rename teddy bears and trains --- src/data/layers/toys.tsx | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 77ecec7..9f62fdb 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -46,12 +46,12 @@ const layer = createLayer(id, function (this: BaseLayer) { const colorDark = "green"; const clothes = createResource(0, "clothes"); - const teddybears = createResource(0, " teddy bears"); - const trains = createResource(0, "trains"); + const woodenBlocks = createResource(0, " wooden blocks"); + const trucks = createResource(0, "trucks"); const toyGain = createSequentialModifier(() => [ ]); - const toySum = createResource(computed(() => Decimal.add(clothes.value, teddybears.value).add(trains.value)), "toy sum") + const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toy sum") const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -83,7 +83,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 1e4, + goal: 8e9, name, day, color: colorDark, @@ -98,7 +98,7 @@ const layer = createLayer(id, function (this: BaseLayer) { day, color: colorBright, clothes, - teddybears, + woodenBlocks, totalToys, generalTabCollapsed, minWidth: 700, @@ -110,28 +110,16 @@ const layer = createLayer(id, function (this: BaseLayer) { resource={clothes} color={colorBright} style="margin-bottom: 0" - productionDisplay={ - /*Decimal.gt(computedAutoCuttingAmount.value, 0) - ? `+${format(ema.value)}/s average
equilibrium: +${formatLimit( - [ - [computedAutoCuttingAmount.value, "cutting speed"], - [computedAutoPlantingAmount.value, "planting speed"], - [Decimal.mul(computedTotalTrees.value, 20), "forest cap"] - ], - "/s", - logGain.apply(1) - )}` - : */undefined - } + productionDisplay={undefined} /> Date: Fri, 16 Dec 2022 01:51:10 +0000 Subject: [PATCH 07/27] add buyable costs --- src/data/layers/toys.tsx | 117 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 7 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 9f62fdb..3c49feb 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -28,15 +28,12 @@ import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } import { Direction, WithRequired } from "util/common"; import { render, renderGrid, renderRow } from "util/vue"; import { computed, ref } from "vue"; -import boxes from "./boxes"; +import metal from "./metal"; +import plastic from "./plastic"; import cloth from "./cloth"; -import coal from "./coal"; +import trees from "./trees"; import dyes from "./dyes"; -import elves, { ElfBuyable } from "./elves"; -import management from "./management"; import paper from "./paper"; -import workshop from "./workshop"; -import wrappingPaper from "./wrapping-paper"; const id = "toys"; const day = 17; @@ -51,7 +48,108 @@ const layer = createLayer(id, function (this: BaseLayer) { const toyGain = createSequentialModifier(() => [ ]); - const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toy sum") + const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toys"); + + const clothesCost = computed(() => { + const clothFactor = Decimal.add(1,clothesBuyable.amount.value); + return { + cloth: clothFactor.mul(1e8), + dye: clothFactor.mul(1e6) + }; + }); + const clothesBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Clothes

+ +
+ Click this buyable to make some clothes! +
+ +
+ You have {formatWhole(clothes.value)} clothes. +
+ +
+ Costs {format(clothesCost.value.cloth)} cloth and requires {format(clothesCost.value.dye)} of red, yellow, and + blue dye +
+ + )), + canPurchase(): boolean { + return ( + clothesCost.value.cloth.lte(cloth.cloth.value) && + clothesCost.value.dye.lte(dyes.dyes.blue.amount.value) && + clothesCost.value.dye.lte(dyes.dyes.red.amount.value) && + clothesCost.value.dye.lte(dyes.dyes.yellow.amount.value) + ); + }, + })) as GenericBuyable; + const woodenBlocksCost = computed(() => { + const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + return { + wood: woodFactor.mul(1e40) + }; + }); + const woodenBlocksBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Wooden Blocks

+ +
+ Click this buyable to make some wooden blocks! +
+ +
+ You have {formatWhole(woodenBlocks.value)} wooden blocks. +
+ +
+ Costs {format(woodenBlocksCost.value.wood)} logs +
+ + )), + canPurchase(): boolean { + return ( + woodenBlocksCost.value.wood.lte(trees.logs.value) + ); + }, + })) as GenericBuyable; + const trucksCost = computed(() => { + const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); + const plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + return { + metal: factor.mul(1e25), + plastic: plasticFactor.mul(1e10) + + }; + }); + const trucksBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Trucks

+ +
+ Click this buyable to make some trucks! +
+ +
+ You have {formatWhole(woodenBlocks.value)} wooden blocks. +
+ +
+ Costs {format(trucksCost.value.metal)} metal and {format(trucksCost.value.plastic)} plastic +
+ + )), + canPurchase(): boolean { + return ( + trucksCost.value.metal.lte(metal.metal.value) && + trucksCost.value.plastic.lte(plastic.plastic.value) + ); + }, + })) as GenericBuyable; + const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -99,7 +197,10 @@ const layer = createLayer(id, function (this: BaseLayer) { color: colorBright, clothes, woodenBlocks, + trucks, + toySum, totalToys, + buyables, generalTabCollapsed, minWidth: 700, display: jsx(() => ( @@ -124,6 +225,8 @@ const layer = createLayer(id, function (this: BaseLayer) { style="margin-bottom: 0" productionDisplay={undefined} /> + + {renderRow(...buyables)} )), minimizedDisplay: jsx(() => ( From 6b9ec5f3c57504cc9c5cba1f2e4ee2054bdc321f Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 02:07:19 +0000 Subject: [PATCH 08/27] milestone --- src/data/layers/toys.tsx | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 3c49feb..3fb5825 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -4,14 +4,19 @@ */ import Spacer from "components/layout/Spacer.vue"; import Modal from "components/Modal.vue"; -import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; import { createBar } from "features/bars/bar"; +import { + createCollapsibleMilestones, + createCollapsibleModifierSections, + setUpDailyProgressTracker +} from "data/common"; import { createBuyable, GenericBuyable } from "features/buyable"; import { createClickable } from "features/clickables/clickable"; import { jsx, showIf } from "features/feature"; import { createHotkey } from "features/hotkey"; import MainDisplay from "features/resources/MainDisplay.vue"; +import { createMilestone } from "features/milestones/milestone"; import { createResource, Resource } from "features/resources/resource"; import { createUpgrade } from "features/upgrades/upgrade"; import { globalBus } from "game/events"; @@ -84,6 +89,11 @@ const layer = createLayer(id, function (this: BaseLayer) { clothesCost.value.dye.lte(dyes.dyes.yellow.amount.value) ); }, + onPurchase() { + cloth.cloth.value = Decimal.sub(cloth.cloth.value, clothesCost.value.cloth); + this.amount.value = Decimal.add(this.amount.value, 1); + clothes.value = this.amount.value + }, })) as GenericBuyable; const woodenBlocksCost = computed(() => { const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); @@ -114,6 +124,11 @@ const layer = createLayer(id, function (this: BaseLayer) { woodenBlocksCost.value.wood.lte(trees.logs.value) ); }, + onPurchase() { + trees.logs.value = Decimal.sub(trees.logs.value, woodenBlocksCost.value.wood); + this.amount.value = Decimal.add(this.amount.value, 1); + woodenBlocks.value = this.amount.value + }, })) as GenericBuyable; const trucksCost = computed(() => { const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); @@ -148,8 +163,25 @@ const layer = createLayer(id, function (this: BaseLayer) { trucksCost.value.plastic.lte(plastic.plastic.value) ); }, + onPurchase() { + metal.metal.value = Decimal.sub(metal.metal.value, trucksCost.value.metal); + plastic.plastic.value = Decimal.sub(plastic.plastic.value, trucksCost.value.plastic); + this.amount.value = Decimal.add(this.amount.value, 1); + trucks.value = this.amount.value + }, })) as GenericBuyable; const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; + const milestone1 = createMilestone(() => ({ + display: { + requirement: "10 toys", + effectDisplay: "The number of complete workshops you have divides the cost to make toys." + }, + shouldEarn: () => Decimal.gte(toySum.value, 10) + })); +const milestones = {milestone1} +const { collapseMilestones, display: milestonesDisplay } = + createCollapsibleMilestones(milestones); + const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -201,7 +233,9 @@ const layer = createLayer(id, function (this: BaseLayer) { toySum, totalToys, buyables, + milestones, generalTabCollapsed, + collapseMilestones, minWidth: 700, display: jsx(() => ( <> @@ -227,6 +261,8 @@ const layer = createLayer(id, function (this: BaseLayer) { /> {renderRow(...buyables)} + + {milestonesDisplay()} )), minimizedDisplay: jsx(() => ( From 7f0301b3e1341016fbfa4f09cb6030b77bbb81d0 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 02:37:37 +0000 Subject: [PATCH 09/27] Implement milestone 1 --- src/data/layers/toys.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 3fb5825..0c5a202 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -39,6 +39,7 @@ import cloth from "./cloth"; import trees from "./trees"; import dyes from "./dyes"; import paper from "./paper"; +import workshop from "./workshop"; const id = "toys"; const day = 17; @@ -56,7 +57,10 @@ const layer = createLayer(id, function (this: BaseLayer) { const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toys"); const clothesCost = computed(() => { - const clothFactor = Decimal.add(1,clothesBuyable.amount.value); + var clothFactor = Decimal.add(1,clothesBuyable.amount.value); + if(milestones.milestone1.earned){ + clothFactor=clothFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { cloth: clothFactor.mul(1e8), dye: clothFactor.mul(1e6) @@ -96,7 +100,10 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const woodenBlocksCost = computed(() => { - const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + var woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + if(milestones.milestone1.earned){ + woodFactor=woodFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { wood: woodFactor.mul(1e40) }; @@ -131,8 +138,12 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const trucksCost = computed(() => { - const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); - const plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + var factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); + var plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + if(milestones.milestone1.earned){ + factor=factor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + plasticFactor=plasticFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { metal: factor.mul(1e25), plastic: plasticFactor.mul(1e10) From 19d58d575e4f3e5ecb3adad514f7089e50360057 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 03:32:47 +0000 Subject: [PATCH 10/27] finish balancing toys layer --- src/data/layers/dyes.tsx | 46 ++++++++++++++++++++++++++-- src/data/layers/letters.tsx | 6 ++++ src/data/layers/metal.tsx | 13 +++++++- src/data/layers/oil.tsx | 5 ++++ src/data/layers/toys.tsx | 58 ++++++++++++++++++++++++++++++++---- src/data/layers/trees.tsx | 6 ++++ src/data/layers/workshop.tsx | 23 +++++++++++--- 7 files changed, 145 insertions(+), 12 deletions(-) diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index 5c97f7d..9fedd06 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -33,6 +33,7 @@ import wrappingPaper from "./wrapping-paper"; import paper from "./paper"; import boxes from "./boxes"; import { ElfBuyable } from "./elves"; +import toys from "./toys" interface Dye { name: string; @@ -53,7 +54,7 @@ type DyeUpg = | "blueDyeUpg2" | "coalUpg"; -export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange"; +export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black"; const id = "dyes"; const day = 11; @@ -393,6 +394,34 @@ const layer = createLayer(id, function (this: BaseLayer) { ], dyesToReset: [] }), + black: createDye({ + name: "Black Dye", + color: "black", + costs: () => [ + { + base: "1e42", + root: 5, + res: trees.logs + }, + { + base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e15" : "2e15")), + root: 2, + res: oil.oil + } + ], + listedBoosts: [ + { + visible: true, + desc: computed( + () => + `*${format( + boosts.black1.value + )} letters processed.` + ) + } + ], + dyesToReset: [] + }), orange: createDye({ name: "Orange Dye", color: "orange", @@ -565,7 +594,12 @@ const layer = createLayer(id, function (this: BaseLayer) { .pow(upgrades.coalUpg.bought.value ? 1.2 : 1) .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) ), - purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)) + purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)), + black1: computed(() => + Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt()) + .pow(upgrades.coalUpg.bought.value ? 1.2 : 1) + .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) + ) }; const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ @@ -584,6 +618,11 @@ const layer = createLayer(id, function (this: BaseLayer) { modifier: dyes.blue.toGenerate, base: 0 }, + { + title: "Black Dye Creation", + modifier: dyes.black.toGenerate, + base: 0 + }, { title: "Orange Dye Creation", modifier: dyes.orange.toGenerate, @@ -795,6 +834,9 @@ const layer = createLayer(id, function (this: BaseLayer) { {render(trackerDisplay)}
+ {renderRow(dyes.black.display)} + {renderRow(dyes.black.buyable)} + {renderRow(dyes.red.display, dyes.yellow.display, dyes.blue.display)} {renderRow(dyes.red.buyable, dyes.yellow.buyable, dyes.blue.buyable)} diff --git a/src/data/layers/letters.tsx b/src/data/layers/letters.tsx index 697cdc6..219a40a 100644 --- a/src/data/layers/letters.tsx +++ b/src/data/layers/letters.tsx @@ -24,6 +24,7 @@ import { createBuyable, GenericBuyable } from "features/buyable"; import metal from "./metal"; import plastic from "./plastic"; import paper from "./paper"; +import dyes from "./dyes"; import SqrtVue from "components/math/Sqrt.vue"; import { globalBus } from "game/events"; import { main } from "data/projEntry"; @@ -190,7 +191,12 @@ const layer = createLayer(id, function (this: BaseLayer) { createMultiplicativeModifier(() => ({ multiplier: () => Decimal.div(paperBuyable.amount.value, 2).add(1), description: "Printed Labels" + })), + createMultiplicativeModifier(() => ({ + multiplier: () => dyes.boosts.black1.value, + description: "Black Dye Boost" })) + ]); const computedLettersGain = computed(() => lettersGain.apply(1)); const processingCooldown = createSequentialModifier(() => [ diff --git a/src/data/layers/metal.tsx b/src/data/layers/metal.tsx index ecd0f82..8f8bdf1 100644 --- a/src/data/layers/metal.tsx +++ b/src/data/layers/metal.tsx @@ -35,6 +35,7 @@ import oil from "./oil"; import paper from "./paper"; import plastic from "./plastic"; import workshop from "./workshop"; +import toys from "./toys"; const id = "metal"; const day = 7; @@ -193,6 +194,11 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.add(industrialCrucible.amount.value, 1).sqrt(), description: "100,000 Letters Processed", enabled: letters.milestones.industrialCrucibleMilestone.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.add(toys.clothes.value, 1), + description: "Give elves clothes to wear", + enabled: toys.row1Upgrades[1].bought })) ]); const computedAutoSmeltMulti = computed(() => autoSmeltMulti.apply(1)); @@ -268,7 +274,12 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.add(dyes.dyes.blue.amount.value, 1).sqrt(), description: "1000 Letters Processed", enabled: letters.milestones.miningMilestone.earned - })) + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.add(toys.clothes.value, 1), + description: "Give elves clothes to wear", + enabled: toys.row1Upgrades[1].bought + })), ]); const computedOreAmount = computed(() => oreAmount.apply(1)); const oreSpeed = createSequentialModifier(() => [ diff --git a/src/data/layers/oil.tsx b/src/data/layers/oil.tsx index a3a7f0c..ce19ca5 100644 --- a/src/data/layers/oil.tsx +++ b/src/data/layers/oil.tsx @@ -861,6 +861,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "Cocoa Level 3", enabled: management.elfTraining.oilElfTraining.milestones[2].earned })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Workshop 1200%", + enabled: workshop.milestones.extraExpansionMilestone6.earned + })), createMultiplicativeModifier(() => ({ multiplier: () => coalEffectiveness.value, description: "Effectiveness", diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 0c5a202..e01bd13 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -160,7 +160,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
- You have {formatWhole(woodenBlocks.value)} wooden blocks. + You have {formatWhole(trucks.value)} trucks.
@@ -182,14 +182,51 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; + const trucksUpgrade1 = createUpgrade(() => ({ + resource: noPersist(trucks), + cost: 10, + display: { + title: "Load logs onto trucks", + description: "Log gain is doubled." + } + })) + const clothesUpgrade1 = createUpgrade(() => ({ + resource: noPersist(clothes), + cost: 30, + display: { + title: "Give elves clothes to wear", + description: "Multiply ore per mining operation and auto-smelt purity by the number of clothes you have." + } + })) + + const woodenBlocksUpgrade1 = createUpgrade(() => ({ + resource: noPersist(woodenBlocks), + cost: 15, + display: { + title: "Build wooden towers", + description: "You can now build 2 extra tall workshops!" + } + })) +const row1Upgrades = [ + trucksUpgrade1, + clothesUpgrade1, + woodenBlocksUpgrade1 + ]; const milestone1 = createMilestone(() => ({ display: { requirement: "10 toys", - effectDisplay: "The number of complete workshops you have divides the cost to make toys." + effectDisplay: "The cost of making toys is divided by the number of complete workshops you have." }, shouldEarn: () => Decimal.gte(toySum.value, 10) })); -const milestones = {milestone1} + const milestone2 = createMilestone(() => ({ + display: { + requirement: "100 toys", + effectDisplay: "Unlock black dyes." + }, + shouldEarn: () => Decimal.gte(toySum.value, 100) + })); +const milestones = {milestone1, milestone2} const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); @@ -217,14 +254,22 @@ const { collapseMilestones, display: milestonesDisplay } = if (Decimal.lt(main.day.value, day)) { return; } - + if (Decimal.lt(clothes.value, clothesBuyable.amount.value)){ + clothesBuyable.amount.value = clothes.value + } + if (Decimal.lt(woodenBlocks.value, woodenBlocksBuyable.amount.value)){ + woodenBlocksBuyable.amount.value = woodenBlocks.value + } + if (Decimal.lt(trucks.value, trucksBuyable.amount.value)){ + trucksBuyable.amount.value = trucks.value + } }); const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 8e9, + goal: 200, name, day, color: colorDark, @@ -244,6 +289,7 @@ const { collapseMilestones, display: milestonesDisplay } = toySum, totalToys, buyables, + row1Upgrades, milestones, generalTabCollapsed, collapseMilestones, @@ -273,6 +319,8 @@ const { collapseMilestones, display: milestonesDisplay } = {renderRow(...buyables)} + {renderGrid(row1Upgrades)} + {milestonesDisplay()} )), diff --git a/src/data/layers/trees.tsx b/src/data/layers/trees.tsx index 49193c9..2555ef9 100644 --- a/src/data/layers/trees.tsx +++ b/src/data/layers/trees.tsx @@ -37,6 +37,7 @@ import management from "./management"; import paper from "./paper"; import workshop from "./workshop"; import wrappingPaper from "./wrapping-paper"; +import toys from "./toys"; const id = "trees"; const day = 1; @@ -528,6 +529,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "Christmas Wrapping Paper", enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Load logs onto trucks", + enabled: toys.row1Upgrades[0].bought + })), createExponentialModifier(() => ({ exponent: 1.2, description: "100% Foundation Completed", diff --git a/src/data/layers/workshop.tsx b/src/data/layers/workshop.tsx index c217bd7..e36ea8f 100644 --- a/src/data/layers/workshop.tsx +++ b/src/data/layers/workshop.tsx @@ -32,6 +32,7 @@ import elves from "./elves"; import management from "./management"; import trees from "./trees"; import wrappingPaper from "./wrapping-paper"; +import toys from "./toys" const id = "workshop"; const day = 2; @@ -47,7 +48,7 @@ const layer = createLayer(id, function (this: BaseLayer) { scaling: addHardcap( addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5423, 1 / 1e10), 1e20, 3e8), computed(() => - management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 + toys.row1Upgrades[2].bought ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ) ), baseResource: trees.logs, @@ -95,7 +96,7 @@ const layer = createLayer(id, function (this: BaseLayer) { showIf( Decimal.lt( foundationProgress.value, - management.elfTraining.expandersElfTraining.milestones[2].earned.value + toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ) @@ -104,7 +105,7 @@ const layer = createLayer(id, function (this: BaseLayer) { Decimal.gte(trees.logs.value, foundationConversion.nextAt.value) && Decimal.lt( foundationProgress.value, - management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 + toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ), onClick() { if (!unref(this.canClick)) { @@ -261,6 +262,19 @@ const layer = createLayer(id, function (this: BaseLayer) { ), showPopups: shouldShowPopups })); + const extraExpansionMilestone6 = createMilestone(() => ({ + display: { + requirement: "1200% Foundation Completed", + effectDisplay: "Quadruple oil gain" + }, + shouldEarn: () => Decimal.gte(foundationProgress.value, 1200), + visibility: () => + showIf( + extraExpansionMilestone5.earned.value && + toys.row1Upgrades[2].bought.value + ), + showPopups: shouldShowPopups + })); const milestones = { logGainMilestone1, autoCutMilestone1, @@ -274,7 +288,8 @@ const layer = createLayer(id, function (this: BaseLayer) { extraExpansionMilestone2, extraExpansionMilestone3, extraExpansionMilestone4, - extraExpansionMilestone5 + extraExpansionMilestone5, + extraExpansionMilestone6 }; const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); From 84e68259975a819c7b7c15644faa7af86b8bc2a4 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:04:40 -0800 Subject: [PATCH 11/27] start day 17 --- src/data/layers/toys.tsx | 871 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 871 insertions(+) create mode 100644 src/data/layers/toys.tsx diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx new file mode 100644 index 0000000..81d5805 --- /dev/null +++ b/src/data/layers/toys.tsx @@ -0,0 +1,871 @@ +/** + * @module + * @hidden + */ +import Spacer from "components/layout/Spacer.vue"; +import Modal from "components/Modal.vue"; +import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; +import { main } from "data/projEntry"; +import { createBar } from "features/bars/bar"; +import { createBuyable, GenericBuyable } from "features/buyable"; +import { createClickable } from "features/clickables/clickable"; +import { jsx, showIf } from "features/feature"; +import { createHotkey } from "features/hotkey"; +import MainDisplay from "features/resources/MainDisplay.vue"; +import { createResource, Resource } from "features/resources/resource"; +import { createUpgrade } from "features/upgrades/upgrade"; +import { globalBus } from "game/events"; +import { BaseLayer, createLayer } from "game/layers"; +import { + createAdditiveModifier, + createExponentialModifier, + createMultiplicativeModifier, + createSequentialModifier, + Modifier +} from "game/modifiers"; +import { noPersist, persistent } from "game/persistence"; +import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum"; +import { Direction, WithRequired } from "util/common"; +import { render, renderGrid, renderRow } from "util/vue"; +import { computed, ref } from "vue"; +import boxes from "./boxes"; +import cloth from "./cloth"; +import coal from "./coal"; +import dyes from "./dyes"; +import elves, { ElfBuyable } from "./elves"; +import management from "./management"; +import paper from "./paper"; +import workshop from "./workshop"; +import wrappingPaper from "./wrapping-paper"; +const id = "toys"; +const day = 17; + +// how much to prioritize this' income +// vs the previous ones +const SMOOTHING_FACTOR = 0.1; +const layer = createLayer(id, function (this: BaseLayer) { + const name = "Toys"; + const colorBright = "#4BDC13"; + const colorDark = "green"; + + const logs = createResource(0, "logs"); + // Think of saplings as spent trees + const saplings = createResource(0, "saplings"); + + const ema = ref(0); + + const lastAutoCuttingAmount = ref(0); + const lastAutoPlantedAmount = ref(0); + + const totalTrees = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: () => Decimal.times(expandingForestBuyable.amount.value, 10), + description: "Expand Forest", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 2), + description: "75% Foundation Completed", + enabled: workshop.milestones.morePlantsMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "5 Elves Trained", + enabled: elves.milestones[4].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "8 Elves Trained", + enabled: elves.milestones[7].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Boots", + enabled: cloth.treesUpgrades.treesUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: dyes.boosts.blue1, + description: "Blue Dye Boost 1", + enabled: () => Decimal.gte(dyes.dyes.blue.amount.value, 1) + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.pow(computedManualCuttingAmount.value, 0.99), + description: "Hope Level 1", + enabled: management.elfTraining.expandersElfTraining.milestones[0].earned + })) + ]) as WithRequired; + const trees = createResource( + computed(() => Decimal.sub(totalTrees.apply(10), saplings.value)), + "trees" + ); + const computedTotalTrees = computed(() => totalTrees.apply(10)); + + const manualCutUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 10, + display: { + title: "Wooden Fingers", + description: "Cut down an additional tree per click" + } + })); + const manualPlantUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 10, + display: { + title: "Leafy Fingers", + description: "Plant an additional tree per click" + } + })); + const autoCutUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 25, + display: { + title: "Automated Knives", + description: "Cut down a tree every second" + } + })); + const autoPlantUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 25, + display: { + title: "Automated Spade", + description: "Plant a tree every second" + } + })); + const researchUpgrade1 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 40, + display: { + title: "Research I", + description: "Trees give 25% more logs, and unlock more upgrades" + } + })); + const row1Upgrades = [ + manualCutUpgrade1, + manualPlantUpgrade1, + autoCutUpgrade1, + autoPlantUpgrade1, + researchUpgrade1 + ]; + + const manualCutUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 50, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Sharper Fingers", + description: "Manually cut trees twice as often" + } + })); + const manualPlantUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 50, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Greener Fingers", + description: "Manually Plant trees twice as often" + } + })); + const manualCutUpgrade3 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 150, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Smart Knives", + description: + "Each time you manually chop trees, gain 1s of automatic tree chopping production" + } + })); + const manualPlantUpgrade3 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 150, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Smart Spades", + description: + "Each time you manually plant trees, gain 1s of automatic tree planting production" + } + })); + const researchUpgrade2 = createUpgrade(() => ({ + resource: noPersist(logs), + cost: 300, + visibility: () => showIf(researchUpgrade1.bought.value), + display: { + title: "Research II", + description: "Trees give 25% more logs, and unlock repeatable purchases" + } + })); + const row2Upgrades = [ + manualCutUpgrade2, + manualPlantUpgrade2, + manualCutUpgrade3, + manualPlantUpgrade3, + researchUpgrade2 + ]; + + const autoCuttingBuyable1 = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); + if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); + if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); + if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); + v = Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value).times(v); + return Decimal.times(100, v).add(200); + }, + inverseCost(x: DecimalSource) { + let v = Decimal.sub(x, 200).div(100); + v = v.div(Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value)); + if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); + if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); + if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); + if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Generic Cutters", + description: "Each cutter cuts down 1 tree/s" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const autoPlantingBuyable1 = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); + if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); + if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); + if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); + v = Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value).times(v); + let cost = Decimal.times(100, v).add(200); + if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { + cost = Decimal.div(cost, 10); + } + return cost; + }, + inverseCost(x: DecimalSource) { + if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { + x = Decimal.mul(x, 10); + } + let v = Decimal.sub(x, 200).div(100); + v = v.div(Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value)); + if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); + if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); + if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); + if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Generic Planters", + description: "Each planter plants 0.5 trees/s" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const expandingForestBuyable = createBuyable(() => ({ + resource: noPersist(logs), + cost() { + let v = this.amount.value; + if (Decimal.gte(v, 100)) v = Decimal.pow(v, 2).div(100); + if (Decimal.gte(v, 1e5)) v = Decimal.pow(v, 2).div(1e5); + if (Decimal.gte(v, 1e15)) v = Decimal.pow(v, 10).div(1e135); + v = Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value).times(v); + return Decimal.pow(Decimal.add(v, 1), 1.5).times(500); + }, + inverseCost(x: DecimalSource) { + let v = Decimal.div(x, 500).root(1.5).sub(1); + v = v.div(Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value)); + if (Decimal.gte(v, 1e15)) v = Decimal.mul(v, 1e135).root(10); + if (Decimal.gte(v, 1e5)) v = Decimal.mul(v, 1e5).root(2); + if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(2); + return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); + }, + display: { + title: "Expand Forest", + description: "Add 10 trees to the forest" + }, + visibility: () => showIf(researchUpgrade2.bought.value) + })) as ElfBuyable & { display: { title: string }; resource: Resource }; + const row1Buyables = [autoCuttingBuyable1, autoPlantingBuyable1, expandingForestBuyable]; + + const manualCuttingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Wooden Fingers", + enabled: manualCutUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: computedAutoCuttingAmount, + description: "Smart Knives", + enabled: manualCutUpgrade3.bought + })) + ]); + const computedManualCuttingAmount = computed(() => manualCuttingAmount.apply(1)); + const manualCuttingCooldown = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 0.5, + description: "Sharper Fingers", + enabled: manualCutUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(0.5, elves.totalElves.value), + description: "1 Elf Trained", + enabled: elves.milestones[0].earned + })) + ]); + const computedManualCuttingCooldown = computed(() => manualCuttingCooldown.apply(1)); + + const autoCuttingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Automated Knives", + enabled: autoCutUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: autoCuttingBuyable1.amount, + description: "Generic Cutters", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 5).floor(), + description: "10% Foundation Completed", + enabled: workshop.milestones.autoCutMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "30% Foundation Completed", + enabled: workshop.milestones.autoCutMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Warmer Cutters", + enabled: coal.warmerCutters.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedHeatedCutterEffect, + description: "Heated Cutters", + enabled: () => Decimal.gt(coal.heatedCutters.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Jeans", + enabled: cloth.treesUpgrades.treesUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(1.1, main.day.value), + description: "Holly Level 4", + enabled: management.elfTraining.cutterElfTraining.milestones[3].earned + })), + createAdditiveModifier(() => ({ + addend: () => + Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0), + description: "Ivy Level 5", + enabled: management.elfTraining.planterElfTraining.milestones[4].earned + })) + ]) as WithRequired; + const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); + + const manualPlantingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Leafy Fingers", + enabled: manualPlantUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: computedAutoPlantingAmount, + description: "Smart Spades", + enabled: manualPlantUpgrade3.bought + })) + ]); + const computedManualPlantingAmount = computed(() => manualPlantingAmount.apply(1)); + const manualPlantingCooldown = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 0.5, + description: "Greener Fingers", + enabled: manualPlantUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(0.5, elves.totalElves.value), + description: "1 Elf Trained", + enabled: elves.milestones[0].earned + })) + ]); + const computedManualPlantingCooldown = computed(() => manualPlantingCooldown.apply(1)); + + const autoPlantingAmount = createSequentialModifier(() => [ + createAdditiveModifier(() => ({ + addend: 1, + description: "Automated Spade", + enabled: autoPlantUpgrade1.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(autoPlantingBuyable1.amount.value, 2), + description: "Generic Planters", + enabled: researchUpgrade2.bought + })), + createAdditiveModifier(() => ({ + addend: () => Decimal.div(workshop.foundationProgress.value, 10).floor(), + description: "20% Foundation Completed", + enabled: workshop.milestones.autoPlantMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "40% Foundation Completed", + enabled: workshop.milestones.autoPlantMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Warmer Planters", + enabled: coal.warmerPlanters.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedHeatedPlanterEffect, + description: "Heated Planters", + enabled: () => Decimal.gt(coal.heatedPlanters.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Lumberjack Plaid", + enabled: cloth.treesUpgrades.treesUpgrade3.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Ivy Level 1", + enabled: management.elfTraining.planterElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.pow(trees.value, 0.2).max(1).log10().pow_base(2), + description: "Ivy Level 3", + enabled: management.elfTraining.planterElfTraining.milestones[2].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Mary Level 4", + enabled: management.elfTraining.heatedPlanterElfTraining.milestones[3].earned + })), + createAdditiveModifier(() => ({ + addend: () => + Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0), + description: "Ivy Level 5", + enabled: management.elfTraining.planterElfTraining.milestones[4].earned + })) + ]) as WithRequired; + const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); + + const logGain = createSequentialModifier(() => [ + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Research I", + enabled: researchUpgrade1.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Research II", + enabled: researchUpgrade2.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => + workshop.milestones.extraExpansionMilestone1.earned.value + ? Decimal.pow(1.02, workshop.foundationProgress.value) + : Decimal.div(workshop.foundationProgress.value, 20).add(1), + description: "1% Foundation Completed", + enabled: workshop.milestones.logGainMilestone1.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "50% Foundation Completed", + enabled: workshop.milestones.logGainMilestone2.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 1.25, + description: "Ashy Soil", + enabled: coal.basicFertilizer.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: coal.computedFertilizerEffect, + description: "Fertilized Soil", + enabled: () => Decimal.gt(coal.moreFertilizer.amount.value, 0) + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "4 Elves Trained", + enabled: elves.milestones[3].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 2, + description: "Carry logs in boxes", + enabled: boxes.upgrades.logsUpgrade.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.div(boxes.buyables.logBoxesBuyable.amount.value, 2).add(1), + description: "Carry more logs", + enabled: boxes.upgrades.logsUpgrade.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: 10, + description: "Felt-Gripped Axe", + enabled: cloth.treesUpgrades.treesUpgrade4.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: computed(() => + Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1) + ), + description: "Is Blue Dye just Water?", + enabled: dyes.upgrades.blueDyeUpg.bought + })), + createMultiplicativeModifier(() => ({ + multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(9)), + description: "Holly Level 1", + enabled: management.elfTraining.cutterElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.sqrt(management.totalElfLevels.value), + description: "Noel Level 1", + enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: wrappingPaper.boosts.christmas1, + description: "Christmas Wrapping Paper", + enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) + })), + createExponentialModifier(() => ({ + exponent: 1.2, + description: "100% Foundation Completed", + enabled: workshop.milestones.logGainMilestone3.earned + })), + createExponentialModifier(() => ({ + exponent: 1.05, + description: "Un-Processing", + enabled: paper.upgrades2.treeUpgrade.bought + })) + ]); + + const manualCutProgress = persistent(0); + const manualCutProgressBar = createBar(() => ({ + direction: Direction.Right, + width: 100, + height: 10, + style: "margin-top: 8px", + baseStyle: "margin-top: -1px", + fillStyle: "margin-top: -1px; transition-duration: 0s", + progress: () => Decimal.div(manualCutProgress.value, computedManualCuttingCooldown.value) + })); + + const cutTree = createClickable(() => ({ + display: { + title: "Cut trees", + description: jsx(() => ( + <> + Cut down up to {formatWhole(Decimal.floor(computedManualCuttingAmount.value))}{" "} + tree + {Decimal.eq(computedManualCuttingAmount.value, 1) ? "" : "s"} at once! +
+ {render(manualCutProgressBar)} + + )) + }, + style: { + minHeight: "80px" + }, + canClick: () => + Decimal.gte(trees.value, 1) && + Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value), + onClick() { + if (Decimal.lt(manualCutProgress.value, computedManualCuttingCooldown.value)) { + return; + } + const amount = Decimal.floor( + Decimal.min( + trees.value, + Decimal.times( + computedManualCuttingAmount.value, + Decimal.div( + manualCutProgress.value, + computedManualCuttingCooldown.value + ).floor() + ) + ) + ); + logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount)); + saplings.value = Decimal.add(saplings.value, amount); + manualCutProgress.value = 0; + } + })); + + const manualPlantProgress = persistent(0); + const manualPlantProgressBar = createBar(() => ({ + direction: Direction.Right, + width: 100, + height: 10, + style: "margin-top: 8px", + baseStyle: "margin-top: -1px", + fillStyle: "margin-top: -1px; transition-duration: 0s", + progress: () => Decimal.div(manualPlantProgress.value, computedManualPlantingCooldown.value) + })); + const plantTree = createClickable(() => ({ + display: { + title: "Plant trees", + description: jsx(() => ( + <> + Plant up to {formatWhole(Decimal.floor(computedManualPlantingAmount.value))}{" "} + tree + {Decimal.eq(computedManualPlantingAmount.value, 1) ? "" : "s"} at once! +
+ {render(manualPlantProgressBar)} + + )) + }, + style: { + minHeight: "80px" + }, + canClick: () => + Decimal.gte(saplings.value, 1) && + Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value), + onClick() { + if (Decimal.lt(manualPlantProgress.value, computedManualPlantingCooldown.value)) { + return; + } + const amount = Decimal.floor( + Decimal.min( + saplings.value, + Decimal.times( + computedManualPlantingAmount.value, + Decimal.div( + manualPlantProgress.value, + computedManualPlantingCooldown.value + ).floor() + ) + ) + ); + saplings.value = Decimal.sub(saplings.value, amount); + manualPlantProgress.value = 0; + } + })); + + const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ + { + title: "Logs per Tree", + modifier: logGain, + base: 1, + visible: researchUpgrade1.bought + }, + { + title: "Manual Cutting Amount", + modifier: manualCuttingAmount, + base: 1, + visible: manualCutUpgrade1.bought, + unit: "/click" + }, + { + title: "Manual Cutting Cooldown", + modifier: manualCuttingCooldown, + base: 1, + visible: manualCutUpgrade1.bought, + unit: "s" + }, + { + title: "Manual Planting Amount", + modifier: manualPlantingAmount, + base: 1, + visible: manualPlantUpgrade1.bought, + unit: "/click" + }, + { + title: "Manual Planting Cooldown", + modifier: manualPlantingCooldown, + base: 1, + visible: manualPlantUpgrade1.bought, + unit: "s" + }, + { + title: `Auto Cutting Amount`, + modifier: autoCuttingAmount, + base: 0, + visible: autoCutUpgrade1.bought, + unit: "/s" + }, + { + title: `Auto Planting Amount`, + modifier: autoPlantingAmount, + base: 0, + visible: autoPlantUpgrade1.bought, + unit: "/s" + }, + { + title: `Forest Size`, + modifier: totalTrees, + base: 10, + visible: researchUpgrade2.bought + } + ]); + const showModifiersModal = ref(false); + const modifiersModal = jsx(() => ( + (showModifiersModal.value = value)} + v-slots={{ + header: () =>

{name} Modifiers

, + body: generalTab + }} + /> + )); + + globalBus.on("update", diff => { + if (Decimal.lt(main.day.value, day)) { + return; + } + + if (Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value)) { + manualCutProgress.value = computedManualCuttingCooldown.value; + } else { + manualCutProgress.value = Decimal.add(manualCutProgress.value, diff); + if (cutTree.isHolding.value) { + cutTree.onClick(); + } + } + if (Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value)) { + manualPlantProgress.value = computedManualPlantingCooldown.value; + } else { + manualPlantProgress.value = Decimal.add(manualPlantProgress.value, diff); + if (plantTree.isHolding.value) { + plantTree.onClick(); + } + } + + const plantingAmount = Decimal.sub( + computedAutoPlantingAmount.value, + Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0) + ); + const cuttingAmount = Decimal.sub( + computedAutoCuttingAmount.value, + Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0) + ); + lastAutoPlantedAmount.value = Decimal.isNaN(plantingAmount) ? 0 : plantingAmount; + lastAutoCuttingAmount.value = Decimal.isNaN(cuttingAmount) ? 0 : cuttingAmount; + + const amountCut = Decimal.min( + trees.value, + Decimal.times(computedAutoCuttingAmount.value, diff) + ); + const logsGained = Decimal.mul(logGain.apply(1), amountCut); + + const effectiveLogsGained = Decimal.div(logsGained, diff); + ema.value = Decimal.mul(effectiveLogsGained, SMOOTHING_FACTOR).add( + Decimal.mul(ema.value, Decimal.dOne.sub(SMOOTHING_FACTOR)) + ); + + logs.value = Decimal.add(logs.value, logsGained); + saplings.value = Decimal.add(saplings.value, amountCut); + + const amountPlanted = Decimal.min( + saplings.value, + Decimal.times(computedAutoPlantingAmount.value, diff) + ); + saplings.value = Decimal.sub(saplings.value, amountPlanted); + }); + + const netSaplingGain = computed(() => + Decimal.sub(computedAutoCuttingAmount.value, computedAutoPlantingAmount.value) + ); + const netTreeGain = computed(() => + Decimal.sub(computedAutoPlantingAmount.value, computedAutoCuttingAmount.value) + ); + + const cutTreeHK = createHotkey(() => ({ + key: "c", + description: 'Press the "Cut trees" button.', + onPress: () => { + if (cutTree.canClick.value) cutTree.onClick(); + } + })); + const plantTreeHK = createHotkey(() => ({ + key: "p", + description: 'Press the "Plant trees" button.', + onPress: () => { + if (plantTree.canClick.value) plantTree.onClick(); + } + })); + + const { total: totalLogs, trackerDisplay } = setUpDailyProgressTracker({ + resource: logs, + goal: 1e4, + name, + day, + color: colorDark, + modal: { + show: showModifiersModal, + display: modifiersModal + } + }); + + return { + name, + color: colorBright, + logs, + totalLogs, + trees, + saplings, + cutTree, + plantTree, + cutTreeHK, + plantTreeHK, + row1Upgrades, + row2Upgrades, + row1Buyables, + manualCutProgress, + manualPlantProgress, + generalTabCollapsed, + computedAutoCuttingAmount, + minWidth: 700, + display: jsx(() => ( + <> + {render(trackerDisplay)} + + equilibrium: +${formatLimit( + [ + [computedAutoCuttingAmount.value, "cutting speed"], + [computedAutoPlantingAmount.value, "planting speed"], + [Decimal.mul(computedTotalTrees.value, 20), "forest cap"] + ], + "/s", + logGain.apply(1) + )}` + : undefined + } + /> + + + + {renderRow(cutTree, plantTree)} +
Tip: You can hold down on actions to perform them automatically
+ + {renderGrid(row1Upgrades, row2Upgrades)} + + {renderRow(...row1Buyables)} + + )), + minimizedDisplay: jsx(() => ( +
+ {name} - {format(logs.value)} {logs.displayName} +
+ )) + }; +}); + +export default layer; From 9e17c4ce39f02b8cd7a8e2f0f3e26e0fa4c21a8c Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:13:44 +0000 Subject: [PATCH 12/27] do toy stuff? --- src/data/layers/toys.tsx | 765 ++------------------------------------- 1 file changed, 22 insertions(+), 743 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 81d5805..1beb8ab 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -48,654 +48,19 @@ const layer = createLayer(id, function (this: BaseLayer) { const colorBright = "#4BDC13"; const colorDark = "green"; - const logs = createResource(0, "logs"); - // Think of saplings as spent trees - const saplings = createResource(0, "saplings"); - - const ema = ref(0); - - const lastAutoCuttingAmount = ref(0); - const lastAutoPlantedAmount = ref(0); - - const totalTrees = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: () => Decimal.times(expandingForestBuyable.amount.value, 10), - description: "Expand Forest", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 2), - description: "75% Foundation Completed", - enabled: workshop.milestones.morePlantsMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "5 Elves Trained", - enabled: elves.milestones[4].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "8 Elves Trained", - enabled: elves.milestones[7].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Boots", - enabled: cloth.treesUpgrades.treesUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: dyes.boosts.blue1, - description: "Blue Dye Boost 1", - enabled: () => Decimal.gte(dyes.dyes.blue.amount.value, 1) - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.pow(computedManualCuttingAmount.value, 0.99), - description: "Hope Level 1", - enabled: management.elfTraining.expandersElfTraining.milestones[0].earned - })) - ]) as WithRequired; - const trees = createResource( - computed(() => Decimal.sub(totalTrees.apply(10), saplings.value)), - "trees" - ); - const computedTotalTrees = computed(() => totalTrees.apply(10)); - - const manualCutUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 10, - display: { - title: "Wooden Fingers", - description: "Cut down an additional tree per click" - } - })); - const manualPlantUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 10, - display: { - title: "Leafy Fingers", - description: "Plant an additional tree per click" - } - })); - const autoCutUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 25, - display: { - title: "Automated Knives", - description: "Cut down a tree every second" - } - })); - const autoPlantUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 25, - display: { - title: "Automated Spade", - description: "Plant a tree every second" - } - })); - const researchUpgrade1 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 40, - display: { - title: "Research I", - description: "Trees give 25% more logs, and unlock more upgrades" - } - })); - const row1Upgrades = [ - manualCutUpgrade1, - manualPlantUpgrade1, - autoCutUpgrade1, - autoPlantUpgrade1, - researchUpgrade1 - ]; - - const manualCutUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 50, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Sharper Fingers", - description: "Manually cut trees twice as often" - } - })); - const manualPlantUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 50, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Greener Fingers", - description: "Manually Plant trees twice as often" - } - })); - const manualCutUpgrade3 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 150, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Smart Knives", - description: - "Each time you manually chop trees, gain 1s of automatic tree chopping production" - } - })); - const manualPlantUpgrade3 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 150, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Smart Spades", - description: - "Each time you manually plant trees, gain 1s of automatic tree planting production" - } - })); - const researchUpgrade2 = createUpgrade(() => ({ - resource: noPersist(logs), - cost: 300, - visibility: () => showIf(researchUpgrade1.bought.value), - display: { - title: "Research II", - description: "Trees give 25% more logs, and unlock repeatable purchases" - } - })); - const row2Upgrades = [ - manualCutUpgrade2, - manualPlantUpgrade2, - manualCutUpgrade3, - manualPlantUpgrade3, - researchUpgrade2 - ]; - - const autoCuttingBuyable1 = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); - if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); - if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); - if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); - v = Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value).times(v); - return Decimal.times(100, v).add(200); - }, - inverseCost(x: DecimalSource) { - let v = Decimal.sub(x, 200).div(100); - v = v.div(Decimal.pow(0.95, paper.books.cuttersBook.totalAmount.value)); - if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); - if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); - if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); - if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Generic Cutters", - description: "Each cutter cuts down 1 tree/s" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const autoPlantingBuyable1 = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 50)) v = Decimal.pow(v, 2).div(50); - if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); - if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); - if (Decimal.gte(v, 2e30)) v = Decimal.pow(v, 10).div(Decimal.pow(2e30, 9)); - v = Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value).times(v); - let cost = Decimal.times(100, v).add(200); - if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { - cost = Decimal.div(cost, 10); - } - return cost; - }, - inverseCost(x: DecimalSource) { - if (management.elfTraining.planterElfTraining.milestones[3].earned.value) { - x = Decimal.mul(x, 10); - } - let v = Decimal.sub(x, 200).div(100); - v = v.div(Decimal.pow(0.95, paper.books.plantersBook.totalAmount.value)); - if (Decimal.gte(v, 2e30)) v = Decimal.mul(v, Decimal.pow(2e30, 9)).root(10); - if (Decimal.gte(v, 2e6)) v = Decimal.mul(v, 2e6).root(2); - if (Decimal.gte(v, 200)) v = Decimal.mul(v, 200).root(2); - if (Decimal.gte(v, 50)) v = Decimal.mul(v, 50).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Generic Planters", - description: "Each planter plants 0.5 trees/s" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const expandingForestBuyable = createBuyable(() => ({ - resource: noPersist(logs), - cost() { - let v = this.amount.value; - if (Decimal.gte(v, 100)) v = Decimal.pow(v, 2).div(100); - if (Decimal.gte(v, 1e5)) v = Decimal.pow(v, 2).div(1e5); - if (Decimal.gte(v, 1e15)) v = Decimal.pow(v, 10).div(1e135); - v = Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value).times(v); - return Decimal.pow(Decimal.add(v, 1), 1.5).times(500); - }, - inverseCost(x: DecimalSource) { - let v = Decimal.div(x, 500).root(1.5).sub(1); - v = v.div(Decimal.pow(0.95, paper.books.expandersBook.totalAmount.value)); - if (Decimal.gte(v, 1e15)) v = Decimal.mul(v, 1e135).root(10); - if (Decimal.gte(v, 1e5)) v = Decimal.mul(v, 1e5).root(2); - if (Decimal.gte(v, 100)) v = Decimal.mul(v, 100).root(2); - return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); - }, - display: { - title: "Expand Forest", - description: "Add 10 trees to the forest" - }, - visibility: () => showIf(researchUpgrade2.bought.value) - })) as ElfBuyable & { display: { title: string }; resource: Resource }; - const row1Buyables = [autoCuttingBuyable1, autoPlantingBuyable1, expandingForestBuyable]; - - const manualCuttingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Wooden Fingers", - enabled: manualCutUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: computedAutoCuttingAmount, - description: "Smart Knives", - enabled: manualCutUpgrade3.bought - })) + const toys = createResource(0, "toys"); + const toys2 = createResource(0, "toys2"); + const toys3 = createResource(0, "toys3"); + const toyGain = createSequentialModifier(() => [ + ]); - const computedManualCuttingAmount = computed(() => manualCuttingAmount.apply(1)); - const manualCuttingCooldown = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 0.5, - description: "Sharper Fingers", - enabled: manualCutUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(0.5, elves.totalElves.value), - description: "1 Elf Trained", - enabled: elves.milestones[0].earned - })) - ]); - const computedManualCuttingCooldown = computed(() => manualCuttingCooldown.apply(1)); - - const autoCuttingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Automated Knives", - enabled: autoCutUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: autoCuttingBuyable1.amount, - description: "Generic Cutters", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 5).floor(), - description: "10% Foundation Completed", - enabled: workshop.milestones.autoCutMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "30% Foundation Completed", - enabled: workshop.milestones.autoCutMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Warmer Cutters", - enabled: coal.warmerCutters.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedHeatedCutterEffect, - description: "Heated Cutters", - enabled: () => Decimal.gt(coal.heatedCutters.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Jeans", - enabled: cloth.treesUpgrades.treesUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(1.1, main.day.value), - description: "Holly Level 4", - enabled: management.elfTraining.cutterElfTraining.milestones[3].earned - })), - createAdditiveModifier(() => ({ - addend: () => - Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0), - description: "Ivy Level 5", - enabled: management.elfTraining.planterElfTraining.milestones[4].earned - })) - ]) as WithRequired; - const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); - - const manualPlantingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Leafy Fingers", - enabled: manualPlantUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: computedAutoPlantingAmount, - description: "Smart Spades", - enabled: manualPlantUpgrade3.bought - })) - ]); - const computedManualPlantingAmount = computed(() => manualPlantingAmount.apply(1)); - const manualPlantingCooldown = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 0.5, - description: "Greener Fingers", - enabled: manualPlantUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(0.5, elves.totalElves.value), - description: "1 Elf Trained", - enabled: elves.milestones[0].earned - })) - ]); - const computedManualPlantingCooldown = computed(() => manualPlantingCooldown.apply(1)); - - const autoPlantingAmount = createSequentialModifier(() => [ - createAdditiveModifier(() => ({ - addend: 1, - description: "Automated Spade", - enabled: autoPlantUpgrade1.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(autoPlantingBuyable1.amount.value, 2), - description: "Generic Planters", - enabled: researchUpgrade2.bought - })), - createAdditiveModifier(() => ({ - addend: () => Decimal.div(workshop.foundationProgress.value, 10).floor(), - description: "20% Foundation Completed", - enabled: workshop.milestones.autoPlantMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "40% Foundation Completed", - enabled: workshop.milestones.autoPlantMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Warmer Planters", - enabled: coal.warmerPlanters.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedHeatedPlanterEffect, - description: "Heated Planters", - enabled: () => Decimal.gt(coal.heatedPlanters.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 4, - description: "Lumberjack Plaid", - enabled: cloth.treesUpgrades.treesUpgrade3.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Ivy Level 1", - enabled: management.elfTraining.planterElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.pow(trees.value, 0.2).max(1).log10().pow_base(2), - description: "Ivy Level 3", - enabled: management.elfTraining.planterElfTraining.milestones[2].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Mary Level 4", - enabled: management.elfTraining.heatedPlanterElfTraining.milestones[3].earned - })), - createAdditiveModifier(() => ({ - addend: () => - Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0), - description: "Ivy Level 5", - enabled: management.elfTraining.planterElfTraining.milestones[4].earned - })) - ]) as WithRequired; - const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); - - const logGain = createSequentialModifier(() => [ - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Research I", - enabled: researchUpgrade1.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Research II", - enabled: researchUpgrade2.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => - workshop.milestones.extraExpansionMilestone1.earned.value - ? Decimal.pow(1.02, workshop.foundationProgress.value) - : Decimal.div(workshop.foundationProgress.value, 20).add(1), - description: "1% Foundation Completed", - enabled: workshop.milestones.logGainMilestone1.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "50% Foundation Completed", - enabled: workshop.milestones.logGainMilestone2.earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 1.25, - description: "Ashy Soil", - enabled: coal.basicFertilizer.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: coal.computedFertilizerEffect, - description: "Fertilized Soil", - enabled: () => Decimal.gt(coal.moreFertilizer.amount.value, 0) - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "4 Elves Trained", - enabled: elves.milestones[3].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: 2, - description: "Carry logs in boxes", - enabled: boxes.upgrades.logsUpgrade.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.div(boxes.buyables.logBoxesBuyable.amount.value, 2).add(1), - description: "Carry more logs", - enabled: boxes.upgrades.logsUpgrade.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: 10, - description: "Felt-Gripped Axe", - enabled: cloth.treesUpgrades.treesUpgrade4.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: computed(() => - Decimal.add(computedAutoCuttingAmount.value, 1).log10().plus(1) - ), - description: "Is Blue Dye just Water?", - enabled: dyes.upgrades.blueDyeUpg.bought - })), - createMultiplicativeModifier(() => ({ - multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(9)), - description: "Holly Level 1", - enabled: management.elfTraining.cutterElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: () => Decimal.sqrt(management.totalElfLevels.value), - description: "Noel Level 1", - enabled: management.elfTraining.fertilizerElfTraining.milestones[0].earned - })), - createMultiplicativeModifier(() => ({ - multiplier: wrappingPaper.boosts.christmas1, - description: "Christmas Wrapping Paper", - enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) - })), - createExponentialModifier(() => ({ - exponent: 1.2, - description: "100% Foundation Completed", - enabled: workshop.milestones.logGainMilestone3.earned - })), - createExponentialModifier(() => ({ - exponent: 1.05, - description: "Un-Processing", - enabled: paper.upgrades2.treeUpgrade.bought - })) - ]); - - const manualCutProgress = persistent(0); - const manualCutProgressBar = createBar(() => ({ - direction: Direction.Right, - width: 100, - height: 10, - style: "margin-top: 8px", - baseStyle: "margin-top: -1px", - fillStyle: "margin-top: -1px; transition-duration: 0s", - progress: () => Decimal.div(manualCutProgress.value, computedManualCuttingCooldown.value) - })); - - const cutTree = createClickable(() => ({ - display: { - title: "Cut trees", - description: jsx(() => ( - <> - Cut down up to {formatWhole(Decimal.floor(computedManualCuttingAmount.value))}{" "} - tree - {Decimal.eq(computedManualCuttingAmount.value, 1) ? "" : "s"} at once! -
- {render(manualCutProgressBar)} - - )) - }, - style: { - minHeight: "80px" - }, - canClick: () => - Decimal.gte(trees.value, 1) && - Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value), - onClick() { - if (Decimal.lt(manualCutProgress.value, computedManualCuttingCooldown.value)) { - return; - } - const amount = Decimal.floor( - Decimal.min( - trees.value, - Decimal.times( - computedManualCuttingAmount.value, - Decimal.div( - manualCutProgress.value, - computedManualCuttingCooldown.value - ).floor() - ) - ) - ); - logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount)); - saplings.value = Decimal.add(saplings.value, amount); - manualCutProgress.value = 0; - } - })); - - const manualPlantProgress = persistent(0); - const manualPlantProgressBar = createBar(() => ({ - direction: Direction.Right, - width: 100, - height: 10, - style: "margin-top: 8px", - baseStyle: "margin-top: -1px", - fillStyle: "margin-top: -1px; transition-duration: 0s", - progress: () => Decimal.div(manualPlantProgress.value, computedManualPlantingCooldown.value) - })); - const plantTree = createClickable(() => ({ - display: { - title: "Plant trees", - description: jsx(() => ( - <> - Plant up to {formatWhole(Decimal.floor(computedManualPlantingAmount.value))}{" "} - tree - {Decimal.eq(computedManualPlantingAmount.value, 1) ? "" : "s"} at once! -
- {render(manualPlantProgressBar)} - - )) - }, - style: { - minHeight: "80px" - }, - canClick: () => - Decimal.gte(saplings.value, 1) && - Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value), - onClick() { - if (Decimal.lt(manualPlantProgress.value, computedManualPlantingCooldown.value)) { - return; - } - const amount = Decimal.floor( - Decimal.min( - saplings.value, - Decimal.times( - computedManualPlantingAmount.value, - Decimal.div( - manualPlantProgress.value, - computedManualPlantingCooldown.value - ).floor() - ) - ) - ); - saplings.value = Decimal.sub(saplings.value, amount); - manualPlantProgress.value = 0; - } - })); const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ - { - title: "Logs per Tree", - modifier: logGain, + { + title: `Toy Gain`, + modifier: toyGain, base: 1, - visible: researchUpgrade1.bought - }, - { - title: "Manual Cutting Amount", - modifier: manualCuttingAmount, - base: 1, - visible: manualCutUpgrade1.bought, - unit: "/click" - }, - { - title: "Manual Cutting Cooldown", - modifier: manualCuttingCooldown, - base: 1, - visible: manualCutUpgrade1.bought, - unit: "s" - }, - { - title: "Manual Planting Amount", - modifier: manualPlantingAmount, - base: 1, - visible: manualPlantUpgrade1.bought, - unit: "/click" - }, - { - title: "Manual Planting Cooldown", - modifier: manualPlantingCooldown, - base: 1, - visible: manualPlantUpgrade1.bought, - unit: "s" - }, - { - title: `Auto Cutting Amount`, - modifier: autoCuttingAmount, - base: 0, - visible: autoCutUpgrade1.bought, - unit: "/s" - }, - { - title: `Auto Planting Amount`, - modifier: autoPlantingAmount, - base: 0, - visible: autoPlantUpgrade1.bought, - unit: "/s" - }, - { - title: `Forest Size`, - modifier: totalTrees, - base: 10, - visible: researchUpgrade2.bought + visible: true } ]); const showModifiersModal = ref(false); @@ -715,79 +80,12 @@ const layer = createLayer(id, function (this: BaseLayer) { return; } - if (Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value)) { - manualCutProgress.value = computedManualCuttingCooldown.value; - } else { - manualCutProgress.value = Decimal.add(manualCutProgress.value, diff); - if (cutTree.isHolding.value) { - cutTree.onClick(); - } - } - if (Decimal.gte(manualPlantProgress.value, computedManualPlantingCooldown.value)) { - manualPlantProgress.value = computedManualPlantingCooldown.value; - } else { - manualPlantProgress.value = Decimal.add(manualPlantProgress.value, diff); - if (plantTree.isHolding.value) { - plantTree.onClick(); - } - } - - const plantingAmount = Decimal.sub( - computedAutoPlantingAmount.value, - Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0) - ); - const cuttingAmount = Decimal.sub( - computedAutoCuttingAmount.value, - Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0) - ); - lastAutoPlantedAmount.value = Decimal.isNaN(plantingAmount) ? 0 : plantingAmount; - lastAutoCuttingAmount.value = Decimal.isNaN(cuttingAmount) ? 0 : cuttingAmount; - - const amountCut = Decimal.min( - trees.value, - Decimal.times(computedAutoCuttingAmount.value, diff) - ); - const logsGained = Decimal.mul(logGain.apply(1), amountCut); - - const effectiveLogsGained = Decimal.div(logsGained, diff); - ema.value = Decimal.mul(effectiveLogsGained, SMOOTHING_FACTOR).add( - Decimal.mul(ema.value, Decimal.dOne.sub(SMOOTHING_FACTOR)) - ); - - logs.value = Decimal.add(logs.value, logsGained); - saplings.value = Decimal.add(saplings.value, amountCut); - - const amountPlanted = Decimal.min( - saplings.value, - Decimal.times(computedAutoPlantingAmount.value, diff) - ); - saplings.value = Decimal.sub(saplings.value, amountPlanted); + }); - const netSaplingGain = computed(() => - Decimal.sub(computedAutoCuttingAmount.value, computedAutoPlantingAmount.value) - ); - const netTreeGain = computed(() => - Decimal.sub(computedAutoPlantingAmount.value, computedAutoCuttingAmount.value) - ); - const cutTreeHK = createHotkey(() => ({ - key: "c", - description: 'Press the "Cut trees" button.', - onPress: () => { - if (cutTree.canClick.value) cutTree.onClick(); - } - })); - const plantTreeHK = createHotkey(() => ({ - key: "p", - description: 'Press the "Plant trees" button.', - onPress: () => { - if (plantTree.canClick.value) plantTree.onClick(); - } - })); - - const { total: totalLogs, trackerDisplay } = setUpDailyProgressTracker({ - resource: logs, + const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ + resource: toys, goal: 1e4, name, day, @@ -801,32 +99,20 @@ const layer = createLayer(id, function (this: BaseLayer) { return { name, color: colorBright, - logs, - totalLogs, - trees, - saplings, - cutTree, - plantTree, - cutTreeHK, - plantTreeHK, - row1Upgrades, - row2Upgrades, - row1Buyables, - manualCutProgress, - manualPlantProgress, + toys, + totalToys, generalTabCollapsed, - computedAutoCuttingAmount, minWidth: 700, display: jsx(() => ( <> {render(trackerDisplay)} equilibrium: +${formatLimit( [ [computedAutoCuttingAmount.value, "cutting speed"], @@ -836,33 +122,26 @@ const layer = createLayer(id, function (this: BaseLayer) { "/s", logGain.apply(1) )}` - : undefined + : */undefined } /> - - {renderRow(cutTree, plantTree)} -
Tip: You can hold down on actions to perform them automatically
- - {renderGrid(row1Upgrades, row2Upgrades)} - - {renderRow(...row1Buyables)} )), minimizedDisplay: jsx(() => (
- {name} - {format(logs.value)} {logs.displayName} + {name} - {format(toys.value)} {toys.displayName}
)) }; From 4408a20f2ed4d033f8c6c982d282bdc2f949f74f Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:17:18 +0000 Subject: [PATCH 13/27] add toys to advent --- src/data/layers/toys.tsx | 3 --- src/data/projEntry.tsx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 1beb8ab..f73457c 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -40,9 +40,6 @@ import wrappingPaper from "./wrapping-paper"; const id = "toys"; const day = 17; -// how much to prioritize this' income -// vs the previous ones -const SMOOTHING_FACTOR = 0.1; const layer = createLayer(id, function (this: BaseLayer) { const name = "Toys"; const colorBright = "#4BDC13"; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 4623bdc..eb76f72 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -406,7 +406,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 17, shouldNotify: false, - layer: null, // "toys 1" + layer: "toys 1", // "toys 1" symbol: "", story: "", completedStory: "", From 468c650baa9564c5689a888db24b67a6c1466100 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 00:43:22 +0000 Subject: [PATCH 14/27] fix toy thing --- src/data/layers/toys.tsx | 2 +- src/data/projEntry.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index f73457c..e60c0d3 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -41,7 +41,7 @@ const id = "toys"; const day = 17; const layer = createLayer(id, function (this: BaseLayer) { - const name = "Toys"; + const name = "toys"; const colorBright = "#4BDC13"; const colorDark = "green"; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index eb76f72..6f5c24a 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -406,7 +406,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 17, shouldNotify: false, - layer: "toys 1", // "toys 1" + layer: "toys", // "toys1" symbol: "", story: "", completedStory: "", @@ -415,7 +415,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 18, shouldNotify: false, - layer: null, // "toys 2" + layer: null, // "toys2" symbol: "", story: "", completedStory: "", @@ -424,7 +424,7 @@ export const main = createLayer("main", function (this: BaseLayer) { createDay(() => ({ day: 19, shouldNotify: false, - layer: null, // "toys 3" + layer: null, // "toys3" symbol: "", story: "", completedStory: "", From dc1c9d48c95acd7ce8872ea1faa6b31bc530f4fc Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 01:10:07 +0000 Subject: [PATCH 15/27] fix toy sum --- src/data/layers/toys.tsx | 26 ++++++++++++++------------ src/data/projEntry.tsx | 8 ++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index e60c0d3..77ecec7 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -41,17 +41,17 @@ const id = "toys"; const day = 17; const layer = createLayer(id, function (this: BaseLayer) { - const name = "toys"; + const name = "Toys"; const colorBright = "#4BDC13"; const colorDark = "green"; - const toys = createResource(0, "toys"); - const toys2 = createResource(0, "toys2"); - const toys3 = createResource(0, "toys3"); + const clothes = createResource(0, "clothes"); + const teddybears = createResource(0, " teddy bears"); + const trains = createResource(0, "trains"); const toyGain = createSequentialModifier(() => [ - - ]); + ]); + const toySum = createResource(computed(() => Decimal.add(clothes.value, teddybears.value).add(trains.value)), "toy sum") const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -82,7 +82,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ - resource: toys, + resource: toySum, goal: 1e4, name, day, @@ -95,8 +95,10 @@ const layer = createLayer(id, function (this: BaseLayer) { return { name, + day, color: colorBright, - toys, + clothes, + teddybears, totalToys, generalTabCollapsed, minWidth: 700, @@ -105,7 +107,7 @@ const layer = createLayer(id, function (this: BaseLayer) { {render(trackerDisplay)} (
- {name} - {format(toys.value)} {toys.displayName} + {name} - {format(toySum.value)} {"total toys"}
)) }; diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 6f5c24a..aa8dc5f 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -33,7 +33,11 @@ import plastic from "./layers/plastic"; import trees from "./layers/trees"; import workshop from "./layers/workshop"; import wrappingPaper from "./layers/wrapping-paper"; +<<<<<<< HEAD import ribbon from "./layers/ribbon"; +======= +import toys from "./layers/toys"; +>>>>>>> fix toy sum import boxesSymbol from "./symbols/cardboardBox.png"; import clothSymbol from "./symbols/cloth.png"; import coalSymbol from "./symbols/coal.png"; @@ -575,8 +579,12 @@ export const getInitialLayers = ( dyes, management, letters, +<<<<<<< HEAD wrappingPaper, ribbon +======= + toys, +>>>>>>> fix toy sum ]; /** From 0e13e7e2d1ba9e27282e5788c1f10bddb952cb19 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 01:14:51 +0000 Subject: [PATCH 16/27] rename teddy bears and trains --- src/data/layers/toys.tsx | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 77ecec7..9f62fdb 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -46,12 +46,12 @@ const layer = createLayer(id, function (this: BaseLayer) { const colorDark = "green"; const clothes = createResource(0, "clothes"); - const teddybears = createResource(0, " teddy bears"); - const trains = createResource(0, "trains"); + const woodenBlocks = createResource(0, " wooden blocks"); + const trucks = createResource(0, "trucks"); const toyGain = createSequentialModifier(() => [ ]); - const toySum = createResource(computed(() => Decimal.add(clothes.value, teddybears.value).add(trains.value)), "toy sum") + const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toy sum") const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -83,7 +83,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 1e4, + goal: 8e9, name, day, color: colorDark, @@ -98,7 +98,7 @@ const layer = createLayer(id, function (this: BaseLayer) { day, color: colorBright, clothes, - teddybears, + woodenBlocks, totalToys, generalTabCollapsed, minWidth: 700, @@ -110,28 +110,16 @@ const layer = createLayer(id, function (this: BaseLayer) { resource={clothes} color={colorBright} style="margin-bottom: 0" - productionDisplay={ - /*Decimal.gt(computedAutoCuttingAmount.value, 0) - ? `+${format(ema.value)}/s average
equilibrium: +${formatLimit( - [ - [computedAutoCuttingAmount.value, "cutting speed"], - [computedAutoPlantingAmount.value, "planting speed"], - [Decimal.mul(computedTotalTrees.value, 20), "forest cap"] - ], - "/s", - logGain.apply(1) - )}` - : */undefined - } + productionDisplay={undefined} /> Date: Fri, 16 Dec 2022 01:51:10 +0000 Subject: [PATCH 17/27] add buyable costs --- src/data/layers/toys.tsx | 117 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 7 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 9f62fdb..3c49feb 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -28,15 +28,12 @@ import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } import { Direction, WithRequired } from "util/common"; import { render, renderGrid, renderRow } from "util/vue"; import { computed, ref } from "vue"; -import boxes from "./boxes"; +import metal from "./metal"; +import plastic from "./plastic"; import cloth from "./cloth"; -import coal from "./coal"; +import trees from "./trees"; import dyes from "./dyes"; -import elves, { ElfBuyable } from "./elves"; -import management from "./management"; import paper from "./paper"; -import workshop from "./workshop"; -import wrappingPaper from "./wrapping-paper"; const id = "toys"; const day = 17; @@ -51,7 +48,108 @@ const layer = createLayer(id, function (this: BaseLayer) { const toyGain = createSequentialModifier(() => [ ]); - const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toy sum") + const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toys"); + + const clothesCost = computed(() => { + const clothFactor = Decimal.add(1,clothesBuyable.amount.value); + return { + cloth: clothFactor.mul(1e8), + dye: clothFactor.mul(1e6) + }; + }); + const clothesBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Clothes

+ +
+ Click this buyable to make some clothes! +
+ +
+ You have {formatWhole(clothes.value)} clothes. +
+ +
+ Costs {format(clothesCost.value.cloth)} cloth and requires {format(clothesCost.value.dye)} of red, yellow, and + blue dye +
+ + )), + canPurchase(): boolean { + return ( + clothesCost.value.cloth.lte(cloth.cloth.value) && + clothesCost.value.dye.lte(dyes.dyes.blue.amount.value) && + clothesCost.value.dye.lte(dyes.dyes.red.amount.value) && + clothesCost.value.dye.lte(dyes.dyes.yellow.amount.value) + ); + }, + })) as GenericBuyable; + const woodenBlocksCost = computed(() => { + const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + return { + wood: woodFactor.mul(1e40) + }; + }); + const woodenBlocksBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Wooden Blocks

+ +
+ Click this buyable to make some wooden blocks! +
+ +
+ You have {formatWhole(woodenBlocks.value)} wooden blocks. +
+ +
+ Costs {format(woodenBlocksCost.value.wood)} logs +
+ + )), + canPurchase(): boolean { + return ( + woodenBlocksCost.value.wood.lte(trees.logs.value) + ); + }, + })) as GenericBuyable; + const trucksCost = computed(() => { + const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); + const plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + return { + metal: factor.mul(1e25), + plastic: plasticFactor.mul(1e10) + + }; + }); + const trucksBuyable = createBuyable(() => ({ + display: jsx(() => ( + <> +

Make Trucks

+ +
+ Click this buyable to make some trucks! +
+ +
+ You have {formatWhole(woodenBlocks.value)} wooden blocks. +
+ +
+ Costs {format(trucksCost.value.metal)} metal and {format(trucksCost.value.plastic)} plastic +
+ + )), + canPurchase(): boolean { + return ( + trucksCost.value.metal.lte(metal.metal.value) && + trucksCost.value.plastic.lte(plastic.plastic.value) + ); + }, + })) as GenericBuyable; + const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -99,7 +197,10 @@ const layer = createLayer(id, function (this: BaseLayer) { color: colorBright, clothes, woodenBlocks, + trucks, + toySum, totalToys, + buyables, generalTabCollapsed, minWidth: 700, display: jsx(() => ( @@ -124,6 +225,8 @@ const layer = createLayer(id, function (this: BaseLayer) { style="margin-bottom: 0" productionDisplay={undefined} /> + + {renderRow(...buyables)} )), minimizedDisplay: jsx(() => ( From 477ebaa6214b1d45f8ea17e28bda4b83114b4005 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 02:07:19 +0000 Subject: [PATCH 18/27] milestone --- src/data/layers/toys.tsx | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 3c49feb..3fb5825 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -4,14 +4,19 @@ */ import Spacer from "components/layout/Spacer.vue"; import Modal from "components/Modal.vue"; -import { createCollapsibleModifierSections, setUpDailyProgressTracker } from "data/common"; import { main } from "data/projEntry"; import { createBar } from "features/bars/bar"; +import { + createCollapsibleMilestones, + createCollapsibleModifierSections, + setUpDailyProgressTracker +} from "data/common"; import { createBuyable, GenericBuyable } from "features/buyable"; import { createClickable } from "features/clickables/clickable"; import { jsx, showIf } from "features/feature"; import { createHotkey } from "features/hotkey"; import MainDisplay from "features/resources/MainDisplay.vue"; +import { createMilestone } from "features/milestones/milestone"; import { createResource, Resource } from "features/resources/resource"; import { createUpgrade } from "features/upgrades/upgrade"; import { globalBus } from "game/events"; @@ -84,6 +89,11 @@ const layer = createLayer(id, function (this: BaseLayer) { clothesCost.value.dye.lte(dyes.dyes.yellow.amount.value) ); }, + onPurchase() { + cloth.cloth.value = Decimal.sub(cloth.cloth.value, clothesCost.value.cloth); + this.amount.value = Decimal.add(this.amount.value, 1); + clothes.value = this.amount.value + }, })) as GenericBuyable; const woodenBlocksCost = computed(() => { const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); @@ -114,6 +124,11 @@ const layer = createLayer(id, function (this: BaseLayer) { woodenBlocksCost.value.wood.lte(trees.logs.value) ); }, + onPurchase() { + trees.logs.value = Decimal.sub(trees.logs.value, woodenBlocksCost.value.wood); + this.amount.value = Decimal.add(this.amount.value, 1); + woodenBlocks.value = this.amount.value + }, })) as GenericBuyable; const trucksCost = computed(() => { const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); @@ -148,8 +163,25 @@ const layer = createLayer(id, function (this: BaseLayer) { trucksCost.value.plastic.lte(plastic.plastic.value) ); }, + onPurchase() { + metal.metal.value = Decimal.sub(metal.metal.value, trucksCost.value.metal); + plastic.plastic.value = Decimal.sub(plastic.plastic.value, trucksCost.value.plastic); + this.amount.value = Decimal.add(this.amount.value, 1); + trucks.value = this.amount.value + }, })) as GenericBuyable; const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; + const milestone1 = createMilestone(() => ({ + display: { + requirement: "10 toys", + effectDisplay: "The number of complete workshops you have divides the cost to make toys." + }, + shouldEarn: () => Decimal.gte(toySum.value, 10) + })); +const milestones = {milestone1} +const { collapseMilestones, display: milestonesDisplay } = + createCollapsibleMilestones(milestones); + const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ { title: `Toy Gain`, @@ -201,7 +233,9 @@ const layer = createLayer(id, function (this: BaseLayer) { toySum, totalToys, buyables, + milestones, generalTabCollapsed, + collapseMilestones, minWidth: 700, display: jsx(() => ( <> @@ -227,6 +261,8 @@ const layer = createLayer(id, function (this: BaseLayer) { /> {renderRow(...buyables)} + + {milestonesDisplay()} )), minimizedDisplay: jsx(() => ( From d412b09c2ad78d06fd3652814039604074b8fb64 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 02:37:37 +0000 Subject: [PATCH 19/27] Implement milestone 1 --- src/data/layers/toys.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 3fb5825..0c5a202 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -39,6 +39,7 @@ import cloth from "./cloth"; import trees from "./trees"; import dyes from "./dyes"; import paper from "./paper"; +import workshop from "./workshop"; const id = "toys"; const day = 17; @@ -56,7 +57,10 @@ const layer = createLayer(id, function (this: BaseLayer) { const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toys"); const clothesCost = computed(() => { - const clothFactor = Decimal.add(1,clothesBuyable.amount.value); + var clothFactor = Decimal.add(1,clothesBuyable.amount.value); + if(milestones.milestone1.earned){ + clothFactor=clothFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { cloth: clothFactor.mul(1e8), dye: clothFactor.mul(1e6) @@ -96,7 +100,10 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const woodenBlocksCost = computed(() => { - const woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + var woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); + if(milestones.milestone1.earned){ + woodFactor=woodFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { wood: woodFactor.mul(1e40) }; @@ -131,8 +138,12 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const trucksCost = computed(() => { - const factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); - const plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + var factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); + var plasticFactor = Decimal.add(1,trucksBuyable.amount.value); + if(milestones.milestone1.earned){ + factor=factor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + plasticFactor=plasticFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + } return { metal: factor.mul(1e25), plastic: plasticFactor.mul(1e10) From 2115a8ea78fb6884c2c1b3ecbadc0bd01792403f Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Fri, 16 Dec 2022 03:32:47 +0000 Subject: [PATCH 20/27] finish balancing toys layer --- src/data/layers/dyes.tsx | 53 +++++++++++++++++++++++++++++++- src/data/layers/letters.tsx | 6 ++++ src/data/layers/metal.tsx | 16 +++++++++- src/data/layers/oil.tsx | 5 ++++ src/data/layers/toys.tsx | 58 ++++++++++++++++++++++++++++++++---- src/data/layers/trees.tsx | 7 +++++ src/data/layers/workshop.tsx | 30 +++++++++++++++++-- 7 files changed, 165 insertions(+), 10 deletions(-) diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index 581f183..e6e7fb4 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -34,7 +34,13 @@ import { ElfBuyable } from "./elves"; import management from "./management"; import oil from "./oil"; import paper from "./paper"; +<<<<<<< HEAD import trees from "./trees"; +======= +import boxes from "./boxes"; +import { ElfBuyable } from "./elves"; +import toys from "./toys" +>>>>>>> finish balancing toys layer interface Dye { name: string; @@ -55,7 +61,11 @@ type DyeUpg = | "blueDyeUpg2" | "coalUpg"; +<<<<<<< HEAD export type enumColor = "blue" | "red" | "green" | "yellow" | "purple" | "orange"; +======= +export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black"; +>>>>>>> finish balancing toys layer const id = "dyes"; const day = 11; @@ -487,6 +497,34 @@ const layer = createLayer(id, function (this: BaseLayer) { ], dyesToReset: [] }), + black: createDye({ + name: "Black Dye", + color: "black", + costs: () => [ + { + base: "1e42", + root: 5, + res: trees.logs + }, + { + base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e15" : "2e15")), + root: 2, + res: oil.oil + } + ], + listedBoosts: [ + { + visible: true, + desc: computed( + () => + `*${format( + boosts.black1.value + )} letters processed.` + ) + } + ], + dyesToReset: [] + }), orange: createDye({ name: "Orange Dye", color: "orange", @@ -664,7 +702,12 @@ const layer = createLayer(id, function (this: BaseLayer) { .pow(upgrades.coalUpg.bought.value ? 1.2 : 1) .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) ), - purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)) + purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)), + black1: computed(() => + Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt()) + .pow(upgrades.coalUpg.bought.value ? 1.2 : 1) + .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) + ) }; const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ @@ -683,6 +726,11 @@ const layer = createLayer(id, function (this: BaseLayer) { modifier: dyes.blue.toGenerate, base: 0 }, + { + title: "Black Dye Creation", + modifier: dyes.black.toGenerate, + base: 0 + }, { title: "Orange Dye Creation", modifier: dyes.orange.toGenerate, @@ -913,6 +961,9 @@ const layer = createLayer(id, function (this: BaseLayer) { ) : null}
+ {renderRow(dyes.black.display)} + {renderRow(dyes.black.buyable)} + {renderRow(dyes.red.display, dyes.yellow.display, dyes.blue.display)} {renderRow(dyes.red.buyable, dyes.yellow.buyable, dyes.blue.buyable)} diff --git a/src/data/layers/letters.tsx b/src/data/layers/letters.tsx index efc5364..22c2272 100644 --- a/src/data/layers/letters.tsx +++ b/src/data/layers/letters.tsx @@ -24,6 +24,7 @@ import { createBuyable, GenericBuyable } from "features/buyable"; import metal from "./metal"; import plastic from "./plastic"; import paper from "./paper"; +import dyes from "./dyes"; import SqrtVue from "components/math/Sqrt.vue"; import { globalBus } from "game/events"; import { main } from "data/projEntry"; @@ -214,7 +215,12 @@ const layer = createLayer(id, function (this: BaseLayer) { createMultiplicativeModifier(() => ({ multiplier: () => Decimal.div(paperBuyable.amount.value, 2).add(1), description: "Printed Labels" + })), + createMultiplicativeModifier(() => ({ + multiplier: () => dyes.boosts.black1.value, + description: "Black Dye Boost" })) + ]); const computedLettersGain = computed(() => lettersGain.apply(1)); const processingCooldown = createSequentialModifier(() => [ diff --git a/src/data/layers/metal.tsx b/src/data/layers/metal.tsx index bf9f7c6..6bd90d3 100644 --- a/src/data/layers/metal.tsx +++ b/src/data/layers/metal.tsx @@ -35,7 +35,11 @@ import oil from "./oil"; import paper from "./paper"; import plastic from "./plastic"; import workshop from "./workshop"; +<<<<<<< HEAD import wrappingPaper from "./wrapping-paper"; +======= +import toys from "./toys"; +>>>>>>> finish balancing toys layer const id = "metal"; const day = 7; @@ -207,6 +211,11 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.add(industrialCrucible.amount.value, 1).sqrt(), description: "100,000 Letters Processed", enabled: letters.milestones.industrialCrucibleMilestone.earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.add(toys.clothes.value, 1), + description: "Give elves clothes to wear", + enabled: toys.row1Upgrades[1].bought })) ]); const computedAutoSmeltMulti = computed(() => autoSmeltMulti.apply(1)); @@ -282,7 +291,12 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.add(dyes.dyes.blue.amount.value, 1).sqrt(), description: "1000 Letters Processed", enabled: letters.milestones.miningMilestone.earned - })) + })), + createMultiplicativeModifier(() => ({ + multiplier: () => Decimal.add(toys.clothes.value, 1), + description: "Give elves clothes to wear", + enabled: toys.row1Upgrades[1].bought + })), ]); const computedOreAmount = computed(() => oreAmount.apply(1)); const oreSpeed = createSequentialModifier(() => [ diff --git a/src/data/layers/oil.tsx b/src/data/layers/oil.tsx index 8f5dcc7..40d2000 100644 --- a/src/data/layers/oil.tsx +++ b/src/data/layers/oil.tsx @@ -874,6 +874,11 @@ const layer = createLayer(id, function (this: BaseLayer) { description: "Cocoa Level 3", enabled: management.elfTraining.oilElfTraining.milestones[2].earned })), + createMultiplicativeModifier(() => ({ + multiplier: 4, + description: "Workshop 1200%", + enabled: workshop.milestones.extraExpansionMilestone6.earned + })), createMultiplicativeModifier(() => ({ multiplier: () => coalEffectiveness.value, description: "Effectiveness", diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 0c5a202..e01bd13 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -160,7 +160,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
- You have {formatWhole(woodenBlocks.value)} wooden blocks. + You have {formatWhole(trucks.value)} trucks.
@@ -182,14 +182,51 @@ const layer = createLayer(id, function (this: BaseLayer) { }, })) as GenericBuyable; const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; + const trucksUpgrade1 = createUpgrade(() => ({ + resource: noPersist(trucks), + cost: 10, + display: { + title: "Load logs onto trucks", + description: "Log gain is doubled." + } + })) + const clothesUpgrade1 = createUpgrade(() => ({ + resource: noPersist(clothes), + cost: 30, + display: { + title: "Give elves clothes to wear", + description: "Multiply ore per mining operation and auto-smelt purity by the number of clothes you have." + } + })) + + const woodenBlocksUpgrade1 = createUpgrade(() => ({ + resource: noPersist(woodenBlocks), + cost: 15, + display: { + title: "Build wooden towers", + description: "You can now build 2 extra tall workshops!" + } + })) +const row1Upgrades = [ + trucksUpgrade1, + clothesUpgrade1, + woodenBlocksUpgrade1 + ]; const milestone1 = createMilestone(() => ({ display: { requirement: "10 toys", - effectDisplay: "The number of complete workshops you have divides the cost to make toys." + effectDisplay: "The cost of making toys is divided by the number of complete workshops you have." }, shouldEarn: () => Decimal.gte(toySum.value, 10) })); -const milestones = {milestone1} + const milestone2 = createMilestone(() => ({ + display: { + requirement: "100 toys", + effectDisplay: "Unlock black dyes." + }, + shouldEarn: () => Decimal.gte(toySum.value, 100) + })); +const milestones = {milestone1, milestone2} const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); @@ -217,14 +254,22 @@ const { collapseMilestones, display: milestonesDisplay } = if (Decimal.lt(main.day.value, day)) { return; } - + if (Decimal.lt(clothes.value, clothesBuyable.amount.value)){ + clothesBuyable.amount.value = clothes.value + } + if (Decimal.lt(woodenBlocks.value, woodenBlocksBuyable.amount.value)){ + woodenBlocksBuyable.amount.value = woodenBlocks.value + } + if (Decimal.lt(trucks.value, trucksBuyable.amount.value)){ + trucksBuyable.amount.value = trucks.value + } }); const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 8e9, + goal: 200, name, day, color: colorDark, @@ -244,6 +289,7 @@ const { collapseMilestones, display: milestonesDisplay } = toySum, totalToys, buyables, + row1Upgrades, milestones, generalTabCollapsed, collapseMilestones, @@ -273,6 +319,8 @@ const { collapseMilestones, display: milestonesDisplay } = {renderRow(...buyables)} + {renderGrid(row1Upgrades)} + {milestonesDisplay()} )), diff --git a/src/data/layers/trees.tsx b/src/data/layers/trees.tsx index 7583e26..4a5edc1 100644 --- a/src/data/layers/trees.tsx +++ b/src/data/layers/trees.tsx @@ -38,6 +38,7 @@ import management from "./management"; import paper from "./paper"; import workshop from "./workshop"; import wrappingPaper from "./wrapping-paper"; +import toys from "./toys"; const id = "trees"; const day = 1; @@ -536,9 +537,15 @@ const layer = createLayer(id, function (this: BaseLayer) { enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) })), createMultiplicativeModifier(() => ({ +<<<<<<< HEAD multiplier: () => Decimal.add(computedTotalTrees.value, 1).log10(), description: "Trees Decoration", enabled: masteryEffectActive +======= + multiplier: 2, + description: "Load logs onto trucks", + enabled: toys.row1Upgrades[0].bought +>>>>>>> finish balancing toys layer })), createExponentialModifier(() => ({ exponent: 1.2, diff --git a/src/data/layers/workshop.tsx b/src/data/layers/workshop.tsx index 28edfc9..357875b 100644 --- a/src/data/layers/workshop.tsx +++ b/src/data/layers/workshop.tsx @@ -33,6 +33,7 @@ import elves from "./elves"; import management from "./management"; import trees from "./trees"; import wrappingPaper from "./wrapping-paper"; +import toys from "./toys" const id = "workshop"; const day = 2; @@ -48,7 +49,7 @@ const layer = createLayer(id, function (this: BaseLayer) { scaling: addHardcap( addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5423, 1 / 1e10), 1e20, 3e8), computed(() => - management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 + toys.row1Upgrades[2].bought ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ) ), baseResource: trees.logs, @@ -98,11 +99,12 @@ const layer = createLayer(id, function (this: BaseLayer) { showIf( Decimal.lt( foundationProgress.value, - management.elfTraining.expandersElfTraining.milestones[2].earned.value + toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ) ), +<<<<<<< HEAD canClick: () => { if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) { return false; @@ -122,6 +124,14 @@ const layer = createLayer(id, function (this: BaseLayer) { } return true; }, +======= + canClick: () => + Decimal.gte(trees.logs.value, foundationConversion.nextAt.value) && + Decimal.lt( + foundationProgress.value, + toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 + ), +>>>>>>> finish balancing toys layer onClick() { if (!unref(this.canClick)) { return; @@ -278,6 +288,19 @@ const layer = createLayer(id, function (this: BaseLayer) { ), showPopups: shouldShowPopups })); + const extraExpansionMilestone6 = createMilestone(() => ({ + display: { + requirement: "1200% Foundation Completed", + effectDisplay: "Quadruple oil gain" + }, + shouldEarn: () => Decimal.gte(foundationProgress.value, 1200), + visibility: () => + showIf( + extraExpansionMilestone5.earned.value && + toys.row1Upgrades[2].bought.value + ), + showPopups: shouldShowPopups + })); const milestones = { logGainMilestone1, autoCutMilestone1, @@ -291,7 +314,8 @@ const layer = createLayer(id, function (this: BaseLayer) { extraExpansionMilestone2, extraExpansionMilestone3, extraExpansionMilestone4, - extraExpansionMilestone5 + extraExpansionMilestone5, + extraExpansionMilestone6 }; const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); From b00ee8518bf3020c5997b0be58482f792e545390 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Mon, 19 Dec 2022 23:32:10 -0600 Subject: [PATCH 21/27] Fix merge conflicts --- src/data/layers/dyes.tsx | 56 +++--------------------------------- src/data/layers/metal.tsx | 9 +----- src/data/layers/trees.tsx | 11 ++----- src/data/layers/workshop.tsx | 42 ++++++++++++--------------- src/data/projEntry.tsx | 22 +++----------- 5 files changed, 29 insertions(+), 111 deletions(-) diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index 06f6355..ce6677c 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -34,16 +34,7 @@ import { ElfBuyable } from "./elves"; import management from "./management"; import oil from "./oil"; import paper from "./paper"; -<<<<<<< HEAD import trees from "./trees"; -======= -import boxes from "./boxes"; -import { ElfBuyable } from "./elves"; -import toys from "./toys" -<<<<<<< HEAD ->>>>>>> finish balancing toys layer -======= ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 interface Dye { name: string; @@ -64,15 +55,7 @@ type DyeUpg = | "blueDyeUpg2" | "coalUpg"; -<<<<<<< HEAD -<<<<<<< HEAD -export type enumColor = "blue" | "red" | "green" | "yellow" | "purple" | "orange"; -======= export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black"; ->>>>>>> finish balancing toys layer -======= -export type enumColor = "red" | "green" | "blue" | "yellow" | "purple" | "orange" | "black"; ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 const id = "dyes"; const day = 11; @@ -229,6 +212,7 @@ const layer = createLayer(id, function (this: BaseLayer) { case "red": case "yellow": case "blue": + case "black": dyeBook = paper.books.primaryDyeBook; break; case "orange": @@ -507,6 +491,7 @@ const layer = createLayer(id, function (this: BaseLayer) { black: createDye({ name: "Black Dye", color: "black", + key: "a", costs: () => [ { base: "1e42", @@ -522,40 +507,7 @@ const layer = createLayer(id, function (this: BaseLayer) { listedBoosts: [ { visible: true, - desc: computed( - () => - `*${format( - boosts.black1.value - )} letters processed.` - ) - } - ], - dyesToReset: [] - }), - black: createDye({ - name: "Black Dye", - color: "black", - costs: () => [ - { - base: "1e42", - root: 5, - res: trees.logs - }, - { - base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e15" : "2e15")), - root: 2, - res: oil.oil - } - ], - listedBoosts: [ - { - visible: true, - desc: computed( - () => - `*${format( - boosts.black1.value - )} letters processed.` - ) + desc: computed(() => `*${format(boosts.black1.value)} letters processed.`) } ], dyesToReset: [] @@ -739,7 +691,7 @@ const layer = createLayer(id, function (this: BaseLayer) { ), purple2: computed(() => Decimal.add(dyes.purple.amount.value, 1).log2().plus(1)), black1: computed(() => - Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt()) + Decimal.pow(2, Decimal.add(dyes.black.amount.value, 1).log2().sqrt()) .pow(upgrades.coalUpg.bought.value ? 1.2 : 1) .pow(management.elfTraining.clothElfTraining.milestones[3].earned.value ? 1.1 : 1) ) diff --git a/src/data/layers/metal.tsx b/src/data/layers/metal.tsx index fd08160..ffb1f28 100644 --- a/src/data/layers/metal.tsx +++ b/src/data/layers/metal.tsx @@ -35,15 +35,8 @@ import oil from "./oil"; import paper from "./paper"; import plastic from "./plastic"; import workshop from "./workshop"; -<<<<<<< HEAD -<<<<<<< HEAD import wrappingPaper from "./wrapping-paper"; -======= import toys from "./toys"; ->>>>>>> finish balancing toys layer -======= -import toys from "./toys"; ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 const id = "metal"; const day = 7; @@ -300,7 +293,7 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.add(toys.clothes.value, 1), description: "Give elves clothes to wear", enabled: toys.row1Upgrades[1].bought - })), + })) ]); const computedOreAmount = computed(() => oreAmount.apply(1)); const oreSpeed = createSequentialModifier(() => [ diff --git a/src/data/layers/trees.tsx b/src/data/layers/trees.tsx index cd52b47..6087ff7 100644 --- a/src/data/layers/trees.tsx +++ b/src/data/layers/trees.tsx @@ -537,21 +537,14 @@ const layer = createLayer(id, function (this: BaseLayer) { enabled: computed(() => Decimal.gt(wrappingPaper.boosts.christmas1.value, 1)) })), createMultiplicativeModifier(() => ({ -<<<<<<< HEAD -<<<<<<< HEAD multiplier: () => Decimal.add(computedTotalTrees.value, 1).log10(), description: "Trees Decoration", enabled: masteryEffectActive -======= + })), + createMultiplicativeModifier(() => ({ multiplier: 2, description: "Load logs onto trucks", enabled: toys.row1Upgrades[0].bought ->>>>>>> finish balancing toys layer -======= - multiplier: 2, - description: "Load logs onto trucks", - enabled: toys.row1Upgrades[0].bought ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 })), createExponentialModifier(() => ({ exponent: 1.2, diff --git a/src/data/layers/workshop.tsx b/src/data/layers/workshop.tsx index 357875b..677edf8 100644 --- a/src/data/layers/workshop.tsx +++ b/src/data/layers/workshop.tsx @@ -33,7 +33,7 @@ import elves from "./elves"; import management from "./management"; import trees from "./trees"; import wrappingPaper from "./wrapping-paper"; -import toys from "./toys" +import toys from "./toys"; const id = "workshop"; const day = 2; @@ -49,7 +49,11 @@ const layer = createLayer(id, function (this: BaseLayer) { scaling: addHardcap( addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5423, 1 / 1e10), 1e20, 3e8), computed(() => - toys.row1Upgrades[2].bought ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 + toys.row1Upgrades[2].bought + ? 1200 + : management.elfTraining.expandersElfTraining.milestones[2].earned.value + ? 1000 + : 100 ) ), baseResource: trees.logs, @@ -99,12 +103,13 @@ const layer = createLayer(id, function (this: BaseLayer) { showIf( Decimal.lt( foundationProgress.value, - toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value + toys.row1Upgrades[2].bought.value + ? 1200 + : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 ) ), -<<<<<<< HEAD canClick: () => { if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) { return false; @@ -112,26 +117,18 @@ const layer = createLayer(id, function (this: BaseLayer) { if (main.isMastery.value && main.currentlyMastering.value?.name === "Trees") { return false; } - if ( - Decimal.gte( - foundationProgress.value, - management.elfTraining.expandersElfTraining.milestones[2].earned.value - ? 1000 - : 100 - ) - ) { + let cap = 100; + if (management.elfTraining.expandersElfTraining.milestones[2].earned.value) { + cap = 1000; + } + if (toys.row1Upgrades[2].bought.value) { + cap = 1200; + } + if (Decimal.gte(foundationProgress.value, cap)) { return false; } return true; }, -======= - canClick: () => - Decimal.gte(trees.logs.value, foundationConversion.nextAt.value) && - Decimal.lt( - foundationProgress.value, - toys.row1Upgrades[2].bought.value ? 1200 : management.elfTraining.expandersElfTraining.milestones[2].earned.value ? 1000 : 100 - ), ->>>>>>> finish balancing toys layer onClick() { if (!unref(this.canClick)) { return; @@ -295,10 +292,7 @@ const layer = createLayer(id, function (this: BaseLayer) { }, shouldEarn: () => Decimal.gte(foundationProgress.value, 1200), visibility: () => - showIf( - extraExpansionMilestone5.earned.value && - toys.row1Upgrades[2].bought.value - ), + showIf(extraExpansionMilestone5.earned.value && toys.row1Upgrades[2].bought.value), showPopups: shouldShowPopups })); const milestones = { diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 10e7fe4..6e68578 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -30,18 +30,11 @@ import metal from "./layers/metal"; import oil from "./layers/oil"; import paper from "./layers/paper"; import plastic from "./layers/plastic"; +import ribbon from "./layers/ribbon"; +import toys from "./layers/toys"; import trees from "./layers/trees"; import workshop from "./layers/workshop"; import wrappingPaper from "./layers/wrapping-paper"; -<<<<<<< HEAD -<<<<<<< HEAD -import ribbon from "./layers/ribbon"; -======= -import toys from "./layers/toys"; ->>>>>>> fix toy sum -======= -import toys from "./layers/toys"; ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 import boxesSymbol from "./symbols/cardboardBox.png"; import clothSymbol from "./symbols/cloth.png"; import coalSymbol from "./symbols/coal.png"; @@ -583,16 +576,9 @@ export const getInitialLayers = ( dyes, management, letters, -<<<<<<< HEAD -<<<<<<< HEAD wrappingPaper, - ribbon -======= - toys, ->>>>>>> fix toy sum -======= - toys, ->>>>>>> 19d58d575e4f3e5ecb3adad514f7089e50360057 + ribbon, + toys ]; /** From a0b147064e161884fb003481179004c5e9fc68e7 Mon Sep 17 00:00:00 2001 From: ducdat0507 <62660527+ducdat0507@users.noreply.github.com> Date: Tue, 20 Dec 2022 16:31:33 +0700 Subject: [PATCH 22/27] Toy bar gradient --- src/data/layers/styles/day-gradients.css | 15 +++ src/data/layers/toys.tsx | 142 +++++++++++------------ 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/src/data/layers/styles/day-gradients.css b/src/data/layers/styles/day-gradients.css index 8a344df..e35a4d3 100644 --- a/src/data/layers/styles/day-gradients.css +++ b/src/data/layers/styles/day-gradients.css @@ -47,4 +47,19 @@ #af0000 10px 20px ); } +} + +@keyframes toys-bar { + from { + background: 0 0 / 114px 114px repeat repeating-linear-gradient(-45deg, + #4bdc13 0 10px, + green 10px 20px + ); + } + to { + background: 114px 0px / 114px 114px repeat repeating-linear-gradient(-45deg, + #4bdc13 0 10px, + green 10px 20px + ); + } } \ No newline at end of file diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index e01bd13..97c197d 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -51,15 +51,18 @@ const layer = createLayer(id, function (this: BaseLayer) { const clothes = createResource(0, "clothes"); const woodenBlocks = createResource(0, " wooden blocks"); const trucks = createResource(0, "trucks"); - const toyGain = createSequentialModifier(() => [ + const toyGain = createSequentialModifier(() => []); + const toySum = createResource( + computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), + "toys" + ); - ]); - const toySum = createResource(computed(() => Decimal.add(clothes.value, woodenBlocks.value).add(trucks.value)), "toys"); - const clothesCost = computed(() => { - var clothFactor = Decimal.add(1,clothesBuyable.amount.value); - if(milestones.milestone1.earned){ - clothFactor=clothFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + let clothFactor = Decimal.add(1, clothesBuyable.amount.value); + if (milestones.milestone1.earned) { + clothFactor = clothFactor.div( + Decimal.div(workshop.foundationProgress.value, 100).floor() + ); } return { cloth: clothFactor.mul(1e8), @@ -71,18 +74,14 @@ const layer = createLayer(id, function (this: BaseLayer) { <>

Make Clothes

-
- Click this buyable to make some clothes! -
+
Click this buyable to make some clothes!
+ +
You have {formatWhole(clothes.value)} clothes.
- You have {formatWhole(clothes.value)} clothes. + Costs {format(clothesCost.value.cloth)} cloth and requires{" "} + {format(clothesCost.value.dye)} of red, yellow, and blue dye
- -
- Costs {format(clothesCost.value.cloth)} cloth and requires {format(clothesCost.value.dye)} of red, yellow, and - blue dye -
)), canPurchase(): boolean { @@ -96,13 +95,15 @@ const layer = createLayer(id, function (this: BaseLayer) { onPurchase() { cloth.cloth.value = Decimal.sub(cloth.cloth.value, clothesCost.value.cloth); this.amount.value = Decimal.add(this.amount.value, 1); - clothes.value = this.amount.value - }, + clothes.value = this.amount.value; + } })) as GenericBuyable; const woodenBlocksCost = computed(() => { - var woodFactor = Decimal.add(1,woodenBlocksBuyable.amount.value).pow(5); - if(milestones.milestone1.earned){ - woodFactor=woodFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + let woodFactor = Decimal.add(1, woodenBlocksBuyable.amount.value).pow(5); + if (milestones.milestone1.earned) { + woodFactor = woodFactor.div( + Decimal.div(workshop.foundationProgress.value, 100).floor() + ); } return { wood: woodFactor.mul(1e40) @@ -113,41 +114,34 @@ const layer = createLayer(id, function (this: BaseLayer) { <>

Make Wooden Blocks

-
- Click this buyable to make some wooden blocks! -
+
Click this buyable to make some wooden blocks!
-
- You have {formatWhole(woodenBlocks.value)} wooden blocks. -
- -
- Costs {format(woodenBlocksCost.value.wood)} logs -
+
You have {formatWhole(woodenBlocks.value)} wooden blocks.
+ +
Costs {format(woodenBlocksCost.value.wood)} logs
)), canPurchase(): boolean { - return ( - woodenBlocksCost.value.wood.lte(trees.logs.value) - ); + return woodenBlocksCost.value.wood.lte(trees.logs.value); }, onPurchase() { trees.logs.value = Decimal.sub(trees.logs.value, woodenBlocksCost.value.wood); this.amount.value = Decimal.add(this.amount.value, 1); - woodenBlocks.value = this.amount.value - }, + woodenBlocks.value = this.amount.value; + } })) as GenericBuyable; const trucksCost = computed(() => { - var factor = Decimal.add(1,trucksBuyable.amount.value).pow(3); - var plasticFactor = Decimal.add(1,trucksBuyable.amount.value); - if(milestones.milestone1.earned){ - factor=factor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) - plasticFactor=plasticFactor.div(Decimal.div(workshop.foundationProgress.value,100).floor()) + let factor = Decimal.add(1, trucksBuyable.amount.value).pow(3); + let plasticFactor = Decimal.add(1, trucksBuyable.amount.value); + if (milestones.milestone1.earned) { + factor = factor.div(Decimal.div(workshop.foundationProgress.value, 100).floor()); + plasticFactor = plasticFactor.div( + Decimal.div(workshop.foundationProgress.value, 100).floor() + ); } return { metal: factor.mul(1e25), plastic: plasticFactor.mul(1e10) - }; }); const trucksBuyable = createBuyable(() => ({ @@ -155,17 +149,14 @@ const layer = createLayer(id, function (this: BaseLayer) { <>

Make Trucks

-
- Click this buyable to make some trucks! -
+
Click this buyable to make some trucks!
+ +
You have {formatWhole(trucks.value)} trucks.
- You have {formatWhole(trucks.value)} trucks. + Costs {format(trucksCost.value.metal)} metal and{" "} + {format(trucksCost.value.plastic)} plastic
- -
- Costs {format(trucksCost.value.metal)} metal and {format(trucksCost.value.plastic)} plastic -
)), canPurchase(): boolean { @@ -178,10 +169,10 @@ const layer = createLayer(id, function (this: BaseLayer) { metal.metal.value = Decimal.sub(metal.metal.value, trucksCost.value.metal); plastic.plastic.value = Decimal.sub(plastic.plastic.value, trucksCost.value.plastic); this.amount.value = Decimal.add(this.amount.value, 1); - trucks.value = this.amount.value - }, + trucks.value = this.amount.value; + } })) as GenericBuyable; - const buyables = [ clothesBuyable, woodenBlocksBuyable, trucksBuyable ]; + const buyables = [clothesBuyable, woodenBlocksBuyable, trucksBuyable]; const trucksUpgrade1 = createUpgrade(() => ({ resource: noPersist(trucks), cost: 10, @@ -189,16 +180,17 @@ const layer = createLayer(id, function (this: BaseLayer) { title: "Load logs onto trucks", description: "Log gain is doubled." } - })) + })); const clothesUpgrade1 = createUpgrade(() => ({ resource: noPersist(clothes), cost: 30, display: { title: "Give elves clothes to wear", - description: "Multiply ore per mining operation and auto-smelt purity by the number of clothes you have." + description: + "Multiply ore per mining operation and auto-smelt purity by the number of clothes you have." } - })) - + })); + const woodenBlocksUpgrade1 = createUpgrade(() => ({ resource: noPersist(woodenBlocks), cost: 15, @@ -206,16 +198,13 @@ const layer = createLayer(id, function (this: BaseLayer) { title: "Build wooden towers", description: "You can now build 2 extra tall workshops!" } - })) -const row1Upgrades = [ - trucksUpgrade1, - clothesUpgrade1, - woodenBlocksUpgrade1 - ]; + })); + const row1Upgrades = [trucksUpgrade1, clothesUpgrade1, woodenBlocksUpgrade1]; const milestone1 = createMilestone(() => ({ display: { requirement: "10 toys", - effectDisplay: "The cost of making toys is divided by the number of complete workshops you have." + effectDisplay: + "The cost of making toys is divided by the number of complete workshops you have." }, shouldEarn: () => Decimal.gte(toySum.value, 10) })); @@ -226,12 +215,12 @@ const row1Upgrades = [ }, shouldEarn: () => Decimal.gte(toySum.value, 100) })); -const milestones = {milestone1, milestone2} -const { collapseMilestones, display: milestonesDisplay } = + const milestones = { milestone1, milestone2 }; + const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); const [generalTab, generalTabCollapsed] = createCollapsibleModifierSections(() => [ - { + { title: `Toy Gain`, modifier: toyGain, base: 1, @@ -254,25 +243,26 @@ const { collapseMilestones, display: milestonesDisplay } = if (Decimal.lt(main.day.value, day)) { return; } - if (Decimal.lt(clothes.value, clothesBuyable.amount.value)){ - clothesBuyable.amount.value = clothes.value + if (Decimal.lt(clothes.value, clothesBuyable.amount.value)) { + clothesBuyable.amount.value = clothes.value; } - if (Decimal.lt(woodenBlocks.value, woodenBlocksBuyable.amount.value)){ - woodenBlocksBuyable.amount.value = woodenBlocks.value + if (Decimal.lt(woodenBlocks.value, woodenBlocksBuyable.amount.value)) { + woodenBlocksBuyable.amount.value = woodenBlocks.value; } - if (Decimal.lt(trucks.value, trucksBuyable.amount.value)){ - trucksBuyable.amount.value = trucks.value + if (Decimal.lt(trucks.value, trucksBuyable.amount.value)) { + trucksBuyable.amount.value = trucks.value; } - }); - const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, goal: 200, name, day, - color: colorDark, + background: { + gradient: "toys-bar", + duration: "15s" + }, modal: { show: showModifiersModal, display: modifiersModal From 803ee667701336fbad51c782644bfd24d421b548 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Tue, 20 Dec 2022 08:16:45 -0600 Subject: [PATCH 23/27] Oops --- src/data/layers/ribbon.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/layers/ribbon.tsx b/src/data/layers/ribbon.tsx index 5b85488..bc6a436 100644 --- a/src/data/layers/ribbon.tsx +++ b/src/data/layers/ribbon.tsx @@ -63,7 +63,7 @@ const layer = createLayer(id, () => { Create another ribbon with{" "} Date: Tue, 20 Dec 2022 23:39:37 +0000 Subject: [PATCH 24/27] fix a ton of stuff --- src/data/layers/dyes.tsx | 8 ++++---- src/data/layers/letters.tsx | 4 ---- src/data/layers/oil.tsx | 4 ++++ src/data/layers/toys.tsx | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index ce6677c..0f132af 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -494,12 +494,12 @@ const layer = createLayer(id, function (this: BaseLayer) { key: "a", costs: () => [ { - base: "1e42", + base: "1e60", root: 5, res: trees.logs }, { - base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e15" : "2e15")), + base: computed(() => (upgrades.yellowDyeUpg2.bought.value ? "1e17" : "2e17")), root: 2, res: oil.oil } @@ -507,10 +507,10 @@ const layer = createLayer(id, function (this: BaseLayer) { listedBoosts: [ { visible: true, - desc: computed(() => `*${format(boosts.black1.value)} letters processed.`) + desc: computed(() => `*${format(boosts.black1.value)} oil gain.`) } ], - dyesToReset: [] + dyesToReset: [], }), orange: createDye({ name: "Orange Dye", diff --git a/src/data/layers/letters.tsx b/src/data/layers/letters.tsx index 22c2272..d7bb010 100644 --- a/src/data/layers/letters.tsx +++ b/src/data/layers/letters.tsx @@ -215,10 +215,6 @@ const layer = createLayer(id, function (this: BaseLayer) { createMultiplicativeModifier(() => ({ multiplier: () => Decimal.div(paperBuyable.amount.value, 2).add(1), description: "Printed Labels" - })), - createMultiplicativeModifier(() => ({ - multiplier: () => dyes.boosts.black1.value, - description: "Black Dye Boost" })) ]); diff --git a/src/data/layers/oil.tsx b/src/data/layers/oil.tsx index 40d2000..46e367a 100644 --- a/src/data/layers/oil.tsx +++ b/src/data/layers/oil.tsx @@ -947,6 +947,10 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: 2, description: "Cocoa Level 3", enabled: management.elfTraining.oilElfTraining.milestones[2].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: () => dyes.boosts.black1.value, + description: "Black Dye Boost" })) ]) as WithRequired; const computedOilSpeed = computed(() => oilSpeed.apply(0)); diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 97c197d..a211714 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -59,14 +59,14 @@ const layer = createLayer(id, function (this: BaseLayer) { const clothesCost = computed(() => { let clothFactor = Decimal.add(1, clothesBuyable.amount.value); - if (milestones.milestone1.earned) { + if (milestones.milestone1.earned.value) { clothFactor = clothFactor.div( Decimal.div(workshop.foundationProgress.value, 100).floor() ); } return { - cloth: clothFactor.mul(1e8), - dye: clothFactor.mul(1e6) + cloth: clothFactor.mul(1e12), + dye: clothFactor.mul(1e14) }; }); const clothesBuyable = createBuyable(() => ({ @@ -100,13 +100,13 @@ const layer = createLayer(id, function (this: BaseLayer) { })) as GenericBuyable; const woodenBlocksCost = computed(() => { let woodFactor = Decimal.add(1, woodenBlocksBuyable.amount.value).pow(5); - if (milestones.milestone1.earned) { + if (milestones.milestone1.earned.value) { woodFactor = woodFactor.div( Decimal.div(workshop.foundationProgress.value, 100).floor() ); } return { - wood: woodFactor.mul(1e40) + wood: woodFactor.mul(1e63) }; }); const woodenBlocksBuyable = createBuyable(() => ({ @@ -133,15 +133,15 @@ const layer = createLayer(id, function (this: BaseLayer) { const trucksCost = computed(() => { let factor = Decimal.add(1, trucksBuyable.amount.value).pow(3); let plasticFactor = Decimal.add(1, trucksBuyable.amount.value); - if (milestones.milestone1.earned) { + if (milestones.milestone1.earned.value) { factor = factor.div(Decimal.div(workshop.foundationProgress.value, 100).floor()); plasticFactor = plasticFactor.div( Decimal.div(workshop.foundationProgress.value, 100).floor() ); } return { - metal: factor.mul(1e25), - plastic: plasticFactor.mul(1e10) + metal: factor.mul(1e43), + plastic: plasticFactor.mul(1e15) }; }); const trucksBuyable = createBuyable(() => ({ From 6a625f2fb86a6c8a413f13396ba3dd96d1c35bee Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:07:40 +0000 Subject: [PATCH 25/27] workshop scaling --- src/data/layers/dyes.tsx | 2 ++ src/data/layers/toys.tsx | 8 ++++---- src/data/layers/workshop.tsx | 10 ++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/data/layers/dyes.tsx b/src/data/layers/dyes.tsx index 0f132af..4eb5246 100644 --- a/src/data/layers/dyes.tsx +++ b/src/data/layers/dyes.tsx @@ -35,6 +35,7 @@ import management from "./management"; import oil from "./oil"; import paper from "./paper"; import trees from "./trees"; +import toys from "./toys"; interface Dye { name: string; @@ -511,6 +512,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } ], dyesToReset: [], + visibility: () => showIf(toys.milestones.milestone2.earned.value) }), orange: createDye({ name: "Orange Dye", diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index a211714..79ee3c5 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -65,8 +65,8 @@ const layer = createLayer(id, function (this: BaseLayer) { ); } return { - cloth: clothFactor.mul(1e12), - dye: clothFactor.mul(1e14) + cloth: clothFactor.mul(1e13), + dye: clothFactor.mul(2e14) }; }); const clothesBuyable = createBuyable(() => ({ @@ -141,7 +141,7 @@ const layer = createLayer(id, function (this: BaseLayer) { } return { metal: factor.mul(1e43), - plastic: plasticFactor.mul(1e15) + plastic: plasticFactor.mul(1e14) }; }); const trucksBuyable = createBuyable(() => ({ @@ -256,7 +256,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 200, + goal: 2000, name, day, background: { diff --git a/src/data/layers/workshop.tsx b/src/data/layers/workshop.tsx index 677edf8..1b6ea38 100644 --- a/src/data/layers/workshop.tsx +++ b/src/data/layers/workshop.tsx @@ -74,6 +74,16 @@ const layer = createLayer(id, function (this: BaseLayer) { exponent: 1 / 0.99, description: "Holly Level 5", enabled: management.elfTraining.cutterElfTraining.milestones[4].earned + })), + createExponentialModifier(() => ({ + exponent: 0.1, + description: "Scaling Jump at 1000%", + enabled: computed(() => Decimal.gte(foundationProgress.value, 1000)) + })), + createMultiplicativeModifier(() => ({ + multiplier: 6969, // note: 6969 is a magic number. Don't touch this or it'll self-destruct. + description: "Scaling Jump at 1000%", + enabled: computed(() => Decimal.gte(foundationProgress.value, 1000)) })) ]) })); From 2cf4e58e5e8cccf55a19ac4b27bcfaeccb5a0204 Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:23:02 +0000 Subject: [PATCH 26/27] rest of day 17 stuff --- src/data/layers/oil.tsx | 6 ++++++ src/data/layers/plastic.tsx | 6 ++++++ src/data/layers/toys.tsx | 19 +++++++++++++++++-- src/data/layers/wrapping-paper.tsx | 3 ++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/data/layers/oil.tsx b/src/data/layers/oil.tsx index 46e367a..4b5f00c 100644 --- a/src/data/layers/oil.tsx +++ b/src/data/layers/oil.tsx @@ -40,6 +40,7 @@ import management from "./management"; import workshop from "./workshop"; import { WithRequired } from "util/common"; import { ElfBuyable } from "./elves"; +import toys from "./toys"; const id = "oil"; const day = 9; @@ -951,6 +952,11 @@ const layer = createLayer(id, function (this: BaseLayer) { createMultiplicativeModifier(() => ({ multiplier: () => dyes.boosts.black1.value, description: "Black Dye Boost" + })), + createMultiplicativeModifier(() => ({ + multiplier: 50, + description: "350 toys", + enabled: toys.milestones.milestone4.earned.value })) ]) as WithRequired; const computedOilSpeed = computed(() => oilSpeed.apply(0)); diff --git a/src/data/layers/plastic.tsx b/src/data/layers/plastic.tsx index 170f25c..27499b2 100644 --- a/src/data/layers/plastic.tsx +++ b/src/data/layers/plastic.tsx @@ -36,6 +36,7 @@ import metal from "./metal"; import oil from "./oil"; import paper from "./paper"; import workshop from "./workshop"; +import toys from "./toys"; const id = "plastic"; const day = 10; @@ -373,6 +374,11 @@ const layer = createLayer(id, function (this: BaseLayer) { multiplier: () => Decimal.div(buildRefinery.amount.value, 100).add(1), description: "Tinsel Level 4", enabled: management.elfTraining.plasticElfTraining.milestones[3].earned + })), + createMultiplicativeModifier(() => ({ + multiplier: 50, + description: "400 toys", + enabled: toys.milestones.milestone4.earned.value })) ]); const computedPlasticGain = computed(() => plasticGain.apply(0)); diff --git a/src/data/layers/toys.tsx b/src/data/layers/toys.tsx index 79ee3c5..f5d9612 100644 --- a/src/data/layers/toys.tsx +++ b/src/data/layers/toys.tsx @@ -215,7 +215,22 @@ const layer = createLayer(id, function (this: BaseLayer) { }, shouldEarn: () => Decimal.gte(toySum.value, 100) })); - const milestones = { milestone1, milestone2 }; + + const milestone3 = createMilestone(() => ({ + display: { + requirement: "200 toys", + effectDisplay: "Beach wrapping paper is much more powerful." + }, + shouldEarn: () => Decimal.gte(toySum.value, 200) + })); + const milestone4 = createMilestone(() => ({ + display: { + requirement: "350 toys", + effectDisplay: "Gain 50x oil and plastic." + }, + shouldEarn: () => Decimal.gte(toySum.value, 350) + })); + const milestones = { milestone1, milestone2, milestone3, milestone4 }; const { collapseMilestones, display: milestonesDisplay } = createCollapsibleMilestones(milestones); @@ -256,7 +271,7 @@ const layer = createLayer(id, function (this: BaseLayer) { const { total: totalToys, trackerDisplay } = setUpDailyProgressTracker({ resource: toySum, - goal: 2000, + goal: 500, name, day, background: { diff --git a/src/data/layers/wrapping-paper.tsx b/src/data/layers/wrapping-paper.tsx index 0622348..9c30853 100644 --- a/src/data/layers/wrapping-paper.tsx +++ b/src/data/layers/wrapping-paper.tsx @@ -16,6 +16,7 @@ import { computed, Ref, unref, watchEffect } from "vue"; import { main } from "../projEntry"; import { default as dyes, type enumColor } from "./dyes"; import elves from "./elves"; +import toys from "./toys"; const id = "wrappingPaper"; const day = 15; @@ -277,7 +278,7 @@ const layer = createLayer(id, () => { beach1: computed(() => main.isMastery.value ? 1 - : Decimal.add(wrappingPaper.beach.buyable.amount.value, 1).log10().add(1) + : Decimal.add(wrappingPaper.beach.buyable.amount.value, 1).log10().add(1).pow(toys.milestones.milestone3.earned.value ? 1.6 : 1) ) }; const wrappingPaperSum = createResource( From 993db57bfe9b3615b2e35a5b36ade530d63db1ab Mon Sep 17 00:00:00 2001 From: unsoftcapped3 <75136164+unsoftcapped3@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:25:05 +0000 Subject: [PATCH 27/27] fix typo --- src/data/layers/plastic.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/layers/plastic.tsx b/src/data/layers/plastic.tsx index 27499b2..d8a070c 100644 --- a/src/data/layers/plastic.tsx +++ b/src/data/layers/plastic.tsx @@ -377,7 +377,7 @@ const layer = createLayer(id, function (this: BaseLayer) { })), createMultiplicativeModifier(() => ({ multiplier: 50, - description: "400 toys", + description: "350 toys", enabled: toys.milestones.milestone4.earned.value })) ]);