From 99cadd3f2f77d15b8dfef6faade97c30c017d32d Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Tue, 13 Dec 2022 09:19:12 -0600 Subject: [PATCH] UpdateFix day 12 not completing --- src/data/layers/management.tsx | 52 +++++++++++++++++++++------------- src/data/projEntry.tsx | 6 ++-- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/data/layers/management.tsx b/src/data/layers/management.tsx index 1df9e3a..b201714 100644 --- a/src/data/layers/management.tsx +++ b/src/data/layers/management.tsx @@ -22,7 +22,7 @@ import { persistent } from "game/persistence"; import Decimal, { DecimalSource, format, formatTime, formatWhole } from "util/bignum"; import { Direction } from "util/common"; import { render, renderCol, renderGrid } from "util/vue"; -import { computed, ComputedRef, ref, Ref, unref, watch } from "vue"; +import { computed, ComputedRef, ref, Ref, unref, watch, watchEffect } from "vue"; import elves from "./elves"; import trees from "./trees"; import paper from "./paper"; @@ -146,18 +146,15 @@ const layer = createLayer(id, () => { if (elf.name == "Star" || elf.name == "Bell") { costMulti /= 3; } - const costBase = Decimal.mul(4000, costMulti) - const expRequiredForNextLevel = computed(() => - Decimal.pow(5, level.value).mul(costBase) - ); + const costBase = Decimal.mul(4000, costMulti); + const expRequiredForNextLevel = computed(() => Decimal.pow(5, level.value).mul(costBase)); const level = computed(() => - Decimal.affordGeometricSeries(exp.value, costBase, 5, 0).min(schools.amount.value).toNumber() + Decimal.affordGeometricSeries(exp.value, costBase, 5, 0) + .min(schools.amount.value) + .toNumber() ); const expToNextLevel = computed(() => - Decimal.sub( - exp.value, - Decimal.sumGeometricSeries(level.value, costBase, 5, 0) - ) + Decimal.sub(exp.value, Decimal.sumGeometricSeries(level.value, costBase, 5, 0)) ); const bar = createBar(() => ({ direction: Direction.Right, @@ -934,7 +931,6 @@ const layer = createLayer(id, () => { elf.exp.value ); } - } focusTime.value = Math.max(focusTime.value - diff, 0); focusCooldown.value = Math.max(focusCooldown.value - diff, 0); @@ -991,17 +987,24 @@ const layer = createLayer(id, () => { fillStyle: () => ({ background: focusTime.value > 0 ? color : "#7f7f00", opacity: focusTime.value > 0 ? focusTime.value / 10 : 1, - transition: "none", + transition: "none" }), progress: () => Decimal.sub(focusMulti.value, 1).div(Decimal.sub(focusMaxMulti.value, 1)).toNumber(), - display: jsx(() => <> - {format(focusMulti.value)}x - {focusTime.value > 0 ? <> - {" "}to {Object.keys(focusTargets.value).join(", ")} - {" "}for {formatTime(focusTime.value)} : "" - } - ) + display: jsx(() => ( + <> + {format(focusMulti.value)}x + {focusTime.value > 0 ? ( + <> + {" "} + to {Object.keys(focusTargets.value).join(", ")} for{" "} + {formatTime(focusTime.value)} + + ) : ( + "" + )} + + )) })) as GenericBar; const focusButton = createClickable(() => ({ @@ -1301,6 +1304,17 @@ const layer = createLayer(id, () => { /> )); + watchEffect(() => { + if (main.day.value === day && day12Elves.every(elf => elf.level.value >= 3)) { + main.completeDay(); + } else if ( + main.day.value === advancedDay && + day13Elves.every(elf => elf.level.value >= 5) + ) { + main.completeDay(); + } + }); + // ------------------------------------------------------------------------------- Return return { diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 0004f0e..fc8e6de 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -263,7 +263,8 @@ export const main = createLayer("main", function (this: BaseLayer) { layer: "management", symbol: managementSymbol, story: "You watch as the elves work, and you realize that they could probably be trained to help out better. Just then, Santa comes over to check on your progress. You reply that you're doing fine, except that the elves may need a bit of behavior management. Santa offers to help, saying that he doesn't want to leave you to do everything. Unfortunately for you, the behavior problems won't fix themselves, so let's get to work!", - completedStory: "Woo! You are exhausted - this layer felt really long to you. It's great seeing the elves so productive, although you worry a bit about your own job security now! Good Job!" + completedStory: + "Woo! You are exhausted - this layer felt really long to you. It's great seeing the elves so productive, although you worry a bit about your own job security now! Good Job!" })), createDay(() => ({ day: 13, @@ -271,7 +272,8 @@ export const main = createLayer("main", function (this: BaseLayer) { layer: null, // "management" (advanced) symbol: "", story: "So after a good night's rest you decide that maybe making these elves able to do all the work for you isn't something to be scared of, but rather encouraged. Let's spend another day continuing to train them up and really get this place spinning. They are Santa's elves after all, they're supposed to be able to run everything without you!", - completedStory: "The elves are doing an incredible job, and Santa does not seem keen on firing you - Score! Now you can get to work on guiding this properly trained highly functional group of hard workers to make Christmas as great as possible. Good Job!" + completedStory: + "The elves are doing an incredible job, and Santa does not seem keen on firing you - Score! Now you can get to work on guiding this properly trained highly functional group of hard workers to make Christmas as great as possible. Good Job!" })), createDay(() => ({ day: 14,