Fix elves resetting things when they shouldn't

This commit is contained in:
thepaperpilot 2022-12-24 22:00:18 -06:00
parent 0dbcefa723
commit 2dde092baf

View file

@ -49,6 +49,21 @@ export interface ElfBuyable extends GenericBuyable {
const id = "elves"; const id = "elves";
const day = 4; const day = 4;
const elvesThatReset = [
"Holly",
"Ivy",
"Hope",
"Jack",
"Mary",
"Noel",
"Joy",
"Faith",
"Snowball",
"Star",
"Bell",
"Gingersnap"
];
const layer = createLayer(id, function (this: BaseLayer) { const layer = createLayer(id, function (this: BaseLayer) {
const name = "Elves"; const name = "Elves";
const colorBright = "red"; const colorBright = "red";
@ -730,16 +745,13 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: jsx(() => ( description: jsx(() => (
<> <>
{options.description} {options.description}
{upgrade.bought.value || {upgrade.bought.value || elvesThatReset.includes(options.name) ? (
["Peppermint", "Twinkle", "Cocoa", "Frosty"].includes(
options.name
) ? null : (
<> <>
{" "} {" "}
Training this elf will require resetting all your progress from Training this elf will require resetting all your progress from
days 1-3. days 1-3.
</> </>
)} ) : null}
{upgrade.bought.value && options.hasToggle === true ? ( {upgrade.bought.value && options.hasToggle === true ? (
<> <>
<Toggle <Toggle
@ -756,11 +768,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
style: "width: 190px", style: "width: 190px",
onPurchase() { onPurchase() {
options.onPurchase?.(); options.onPurchase?.();
if ( if (!elvesThatReset.includes(options.name)) {
!["Peppermint", "Twinkle", "Cocoa", "Frosty", "Carol", "Jingle"].includes(
options.name
)
) {
elfReset.reset(); elfReset.reset();
} }
} }
@ -1041,13 +1049,17 @@ const layer = createLayer(id, function (this: BaseLayer) {
const packingElf = createElf({ const packingElf = createElf({
name: "Jingle", name: "Jingle",
description: "Jingle will automatically hire more elves to help out with packing the sleigh.", description:
"Jingle will automatically hire more elves to help out with packing the sleigh.",
buyable: [packing.helpers.elf, packing.helpers.loader], buyable: [packing.helpers.elf, packing.helpers.loader],
cooldownModifier: packingCooldown, cooldownModifier: packingCooldown,
visibility: () => showIf(packing.upgrades.packingElf.bought.value), visibility: () => showIf(packing.upgrades.packingElf.bought.value),
buyMax: true, buyMax: true,
onAutoPurchase(buyable, amount) { onAutoPurchase(buyable, amount) {
if (buyable === packing.helpers.loader && !management.elfTraining.packingElfTraining.milestones[3].earned.value) { if (
buyable === packing.helpers.loader &&
!management.elfTraining.packingElfTraining.milestones[3].earned.value
) {
buyable.amount.value = Decimal.sub(buyable.amount.value, amount); buyable.amount.value = Decimal.sub(buyable.amount.value, amount);
} }
} }