2020-10-01 05:30:59 +00:00
|
|
|
# Layer Features
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
This is a more comprehensive list of established features to add to layers.
|
|
|
|
You can add more freely, if you want to have other functions or values associated with your layer. These have special functionality, though.
|
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
You can make almost any value dynamic by using a function in its place, including all display strings and styling/color features.
|
|
|
|
|
2020-10-01 04:08:01 +00:00
|
|
|
Key:
|
|
|
|
- No label: This is required and the game will crash if it isn't included.
|
|
|
|
- **sometimes required**: This is may be required, depending on other things in the layer.
|
|
|
|
- **optional**: You can leave this out if you don't intend to use that feature for the layer.
|
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Layer Definition features
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-03 19:45:47 +00:00
|
|
|
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
|
|
|
to access the save value. It makes copying code to new layers easier. It is also assigned to all upgrades and buyables and such.
|
|
|
|
|
2020-10-07 15:08:20 +00:00
|
|
|
- name: **Optional**, used in reset confirmations (and maybe other places). If absent, it just uses the layer's id.
|
|
|
|
|
2020-10-01 04:08:01 +00:00
|
|
|
- startData(): A function to return the default save data for this layer. Add any variables you have to it.
|
2020-10-01 05:41:25 +00:00
|
|
|
Any nonstandard Decimal variables need to be added to convertToDecimal as well.
|
2020-10-01 04:08:01 +00:00
|
|
|
Standard values:
|
|
|
|
Required:
|
2020-10-13 03:08:19 +00:00
|
|
|
unlocked: a bool determining if this layer is unlocked or not
|
2020-10-01 04:08:01 +00:00
|
|
|
points: a Decimal, the main currency for the layer
|
|
|
|
Optional:
|
|
|
|
total: A Decimal, tracks total amount of main prestige currency
|
|
|
|
best: A Decimal, tracks highest amount of main prestige currency
|
2020-10-15 03:31:05 +00:00
|
|
|
unlockOrder: used to keep track of relevant layers unlocked before this one.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- color: A color associated with this layer, used in many places. (A string in hex format with a #)
|
|
|
|
|
2020-10-14 23:46:35 +00:00
|
|
|
- row: The row of the layer, starting at 0. This affects where the node appears on the tree, and which resets affect the layer.
|
|
|
|
|
|
|
|
Using "side" instead of a number will cause the layer to appear off to the side as a smaller node (useful for achievements
|
|
|
|
and statistics). Side layers are not affected by resets unless you add a doReset to them.
|
|
|
|
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- resource: Name of the main currency you gain by resetting on this layer.
|
|
|
|
|
|
|
|
- effect(): **optional**, A function that calculates and returns the current values of any bonuses
|
|
|
|
inherent to the main currency.
|
2020-10-01 04:51:07 +00:00
|
|
|
Can return a value or an object containing multiple values.
|
|
|
|
*You will also have to implement the effect where it is applied.*
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-03 19:45:47 +00:00
|
|
|
- effectDescription: **optional**, A function that returns a description of this effect.
|
|
|
|
If the text stays constant, it can just be a string.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- layerShown(): A function returning a bool which determines if this layer's node should be visible on the tree.
|
2020-10-16 22:45:44 +00:00
|
|
|
It can also return "ghost", which will hide the layer, but its node will still take up space in the tree.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-08 05:33:44 +00:00
|
|
|
- hotkeys: **optional**, An array containing information on any hotkeys associated with this layer:
|
2020-10-01 19:57:47 +00:00
|
|
|
```js
|
|
|
|
hotkeys: [
|
2020-10-01 04:08:01 +00:00
|
|
|
{key: "p", // What the hotkey button is. Use uppercase if it's combined with shift, or "ctrl+x" if ctrl is.
|
|
|
|
desc: "p: reset your points for prestige points", // The description of the hotkey used in the How To Play
|
2020-10-13 03:08:19 +00:00
|
|
|
onPress(){if (player.p.unlocked) doReset("p")}}, // This function is called when the hotkey is pressed.
|
2020-10-01 19:57:47 +00:00
|
|
|
],
|
|
|
|
```
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- style: **optional**, a "CSS object" where the keys are CSS attributes ,containing any CSS that should affect this
|
|
|
|
layer's entire tab.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-08 05:33:44 +00:00
|
|
|
- tabFormat: **optional**, use this if you want to add extra things to your tab or change the layout. [See here for more info.](custom-tab-layouts.md)
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-08 05:33:44 +00:00
|
|
|
- midsection: **optional**, an alternative to tabFormat, which is inserted in between Milestones and Buyables in the
|
|
|
|
standard tab layout. (cannot do subtabs)
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-08 05:33:44 +00:00
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Big features (all optional)
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- upgrades: A grid of one-time purchases which can have unique upgrade conditions, currency costs, and bonuses.
|
|
|
|
[Explanations are in a separate file.](upgrades.md)
|
|
|
|
|
|
|
|
- milestones: A list of bonuses gained upon reaching certain thresholds of a resource. Often used for automation/QOL.
|
|
|
|
[Explanations are in a separate file.](milestones.md)
|
|
|
|
|
|
|
|
- challenges: The player can enter challenges, which make the game harder. If they reach a goal and beat the challenge,
|
|
|
|
they recieve a bonus.
|
|
|
|
[Explanations are in a separate file.](challenges.md)
|
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- buyables: Effectively upgrades that can be bought multiple times, and are optionally respeccable. Many uses.
|
2020-10-01 04:08:01 +00:00
|
|
|
[Explanations are in a separate file.](buyables.md)
|
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- clickables: Extremely versatile and generalized buttons which can only be clicked sometimes.
|
|
|
|
[Explanations are in a separate file.](clickables.md)
|
|
|
|
|
2020-10-07 04:57:41 +00:00
|
|
|
- microtabs: An area that functions like a set of subtabs, with buttons at the top changing the content within. (Advanced)
|
|
|
|
[Explanations are in a separate file.](subtabs-and-microtabs.md)
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- bars: Display some information as a progress bar, gague, or similar. They are highly customizable, and can be vertical as well.
|
|
|
|
[Explanations are in a separate file.](bars.md)
|
2020-10-07 04:57:41 +00:00
|
|
|
|
2020-10-15 01:43:16 +00:00
|
|
|
- achievements: Kind of like milestones, but with a different display style and some other differences. Extra features are on the way at a later date!
|
|
|
|
[Explanations are in a separate file.](achievements.md)
|
|
|
|
|
2020-10-26 02:25:42 +00:00
|
|
|
- infoboxes: Displays some text in a box that can be shown or hidden.
|
|
|
|
[Explanations are in a separate file.](infoboxes.md)
|
|
|
|
|
2020-10-15 01:43:16 +00:00
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Prestige formula features
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-26 02:25:42 +00:00
|
|
|
- type: **optional**, Determines which prestige formula you use. Defaults to "none".
|
2020-10-15 03:09:30 +00:00
|
|
|
"normal": The amount of currency you gain is independent of its current amount (like Prestige).
|
|
|
|
formula before bonuses is based on `baseResource^exponent`
|
|
|
|
"static": The cost is dependent on your total after reset.
|
|
|
|
formula before bonuses is based on `base^(x^exponent)`
|
|
|
|
"custom": You can define everything, from the calculations to the text on the button, yourself. (See more at the bottom)
|
|
|
|
"none": This layer does not prestige, and therefore does not need any of the other features in this section.
|
|
|
|
|
2020-10-01 04:08:01 +00:00
|
|
|
- baseResource: The name of the resource that determines how much of the main currency you gain on reset.
|
|
|
|
|
|
|
|
- baseAmount(): A function that gets the current value of the base resource.
|
|
|
|
|
2020-10-03 19:45:47 +00:00
|
|
|
- requires: A Decimal, the amount of the base needed to gain 1 of the prestige currency.
|
2020-10-01 04:08:01 +00:00
|
|
|
Also the amount required to unlock the layer.
|
2020-10-15 03:31:05 +00:00
|
|
|
You can instead make this a function, to make it harder if another layer was unlocked first (based on unlockOrder).
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- exponent: Used as described above.
|
|
|
|
|
|
|
|
- base: **sometimes required**, required for "static" layers, used as described above.
|
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- roundUpCost: **optional**, a bool, which is true if the resource cost needs to be rounded up.
|
2020-10-01 04:08:01 +00:00
|
|
|
(use if the base resource is a "static" currency.)
|
|
|
|
|
|
|
|
- canBuyMax(): **sometimes required**, required for static layers, function used to determine if buying max is permitted.
|
|
|
|
|
2020-10-21 20:14:42 +00:00
|
|
|
- gainMult(), gainExp(): **optional**, Functions that calculate the multiplier and exponent on resource gain from upgrades
|
2020-10-01 04:08:01 +00:00
|
|
|
and boosts and such. Plug in any bonuses here.
|
|
|
|
|
|
|
|
- onPrestige(gain): **optional**, A function that triggers when this layer prestiges, just before you gain the currency.
|
|
|
|
Can be used to have secondary resource gain on prestige, or to recalculate things or whatnot.
|
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- resetDesc: **optional**, use this to replace "Reset for " on the Prestige button with something else.
|
|
|
|
|
|
|
|
- prestigeButtonText(): **Sometimes required**, Use this to make the entirety of the text a Prestige button contains. Only required for custom layers,
|
|
|
|
but usable by all types.
|
|
|
|
|
|
|
|
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Tree/node features
|
2020-10-07 20:41:45 +00:00
|
|
|
|
2020-10-11 03:26:26 +00:00
|
|
|
- symbol: **optional**, the text that appears on this layer's node. Default is the layer id with the first letter capitalized
|
|
|
|
|
|
|
|
- position: **optional**, Determines the horizontal position of the layer in its row. By default, it uses the layer id,
|
|
|
|
and layers are sorted in alphabetical order.
|
|
|
|
|
2020-10-09 00:35:08 +00:00
|
|
|
- branches: **optional**, an array of layer ids. On a tree, a line will appear from this layer to all of the layers
|
2020-10-15 01:52:48 +00:00
|
|
|
in the list. Alternatively, an entry in the array can be a 2-element array consisting of the layer id and a color
|
2020-10-09 00:35:08 +00:00
|
|
|
value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors)
|
2020-10-07 20:41:45 +00:00
|
|
|
|
2020-10-13 03:08:19 +00:00
|
|
|
- nodeStyle: **optional**, a CSS object, where the keys are CSS attributes, which styles this layer's node on the tree
|
2020-10-07 20:41:45 +00:00
|
|
|
|
|
|
|
- tooltip() / tooltipLocked(): **optional** Functions that return text, which is the tooltip for the node when the layer
|
|
|
|
is unlocked or locked, respectively. By default the tooltips behave the same as in the original Prestige Tree.
|
|
|
|
|
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Other features
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- doReset(resettingLayer): **optional**, is triggered when a layer on a row greater than or equal to this one does a reset.
|
2020-10-13 22:56:17 +00:00
|
|
|
The default behavior is to reset everything on the row, but only if it was triggered by a layer in a higher row.
|
2020-10-14 23:46:35 +00:00
|
|
|
(doReset is always called for side layers, but for these the default behavior is to reset nothing.)
|
2020-10-13 22:56:17 +00:00
|
|
|
|
|
|
|
If you want to keep things, determine what to keep based on the resettingLayer, milestones, and such, then call
|
|
|
|
resetLayerData(layer, keep), where layer is this layer, and keep is an array of the names of things to keep.
|
|
|
|
It can include things like "points", "best", "total" (for this layer's prestige currency), "upgrades",
|
|
|
|
any unique variables like "generatorPower", etc.
|
|
|
|
If you want to only keep specific upgrades or something like that, save them in a separate variable, then
|
2020-10-15 21:41:18 +00:00
|
|
|
call layerDataReset, and then set player[layer].upgrades to the saved upgrades.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
- update(diff): **optional**, this function is called every game tick. Use it for any passive resource production or
|
|
|
|
time-based things. diff is the time since the last tick.
|
|
|
|
Suggestion: use addPoints(layer, gain) when generating points to automatically
|
|
|
|
update the best and total amounts.
|
|
|
|
|
|
|
|
- automate(): **optional**, this function is called every game tick, after production. Use it to activate any
|
|
|
|
autobuyers or auto-resets or similar on this layer, if appropriate.
|
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- resetsNothing: **optional**, returns true if this layer shouldn't trigger any resets when you prestige.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-15 03:31:05 +00:00
|
|
|
- increaseUnlockOrder: **optional**, an array of layer ids. When this layer is unlocked for the first time, the unlockOrder value
|
2020-10-01 04:08:01 +00:00
|
|
|
for any not-yet-unlocked layers in this list increases. This can be used to make them harder to unlock.
|
|
|
|
|
2020-10-19 23:52:52 +00:00
|
|
|
- shouldNotify: **optional**, a function to return true if this layer should be highlighted in the tree.
|
2020-10-07 03:11:36 +00:00
|
|
|
The layer will automatically be highlighted if you can buy an upgrade whether you have this or not.
|
|
|
|
|
2020-10-07 20:41:45 +00:00
|
|
|
- componentStyles: **optional**, An object that contains a set of functions returning CSS objects.
|
|
|
|
Each of these will be applied to any components on the layer with the type of its id. Example:
|
|
|
|
|
|
|
|
```js
|
|
|
|
componentStyles: {
|
2020-10-19 23:52:52 +00:00
|
|
|
"challenge"() {return {'height': '200px'}},
|
2020-10-07 20:41:45 +00:00
|
|
|
"prestige-button"() {return {'color': '#AA66AA'}},
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
2020-10-07 03:11:36 +00:00
|
|
|
|
2020-10-15 17:29:25 +00:00
|
|
|
## Custom Prestige type
|
2020-10-07 03:11:36 +00:00
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- getResetGain(): **For custom prestige type**, Returns how many points you should get if you reset now. You can call
|
2020-10-07 03:11:36 +00:00
|
|
|
getResetGain(this.layer, useType = "static") or similar to calculate what your gain would be under another
|
|
|
|
prestige type (provided you have all of the required features in the layer.)
|
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- getNextAt(canMax=false): **For custom prestige type**, Returns how many of the base currency you need to get to
|
2020-10-07 03:11:36 +00:00
|
|
|
the next point. canMax is an optional variable used with Static-ish layers to differentiate between if
|
|
|
|
it's looking for the first point you can reset at, or the requirement for any gain at all.
|
|
|
|
(Supporting both is good). You can also call getNextAt(this.layer, canMax=false, useType = "static")
|
|
|
|
or similar to calculate what your next at would be under another prestige type (provided you have
|
|
|
|
all of the required features in the layer.)
|
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- canReset(): **For custom prestige type**, return true only if you have the resources required to do a prestige here.
|