just_another_tree/js/data/progress.js
2024-04-09 16:19:14 +01:00

296 lines
14 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)
}},
color: "#0c6949",
requires() {
let req = new Decimal(1)
if (hasMilestone('f', 2)) { req = req.mul(0.5) }
if (hasUpgrade('f', 33)) { req = req.mul(0.75) }
if (hasUpgrade('f', 43)) { req = req.div(upgradeEffect('f', 43)) }
return req
}, // 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.3, // Prestige currency exponent
gainMult() { // Calculate the multiplier for main currency from bonuses
let mult = new Decimal(1)
mult = mult.mul(buyableEffect(this.layer, 11))
mult = mult.mul(getThetaEffect())
if (hasMilestone('f', 0)) mult = mult.mul(3)
mult = mult.mul(tmp.i.numberEffect)
return mult
},
gainExp() { // Calculate the exponent on main currency from bonuses
return new Decimal(1)
},
doReset(resettingLayer) {
if (layers[resettingLayer].row <= this.row) return
if (hasMilestone('f', 3) && resettingLayer == 'sp') return
let keep = []
layerDataReset(this.layer, keep)
if (hasMilestone('i', 1)) player[this.layer].points = player[this.layer].points.max(1000)
},
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)}},
],
passiveGeneration() {
let gain = 0
if (hasUpgrade('f', 23)) gain += 0.1
if (hasUpgrade('f', 44)) gain += 0.15
return gain
},
automate() {
if (hasMilestone('f', 5)) {
Object.values(tmp[this.layer].buyables).forEach(i => { if (i.canAfford) i.buy() })
}
},
bars: {
alpha: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getAlphaCost()) },
display() {
return "Alpha - Level " + format(getAlphaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getAlphaCost())
+ ")<br>Effect: +" + format(getAlphaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"}
},
alphaRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getAlphaLevel().div(getAlphaRankCost()) },
display() {
return "Alpha - Rank " + format(getAlphaRank()) + " (" + format(getAlphaLevel()) + "/" + format(getAlphaRankCost())
+ ")<br>Effect: +" + format(getAlphaRankEffect()) + " to Alpha effect base."
},
fillStyle: {backgroundColor: "#0c6949"},
},
beta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getBetaCost()) },
display() {
return "Beta - Level " + format(getBetaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getBetaCost())
+ ")<br>Effect: x" + format(getBetaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getAlphaLevel().gt(0) }
},
betaRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getBetaLevel().div(getBetaRankCost()) },
display() {
return "Beta - Rank " + format(getBetaRank()) + " (" + format(getBetaLevel()) + "/" + format(getBetaRankCost())
+ ")<br>Effect: +" + format(getBetaRankEffect()) + " to Beta effect base."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getAlphaLevel().gt(0) }
},
gamma: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getGammaCost()) },
display() {
return "Gamma - Level " + format(getGammaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getGammaCost())
+ ")<br>Effect: x" + format(getGammaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getBetaLevel().gt(0) }
},
gammaRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getGammaLevel().div(getGammaRankCost()) },
display() {
return "Gamma - Rank " + format(getGammaRank()) + " (" + format(getGammaLevel()) + "/" + format(getGammaRankCost())
+ ")<br>Effect: +" + format(getGammaRankEffect()) + " to Gamma effect exponent."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getBetaLevel().gt(0) }
},
delta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getDeltaCost()) },
display() {
return "Delta - Level " + format(getDeltaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getDeltaCost())
+ ")<br>Effect: x" + format(getDeltaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getGammaLevel().gt(0) }
},
deltaRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getDeltaLevel().div(getDeltaRankCost()) },
display() {
return "Delta - Rank " + format(getDeltaRank()) + " (" + format(getDeltaLevel()) + "/" + format(getDeltaRankCost())
+ ")<br>Effect: +" + format(getDeltaRankEffect()) + " to Delta effect base."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getGammaLevel().gt(0) }
},
epsilon: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getEpsilonCost()) },
display() {
return "Epsilon - Level " + format(getEpsilonLevel()) + " (" + format(player[this.layer].points) + "/" + format(getEpsilonCost())
+ ")<br>Effect: ^" + format(getEpsilonEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getDeltaLevel().gt(0) }
},
epsilonRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getEpsilonLevel().div(getEpsilonRankCost()) },
display() {
return "Epsilon - Rank " + format(getEpsilonRank()) + " (" + format(getEpsilonLevel()) + "/" + format(getEpsilonRankCost())
+ ")<br>Effect: +" + format(getEpsilonRankEffect()) + " to Epsilon effect base."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getDeltaLevel().gt(0) }
},
zeta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getZetaCost()) },
display() {
return "Zeta - Level " + format(getZetaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getZetaCost())
+ ")<br>Effect: x" + format(getZetaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getEpsilonLevel().gt(0) }
},
zetaRank: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return getZetaLevel().div(getZetaRankCost()) },
display() {
return "Zeta - Rank " + format(getZetaRank()) + " (" + format(getZetaLevel()) + "/" + format(getZetaRankCost())
+ ")<br>Effect: +" + format(getZetaRankEffect()) + " to Zeta effect base."
},
fillStyle: {backgroundColor: "#0c6949"},
unlocked() { return getEpsilonLevel().gt(0) }
},
},
buyables: {
11: {
title: "More progress",
effect() { return Decimal.pow(1.1, getBuyableAmount(this.layer, this.id)) },
cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.2).mul(5).add(50) },
display() {
return "Increase progress point gain.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
+ ".<br>Effect: x" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
+ format(this.cost(getBuyableAmount(this.layer, this.id))) + " total levels."
},
canAfford() { return Decimal.gte(getTotalLevel(), this.cost()) },
buy() { addBuyables(this.layer, this.id, 1) }
},
12: {
title: "Rebased",
effect() { return Decimal.add(getBuyableAmount(this.layer, this.id), hasUpgrade('f', 21) ? 2 : 0).pow_base(0.95) },
cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.4).mul(7).add(80) },
display() {
return "Decrease Gamma effect log base.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
+ ".<br>Effect: ^" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
+ format(this.cost(getBuyableAmount(this.layer, this.id))) + " total levels."
},
canAfford() { return Decimal.gte(getTotalLevel(), this.cost()) },
buy() { addBuyables(this.layer, this.id, 1) }
},
13: {
title: "Shorter bars",
effect() { return Decimal.add(getBuyableAmount(this.layer, this.id), hasUpgrade('f', 22) ? 2 : 0).pow_base(0.98) },
cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.6).mul(10).add(100) },
display() {
return "Decrease all level costs.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
+ ".<br>Effect: ^" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
+ format(this.cost(getBuyableAmount(this.layer, this.id))) + " total levels."
},
canAfford() { return Decimal.gte(getTotalLevel(), this.cost()) },
buy() { addBuyables(this.layer, this.id, 1) }
}
},
clickables: {
11: {
display() { return "Hold to gain PP" },
canClick() { return true },
onClick() { if (canReset(this.layer)) doReset(this.layer) },
onHold() { if (canReset(this.layer)) doReset(this.layer) }
}
},
tabFormat: {
levels: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
["raw-html", () => "You have " + format(getTotalLevel()) + " level" + (getTotalLevel().eq(1) ? "" : "s") + "."],
["raw-html", () => "You have " + format(getTotalRank()) + " rank" + (getTotalRank().eq(1) ? "" : "s") + "."],
"blank",
"blank",
["bar", "alpha"],
["bar", "beta"],
["bar", "gamma"],
["bar", "delta"],
["bar", "epsilon"],
["bar", "zeta"]
]
},
ranks: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
["raw-html", () => "You have " + format(getTotalLevel()) + " level" + (getTotalLevel().eq(1) ? "" : "s") + "."],
["raw-html", () => "You have " + format(getTotalRank()) + " rank" + (getTotalRank().eq(1) ? "" : "s") + "."],
"blank",
"blank",
["bar", "alphaRank"],
["bar", "betaRank"],
["bar", "gammaRank"],
["bar", "deltaRank"],
["bar", "epsilonRank"],
["bar", "zetaRank"]
],
unlocked() { return getAlphaLevel().gte(18) }
},
buyables: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
["raw-html", () => "You have " + format(getTotalLevel()) + " level" + (getTotalLevel().eq(1) ? "" : "s") + "."],
["raw-html", () => "You have " + format(getTotalRank()) + " rank" + (getTotalRank().eq(1) ? "" : "s") + "."],
"blank",
"blank",
"buyables"
],
unlocked() { return getTotalLevel().gte(45) }
}
},
layerShown(){return true}
})