This commit is contained in:
thepaperpilot 2022-12-24 10:19:27 -06:00
parent ad00101b8d
commit 8e6ba89928

View file

@ -21,7 +21,7 @@ import oil from "./oil";
import { createCollapsibleMilestones } from "data/common"; import { createCollapsibleMilestones } from "data/common";
import { globalBus } from "game/events"; import { globalBus } from "game/events";
import { createUpgrade } from "features/upgrades/upgrade"; import { createUpgrade } from "features/upgrades/upgrade";
import { ElfBuyable } from "./elves"; import elves, { ElfBuyable } from "./elves";
import management from "./management"; import management from "./management";
import paper from "./paper"; import paper from "./paper";
import ModalVue from "components/Modal.vue"; 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)), visibility: () => showIf(Decimal.gt(remainingSize.value, 0)),
canClick: () => Decimal.gte(packingProgress.value, 1), canClick: () => Decimal.gte(packingProgress.value, 1),
onClick() { onClick() {
@ -102,11 +103,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
}); });
const packedPresentsSize = computed(() => const packedPresentsSize = computed(() =>
Decimal.times(packedPresents.value, 0.008).dividedBy(packingDensity.value) Decimal.div(packedPresents.value, packingDensity.value)
);
const currentMaxPresents = computed(() =>
Decimal.times(sledSpace, packingDensity.value).div(0.008)
); );
const currentMaxPresents = computed(() => Decimal.times(sledSpace, packingDensity.value));
const remainingSize = computed(() => Decimal.sub(sledSpace, packedPresentsSize.value)); const remainingSize = computed(() => Decimal.sub(sledSpace, packedPresentsSize.value));
const elfPackingSpeed = createSequentialModifier(() => [ const elfPackingSpeed = createSequentialModifier(() => [
@ -163,130 +162,127 @@ const layer = createLayer(id, function (this: BaseLayer) {
})) }))
]); ]);
const computedLoaderPackingSpeed = computed(() => loaderPackingSpeed.apply(1000)); const computedLoaderPackingSpeed = computed(() => loaderPackingSpeed.apply(1000));
const helpers = { const elf = createBuyable(() => ({
elf: createBuyable(() => ({ visibility: () => showIf(Decimal.gte(totalPresents.value, 10)),
visibility: () => showIf(Decimal.gte(totalPresents.value, 10)), cost() {
cost() { let v = this.amount.value;
let v = this.amount.value; v = Decimal.pow(0.98, paper.books.packingBook.totalAmount.value).times(v);
v = Decimal.pow(0.98, paper.books.packingBook.totalAmount.value).times(v); return Decimal.pow(1.2, v).times(10).floor();
return Decimal.pow(1.2, v).times(10).floor(); },
}, inverseCost(cost: DecimalSource) {
inverseCost(cost: DecimalSource) { let amount = Decimal.div(cost, 10).log(1.2);
let amount = Decimal.div(cost, 10).log(1.2); amount = amount.div(Decimal.pow(0.98, paper.books.packingBook.totalAmount.value));
amount = amount.div(Decimal.pow(0.98, paper.books.packingBook.totalAmount.value)); return Decimal.isNaN(amount) ? Decimal.dZero : amount.floor().max(0);
return Decimal.isNaN(amount) ? Decimal.dZero : amount.floor().max(0); },
}, resource: totalPresentsResource,
resource: totalPresentsResource, display: jsx(() => (
display: jsx(() => ( <>
<> <div>
<div> <h3>Hire an elf assistant</h3>
<h3>Hire an elf assistant</h3> </div>
</div> Packs {format(computedElfPackingSpeed.value)} presents per second
Packs {format(computedElfPackingSpeed.value)} presents per second <div>
<div> <br />
<br /> Amount: {formatWhole(helpers.elf.amount.value)}
Amount: {formatWhole(helpers.elf.amount.value)} </div>
</div> <div>
<div> <br />
<br /> Currently packing{" "}
Currently packing{" "} {format(
{format( Decimal.times(helpers.elf.amount.value, computedElfPackingSpeed.value)
Decimal.times(helpers.elf.amount.value, computedElfPackingSpeed.value) )}{" "}
)}{" "} presents per second
presents per second </div>
</div> <div>
<div> Requires: {formatWhole(unref(helpers.elf.cost!))}{" "}
Requires: {formatWhole(unref(helpers.elf.cost!))}{" "} {helpers.elf.resource!.displayName}
{helpers.elf.resource!.displayName} </div>
</div> </>
</> )),
)), style: {
style: { width: "200px"
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<DecimalSource>;
oilCost: ComputedRef<DecimalSource>;
} }
})), ) {
loader: createBuyable(() => ({ return (
visibility: () => showIf(upgrades.loaderUnlock.bought.value), Decimal.gte(metal.metal.value, this.metalCost.value) &&
metalCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e70)), Decimal.gte(oil.oil.value, this.oilCost.value)
oilCost: computed(() => Decimal.pow(1.2, helpers.loader.amount.value).times(1e25)), );
canPurchase( },
this: GenericBuyable & { onPurchase() {
metalCost: ComputedRef<DecimalSource>; metal.metal.value = Decimal.sub(metal.metal.value, this.metalCost.value);
oilCost: ComputedRef<DecimalSource>; oil.oil.value = Decimal.sub(oil.oil.value, this.oilCost.value);
} this.amount.value = Decimal.add(this.amount.value, 1);
) { },
return ( inverseCost() {
Decimal.gte(metal.metal.value, this.metalCost.value) && const metalAmount = Decimal.div(metal.metal.value, 1e40).log(1.5);
Decimal.gte(oil.oil.value, this.oilCost.value) 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);
onPurchase() { },
metal.metal.value = Decimal.sub(metal.metal.value, this.metalCost.value); display: jsx(() => (
oil.oil.value = Decimal.sub(oil.oil.value, this.oilCost.value); <>
this.amount.value = Decimal.add(this.amount.value, 1); <div>
}, <h3>Build a loader</h3>
inverseCost() { </div>
const metalAmount = Decimal.div(metal.metal.value, 1e40).log(1.5); Loads {format(computedLoaderPackingSpeed.value)} presents per second
const oilAmount = Decimal.div(oil.oil.value, 1e20).log(1.5); <div>
if (Decimal.isNaN(metalAmount) || Decimal.isNaN(oilAmount)) return Decimal.dZero; <br />
return Decimal.min(metalAmount, oilAmount).floor().max(0); Amount: {formatWhole(helpers.loader.amount.value)}
}, </div>
display: jsx(() => ( <div>
<> <br />
<div> Currently packing{" "}
<h3>Build a loader</h3> {format(
</div> Decimal.times(helpers.loader.amount.value, computedLoaderPackingSpeed.value)
Loads {format(computedLoaderPackingSpeed.value)} presents per second )}{" "}
<div> persents per second
<br /> </div>
Amount: {formatWhole(helpers.loader.amount.value)} <div>
</div> Cost:{" "}
<div> {displayCost(
<br /> metal.metal,
Currently packing{" "} helpers.loader.metalCost.value,
{format( metal.metal.displayName
Decimal.times( )}
helpers.loader.amount.value, ,{displayCost(oil.oil, helpers.loader.oilCost.value, oil.oil.displayName)}
computedLoaderPackingSpeed.value </div>
) </>
)}{" "} )),
persents per second style: {
</div> width: "200px"
<div> }
Cost:{" "} })) as ElfBuyable & {
{displayCost( metalCost: ComputedRef<DecimalSource>;
metal.metal, oilCost: ComputedRef<DecimalSource>;
helpers.loader.metalCost.value,
metal.metal.displayName
)}
,{displayCost(oil.oil, helpers.loader.oilCost.value, oil.oil.displayName)}
</div>
</>
)),
style: {
width: "200px"
}
}))
} as {
elf: ElfBuyable;
loader: ElfBuyable & {
metalCost: ComputedRef<DecimalSource>;
oilCost: ComputedRef<DecimalSource>;
};
}; };
const helpers = { elf, loader };
const upgrades = { const upgrades = {
packingElf: createUpgrade(() => ({ packingElf: createUpgrade(() => ({
display: { display: {
title: "An Elf's Elf", 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, cost: 1000,
resource: totalPresentsResource, resource: totalPresentsResource,
style: { style: {
width: "200px" 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(() => ({ loaderUnlock: createUpgrade(() => ({
display: { 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<string, GenericMilestone> = { const packingMilestones: Record<string, GenericMilestone> = {
logBoost: createMilestone(() => ({ logBoost: createMilestone(() => ({
display: { display: {
@ -382,7 +374,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
ribbonBoost: createMilestone(() => ({ ribbonBoost: createMilestone(() => ({
display: { display: {
requirement: `8,230,000 ${packedPresents.displayName}`, requirement: `8,230,000 ${packedPresents.displayName}`,
effectDisplay: "Halve ribbon cost" effectDisplay: "Halve ribbon's dye cost"
}, },
shouldEarn: () => Decimal.gte(packedPresents.value, 8230000), shouldEarn: () => Decimal.gte(packedPresents.value, 8230000),
visibility: () => showIf(packingMilestones.oreBoost.earned.value) visibility: () => showIf(packingMilestones.oreBoost.earned.value)
@ -499,6 +491,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
packingMilestones, packingMilestones,
collapseMilestones, collapseMilestones,
generalTabCollapsed, generalTabCollapsed,
minWidth: 700,
display: jsx(() => ( display: jsx(() => (
<> <>
{render(trackerDisplay)} {render(trackerDisplay)}