diff --git a/changelog.md b/changelog.md
index e12e41e..1874bb6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,11 @@
# The Modding Tree changelog:
+### v2.2.4 - 11/28/20
+- Added softcap and softcapPower features (for Normal layers)
+- Offline time limit and default max tick length were fixed (previously the limits were 1000x too large)
- Added fixOldSaves.
+- You can use HTML in mainDisplay.
+- Fixed a number of minor oddities.
### v2.2.3 - 11/28/20
- Layers will be highlighted if you can finish a challenge.
diff --git a/docs/layer-features.md b/docs/layer-features.md
index 7e840e5..59a99b1 100644
--- a/docs/layer-features.md
+++ b/docs/layer-features.md
@@ -94,10 +94,15 @@ You can make almost any value dynamic by using a function in its place, includin
- roundUpCost: **optional**. a bool, which is true if the resource cost needs to be rounded up. (use if the base resource is a "static" currency.)
-- canBuyMax(): **sometimes required**. required for static layers, function used to determine if buying max is permitted.
-
- gainMult(), gainExp(): **optional**. Functions that calculate the multiplier and exponent on resource gain from upgrades and boosts and such. Plug in any bonuses here.
+- softcap, softcapPower: **optional**. For normal layers, gain beyond [softcap] points is put to the [softcapPower]th power
+ Default for softcap is e1e7, and for power is 0.5.
+
+## Other prestige-related features
+
+- canBuyMax(): **sometimes required**. required for static layers, function used to determine if buying max is permitted.
+
- onPrestige(gain): **optional**. A function that triggers when this layer prestiges, just before you gain the currency. Can be used to have secondary resource gain on prestige, or to recalculate things or whatnot.
- resetDesc: **optional**. Use this to replace "Reset for " on the Prestige button with something else.
diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js
index a340bcc..8088d76 100644
--- a/js/Demo/demoLayers.js
+++ b/js/Demo/demoLayers.js
@@ -23,6 +23,11 @@ addLayer("c", {
exponent: 0.5, // Prestige currency exponent
base: 5, // Only needed for static layers, base of the formula (b^(x^exp))
roundUpCost: false, // True if the cost needs to be rounded up (use when baseResource is static?)
+
+ // For normal layers, gain beyond [softcap] points is put to the [softcapPower]th power
+ softcap: new Decimal(1e100),
+ softcapPower: new Decimal(0.5),
+
canBuyMax() {}, // Only needed for static layers with buy max
gainMult() { // Calculate the multiplier for main currency from bonuses
mult = new Decimal(1)
@@ -208,7 +213,7 @@ addLayer("c", {
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
hotkeys: [
- {key: "c", description: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
+ {key: "c", description: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}, unlocked() {return player.points.gte(10)}},
{key: "ctrl+c", description: "Ctrl+c: respec things", onPress(){if (player[this.layer].unlocked) respecBuyables(this.layer)}},
],
increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked
diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js
index a85063e..dbf11ec 100644
--- a/js/Demo/demoMod.js
+++ b/js/Demo/demoMod.js
@@ -12,7 +12,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
- num: "2.2.3",
+ num: "2.2.4",
name: "Uprooted",
}
@@ -63,7 +63,7 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() {
- return(3600000) // Default is 1 hour which is just arbitrarily large
+ return(3600) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,
diff --git a/js/components.js b/js/components.js
index 3f7db55..d0f15f0 100644
--- a/js/components.js
+++ b/js/components.js
@@ -206,7 +206,7 @@ function loadVue() {
Vue.component('main-display', {
props: ['layer'],
template: `
-
You have
{{formatWhole(player[layer].points)}}
{{tmp[layer].resource}}, {{tmp[layer].effectDescription}}
+ You have
{{formatWhole(player[layer].points)}}
{{tmp[layer].resource}},
`
})
@@ -310,7 +310,7 @@ function loadVue() {
},
template: `
-
+
diff --git a/js/game.js b/js/game.js
index 2eca59c..af4057c 100644
--- a/js/game.js
+++ b/js/game.js
@@ -4,7 +4,7 @@ var gameEnded = false;
// Don't change this
const TMT_VERSION = {
- tmtNum: "2.2.2",
+ tmtNum: "2.2.4",
tmtName: "Uprooted"
}
@@ -21,7 +21,7 @@ function getResetGain(layer, useType = null) {
} else if (type=="normal"){
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(0)
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).pow(tmp[layer].exponent).times(tmp[layer].gainMult).pow(tmp[layer].gainExp)
- if (gain.gte("e1e7")) gain = gain.sqrt().times("e5e6")
+ if (gain.gte(tmp[layer].softcap)) gain = gain.pow(tmp[layer].softcapPower).times(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower)))
return gain.floor().max(0);
} else if (type=="custom"){
return layers[layer].getResetGain()
@@ -49,7 +49,7 @@ function getNextAt(layer, canMax=false, useType = null) {
return cost;
} else if (type=="normal"){
let next = tmp[layer].resetGain.add(1)
- if (next.gte("e1e7")) next = next.div("e5e6").pow(2)
+ 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;
@@ -347,7 +347,7 @@ var interval = setInterval(function() {
let now = Date.now()
let diff = (now - player.time) / 1e3
if (player.offTime !== undefined) {
- if (player.offTime.remain > modInfo.offlineLimit * 3600000) player.offTime.remain = modInfo.offlineLimit * 3600000
+ if (player.offTime.remain > modInfo.offlineLimit * 3600) player.offTime.remain = modInfo.offlineLimit * 3600
if (player.offTime.remain > 0) {
let offlineDiff = Math.max(player.offTime.remain / 10, diff)
player.offTime.remain -= offlineDiff
diff --git a/js/mod.js b/js/mod.js
index b8a7f6f..9c1dc5b 100644
--- a/js/mod.js
+++ b/js/mod.js
@@ -58,7 +58,7 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() {
- return(3600000) // Default is 1 hour which is just arbitrarily large
+ return(3600) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,
diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js
index 4184576..13fb68e 100644
--- a/js/technical/layerSupport.js
+++ b/js/technical/layerSupport.js
@@ -22,7 +22,10 @@ function updateHotkeys()
if (hk){
for (id in hk){
hotkeys[hk[id].key] = hk[id]
- hotkeys[hk[id].key].layer = layer
+ hotkeys[hk[id].key].layer = layer
+ hotkeys[hk[id].key].id = id
+ if (hk[id].unlocked === undefined)
+ hk[id].unlocked = true
}
}
}
@@ -138,6 +141,8 @@ function updateLayers(){
if(layers[layer].gainExp === undefined) layers[layer].gainExp = new Decimal(1)
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")
+ if(layers[layer].softcapPower === undefined) layers[layer].softcapPower = new Decimal("0.5")
let row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
diff --git a/js/technical/systemComponents.js b/js/technical/systemComponents.js
index 0aa9513..853a8ec 100644
--- a/js/technical/systemComponents.js
+++ b/js/technical/systemComponents.js
@@ -135,7 +135,7 @@ var systemComponents = {
Time Played: {{ formatTime(player.timePlayed) }}
Hotkeys
-
{{key.description}}
+
{{key.description}}
`
},
diff --git a/js/utils.js b/js/utils.js
index 219ebee..f658c0f 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -149,7 +149,7 @@ function getStartBuyables(layer){
let data = {}
if (layers[layer].buyables) {
for (id in layers[layer].buyables)
- if (!isNaN(id))
+ if (isPlainObject(layers[layer].buyables[id]))
data[id] = new Decimal(0)
}
return data
@@ -158,9 +158,9 @@ function getStartBuyables(layer){
function getStartClickables(layer){
let data = {}
if (layers[layer].clickables) {
- for (id in layers[layer].clickables)
- if (!isNaN(id))
- data[id] = ""
+ if (isPlainObject(layers[layer].clickables[id]))
+ if (isPlainObject(id))
+ data[id] = ""
}
return data
}
@@ -169,8 +169,8 @@ function getStartChallenges(layer){
let data = {}
if (layers[layer].challenges) {
for (id in layers[layer].challenges)
- if (!isNaN(id))
- data[id] = 0
+ if (isPlainObject(layers[layer].challenges[id]))
+ data[id] = 0
}
return data
}
@@ -698,7 +698,7 @@ function updateMilestones(layer){
function updateAchievements(layer){
for (id in layers[layer].achievements){
- if (!isNaN(id) && !(player[layer].achievements.includes(id)) && layers[layer].achievements[id].done()) {
+ if (isPlainObject(layers[layer].achievements[id]) && !(player[layer].achievements.includes(id)) && layers[layer].achievements[id].done()) {
player[layer].achievements.push(id)
if (layers[layer].achievements[id].onComplete) layers[layer].achievements[id].onComplete()
}
@@ -765,5 +765,9 @@ function prestigeButtonText(layer)
function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
};
-
+
+function isPlainObject(obj) {
+ return (!!obj) && (obj.constructor === Object)
+}
+
document.title = modInfo.name