generated from incremental-social/The-Modding-Tree
75 lines
No EOL
3.3 KiB
JavaScript
75 lines
No EOL
3.3 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 = null) {
|
|
if (points === null && player === null) return new Decimal(0)
|
|
if (Decimal.eq(points, 0)) return new Decimal(0)
|
|
return inverseCumulativeExponential(1.1, Decimal.pow(points, buyableEffect('p', 13).pow(-1))).floor()
|
|
}
|
|
function getAlphaCost(points = null) {
|
|
return cumulativeExponential(1.1, getAlphaLevel(points)).pow(buyableEffect('p', 13))
|
|
}
|
|
function getAlphaEffect(points = null) {
|
|
return getAlphaLevel(points).mul(getAlphaRankEffect(points).add(1/20))
|
|
}
|
|
function getBetaLevel(points = null) {
|
|
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()
|
|
}
|
|
function getBetaCost(points = null) {
|
|
return cumulativeExponential(1.25, getBetaLevel(points)).mul(5).pow(buyableEffect('p', 13))
|
|
}
|
|
function getBetaEffect(points = null) {
|
|
return getBetaLevel(points).mul(getBetaRankEffect(points).add(1/20)).add(1)
|
|
}
|
|
function getGammaLevel(points = null) {
|
|
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()
|
|
}
|
|
function getGammaCost(points = null) {
|
|
return cumulativeExponential(1.5, getGammaLevel(points)).mul(15).pow(buyableEffect('p', 13))
|
|
}
|
|
function getGammaEffect(points = null) {
|
|
return Decimal.add(null, 1).log(Decimal.pow(50, buyableEffect('p', 12))).add(1).pow(
|
|
getGammaLevel(points).mul(getGammaRankEffect(points).add(1/10))
|
|
)
|
|
}
|
|
function getDeltaLevel(points = null) {
|
|
if (Decimal.eq(points, 0)) return new Decimal(0)
|
|
return inverseCumulativeExponential(2, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 30)).floor()
|
|
}
|
|
function getDeltaCost(points = null) {
|
|
return cumulativeExponential(2, getDeltaLevel(points)).mul(30).pow(buyableEffect('p', 13))
|
|
}
|
|
function getDeltaEffect(points = null) {
|
|
return getDeltaLevel(points).mul(getDeltaRankEffect(points).add(1/5)).add(1)
|
|
}
|
|
function getEpsilonLevel(points = null) {
|
|
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()
|
|
}
|
|
function getEpsilonCost(points = null) {
|
|
return cumulativeExponential(2.5, getEpsilonLevel(points)).mul(50).pow(buyableEffect('p', 13))
|
|
}
|
|
function getEpsilonEffect(points = null) {
|
|
return getEpsilonLevel(points).mul(getEpsilonRankEffect(points).add(1/10)).add(1)
|
|
}
|
|
function getZetaLevel(points = null) {
|
|
if (Decimal.eq(points, 0)) return new Decimal(0)
|
|
return inverseCumulativeExponential(3, Decimal.div(Decimal.pow(points, buyableEffect('p', 13).pow(-1)), 80)).floor()
|
|
}
|
|
function getZetaCost(points = null) {
|
|
return cumulativeExponential(3, getZetaLevel(points)).mul(80).pow(buyableEffect('p', 13))
|
|
}
|
|
function getZetaEffect(points = null) {
|
|
return getZetaLevel(points).mul(getZetaRankEffect().add(1/3)).add(1)
|
|
}
|
|
|
|
function getTotalLevel() {
|
|
return getAlphaLevel().add(getBetaLevel()).add(getGammaLevel()).add(getDeltaLevel()).add(getEpsilonLevel())
|
|
.add(getZetaLevel())
|
|
} |