just_another_tree/js/progress.js

106 lines
4.4 KiB
JavaScript

addLayer("p", {
name: "progress", // This is optional, only used in a few places, If absent it just uses the layer id.
symbol: "%", // This appears on the layer's node. Default is the id with the first letter capitalized
position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
startData() { return {
unlocked: true,
points: new Decimal(0),
best: new Decimal(0),
levels: {
epsilon: new Decimal(0),
}
}},
color: "#0c6949",
requires: new Decimal(1), // Can be a function that takes requirement increases into account
resource: "progress points", // Name of prestige currency
baseResource: "points", // Name of resource prestige is based on
baseAmount() {return player.points}, // Get the current amount of baseResource
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
exponent: 0.5, // Prestige currency exponent
gainMult() { // Calculate the multiplier for main currency from bonuses
mult = new Decimal(1)
return mult
},
gainExp() { // Calculate the exponent on main currency from bonuses
return new Decimal(1)
},
row: 0, // Row the layer is in on the tree (0 is the first row)
hotkeys: [
{key: "p", description: "P: Reset for progress points", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
],
bars: {
alpha: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getNextAlphaCost()) },
display() {
return "Alpha - Level " + getAlphaLevel() + " (" + player[this.layer].points + "/" + getNextAlphaCost()
+ ")<br>Effect: +" + getAlphaLevel().div(20) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
beta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getNextBetaCost()) },
display() {
return "Beta - Level " + getBetaLevel() + " (" + player[this.layer].points + "/" + getNextBetaCost()
+ ")<br>Effect: x" + getBetaLevel().div(20).add(1) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
gamma: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getNextGammaCost()) },
display() {
return "Gamma - Level " + getGammaLevel() + " (" + player[this.layer].points + "/" + getNextGammaCost()
+ ")<br>Effect: x" + getGammaLevel().div(15).add(1) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
delta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getNextDeltaCost()) },
display() {
return "Delta - Level " + getDeltaLevel() + " (" + player[this.layer].points + "/" + getNextDeltaCost()
+ ")<br>Effect: x" + getDeltaLevel().div(10).add(1) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
epsilon: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getNextEpsilonCost()) },
display() {
return "Epsilon - Level " + getEpsilonLevel() + " (" + player[this.layer].points + "/" + getNextEpsilonCost()
+ ")<br>Effect: ^" + getEpsilonLevel().div(40).add(1) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
},
update(diff) {
if (player[this.layer].points.gte(player[this.layer].levels.epsilon.pow_base(5).mul(125/2))) {
player[this.layer].levels.epsilon = player[this.layer].levels.epsilon.add(1)
}
},
tabFormat: [
"main-display",
"prestige-button",
"blank",
"h-line",
"blank",
["bar", "alpha"],
["bar", "beta"],
["bar", "gamma"],
["bar", "delta"],
["bar", "epsilon"],
],
layerShown(){return true}
})