From fde714d73f3a11ffbe358cd7d82342bbc66e5e19 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Mon, 12 Oct 2020 23:08:19 -0400 Subject: [PATCH] Renamed many things to be more readable and updated docs --- {js => Old Code}/gametest.js | 60 ++++++++++++------------ {js => Old Code}/test.js | 0 changelog.md | 19 ++++++-- docs/!general-info.md | 2 + docs/basic-layer-breakdown.md | 2 +- docs/buyables.md | 17 ++++--- docs/challenges.md | 24 +++++----- docs/clickables.md | 10 ++-- docs/custom-tab-layouts.md | 7 ++- docs/layer-features.md | 20 +++++--- docs/milestones.md | 9 ++-- docs/subtabs-and-microtabs.md | 6 ++- docs/upgrades.md | 14 +++--- index.html | 6 +-- js/game.js | 60 ++++++++++++------------ js/layerSupport.js | 38 +++++++-------- js/layers.js | 88 ++++++++++++++++------------------- js/temp.js | 4 +- js/utils.js | 72 ++++++++++++++-------------- js/v.js | 70 ++++++++++++++-------------- style.css | 6 +-- 21 files changed, 281 insertions(+), 253 deletions(-) rename {js => Old Code}/gametest.js (90%) rename {js => Old Code}/test.js (100%) diff --git a/js/gametest.js b/Old Code/gametest.js similarity index 90% rename from js/gametest.js rename to Old Code/gametest.js index 34f394e..b1256df 100644 --- a/js/gametest.js +++ b/Old Code/gametest.js @@ -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 : "") diff --git a/js/test.js b/Old Code/test.js similarity index 100% rename from js/test.js rename to Old Code/test.js diff --git a/changelog.md b/changelog.md index 56e8577..55909f8 100644 --- a/changelog.md +++ b/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, \ No newline at end of file +All instances of: + chall -> challenge + unl -> unlocked + upg -> upgrade + amt -> amount + desc -> description + resCeil -> roundUpCost + +Challenges: + desc -> challengeDescription + reward -> rewardDescription + effect -> rewardEffect + effectDisplay -> rewardDisplay \ No newline at end of file diff --git a/docs/!general-info.md b/docs/!general-info.md index ed7fe30..0b9507c 100644 --- a/docs/!general-info.md +++ b/docs/!general-info.md @@ -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. diff --git a/docs/basic-layer-breakdown.md b/docs/basic-layer-breakdown.md index 0e330d1..43d7696 100644 --- a/docs/basic-layer-breakdown.md +++ b/docs/basic-layer-breakdown.md @@ -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 }}, diff --git a/docs/buyables.md b/docs/buyables.md index 098bb01..b3976db 100644 --- a/docs/buyables.md +++ b/docs/buyables.md @@ -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. \ No newline at end of file +- 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. \ No newline at end of file diff --git a/docs/challenges.md b/docs/challenges.md index b92a2b1..bb48509 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -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. \ No newline at end of file +- 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. \ No newline at end of file diff --git a/docs/clickables.md b/docs/clickables.md index 0730ab2..9874f19 100644 --- a/docs/clickables.md +++ b/docs/clickables.md @@ -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. \ No newline at end of file +- 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. \ No newline at end of file diff --git a/docs/custom-tab-layouts.md b/docs/custom-tab-layouts.md index d89e734..7106f37 100644 --- a/docs/custom-tab-layouts.md +++ b/docs/custom-tab-layouts.md @@ -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. diff --git a/docs/layer-features.md b/docs/layer-features.md index 8f3d658..e57b557 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -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'}}, }, ``` diff --git a/docs/milestones.md b/docs/milestones.md index 6f70b04..a8c521c 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -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. \ No newline at end of file diff --git a/docs/subtabs-and-microtabs.md b/docs/subtabs-and-microtabs.md index 711469a..42d2e7e 100644 --- a/docs/subtabs-and-microtabs.md +++ b/docs/subtabs-and-microtabs.md @@ -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.) \ No newline at end of file diff --git a/docs/upgrades.md b/docs/upgrades.md index 0071246..3b78ec8 100644 --- a/docs/upgrades.md +++ b/docs/upgrades.md @@ -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. \ No newline at end of file +- 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. \ No newline at end of file diff --git a/index.html b/index.html index 0566a11..26e1535 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@

Time Played: {{ formatTime(player.timePlayed) }}

Hotkeys


-
{{key.desc}}
+
{{key.description}}

@@ -84,7 +84,7 @@ - + @@ -134,7 +134,7 @@ - +

diff --git a/js/game.js b/js/game.js index df2dc70..4c953a4 100644 --- a/js/game.js +++ b/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 : "") diff --git a/js/layerSupport.js b/js/layerSupport.js index 1b2c936..7647d93 100644 --- a/js/layerSupport.js +++ b/js/layerSupport.js @@ -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 } diff --git a/js/layers.js b/js/layers.js index e500f2a..766b58a 100644 --- a/js/layers.js +++ b/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
"+challCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"}, - unl() { return player[this.layer].best.gt(0) }, + challengeDescription() {return "Makes the game 0% harder
"+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 secret subtab and make this layer act if you unlocked it first.", + description:() => "Unlock a secret subtab 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 "

C O N F I R M E D

"}], "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:
" + data }, - unl() { return player[this.layer].unl }, + unlocked() { return player[this.layer].unlocked }, canClick() { return getClickableState(this.layer, this.id) !== "Borkened..."}, onClick() { diff --git a/js/temp.js b/js/temp.js index 7592ab2..ebbb0e0 100644 --- a/js/temp.js +++ b/js/temp.js @@ -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) diff --git a/js/utils.js b/js/utils.js index d467b04..81fdc50 100644 --- a/js/utils.js +++ b/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 ") : ""}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `

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 ") : ""}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `

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 "}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource}

${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 "}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource}

${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() diff --git a/js/v.js b/js/v.js index 69c21a4..72f55ae 100644 --- a/js/v.js +++ b/js/v.js @@ -86,13 +86,13 @@ function loadVue() { ` }) - Vue.component('challs', { + Vue.component('challenges', { props: ['layer'], template: ` -
-
-
- +
+
+
+
@@ -100,16 +100,16 @@ function loadVue() { }) // data = id - Vue.component('chall', { + Vue.component('challenge', { props: ['layer', 'data'], template: ` -
-



-

-
- Goal: {{format(tmp[layer].challs[data].goal)}} {{tmp[layer].challs[data].currencyDisplayName ? tmp[layer].challs[data].currencyDisplayName : "points"}}
- Reward:
- Currently: +
+



+

+
+ Goal: {{format(tmp[layer].challenges[data].goal)}} {{tmp[layer].challenges[data].currencyDisplayName ? tmp[layer].challenges[data].currencyDisplayName : "points"}}
+ Reward:
+ Currently:
` }) @@ -119,7 +119,7 @@ function loadVue() { template: `
-
+
@@ -132,10 +132,10 @@ function loadVue() { Vue.component('upgrade', { props: ['layer', 'data'], template: ` - @@ -147,7 +147,7 @@ function loadVue() { template: `
-
@@ -160,9 +160,9 @@ function loadVue() { Vue.component('milestone', { props: ['layer', 'data'], template: ` - -


-
+ +


+
  ` }) @@ -199,9 +199,9 @@ function loadVue() { props: ['layer', 'data'], template: `
-
+
-
+

@@ -215,7 +215,7 @@ function loadVue() { props: ['layer', 'data', 'size'], template: `
+
-
+

@@ -247,7 +247,7 @@ function loadVue() { props: ['layer', 'data', 'size'], template: ` +
` @@ -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, diff --git a/style.css b/style.css index 6dc272b..0ae3521 100644 --- a/style.css +++ b/style.css @@ -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; }