diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index 0c4bbc0..1ba5098 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -15,6 +15,7 @@ addLayer("c", { beep: false, }}, color: "#4BDC13", + autoUpgrade: true, requires: new Decimal(10), // Can be a function that takes requirement increases into account resource: "lollipops", // Name of prestige currency baseResource: "candies", // Name of resource prestige is based on diff --git a/js/game.js b/js/game.js index 5a0cedd..47b224a 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.7", + tmtNum: "2.2.7.1", tmtName: "Uprooted" } @@ -272,6 +272,12 @@ VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSI VERSION.withName = VERSION.withoutName + (VERSION.name ? ": " + VERSION.name : "") +function autobuyUpgrades(layer){ + if (!tmp[layer].upgrades) return + for (id in tmp[layer].upgrades) + if (isPlainObject(tmp[layers].upgrades[id]) && (layers[layer].upgrades[id].canAfford === undefined || layers[layer].upgrades[id].canAfford() === true)) + buyUpg(layer, id) +} function gameLoop(diff) { if (isEndgame() || gameEnded) gameEnded = 1 @@ -332,13 +338,6 @@ function gameLoop(diff) { } -function autobuyUpgrades(layer){ - if (!tmp[layer].upgrades) return - for (id in tmp[layer].upgrades) - if (layers[layer].canAfford === undefined || layers[layer].canAfford() === true) - buyUpg(layer, id) -} - function hardReset() { if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return player = null diff --git a/js/utils.js b/js/utils.js index ed3915c..95cb654 100644 --- a/js/utils.js +++ b/js/utils.js @@ -544,6 +544,7 @@ function buyUpgrade(layer, id) { } function buyUpg(layer, id) { + if (!tmp[layer].upgrades || !tmp[layer].upgrades[id]) return let upg = tmp[layer].upgrades[id] if (!player[layer].unlocked) return if (!tmp[layer].upgrades[id].unlocked) return