just_another_tree/js/data/levels.js

132 lines
6.2 KiB
JavaScript
Raw Permalink 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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(1.1, Decimal.pow(points, buyableEffect('p', 13).pow(-1)))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getAlphaCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(1.1, getAlphaLevel(points).floor()).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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(1.25, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 5))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getBetaCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(1.25, getBetaLevel(points).floor()).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) {
2024-03-10 17:35:06 +00:00
return getBetaLevel(points).mul(getBetaRankEffect(points).add(1/20)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(1.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 15))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getGammaCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(1.5, getGammaLevel(points).floor()).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(points, 1).add(hasUpgrade('f', 31) ? getTotalLevel() : 0).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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(2, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 30))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getDeltaCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(2, getDeltaLevel(points).floor()).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) {
2024-03-10 17:35:06 +00:00
return getDeltaLevel(points).mul(getDeltaRankEffect(points).add(1/5)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(2.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 50))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
2024-03-07 17:49:20 +00:00
}
2024-03-09 15:11:14 +00:00
function getEpsilonCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(2.5, getEpsilonLevel(points).floor()).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)
2024-03-13 17:02:37 +00:00
const level = inverseCumulativeExponential(3, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 80))
2024-04-09 15:19:14 +00:00
return hasMilestone('f', 7) ? level : level.floor()
}
2024-03-09 15:11:14 +00:00
function getZetaCost(points = player.p.points) {
2024-03-13 17:02:37 +00:00
return cumulativeExponential(3, getZetaLevel(points).floor()).mul(80).pow(buyableEffect('p', 13))
}
2024-03-09 15:11:14 +00:00
function getZetaEffect(points = player.p.points) {
2024-03-10 17:35:06 +00:00
return getZetaLevel(points).mul(getZetaRankEffect().add(1/3)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 1)
}
2024-03-13 17:02:37 +00:00
function getTotalLevel(points = player.p.points) {
return getAlphaLevel(points).add(getBetaLevel(points)).add(getGammaLevel(points)).add(getDeltaLevel(points)).add(getEpsilonLevel(points)).add(getZetaLevel(points))
2024-03-13 17:02:37 +00:00
}
function getEtaLevel(points = player.sp.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.2, Decimal.mul(points, 2)).floor()
}
function getEtaCost(points = player.sp.points) {
return cumulativeExponential(1.2, getEtaLevel(points)).div(2)
}
function getEtaEffect(points = player.sp.points) {
return getEtaLevel(points).sqrt()
}
function getThetaLevel(points = player.sp.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.3, Decimal.div(points, 3)).floor()
2024-03-13 17:02:37 +00:00
}
function getThetaCost(points = player.sp.points) {
return cumulativeExponential(1.3, getThetaLevel(points)).mul(3)
2024-03-13 17:02:37 +00:00
}
function getThetaEffect(points = player.sp.points) {
return getThetaLevel(points).pow(1/4).add(1)
}
function getIotaLevel(points = player.sp.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.5, Decimal.div(points, 5)).floor()
2024-03-13 17:02:37 +00:00
}
function getIotaCost(points = player.sp.points) {
return cumulativeExponential(1.5, getIotaLevel(points)).mul(5)
2024-03-13 17:02:37 +00:00
}
function getIotaEffect(points = player.sp.points) {
return getIotaLevel(points).pow(1/3).add(1)
}
function getKappaLevel(points = player.sp.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(1.7, Decimal.div(points, 8)).floor()
2024-03-13 17:02:37 +00:00
}
function getKappaCost(points = player.sp.points) {
return cumulativeExponential(1.7, getKappaLevel(points)).mul(8)
2024-03-13 17:02:37 +00:00
}
function getKappaEffect(points = player.sp.points) {
return getKappaLevel(points).sqrt().add(1)
}
function getLambdaLevel(points = player.sp.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
return inverseCumulativeExponential(2, Decimal.div(points, 13)).floor()
}
function getLambdaCost(points = player.sp.points) {
return cumulativeExponential(2, getLambdaLevel(points)).mul(13)
}
function getLambdaEffect(points = player.sp.points) {
return getLambdaLevel(points).add(1).pow(3/2)
2024-03-13 17:02:37 +00:00
}
function getTotalSuperLevel(points = player.sp.points) {
return getEtaLevel(points).add(getThetaLevel(points)).add(getIotaLevel(points)).add(getKappaLevel(points)).add(getLambdaLevel(points))
2024-03-07 17:49:20 +00:00
}