just_another_tree/js/levels.js

74 lines
3.5 KiB
JavaScript
Raw Normal View History

function cumulativeExponential(base, levels) {
return Decimal.add(levels, 1).pow_base(base).sub(1).div(Decimal.sub(base, 1))
}
function inverseCumulativeExponential(base, levels) {
return Decimal.sub(base, 1).mul(levels).add(1).log(base)
}
2024-03-09 15:11:14 +00:00
function getAlphaLevel(points = player.p.points) {
2024-03-07 17:49:20 +00:00
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.1, Decimal.pow(points, buyableEffect('p', 13).pow(-1))).floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getAlphaCost(points = player.p.points) {
return cumulativeExponential(1.1, getAlphaLevel(points)).pow(buyableEffect('p', 13))
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getAlphaEffect(points = player.p.points) {
return getAlphaLevel(points).mul(getAlphaRankEffect(points).add(1/20))
}
2024-03-09 15:11:14 +00:00
function getBetaLevel(points = player.p.points) {
2024-03-07 17:49:20 +00:00
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.25, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 5)).floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getBetaCost(points = player.p.points) {
return cumulativeExponential(1.25, getBetaLevel(points)).mul(5).pow(buyableEffect('p', 13))
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getBetaEffect(points = player.p.points) {
return getBetaLevel(points).mul(getBetaRankEffect(points).add(1/20)).add(1)
}
2024-03-09 15:11:14 +00:00
function getGammaLevel(points = player.p.points) {
2024-03-07 17:49:20 +00:00
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 15)).floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getGammaCost(points = player.p.points) {
return cumulativeExponential(1.5, getGammaLevel(points)).mul(15).pow(buyableEffect('p', 13))
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getGammaEffect(points = player.p.points) {
return Decimal.add(player.p.points, 1).log(Decimal.pow(50, buyableEffect('p', 12))).add(1).pow(
getGammaLevel(points).mul(getGammaRankEffect(points).add(1/10))
)
}
2024-03-09 15:11:14 +00:00
function getDeltaLevel(points = player.p.points) {
2024-03-07 17:49:20 +00:00
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(2, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 30)).floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getDeltaCost(points = player.p.points) {
return cumulativeExponential(2, getDeltaLevel(points)).mul(30).pow(buyableEffect('p', 13))
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getDeltaEffect(points = player.p.points) {
return getDeltaLevel(points).mul(getDeltaRankEffect(points).add(1/5)).add(1)
}
2024-03-09 15:11:14 +00:00
function getEpsilonLevel(points = player.p.points) {
2024-03-07 17:49:20 +00:00
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(2.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 50)).floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getEpsilonCost(points = player.p.points) {
return cumulativeExponential(2.5, getEpsilonLevel(points)).mul(50).pow(buyableEffect('p', 13))
}
2024-03-09 15:11:14 +00:00
function getEpsilonEffect(points = player.p.points) {
return getEpsilonLevel(points).mul(getEpsilonRankEffect(points).add(1/10)).add(1)
}
2024-03-09 15:11:14 +00:00
function getZetaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(3, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 80)).floor()
}
2024-03-09 15:11:14 +00:00
function getZetaCost(points = player.p.points) {
return cumulativeExponential(3, getZetaLevel(points)).mul(80).pow(buyableEffect('p', 13))
}
2024-03-09 15:11:14 +00:00
function getZetaEffect(points = player.p.points) {
return getZetaLevel(points).mul(getZetaRankEffect().add(1/3)).add(1)
}
function getTotalLevel() {
return getAlphaLevel().add(getBetaLevel()).add(getGammaLevel()).add(getDeltaLevel()).add(getEpsilonLevel())
.add(getZetaLevel())
2024-03-07 17:49:20 +00:00
}