diff --git a/demo.html b/demo.html
index 8563b67..5525ab1 100644
--- a/demo.html
+++ b/demo.html
@@ -25,6 +25,8 @@
+
+
diff --git a/index.html b/index.html
index ec4cf91..2ccc161 100644
--- a/index.html
+++ b/index.html
@@ -24,6 +24,7 @@
+
diff --git a/js/incrementum.js b/js/incrementum.js
index eff7620..f678987 100644
--- a/js/incrementum.js
+++ b/js/incrementum.js
@@ -7,74 +7,6 @@ const INC_VERSION = {
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.
function shouldNotify(layer){
for (id in tmp[layer].upgrades){
diff --git a/js/mechanics/prestigeFormulas.js b/js/mechanics/prestigeFormulas.js
new file mode 100644
index 0000000..cc0dbb8
--- /dev/null
+++ b/js/mechanics/prestigeFormulas.js
@@ -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)))
+}
\ No newline at end of file
diff --git a/js/technical/systemComponents.js b/js/technical/systemComponents.js
index 29c3b8e..f0ad353 100644
--- a/js/technical/systemComponents.js
+++ b/js/technical/systemComponents.js
@@ -133,7 +133,7 @@ var systemComponents = {
Made by {{gameInfo.author}}
- Incrementum {{TMT_VERSION.tmtNum}} by Acamaeda
+ Incrementum {{INC_VERSION.incNum}} by Acamaeda
Based on The Prestige Tree by Jacorb and Aarex