Fixed mastery.saplings

This commit is contained in:
thepaperpilot 2022-12-16 00:40:03 -06:00
parent 80a74c13a2
commit bc13b05d85

View file

@ -61,7 +61,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
const totalTrees = createSequentialModifier(() => [
createAdditiveModifier(() => ({
addend: () => Decimal.times((main.isMastery.value ? mastery.expandingForestBuyable : expandingForestBuyable).amount.value, 10),
addend: () =>
Decimal.times(
(main.isMastery.value ? mastery.expandingForestBuyable : expandingForestBuyable)
.amount.value,
10
),
description: "Expand Forest",
enabled: (main.isMastery.value ? mastery.researchUpgrade2 : researchUpgrade2).bought
})),
@ -93,7 +98,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
createAdditiveModifier(() => ({
addend: () => Decimal.pow(computedManualCuttingAmount.value, 0.99),
description: "Hope Level 1",
enabled: () => management.elfTraining.expandersElfTraining.milestones[0].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.expandersElfTraining.milestones[0].earned.value &&
!main.isMastery.value
}))
]) as WithRequired<Modifier, "description" | "revert">;
const trees = createResource(
@ -299,7 +306,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
createAdditiveModifier(() => ({
addend: computedAutoCuttingAmount,
description: "Smart Knives",
enabled: main.isMastery.value ? mastery.manualCutUpgrade3.bought : manualCutUpgrade3.bought
enabled: main.isMastery.value
? mastery.manualCutUpgrade3.bought
: manualCutUpgrade3.bought
}))
]);
const computedManualCuttingAmount = computed(() => manualCuttingAmount.apply(1));
@ -307,7 +316,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: 0.5,
description: "Sharper Fingers",
enabled: main.isMastery.value ? mastery.manualCutUpgrade2.bought : manualCutUpgrade2.bought
enabled: main.isMastery.value
? mastery.manualCutUpgrade2.bought
: manualCutUpgrade2.bought
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.pow(0.5, elves.totalElves.value),
@ -356,13 +367,17 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.pow(1.1, main.day.value),
description: "Holly Level 4",
enabled: () => management.elfTraining.cutterElfTraining.milestones[3].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.cutterElfTraining.milestones[3].earned.value &&
!main.isMastery.value
})),
createAdditiveModifier(() => ({
addend: () =>
Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0),
description: "Ivy Level 5",
enabled: () => management.elfTraining.planterElfTraining.milestones[4].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.planterElfTraining.milestones[4].earned.value &&
!main.isMastery.value
}))
]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0));
@ -371,12 +386,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
createAdditiveModifier(() => ({
addend: 1,
description: "Leafy Fingers",
enabled: main.isMastery.value ? mastery.manualPlantUpgrade1.bought : manualPlantUpgrade1.bought
enabled: main.isMastery.value
? mastery.manualPlantUpgrade1.bought
: manualPlantUpgrade1.bought
})),
createAdditiveModifier(() => ({
addend: computedAutoPlantingAmount,
description: "Smart Spades",
enabled: main.isMastery.value ? mastery.manualPlantUpgrade3.bought : manualPlantUpgrade3.bought
enabled: main.isMastery.value
? mastery.manualPlantUpgrade3.bought
: manualPlantUpgrade3.bought
}))
]);
const computedManualPlantingAmount = computed(() => manualPlantingAmount.apply(1));
@ -384,7 +403,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: 0.5,
description: "Greener Fingers",
enabled: main.isMastery.value ? mastery.manualPlantUpgrade2.bought : manualPlantUpgrade2.bought
enabled: main.isMastery.value
? mastery.manualPlantUpgrade2.bought
: manualPlantUpgrade2.bought
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.pow(0.5, elves.totalElves.value),
@ -398,10 +419,18 @@ const layer = createLayer(id, function (this: BaseLayer) {
createAdditiveModifier(() => ({
addend: 1,
description: "Automated Spade",
enabled: main.isMastery.value ? mastery.autoPlantUpgrade1.bought : autoPlantUpgrade1.bought
enabled: main.isMastery.value
? mastery.autoPlantUpgrade1.bought
: autoPlantUpgrade1.bought
})),
createAdditiveModifier(() => ({
addend: () => Decimal.div(main.isMastery.value ? mastery.autoPlantingBuyable1.amount.value : autoPlantingBuyable1.amount.value, 2),
addend: () =>
Decimal.div(
main.isMastery.value
? mastery.autoPlantingBuyable1.amount.value
: autoPlantingBuyable1.amount.value,
2
),
description: "Generic Planters",
enabled: researchUpgrade2.bought
})),
@ -433,23 +462,31 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "Ivy Level 1",
enabled: () => management.elfTraining.planterElfTraining.milestones[0].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.planterElfTraining.milestones[0].earned.value &&
!main.isMastery.value
})),
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.value && !main.isMastery.value
enabled: () =>
management.elfTraining.planterElfTraining.milestones[2].earned.value &&
!main.isMastery.value
})),
createMultiplicativeModifier(() => ({
multiplier: 2,
description: "Mary Level 4",
enabled: () => management.elfTraining.heatedPlanterElfTraining.milestones[3].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.heatedPlanterElfTraining.milestones[3].earned.value &&
!main.isMastery.value
})),
createAdditiveModifier(() => ({
addend: () =>
Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0),
description: "Ivy Level 5",
enabled: () => management.elfTraining.planterElfTraining.milestones[4].earned.value && !main.isMastery.value
enabled: () =>
management.elfTraining.planterElfTraining.milestones[4].earned.value &&
!main.isMastery.value
}))
]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0));
@ -458,12 +495,16 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: 1.25,
description: "Research I",
enabled: main.isMastery.value ? mastery.researchUpgrade1.bought : researchUpgrade1.bought
enabled: main.isMastery.value
? mastery.researchUpgrade1.bought
: researchUpgrade1.bought
})),
createMultiplicativeModifier(() => ({
multiplier: 1.25,
description: "Research II",
enabled: main.isMastery.value ? mastery.researchUpgrade2.bought : researchUpgrade2.bought
enabled: main.isMastery.value
? mastery.researchUpgrade2.bought
: researchUpgrade2.bought
})),
createMultiplicativeModifier(() => ({
multiplier: () =>
@ -518,15 +559,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
createMultiplicativeModifier(() => ({
multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(9)),
description: "Holly Level 1",
enabled () {
return management.elfTraining.cutterElfTraining.milestones[0].earned.value && !main.isMastery.value;
enabled() {
return (
management.elfTraining.cutterElfTraining.milestones[0].earned.value &&
!main.isMastery.value
);
}
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.sqrt(management.totalElfLevels.value),
description: "Noel Level 1",
enabled () {
return management.elfTraining.fertilizerElfTraining.milestones[0].earned.value && !main.isMastery.value;
enabled() {
return (
management.elfTraining.fertilizerElfTraining.milestones[0].earned.value &&
!main.isMastery.value
);
}
})),
createMultiplicativeModifier(() => ({
@ -574,7 +621,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
minHeight: "80px"
},
canClick: () =>
Decimal.gte((main.isMastery.value ? mastery.trees.value : trees.value), 1) &&
Decimal.gte(main.isMastery.value ? mastery.trees.value : trees.value, 1) &&
Decimal.gte(manualCutProgress.value, computedManualCuttingCooldown.value),
onClick() {
if (Decimal.lt(manualCutProgress.value, computedManualCuttingCooldown.value)) {
@ -593,8 +640,14 @@ const layer = createLayer(id, function (this: BaseLayer) {
)
);
if (main.isMastery.value) {
mastery.logs.value = Decimal.add(mastery.logs.value, Decimal.times(logGain.apply(1), amount));
mastery.saplings.value = Decimal.add(Decimal.mul(mastery.saplings.value, 2), amount);
mastery.logs.value = Decimal.add(
mastery.logs.value,
Decimal.times(logGain.apply(1), amount)
);
mastery.saplings.value = Decimal.add(
Decimal.mul(mastery.saplings.value, 2),
amount
);
} else {
logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount));
saplings.value = Decimal.add(saplings.value, amount);
@ -662,34 +715,44 @@ const layer = createLayer(id, function (this: BaseLayer) {
title: "Logs per Tree",
modifier: logGain,
base: 1,
visible: main.isMastery.value ? mastery.researchUpgrade1.bought : researchUpgrade1.bought
visible: main.isMastery.value
? mastery.researchUpgrade1.bought
: researchUpgrade1.bought
},
{
title: "Manual Cutting Amount",
modifier: manualCuttingAmount,
base: 1,
visible: main.isMastery.value ? mastery.manualCutUpgrade1.bought : manualCutUpgrade1.bought,
visible: main.isMastery.value
? mastery.manualCutUpgrade1.bought
: manualCutUpgrade1.bought,
unit: "/click"
},
{
title: "Manual Cutting Cooldown",
modifier: manualCuttingCooldown,
base: 1,
visible: main.isMastery.value ? mastery.manualCutUpgrade1.bought : manualCutUpgrade1.bought,
visible: main.isMastery.value
? mastery.manualCutUpgrade1.bought
: manualCutUpgrade1.bought,
unit: "s"
},
{
title: "Manual Planting Amount",
modifier: manualPlantingAmount,
base: 1,
visible: main.isMastery.value ? mastery.manualPlantUpgrade1.bought : manualPlantUpgrade1.bought,
visible: main.isMastery.value
? mastery.manualPlantUpgrade1.bought
: manualPlantUpgrade1.bought,
unit: "/click"
},
{
title: "Manual Planting Cooldown",
modifier: manualPlantingCooldown,
base: 1,
visible: main.isMastery.value ? mastery.manualPlantUpgrade1.bought : manualPlantUpgrade1.bought,
visible: main.isMastery.value
? mastery.manualPlantUpgrade1.bought
: manualPlantUpgrade1.bought,
unit: "s"
},
{
@ -710,7 +773,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
title: `Forest Size`,
modifier: totalTrees,
base: 10,
visible: main.isMastery.value ? mastery.researchUpgrade2.bought: researchUpgrade2.bought,
visible: main.isMastery.value
? mastery.researchUpgrade2.bought
: researchUpgrade2.bought
}
]);
const showModifiersModal = ref(false);
@ -759,7 +824,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
lastAutoCuttingAmount.value = Decimal.isNaN(cuttingAmount) ? 0 : cuttingAmount;
const amountCut = Decimal.min(
(main.isMastery ? mastery.trees.value : trees.value),
main.isMastery ? mastery.trees.value : trees.value,
Decimal.times(computedAutoCuttingAmount.value, diff)
);
const logsGained = Decimal.mul(logGain.apply(1), amountCut);
@ -823,7 +888,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
// This would be a lazy proxy if the typings worked properly, REEE
// Doesn't matter too much, nothing needs lazy inittialization
const mastery = (() => {
const logs = createResource<DecimalSource>(0, "logs")
const logs = createResource<DecimalSource>(0, "logs");
const saplings = createResource<DecimalSource>(0, "saplings");
const manualCutUpgrade1 = createUpgrade(() => ({
resource: noPersist(logs),
cost: 10,
@ -871,7 +937,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
autoPlantUpgrade1,
researchUpgrade1
];
const manualCutUpgrade2 = createUpgrade(() => ({
resource: noPersist(logs),
cost: 50,
@ -926,7 +992,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
manualPlantUpgrade3,
researchUpgrade2
];
const autoCuttingBuyable1 = createBuyable(() => ({
resource: noPersist(logs),
cost() {
@ -962,7 +1028,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
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);
const cost = Decimal.times(100, v).add(200);
/*if (management.elfTraining.planterElfTraining.milestones[3].earned.value) {
cost = Decimal.div(cost, 10);
}*/
@ -1034,8 +1100,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
row1Buyables,
row1Upgrades,
row2Upgrades
}
})();
};
})();
//mastery.manualCutUpgrade1
return {
@ -1096,14 +1162,19 @@ const layer = createLayer(id, function (this: BaseLayer) {
{renderRow(cutTree, plantTree)}
<div>Tip: You can hold down on actions to perform them automatically</div>
<Spacer />
{renderGrid(...main.isMastery.value ? [mastery.row1Upgrades, mastery.row2Upgrades] : [row1Upgrades, row2Upgrades])}
{renderGrid(
...(main.isMastery.value
? [mastery.row1Upgrades, mastery.row2Upgrades]
: [row1Upgrades, row2Upgrades])
)}
<Spacer />
{renderRow(...main.isMastery.value ? mastery.row1Buyables : row1Buyables)}
{renderRow(...(main.isMastery.value ? mastery.row1Buyables : row1Buyables))}
</>
)),
minimizedDisplay: jsx(() => (
<div>
{name} - {format(main.isMastery.value ? mastery.logs.value : logs.value)} {logs.displayName}
{name} - {format(main.isMastery.value ? mastery.logs.value : logs.value)}{" "}
{logs.displayName}
</div>
)),
mastered