Fixed some dye elf stuff

This commit is contained in:
thepaperpilot 2022-12-18 20:12:00 -06:00
parent e42e1f4c32
commit c50b9873c5
2 changed files with 11 additions and 6 deletions

View file

@ -901,8 +901,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
});
const managementElves2 = [metalElf];
const dyeColors = Object.fromEntries((["red", "yellow", "blue", "orange", "green", "purple"] as enumColor[])
.map(color => [dyes.dyes[color].buyable.id, color])) as Record<string, enumColor>;
const dyeColors = Object.fromEntries(
(["red", "yellow", "blue", "orange", "green", "purple"] as enumColor[]).map(color => [
dyes.dyes[color].buyable.id,
color
])
) as Record<string, enumColor>;
const dyeElf = createElf({
name: "Carol",
description:
@ -910,11 +914,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
buyable: Object.values(dyes.dyes).map(dye => dye.buyable),
cooldownModifier: dyeCooldown, // Note: Buy max will be unlocked at this point
visibility: () => showIf(wrappingPaper.unlockDyeElfMilestone.earned.value),
buyMax: management.elfTraining.dyeElfTraining.milestones[2].earned,
buyMax: () => management.elfTraining.dyeElfTraining.milestones[2].earned.value,
onAutoPurchase(buyable, amount) {
if (["orange", "green", "purple"].includes(dyeColors[buyable.id])) {
if (!ribbon.milestones.secondaryDyeElf.earned.value) {
buyable.amount.value = Decimal.sub(buyable.amount.value, amount)
buyable.amount.value = Decimal.sub(buyable.amount.value, amount);
return;
}
}

View file

@ -292,10 +292,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
visibility: () => showIf(elves.elves.dyeElf.bought.value)
});
const secondaryDyeBook = createBook({
name: "",
name: "Natural Dyeing",
elfName: "Carol",
buyableName: "Secondary Dyes",
visibility: () => showIf(elves.elves.dyeElf.bought.value && ribbon.milestones.dyeBook.earned.value)
visibility: () =>
showIf(elves.elves.dyeElf.bought.value && ribbon.milestones.dyeBook.earned.value)
});
const books = {
cuttersBook,