1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00
This commit is contained in:
Acamaeda 2020-11-30 15:03:26 -05:00
parent 2096c3db7f
commit a9d55645b5
10 changed files with 32 additions and 23 deletions

View file

@ -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.

View file

@ -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

View file

@ -60,7 +60,7 @@
</div>
<overlay-head v-if="!(gameEnded && !player.keepGoing)"></overlay-head>
<div class="sideLayers" >
<div v-for="node in OTHER_LAYERS['side']"><tree--node :layer='node' :abb='tmp[node].symbol' :size="'small'"></tree-node></div>
<div v-for="node in OTHER_LAYERS['side']"><tree-node :layer='node' :abb='tmp[node].symbol' :size="'small'"></tree-node></div>
</div>
</div>

View file

@ -84,6 +84,7 @@ addLayer("c", {
completionLimit: 3,
challengeDescription() {return "Makes the game 0% harder<br>"+challengeCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"},
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

View file

@ -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",
}

View file

@ -125,7 +125,7 @@ function loadVue() {
<span v-if="tmp[layer].challenges[data].fullDisplay" v-html="tmp[layer].challenges[data].fullDisplay"></span>
<span v-else>
<span v-html="tmp[layer].challenges[data].challengeDescription"></span><br>
Goal: {{format(tmp[layer].challenges[data].goal)}} {{tmp[layer].challenges[data].currencyDisplayName ? tmp[layer].challenges[data].currencyDisplayName : "points"}}<br>
Goal: <span v-if="tmp[layer].challenges[data].goalDescription" v-html="tmp[layer].challenges[data].goalDescription"></span><span v-else>{{format(tmp[layer].challenges[data].goal)}} {{tmp[layer].challenges[data].currencyDisplayName ? tmp[layer].challenges[data].currencyDisplayName : "points"}}</span><br>
Reward: <span v-html="tmp[layer].challenges[data].rewardDescription"></span><br>
<span v-if="tmp[layer].challenges[data].rewardEffect!==undefined">Currently: <span v-html="(tmp[layer].challenges[data].rewardDisplay) ? (tmp[layer].challenges[data].rewardDisplay) : format(tmp[layer].challenges[data].rewardEffect)"></span></span>
</span>

View file

@ -4,7 +4,7 @@ var gameEnded = false;
// Don't change this
const TMT_VERSION = {
tmtNum: "2.2.5",
tmtNum: "2.2.6",
tmtName: "Uprooted"
}

View file

@ -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
}

View file

@ -169,6 +169,7 @@ function getStartBuyables(layer){
function getStartClickables(layer){
let data = {}
if (layers[layer].clickables) {
for (id in layers[layer].buyables)
if (isPlainObject(layers[layer].clickables[id]))
data[id] = ""
}