From 350e941ceda32ca58491fffb5115b42c87db8de6 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Thu, 24 Sep 2020 19:32:34 -0400 Subject: [PATCH] More fixes and improvements --- index.html | 4 ++-- js/game.js | 6 +++--- js/layers.js | 5 ++--- sampleLayers.js | 10 +++++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index d7ecccf..5867399 100644 --- a/index.html +++ b/index.html @@ -130,8 +130,8 @@
You have {{formatWhole(tmp.layerAmt[layer])}} {{layers[layer].baseResource}}


- Your best {{layers[layer].resource}} is {{formatWhole(player[layer].best)}}
- You have made a total of {{formatWhole(player[layer].total)}} {{layers[layer].resource}}
+ Your best {{layers[layer].resource}} is {{formatWhole(player[layer].best)}}
+ You have made a total of {{formatWhole(player[layer].total)}} {{layers[layer].resource}}
diff --git a/js/game.js b/js/game.js index bc8c299..43a2dc7 100644 --- a/js/game.js +++ b/js/game.js @@ -118,7 +118,7 @@ function convertToDecimal() { player.points = new Decimal(player.points) for (layer in layers) { player[layer].points = new Decimal(player[layer].points) - player[layer].best = new Decimal(player[layer].best) + if (player[layer].best != undefined) player[layer].best = new Decimal(player[layer].best) if (player[layer].total !== undefined) player[layer].total = new Decimal(player[layer].total) if (layers[layer].convertToDecimal) layers[layer].convertToDecimal(); } @@ -298,14 +298,14 @@ function doReset(layer, force=false) { if (layers[layer].incr_order){ for (lr in layers[layer].incr_order) - player.lr.order++ + if (!player[lr].unl) player[lr].order++ } } tmp.layerAmt[layer] = new Decimal(0) // quick fix } - if (layers[layer].resetsNothing()) return + if (layers[layer].resetsNothing && layers[layer].resetsNothing()) return for (layerResetting in layers) { diff --git a/js/layers.js b/js/layers.js index f1fa218..8b06066 100644 --- a/js/layers.js +++ b/js/layers.js @@ -3,7 +3,8 @@ var layers = { startData() { return { unl: true, points: new Decimal(0), - best: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), upgrades: [], milestones: [], beep: false, @@ -102,7 +103,6 @@ var layers = { startData() { return { unl: false, points: new Decimal(0), - best: new Decimal(0), boop: false, }}, color: "#FE0102", @@ -121,7 +121,6 @@ var layers = { }, row: 1, layerShown() {return true}, - resetsNothing() {return false}, branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default }, } diff --git a/sampleLayers.js b/sampleLayers.js index 86956ff..2fd8909 100644 --- a/sampleLayers.js +++ b/sampleLayers.js @@ -3,7 +3,9 @@ var layers = { startData() { return { unl: true, points: new Decimal(0), - best: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + order: 0, // Used for tracking other relevant layers unlocked before this one upgrades: [], milestones: [], challs: [], @@ -103,7 +105,7 @@ var layers = { }, }, convertToDecimal() { - // Convert any layer-specific values (besides points, total, and best) to Decimal + // Convert any layer-specific values (besides points, total, and best) to Decimal after loading }, layerShown() {return true}, // Condition for when layer appears update(diff) { @@ -118,11 +120,10 @@ var layers = { incr_order: [], // Array of layer names to have their order increased when this one is first unlocked branches: [] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default }, - f: { // This layer contains a more minimal set of things, besides a branch + f: { // This layer contains a more minimal set of things, besides a branch and "boop" startData() { return { unl: false, points: new Decimal(0), - best: new Decimal(0), boop: false, }}, color: "#FE0102", @@ -141,7 +142,6 @@ var layers = { }, row: 1, layerShown() {return true}, // Condition for when layer appears - resetsNothing() {return false}, branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default }, }