diff --git a/src/data/layers/packing.tsx b/src/data/layers/packing.tsx index 9d9e010..4f8478b 100644 --- a/src/data/layers/packing.tsx +++ b/src/data/layers/packing.tsx @@ -21,7 +21,7 @@ import oil from "./oil"; import { createCollapsibleMilestones } from "data/common"; import { globalBus } from "game/events"; import { createUpgrade } from "features/upgrades/upgrade"; -import { ElfBuyable } from "./elves"; +import elves, { ElfBuyable } from "./elves"; import management from "./management"; import paper from "./paper"; import ModalVue from "components/Modal.vue"; @@ -77,6 +77,7 @@ const layer = createLayer(id, function (this: BaseLayer) { )) }, + style: "min-height: 40px", visibility: () => showIf(Decimal.gt(remainingSize.value, 0)), canClick: () => Decimal.gte(packingProgress.value, 1), onClick() { @@ -102,11 +103,9 @@ const layer = createLayer(id, function (this: BaseLayer) { }); const packedPresentsSize = computed(() => - Decimal.times(packedPresents.value, 0.008).dividedBy(packingDensity.value) - ); - const currentMaxPresents = computed(() => - Decimal.times(sledSpace, packingDensity.value).div(0.008) + Decimal.div(packedPresents.value, packingDensity.value) ); + const currentMaxPresents = computed(() => Decimal.times(sledSpace, packingDensity.value)); const remainingSize = computed(() => Decimal.sub(sledSpace, packedPresentsSize.value)); const elfPackingSpeed = createSequentialModifier(() => [ @@ -163,130 +162,127 @@ const layer = createLayer(id, function (this: BaseLayer) { })) ]); const computedLoaderPackingSpeed = computed(() => loaderPackingSpeed.apply(1000)); - const helpers = { - elf: createBuyable(() => ({ - visibility: () => showIf(Decimal.gte(totalPresents.value, 10)), - cost() { - let v = this.amount.value; - v = Decimal.pow(0.98, paper.books.packingBook.totalAmount.value).times(v); - return Decimal.pow(1.2, v).times(10).floor(); - }, - inverseCost(cost: DecimalSource) { - let amount = Decimal.div(cost, 10).log(1.2); - amount = amount.div(Decimal.pow(0.98, paper.books.packingBook.totalAmount.value)); - return Decimal.isNaN(amount) ? Decimal.dZero : amount.floor().max(0); - }, - resource: totalPresentsResource, - display: jsx(() => ( - <> -
-

Hire an elf assistant

-
- Packs {format(computedElfPackingSpeed.value)} presents per second -
-
- Amount: {formatWhole(helpers.elf.amount.value)} -
-
-
- Currently packing{" "} - {format( - Decimal.times(helpers.elf.amount.value, computedElfPackingSpeed.value) - )}{" "} - presents per second -
-
- Requires: {formatWhole(unref(helpers.elf.cost!))}{" "} - {helpers.elf.resource!.displayName} -
- - )), - style: { - width: "200px" + const elf = createBuyable(() => ({ + visibility: () => showIf(Decimal.gte(totalPresents.value, 10)), + cost() { + let v = this.amount.value; + v = Decimal.pow(0.98, paper.books.packingBook.totalAmount.value).times(v); + return Decimal.pow(1.2, v).times(10).floor(); + }, + inverseCost(cost: DecimalSource) { + let amount = Decimal.div(cost, 10).log(1.2); + amount = amount.div(Decimal.pow(0.98, paper.books.packingBook.totalAmount.value)); + return Decimal.isNaN(amount) ? Decimal.dZero : amount.floor().max(0); + }, + resource: totalPresentsResource, + display: jsx(() => ( + <> +
+

Hire an elf assistant

+
+ Packs {format(computedElfPackingSpeed.value)} presents per second +
+
+ Amount: {formatWhole(helpers.elf.amount.value)} +
+
+
+ Currently packing{" "} + {format( + Decimal.times(helpers.elf.amount.value, computedElfPackingSpeed.value) + )}{" "} + presents per second +
+
+ Requires: {formatWhole(unref(helpers.elf.cost!))}{" "} + {helpers.elf.resource!.displayName} +
+ + )), + style: { + width: "200px" + } + })) as ElfBuyable; + const loader = createBuyable(() => ({ + visibility: () => showIf(upgrades.loaderUnlock.bought.value), + metalCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e70)), + oilCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e25)), + canPurchase( + this: GenericBuyable & { + metalCost: ComputedRef; + oilCost: ComputedRef; } - })), - loader: createBuyable(() => ({ - visibility: () => showIf(upgrades.loaderUnlock.bought.value), - metalCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e70)), - oilCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e25)), - canPurchase( - this: GenericBuyable & { - metalCost: ComputedRef; - oilCost: ComputedRef; - } - ) { - return ( - Decimal.gte(metal.metal.value, this.metalCost.value) && - Decimal.gte(oil.oil.value, this.oilCost.value) - ); - }, - onPurchase() { - metal.metal.value = Decimal.sub(metal.metal.value, this.metalCost.value); - oil.oil.value = Decimal.sub(oil.oil.value, this.oilCost.value); - this.amount.value = Decimal.add(this.amount.value, 1); - }, - inverseCost() { - const metalAmount = Decimal.div(metal.metal.value, 1e40).log(1.5); - const oilAmount = Decimal.div(oil.oil.value, 1e20).log(1.5); - if (Decimal.isNaN(metalAmount) || Decimal.isNaN(oilAmount)) return Decimal.dZero; - return Decimal.min(metalAmount, oilAmount).floor().max(0); - }, - display: jsx(() => ( - <> -
-

Build a loader

-
- Loads {format(computedLoaderPackingSpeed.value)} presents per second -
-
- Amount: {formatWhole(helpers.loader.amount.value)} -
-
-
- Currently packing{" "} - {format( - Decimal.times( - helpers.loader.amount.value, - computedLoaderPackingSpeed.value - ) - )}{" "} - persents per second -
-
- Cost:{" "} - {displayCost( - metal.metal, - helpers.loader.metalCost.value, - metal.metal.displayName - )} - ,{displayCost(oil.oil, helpers.loader.oilCost.value, oil.oil.displayName)} -
- - )), - style: { - width: "200px" - } - })) - } as { - elf: ElfBuyable; - loader: ElfBuyable & { - metalCost: ComputedRef; - oilCost: ComputedRef; - }; + ) { + return ( + Decimal.gte(metal.metal.value, this.metalCost.value) && + Decimal.gte(oil.oil.value, this.oilCost.value) + ); + }, + onPurchase() { + metal.metal.value = Decimal.sub(metal.metal.value, this.metalCost.value); + oil.oil.value = Decimal.sub(oil.oil.value, this.oilCost.value); + this.amount.value = Decimal.add(this.amount.value, 1); + }, + inverseCost() { + const metalAmount = Decimal.div(metal.metal.value, 1e40).log(1.5); + const oilAmount = Decimal.div(oil.oil.value, 1e20).log(1.5); + if (Decimal.isNaN(metalAmount) || Decimal.isNaN(oilAmount)) return Decimal.dZero; + return Decimal.min(metalAmount, oilAmount).floor().max(0); + }, + display: jsx(() => ( + <> +
+

Build a loader

+
+ Loads {format(computedLoaderPackingSpeed.value)} presents per second +
+
+ Amount: {formatWhole(helpers.loader.amount.value)} +
+
+
+ Currently packing{" "} + {format( + Decimal.times(helpers.loader.amount.value, computedLoaderPackingSpeed.value) + )}{" "} + persents per second +
+
+ Cost:{" "} + {displayCost( + metal.metal, + helpers.loader.metalCost.value, + metal.metal.displayName + )} + ,{displayCost(oil.oil, helpers.loader.oilCost.value, oil.oil.displayName)} +
+ + )), + style: { + width: "200px" + } + })) as ElfBuyable & { + metalCost: ComputedRef; + oilCost: ComputedRef; }; + const helpers = { elf, loader }; const upgrades = { packingElf: createUpgrade(() => ({ display: { title: "An Elf's Elf", - description: "Hire an Elf to help you hire more Elves." + description: "Train an Elf to help you hire more Elves." }, cost: 1000, resource: totalPresentsResource, style: { width: "200px" }, - visibility: () => showIf(Decimal.gte(helpers.elf.amount.value, 10)) + visibility: () => showIf(Decimal.gte(helpers.elf.amount.value, 10)), + onPurchase() { + main.days[3].recentlyUpdated.value = true; + elves.elves.packingElf.bought.value = true; + } })), loaderUnlock: createUpgrade(() => ({ display: { @@ -303,10 +299,6 @@ const layer = createLayer(id, function (this: BaseLayer) { })) }; - const resetButton = createClickable(() => ({ - display: jsx(() => <>Oh no! You've run out of room for presents! You'll need to take) - })); - const packingMilestones: Record = { logBoost: createMilestone(() => ({ display: { @@ -382,7 +374,7 @@ const layer = createLayer(id, function (this: BaseLayer) { ribbonBoost: createMilestone(() => ({ display: { requirement: `8,230,000 ${packedPresents.displayName}`, - effectDisplay: "Halve ribbon cost" + effectDisplay: "Halve ribbon's dye cost" }, shouldEarn: () => Decimal.gte(packedPresents.value, 8230000), visibility: () => showIf(packingMilestones.oreBoost.earned.value) @@ -499,6 +491,7 @@ const layer = createLayer(id, function (this: BaseLayer) { packingMilestones, collapseMilestones, generalTabCollapsed, + minWidth: 700, display: jsx(() => ( <> {render(trackerDisplay)}