`
});
function getJobLevel(job) {
if (player[job].xp.eq(0)) {
return new Decimal(0);
}
return player[job].xp.clampMin(1).log10().floor().add(1);
}
function getJobProgressBar(job) {
return {
direction: RIGHT,
width: 400,
height: 20,
progress: () => {
let level = getJobLevel(job);
if (level.eq(0)) {
return 0;
}
let previousLevelRequirement = level.sub(1).pow10();
let progress = player[job].xp.clampMin(1).sub(previousLevelRequirement).div(level.pow10().sub(previousLevelRequirement));
return progress;
},
unlocked: true,
fillStyle: { backgroundColor: layers[job].color },
borderStyle: { borderColor: layers[job].color }
};
}
function toggleTimeLoop(layer) {
if (player[layer].timeLoopActive) {
player[layer].timeLoopActive = false;
player.usedTimeSlots = player.usedTimeSlots.sub(1).clampMin(0);
} else if (player.timeSlots.sub(player.usedTimeSlots).gte(1)) {
player[layer].timeLoopActive = true;
player.usedTimeSlots = player.usedTimeSlots.add(1);
}
}
addLayer("tree-tab", {
bars: {
flowers: getJobProgressBar("flowers"),
study: getJobProgressBar("study")
},
tabFormat: () => player.chapter < 3 ?
[
// TODO babble buds stage?
["infobox", "genesis", { "--lore-color": "white" }],
player.chapter === 2 ? ["infobox", "discovery", { "--lore-color": "orange" }] : null,
"blank",
"blank",
player.chapter === 2 ? ["display-text", `You have ${formatWhole(player.timeSlots.sub(player.usedTimeSlots))} free time slots`] : null,
player.chapter === 2 ? "blank" : null,
["job", "flowers"],
["job", "study"]
] :
{
"Main": {
content: [
// TODO babble buds stage?
["infobox", "genesis", { "--lore-color": "white" }],
["infobox", "discovery", { "--lore-color": "orange" }],
"blank",
"blank",
["job", "flowers"],
["job", "study"]
]
}
},
infoboxes: {
genesis: {
title: "Chapter 1: Genesis",
body: `[WIP, needs feedback from Hudson] Finally, I've found the flowers! The legends were true, I was able to confirm they're the real deal by reverting some scratches I received on the trek here.
I just can't believe I actually found them! I'm going to get started collecting them right away. This field is plenty large enough, so I can start harnessing the flowers to speed up the harvesting process.`
},
discovery: {
title: "Chapter 2: Discovery",
body: `[WIP, needs feedback from Hudson] The field is completely barren... Fortunately, I've collected enough flowers that I can finally create a time loop. Not only will this allow me to revert the field whenever it empties, it'll now open me up to close myself in the loop, effectively allowing it to run while the real me continues with my next task: Studying the flowers, and eventually experimenting with how to further take advantage of the time altering properties of these flowers.
It'll be prudent of me not to forget about collecting flowers, as I'll still need them as I move forward.`
}
}
});