2020-10-01 05:30:59 +00:00
|
|
|
# Upgrades
|
2020-10-01 04:08:01 +00:00
|
|
|
|
|
|
|
Upgrades are stored in the following format:
|
|
|
|
|
2020-10-05 21:11:15 +00:00
|
|
|
Useful functions for dealing with Upgrades and implementing their effects:
|
|
|
|
|
|
|
|
- hasUpg(layer, id): determine if the player has the upgrade
|
2020-10-10 03:26:27 +00:00
|
|
|
- upgEffect(layer, id): Returns the current effects of the upgrade, if any
|
2020-10-05 21:11:15 +00:00
|
|
|
|
|
|
|
Hint: Basic point gain is calculated in game.js's "getPointGain".
|
|
|
|
|
|
|
|
|
2020-10-01 19:57:47 +00:00
|
|
|
```js
|
2020-10-01 05:43:30 +00:00
|
|
|
upgrades: {
|
|
|
|
rows: # of rows
|
|
|
|
cols: # of columns
|
|
|
|
11: {
|
2020-10-03 19:45:47 +00:00
|
|
|
desc:() => "Blah",
|
2020-10-05 21:11:15 +00:00
|
|
|
more features
|
2020-10-01 05:43:30 +00:00
|
|
|
}
|
2020-10-01 05:41:25 +00:00
|
|
|
etc
|
|
|
|
}
|
2020-10-01 19:57:47 +00:00
|
|
|
```
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-01 04:51:07 +00:00
|
|
|
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:
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-03 19:45:47 +00:00
|
|
|
- title: **optional**, displayed at the top in a larger font
|
2020-10-07 20:41:45 +00:00
|
|
|
It can also be a function that returns updating text. Can use basic HTML.
|
2020-10-03 19:45:47 +00:00
|
|
|
|
2020-10-01 04:51:07 +00:00
|
|
|
- desc: A description of the upgrade's effect. *You will also have to implement the effect where it is applied.*
|
2020-10-07 20:41:45 +00:00
|
|
|
It can also be a function that returns updating text. Can use basic HTML.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-01 04:51:07 +00:00
|
|
|
- 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.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-10 03:16:29 +00:00
|
|
|
- effectDisplay(): **optional**, A function that returns a display of the current effects of the upgrade with
|
2020-10-07 20:41:45 +00:00
|
|
|
formatting. Default behavior is to just display the a number appropriately formatted. Can use basic HTML.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-01 04:51:07 +00:00
|
|
|
- cost: A Decimal for the cost of the upgrade. By default, upgrades cost the main prestige currency for the layer.
|
|
|
|
|
2020-10-01 05:30:59 +00:00
|
|
|
- unl(): A function returning a bool to determine if the upgrade is visible or not.
|
2020-10-01 04:51:07 +00:00
|
|
|
|
|
|
|
- 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.
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-10 03:26:27 +00:00
|
|
|
- style: **Optional**, A a CSS object, which affects this upgrade.
|
2020-10-07 20:41:45 +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
|
2020-10-01 04:08:01 +00:00
|
|
|
|
2020-10-03 19:45:47 +00:00
|
|
|
- id: **Assigned automagically**. It's the id for this upgrade.
|