From 28282790d5a2795ac0315afd29cbbbe68f3e8aef Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sat, 3 Oct 2020 16:47:56 -0400 Subject: [PATCH] Fixed several issues --- js/layers.js | 14 +++++++------- js/temp.js | 6 +++--- js/v.js | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/js/layers.js b/js/layers.js index 9ac447e..822ff14 100644 --- a/js/layers.js +++ b/js/layers.js @@ -46,7 +46,7 @@ addLayer("c", { done() {return player[this.layer].best.gte(4)}, effectDesc:() => "You can toggle beep and boop (which do nothing)", toggles: [ - [this.layer, "beep"], // Each toggle is defined by a layer and the data toggled for that layer + ["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer ["f", "boop"]], } }, @@ -129,18 +129,18 @@ addLayer("c", { return eff; }, display() { // Everything else displayed in the buyable button after the title - let data = tmp.buyables[this.layer]["11"] + let data = tmp.buyables[this.layer][this.id] return "Cost: " + format(data.cost) + " lollipops\n\ - Amount: " + player[this.layer].buyables["11"] + "\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ Adds + " + format(data.effect.first) + " things and multiplies stuff by " + format(data.effect.second) }, unl() { return player[this.layer].unl }, canAfford() { - return player[this.layer].points.gte(tmp.buyables["c"][11].cost)}, + return player[this.layer].points.gte(tmp.buyables[this.layer][this.id].cost)}, buy() { - cost = tmp.buyables[this.layer][11].cost + cost = tmp.buyables[this.layer][this.id].cost player[this.layer].points = player[this.layer].points.sub(cost) - player[this.layer].buyables[11] = player[this.layer].buyables[11].add(1) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value }, buyMax() {}, // You'll have to handle this yourself if you want @@ -179,7 +179,7 @@ addLayer("c", { function() {return 'I have ' + format(player.points) + ' pointy points!'}, {"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}], ["buyables", "150px"], - ["toggle", [this.layer, "beep"]], + ["toggle", ["c", "beep"]], "milestones", "upgrades", "challs"], style() {return { 'background-color': 'blue' diff --git a/js/temp.js b/js/temp.js index d057bde..3153905 100644 --- a/js/temp.js +++ b/js/temp.js @@ -93,7 +93,7 @@ function updateChallTemp(layer) { } function updateUpgradeTemp(layer) { - if (player[layer] === undefined) return + if (layers[layer] === undefined) return if (!tmp.upgrades[layer]) tmp.upgrades[layer] = {} let data2 = layers[layer].upgrades @@ -114,7 +114,7 @@ function updateUpgradeTemp(layer) { } function updateMilestoneTemp(layer) { - if (player[layer] === undefined) return + if (layers[layer] === undefined) return if (!tmp.milestones[layer]) tmp.milestones[layer] = {} let data2 = layers[layer].milestones @@ -127,7 +127,7 @@ function updateMilestoneTemp(layer) { } function updateBuyableTemp(layer) { - if (player[layer] === undefined) return + if (layers[layer] === undefined) return if (!tmp.buyables[layer]) tmp.buyables[layer] = {} let data2 = layers[layer].buyables if(data2.respecText) tmp.buyables[layer].respecText = data2.respecText() diff --git a/js/v.js b/js/v.js index 8fecd99..071cbab 100644 --- a/js/v.js +++ b/js/v.js @@ -17,7 +17,7 @@ function loadVue() { treeNode: true, [layer]: true, hidden: !tmp.layerShown[layer], - locked: player[layer].unl && !tmp.layerAmt[layer].gte(tmp.layerReqs[layer]), + locked: !player[layer].unl && !tmp.layerAmt[layer].gte(tmp.layerReqs[layer]), can: layerUnl(layer), }" v-bind:style="{ @@ -72,7 +72,8 @@ function loadVue() {
- +

{{tmp.milestones[layer][id].requirementDesc}}


{{tmp.milestones[layer][id].effectDesc}}
 

{{tmp.milestones[layer][id].requirementDesc}}


{{tmp.milestones[layer][id].effectDesc}}
+  

@@ -83,7 +84,7 @@ function loadVue() { Vue.component('toggle', { props: ['layer', 'data'], template: ` - + ` })