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

179 lines
7.9 KiB
JavaScript

addLayer("sp", {
name: "super 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: 1, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
startData() { return {
unlocked: false,
points: new Decimal(0)
}},
color: "#107f76",
requires() {
let req = new Decimal(5000)
if (hasUpgrade('f', 54)) req = req.div(2)
return req
}, // Can be a function that takes requirement increases into account
resource: "super 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.35, // Prestige currency exponent
gainMult() { // Calculate the multiplier for main currency from bonuses
let mult = new Decimal(1)
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 buyableEffect('sp', 11)
},
row: 1, // Row the layer is in on the tree (0 is the first row)
displayRow: 0,
hotkeys: [
{key: "s", description: "S: Reset for super progress points", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
],
passiveGeneration() {
let gain = 0
if (hasUpgrade('f', 62)) gain += 0.2
return gain
},
onPrestige(gain) {
if (player.p.points.eq(0)) { player.ach.has45 = true }
},
automate() {
if (hasMilestone('f', 10)) {
Object.values(tmp[this.layer].buyables).forEach(i => { if (i.canAfford) i.buy() })
}
},
doReset(resettingLayer) {
if (layers[resettingLayer].row <= this.row) return;
let keep = []
layerDataReset(this.layer, keep)
if (hasMilestone('i', 1)) player[this.layer].points = player[this.layer].points.max(250)
},
bars: {
eta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getEtaCost()) },
display() {
return "Eta - Level " + format(getEtaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getEtaCost())
+ ")<br>Effect: +" + format(getEtaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#107f76"}
},
theta: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getThetaCost()) },
display() {
return "Theta - Level " + format(getThetaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getThetaCost())
+ ")<br>Effect: x" + format(getThetaEffect()) + " to PP."
},
fillStyle: {backgroundColor: "#107f76"},
unlocked() { return getEtaLevel().gt(0) }
},
iota: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getIotaCost()) },
display() {
return "Iota - Level " + format(getIotaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getIotaCost())
+ ")<br>Effect: ^" + format(getIotaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#107f76"},
unlocked() { return getThetaLevel().gt(0) }
},
kappa: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getKappaCost()) },
display() {
return "Kappa - Level " + format(getKappaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getKappaCost())
+ ")<br>Effect: x" + format(getKappaEffect()) + " to first softcap's start."
},
fillStyle: {backgroundColor: "#107f76"},
unlocked() { return getIotaLevel().gt(0) }
},
lambda: {
direction: RIGHT,
width: 300,
height: 50,
progress() { return player[this.layer].points.div(getLambdaCost()) },
display() {
return "Lambda - Level " + format(getLambdaLevel()) + " (" + format(player[this.layer].points) + "/" + format(getLambdaCost())
+ ")<br>Effect: x" + format(getLambdaEffect()) + " to point gen."
},
fillStyle: {backgroundColor: "#107f76"},
unlocked() { return getKappaLevel().gt(0) }
},
},
buyables: {
11: {
title: "Much more progress",
effect() { return Decimal.div(getBuyableAmount(this.layer, this.id), 20).add(1) },
cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.2).mul(3).add(20) },
display() {
return "Increase SPP gain.<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 super levels."
},
canAfford() { return Decimal.gte(getTotalSuperLevel(), this.cost()) },
buy() { addBuyables(this.layer, this.id, 1) }
},
12: {
title: "Super point booster",
effect() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.3).add(1) },
cost() { return Decimal.pow(getBuyableAmount(this.layer, this.id), 1.2).mul(5).add(25) },
display() {
return "Increase point gen.<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 super levels."
},
canAfford() { return Decimal.gte(getTotalSuperLevel(), this.cost()) },
buy() { addBuyables(this.layer, this.id, 1) }
},
},
clickables: {
11: {
display() { return "Hold to gain SPP" },
canClick() { return true },
onClick() { if (canReset(this.layer)) doReset(this.layer) },
onHold() { if (canReset(this.layer)) doReset(this.layer) }
}
},
tabFormat: {
"super levels": {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
["raw-html", () => "You have " + format(getTotalSuperLevel()) + " super level" + (getTotalSuperLevel().eq(1) ? "" : "s") + "."],
"blank",
"blank",
["bar", "eta"],
["bar", "theta"],
["bar", "iota"],
["bar", "kappa"],
["bar", "lambda"],
]
},
"super buyables": {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
["raw-html", () => "You have " + format(getTotalSuperLevel()) + " super level" + (getTotalSuperLevel().eq(1) ? "" : "s") + "."],
"blank",
"blank",
"buyables",
],
unlocked() { return getTotalSuperLevel().gte(18) }
},
},
layerShown(){ return player.points.gte(4000) || player[this.layer].unlocked },
branches: ['p'],
})