add sleigh cost thing

This commit is contained in:
unsoftcapped3 2022-12-23 06:56:52 +00:00
parent 93979988ad
commit 9ba136b8b1

View file

@ -65,6 +65,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
); );
} }
const sleighProgress = computed(() => sleigh.amount) const sleighProgress = computed(() => sleigh.amount)
const sleighCost = computed(() => {
let v = sleighProgress.value.value;
return {
wood: Decimal.mul(1e100, Decimal.pow(1.2, v)),
metal: Decimal.mul(1e60, Decimal.pow(1.1, v)),
plastic: Decimal.mul(1e20, Decimal.pow(1.05, v))
};
});
const sleigh = createBuyable(() => ({ const sleigh = createBuyable(() => ({
display: jsx(() => ( display: jsx(() => (
<> <>
@ -73,45 +81,31 @@ const layer = createLayer(id, function (this: BaseLayer) {
Increase sleigh fixed by 1% Increase sleigh fixed by 1%
</div> </div>
<div> <div>
Costs {displayCost(trees.logs, Decimal.pow(10, 100), "logs")}, Costs {displayCost(trees.logs, sleighCost.value.wood, "logs")},
{displayCost(metal.metal, sleighCost.value.metal, "metal")},
{displayCost(plastic.plastic, sleighCost.value.plastic, "plastic")}
</div> </div>
</> </>
)), )),
canPurchase(): boolean { canPurchase(): boolean {
return ( return (
/*classroomCost.value.wood.lte(trees.logs.value) && sleighCost.value.wood.lte(trees.logs.value) &&
classroomCost.value.paper.lte(paper.paper.value) && sleighCost.value.metal.lte(metal.metal.value) &&
classroomCost.value.boxes.lte(boxes.boxes.value) && sleighCost.value.plastic.lte(plastic.plastic.value)
classroomCost.value.metalIngots.lte(metal.metal.value)*/
true
); );
}, },
onPurchase() { onPurchase() {
/*trees.logs.value = Decimal.sub(trees.logs.value, classroomCost.value.wood); this.amount.value = Decimal.add(this.amount.value, 1);
paper.paper.value = Decimal.sub(paper.paper.value, classroomCost.value.paper);
boxes.boxes.value = Decimal.sub(boxes.boxes.value, classroomCost.value.boxes);
metal.metal.value = Decimal.sub(metal.metal.value, classroomCost.value.metalIngots);
this.amount.value = Decimal.add(this.amount.value, 1);*/
}, },
visibility: () => showIf(Decimal.lt(sleighProgress.value.value, 100)), visibility: () => showIf(Decimal.lt(sleighProgress.value.value, 100)),
style: "width: 600px" style: "width: 600px"
})) as GenericBuyable; })) as GenericBuyable;
const shouldShowPopups = computed(() => true);
/*const buildFoundationHK = createHotkey(() => ({
key: "x",
description: "Fix sleigh",
onPress: () => {
if (buildFoundation.canClick.value) buildFoundation.onClick();
},
enabled: noPersist(main.days[day - 1].opened)
}));*/
const shouldShowPopups = computed(() => !elves.milestones[6].earned.value);
const milestone1 = createMilestone(() => ({ const milestone1 = createMilestone(() => ({
display: { display: {
requirement: "1% Foundation Completed", requirement: "1% Sleigh Fixed",
effectDisplay: "Trees give 5% more logs for each % of foundation completed" effectDisplay: "Ore gives 5% more metal for each % of sleigh fixed"
}, },
shouldEarn: () => Decimal.gte(sleighProgress.value.value, 1), shouldEarn: () => Decimal.gte(sleighProgress.value.value, 1),
showPopups: shouldShowPopups showPopups: shouldShowPopups
@ -184,11 +178,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
{render(dayProgress)} {render(dayProgress)}
<Spacer /> <Spacer />
<div> <div>
<span>The foundation is </span> <span>The sleigh is </span>
<h2 style={`color: ${color}; text-shadow: 0 0 10px ${color}`}> <h2 style={`color: ${color}; text-shadow: 0 0 10px ${color}`}>
{formatWhole(sleighProgress.value.value)} {formatWhole(sleighProgress.value.value)}
</h2> </h2>
% completed % fixed
</div> </div>
{Decimal.lt(sleighProgress.value.value, 100) || {Decimal.lt(sleighProgress.value.value, 100) ||
management.elfTraining.expandersElfTraining.milestones[2].earned.value ? ( management.elfTraining.expandersElfTraining.milestones[2].earned.value ? (