just_another_tree/js/levels.js

124 lines
No EOL
5.8 KiB
JavaScript

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)
}
function getAlphaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(1.1, Decimal.pow(points, buyableEffect('p', 13).pow(-1)))
return hasMilestone('f', 9) ? level : level.floor()
}
function getAlphaCost(points = player.p.points) {
return cumulativeExponential(1.1, getAlphaLevel(points).floor()).pow(buyableEffect('p', 13))
}
function getAlphaEffect(points = player.p.points) {
return getAlphaLevel(points).mul(getAlphaRankEffect(points).add(1/20))
}
function getBetaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(1.25, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 5))
return hasMilestone('f', 9) ? level : level.floor()
}
function getBetaCost(points = player.p.points) {
return cumulativeExponential(1.25, getBetaLevel(points).floor()).mul(5).pow(buyableEffect('p', 13))
}
function getBetaEffect(points = player.p.points) {
return getBetaLevel(points).mul(getBetaRankEffect(points).add(1/20)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 1)
}
function getGammaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(1.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 15))
return hasMilestone('f', 9) ? level : level.floor()
}
function getGammaCost(points = player.p.points) {
return cumulativeExponential(1.5, getGammaLevel(points).floor()).mul(15).pow(buyableEffect('p', 13))
}
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)))
}
function getDeltaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(2, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 30))
return hasMilestone('f', 9) ? level : level.floor()
}
function getDeltaCost(points = player.p.points) {
return cumulativeExponential(2, getDeltaLevel(points).floor()).mul(30).pow(buyableEffect('p', 13))
}
function getDeltaEffect(points = player.p.points) {
return getDeltaLevel(points).mul(getDeltaRankEffect(points).add(1/5)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 1)
}
function getEpsilonLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(2.5, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 50))
return hasMilestone('f', 9) ? level : level.floor()
}
function getEpsilonCost(points = player.p.points) {
return cumulativeExponential(2.5, getEpsilonLevel(points).floor()).mul(50).pow(buyableEffect('p', 13))
}
function getEpsilonEffect(points = player.p.points) {
return getEpsilonLevel(points).mul(getEpsilonRankEffect(points).add(1/10)).add(1)
}
function getZetaLevel(points = player.p.points) {
if (Decimal.eq(points, 0)) return new Decimal(0)
const level = inverseCumulativeExponential(3, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 80))
return hasMilestone('f', 9) ? level : level.floor()
}
function getZetaCost(points = player.p.points) {
return cumulativeExponential(3, getZetaLevel(points).floor()).mul(80).pow(buyableEffect('p', 13))
}
function getZetaEffect(points = player.p.points) {
return getZetaLevel(points).mul(getZetaRankEffect().add(1/3)).add(1).pow(hasUpgrade('f', 41) ? 1.2 : 1)
}
function getTotalLevel(points = player.p.points) {
return getAlphaLevel(points).add(getBetaLevel(points)).add(getGammaLevel(points)).add(getDeltaLevel(points))
.add(getEpsilonLevel(points)).add(getZetaLevel(points))
}
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.5, Decimal.div(points, 3)).floor()
}
function getThetaCost(points = player.sp.points) {
return cumulativeExponential(1.5, getThetaLevel(points)).mul(3)
}
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.7, Decimal.div(points, 5)).floor()
}
function getIotaCost(points = player.sp.points) {
return cumulativeExponential(1.7, getIotaLevel(points)).mul(5)
}
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(2, Decimal.div(points, 8)).floor()
}
function getKappaCost(points = player.sp.points) {
return cumulativeExponential(2, getKappaLevel(points)).mul(8)
}
function getKappaEffect(points = player.sp.points) {
return getKappaLevel(points).pow(2/3).add(1)
}
function getTotalSuperLevel(points = player.sp.points) {
return getEtaLevel(points).add(getThetaLevel(points)).add(getIotaLevel(points)).add(getKappaLevel(points))
}