From a9d55645b5d2467d71f41170a8958de23629ad4f Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Mon, 30 Nov 2020 15:03:26 -0500 Subject: [PATCH] 2.2.6 --- changelog.md | 5 ++++- docs/challenges.md | 24 ++++++++++++++---------- docs/upgrades.md | 4 ++-- index.html | 2 +- js/Demo/demoLayers.js | 3 ++- js/Demo/demoMod.js | 2 +- js/components.js | 2 +- js/game.js | 2 +- js/technical/layerSupport.js | 2 +- js/utils.js | 9 +++++---- 10 files changed, 32 insertions(+), 23 deletions(-) diff --git a/changelog.md b/changelog.md index 9898984..219b93b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,10 @@ # The Modding Tree changelog: -### +### v2.2.6 11/30/20 +- Added goalDescription for challenges and made the new "canComplete" system the standard. - Another attempt to fix challenges not visually updating. +- Fixed side layers not appearing. +- Fixed getStartClickables again. ### v2.2.5 11/29/20 - Added features for overriding the displays and costs/goals of upgrades and challenges to make them fully custom. diff --git a/docs/challenges.md b/docs/challenges.md index dea9333..aa417fb 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -1,6 +1,6 @@ # Challenges -Useful functions for dealing with Challenges and implementing their effects: +Challenges can have fully customizable win conditions. Useful functions for dealing with Challenges and implementing their effects: - inChallenge(layer, id): determine if the player is in a given challenge (or another challenge on the same layer that counts as this one). - hasChallenge(layer, id): determine if the player has completed the challenge. @@ -31,6 +31,11 @@ Individual Challenges can have these features: - challengeDescription: A description of what makes the challenge a challenge. *You will need to implement these elsewhere.* It can also be a function that returns updating text. Can use basic HTML. +- goalDescription: A description of the win condition for the challenge. It can also be a function that returns updating text. + Can use basic HTML. (Optional if using the old goal system) + +- canComplete(): A function that returns true if you meet the win condition for the challenge. (Optional if using the old goal system) + - rewardDescription: A description of the reward's effect. *You will also have to implement the effect where it is applied.* It can also be a function that returns updating text. Can use basic HTML. - rewardEffect(): **optional**. A function that calculates and returns the current values of any bonuses from the reward. Can return a value or an object containing multiple values. Can use basic HTML. @@ -39,8 +44,6 @@ Individual Challenges can have these features: - fullDisplay(): **OVERRIDE**. Overrides the other displays and descriptions, and lets you set the full text for the challenge. Can use basic HTML. -- goal: A Decimal for the amount of currency required to beat the challenge. By default, the goal is in basic Points. The goal can also be a function if its value changes. - - unlocked(): **optional**. A function returning a bool to determine if the challenge is visible or not. Default is unlocked. - onComplete() - **optional**. this function will be called when the challenge is completed when previously incomplete. @@ -55,16 +58,17 @@ Individual Challenges can have these features: - id: **assigned automagically**. It's the "key" which the challenge was stored under, for convenient access. The challenge in the example's id is 11. -By default, challenges use basic Points for the goal. You can change that using these features: -- currencyDisplayName: **optional**. the name to display for the currency for the goal -- currencyInternalName: **optional**. the internal name for that currency +The old goal system uses these features: -- currencyLayer: **optional**. the internal name of the layer that currency is stored in. If it's not in a layer, omit. If it's not stored directly in a layer, instead use the next feature. +- goal: **deprecated**, A Decimal for the amount of currency required to beat the challenge. By default, the goal is in basic Points. The goal can also be a function if its value changes. -- currencyLocation: **optional**. if your currency is stored in something inside a layer (e.g. a buyable's amount), you can access it this way. This is a function returning the object in "player" that contains the value (like `player[this.layer].buyables`) +- currencyDisplayName: **deprecated**. the name to display for the currency for the goal -You can also set a fully custom win condition that overrides other goal-related features (use fullDisplay along with this) +- currencyInternalName: **deprecated**. the internal name for that currency + +- currencyLayer: **deprecated**. the internal name of the layer that currency is stored in. If it's not in a layer, omit. If it's not stored directly in a layer, instead use the next feature. + +- currencyLocation(): **deprecated**. if your currency is stored in something inside a layer (e.g. a buyable's amount), you can access it this way. This is a function returning the object in "player" that contains the value (like `player[this.layer].buyables`) -- canComplete(): **OVERRIDE**, returns true if you can complete the challenge \ No newline at end of file diff --git a/docs/upgrades.md b/docs/upgrades.md index 06b59f9..ccb706f 100644 --- a/docs/upgrades.md +++ b/docs/upgrades.md @@ -61,6 +61,6 @@ By default, upgrades use the main prestige currency for the layer. You can inclu If you want to do something more complicated like upgrades that cost two currencies, you can override the purchase system with these (and you need to use fullDisplay as well) --canAfford(): **OVERRIDE**, a function determining if you are able to buy the upgrade +- canAfford(): **OVERRIDE**, a function determining if you are able to buy the upgrade --pay(): **OVERRIDE**, a function that reduces your currencies when you buy the upgrade \ No newline at end of file +- pay(): **OVERRIDE**, a function that reduces your currencies when you buy the upgrade \ No newline at end of file diff --git a/index.html b/index.html index 0c5985a..169fa1f 100644 --- a/index.html +++ b/index.html @@ -60,7 +60,7 @@
-
+
diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index f6e5b0d..905ca41 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -83,7 +83,8 @@ addLayer("c", { name: "Fun", completionLimit: 3, challengeDescription() {return "Makes the game 0% harder
"+challengeCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"}, - unlocked() { return player[this.layer].best.gt(0) }, + unlocked() { return player[this.layer].best.gt(0) }, + goalDescription: 'Have 20 lollipops I guess', goal: new Decimal("20"), currencyDisplayName: "lollipops", // Use if using a nonstandard currency currencyInternalName: "points", // Use if using a nonstandard currency diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 4b83e5b..4d6e724 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.5", + num: "2.2.6", name: "Uprooted", } diff --git a/js/components.js b/js/components.js index d72500d..afe6509 100644 --- a/js/components.js +++ b/js/components.js @@ -125,7 +125,7 @@ function loadVue() {
- Goal: {{format(tmp[layer].challenges[data].goal)}} {{tmp[layer].challenges[data].currencyDisplayName ? tmp[layer].challenges[data].currencyDisplayName : "points"}}
+ Goal: {{format(tmp[layer].challenges[data].goal)}} {{tmp[layer].challenges[data].currencyDisplayName ? tmp[layer].challenges[data].currencyDisplayName : "points"}}
Reward:
Currently:
diff --git a/js/game.js b/js/game.js index ecc997f..4e7781b 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.5", + tmtNum: "2.2.6", tmtName: "Uprooted" } diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index 13fb68e..2639c0b 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -181,7 +181,7 @@ function addLayer(layerName, layerData){ // Call this to add layers from a diffe layers[layerName].isLayer = true } -function addNode(layerName, layerData){ // Does the same thing +function addNode(layerName, layerData){ // Does the same thing, but for non-layer nodes layers[layerName] = layerData layers[layerName].isLayer = false } diff --git a/js/utils.js b/js/utils.js index 7d44004..cd2eee9 100644 --- a/js/utils.js +++ b/js/utils.js @@ -169,8 +169,9 @@ function getStartBuyables(layer){ function getStartClickables(layer){ let data = {} if (layers[layer].clickables) { - if (isPlainObject(layers[layer].clickables[id])) - data[id] = "" + for (id in layers[layer].buyables) + if (isPlainObject(layers[layer].clickables[id])) + data[id] = "" } return data } @@ -179,8 +180,8 @@ function getStartChallenges(layer){ let data = {} if (layers[layer].challenges) { for (id in layers[layer].challenges) - if (isPlainObject(layers[layer].challenges[id])) - data[id] = 0 + if (isPlainObject(layers[layer].challenges[id])) + data[id] = 0 } return data }