From 30673fd80d7dff915491a667ee5b1dcbd14d6e36 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Wed, 14 Oct 2020 23:31:05 -0400 Subject: [PATCH] Renamed Order --- 2.0-format-changes.md | 2 ++ docs/layer-features.md | 6 +++--- js/game.js | 8 ++++---- js/layerSupport.js | 1 + js/layers.js | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/2.0-format-changes.md b/2.0-format-changes.md index 78081f6..fbead8f 100644 --- a/2.0-format-changes.md +++ b/2.0-format-changes.md @@ -16,6 +16,8 @@ All instances of: amt -> amount desc -> description resCeil -> roundUpCost + order -> unlockOrderS + incr_order -> increaseUnlockOrder Challenges: desc -> challengeDescription diff --git a/docs/layer-features.md b/docs/layer-features.md index 2d782ff..bd6c363 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -26,7 +26,7 @@ Key: Optional: total: A Decimal, tracks total amount of main prestige currency best: A Decimal, tracks highest amount of main prestige currency - order: used to keep track of relevant layers unlocked before this one. + unlockOrder: used to keep track of relevant layers unlocked before this one. - color: A color associated with this layer, used in many places. (A string in hex format with a #) @@ -110,7 +110,7 @@ Key: - requires: A Decimal, the amount of the base needed to gain 1 of the prestige currency. Also the amount required to unlock the layer. - You can instead make this a function, to make it harder if another layer was unlocked first (based on "order"). + You can instead make this a function, to make it harder if another layer was unlocked first (based on unlockOrder). - exponent: Used as described above. @@ -174,7 +174,7 @@ Key: - resetsNothing: **optional**, returns true if this layer shouldn't trigger any resets when you prestige. -- incr_order: **optional**, an array of layer ids. When this layer is unlocked for the first time, the "order" value +- increaseUnlockOrder: **optional**, an array of layer ids. When this layer is unlocked for the first time, the unlockOrder value for any not-yet-unlocked layers in this list increases. This can be used to make them harder to unlock. - should_notify: **optional**, a function to return true if this layer should be highlighted in the tree. diff --git a/js/game.js b/js/game.js index f148a49..f07f13b 100644 --- a/js/game.js +++ b/js/game.js @@ -193,10 +193,10 @@ function doReset(layer, force=false) { player[layer].unlocked = true; needCanvasUpdate = true; - if (layers[layer].incr_order){ - lrs = layers[layer].incr_order + if (layers[layer].increaseUnlockOrder){ + lrs = layers[layer].increaseUnlockOrder for (lr in lrs) - if (!player[lrs[lr]].unlocked) player[lrs[lr]].order++ + if (!player[lrs[lr]].unlocked) player[lrs[lr]].unlockOrder++ } } @@ -230,7 +230,7 @@ function resetRow(row) { doReset(pre_layers[0], true) for (let layer in layers) { player[layers[layer]].unlocked = false - if (player[layers[layer]].order) player[layers[layer]].order = 0 + if (player[layers[layer]].unlockOrder) player[layers[layer]].unlockOrder = 0 } player.points = new Decimal(10) updateTemp(); diff --git a/js/layerSupport.js b/js/layerSupport.js index 8aa1cc2..ef27d29 100644 --- a/js/layerSupport.js +++ b/js/layerSupport.js @@ -112,6 +112,7 @@ function updateLayers(){ 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 = 0 row = layers[layer].row if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {} diff --git a/js/layers.js b/js/layers.js index 5c4244e..0a80efd 100644 --- a/js/layers.js +++ b/js/layers.js @@ -110,7 +110,7 @@ addLayer("c", { currencyLayer: "", // Leave empty if not in a layer "e.g. points" unlocked() { return (hasUpgrade(this.layer, 12))}, onPurchase() { // This function triggers when the upgrade is purchased - player[this.layer].order = 0 + player[this.layer].unlockOrder = 0 }, style() { if (hasUpgrade(this.layer, this.id)) return { @@ -189,7 +189,7 @@ addLayer("c", { {key: "c", description: "C: reset for lollipops or whatever", onPress(){if (player[this.layer].unlocked) doReset(this.layer)}}, {key: "ctrl+c" + this.layer, description: "Ctrl+c: respec things", onPress(){if (player[this.layer].unlocked) respecBuyables(this.layer)}}, ], - incr_order: [], // Array of layer names to have their order increased when this one is first unlocked + increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked microtabs: { stuff: {