fixes some issues

This commit is contained in:
circle-gon 2022-12-12 01:38:17 +00:00
parent 9ceacb08d9
commit 6199f07fbc

View file

@ -79,7 +79,8 @@ const layer = createLayer(id, () => {
description: description:
"Yay, you have a school. Too bad it has pretty much nothing in it. Maybe you could add some classrooms to make it less boring and more enticing to the Elves?" "Yay, you have a school. Too bad it has pretty much nothing in it. Maybe you could add some classrooms to make it less boring and more enticing to the Elves?"
}, },
resources: boxes.boxes, resource: boxes.boxes,
style: "width: 150px",
cost: 1e13 cost: 1e13
})); }));
const globalXPModifier = createSequentialModifier(() => [ const globalXPModifier = createSequentialModifier(() => [
@ -193,7 +194,7 @@ const layer = createLayer(id, () => {
requirement: "Holly Level 2", requirement: "Holly Level 2",
effectDisplay: "Holly now buys max." effectDisplay: "Holly now buys max."
}, },
visibility: showIf(cutterElfMilestones[0].earned.value), visibility: () => showIf(cutterElfMilestones[0].earned.value),
shouldEarn: () => cutterElfTraining.level.value >= 2 shouldEarn: () => cutterElfTraining.level.value >= 2
})), })),
createMilestone(() => ({ createMilestone(() => ({
@ -202,7 +203,7 @@ const layer = createLayer(id, () => {
effectDisplay: effectDisplay:
"Cutting speed multiplies cloth gain, wool gain (increasing the requirement as well), and sheep gain." "Cutting speed multiplies cloth gain, wool gain (increasing the requirement as well), and sheep gain."
}, },
visibility: showIf(cutterElfMilestones[1].earned.value), visibility: () => showIf(cutterElfMilestones[1].earned.value),
shouldEarn: () => cutterElfTraining.level.value >= 3 shouldEarn: () => cutterElfTraining.level.value >= 3
})) }))
] as Array<GenericMilestone>; ] as Array<GenericMilestone>;
@ -219,7 +220,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 2", requirement: "Ivy Level 2",
effectDisplay: "Ivy now buys max." effectDisplay: "Ivy now buys max."
}, },
visibility: showIf(planterElfMilestones[0].earned.value), visibility: () => showIf(planterElfMilestones[0].earned.value),
shouldEarn: () => planterElfTraining.level.value >= 2 shouldEarn: () => planterElfTraining.level.value >= 2
})), })),
createMilestone(() => ({ createMilestone(() => ({
@ -227,7 +228,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 3", requirement: "Ivy Level 3",
effectDisplay: "???" effectDisplay: "???"
}, },
visibility: showIf(planterElfMilestones[1].earned.value), visibility: () => showIf(planterElfMilestones[1].earned.value),
shouldEarn: () => planterElfTraining.level.value >= 3 shouldEarn: () => planterElfTraining.level.value >= 3
})), })),
createMilestone(() => ({ createMilestone(() => ({
@ -235,7 +236,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 4", requirement: "Ivy Level 4",
effectDisplay: "???" effectDisplay: "???"
}, },
visibility: showIf(planterElfMilestones[2].earned.value), visibility: () => showIf(planterElfMilestones[2].earned.value),
shouldEarn: () => planterElfTraining.level.value >= 4 shouldEarn: () => planterElfTraining.level.value >= 4
})), })),
createMilestone(() => ({ createMilestone(() => ({
@ -243,7 +244,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 5", requirement: "Ivy Level 5",
effectDisplay: "???" effectDisplay: "???"
}, },
visibility: showIf(planterElfMilestones[3].earned.value), visibility: () => showIf(planterElfMilestones[3].earned.value),
shouldEarn: () => planterElfTraining.level.value >= 5 shouldEarn: () => planterElfTraining.level.value >= 5
})) }))
] as Array<GenericMilestone>; ] as Array<GenericMilestone>;
@ -269,7 +270,7 @@ const layer = createLayer(id, () => {
// some milestone display stuff // some milestone display stuff
const currentShown = persistent<string>("Holly"); const currentShown = persistent<string>("Holly");
const currentElfDisplay = computed(() => { const currentElfDisplay = computed(() => {
let disp: { displayMilestone: JSXFunction } = { displayMilestone: jsx(() => "") }; let disp: { displayMilestone: JSXFunction } = { displayMilestone: jsx(() => undefined) };
switch (currentShown.value) { switch (currentShown.value) {
case "Holly": case "Holly":
disp = cutterElfTraining; disp = cutterElfTraining;
@ -368,9 +369,12 @@ const layer = createLayer(id, () => {
if (main.day.value < day) return; if (main.day.value < day) return;
for (const elf of Object.values(elfTraining)) { for (const elf of Object.values(elfTraining)) {
const times = Math.floor(elf.amountOfTimesDone.value); const times = Math.floor(elf.amountOfTimesDone.value);
if (times >= 1 && Decimal.lt(elf.level.value, schools.amount.value)) { if (times >= 1) {
elf.amountOfTimesDone.value -= times; elf.amountOfTimesDone.value -= times;
elf.exp.value = Decimal.mul(elf.elfXPGainComputed.value, times).add(elf.exp.value); if (Decimal.lt(elf.level.value, schools.amount.value))
elf.exp.value = Decimal.mul(elf.elfXPGainComputed.value, times).add(
elf.exp.value
);
} }
} }
}); });