1
0
Fork 0
mirror of https://github.com/thepaperpilot/Advent-Incremental.git synced 2025-03-21 21:51:45 +00:00

Implemented boxes mastery

This commit is contained in:
thepaperpilot 2022-12-18 16:58:09 -06:00
parent 294cd5c989
commit c48244531b

View file

@ -27,7 +27,7 @@ import { WithRequired } from "util/common";
import { render, renderGrid, renderRow } from "util/vue"; import { render, renderGrid, renderRow } from "util/vue";
import { computed, ComputedRef, ref, unref } from "vue"; import { computed, ComputedRef, ref, unref } from "vue";
import dyes from "./dyes"; import dyes from "./dyes";
import { ElfBuyable } from "./elves"; import elves, { ElfBuyable } from "./elves";
import management from "./management"; import management from "./management";
import paper from "./paper"; import paper from "./paper";
import plastic from "./plastic"; import plastic from "./plastic";
@ -58,9 +58,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
createExponentialModifier(() => ({ createExponentialModifier(() => ({
exponent: 1.1, exponent: 1.1,
description: "Bell Level 2", description: "Bell Level 2",
enabled: () => enabled: management.elfTraining.boxElfTraining.milestones[1].earned
management.elfTraining.boxElfTraining.milestones[1].earned.value &&
!main.isMastery.value
})) }))
]) as WithRequired<Modifier, "description" | "revert">; ]) as WithRequired<Modifier, "description" | "revert">;
@ -100,7 +98,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
} }
boxesConversion.convert(); boxesConversion.convert();
}, },
style: "width: 600px; min-height: unset" style: "width: 600px; min-height: unset",
visibility: () => showIf(!main.isMastery.value || masteryEffectActive.value)
})); }));
const logsUpgrade = createUpgrade(() => ({ const logsUpgrade = createUpgrade(() => ({
@ -109,6 +108,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Double log gain and unlock a new elf for training" description: "Double log gain and unlock a new elf for training"
}, },
onPurchase() { onPurchase() {
if (masteryEffectActive.value) {
elves.elves.smallFireElf.bought.value = true;
}
main.days[3].recentlyUpdated.value = true; main.days[3].recentlyUpdated.value = true;
}, },
resource: noPersist(boxes), resource: noPersist(boxes),
@ -120,6 +122,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Double ash gain and unlock a new elf for training" description: "Double ash gain and unlock a new elf for training"
}, },
onPurchase() { onPurchase() {
if (masteryEffectActive.value) {
elves.elves.bonfireElf.bought.value = true;
}
main.days[3].recentlyUpdated.value = true; main.days[3].recentlyUpdated.value = true;
}, },
resource: noPersist(boxes), resource: noPersist(boxes),
@ -131,6 +136,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
description: "Double coal gain and unlock a new elf for training" description: "Double coal gain and unlock a new elf for training"
}, },
onPurchase() { onPurchase() {
if (masteryEffectActive.value) {
elves.elves.kilnElf.bought.value = true;
}
main.days[3].recentlyUpdated.value = true; main.days[3].recentlyUpdated.value = true;
}, },
resource: noPersist(boxes), resource: noPersist(boxes),
@ -249,14 +257,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(logsUpgrade.bought.value), visibility: () => showIf(logsUpgrade.bought.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(ashBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(ashBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(coalBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(coalBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(logBoxesBuyable.amount.value, 2)
.sub(logBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(logBoxesBuyable.amount.value, logBoxesBuyable.freeLevels.value) Decimal.add(logBoxesBuyable.amount.value, logBoxesBuyable.freeLevels.value)
) )
@ -304,14 +319,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(ashUpgrade.bought.value), visibility: () => showIf(ashUpgrade.bought.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(logBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(logBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(coalBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(coalBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(ashBoxesBuyable.amount.value, 2)
.sub(ashBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(ashBoxesBuyable.amount.value, ashBoxesBuyable.freeLevels.value) Decimal.add(ashBoxesBuyable.amount.value, ashBoxesBuyable.freeLevels.value)
) )
@ -359,14 +381,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(coalUpgrade.bought.value), visibility: () => showIf(coalUpgrade.bought.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(logBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(logBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(ashBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(ashBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(coalBoxesBuyable.amount.value, 2)
.sub(coalBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(coalBoxesBuyable.amount.value, coalBoxesBuyable.freeLevels.value) Decimal.add(coalBoxesBuyable.amount.value, coalBoxesBuyable.freeLevels.value)
) )
@ -421,14 +450,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value), visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(metalBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(metalBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(plasticBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(plasticBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(oreBoxesBuyable.amount.value, 2)
.sub(oreBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(oreBoxesBuyable.amount.value, oreBoxesBuyable.freeLevels.value) Decimal.add(oreBoxesBuyable.amount.value, oreBoxesBuyable.freeLevels.value)
) )
@ -476,14 +512,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value), visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(oreBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(oreBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(plasticBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(plasticBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(metalBoxesBuyable.amount.value, 2)
.sub(metalBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(metalBoxesBuyable.amount.value, metalBoxesBuyable.freeLevels.value) Decimal.add(metalBoxesBuyable.amount.value, metalBoxesBuyable.freeLevels.value)
) )
@ -531,14 +574,21 @@ const layer = createLayer(id, function (this: BaseLayer) {
return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0); return Decimal.isNaN(v) ? Decimal.dZero : v.floor().max(0);
}, },
visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value), visibility: () => showIf(management.elfTraining.boxElfTraining.milestones[3].earned.value),
freeLevels: computed(() => freeLevels: computed(() => {
management.elfTraining.boxElfTraining.milestones[0].earned.value let levels: DecimalSource = 0;
? Decimal.max(oreBoxesBuyable.amount.value, 1) if (management.elfTraining.boxElfTraining.milestones[0].earned.value) {
.sqrt() levels = Decimal.max(oreBoxesBuyable.amount.value, 1)
.floor() .sqrt()
.add(Decimal.max(metalBoxesBuyable.amount.value, 1).sqrt().floor()) .floor()
: 0 .add(Decimal.max(metalBoxesBuyable.amount.value, 1).sqrt().floor());
), }
if (masteryEffectActive.value) {
levels = Decimal.pow(plasticBoxesBuyable.amount.value, 2)
.sub(plasticBoxesBuyable.amount.value)
.add(levels);
}
return levels;
}),
totalAmount: computed(() => totalAmount: computed(() =>
Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value) Decimal.add(plasticBoxesBuyable.amount.value, plasticBoxesBuyable.freeLevels.value)
) )
@ -577,6 +627,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
const { total: totalBoxes, trackerDisplay } = setUpDailyProgressTracker({ const { total: totalBoxes, trackerDisplay } = setUpDailyProgressTracker({
resource: boxes, resource: boxes,
goal: 5e4, goal: 5e4,
masteryGoal: 1e9,
name, name,
day, day,
color, color,
@ -638,6 +689,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
<> <>
{render(trackerDisplay)} {render(trackerDisplay)}
<Spacer /> <Spacer />
{masteryEffectActive.value ? (
<>
Decoration effect: Effective boxes buyables' levels are squared
<Spacer />
</>
) : null}
<MainDisplay resource={boxes} color={color} style="margin-bottom: 0" /> <MainDisplay resource={boxes} color={color} style="margin-bottom: 0" />
<Spacer /> <Spacer />
{render(makeBoxes)} {render(makeBoxes)}
@ -654,7 +711,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
minimizedDisplay: jsx(() => ( minimizedDisplay: jsx(() => (
<div> <div>
{name}{" "} {name}{" "}
<span class="desc">{format(boxes.value)} {boxes.displayName}</span> <span class="desc">
{format(boxes.value)} {boxes.displayName}
</span>
</div> </div>
)), )),
mastery, mastery,