mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-28 19:11:43 +00:00
Reorganized prestige formulas to make adding new types easier
This commit is contained in:
parent
045b7ba6b1
commit
735d631ad8
5 changed files with 86 additions and 69 deletions
|
@ -25,6 +25,8 @@
|
||||||
<script src="js/technical/displays.js"></script>
|
<script src="js/technical/displays.js"></script>
|
||||||
|
|
||||||
<script src="js/incrementum.js"></script>
|
<script src="js/incrementum.js"></script>
|
||||||
|
<script src="js/mechanics/prestigeFormulas.js"></script>
|
||||||
|
|
||||||
<script src="js/utils.js"></script>
|
<script src="js/utils.js"></script>
|
||||||
<script src="js/utils/easyAccess.js"></script>
|
<script src="js/utils/easyAccess.js"></script>
|
||||||
<script src="js/technical/systemComponents.js"></script>
|
<script src="js/technical/systemComponents.js"></script>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<script src="js/technical/displays.js"></script>
|
<script src="js/technical/displays.js"></script>
|
||||||
|
|
||||||
<script src="js/incrementum.js"></script>
|
<script src="js/incrementum.js"></script>
|
||||||
|
<script src="js/mechanics/prestigeFormulas.js"></script>
|
||||||
<script src="js/utils.js"></script>
|
<script src="js/utils.js"></script>
|
||||||
<script src="js/utils/easyAccess.js"></script>
|
<script src="js/utils/easyAccess.js"></script>
|
||||||
<script src="js/technical/systemComponents.js"></script>
|
<script src="js/technical/systemComponents.js"></script>
|
||||||
|
|
|
@ -7,74 +7,6 @@ const INC_VERSION = {
|
||||||
incName: "Fixed Reality"
|
incName: "Fixed Reality"
|
||||||
}
|
}
|
||||||
|
|
||||||
function getResetGain(layer, useType = null) {
|
|
||||||
let type = useType
|
|
||||||
if (!useType){
|
|
||||||
type = tmp[layer].type
|
|
||||||
if (layers[layer].getResetGain !== undefined)
|
|
||||||
return layers[layer].getResetGain()
|
|
||||||
}
|
|
||||||
if(tmp[layer].type == "none")
|
|
||||||
return new Decimal (0)
|
|
||||||
if (tmp[layer].gainExp.eq(0)) return decimalZero
|
|
||||||
if (type=="static") {
|
|
||||||
if ((!tmp[layer].canBuyMax) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return decimalOne
|
|
||||||
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(tmp[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(tmp[layer].exponent, -1))
|
|
||||||
gain = gain.times(tmp[layer].directMult)
|
|
||||||
return gain.floor().sub(player[layer].points).add(1).max(1);
|
|
||||||
} else if (type=="normal"){
|
|
||||||
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return decimalZero
|
|
||||||
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).pow(tmp[layer].exponent).times(tmp[layer].gainMult).pow(tmp[layer].gainExp)
|
|
||||||
if (gain.gte(tmp[layer].softcap)) gain = gain.pow(tmp[layer].softcapPower).times(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower)))
|
|
||||||
gain = gain.times(tmp[layer].directMult)
|
|
||||||
return gain.floor().max(0);
|
|
||||||
} else if (type=="custom"){
|
|
||||||
return layers[layer].getResetGain()
|
|
||||||
} else {
|
|
||||||
return decimalZero
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNextAt(layer, canMax=false, useType = null) {
|
|
||||||
let type = useType
|
|
||||||
if (!useType) {
|
|
||||||
type = tmp[layer].type
|
|
||||||
if (layers[layer].getNextAt !== undefined)
|
|
||||||
return layers[layer].getNextAt(canMax)
|
|
||||||
|
|
||||||
}
|
|
||||||
if(tmp[layer].type == "none")
|
|
||||||
return new Decimal (Infinity)
|
|
||||||
|
|
||||||
if (tmp[layer].gainMult.lte(0)) return new Decimal(Infinity)
|
|
||||||
if (tmp[layer].gainExp.lte(0)) return new Decimal(Infinity)
|
|
||||||
|
|
||||||
if (type=="static")
|
|
||||||
{
|
|
||||||
if (!tmp[layer].canBuyMax) canMax = false
|
|
||||||
let amt = player[layer].points.plus((canMax&&tmp[layer].baseAmount.gte(tmp[layer].nextAt))?tmp[layer].resetGain:0).div(tmp[layer].directMult)
|
|
||||||
let extraCost = Decimal.pow(tmp[layer].base, amt.pow(tmp[layer].exponent).div(tmp[layer].gainExp)).times(tmp[layer].gainMult)
|
|
||||||
let cost = extraCost.times(tmp[layer].requires).max(tmp[layer].requires)
|
|
||||||
if (tmp[layer].roundUpCost) cost = cost.ceil()
|
|
||||||
return cost;
|
|
||||||
} else if (type=="normal"){
|
|
||||||
let next = tmp[layer].resetGain.add(1).div(tmp[layer].directMult)
|
|
||||||
if (next.gte(tmp[layer].softcap)) next = next.div(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower))).pow(decimalOne.div(tmp[layer].softcapPower))
|
|
||||||
next = next.root(tmp[layer].gainExp).div(tmp[layer].gainMult).root(tmp[layer].exponent).times(tmp[layer].requires).max(tmp[layer].requires)
|
|
||||||
if (tmp[layer].roundUpCost) next = next.ceil()
|
|
||||||
return next;
|
|
||||||
} else if (type=="custom"){
|
|
||||||
return layers[layer].getNextAt(canMax)
|
|
||||||
} else {
|
|
||||||
return decimalZero
|
|
||||||
}}
|
|
||||||
|
|
||||||
function softcap(value, cap, power = 0.5) {
|
|
||||||
if (value.lte(cap)) return value
|
|
||||||
else
|
|
||||||
return value.pow(power).times(cap.pow(decimalOne.sub(power)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return true if the layer should be highlighted. By default checks for upgrades only.
|
// Return true if the layer should be highlighted. By default checks for upgrades only.
|
||||||
function shouldNotify(layer){
|
function shouldNotify(layer){
|
||||||
for (id in tmp[layer].upgrades){
|
for (id in tmp[layer].upgrades){
|
||||||
|
|
82
js/mechanics/prestigeFormulas.js
Normal file
82
js/mechanics/prestigeFormulas.js
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
function getResetGain(layer, useType = null) {
|
||||||
|
let type = useType
|
||||||
|
if (!useType){
|
||||||
|
type = tmp[layer].type
|
||||||
|
if (layers[layer].getResetGain !== undefined)
|
||||||
|
return layers[layer].getResetGain()
|
||||||
|
}
|
||||||
|
if (tmp[layer].gainExp.eq(0)) return DecimalZero
|
||||||
|
|
||||||
|
if (PRESTIGE_TYPES[type]) return PRESTIGE_TYPES[type].gain(layer)
|
||||||
|
return decimalZero
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNextAt(layer, canMax=false, useType = null) {
|
||||||
|
let type = useType
|
||||||
|
if (!useType) {
|
||||||
|
type = tmp[layer].type
|
||||||
|
if (layers[layer].getNextAt !== undefined)
|
||||||
|
return layers[layer].getNextAt(canMax)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp[layer].gainMult.lte(0)) return new Decimal(Infinity)
|
||||||
|
if (tmp[layer].gainExp.lte(0)) return new Decimal(Infinity)
|
||||||
|
|
||||||
|
if (PRESTIGE_TYPES[type]) return PRESTIGE_TYPES[type].nextAt(layer)
|
||||||
|
return new Decimal (Infinity)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const PRESTIGE_TYPES = {
|
||||||
|
static: {
|
||||||
|
gain(layer) {
|
||||||
|
if ((!tmp[layer].canBuyMax) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return decimalOne
|
||||||
|
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(tmp[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(tmp[layer].exponent, -1))
|
||||||
|
gain = gain.times(tmp[layer].directMult)
|
||||||
|
return gain.floor().sub(player[layer].points).add(1).max(1);
|
||||||
|
},
|
||||||
|
nextAt(layer) {
|
||||||
|
if (!tmp[layer].canBuyMax) canMax = false
|
||||||
|
let amt = player[layer].points.plus((canMax&&tmp[layer].baseAmount.gte(tmp[layer].nextAt))?tmp[layer].resetGain:0).div(tmp[layer].directMult)
|
||||||
|
let extraCost = Decimal.pow(tmp[layer].base, amt.pow(tmp[layer].exponent).div(tmp[layer].gainExp)).times(tmp[layer].gainMult)
|
||||||
|
let cost = extraCost.times(tmp[layer].requires).max(tmp[layer].requires)
|
||||||
|
if (tmp[layer].roundUpCost) cost = cost.ceil()
|
||||||
|
return cost;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
normal: {
|
||||||
|
gain(layer) {
|
||||||
|
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return decimalZero
|
||||||
|
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).pow(tmp[layer].exponent).times(tmp[layer].gainMult).pow(tmp[layer].gainExp)
|
||||||
|
if (gain.gte(tmp[layer].softcap)) gain = gain.pow(tmp[layer].softcapPower).times(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower)))
|
||||||
|
gain = gain.times(tmp[layer].directMult)
|
||||||
|
return gain.floor().max(0);
|
||||||
|
},
|
||||||
|
nextAt(layer){
|
||||||
|
let next = tmp[layer].resetGain.add(1).div(tmp[layer].directMult)
|
||||||
|
if (next.gte(tmp[layer].softcap)) next = next.div(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower))).pow(decimalOne.div(tmp[layer].softcapPower))
|
||||||
|
next = next.root(tmp[layer].gainExp).div(tmp[layer].gainMult).root(tmp[layer].exponent).times(tmp[layer].requires).max(tmp[layer].requires)
|
||||||
|
if (tmp[layer].roundUpCost) next = next.ceil()
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
gain(layer) {
|
||||||
|
return layers[layer].getResetGain()
|
||||||
|
},
|
||||||
|
nextAt(layer) {
|
||||||
|
return layers[layer].getNextAt(canMax)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function softcap(value, cap, power = 0.5) {
|
||||||
|
if (value.lte(cap)) return value
|
||||||
|
else
|
||||||
|
return value.pow(power).times(cap.pow(decimalOne.sub(power)))
|
||||||
|
}
|
|
@ -133,7 +133,7 @@ var systemComponents = {
|
||||||
Made by {{gameInfo.author}}
|
Made by {{gameInfo.author}}
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
Incrementum <a v-bind:href="'https://github.com/Acamaeda/Incrementum/blob/master/changelog.md'" target="_blank" class="link" v-bind:style = "{'font-size': '14px', 'display': 'inline'}" >{{TMT_VERSION.tmtNum}}</a> by Acamaeda
|
Incrementum <a v-bind:href="'https://github.com/Acamaeda/Incrementum/blob/master/changelog.md'" target="_blank" class="link" v-bind:style = "{'font-size': '14px', 'display': 'inline'}" >{{INC_VERSION.incNum}}</a> by Acamaeda
|
||||||
<br>
|
<br>
|
||||||
Based on The Prestige Tree by Jacorb and Aarex
|
Based on The Prestige Tree by Jacorb and Aarex
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
Loading…
Reference in a new issue