mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-21 16:13:55 +00:00
Renamed many things to be more readable and updated docs
This commit is contained in:
parent
02da021fb1
commit
fde714d73f
21 changed files with 281 additions and 253 deletions
|
@ -49,11 +49,11 @@ function getPointGen() {
|
|||
|
||||
// Function to determine if the player is in a challenge
|
||||
function inChallenge(layer, id){
|
||||
let chall = player[layer].active
|
||||
if (chall==toNumber(id)) return true
|
||||
let challenge = player[layer].active
|
||||
if (challenge==toNumber(id)) return true
|
||||
|
||||
if (layers[layer].challs[chall].countsAs)
|
||||
return layers[layer].challs[id].countsAs.includes(id)
|
||||
if (layers[layer].challenges[challenge].countsAs)
|
||||
return layers[layer].challenges[id].countsAs.includes(id)
|
||||
}
|
||||
|
||||
function getResetGain(layer, useType = null) {
|
||||
|
@ -144,7 +144,7 @@ function fullLayerReset(layer) {
|
|||
player[layer] = layers[layer].startData();
|
||||
player[layer].upgrades = []
|
||||
player[layer].milestones = []
|
||||
player[layer].challs = []
|
||||
player[layer].challenges = []
|
||||
if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)) {
|
||||
if (player.subtabs[layer] == undefined) player.subtabs[layer] = {}
|
||||
if (player.subtabs[layer].mainTabs == undefined) player.subtabs[layer].mainTabs = Object.keys(layers[layer].tabFormat)[0]
|
||||
|
@ -218,7 +218,7 @@ function doReset(layer, force=false) {
|
|||
|
||||
|
||||
for (layerResetting in layers) {
|
||||
if (row >= layers[layerResetting].row && (!force || layerResetting != layer)) completeChall(layerResetting)
|
||||
if (row >= layers[layerResetting].row && (!force || layerResetting != layer)) completeChallenge(layerResetting)
|
||||
}
|
||||
|
||||
prevOnReset = {...player} //Deep Copy
|
||||
|
@ -260,10 +260,10 @@ function hasMilestone(layer, id) {
|
|||
return (player[layer].milestones.includes(toNumber(id)) || player[layer].milestones.includes(id.toString()))
|
||||
}
|
||||
|
||||
function hasChall(layer, id){
|
||||
if (!layers[layer].challs) return false
|
||||
function hasChallenge(layer, id){
|
||||
if (!layers[layer].challenges) return false
|
||||
|
||||
return (player[layer].challs.includes(toNumber(id)) || player[layer].challs.includes(id.toString()))
|
||||
return (player[layer].challenges.includes(toNumber(id)) || player[layer].challenges.includes(id.toString()))
|
||||
}
|
||||
|
||||
function buyablesOwned(layer, id){
|
||||
|
@ -280,10 +280,10 @@ function upgEffect(layer, id){
|
|||
return (tmp[layer].upgrades[id].effect)
|
||||
}
|
||||
|
||||
function challEffect(layer, id){
|
||||
if (!layers[layer].chall) return false
|
||||
function challengeEffect(layer, id){
|
||||
if (!layers[layer].challenge) return false
|
||||
|
||||
return (tmp[layer].challs[id].effect)
|
||||
return (tmp[layer].challenges[id].effect)
|
||||
}
|
||||
|
||||
function buyableEffect(layer, id){
|
||||
|
@ -371,11 +371,11 @@ function resetRow(row) {
|
|||
resizeCanvas();
|
||||
}
|
||||
|
||||
function startChall(layer, x) {
|
||||
function startChallenge(layer, x) {
|
||||
let enter = false
|
||||
if (!player[layer].unl) return
|
||||
if (player[layer].active == x) {
|
||||
completeChall(layer, x)
|
||||
completeChallenge(layer, x)
|
||||
delete player[layer].active
|
||||
} else {
|
||||
enter = true
|
||||
|
@ -383,42 +383,42 @@ function startChall(layer, x) {
|
|||
doReset(layer, true)
|
||||
if(enter) player[layer].active = x
|
||||
|
||||
updateChallTemp(layer)
|
||||
updateChallengeTemp(layer)
|
||||
}
|
||||
|
||||
function canCompleteChall(layer, x)
|
||||
function canCompleteChallenge(layer, x)
|
||||
{
|
||||
if (x != player[layer].active) return
|
||||
|
||||
let chall = layers[layer].challs[x]
|
||||
let challenge = layers[layer].challenges[x]
|
||||
|
||||
if (chall.currencyInternalName){
|
||||
let name = chall.currencyInternalName
|
||||
if (chall.currencyLayer){
|
||||
let lr = chall.currencyLayer
|
||||
return !(player[lr][name].lt(readData(chall.goal)))
|
||||
if (challenge.currencyInternalName){
|
||||
let name = challenge.currencyInternalName
|
||||
if (challenge.currencyLayer){
|
||||
let lr = challenge.currencyLayer
|
||||
return !(player[lr][name].lt(readData(challenge.goal)))
|
||||
}
|
||||
else {
|
||||
return !(player[name].lt(chall.cost))
|
||||
return !(player[name].lt(challenge.cost))
|
||||
}
|
||||
}
|
||||
else {
|
||||
return !(player[layer].points.lt(chall.cost))
|
||||
return !(player[layer].points.lt(challenge.cost))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function completeChall(layer, x) {
|
||||
function completeChallenge(layer, x) {
|
||||
var x = player[layer].active
|
||||
if (!x) return
|
||||
if (! canCompleteChall(layer, x)) return
|
||||
if (!player[layer].challs.includes(x)) {
|
||||
if (! canCompleteChallenge(layer, x)) return
|
||||
if (!player[layer].challenges.includes(x)) {
|
||||
needCanvasUpdate = true
|
||||
player[layer].challs.push(x);
|
||||
if (layers[layer].challs[x].onComplete) layers[layer].challs[x].onComplete()
|
||||
player[layer].challenges.push(x);
|
||||
if (layers[layer].challenges[x].onComplete) layers[layer].challenges[x].onComplete()
|
||||
}
|
||||
delete player[layer].active
|
||||
updateChallTemp(layer)
|
||||
updateChallengeTemp(layer)
|
||||
}
|
||||
|
||||
VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSION.pre : VERSION.pre ? " Beta " + VERSION.beta : "")
|
19
changelog.md
19
changelog.md
|
@ -16,7 +16,8 @@ Buyable cost can take an argument for amount of buyables, but if one is not supp
|
|||
All displays will update correctly.
|
||||
Changelog is no longer in index.html at all.
|
||||
Generation of Points now happens in the main game loop (not in a layer update function), enabled by canGenPoints in game.js
|
||||
|
||||
Renamed many things to increase readability (see something or other for a list)
|
||||
Improved documentation based on feedback
|
||||
|
||||
##v1.3.5
|
||||
|
||||
|
@ -106,7 +107,19 @@ Define "CSS Object" clearly in the first instance in each file
|
|||
Explain automagical assignments better
|
||||
|
||||
|
||||
"incr_order",
|
||||
|
||||
Change all "chall", "unl", "desc", "res_ceil", "incr_order",
|
||||
|
||||
Challenges: "chall", "desc", reward -> rewardDescription, effect -> reward, effectDisplay -> rewardDisplay,
|
||||
All instances of:
|
||||
chall -> challenge
|
||||
unl -> unlocked
|
||||
upg -> upgrade
|
||||
amt -> amount
|
||||
desc -> description
|
||||
resCeil -> roundUpCost
|
||||
|
||||
Challenges:
|
||||
desc -> challengeDescription
|
||||
reward -> rewardDescription
|
||||
effect -> rewardEffect
|
||||
effectDisplay -> rewardDisplay
|
|
@ -28,6 +28,8 @@ plain number, and perform operations on them by calling functions. e.g, instead
|
|||
Can be used to make Enhancers or Space Buildings.
|
||||
- [Clickables](clickables.md): A more generalized variant of buyables, for any kind of thing that is sometimes clickable.
|
||||
Between these and Buyables, you can do just about anything.
|
||||
- [Bars](bars.md): Display some information as a progress bar, gague, or similar. They are highly customizable,
|
||||
and can be horizontal and vertical as well.
|
||||
- [Custom Tab Layouts](custom-tab-layouts.md): An optional way to give your tabs a different layout.
|
||||
You can even create entirely new components to use.
|
||||
- [Subtabs and Microtabs](subtabs-and-microtabs.md): Create subtabs for your tabs, as well as "microtab" components that you can put inside the tabs.
|
||||
|
|
|
@ -6,7 +6,7 @@ This is a very minimal layer with minimal features. Most things will require add
|
|||
```js
|
||||
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.
|
||||
unlocked: false, // You can add more variables here to add them to your layer.
|
||||
points: new Decimal(0), // "points" is the internal name for the main resource of the layer.
|
||||
// If you add non-standard Decimal variables, look at convertToDecimal
|
||||
}},
|
||||
|
|
|
@ -17,7 +17,7 @@ Buyables should be formatted like this:
|
|||
Having this function makes a respec button appear
|
||||
respecText: **optional**, text that appears on the respec button
|
||||
11: {
|
||||
desc:() => "Blah",
|
||||
display:() => "Blah",
|
||||
etc
|
||||
}
|
||||
etc
|
||||
|
@ -30,7 +30,8 @@ Features:
|
|||
It can also be a function that returns updating text.
|
||||
|
||||
- cost(): cost for buying the next buyable. Can have an optional argument "x" to calculate the cost of the x+1th object,
|
||||
but needs to use "current amount" as a default value for x. Can return an object if there are multiple currencies.
|
||||
but needs to use "current amount" as a default value for x. (x is a Decimal).
|
||||
Can return an object if there are multiple currencies.
|
||||
|
||||
- effect(): **optional**, A function that calculates and returns the current values of bonuses
|
||||
of this buyable. Can return a value or an object containing multiple values.
|
||||
|
@ -38,16 +39,18 @@ Features:
|
|||
- display(): A function returning everything that should be displayed on the buyable after the title, likely
|
||||
including the description, amount bought, cost, and current effect. Can use basic HTML.
|
||||
|
||||
- unl(): A function returning a bool to determine if the buyable is visible or not.
|
||||
- unlocked(): **optional**, A function returning a bool to determine if the buyable is visible or not. Default is unlocked.
|
||||
|
||||
- canAfford(): A function returning a bool to determine if you can buy one of the buyables.
|
||||
|
||||
- buy(): A function that implements buying one of the buyable.
|
||||
- buy(): A function that implements buying one of the buyable, including spending the currency.
|
||||
|
||||
- buyMax(): **optional**, A function that implements buying as many of the buyable as possible.
|
||||
|
||||
- style: **Optional**, A CSS object, which affects this buyable.
|
||||
|
||||
- style: **Optional**, Applies CSS to this buyable, in the form of an object where the keys are CSS attributes,
|
||||
and the values are the values for those attributes (both as strings)
|
||||
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
||||
|
||||
- id: **Assigned automagically**. It's the id for this buyable.
|
||||
- id: **Assigned automagically**. It's the "key" which the buyable was stored under, for convenient access.
|
||||
The buyable in the example's id is 11.
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
Useful functions for dealing with Challenges and implementing their effects:
|
||||
|
||||
- inChall(layer, id): determine if the player is in a given challenge (or another challenge on the same layer that counts as this one)
|
||||
- hasChall(layer, id): determine if the player has completed the challenge
|
||||
- challCompletions(layer, id): determine if the player has completed the challenge
|
||||
- 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
|
||||
- challengeCompletions(layer, id): determine how many times the player completed the challenge
|
||||
- challEffect(layer, id): Returns the current effects of the challenge, if any
|
||||
|
||||
|
||||
Challenges are stored in the following format:
|
||||
|
||||
```js
|
||||
challs: {
|
||||
challenges: {
|
||||
rows: # of rows
|
||||
cols: # of columns
|
||||
11: {
|
||||
|
@ -27,22 +27,22 @@ Individual Challenges can have these features:
|
|||
|
||||
- name: Name of the challenge, can be a string or a function. Can use basic HTML.
|
||||
|
||||
- desc: A description of what makes the challenge a challenge. *You will need to implement these elsewhere*
|
||||
- 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.
|
||||
|
||||
- reward: A description of the reward's effect. *You will also have to implement the effect where it is applied.*
|
||||
- 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.
|
||||
|
||||
- effect(): **optional**, A function that calculates and returns the current values of any bonuses from the reward.
|
||||
- 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.
|
||||
|
||||
- effectDisplay(): **optional**, A function that returns a display of the current effects of the reward with
|
||||
- rewardDisplay(): **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 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.
|
||||
|
||||
- unl(): A function returning a bool to determine if the challenge is visible or not.
|
||||
- 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.
|
||||
|
||||
|
@ -57,8 +57,10 @@ By default, challenges use basic Points for the goal. You can change that using
|
|||
|
||||
- completionLimit: **optional**, the amount of times you can complete this challenge. Default is 1 completion.
|
||||
|
||||
- style: **Optional**, A CSS object, which affects this challenge.
|
||||
- style: **Optional**, Applies CSS to this challenge, in the form of an object where the keys are CSS attributes,
|
||||
and the values are the values for those attributes (both as strings)
|
||||
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
||||
|
||||
- id: **Assigned automagically**. It's the id for this challenge.
|
||||
- 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.
|
|
@ -38,14 +38,16 @@ Features:
|
|||
- display(): A function returning everything that should be displayed on the clickable after the title, likely
|
||||
changing based on its state. Can use basic HTML.
|
||||
|
||||
- unl(): A function returning a bool to determine if the clickable is visible or not.
|
||||
- unlocked(): **optional**, A function returning a bool to determine if the clickable is visible or not. Default is unlocked.
|
||||
|
||||
- canClick(): A function returning a bool to determine if you can click the clickable.
|
||||
|
||||
- onClick(): A function that implements clicking one of the clickable.
|
||||
|
||||
- style: **Optional**, A CSS object, which affects this clickable.
|
||||
- style: **Optional**, Applies CSS to this clickable, in the form of an object where the keys are CSS attributes,
|
||||
and the values are the values for those attributes (both as strings)
|
||||
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar.
|
||||
|
||||
- id: **Assigned automagically**. It's the id for this clickable.
|
||||
- id: **Assigned automagically**. It's the "key" which the clickable was stored under, for convenient access.
|
||||
The clickable in the example's id is 11.
|
|
@ -17,8 +17,9 @@ Custom tab layouts can be used to do basically anything in a tab window, especia
|
|||
"milestones", "blank", "blank", "upgrades"]
|
||||
```
|
||||
|
||||
It is a list of components, which can be either just a name, or an array with arguments. If it's an array, the first item is the name of the component, the second is the data passed into it, and the third (optional) is a CSS object,
|
||||
which applies its style to the component.
|
||||
It is a list of components, which can be either just a name, or an array with arguments. If it's an array,
|
||||
the first item is the name of the component, the second is the data passed into it, and the third (optional)
|
||||
applies a CSS style to it with a "CSS object", where the keys are CSS attributes.
|
||||
|
||||
These are the existing components, but you can create more in v.js:
|
||||
|
||||
|
@ -43,6 +44,8 @@ These are the existing components, but you can create more in v.js:
|
|||
- upgrade, milestone, chall, buyable: An individual upgrade, challenge, etc. The argument is the id.
|
||||
This can be used if you want to have upgrades split up across multiple subtabs, for example.
|
||||
|
||||
- bar: Display a bar. The argument is the id of the bar to display.
|
||||
|
||||
- toggle: A toggle button that toggles a bool value. The data is a pair that identifies what bool to toggle, [layer, id]
|
||||
|
||||
- row: Display a list of components horizontally. The argument is an array of components in the tab layout format.
|
||||
|
|
|
@ -21,7 +21,7 @@ Key:
|
|||
Any nonstandard Decimal variables need to be added to convertToDecimal as well.
|
||||
Standard values:
|
||||
Required:
|
||||
unl: a bool determining if this layer is unlocked or not
|
||||
unlocked: a bool determining if this layer is unlocked or not
|
||||
points: a Decimal, the main currency for the layer
|
||||
Optional:
|
||||
total: A Decimal, tracks total amount of main prestige currency
|
||||
|
@ -49,11 +49,12 @@ Key:
|
|||
hotkeys: [
|
||||
{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
|
||||
onPress(){if (player.p.unl) doReset("p")}}, // This function is called when the hotkey is pressed.
|
||||
onPress(){if (player.p.unlocked) doReset("p")}}, // This function is called when the hotkey is pressed.
|
||||
],
|
||||
```
|
||||
|
||||
- style: **optional**, a CSS object containing any CSS that should affect this layer's whole tab.
|
||||
- style: **optional**, a "CSS object" where the keys are CSS attributes ,containing any CSS that should affect this
|
||||
layer's entire tab.
|
||||
|
||||
- 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)
|
||||
|
||||
|
@ -73,12 +74,17 @@ Key:
|
|||
they recieve a bonus.
|
||||
[Explanations are in a separate file.](challenges.md)
|
||||
|
||||
- buyables: Effectively upgrades that can be bought multiple times, and are optionally respeccable.
|
||||
- buyables: Effectively upgrades that can be bought multiple times, and are optionally respeccable. Many uses.
|
||||
[Explanations are in a separate file.](buyables.md)
|
||||
|
||||
- clickables: Extremely versatile and generalized buttons which can only be clicked sometimes.
|
||||
[Explanations are in a separate file.](clickables.md)
|
||||
|
||||
- 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)
|
||||
|
||||
- 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)
|
||||
|
||||
# Prestige formula features
|
||||
|
||||
|
@ -101,7 +107,7 @@ Key:
|
|||
|
||||
- base: **sometimes required**, required for "static" layers, used as described above.
|
||||
|
||||
- resCeil: **optional**, a bool, which is true if the resource cost needs to be rounded up.
|
||||
- roundUpCost: **optional**, a bool, which is true if the resource cost needs to be rounded up.
|
||||
(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.
|
||||
|
@ -130,7 +136,7 @@ Key:
|
|||
in the list. Alternatively, an entry in the array can be a pair consisting of the layer id and a color
|
||||
value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors)
|
||||
|
||||
- nodeStyle: **optional**, a CSS object, styles this layer's node on the tree
|
||||
- nodeStyle: **optional**, a CSS object, where the keys are CSS attributes, which styles this layer's node on the tree
|
||||
|
||||
- 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.
|
||||
|
@ -164,7 +170,7 @@ Key:
|
|||
|
||||
```js
|
||||
componentStyles: {
|
||||
"chall"() {return {'height': '200px'}},
|
||||
"challenges"() {return {'height': '200px'}},
|
||||
"prestige-button"() {return {'color': '#AA66AA'}},
|
||||
},
|
||||
```
|
||||
|
|
|
@ -31,10 +31,13 @@ Milestone features:
|
|||
|
||||
**Tip:** Toggles are not de-set if the milestone becomes locked! In this case, you should also check if the player has the milestone.
|
||||
|
||||
- style: **Optional**, A CSS object, which affects this milestone.
|
||||
- style: **Optional**, Applies CSS to this milestone, in the form of an object where the keys are CSS attributes,
|
||||
and the values are the values for those attributes (both as strings)
|
||||
|
||||
- unl(): A function returning a boolean to determine if the milestone should be shown. If absent, it is always shown.
|
||||
- unlocked(): **Optional** A function returning a boolean to determine if the milestone should be shown.
|
||||
If absent, it is always shown.
|
||||
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
||||
|
||||
- id: **Assigned automagically**. It's the id for this milestone.
|
||||
- id: **Assigned automagically**. It's the "key" which the milestone was stored under, for convenient access.
|
||||
The milestone in the example's id is 0.
|
|
@ -44,9 +44,11 @@ Normal subtabs and microtab subtabs both use the same features:
|
|||
|
||||
- content: The tab layout code for the subtab, in [the tab layout format](custom-tab-layouts.md)
|
||||
|
||||
- style: **Optional**, A CSS object, which affects the CSS when in that subtab.
|
||||
- style: **Optional**, Applies CSS to the whole subtab when switched to, in the form of an "CSS Object",
|
||||
where the keys are CSS attributes, and the values are the values for those attributes (both as strings)
|
||||
|
||||
- buttonStyle: **Optional**, A CSS object, which affects the appearance of the button for that subtab.
|
||||
|
||||
- unl(): **Optional**, a function to determine if the button for this subtab should be visible. By default, a subtab is always unlocked.
|
||||
- unlocked(): **Optional**, a function to determine if the button for this subtab should be visible.
|
||||
By default, a subtab is always unlocked.
|
||||
(You can't use the "this" keyword in this function.)
|
|
@ -4,8 +4,8 @@ Upgrades are stored in the following format:
|
|||
|
||||
Useful functions for dealing with Upgrades and implementing their effects:
|
||||
|
||||
- hasUpg(layer, id): determine if the player has the upgrade
|
||||
- upgEffect(layer, id): Returns the current effects of the upgrade, if any
|
||||
- hasUpgrade(layer, id): determine if the player has the upgrade
|
||||
- upgradeEffect(layer, id): Returns the current effects of the upgrade, if any
|
||||
|
||||
Hint: Basic point gain is calculated in game.js's "getPointGain".
|
||||
|
||||
|
@ -28,7 +28,7 @@ Individual upgrades can have these features:
|
|||
- title: **optional**, displayed at the top in a larger font
|
||||
It can also be a function that returns updating text. Can use basic HTML.
|
||||
|
||||
- desc: A description of the upgrade's effect. *You will also have to implement the effect where it is applied.*
|
||||
- description: A description of the upgrade'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.
|
||||
|
||||
- effect(): **optional**, A function that calculates and returns the current values of any bonuses from the upgrade.
|
||||
|
@ -39,7 +39,7 @@ Individual upgrades can have these features:
|
|||
|
||||
- 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 visible or not.
|
||||
- unlocked(): **optional**, A function returning a bool to determine if the upgrade is visible or not. Default is unlocked.
|
||||
|
||||
- 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".
|
||||
|
@ -50,8 +50,10 @@ By default, upgrades use the main prestige currency for the layer. You can inclu
|
|||
- currencyLayer: **optional**, the internal name of the layer that currency is stored in.
|
||||
If it's not in a layer (like Points), omit.
|
||||
|
||||
- style: **Optional**, A a CSS object, which affects this upgrade.
|
||||
- style: **Optional**, Applies CSS to this upgrade, in the form of an object where the keys are CSS attributes,
|
||||
and the values are the values for those attributes (both as strings)
|
||||
|
||||
- layer: **Assigned automagically**. It's the same value as the name of this layer, so you can do player[this.layer].points or similar
|
||||
|
||||
- id: **Assigned automagically**. It's the id for this upgrade.
|
||||
- id: **Assigned automagically**. It's the "key" which the upgrade was stored under, for convenient access.
|
||||
The upgrade in the example's id is 11.
|
|
@ -63,7 +63,7 @@
|
|||
<br><br>
|
||||
Time Played: {{ formatTime(player.timePlayed) }}<br><br>
|
||||
<h3>Hotkeys</h3><br>
|
||||
<span v-for="key in hotkeys" v-if="player[key.layer].unl"><br>{{key.desc}}</span>
|
||||
<span v-for="key in hotkeys" v-if="player[key.layer].unl"><br>{{key.description}}</span>
|
||||
</div>
|
||||
<div v-if="player.tab=='options'" class="col right">
|
||||
<button class="back" onclick="showTab('tree')">←</button><br>
|
||||
|
@ -84,7 +84,7 @@
|
|||
<td><button class="opt" onclick="toggleOpt('hqTree')">High-Quality Tree: {{ player.hqTree?"ON":"OFF" }}</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button class="opt" onclick="toggleOpt('hideChalls')">Completed Challenges: {{ player.hideChalls?"HIDDEN":"SHOWN" }}</button></td>
|
||||
<td><button class="opt" onclick="toggleOpt('hideChallengess')">Completed Challenges: {{ player.hideChallenges?"HIDDEN":"SHOWN" }}</button></td>
|
||||
<!-- <td><button class="opt" onclick="toggleOpt('oldStyle')">Style: {{ player.oldStyle?"v1.0":"NEW" }}</button></td>-->
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -134,7 +134,7 @@
|
|||
<clickables v-bind:style="tmp[layer].componentStyles['clickables']" :layer="layer"></clickables>
|
||||
<buyables v-bind:style="tmp[layer].componentStyles.buyables" :layer="layer"></buyables>
|
||||
<upgrades v-bind:style="tmp[layer].componentStyles['upgrades']" :layer="layer"></upgrades>
|
||||
<challs v-bind:style="tmp[layer].componentStyles['challs']" :layer="layer"></challs>
|
||||
<challenges v-bind:style="tmp[layer].componentStyles['challenges']" :layer="layer"></challenges>
|
||||
<br><br>
|
||||
</div>
|
||||
<div v-if="layers[layer].tabFormat">
|
||||
|
|
60
js/game.js
60
js/game.js
|
@ -23,7 +23,7 @@ let VERSION = {
|
|||
|
||||
// Determines if it should show points/sec
|
||||
function canGenPoints(){
|
||||
return hasUpg("c", 11)
|
||||
return hasUpgrade("c", 11)
|
||||
}
|
||||
|
||||
// Calculate points/sec!
|
||||
|
@ -32,7 +32,7 @@ function getPointGen() {
|
|||
return new Decimal(0)
|
||||
|
||||
let gain = new Decimal(1)
|
||||
if (hasUpg("c", 12)) gain = gain.times(upgEffect("c", 12))
|
||||
if (hasUpgrade("c", 12)) gain = gain.times(upgradeEffect("c", 12))
|
||||
return gain
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,13 @@ function getNextAt(layer, canMax=false, useType = null) {
|
|||
let amt = player[layer].points.plus((canMax&&tmp[layer].baseAmount.gte(tmp[layer].nextAt))?tmp[layer].resetGain:0)
|
||||
let extraCost = Decimal.pow(layers[layer].base, amt.pow(tmp[layer].exponent).div(tmp[layer].gainExp)).times(tmp[layer].gainMult)
|
||||
let cost = extraCost.times(tmp[layer].requires).max(tmp[layer].requires)
|
||||
if (layers[layer].resCeil) cost = cost.ceil()
|
||||
if (layers[layer].roundUpCost) cost = cost.ceil()
|
||||
return cost;
|
||||
} else if (type=="normal"){
|
||||
let next = tmp[layer].resetGain.add(1)
|
||||
if (next.gte("e1e7")) next = next.div("e5e6").pow(2)
|
||||
next = next.root(tmp[layer].gainExp).div(tmp[layer].gainMult).root(tmp[layer].exponent).times(tmp[layer].requires).max(tmp[layer].requires)
|
||||
if (layers[layer].resCeil) next = next.ceil()
|
||||
if (layers[layer].roundUpCost) next = next.ceil()
|
||||
return next;
|
||||
} else if (type=="custom"){
|
||||
return layers[layer].getNextAt(canMax)
|
||||
|
@ -90,7 +90,7 @@ function getNextAt(layer, canMax=false, useType = null) {
|
|||
function shouldNotify(layer){
|
||||
for (id in layers[layer].upgrades){
|
||||
if (!isNaN(id)){
|
||||
if (canAffordUpg(layer, id) && !hasUpg(layer, id) && tmp[layer].upgrades[id].unl){
|
||||
if (canAffordUpgrade(layer, id) && !hasUpgrade(layer, id) && tmp[layer].upgrades[id].unlocked){
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ function fullLayerReset(layer) {
|
|||
player[layer] = layers[layer].startData();
|
||||
player[layer].upgrades = []
|
||||
player[layer].milestones = []
|
||||
player[layer].challs = []
|
||||
player[layer].challenges = []
|
||||
if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)) {
|
||||
if (player.subtabs[layer] == undefined) player.subtabs[layer] = {}
|
||||
if (player.subtabs[layer].mainTabs == undefined) player.subtabs[layer].mainTabs = Object.keys(layers[layer].tabFormat)[0]
|
||||
|
@ -180,14 +180,14 @@ function doReset(layer, force=false) {
|
|||
addPoints(layer, gain)
|
||||
updateMilestones(layer)
|
||||
|
||||
if (!player[layer].unl) {
|
||||
player[layer].unl = true;
|
||||
if (!player[layer].unlocked) {
|
||||
player[layer].unlocked = true;
|
||||
needCanvasUpdate = true;
|
||||
|
||||
if (layers[layer].incr_order){
|
||||
lrs = layers[layer].incr_order
|
||||
for (lr in lrs)
|
||||
if (!player[lrs[lr]].unl) player[lrs[lr]].order++
|
||||
if (!player[lrs[lr]].unlocked) player[lrs[lr]].order++
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ function doReset(layer, force=false) {
|
|||
|
||||
|
||||
for (layerResetting in layers) {
|
||||
if (row >= layers[layerResetting].row && (!force || layerResetting != layer)) completeChall(layerResetting)
|
||||
if (row >= layers[layerResetting].row && (!force || layerResetting != layer)) completeChallenge(layerResetting)
|
||||
}
|
||||
|
||||
prevOnReset = {...player} //Deep Copy
|
||||
|
@ -219,7 +219,7 @@ function resetRow(row) {
|
|||
rowReset(row+1, post_layers[0])
|
||||
doReset(pre_layers[0], true)
|
||||
for (let layer in layers) {
|
||||
player[layers[layer]].unl = false
|
||||
player[layers[layer]].unlocked = false
|
||||
if (player[layers[layer]].order) player[layers[layer]].order = 0
|
||||
}
|
||||
player.points = new Decimal(10)
|
||||
|
@ -227,11 +227,11 @@ function resetRow(row) {
|
|||
resizeCanvas();
|
||||
}
|
||||
|
||||
function startChall(layer, x) {
|
||||
function startChallenge(layer, x) {
|
||||
let enter = false
|
||||
if (!player[layer].unl) return
|
||||
if (!player[layer].unlocked) return
|
||||
if (player[layer].active == x) {
|
||||
completeChall(layer, x)
|
||||
completeChallenge(layer, x)
|
||||
delete player[layer].active
|
||||
} else {
|
||||
enter = true
|
||||
|
@ -239,45 +239,45 @@ function startChall(layer, x) {
|
|||
doReset(layer, true)
|
||||
if(enter) player[layer].active = x
|
||||
|
||||
updateChallTemp(layer)
|
||||
updateChallengeTemp(layer)
|
||||
}
|
||||
|
||||
function canCompleteChall(layer, x)
|
||||
function canCompleteChallenge(layer, x)
|
||||
{
|
||||
if (x != player[layer].active) return
|
||||
|
||||
let chall = layers[layer].challs[x]
|
||||
let challenge = layers[layer].challenges[x]
|
||||
|
||||
if (chall.currencyInternalName){
|
||||
let name = chall.currencyInternalName
|
||||
if (chall.currencyLayer){
|
||||
let lr = chall.currencyLayer
|
||||
return !(player[lr][name].lt(readData(chall.goal)))
|
||||
if (challenge.currencyInternalName){
|
||||
let name = challenge.currencyInternalName
|
||||
if (challenge.currencyLayer){
|
||||
let lr = challenge.currencyLayer
|
||||
return !(player[lr][name].lt(readData(challenge.goal)))
|
||||
}
|
||||
else {
|
||||
return !(player[name].lt(chall.cost))
|
||||
return !(player[name].lt(challenge.cost))
|
||||
}
|
||||
}
|
||||
else {
|
||||
return !(player[layer].points.lt(chall.cost))
|
||||
return !(player[layer].points.lt(challenge.cost))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function completeChall(layer, x) {
|
||||
function completeChallenge(layer, x) {
|
||||
var x = player[layer].active
|
||||
if (!x) return
|
||||
if (! canCompleteChall(layer, x)){
|
||||
if (! canCompleteChallenge(layer, x)){
|
||||
delete player[layer].active
|
||||
return
|
||||
}
|
||||
if (player[layer].challs[x] < tmp[layer].challs[x].completionLimit) {
|
||||
if (player[layer].challenges[x] < tmp[layer].challenges[x].completionLimit) {
|
||||
needCanvasUpdate = true
|
||||
player[layer].challs[x] += 1
|
||||
if (layers[layer].challs[x].onComplete) layers[layer].challs[x].onComplete()
|
||||
player[layer].challenges[x] += 1
|
||||
if (layers[layer].challenges[x].onComplete) layers[layer].challenges[x].onComplete()
|
||||
}
|
||||
delete player[layer].active
|
||||
updateChallTemp(layer)
|
||||
updateChallengeTemp(layer)
|
||||
}
|
||||
|
||||
VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSION.pre : VERSION.pre ? " Beta " + VERSION.beta : "")
|
||||
|
|
|
@ -36,8 +36,8 @@ function updateLayers(){
|
|||
if (!isNaN(thing)){
|
||||
layers[layer].upgrades[thing].id = thing
|
||||
layers[layer].upgrades[thing].layer = layer
|
||||
if (layers[layer].upgrades[thing].unl === undefined)
|
||||
layers[layer].upgrades[thing].unl = true
|
||||
if (layers[layer].upgrades[thing].unlocked === undefined)
|
||||
layers[layer].upgrades[thing].unlocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,20 +46,20 @@ function updateLayers(){
|
|||
if (!isNaN(thing)){
|
||||
layers[layer].milestones[thing].id = thing
|
||||
layers[layer].milestones[thing].layer = layer
|
||||
if (layers[layer].milestones[thing].unl === undefined)
|
||||
layers[layer].milestones[thing].unl = true
|
||||
if (layers[layer].milestones[thing].unlocked === undefined)
|
||||
layers[layer].milestones[thing].unlocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (layers[layer].challs){
|
||||
for (thing in layers[layer].challs){
|
||||
if (layers[layer].challenges){
|
||||
for (thing in layers[layer].challenges){
|
||||
if (!isNaN(thing)){
|
||||
layers[layer].challs[thing].id = thing
|
||||
layers[layer].challs[thing].layer = layer
|
||||
if (layers[layer].challs[thing].unl === undefined)
|
||||
layers[layer].challs[thing].unl = true
|
||||
if (layers[layer].challs[thing].completionLimit === undefined)
|
||||
layers[layer].challs[thing].completionLimit = 1
|
||||
layers[layer].challenges[thing].id = thing
|
||||
layers[layer].challenges[thing].layer = layer
|
||||
if (layers[layer].challenges[thing].unlocked === undefined)
|
||||
layers[layer].challenges[thing].unlocked = true
|
||||
if (layers[layer].challenges[thing].completionLimit === undefined)
|
||||
layers[layer].challenges[thing].completionLimit = 1
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ function updateLayers(){
|
|||
if (!isNaN(thing)){
|
||||
layers[layer].buyables[thing].id = thing
|
||||
layers[layer].buyables[thing].layer = layer
|
||||
if (layers[layer].buyables[thing].unl === undefined)
|
||||
layers[layer].buyables[thing].unl = true
|
||||
if (layers[layer].buyables[thing].unlocked === undefined)
|
||||
layers[layer].buyables[thing].unlocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ function updateLayers(){
|
|||
if (!isNaN(thing)){
|
||||
layers[layer].clickables[thing].id = thing
|
||||
layers[layer].clickables[thing].layer = layer
|
||||
if (layers[layer].clickables[thing].unl === undefined)
|
||||
layers[layer].clickables[thing].unl = true
|
||||
if (layers[layer].clickables[thing].unlocked === undefined)
|
||||
layers[layer].clickables[thing].unlocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ function updateLayers(){
|
|||
if (!isNaN(thing)){
|
||||
layers[layer].bars[thing].id = thing
|
||||
layers[layer].bars[thing].layer = layer
|
||||
if (layers[layer].bars[thing].unl === undefined)
|
||||
layers[layer].bars[thing].unl = true
|
||||
if (layers[layer].bars[thing].unlocked === undefined)
|
||||
layers[layer].bars[thing].unlocked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ function readData(data, args=null){
|
|||
|
||||
function someLayerUnlocked(row){
|
||||
for (layer in ROW_LAYERS[row])
|
||||
if (player[layer].unl)
|
||||
if (player[layer].unlocked)
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
|
88
js/layers.js
88
js/layers.js
|
@ -4,7 +4,7 @@ addLayer("c", {
|
|||
symbol: "C", // This appears on the layer's node. Default is the id with the first letter capitalized
|
||||
position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
|
||||
startData() { return {
|
||||
unl: true,
|
||||
unlocked: true,
|
||||
points: new Decimal(0),
|
||||
best: new Decimal(0),
|
||||
total: new Decimal(0),
|
||||
|
@ -19,12 +19,12 @@ addLayer("c", {
|
|||
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
|
||||
exponent: 0.5, // Prestige currency exponent
|
||||
base: 5, // Only needed for static layers, base of the formula (b^(x^exp))
|
||||
resCeil: false, // True if the cost needs to be rounded up (use when baseResource is static?)
|
||||
roundUpCost: false, // True if the cost needs to be rounded up (use when baseResource is static?)
|
||||
canBuyMax() {}, // Only needed for static layers with buy max
|
||||
gainMult() { // Calculate the multiplier for main currency from bonuses
|
||||
mult = new Decimal(1)
|
||||
if (hasUpg(this.layer, 166)) mult = mult.times(2) // These upgrades don't exist
|
||||
if (hasUpg(this.layer, 120)) mult = mult.times(upgEffect(this.layer, 120))
|
||||
if (hasUpgrade(this.layer, 166)) mult = mult.times(2) // These upgrades don't exist
|
||||
if (hasUpgrade(this.layer, 120)) mult = mult.times(upgradeEffect(this.layer, 120))
|
||||
return mult
|
||||
},
|
||||
gainExp() { // Calculate the exponent on main currency from bonuses
|
||||
|
@ -42,14 +42,14 @@ addLayer("c", {
|
|||
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
||||
},
|
||||
milestones: {
|
||||
0: {requirementDesc:() => "3 Lollipops",
|
||||
0: {requirementDescription:() => "3 Lollipops",
|
||||
done() {return player[this.layer].best.gte(3)}, // Used to determine when to give the milestone
|
||||
effectDesc:() => "Unlock the next milestone",
|
||||
effectDescription:() => "Unlock the next milestone",
|
||||
},
|
||||
1: {requirementDesc:() => "4 Lollipops",
|
||||
unl() {return hasMilestone(this.layer, 0)},
|
||||
1: {requirementDescription:() => "4 Lollipops",
|
||||
unlocked() {return hasMilestone(this.layer, 0)},
|
||||
done() {return player[this.layer].best.gte(4)},
|
||||
effectDesc:() => "You can toggle beep and boop (which do nothing)",
|
||||
effectDescription:() => "You can toggle beep and boop (which do nothing)",
|
||||
toggles: [
|
||||
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
|
||||
["f", "boop"]],
|
||||
|
@ -60,25 +60,25 @@ addLayer("c", {
|
|||
|
||||
},
|
||||
},
|
||||
challs: {
|
||||
challenges: {
|
||||
rows: 2,
|
||||
cols: 12,
|
||||
11: {
|
||||
name:() => "Fun",
|
||||
completionLimit: 3,
|
||||
desc() {return "Makes the game 0% harder<br>"+challCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"},
|
||||
unl() { return player[this.layer].best.gt(0) },
|
||||
challengeDescription() {return "Makes the game 0% harder<br>"+challengeCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"},
|
||||
unlocked() { return player[this.layer].best.gt(0) },
|
||||
goal:() => new Decimal("20"),
|
||||
currencyDisplayName: "lollipops", // Use if using a nonstandard currency
|
||||
currencyInternalName: "points", // Use if using a nonstandard currency
|
||||
currencyLayer: this.layer, // Leave empty if not in a layer
|
||||
effect() {
|
||||
rewardEffect() {
|
||||
let ret = player[this.layer].points.add(1).tetrate(0.02)
|
||||
return ret;
|
||||
},
|
||||
effectDisplay(x) { return format(x)+"x" },
|
||||
rewardDisplay() { return format(this.rewardEffect())+"x" },
|
||||
countsAs: [12, 21], // Use this for if a challenge includes the effects of other challenges. Being in this challenge "counts as" being in these.
|
||||
reward:() => "Says hi",
|
||||
rewardDescription: "Says hi",
|
||||
onComplete() {console.log("hiii")} // Called when you complete the challenge
|
||||
},
|
||||
},
|
||||
|
@ -87,14 +87,14 @@ addLayer("c", {
|
|||
cols: 3,
|
||||
11: {
|
||||
title:() => "Generator of Genericness",
|
||||
desc:() => "Gain 1 Point every second.",
|
||||
description:() => "Gain 1 Point every second.",
|
||||
cost:() => new Decimal(1),
|
||||
unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true
|
||||
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
||||
},
|
||||
12: {
|
||||
desc:() => "Candy generation is faster based on your unspent Lollipops.",
|
||||
description:() => "Candy generation is faster based on your unspent Lollipops.",
|
||||
cost:() => new Decimal(1),
|
||||
unl() { return (hasUpg(this.layer, 11))},
|
||||
unlocked() { return (hasUpgrade(this.layer, 11))},
|
||||
effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values
|
||||
let ret = player[this.layer].points.add(1).pow(player[this.layer].upgrades.includes(24)?1.1:(player[this.layer].upgrades.includes(14)?0.75:0.5))
|
||||
if (ret.gte("1e20000000")) ret = ret.sqrt().times("1e10000000")
|
||||
|
@ -103,20 +103,20 @@ addLayer("c", {
|
|||
effectDisplay() { return format(this.effect())+"x" }, // Add formatting to the effect
|
||||
},
|
||||
13: {
|
||||
desc:() => "Unlock a <b>secret subtab</b> and make this layer act if you unlocked it first.",
|
||||
description:() => "Unlock a <b>secret subtab</b> and make this layer act if you unlocked it first.",
|
||||
cost:() => new Decimal(69),
|
||||
currencyDisplayName: "candies", // Use if using a nonstandard currency
|
||||
currencyInternalName: "points", // Use if using a nonstandard currency
|
||||
currencyLayer: "", // Leave empty if not in a layer "e.g. points"
|
||||
unl() { return (hasUpg(this.layer, 12))},
|
||||
unlocked() { return (hasUpgrade(this.layer, 12))},
|
||||
onPurchase() { // This function triggers when the upgrade is purchased
|
||||
player[this.layer].order = 0
|
||||
},
|
||||
style() {
|
||||
if (hasUpg(this.layer, this.id)) return {
|
||||
if (hasUpgrade(this.layer, this.id)) return {
|
||||
'background-color': '#1111dd'
|
||||
}
|
||||
else if (!canAffordUpg(this.layer, this.id)) {
|
||||
else if (!canAffordUpgrade(this.layer, this.id)) {
|
||||
return {
|
||||
'background-color': '#dd1111'
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ addLayer("c", {
|
|||
},
|
||||
22: {
|
||||
title:() => "This upgrade doesn't exist",
|
||||
desc:() => "Or does it?.",
|
||||
cost:() => new Decimal(1),
|
||||
unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true
|
||||
description:() => "Or does it?.",
|
||||
cost:() => new Decimal(3),
|
||||
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
||||
},
|
||||
},
|
||||
buyables: {
|
||||
|
@ -161,7 +161,7 @@ addLayer("c", {
|
|||
Amount: " + player[this.layer].buyables[this.id] + "\n\
|
||||
Adds + " + format(data.effect.first) + " things and multiplies stuff by " + format(data.effect.second)
|
||||
},
|
||||
unl() { return player[this.layer].unl },
|
||||
unlocked() { return player[this.layer].unlocked },
|
||||
canAfford() {
|
||||
return player[this.layer].points.gte(tmp[this.layer].buyables[this.id].cost)},
|
||||
buy() {
|
||||
|
@ -186,8 +186,8 @@ addLayer("c", {
|
|||
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
|
||||
|
||||
hotkeys: [
|
||||
{key: "c", desc: "C: reset for lollipops or whatever", onPress(){if (player[this.layer].unl) doReset(this.layer)}},
|
||||
{key: "ctrl+c" + this.layer, desc: "Ctrl+c: respec things", onPress(){if (player[this.layer].unl) respecBuyables(this.layer)}},
|
||||
{key: "c", description: "C: reset for lollipops or whatever", onPress(){if (player[this.layer].unlocked) doReset(this.layer)}},
|
||||
{key: "ctrl+c" + this.layer, description: "Ctrl+c: respec things", onPress(){if (player[this.layer].unlocked) respecBuyables(this.layer)}},
|
||||
],
|
||||
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
|
||||
|
||||
|
@ -224,7 +224,7 @@ addLayer("c", {
|
|||
display() {
|
||||
return format(player.points) + " / 1e10 points"
|
||||
},
|
||||
unl:() => true,
|
||||
unlocked:() => true,
|
||||
|
||||
},
|
||||
tallBoi: {
|
||||
|
@ -242,7 +242,7 @@ addLayer("c", {
|
|||
display() {
|
||||
return formatWhole((player.points.div(1)).min(100)) + "%"
|
||||
},
|
||||
unl:() => true,
|
||||
unlocked:() => true,
|
||||
|
||||
},
|
||||
flatBoi: {
|
||||
|
@ -257,7 +257,7 @@ addLayer("c", {
|
|||
progress() {
|
||||
return player.c.points.div(50)
|
||||
},
|
||||
unl:() => true,
|
||||
unlocked:() => true,
|
||||
|
||||
},
|
||||
},
|
||||
|
@ -274,7 +274,7 @@ addLayer("c", {
|
|||
["display-text",
|
||||
function() {return 'I have ' + format(player.points) + ' pointy points!'},
|
||||
{"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}],
|
||||
"h-line", "milestones", "blank", "upgrades", "challs"],
|
||||
"h-line", "milestones", "blank", "upgrades", "challenges"],
|
||||
},
|
||||
thingies: {
|
||||
style() {return {'background-color': '#222222'}},
|
||||
|
@ -309,7 +309,7 @@ addLayer("c", {
|
|||
],
|
||||
},
|
||||
illuminati: {
|
||||
unl() {return (hasUpg("c", 13))},
|
||||
unlocked() {return (hasUpgrade("c", 13))},
|
||||
content:[
|
||||
["raw-html", function() {return "<h1> C O N F I R M E D </h1>"}], "blank",
|
||||
["microtabs", "stuff", {'width': '600px', 'height': '350px', 'background-color': 'brown', 'border-style': 'solid'}]
|
||||
|
@ -325,7 +325,7 @@ addLayer("c", {
|
|||
'text-decoration': 'underline'
|
||||
}},
|
||||
componentStyles: {
|
||||
"chall"() {return {'height': '200px'}},
|
||||
"challenge"() {return {'height': '200px'}},
|
||||
"prestige-button"() {return {'color': '#AA66AA'}},
|
||||
},
|
||||
tooltip() { // Optional, tooltip displays when the layer is unlocked
|
||||
|
@ -337,13 +337,13 @@ addLayer("c", {
|
|||
// Layer will automatically highlight if an upgrade is purchasable.
|
||||
return (player.c.buyables[11] == 1)
|
||||
},
|
||||
resetDesc: "Melt your points into ",
|
||||
resetDescription: "Melt your points into ",
|
||||
})
|
||||
|
||||
// This layer is mostly minimal but it uses a custom prestige type and a clickable
|
||||
addLayer("f", {
|
||||
startData() { return {
|
||||
unl: false,
|
||||
unlocked: false,
|
||||
points: new Decimal(0),
|
||||
boop: false,
|
||||
clickables: {[11]: "Start"} // Optional default Clickable state
|
||||
|
@ -356,7 +356,7 @@ addLayer("f", {
|
|||
type: "custom", // A "Custom" type which is effectively static
|
||||
exponent: 0.5,
|
||||
base: 3,
|
||||
resCeil: true,
|
||||
roundUpCost: true,
|
||||
canBuyMax:() => true,
|
||||
gainMult() {
|
||||
return new Decimal(1)
|
||||
|
@ -391,16 +391,6 @@ addLayer("f", {
|
|||
canReset() {
|
||||
return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt)
|
||||
},
|
||||
upgrades: {
|
||||
rows: 1,
|
||||
cols: 1,
|
||||
11: {
|
||||
title:() => "Generator",
|
||||
cost:() => new Decimal(1),
|
||||
desc:() => "Gain 1 point per second",
|
||||
}
|
||||
|
||||
},
|
||||
// This is also non minimal, a Clickable!
|
||||
clickables: {
|
||||
rows: 1,
|
||||
|
@ -416,7 +406,7 @@ addLayer("f", {
|
|||
let data = getClickableState(this.layer, this.id)
|
||||
return "Current state:<br>" + data
|
||||
},
|
||||
unl() { return player[this.layer].unl },
|
||||
unlocked() { return player[this.layer].unlocked },
|
||||
canClick() {
|
||||
return getClickableState(this.layer, this.id) !== "Borkened..."},
|
||||
onClick() {
|
||||
|
|
|
@ -81,9 +81,9 @@ function updateTempData(layerData, tmpData) {
|
|||
}
|
||||
}
|
||||
|
||||
function updateChallTemp(layer)
|
||||
function updateChallengeTemp(layer)
|
||||
{
|
||||
updateTempData(layers[layer].challs, tmp[layer].challs)
|
||||
updateTempData(layers[layer].challenges, tmp[layer].challenges)
|
||||
}
|
||||
|
||||
function updateBuyableTemp(layer)
|
||||
|
|
72
js/utils.js
72
js/utils.js
|
@ -78,7 +78,7 @@ function startPlayerBase() {
|
|||
timePlayed: 0,
|
||||
keepGoing: false,
|
||||
hasNaN: false,
|
||||
hideChalls: false,
|
||||
hideChallenges: false,
|
||||
points: new Decimal(10),
|
||||
subtabs: {},
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ function getStartPlayer() {
|
|||
playerdata[layer].spentOnBuyables = new Decimal(0)
|
||||
playerdata[layer].upgrades = []
|
||||
playerdata[layer].milestones = []
|
||||
playerdata[layer].challs = getStartChalls(layer)
|
||||
playerdata[layer].challenges = getStartChallenges(layer)
|
||||
if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)) {
|
||||
playerdata.subtabs[layer] = {}
|
||||
playerdata.subtabs[layer].mainTabs = Object.keys(layers[layer].tabFormat)[0]
|
||||
|
@ -128,10 +128,10 @@ function getStartClickables(layer){
|
|||
return data
|
||||
}
|
||||
|
||||
function getStartChalls(layer){
|
||||
function getStartChallenges(layer){
|
||||
let data = {}
|
||||
if (layers[layer].challs) {
|
||||
for (id in layers[layer].challs)
|
||||
if (layers[layer].challenges) {
|
||||
for (id in layers[layer].challenges)
|
||||
if (!isNaN(id))
|
||||
data[id] = 0
|
||||
}
|
||||
|
@ -354,13 +354,13 @@ function respecBuyables(layer) {
|
|||
updateBuyableTemp(layer)
|
||||
}
|
||||
|
||||
function canAffordUpg(layer, id) {
|
||||
function canAffordUpgrade(layer, id) {
|
||||
let upg = layers[layer].upgrades[id]
|
||||
let cost = tmp[layer].upgrades[id].cost
|
||||
return canAffordPurchase(layer, upg, cost)
|
||||
}
|
||||
|
||||
function hasUpg(layer, id){
|
||||
function hasUpgrade(layer, id){
|
||||
return (player[layer].upgrades.includes(toNumber(id)) || player[layer].upgrades.includes(id.toString()))
|
||||
}
|
||||
|
||||
|
@ -368,19 +368,19 @@ function hasMilestone(layer, id){
|
|||
return (player[layer].milestones.includes(toNumber(id)) || player[layer].milestones.includes(id.toString()))
|
||||
}
|
||||
|
||||
function hasChall(layer, id){
|
||||
return (player[layer].challs[id])
|
||||
function hasChallenge(layer, id){
|
||||
return (player[layer].challenges[id])
|
||||
}
|
||||
|
||||
function challCompletions(layer, id){
|
||||
return (player[layer].challs[id])
|
||||
function challengeCompletions(layer, id){
|
||||
return (player[layer].challenges[id])
|
||||
}
|
||||
|
||||
function getBuyableAmt(layer, id){
|
||||
function getBuyableAmount(layer, id){
|
||||
return (player[layer].buyables[id])
|
||||
}
|
||||
|
||||
function setBuyableAmt(layer, id, amt){
|
||||
function setBuyableAmount(layer, id, amt){
|
||||
player[layer].buyables[id] = amt
|
||||
}
|
||||
|
||||
|
@ -392,12 +392,12 @@ function setClickableState(layer, id, state){
|
|||
player[layer].clickables[id] = state
|
||||
}
|
||||
|
||||
function upgEffect(layer, id){
|
||||
function upgradeEffect(layer, id){
|
||||
return (tmp[layer].upgrades[id].effect)
|
||||
}
|
||||
|
||||
function challEffect(layer, id){
|
||||
return (tmp[layer].challs[id].effect)
|
||||
function challengeEffect(layer, id){
|
||||
return (tmp[layer].challenges[id].effect)
|
||||
}
|
||||
|
||||
function buyableEffect(layer, id){
|
||||
|
@ -422,8 +422,8 @@ function canAffordPurchase(layer, thing, cost) {
|
|||
}
|
||||
|
||||
function buyUpg(layer, id) {
|
||||
if (!player[layer].unl) return
|
||||
if (!layers[layer].upgrades[id].unl) return
|
||||
if (!player[layer].unlocked) return
|
||||
if (!layers[layer].upgrades[id].unlocked) return
|
||||
if (player[layer].upgrades.includes(id)) return
|
||||
let upg = layers[layer].upgrades[id]
|
||||
let cost = tmp[layer].upgrades[id].cost
|
||||
|
@ -450,8 +450,8 @@ function buyUpg(layer, id) {
|
|||
}
|
||||
|
||||
function buyMaxBuyable(layer, id) {
|
||||
if (!player[layer].unl) return
|
||||
if (!tmp[layer].buyables[id].unl) return
|
||||
if (!player[layer].unlocked) return
|
||||
if (!tmp[layer].buyables[id].unlocked) return
|
||||
if (!tmp[layer].buyables[id].canAfford) return
|
||||
if (!layers[layer].buyables[id].buyMax) return
|
||||
|
||||
|
@ -460,8 +460,8 @@ function buyMaxBuyable(layer, id) {
|
|||
}
|
||||
|
||||
function buyBuyable(layer, id) {
|
||||
if (!player[layer].unl) return
|
||||
if (!tmp[layer].buyables[id].unl) return
|
||||
if (!player[layer].unlocked) return
|
||||
if (!tmp[layer].buyables[id].unlocked) return
|
||||
if (!tmp[layer].buyables[id].canAfford) return
|
||||
|
||||
layers[layer].buyables[id].buy()
|
||||
|
@ -469,8 +469,8 @@ function buyBuyable(layer, id) {
|
|||
}
|
||||
|
||||
function clickClickable(layer, id) {
|
||||
if (!player[layer].unl) return
|
||||
if (!tmp[layer].clickables[id].unl) return
|
||||
if (!player[layer].unlocked) return
|
||||
if (!tmp[layer].clickables[id].unlocked) return
|
||||
if (!tmp[layer].clickables[id].canClick) return
|
||||
|
||||
layers[layer].clickables[id].onClick()
|
||||
|
@ -479,18 +479,18 @@ function clickClickable(layer, id) {
|
|||
|
||||
// Function to determine if the player is in a challenge
|
||||
function inChallenge(layer, id){
|
||||
let chall = player[layer].active
|
||||
if (chall==toNumber(id)) return true
|
||||
let challenge = player[layer].active
|
||||
if (challenge==toNumber(id)) return true
|
||||
|
||||
if (layers[layer].challs[chall].countsAs)
|
||||
return layers[layer].challs[id].countsAs.includes(id)
|
||||
if (layers[layer].challenges[challenge].countsAs)
|
||||
return layers[layer].challenges[id].countsAs.includes(id)
|
||||
}
|
||||
|
||||
// ************ Misc ************
|
||||
|
||||
var onTreeTab = true
|
||||
function showTab(name) {
|
||||
if (LAYERS.includes(name) && !layerUnl(name)) return
|
||||
if (LAYERS.includes(name) && !layerunlocked(name)) return
|
||||
|
||||
var toTreeTab = name == "tree"
|
||||
player.tab = name
|
||||
|
@ -504,7 +504,7 @@ function showTab(name) {
|
|||
}
|
||||
|
||||
function notifyLayer(name) {
|
||||
if (player.tab == name || !layerUnl(name)) return
|
||||
if (player.tab == name || !layerunlocked(name)) return
|
||||
player.notify[name] = 1
|
||||
}
|
||||
|
||||
|
@ -512,14 +512,14 @@ function nodeShown(layer) {
|
|||
if (tmp[layer].layerShown) return true
|
||||
switch(layer) {
|
||||
case "idk":
|
||||
return player.l.unl
|
||||
return player.l.unlocked
|
||||
break;
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function layerUnl(layer) {
|
||||
return LAYERS.includes(layer) && (player[layer].unl || (tmp[layer].baseAmount.gte(tmp[layer].requires) && layers[layer].layerShown()))
|
||||
function layerunlocked(layer) {
|
||||
return LAYERS.includes(layer) && (player[layer].unlocked || (tmp[layer].baseAmount.gte(tmp[layer].requires) && layers[layer].layerShown()))
|
||||
}
|
||||
|
||||
function keepGoing() {
|
||||
|
@ -574,7 +574,7 @@ document.onkeydown = function(e) {
|
|||
if (onFocused) return
|
||||
if (ctrlDown && key != "-" && key != "_" && key != "+" && key != "=" && key != "r" && key != "R" && key != "F5") e.preventDefault()
|
||||
if(hotkeys[key]){
|
||||
if (player[hotkeys[key].layer].unl)
|
||||
if (player[hotkeys[key].layer].unlocked)
|
||||
hotkeys[key].onPress()
|
||||
}
|
||||
}
|
||||
|
@ -587,9 +587,9 @@ function focused(x) {
|
|||
function prestigeButtonText(layer)
|
||||
{
|
||||
if(tmp[layer].type == "normal")
|
||||
return `${ player[layer].points.lt(1e3) ? (tmp[layer].resetDesc !== undefined ? tmp[layer].resetDesc : "Reset for ") : ""}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `<br><br>Next at ${ (tmp[layer].resCeil ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))}` : ""} ${ tmp[layer].baseResource }`
|
||||
return `${ player[layer].points.lt(1e3) ? (tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for ") : ""}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `<br><br>Next at ${ (tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))}` : ""} ${ tmp[layer].baseResource }`
|
||||
else if(tmp[layer].type== "static")
|
||||
return `${tmp[layer].resetDesc !== undefined ? tmp[layer].resetDesc : "Reset for "}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource}<br><br>${player[layer].points.lt(20) ? (tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&(tmp[layer].canBuyMax !== undefined) && tmp[layer].canBuyMax?"Next":"Req") : ""}: ${formatWhole(tmp[layer].baseAmount)} / ${(tmp[layer].resCeil ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ tmp[layer].baseResource }
|
||||
return `${tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for "}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource}<br><br>${player[layer].points.lt(20) ? (tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&(tmp[layer].canBuyMax !== undefined) && tmp[layer].canBuyMax?"Next":"Req") : ""}: ${formatWhole(tmp[layer].baseAmount)} / ${(tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ tmp[layer].baseResource }
|
||||
`
|
||||
else
|
||||
return layers[layer].prestigeButtonText()
|
||||
|
|
70
js/v.js
70
js/v.js
|
@ -86,13 +86,13 @@ function loadVue() {
|
|||
`
|
||||
})
|
||||
|
||||
Vue.component('challs', {
|
||||
Vue.component('challenges', {
|
||||
props: ['layer'],
|
||||
template: `
|
||||
<div v-if="layers[layer].challs" class="upgTable">
|
||||
<div v-for="row in tmp[layer].challs.rows" class="upgRow">
|
||||
<div v-for="col in tmp[layer].challs.cols">
|
||||
<chall v-if="layers[layer].challs[row*10+col]!== undefined && tmp[layer].challs[row*10+col].unl" :layer = "layer" :data = "row*10+col" v-bind:style="tmp[layer].componentStyles.chall"></chall>
|
||||
<div v-if="layers[layer].challenges" class="upgTable">
|
||||
<div v-for="row in tmp[layer].challenges.rows" class="upgRow">
|
||||
<div v-for="col in tmp[layer].challenges.cols">
|
||||
<challenge v-if="layers[layer].challenges[row*10+col]!== undefined && tmp[layer].challenges[row*10+col].unlocked" :layer = "layer" :data = "row*10+col" v-bind:style="tmp[layer].componentStyles.challenge"></challenge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -100,16 +100,16 @@ function loadVue() {
|
|||
})
|
||||
|
||||
// data = id
|
||||
Vue.component('chall', {
|
||||
Vue.component('challenge', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<div v-if="layers[layer].challs && layers[layer].challs[data]!== undefined && tmp[layer].challs[data].unl && !(player.hideChalls && hasChall(layer, [data]))" v-bind:class="{hChall: true, done: hasChall(layer, data), canComplete: player[layer].active == data&&!hasChall(layer, data)&&canCompleteChall(layer, data)}">
|
||||
<br><h3 v-html="tmp[layer].challs[data].name"></h3><br><br>
|
||||
<button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': tmp[layer].color}" v-on:click="startChall(layer, data)">{{player[layer].active==(data)?(canCompleteChall(layer, data)?"Finish":"Exit Early"):(hasChall(layer, data)?"Completed":"Start")}}</button><br><br>
|
||||
<span v-html="tmp[layer].challs[data].desc"></span><br>
|
||||
Goal: {{format(tmp[layer].challs[data].goal)}} {{tmp[layer].challs[data].currencyDisplayName ? tmp[layer].challs[data].currencyDisplayName : "points"}}<br>
|
||||
Reward: <span v-html="tmp[layer].challs[data].reward"></span><br>
|
||||
<span v-if="tmp[layer].challs[data].effect!==undefined">Currently: <span v-html="(tmp[layer].challs[data].effectDisplay) ? (tmp[layer].challs[data].effectDisplay) : format(tmp[layer].challs[data].effect)"></span></span>
|
||||
<div v-if="layers[layer].challenges && layers[layer].challenges[data]!== undefined && tmp[layer].challenges[data].unlocked && !(player.hideChallenges && hasChallenge(layer, [data]))" v-bind:class="{hChallenge: true, done: hasChallenge(layer, data), canComplete: player[layer].active == data&&!hasChallenge(layer, data)&&canCompleteChallenge(layer, data)}">
|
||||
<br><h3 v-html="tmp[layer].challenges[data].name"></h3><br><br>
|
||||
<button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': tmp[layer].color}" v-on:click="startChallenge(layer, data)">{{player[layer].active==(data)?(canCompleteChallenge(layer, data)?"Finish":"Exit Early"):(hasChallenge(layer, data)?"Completed":"Start")}}</button><br><br>
|
||||
<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>
|
||||
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>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
@ -119,7 +119,7 @@ function loadVue() {
|
|||
template: `
|
||||
<div v-if="layers[layer].upgrades" class="upgTable">
|
||||
<div v-for="row in layers[layer].upgrades.rows" class="upgRow">
|
||||
<div v-for="col in layers[layer].upgrades.cols"><div v-if="layers[layer].upgrades[row*10+col]!== undefined && tmp[layer].upgrades[row*10+col].unl" class="upgAlign">
|
||||
<div v-for="col in layers[layer].upgrades.cols"><div v-if="layers[layer].upgrades[row*10+col]!== undefined && tmp[layer].upgrades[row*10+col].unlocked" class="upgAlign">
|
||||
<upgrade :layer = "layer" :data = "row*10+col" v-bind:style="tmp[layer].componentStyles.upgrade"></upgrade>
|
||||
</div></div>
|
||||
</div>
|
||||
|
@ -132,10 +132,10 @@ function loadVue() {
|
|||
Vue.component('upgrade', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<button v-if="layers[layer].upgrades && layers[layer].upgrades[data]!== undefined && tmp[layer].upgrades[data].unl" v-on:click="buyUpg(layer, data)" v-bind:class="{ [layer]: true, upg: true, bought: player[layer].upgrades.includes(data), locked: (!(canAffordUpg(layer, data))&&!player[layer].upgrades.includes(data)), can: (canAffordUpg(layer, data)&&!player[layer].upgrades.includes(data))}"
|
||||
v-bind:style="[((!hasUpg(layer, data) && canAffordUpg(layer, data)) ? {'background-color': tmp[layer].color} : {}), tmp[layer].upgrades[data].style]">
|
||||
<button v-if="layers[layer].upgrades && layers[layer].upgrades[data]!== undefined && tmp[layer].upgrades[data].unlocked" v-on:click="buyUpg(layer, data)" v-bind:class="{ [layer]: true, upg: true, bought: player[layer].upgrades.includes(data), locked: (!(canAffordUpgrade(layer, data))&&!player[layer].upgrades.includes(data)), can: (canAffordUpgrade(layer, data)&&!player[layer].upgrades.includes(data))}"
|
||||
v-bind:style="[((!hasUpgrade(layer, data) && canAffordUpgrade(layer, data)) ? {'background-color': tmp[layer].color} : {}), tmp[layer].upgrades[data].style]">
|
||||
<span v-if= "tmp[layer].upgrades[data].title"><h3 v-html="tmp[layer].upgrades[data].title"></h3><br></span>
|
||||
<span v-html="tmp[layer].upgrades[data].desc"></span>
|
||||
<span v-html="tmp[layer].upgrades[data].description"></span>
|
||||
<span v-if="tmp[layer].upgrades[data].effect"><br>Currently: <span v-html="(tmp[layer].upgrades[data].effectDisplay) ? (tmp[layer].upgrades[data].effectDisplay) : format(tmp[layer].upgrades[data].effect)"></span></span>
|
||||
<br><br>Cost: {{ formatWhole(tmp[layer].upgrades[data].cost) }} {{(layers[layer].upgrades[data].currencyDisplayName ? tmp[layer].upgrades[data].currencyDisplayName : tmp[layer].resource)}}
|
||||
</button>
|
||||
|
@ -147,7 +147,7 @@ function loadVue() {
|
|||
template: `
|
||||
<div v-if="layers[layer].milestones">
|
||||
<table>
|
||||
<tr v-for="id in Object.keys(tmp[layer].milestones)"><div v-if="layers[layer].milestones[id]!== undefined && tmp[layer].milestones[id].unl"
|
||||
<tr v-for="id in Object.keys(tmp[layer].milestones)"><div v-if="layers[layer].milestones[id]!== undefined && tmp[layer].milestones[id].unlocked"
|
||||
<milestone :layer = "layer" :data = "id" v-bind:style="tmp[layer].componentStyles.milestone"></milestone>
|
||||
</tr></div>
|
||||
</table>
|
||||
|
@ -160,9 +160,9 @@ function loadVue() {
|
|||
Vue.component('milestone', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<td v-if="layers[layer].milestones && layers[layer].milestones[data]!== undefined && milestoneShown(layer, data)" v-bind:style="[(!tmp[layer].milestones[data].unl) ? {'visibility': 'hidden'} : {}, tmp[layer].milestones[data].style]" v-bind:class="{milestone: !player[layer].milestones.includes(data), milestoneDone: player[layer].milestones.includes(data)}">
|
||||
<h3 v-html="tmp[layer].milestones[data].requirementDesc"></h3><br>
|
||||
<span v-html="tmp[layer].milestones[data].effectDesc"></span><br>
|
||||
<td v-if="layers[layer].milestones && layers[layer].milestones[data]!== undefined && milestoneShown(layer, data)" v-bind:style="[(!tmp[layer].milestones[data].unlocked) ? {'visibility': 'hidden'} : {}, tmp[layer].milestones[data].style]" v-bind:class="{milestone: !player[layer].milestones.includes(data), milestoneDone: player[layer].milestones.includes(data)}">
|
||||
<h3 v-html="tmp[layer].milestones[data].requirementDescription"></h3><br>
|
||||
<span v-html="tmp[layer].milestones[data].effectDescription"></span><br>
|
||||
<span v-if="(tmp[layer].milestones[data].toggles)&&(player[layer].milestones.includes(data))" v-for="toggle in tmp[layer].milestones[data].toggles"><toggle :layer= "layer" :data= "toggle" v-bind:style="tmp[layer].componentStyles.toggle"></toggle> </span></td></tr>
|
||||
`
|
||||
})
|
||||
|
@ -199,9 +199,9 @@ function loadVue() {
|
|||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<div v-if="layers[layer].buyables" class="upgTable">
|
||||
<button v-if="tmp[layer].buyables.respec" v-on:click="respecBuyables(layer)" v-bind:class="{ longUpg: true, can: player[layer].unl, locked: !player[layer].unl }">{{tmp[layer].buyables.respecText ? tmp[layer].buyables.respecText : "Respec"}}</button><br>
|
||||
<button v-if="tmp[layer].buyables.respec" v-on:click="respecBuyables(layer)" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].buyables.respecText ? tmp[layer].buyables.respecText : "Respec"}}</button><br>
|
||||
<div v-for="row in tmp[layer].buyables.rows" class="upgRow">
|
||||
<div v-for="col in tmp[layer].buyables.cols"><div v-if="layers[layer].buyables[row*10+col]!== undefined && tmp[layer].buyables[row*10+col].unl" class="upgAlign" v-bind:style="{'margin-left': '7px', 'margin-right': '7px', 'height': (data ? data : 'inherit'),}">
|
||||
<div v-for="col in tmp[layer].buyables.cols"><div v-if="layers[layer].buyables[row*10+col]!== undefined && tmp[layer].buyables[row*10+col].unlocked" class="upgAlign" v-bind:style="{'margin-left': '7px', 'margin-right': '7px', 'height': (data ? data : 'inherit'),}">
|
||||
<buyable :layer = "layer" :data = "row*10+col" :size = "data" v-bind:style="tmp[layer].componentStyles.buyable"></buyable>
|
||||
</div></div>
|
||||
<br>
|
||||
|
@ -215,7 +215,7 @@ function loadVue() {
|
|||
props: ['layer', 'data', 'size'],
|
||||
template: `
|
||||
<button
|
||||
v-if="layers[layer].buyables && layers[layer].buyables[data]!== undefined && tmp[layer].buyables[data].unl"
|
||||
v-if="layers[layer].buyables && layers[layer].buyables[data]!== undefined && tmp[layer].buyables[data].unlocked"
|
||||
v-bind:class="{ buyable: true, can: tmp[layer].buyables[data].canAfford, locked: !tmp[layer].buyables[data].canAfford}"
|
||||
v-bind:style="[tmp[layer].buyables[data].canAfford ? {'background-color': tmp[layer].color} : {}, size ? {'height': size, 'width': size} : {}, tmp[layer].buyables[data].style]"
|
||||
v-on:click="buyBuyable(layer, data)">
|
||||
|
@ -231,9 +231,9 @@ function loadVue() {
|
|||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<div v-if="layers[layer].clickables" class="upgTable">
|
||||
<button v-if="tmp[layer].clickables.masterButtonPress" v-on:click="layers[layer].clickables.masterButtonPress()" v-bind:class="{ longUpg: true, can: player[layer].unl, locked: !player[layer].unl }">{{tmp[layer].clickables.masterButtonText ? tmp[layer].clickables.masterButtonText : "Click me!"}}</button><br>
|
||||
<button v-if="tmp[layer].clickables.masterButtonPress" v-on:click="layers[layer].clickables.masterButtonPress()" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].clickables.masterButtonText ? tmp[layer].clickables.masterButtonText : "Click me!"}}</button><br>
|
||||
<div v-for="row in tmp[layer].clickables.rows" class="upgRow">
|
||||
<div v-for="col in tmp[layer].clickables.cols"><div v-if="layers[layer].clickables[row*10+col]!== undefined && tmp[layer].clickables[row*10+col].unl" class="upgAlign" v-bind:style="{'margin-left': '7px', 'margin-right': '7px', 'height': (data ? data : 'inherit'),}">
|
||||
<div v-for="col in tmp[layer].clickables.cols"><div v-if="layers[layer].clickables[row*10+col]!== undefined && tmp[layer].clickables[row*10+col].unlocked" class="upgAlign" v-bind:style="{'margin-left': '7px', 'margin-right': '7px', 'height': (data ? data : 'inherit'),}">
|
||||
<clickable :layer = "layer" :data = "row*10+col" :size = "data" v-bind:style="tmp[layer].componentStyles.clickable"></clickable>
|
||||
</div></div>
|
||||
<br>
|
||||
|
@ -247,7 +247,7 @@ function loadVue() {
|
|||
props: ['layer', 'data', 'size'],
|
||||
template: `
|
||||
<button
|
||||
v-if="layers[layer].clickables && layers[layer].clickables[data]!== undefined && tmp[layer].clickables[data].unl"
|
||||
v-if="layers[layer].clickables && layers[layer].clickables[data]!== undefined && tmp[layer].clickables[data].unlocked"
|
||||
v-bind:class="{ upg: true, can: tmp[layer].clickables[data].canClick, locked: !tmp[layer].clickables[data].canClick}"
|
||||
v-bind:style="[tmp[layer].clickables[data].canClick ? {'background-color': tmp[layer].color} : {}, size ? {'height': size, 'width': size} : {}, tmp[layer].clickables[data].style]"
|
||||
v-on:click="clickClickable(layer, data)">
|
||||
|
@ -279,7 +279,7 @@ function loadVue() {
|
|||
Vue.component('bar', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<div v-if="tmp[layer].bars && tmp[layer].bars[data].unl" v-bind:style="{'position': 'relative'}"><div class ="barBorder" v-bind:style="[tmp[layer].bars[data].style, tmp[layer].bars[data].baseStyle, tmp[layer].bars[data].borderStyle, tmp[layer].bars[data].dims]">
|
||||
<div v-if="tmp[layer].bars && tmp[layer].bars[data].unlocked" v-bind:style="{'position': 'relative'}"><div class ="barBorder" v-bind:style="[tmp[layer].bars[data].style, tmp[layer].bars[data].baseStyle, tmp[layer].bars[data].borderStyle, tmp[layer].bars[data].dims]">
|
||||
|
||||
<div class = "overlayTextContainer" v-bind:style="[tmp[layer].bars[data].dims]">
|
||||
<span class = "overlayText" v-bind:style="[tmp[layer].bars[data].style, tmp[layer].bars[data].textStyle]" v-html="tmp[layer].bars[data].display"></span>
|
||||
|
@ -298,7 +298,7 @@ function loadVue() {
|
|||
template: `
|
||||
<div class="upgRow">
|
||||
<div v-for="tab in Object.keys(data)">
|
||||
<button v-if="data[tab].unl == undefined || data[tab].unl" class="tabButton" v-bind:style="[{'border-color': tmp[layer].color}, tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]" v-on:click="player.subtabs[layer][name] = tab">{{tab}}</button>
|
||||
<button v-if="data[tab].unlocked == undefined || data[tab].unlocked" class="tabButton" v-bind:style="[{'border-color': tmp[layer].color}, tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]" v-on:click="player.subtabs[layer][name] = tab">{{tab}}</button>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
@ -313,18 +313,18 @@ function loadVue() {
|
|||
showTab(layer)
|
||||
}"
|
||||
v-bind:tooltip="
|
||||
player[layer].unl ? (tmp[layer].tooltip ? tmp[layer].tooltip : formatWhole(player[layer].points) + ' ' + tmp[layer].resource)
|
||||
player[layer].unlocked ? (tmp[layer].tooltip ? tmp[layer].tooltip : formatWhole(player[layer].points) + ' ' + tmp[layer].resource)
|
||||
: (tmp[layer].tooltipLocked ? tmp[layer].tooltipLocked : 'Reach ' + formatWhole(tmp[layer].requires) + ' ' + tmp[layer].baseResource + ' to unlock (You have ' + formatWhole(tmp[layer].baseAmount) + ' ' + tmp[layer].baseResource + ')')
|
||||
"
|
||||
v-bind:class="{
|
||||
treeNode: true,
|
||||
[layer]: true,
|
||||
hidden: !tmp[layer].layerShown,
|
||||
locked: !player[layer].unl && !tmp[layer].baseAmount.gte(tmp[layer].requires),
|
||||
locked: !player[layer].unlocked && !tmp[layer].baseAmount.gte(tmp[layer].requires),
|
||||
notify: tmp[layer].notify,
|
||||
can: layerUnl(layer),
|
||||
can: layerunlocked(layer),
|
||||
}"
|
||||
v-bind:style="[layerUnl(layer) ? {
|
||||
v-bind:style="[layerunlocked(layer) ? {
|
||||
'background-color': tmp[layer].color,
|
||||
} : {}, tmp[layer].nodeStyle]">
|
||||
{{abb}}
|
||||
|
@ -344,10 +344,10 @@ function loadVue() {
|
|||
formatTime,
|
||||
focused,
|
||||
getThemeName,
|
||||
layerUnl,
|
||||
layerunlocked,
|
||||
doReset,
|
||||
buyUpg,
|
||||
startChall,
|
||||
startChallenge,
|
||||
milestoneShown,
|
||||
keepGoing,
|
||||
VERSION,
|
||||
|
|
|
@ -428,7 +428,7 @@ ul {
|
|||
list-style-type: none;
|
||||
}
|
||||
|
||||
.hChall {
|
||||
.hChallenge {
|
||||
background-color: #bf8f8f;
|
||||
border: 4px solid;
|
||||
border-color: rgba(255, 255, 255, 0.125) rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.25) rgba(255, 255, 255, 0.125);
|
||||
|
@ -439,11 +439,11 @@ ul {
|
|||
border-radius: 33.33%;
|
||||
}
|
||||
|
||||
.hChall.done {
|
||||
.hChallenge.done {
|
||||
background-color: #77bf5f;
|
||||
}
|
||||
|
||||
.hChall.canComplete {
|
||||
.hChallenge.canComplete {
|
||||
background-color: #ffbf00;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue