From ea9daeb8d4caf126331e4db8710f6e637af9ae22 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Thu, 1 Oct 2020 00:51:07 -0400 Subject: [PATCH] Added documentation for everything but Buyables and Custom Layout --- docs/basic-layer-breakdown.md | 4 +-- docs/challenges.md | 44 ++++++++++++++--------- docs/layer-features.md | 3 +- docs/milestones.md | 68 +++++++++++++++++++++++++++++++---- docs/upgrades.md | 37 ++++++++++++------- sampleLayers.js | 2 +- 6 files changed, 118 insertions(+), 40 deletions(-) diff --git a/docs/basic-layer-breakdown.md b/docs/basic-layer-breakdown.md index a5016d4..e39b705 100644 --- a/docs/basic-layer-breakdown.md +++ b/docs/basic-layer-breakdown.md @@ -2,7 +2,7 @@ This is a very minimal layer with minimal features. Most things will require additional features: -``` +`` p: { startData() { return { // startData is a function that returns default data for a layer. unl: false, // You can add more variables here to add them to your layer. @@ -32,4 +32,4 @@ p: { layerShown() {return true}, // Returns a bool for if this layer's node should be visible in the tree. }, -``` \ No newline at end of file +`` \ No newline at end of file diff --git a/docs/challenges.md b/docs/challenges.md index 839e409..e19f1e2 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -2,35 +2,47 @@ Challenges are stored in the following format: -challs: { +``challs: { rows: # of rows cols: # of columns 11: { - [insert challenge info here] + name: "Ouch", + etc } etc -} +}`` -Each challenge should have an id where the first digit is the row and the second digit is the column. Individual upgrades can have these features: +You can use inChall(layer, id) and hasChall(layer, id) to determine if the player is currently in a challenge, +or has completed the challenge, respectively. These are useful for implementing effects. -name: Name of the challenge +Each challenge should have an id where the first digit is the row and the second digit is the column. +Individual upgrades can have these features: -desc: A description of what makes the challenge a challenge +- name: Name of the challenge -reward: A description of the reward's effect +- desc: A description of what makes the challenge a challenge. *You will need to implement these elsewhere* -effect() - Optional, calculate and return the values of this upgrade's effects or effects. +- reward: A description of the reward's effect. *You will also have to implement the effect where it is applied.* -effectDisp(x) - Optional, returns a display of the current effects of the upgrade with formatting. Default behavior is to just display the number appropriately formatted. +- effect(): **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. -goal: A Decimal for the goal of the challenge's value. +- effectDisp(effects): **optional**, A function that returns a display of the current effects of the reward with + formatting. Default behavior is to just display the a number appropriately formatted. -currencyDisplayName: Optional, if using a goal currency other than basic Points, the name to display for that currency -currencyInternalName: The internal name for that currency -currencyLayer: The internal name of the layer for that currency. If it's not in a layer, omit. +- goal: A Decimal for the cost of the upgrade. By default, the goal is in basic Points. -unl() - Return a bool to determine if the challenge is unlocked or not. +- unl(): A function returning a bool to determine if the challenge is unlocked or not. + +- onComplete() - **optional**, this function will be called when the challenge is completed when previously incomplete. + +- countsAs: **optional**, If a challenge combines the effects of other challenges in this layer, you can use this. + An array of challenge ids. The player is effectively in all of those challenges when in the current one. + +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 +- currencyLayer: **optional**, the internal name of the layer that currency is stored in. + If it's part of a layer, omit. -onComplete() - Optional, this function will be called when the challenge is newly completed. -countsAs: An array of ids of other challenges in this layer that being in this challenge "counts as" being in. diff --git a/docs/layer-features.md b/docs/layer-features.md index 3ca0537..339f005 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -29,7 +29,8 @@ Key: - effect(): **optional**, A function that calculates and returns the current values of any bonuses inherent to the main currency. - Returns a value or an object containing multiple values. + Can return a value or an object containing multiple values. + *You will also have to implement the effect where it is applied.* - effectDescription(): **optional**, A function that returns a description of this effect diff --git a/docs/milestones.md b/docs/milestones.md index 55017f7..107b3ef 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -2,20 +2,74 @@ Milestones should be formatted like this: -milestones: { +``milestones: { 0: { - [insert milestone info here] + requirementDesc: "123 waffles", } etc -} +}`` + +You can use inChall(layer, id) and hasChall(layer, id) to determine if the player is currently in a challenge, Milestone features: -requirementDesc: A string describing the requirement +- requirementDesc: A string describing the requirement for unlocking this milestone. Suggestion: Use a "total". -effectDesc: A string describing the reward for having the milestone +- effectDesc: A string describing the reward for having the milestone. *You will have to implement the reward elsewhere.* -done() - A function to determine if the milestone has been fulfilled. +- done(): A function returning a boolean to determine if the milestone has been fulfilled. + +- toggles: *optional*, Creates toggle buttons that appear on the milestone when it is unlocked. + The toggles can toggle a given boolean value in a layer. + It is defined as an array of paired items, one pair per toggle. The first is the internal name of the layer + the value being toggled is stored in, and the second is the internal name of the variable to toggle. + (e.g. [["b", "auto"], ["g", "auto"]) + +#Challenges + +Challenges are stored in the following format: + +```challs: { + rows: # of rows + cols: # of columns + 11: { + name: "Ouch", + etc + } + etc +}``` + +You can use inChall(layer, id) and hasChall(layer, id) to determine if the player is currently in a challenge, +or has completed the challenge, respectively. These are useful for implementing effects. + +Each challenge should have an id where the first digit is the row and the second digit is the column. +Individual upgrades can have these features: + +- name: Name of the challenge + +- desc: A description of what makes the challenge a challenge. *You will need to implement these elsewhere* + +- reward: A description of the reward's effect. *You will also have to implement the effect where it is applied.* + +- effect(): **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. + +- effectDisp(effects): **optional**, A function that returns a display of the current effects of the reward with + formatting. Default behavior is to just display the a number appropriately formatted. + +- goal: A Decimal for the cost of the upgrade. By default, the goal is in basic Points. + +- unl(): A function returning a bool to determine if the challenge is unlocked or not. + +- onComplete() - **optional**, this function will be called when the challenge is completed when previously incomplete. + +- countsAs: **optional**, If a challenge combines the effects of other challenges in this layer, you can use this. + An array of challenge ids. The player is effectively in all of those challenges when in the current one. + +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 +- currencyLayer: **optional**, the internal name of the layer that currency is stored in. + If it's part of a layer, omit. -toggles: Creates toggle buttons on the milestone when it is unlocked. An array of paired items, one pair per toggle. The first is the internal name of the layer the value being toggled is stored in, and the second is the internal name of the variable to toggle. (e.g. [["b", "auto"], ["g", "auto"]) diff --git a/docs/upgrades.md b/docs/upgrades.md index 4028e07..bc6fbed 100644 --- a/docs/upgrades.md +++ b/docs/upgrades.md @@ -2,29 +2,40 @@ Upgrades are stored in the following format: -upgrades: { +``upgrades: { rows: # of rows cols: # of columns 11: { - [insert upgrade info here] + desc: "Blah", + etc } etc -} +}`` -Each upgrade should have an id where the first digit is the row and the second digit is the column. Individual upgrades can have these features: +You can use hasUpg(layer, id) to determine if the player has an upgrade. This is useful for implementing bonuses. -desc: A description of the upgrade's effect +Each upgrade should have an id where the first digit is the row and the second digit is the column. +Individual upgrades can have these features: -effect() - Optional, calculate and return the values of this upgrade's effects or effects. +- desc: A description of the upgrade's effect. *You will also have to implement the effect where it is applied.* -effectDisp() - Optional, returns a display of the current effects of the upgrade with formatting. Default behavior is to just display the number appropriately formatted. +- effect(): **optional**, A function that calculates and returns the current values of any bonuses from the upgrade. + Can return a value or an object containing multiple values. -cost: A Decimal for the cost of the upgrade. +- effectDisp(effects): **optional**, A function that returns a display of the current effects of the upgrade with + formatting. Default behavior is to just display the a number appropriately formatted. -currencyDisplayName: Optional, if using a currency other than the main one for this layer, the name to display for that currency -currencyInternalName: The internal name for that currency -currencyLayer: The internal name of the layer for that currency. If it's not in a layer (like Points), omit. +- cost: A Decimal for the cost of the upgrade. By default, upgrades cost the main prestige currency for the layer. + +- unl(): A function returning a bool to determine if the upgrade is unlocked or not. + +- onPurchase() - **optional**, this function will be called when the upgrade is purchased. + Good for upgrades like "makes this layer act like it was unlocked first". + +By default, upgrades use the main prestige currency for the layer. You can include these to change them: +- currencyDisplayName: **optional**, the name to display for the currency for the upgrade +- currencyInternalName: **optional**, the internal name for that currency +- currencyLayer: **optional**, the internal name of the layer that currency is stored in. + If it's not in a layer (like Points), omit. -unl() - Return a bool to determine if the upgrade is unlocked or not. -onPurchase() - Optional, this function will be called when the upgrade is purchased. Good for upgrades like "makes this layer act like it was unlocked first". diff --git a/sampleLayers.js b/sampleLayers.js index b07e7dd..7b9e95b 100644 --- a/sampleLayers.js +++ b/sampleLayers.js @@ -56,7 +56,7 @@ var layers = { if (ret.gte("1e20000000")) ret = ret.sqrt().times("1e10000000") return ret; }, - effDisp(x) { return format(x)+"x" }, + effDisp(fx) { return format(fx)+"x" }, }, 13: { desc: "Make this layer act like you bought it first.",