diff --git a/js/game.js b/js/game.js index 13b46c2..a7ff889 100644 --- a/js/game.js +++ b/js/game.js @@ -18,14 +18,14 @@ function getResetGain(layer, useType = null) { } if(tmp[layer].type == "none") return new Decimal (0) - if (tmp[layer].gainExp.eq(0)) 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 new Decimal(1) + 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 new Decimal(0) + 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) @@ -33,7 +33,7 @@ function getResetGain(layer, useType = null) { } else if (type=="custom"){ return layers[layer].getResetGain() } else { - return new Decimal(0) + return decimalZero } } @@ -68,7 +68,7 @@ function getNextAt(layer, canMax=false, useType = null) { } else if (type=="custom"){ return layers[layer].getNextAt(canMax) } else { - return new Decimal(0) + return decimalZero }} function softcap(value, cap, power = 0.5) { @@ -167,7 +167,7 @@ function layerDataReset(layer, keep = []) { function resetBuyables(layer){ if (layers[layer].buyables) player[layer].buyables = getStartBuyables(layer) - player[layer].spentOnBuyables = new Decimal(0) + player[layer].spentOnBuyables = decimalZero } @@ -215,7 +215,7 @@ function doReset(layer, force=false) { } } - tmp[layer].baseAmount = new Decimal(0) // quick fix + tmp[layer].baseAmount = decimalZero // quick fix } if (tmp[layer].resetsNothing) return @@ -226,7 +226,7 @@ function doReset(layer, force=false) { } prevOnReset = {...player} //Deep Copy - player.points = (row == 0 ? new Decimal(0) : getStartPoints()) + player.points = (row == 0 ? decimalZero : getStartPoints()) for (let x = row; x >= 0; x--) rowReset(x, layer) rowReset("side", layer) diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index d6d84c1..8ce18e2 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -165,9 +165,9 @@ function setupLayer(layer){ if(!layers[layer].componentStyles) layers[layer].componentStyles = {} if(layers[layer].symbol === undefined) layers[layer].symbol = layer.charAt(0).toUpperCase() + layer.slice(1) if(layers[layer].unlockOrder === undefined) layers[layer].unlockOrder = [] - if(layers[layer].gainMult === undefined) layers[layer].gainMult = new Decimal(1) - if(layers[layer].gainExp === undefined) layers[layer].gainExp = new Decimal(1) - if(layers[layer].directMult === undefined) layers[layer].directMult = new Decimal(1) + if(layers[layer].gainMult === undefined) layers[layer].gainMult = decimalOne + if(layers[layer].gainExp === undefined) layers[layer].gainExp = decimalOne + if(layers[layer].directMult === undefined) layers[layer].directMult = decimalOne if(layers[layer].type === undefined) layers[layer].type = "none" if(layers[layer].base === undefined || layers[layer].base <= 1) layers[layer].base = 2 if(layers[layer].softcap === undefined) layers[layer].softcap = new Decimal("e1e7") diff --git a/js/technical/temp.js b/js/technical/temp.js index 8430a95..8ee851b 100644 --- a/js/technical/temp.js +++ b/js/technical/temp.js @@ -42,8 +42,8 @@ function setupTemp() { } tmp.other = { - lastPoints: player.points || new Decimal(0), - oomps: new Decimal(0), + lastPoints: player.points || decimalZero, + oomps: decimalZero, } updateWidth() @@ -74,7 +74,7 @@ function setupTempData(layerData, tmpData, funcsData) { } else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){ funcsData[item] = layerData[item] - tmpData[item] = new Decimal(1) // The safest thing to put probably? + tmpData[item] = decimalOne // The safest thing to put probably? } else { tmpData[item] = layerData[item] } diff --git a/js/utils/NumberFormating.js b/js/utils/NumberFormating.js index fe29dc1..4dd3704 100644 --- a/js/utils/NumberFormating.js +++ b/js/utils/NumberFormating.js @@ -3,7 +3,7 @@ function exponentialFormat(num, precision, mantissa = true) { let e = num.log10().floor() let m = num.div(Decimal.pow(10, e)) if (m.toStringWithDecimalPlaces(precision) == 10) { - m = new Decimal(1) + m = decimalOne e = e.add(1) } e = (e.gte(1e9) ? format(e, 1) : (e.gte(10000) ? commaFormat(e, 0) : e.toStringWithDecimalPlaces(0))) @@ -32,7 +32,7 @@ function fixValue(x, y = 0) { function sumValues(x) { x = Object.values(x) - if (!x[0]) return new Decimal(0) + if (!x[0]) return decimalZero return x.reduce((a, b) => Decimal.add(a, b)) } diff --git a/js/utils/save.js b/js/utils/save.js index 8fe2315..e89866f 100644 --- a/js/utils/save.js +++ b/js/utils/save.js @@ -66,9 +66,9 @@ function getStartLayerData(layer) { if (layerdata.unlocked === undefined) layerdata.unlocked = true; if (layerdata.total === undefined) - layerdata.total = new Decimal(0); + layerdata.total = decimalZero; if (layerdata.best === undefined) - layerdata.best = new Decimal(0); + layerdata.best = decimalZero; if (layerdata.resetTime === undefined) layerdata.resetTime = 0; if (layerdata.forceTooltip === undefined) @@ -78,7 +78,7 @@ function getStartLayerData(layer) { if (layerdata.noRespecConfirm === undefined) layerdata.noRespecConfirm = false if (layerdata.clickables == undefined) layerdata.clickables = getStartClickables(layer); - layerdata.spentOnBuyables = new Decimal(0); + layerdata.spentOnBuyables = decimalZero; layerdata.upgrades = []; layerdata.milestones = []; layerdata.lastMilestone = null; @@ -91,7 +91,7 @@ function getStartBuyables(layer) { if (layers[layer].buyables) { for (id in layers[layer].buyables) if (isPlainObject(layers[layer].buyables[id])) - data[id] = new Decimal(0); + data[id] = decimalZero; } return data; }