From e9105e9865f4d501466045302aafed62e44ab260 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sun, 11 Oct 2020 14:49:29 -0400 Subject: [PATCH] Test with Despacit Tree Delta, numerous fixes --- changelog.md | 5 +- docs/custom-tab-layouts.md | 5 +- index.html | 4 +- js/game.js | 3 +- js/gametest.js | 486 ++++++++++ js/temp.js | 8 +- js/test.js | 1872 ++++++++++++++++++++++++++++++++++++ js/v.js | 21 +- 8 files changed, 2378 insertions(+), 26 deletions(-) create mode 100644 js/gametest.js create mode 100644 js/test.js diff --git a/changelog.md b/changelog.md index 2391801..39aa6e9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,11 +1,12 @@ #The Modding Tree changelog: +Moved modInfo to game.js, added a spot for a Discord link, and a separate mod version from the TMT version +Tree structure is based on layer data, no index.html needed. Tmp does not need to be manually updated. Almost every value in layer data can be a function or a constant value! -effectDisplay in Challenges and Upgrades no longer takes an argument You don't have to have the same amount of upgrades in every row (and challs and buyables) Unl is optional for all Big Components (defaults to true). -Moved modInfo to game.js, added a spot for a Discord link, and a separate mod version from the TMT version +effectDisplay in Challenges and Upgrades no longer takes an argument ##v1.3.5 - Completely automated convertToDecimal, now you never have to worry about it again. diff --git a/docs/custom-tab-layouts.md b/docs/custom-tab-layouts.md index 4f06b4f..f507911 100644 --- a/docs/custom-tab-layouts.md +++ b/docs/custom-tab-layouts.md @@ -22,10 +22,7 @@ which applies its style to the component. These are the existing components, but you can create more in v.js: -- display-text: Displays some text. The argument is the text to display. It can also be a function that returns updating text. - -- raw-html: Displays some HTML. The argument is the HTML as a string, or a function that returns updating HTML. - It doesn't work with many vue things. +- display-text: Displays some text (can use basic HTML). The argument is the text to display. It can also be a function that returns updating text. - blank: Adds empty space. The default dimensions are 8px x 17px. The argument changes the dimensions. If it's a single value (e.g. "20px"), that determines the height. diff --git a/index.html b/index.html index bb3597c..65f0174 100644 --- a/index.html +++ b/index.html @@ -6,9 +6,9 @@ - + - + diff --git a/js/game.js b/js/game.js index fe88a30..72f6ae4 100644 --- a/js/game.js +++ b/js/game.js @@ -27,7 +27,7 @@ function showPointGen(){ // Calculate points/sec! function getPointGen() { - if(!hasUpg("c", 11)) + if(!hasUpg("p", 11)) return new Decimal(0) let gain = new Decimal(1) @@ -264,6 +264,7 @@ function buyableEffect(layer, id){ return (tmp[layer].buyables[id].effect) } + function canAffordPurchase(layer, thing, cost) { if (thing.currencyInternalName){ let name = thing.currencyInternalName diff --git a/js/gametest.js b/js/gametest.js new file mode 100644 index 0000000..b556c8d --- /dev/null +++ b/js/gametest.js @@ -0,0 +1,486 @@ +var player; +var needCanvasUpdate = true; +var NaNalert = false; +var gameEnded = false; + + +let modInfo = { + name: "The Modding Tree", + id: "modbase", + pointsName: "points", + discordName: "", + discordLink: "", + offlineLimit: 1 // In hours +} + +let VERSION = { + num: "1.3.5 maybe", + name: "Tabception... ception!", + tmtNum: "1.3.5 maybe", + tmtName: "Tabception... ception!" +} + +// Determines if it should show points/sec +function showPointGen(){ + return (tmp.pointGen.neq(new Decimal(0))) +} + +// Calculate points/sec! +function getPointGen() { + if(!hasUpg("p", 11)) return new Decimal(0) + + let gain = new Decimal(1) + if (hasUpg("p", 12)) gain = gain.times(upgEffect("p", 12)) + if (hasUpg("p", 13)) gain = gain.times(upgEffect("p", 13)) + if (hasUpg("p", 22)) gain = gain.times(upgEffect("p", 22)) + if (player.b.unl) gain = gain.times(layers.b.effect()) + if (player.g.unl) gain = gain.times(layers.g.effect().powerBoost) + if (hasUpg("e", 11)) gain = gain.times(layers.e.upgrades[11].effect()) + if (player.e.unl && tmp.e.buyables) gain = gain.times(tmp.e.buyables[11].effect.second) + if (player.r.upgrades.includes(11)) gain = gain.times(layers.r.upgrades[11].effect()) + if (player.d.buyables[12].gt(0)) gain = gain.times(layers.d.buyables[12].effect(player.d.buyables[12]).first) + if (!player.s.active) if (player.pr.buyables[13].gt(0)) gain = gain.times(layers.pr.buyables[13].effect().first) + if (player.d.banking == 1) gain = gain.sqrt() + if (player.d.banking == 2) gain = gain.add(1).log10() + return gain +} + + + +// 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 + + if (layers[layer].challs[chall].countsAs) + return layers[layer].challs[id].countsAs.includes(id) +} + +function getResetGain(layer, useType = null) { + let type = useType + if (!useType) type = layers[layer].type + + if (tmp[layer].gainExp.eq(0)) return new Decimal(0) + if (type=="static") { + if ((!layers[layer].canBuyMax()) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(1) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(layers[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(layers[layer].exponent, -1)) + return gain.floor().sub(player[layer].points).add(1).max(1); + } else if (type=="normal"){ + if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(0) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).pow(layers[layer].exponent).times(tmp[layer].gainMult).pow(tmp[layer].gainExp) + if (gain.gte("e1e7")) gain = gain.sqrt().times("e5e6") + return gain.floor().max(0); + } else if (type=="custom"){ + return layers[layer].getResetGain() + } else { + return new Decimal(0) + } +} + +function getNextAt(layer, canMax=false, useType = null) { + let type = useType + if (!useType) type = layers[layer].type + + if (tmp[layer].gainExp.eq(0)) return new Decimal(1/0) + if (type=="static") + { + if (!layers[layer].canBuyMax()) canMax = false + 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(layers[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() + 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(layers[layer].exponent).times(tmp[layer].requires).max(tmp[layer].requires)) + if (layers[layer].resCeil) next = next.ceil() + return next; + } else if (type=="custom"){ + return layers[layer].getNextAt(canMax) + } else { + return new Decimal(0) + }} + +// Return true if the layer should be highlighted. By default checks for upgrades only. +function shouldNotify(layer){ + for (id in layers[layer].upgrades){ + if (!isNaN(id)){ + if (canAffordUpg(layer, id) && !hasUpg(layer, id) && tmp[layer].upgrades[id].unl){ + return true + } + } + } + + if (layers[layer].shouldNotify){ + return layers[layer].shouldNotify() + } + else + return false +} + +function canReset(layer) +{ + if(tmp[layer].type == "normal") + return tmp[layer].baseAmount.gte(tmp[layer].requires) + else if(tmp[layer].type== "static") + return tmp[layer].baseAmount.gte(tmp[layer].nextAt) + else + return layers[layer].canReset() +} + +function rowReset(row, layer) { + for (lr in ROW_LAYERS[row]){ + if(layers[lr].doReset) { + player[lr].active = null // Exit challenges on any row reset on an equal or higher row + layers[lr].doReset(layer) + } + else + if(layers[layer].row > layers[lr].row) fullLayerReset(lr) + } +} + +function fullLayerReset(layer) { + player[layer] = layers[layer].startData(); + player[layer].upgrades = [] + player[layer].milestones = [] + player[layer].challs = [] + 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] + } + + if (layers[layer].microtabs) { + if (player.subtabs[layer] == undefined) player.subtabs[layer] = {} + for (item in layers[layer].microtabs) + if (player.subtabs[layer][item] == undefined) player.subtabs[layer][item] = Object.keys(layers[layer].microtabs[item])[0] + } + resetBuyables(layer) +} + +function resetBuyables(layer){ + if (layers[layer].buyables) + player[layer].buyables = getStartBuyables(layer) + player[layer].spentOnBuyables = new Decimal(0) +} + +function getStartBuyables(layer){ + let data = {} + if (layers[layer].buyables) { + for (id in layers[layer].buyables) + if (!isNaN(id)) + data[id] = new Decimal(0) + } + return data +} + +function addPoints(layer, gain) { + player[layer].points = player[layer].points.add(gain).max(0) + if (player[layer].best) player[layer].best = player[layer].best.max(player[layer].points) + if (player[layer].total) player[layer].total = player[layer].total.add(gain) +} + +function generatePoints(layer, diff) { + addPoints(layer, tmp[layer].resetGain.times(diff)) +} + +var prevOnReset + +function doReset(layer, force=false) { + let row = layers[layer].row + if (!force) { + if (!tmp[layer].canReset) return + let gain = tmp[layer].resetGain + if (layers[layer].type=="static") { + gain =(layers[layer].canBuyMax() ? gain : 1) + } + if (layers[layer].onPrestige) + layers[layer].onPrestige(gain) + + addPoints(layer, gain) + updateMilestones(layer) + + if (!player[layer].unl) { + player[layer].unl = 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++ + } + } + + tmp[layer].baseAmount = new Decimal(0) // quick fix + } + + if (tmp[layer].resetsNothing) return + + + for (layerResetting in layers) { + if (row >= layers[layerResetting].row && (!force || layerResetting != layer)) completeChall(layerResetting) + } + + prevOnReset = {...player} //Deep Copy + player.points = (row == 0 ? new Decimal(0) : new Decimal(10)) + + for (let x = row; x >= 0; x--) rowReset(x, layer) + prevOnReset = undefined + + updateTemp() + updateTemp() +} + +function respecBuyables(layer) { + if (!layers[layer].buyables) return + if (!layers[layer].buyables.respec) return + if (!confirm("Are you sure you want to respec? This will force you to do a \"" + (layers[layer].name ? layers[layer].name : layer) + "\" reset as well!")) return + layers[layer].buyables.respec() + updateBuyableTemp(layer) +} + + + +function canAffordUpg(layer, id) { + if (!layers[layer].upgrades) return false + let upg = layers[layer].upgrades[id] + let cost = tmp[layer].upgrades[id].cost + return canAffordPurchase(layer, upg, cost) +} + +function hasUpg(layer, id){ + if (!layers[layer].upgrades) return false + + return (player[layer].upgrades.includes(toNumber(id)) || player[layer].upgrades.includes(id.toString())) +} + +function hasMilestone(layer, id) { + if (!layers[layer].milestones) return false + + return (player[layer].milestones.includes(toNumber(id)) || player[layer].milestones.includes(id.toString())) +} + +function hasChall(layer, id){ + if (!layers[layer].challs) return false + + return (player[layer].challs.includes(toNumber(id)) || player[layer].challs.includes(id.toString())) +} + +function upgEffect(layer, id){ + if (!layers[layer].upgrades) return {} + + return (tmp[layer].upgrades[id].effect) +} + +function challEffect(layer, id){ + if (!layers[layer].chall) return false + + return (tmp[layer].challs[id].effect) +} + +function buyableEffect(layer, id){ + if (!layers[layer].buyables) return false + + return (tmp[layer].buyables[id].effect) +} + +function canAffordPurchase(layer, thing, cost) { + if (thing.currencyInternalName){ + let name = thing.currencyInternalName + if (thing.currencyLayer){ + let lr = thing.currencyLayer + return !(player[lr][name].lt(cost)) + } + else { + return !(player[name].lt(cost)) + } + } + else { + return !(player[layer].points.lt(cost)) + } +} + +function buyUpg(layer, id) { + if (!player[layer].unl) return + if (!layers[layer].upgrades[id].unl()) return + if (player[layer].upgrades.includes(id)) return + let upg = layers[layer].upgrades[id] + let cost = tmp[layer].upgrades[id].cost + + if (upg.currencyInternalName){ + let name = upg.currencyInternalName + if (upg.currencyLayer){ + let lr = upg.currencyLayer + if (player[lr][name].lt(cost)) return + player[lr][name] = player[lr][name].sub(cost) + } + else { + if (player[name].lt(cost)) return + player[name] = player[name].sub(cost) + } + } + else { + if (player[layer].points.lt(cost)) return + player[layer].points = player[layer].points.sub(cost) + } + player[layer].upgrades.push(id); + if (upg.onPurchase != undefined) + upg.onPurchase() +} + +function buyMaxBuyable(layer, id) { + if (!player[layer].unl) return + if (!tmp[layer].buyables[id].unl) return + if (!tmp[layer].buyables[id].canAfford) return + if (!layers[layer].buyables[id].buyMax) return + + layers[layer].buyables[id].buyMax() + updateBuyableTemp(layer) +} + +function buyBuyable(layer, id) { + if (!player[layer].unl) return + if (!tmp[layer].buyables[id].unl) return + if (!tmp[layer].buyables[id].canAfford) return + + layers[layer].buyables[id].buy() + updateBuyableTemp(layer) +} + +function resetRow(row) { + if (prompt('Are you sure you want to reset this row? It is highly recommended that you wait until the end of your current run before doing this! Type "I WANT TO RESET THIS" to confirm')!="I WANT TO RESET THIS") return + let pre_layers = ROW_LAYERS[row-1] + let layers = ROW_LAYERS[row] + let post_layers = ROW_LAYERS[row+1] + rowReset(row+1, post_layers[0]) + doReset(pre_layers[0], true) + for (let layer in layers) { + player[layers[layer]].unl = false + if (player[layers[layer]].order) player[layers[layer]].order = 0 + } + player.points = new Decimal(10) + updateTemp(); + resizeCanvas(); +} + +function startChall(layer, x) { + let enter = false + if (!player[layer].unl) return + if (player[layer].active == x) { + completeChall(layer, x) + delete player[layer].active + } else { + enter = true + } + doReset(layer, true) + if(enter) player[layer].active = x + + updateChallTemp(layer) +} + +function canCompleteChall(layer, x) +{ + if (x != player[layer].active) return + + let chall = layers[layer].challs[x] + + if (chall.currencyInternalName){ + let name = chall.currencyInternalName + if (chall.currencyLayer){ + let lr = chall.currencyLayer + return !(player[lr][name].lt(readData(chall.goal))) + } + else { + return !(player[name].lt(chall.cost)) + } + } + else { + return !(player[layer].points.lt(chall.cost)) + } + +} + +function completeChall(layer, x) { + var x = player[layer].active + if (!x) return + if (! canCompleteChall(layer, x)) return + if (!player[layer].challs.includes(x)) { + needCanvasUpdate = true + player[layer].challs.push(x); + if (layers[layer].challs[x].onComplete) layers[layer].challs[x].onComplete() + } + delete player[layer].active + updateChallTemp(layer) +} + +VERSION.withoutName = "v" + VERSION.num + (VERSION.pre ? " Pre-Release " + VERSION.pre : VERSION.pre ? " Beta " + VERSION.beta : "") +VERSION.withName = VERSION.withoutName + (VERSION.name ? ": " + VERSION.name : "") + + +const ENDGAME = new Decimal("e280000000"); + +function gameLoop(diff) { + if (player.points.gte(ENDGAME) || gameEnded) gameEnded = 1 + + if (isNaN(diff)) diff = 0 + if (gameEnded && !player.keepGoing) { + diff = 0 + player.tab = "gameEnded" + } + if (player.devSpeed) diff *= player.devSpeed + + addTime(diff) + + for (layer in layers){ + if (layers[layer].update) layers[layer].update(diff); + } + + for (layer in layers){ + if (layers[layer].automate) layers[layer].automate(); + } + + for (layer in layers){ + if (layers[layer].milestones) updateMilestones(layer); + } + + if (player.hasNaN&&!NaNalert) { + clearInterval(interval); + player.autosave = false; + NaNalert = true; + + alert("We have detected a corruption in your save. Please visit https://discord.gg/wwQfgPa for help.") + } +} + +function hardReset() { + if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return + player = getStartPlayer() + save(); + window.location.reload(); +} + +var ticking = false + +var interval = setInterval(function() { + if (player===undefined||tmp===undefined) return; + if (ticking) return; + if (gameEnded&&!player.keepGoing) return; + ticking = true + let now = Date.now() + let diff = (now - player.time) / 1e3 + if (player.offTime !== undefined) { + if (player.offTime.remain > modInfo.offlineLimit * 3600000) player.offlineTime.remain = modInfo.offlineLimit * 3600000 + if (player.offTime.remain > 0) { + let offlineDiff = Math.max(player.offTime.remain / 10, diff) + player.offTime.remain -= offlineDiff + diff += offlineDiff + } + if (!player.offlineProd || player.offTime.remain <= 0) delete player.offTime + } + if (player.devSpeed) diff *= player.devSpeed + player.time = now + if (needCanvasUpdate) resizeCanvas(); + updateTemp(); + gameLoop(diff) + ticking = false +}, 50) diff --git a/js/temp.js b/js/temp.js index b7c9299..8e50fe4 100644 --- a/js/temp.js +++ b/js/temp.js @@ -28,6 +28,8 @@ function setupTempData(layerData, tmpData) { if (layerData[item] == null) { tmpData[item] = null } + else if (layerData[item] instanceof Decimal) + tmpData[item] = layerData[item] else if (Array.isArray(layerData[item])) { tmpData[item] = [] setupTempData(layerData[item], tmpData[item]) @@ -37,7 +39,7 @@ function setupTempData(layerData, tmpData) { setupTempData(layerData[item], tmpData[item]) } else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){ - tmpData[item] = {} + tmpData[item] = new Decimal(1) // The safest thing to put probably? } else { tmpData[item] = layerData[item] } @@ -64,7 +66,7 @@ function updateTemp() { } function updateTempData(layerData, tmpData) { - + for (item in layerData){ if (Array.isArray(layerData[item])) { updateTempData(layerData[item], tmpData[item]) @@ -73,7 +75,7 @@ function updateTempData(layerData, tmpData) { updateTempData(layerData[item], tmpData[item]) } else if (isFunction(layerData[item]) && !activeFunctions.includes(item)){ - tmpData[item] = layerData[item]() + Vue.set(tmpData, item, layerData[item]()) } } } diff --git a/js/test.js b/js/test.js new file mode 100644 index 0000000..e5cb029 --- /dev/null +++ b/js/test.js @@ -0,0 +1,1872 @@ +addLayer("p", { + + effect() {return {}}, + startData() { return { + unl: true, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + }}, + color:() => "#00bfbf", + background:() => undefined, + requires:() => new Decimal(10), // Can be a function that takes requirement increases into account + resource: "prestige points", // Name of prestige currency + baseResource: "points", // Name of resource prestige is based on + baseAmount() {return player.points}, // Get the current amount of baseResource + 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?) + canBuyMax() {}, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + if (player[this.layer].upgrades.includes(21)) mult = mult.times(2) + if (player[this.layer].upgrades.includes(23)) mult = mult.times(this.upgrades[23].effect()) + if (player.b.upgrades.includes(11)) mult = mult.times(layers.b.upgrades[11].effect()) + if (player.g.upgrades.includes(11)) mult = mult.times(layers.g.upgrades[11].effect()) + if (player.e.upgrades.includes(11)) mult = mult.times(layers.e.upgrades[11].effect()) + if (player.e.unl) mult = mult.times(layers.e.buyables[11].effect.second) + if (player.d.unl) mult = mult.times(layers.d.buyables[11].effect(player.d.buyables[11]).first) + if (!player.s.active) if (player.pr.buyables[13].gt(0)) mult = mult.times(layers.pr.buyables[13].effect().first) + if (player.s.challs.includes(21)) mult = mult.times(layers.s.challs[21].effect()) + return mult.max(1) + }, + gainExp() { // Calculate the exponent on main currency from bonuses + let exp = new Decimal(1) + if (player.d.unl && player.d.banking == 1) exp = exp.div(2) + if (player.s.active == 11) exp = exp.div(10) + return exp + }, + row: 0, // Row the layer is in on the tree (0 is the first row) + upgrades: { + rows: 2, + cols: 3, + 11: { + desc:() => "Gain 1 Point every second.", + cost:() => new Decimal(1), + unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true + }, + 12: { + desc:() => "Point generation is faster based on your unspent prestige points.", + cost:() => new Decimal(1), + unl() { return player[this.layer].upgrades.includes(11) }, + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + if (player.d.banking == 1) return new Decimal(1) + let ret = player[this.layer].points.add(2).pow(0.5) + if (player.s.unl) ret = ret.pow(layers.s.effect()) + if (ret.gte("1e20000000")) ret = ret.sqrt().times("1e10000000") + return ret; + }, + effectDisplay() { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 13: { + desc:() => "Points boost point gain.", + cost:() => new Decimal(5), + unl() { return player[this.layer].upgrades.includes(12) }, + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.points.add(1).log10().add(1) + return ret; + }, + effectDisplay() { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 21: { + desc:() => "Double prestige point gain.", + cost:() => new Decimal(10), + unl() { return player[this.layer].upgrades.includes(13) }, + }, + 22: { + desc:() => "Point generation is faster based on your prestige upgrades.", + cost:() => new Decimal(25), + unl() { return player[this.layer].upgrades.includes(21) }, + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = Decimal.pow(1.4, player[this.layer].upgrades.length) + return ret + }, + effectDisplay() { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 23: { + desc:() => "Prestige Point gain is boosted by normal Points.", + cost:() => new Decimal(250), + unl() { return player[this.layer].upgrades.includes(22) }, + effect() { + let ret = player.points.add(1).log10().cbrt().add(1) + return ret; + }, + effectDisplay() { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + if(resettingLayer == "b") { + if (player.b.milestones.includes("0")) { + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].upgrades = upgrades + return; + } + } + if(resettingLayer == "g") { + if (player.g.milestones.includes("0")) { + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].upgrades = upgrades + return; + } + } + if(resettingLayer == "e") { + if (player.e.milestones.includes("0")) { + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].upgrades = upgrades + return; + } + } + if(resettingLayer == "r") { + if (player.r.milestones.includes("0")) { + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].upgrades = upgrades + return; + } + } + if(resettingLayer == "d") { + if (player.d.milestones.includes("0")) { + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].upgrades = upgrades + return; + } + } + if(layers[resettingLayer].row > this.row) fullLayerReset(this.layer) // This is actually the default behavior + }, + layerShown() {return true}, // Condition for when layer appears on the tree + update(diff) { + if (player[this.layer].upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0) + }, // Do any gameloop things (e.g. resource generation) inherent to this layer + hotkeys: [ + {key: "p", desc: "P: Reset points for prestige points.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}], + ["blank", "5px"], // Height + ["display-text", + function() {return 'You have ' + format(player.points) + ' points.'}, + {"font-size": "14px"}], + "upgrades"], +}) + + +addLayer("b", { + startData() { return { + unl: false, + auto: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [] + }}, + color:() => "#415a9e", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(5000) + if (player.g.unl && !player.b.unl) req = req.mul(500) + return req + }, // Can be a function that takes requirement increases into account + resource: "boosters", // Name of prestige currency + baseResource: "points", // Name of resource prestige is based on + baseAmount() {return player.points}, // Get the current amount of baseResource + type: "custom", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 1, // 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?) + canBuyMax() { + return player[this.layer].milestones.includes("1") + }, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + if (player[this.layer].upgrades.includes(21)) mult = mult.div(layers[this.layer].upgrades[21].effect()) + if (!player.s.active) if (player.pr.buyables[11].gt(0)) mult = mult.div(layers.pr.buyables[11].effect().first) + if (player.s.challs.includes(12)) mult = mult.div(layers.s.challs[12].effect()) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + exp = new Decimal(1) + if (player.d.unl && player.d.banking == 3) exp = exp.div(2) + return exp + }, + row: 1, // Row the layer is in on the tree (0 is the first row) + effect() { + let base = new Decimal(2) + if (player[this.layer].upgrades.includes(12)) base = base.add(layers[this.layer].upgrades[12].effect()) + if (player[this.layer].upgrades.includes(13)) base = base.add(layers[this.layer].upgrades[13].effect()) + if (player.e.unl && tmp.buyables) base = base.add(tmp.e.buyables[11].effect.first) + if (!player.s.active) if (player.pr.buyables[12].gt(0)) base = base.add(layers.pr.buyables[12].effect().first) + if (player.g.upgrades.includes(23)) base = base.mul(2) + if (player.s.active == 11) base = base.pow(0.1) + if (player.d.unl && player.d.banking == 3) base = new Decimal(2) + let exp = new Decimal(1) + if (player.d.banking == 1) exp = exp.div(2) + let free = new Decimal(0) + if (!player.s.active) if (player.pr.buyables[14].gt(0)) free = free.add(layers.pr.buyables[14].effect().first) + return Decimal.pow(base, player[this.layer].points.add(free)).pow(exp) + }, + effectDescription:() => "multiplying point gain by "+format(layers[this.layer].effect())+"x", + milestones: { + 0: { + requirementDesc:() => "4 boosters", + effectDesc:() => "You don't lose prestige upgrades on booster resets", + done() { + return player[this.layer].best.gte(4) || player.e.milestones.includes("0") || player.r.milestones.includes("0") || player.d.milestones.includes("0"); + } + }, + 1: { + requirementDesc:() => "8 boosters", + effectDesc:() => "You can max-buy boosters.", + done() { + return player[this.layer].best.gte(8); + } + } + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + let unlocked = true + let autoed = player[this.layer].auto + if(resettingLayer == "r") { + if (player.r.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.r.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(resettingLayer == "d") { + if (player.d.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.d.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(resettingLayer == "e") { + if (player.e.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.e.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(layers[resettingLayer].row > this.row) { + fullLayerReset(this.layer) // This is actually the default behavior + player[this.layer].unl = unlocked + } + }, + layerShown() {return player.p.unl}, // Condition for when layer appears on the tree + resetsNothing() {return player.e.milestones.includes("3") || player.r.milestones.includes("3") || player.d.milestones.includes("3")}, + upgrades: { + rows: 2, + cols: 3, + 11: { + desc:() => "Boosters multiply prestige points.", + cost:() => new Decimal(3), + unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].points.add(2).log10().add(1).pow(2) + return ret; + }, + effectDisplay() { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 12: { + desc:() => "Generators add to the base of Boosters.", + cost:() => new Decimal(8), + unl() { return player[this.layer].upgrades.includes(11) && player.g.unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.g.points.add(1).log10().div(3) + return ret; + }, + effectDisplay() { return "+"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 13: { + desc:() => "Prestige Points add to the base of Boosters.", + cost:() => new Decimal(16), + unl() { return player[this.layer].upgrades.includes(12) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.p.points.add(1).log10().root(7).div(3) + return ret; + }, + effectDisplay() { return "+"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 21: { + desc:() => "Points divide the Booster cost.", + cost:() => new Decimal(20), + unl() { return player[this.layer].upgrades.includes(13) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = (player.points.add(1)).root(15) + return ret; + }, + effectDisplay() { return "/"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 22: { + desc:() => "Square the Generator Power effect.", + cost:() => new Decimal(21), + unl() { return player[this.layer].upgrades.includes(21) }, // The upgrade is only visible when this is true + }, + 23: { + desc:() => "Boosters multiply Generator Power gain.", + cost:() => new Decimal(24), + unl() { return player[this.layer].upgrades.includes(22) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.b.points.add(1).log10().add(1).pow(5) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + }, + hotkeys: [ + {key: "b", desc: "B: Reset points for boosters.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + incr_order: [], // Array of layer names to have their order increased when this one is first unlocked + prestigeButtonText() { //Is secretly HTML + return `Convert your points into +${formatWhole(tmp[layer].resetGain)} ${layers[layer].resource}

${(tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&layers[layer].canBuyMax && layers[layer].canBuyMax())?"Next":"Req"}: ${formatWhole(tmp[layer].baseAmount)} / ${(layers[layer].resCeil ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ layers[layer].baseResource }` + }, + getResetGain() { + if ((!layers[layer].canBuyMax()) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(1) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(layers[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(layers[layer].exponent, -1)) + if (gain.gte(12)) { + gain = gain.times(12).sqrt() + } + if (gain.gte(1225)) gain = gain.times(Decimal.pow(1225, 9)).pow(0.1) + return gain.floor().sub(player[layer].points).add(1).max(1); + }, + getNextAt() { + let amt = player[layer].points + if (amt.gte(1225)) amt = amt.pow(10).div(Decimal.pow(1225, 9)) + if (amt.gte(12)) { + amt = amt.pow(2).div(12) + } + let extraCost = Decimal.pow(layers[layer].base, amt.pow(layers[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() + return cost; + }, + canReset() { + return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt) + }, + automate() { + if (player.e.milestones.includes("4") || player.r.milestones.includes("4") || player.d.milestones.includes("4") && player[this.layer].auto) doReset(this.layer, false) + }, // Do any automation inherent to this layer if appropriate + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}, {}], + ["blank", "5px"], // Height + ["display-text", + function() {return 'You have ' + format(player.points) + ' points.'}, + {"font-size": "14px"}], + "upgrades", "blank", "milestones"], + branches: [["p", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + + +addLayer("g", { + startData() { return { + unl: false, + auto: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + power: new Decimal(0), + milestones: [] + }}, + color:() => "#409c6e", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(5000) + if (player.b.unl && !player.g.unl) req = req.mul(500) + return req + }, // Can be a function that takes requirement increases into account + resource: "generators", // Name of prestige currency + baseResource: "points", // Name of resource prestige is based on + baseAmount() {return player.points}, // Get the current amount of baseResource + type: "custom", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 1, // 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?) + canBuyMax() { + return player[this.layer].milestones.includes("1") + }, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + if (player[this.layer].upgrades.includes(21)) mult = mult.div(layers[this.layer].upgrades[21].effect()) + if (!player.s.active) if (player.pr.buyables[11].gt(0)) mult = mult.div(layers.pr.buyables[11].effect().first) + if (player.s.challs.includes(12)) mult = mult.div(layers.s.challs[12].effect()) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + exp = new Decimal(1) + if (player.d.unl && player.d.banking == 3) exp = exp.div(2) + return exp + }, + row: 1, // Row the layer is in on the tree (0 is the first row) + effect() { + let base = new Decimal(2) + if (player[this.layer].upgrades.includes(12)) base = base.add(layers[this.layer].upgrades[12].effect()) + if (player[this.layer].upgrades.includes(13)) base = base.add(layers[this.layer].upgrades[13].effect()) + if (player.r.upgrades.includes(14)) base = base.add(layers.r.upgrades[14].effect()) + if (player.e.unl && tmp.buyables) base = base.add(tmp.e.buyables[11].effect.first) + if (!player.s.active) if (player.pr.buyables[12].gt(0)) base = base.add(layers.pr.buyables[12].effect().first) + if (player.s.active == 11) base = base.pow(0.1) + if (player.d.unl && player.d.banking == 3) base = new Decimal(2) + + let genMult = new Decimal(1) + if (player[this.layer].upgrades.includes(14)) genMult = genMult.add(layers[this.layer].upgrades[14].effect()) + if (player[this.layer].upgrades.includes(22)) genMult = genMult.add(layers[this.layer].upgrades[22].effect()) + if (player.b.upgrades.includes(23)) genMult = genMult.add(layers.b.upgrades[23].effect(player.e.buyables[11])) + if (player.r.unl) genMult = genMult.times(layers.r.effect().powerBoost) + if (player.d.unl) genMult = genMult.times(layers.d.buyables[13].effect(player.d.buyables[13]).first) + + let powerPow = new Decimal(1) + if (player.b.upgrades.includes(21)) powerPow = powerPow.add(1) + if (player.d.banking == 1) powerPow = powerPow.div(2) + + let freeGens = new Decimal(0) + if (player.r.unl && tmp.buyables) freeGens = freeGens.add(tmp.r.buyables[13].effect.first) + if (!player.s.active) if (player.pr.buyables[14].gt(0)) freeGens = freeGens.add(layers.pr.buyables[14].effect().first) + return { + genProd: Decimal.pow(base, player[this.layer].points.add(freeGens)).sub(1).mul(genMult), + powerBoost: player.g.power.add(1).pow(1/3).pow(powerPow) + } + }, + effectDescription() {return "producing "+format(layers[this.layer].effect().genProd)+" generator power each second"}, + milestones: { + 0: { + requirementDesc:() => "4 generators", + effectDesc:() => "You don't lose prestige upgrades on generator resets", + done() { + return player[this.layer].best.gte(4) || player.e.milestones.includes("0") || player.r.milestones.includes("0") || player.d.milestones.includes("0"); + } + }, + 1: { + requirementDesc:() => "8 generators", + effectDesc:() => "You can buy max generators.", + done() { + return player[this.layer].best.gte(8); + } + }, + 2: { + requirementDesc:() => "14 generators", + effectDesc:() => "You get 100% of Prestige Points gained on Prestige each second.", + done() { + return player[this.layer].best.gte(14); + } + } + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + if(layers[resettingLayer].row > this.row-1) player.g.power = new Decimal(0) + let unlocked = true + let autoed = player[this.layer].auto + if(resettingLayer == "d") { + if (player.d.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.d.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(resettingLayer == "r") { + if (player.r.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.r.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(resettingLayer == "e") { + if (player.e.milestones.includes("2")) { + let milestones = player[this.layer].milestones + let upgrades = player[this.layer].upgrades + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].upgrades = upgrades + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + if (player.e.milestones.includes("1")) { + let milestones = player[this.layer].milestones + fullLayerReset(this.layer) + player[this.layer].milestones = milestones + player[this.layer].unl = unlocked + player[this.layer].auto = autoed + return; + } + } + if(layers[resettingLayer].row > this.row) { + fullLayerReset(this.layer) // This is actually the default behavior + player[this.layer].unl = unlocked + } + }, + convertToDecimal() { + player.g.power = new Decimal(player.g.power) + // Convert any layer-specific Decimal values (besides points, total, and best) from String to Decimal (used when loading save) + }, + layerShown() {return player.p.unl}, // Condition for when layer appears on the tree + automate() { + if (player.e.milestones.includes("4") || player.r.milestones.includes("4") || player.d.milestones.includes("4") && player[this.layer].auto) doReset(this.layer, false) + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + update(diff) { + if (player.g.unl) player.g.power = player.g.power.add(layers[this.layer].effect().genProd.mul(diff)) + if (player[this.layer].milestones.includes("2")) generatePoints("p", diff) + }, + resetsNothing() {return player.e.milestones.includes("3") || player.r.milestones.includes("3") || player.d.milestones.includes("3")}, + onPrestige(gain) { + return + }, // 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. + upgrades: { + rows: 2, + cols: 4, + 11: { + desc:() => "Generators multiply prestige points.", + cost:() => new Decimal(3), + unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].points.add(2).log10().add(1).pow(2) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 12: { + desc:() => " Boosters add to the base of Generators.", + cost:() => new Decimal(8), + unl() { return player[this.layer].upgrades.includes(11) && player.b.unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.b.points.add(1).log10().div(3) + return ret; + }, + effectDisplay(fx) { return "+"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 13: { + desc:() => "Prestige Points add to the base of Generators.", + cost:() => new Decimal(16), + unl() { return player[this.layer].upgrades.includes(12) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.p.points.add(1).log10().root(7).div(3) + return ret; + }, + effectDisplay(fx) { return "+"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 14: { + desc:() => "Generator Power boosts itself.", + cost:() => new Decimal(19), + unl() { return player[this.layer].upgrades.includes(13) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].power.add(1).log10().add(1).pow(1.15) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 21: { + desc:() => "Prestige Points divide the Generator cost.", + cost:() => new Decimal(24), + unl() { return player[this.layer].upgrades.includes(14) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = (player.p.points.add(1)).root(13) + return ret; + }, + effectDisplay(fx) { return "/"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 22: { + desc:() => "Points multiply Generator Power gain.", + cost:() => new Decimal(25), + unl() { return player[this.layer].upgrades.includes(21) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.points.add(1).log10().add(1).pow(2) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 23: { + desc:() => "Double the Booster base.", + cost:() => new Decimal(26), + unl() { return player[this.layer].upgrades.includes(22) }, // The upgrade is only visible when this is true + }, + 24: { + desc:() => "???", + cost:() => new Decimal(1/0), + unl() { return false }, // The upgrade is only visible when this is true + }, + }, + hotkeys: [ + {key: "g", desc: "G: Reset points for generators.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + incr_order: [], // Array of layer names to have their order increased when this one is first unlocked + prestigeButtonText() { //Is secretly HTML + return `Convert your points into +${formatWhole(tmp[layer].resetGain)} ${layers[layer].resource}

${(tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&layers[layer].canBuyMax && layers[layer].canBuyMax())?"Next":"Req"}: ${formatWhole(tmp[layer].baseAmount)} / ${(layers[layer].resCeil ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ layers[layer].baseResource }` + }, + getResetGain() { + if ((!layers[layer].canBuyMax()) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(1) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(layers[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(layers[layer].exponent, -1)) + if (gain.gte(12)) { + gain = gain.times(12).sqrt() + } + if (gain.gte(1225)) gain = gain.times(Decimal.pow(1225, 9)).pow(0.1) + return gain.floor().sub(player[layer].points).add(1).max(1); + }, + getNextAt() { + let amt = player[layer].points + if (amt.gte(1225)) amt = amt.pow(10).div(Decimal.pow(1225, 9)) + if (amt.gte(12)) { + amt = amt.pow(2).div(12) + } + let extraCost = Decimal.pow(layers[layer].base, amt.pow(layers[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() + return cost; + }, + canReset() { + return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt) + }, + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}, {}], + ["display-text", + function() {return 'You have ' + format(player.points) + ' points.'}, + {"font-size": "14px"}], + ["blank", "5px"], // Height + ["display-text", + function() {return 'You have ' + format(player.g.power) + ' generator power, translating to a '+format(layers.g.effect().powerBoost)+'x multiplier to points.'}, + {"font-size": "14px"}], + "upgrades", "blank", "milestones"], + branches: [["p", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + +addLayer("e", { + startData() { return { + unl: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [], + order: 0 + }}, + color:() => "#9643a3", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(1e60) + if (!player[this.layer].upgrades.includes(14)) if (player[this.layer].order > 0) req = req.pow(player[this.layer].order+1) + return req + }, // Can be a function that takes requirement increases into account + resource: "enhance points", // Name of prestige currency + baseResource: "points", // Name of resource prestige is based on + baseAmount() {return player.points}, // Get the current amount of baseResource + type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.04, // 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?) + canBuyMax() {}, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + if (player[this.layer].upgrades.includes(12)) mult = mult.mul(layers[this.layer].upgrades[12].effect()) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + row: 2, // Row the layer is in on the tree (0 is the first row) + milestones: { + 0: { + requirementDesc:() => "1 enhance point", + effectDesc:() => "You don't lose prestige upgrades on previous resets and this resets", + done() { + return player[this.layer].best.gte(1); + } + }, + 1: { + requirementDesc:() => "3 enhance points", + effectDesc:() => "You keep all booster and generator milestones on reset.", + done() { + return player[this.layer].best.gte(3); + } + }, + 2: { + requirementDesc:() => "10 enhance points", + effectDesc:() => "You keep booster and generator upgrades on reset.", + done() { + return player[this.layer].best.gte(10); + } + }, + 3: { + requirementDesc:() => "15 enhance points", + effectDesc:() => "Boosters and generators do not reset everything.", + done() { + return player[this.layer].best.gte(15); + } + }, + 4: { + requirementDesc:() => "50 enhance points", + effectDesc:() => "Automate boosters and generators.", + done() { + return player[this.layer].best.gte(50); + }, + toggles: [ + ["b", "auto"], + ["g", "auto"] + ] + } + }, + buyables: { + rows: 1, + cols: 1, + 11: { + title:() => "Enhancers", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + if (x.gte(25)) x = x.pow(2).div(25) + if (player[this.layer].upgrades.includes(13)) x = x.div(layers[this.layer].upgrades[13].effect()) + let cost = Decimal.pow(2, x.pow(1.5)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + + let eff = {} + eff.first = Decimal.pow(1.5, x.sqrt()) + + eff.second = x.add(1).pow(3) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Cost: " + format(data.cost) + " enhance points\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ + Adds + " + format(data.effect.first) + " to the booster and generator base and multiply points and prestige points by " + format(data.effect.second) + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].points.gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].points = player[this.layer].points.sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + }, + layerShown() {return player.b.unl && player.g.unl}, // Condition for when layer appears on the tree + automate() { + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + resetsNothing() {return false}, + onPrestige(gain) { + return + }, // 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. + upgrades: { + rows: 1, + cols: 4, + 11: { + desc:() => "Enhance points boost point and prestige point gain.", + cost:() => new Decimal(100), + unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].points.add(2).root(1.5) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 12: { + desc:() => "Generator Power boosts enhance point gain.", + cost:() => new Decimal(500), + unl() { return player[this.layer].upgrades.includes(11) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.g.power.add(1).log10().add(1).root(8) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 13: { + desc:() => "Boosters reduce the enhancer cost formula power.", + cost:() => new Decimal(1000), + unl() { return player[this.layer].upgrades.includes(12) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.b.points.add(1).log10().add(1).root(3) + return ret; + }, + effectDisplay(fx) { return "/"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 14: { + desc:() => "This layer behaves like it was bought first..", + cost:() => new Decimal(1000), + unl() { return player[this.layer].order > 0 && player[this.layer].upgrades.includes(13) }, // The upgrade is only visible when this is true + }, + }, + hotkeys: [ + {key: "e", desc: "E: Reset points for enhance points.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + tooltipLocked() { // Optional, tooltip displays when the layer is locked + return ("(Passive layer) This layer requires " + this.requires() + " points. You only have " + formatWhole(player.points)) + }, + incr_order: ["r", "d"], + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}, {}], + ["display-text", + function() {return 'You have ' + format(player.points) + ' points.'}, + {"font-size": "14px"}], + ["blank", "5px"], // Height + "buyables", "blank", "blank", + "upgrades", "blank", "milestones"], + branches: [["b", 1], ["g", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + +addLayer("r", { + startData() { return { + unl: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [], + power: new Decimal(1), + order: 0 + }}, + color:() => "#94bc42", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(1e20) + if (!player[this.layer].upgrades.includes(15)) if (player[this.layer].order > 0) req = req.pow(player[this.layer].order+1) + return req + }, // Can be a function that takes requirement increases into account + resource: "replicators", // Name of prestige currency + baseResource: "generator power", // Name of resource prestige is based on + baseAmount() {return player.g.power}, // Get the current amount of baseResource + type: "custom", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 1, // Prestige currency exponent + base: 25, // 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?) + canBuyMax() {return player[this.layer].milestones.includes("4")}, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + row: 2, // Row the layer is in on the tree (0 is the first row) + effect() { + let base = new Decimal(1) + if (player.r.unl && tmp.buyables) base = base.mul(tmp.r.buyables[11].effect.first) + if (player[this.layer].upgrades.includes(12)) base = base.mul(layers[this.layer].upgrades[12].effect()) + if (player[this.layer].upgrades.includes(13)) base = base.mul(layers[this.layer].upgrades[13].effect()) + + let genMult = new Decimal(1) + if (player.r.unl && tmp.buyables) genMult = genMult.mul(tmp.r.buyables[12].effect.first) + + return { + genProd: player[this.layer].points.add(1).log10().add(1).pow(base).sub(1), + powerBoost: player.r.power.add(1).log2().add(1).pow(genMult) + } + }, + effectDescription() {return "making replicanti multiply by "+format(layers[this.layer].effect().genProd.add(1))+" each second"}, + milestones: { + 0: { + requirementDesc:() => "1 replicator", + effectDesc:() => "You don't lose prestige upgrades on previous resets and this resets", + done() { + return player[this.layer].best.gte(1); + } + }, + 1: { + requirementDesc:() => "2 replicators", + effectDesc:() => "You keep all booster and generator milestones on reset.", + done() { + return player[this.layer].best.gte(2); + } + }, + 2: { + requirementDesc:() => "4 replicators", + effectDesc:() => "You keep booster and generator upgrades on reset.", + done() { + return player[this.layer].best.gte(4); + } + }, + 3: { + requirementDesc:() => "5 replicators", + effectDesc:() => "Boosters and generators do not reset everything.", + done() { + return player[this.layer].best.gte(5); + } + }, + 4: { + requirementDesc:() => "8 replicators", + effectDesc:() => "Automate boosters and generators, and you can buy max replicators.", + done() { + return player[this.layer].best.gte(8); + }, + toggles: [ + ["b", "auto"], + ["g", "auto"] + ] + } + }, + buyables: { + rows: 1, + cols: 3, + 11: { + title:() => "Replication Up", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + if (x.gte(25)) x = x.pow(2).div(25) + if (player[this.layer].buyables[this.id].gte(150)) x = x.pow(1.5).div(12.2474487139) + let cost = Decimal.pow(500, x.add(1).pow(1.5)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = Decimal.pow(1.4, x.sqrt()) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Cost: " + format(data.cost) + " replicanti\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ + Multiplies replicator power by " + format(data.effect.first) + "x" + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].power.gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].power = player[this.layer].power.sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 12: { + title:() => "Effect Up", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + if (x.gte(25)) x = x.pow(2).div(25) + if (player[this.layer].buyables[this.id].gte(150)) x = x.pow(1.5).div(12.2474487139) + let cost = Decimal.pow(1000, x.add(1).pow(1.5)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x.add(1).log10().add(1).pow(0.25) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Cost: " + format(data.cost) + " replicanti\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ + Multiplies replicanti power by " + format(data.effect.first) + "x" + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].power.gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].power = player[this.layer].power.sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 13: { + title:() => "Generator", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + if (x.gte(5)) x = x.pow(3).div(25) + if (player[this.layer].buyables[this.id].gte(25)) x = x.pow(4).div(244140625) + if (player[this.layer].buyables[this.id].gte(50)) x = x.pow(5).div(3.90625e13) + let cost = Decimal.pow("1.80e308", x.add(1).pow(0.125)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Cost: " + format(data.cost) + " replicanti\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ + Get " + format(data.effect.first) + " free generators, and increase the replicanti limit by "+format(tmp[this.layer].buyables[this.id].cost.div("1.80e308"))+"x" + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].power.gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].power = player[this.layer].power.sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + }, + upgrades: { + rows: 1, + cols: 5, + 11: { + desc:() => "Replicanti boosts point gain.", + cost:() => new Decimal(3), + unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].power.add(1).log2().add(1).log2().add(1).pow(3) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 12: { + desc:() => "Generator Power boosts replicanti gain.", + cost:() => new Decimal(7), + unl() { return player[this.layer].upgrades.includes(11) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player.g.power.add(1).log2().add(1).log2().add(1).log2().add(1) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 13: { + desc:() => "Replicanti boosts itself.", + cost:() => new Decimal(14), + unl() { return player[this.layer].upgrades.includes(12) }, // The upgrade is only visible when this is true + effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values + let ret = player[this.layer].power.add(1).log2().add(1).log2().add(1).log2().add(1).log2().add(1) + return ret; + }, + effectDisplay(fx) { return format(tmp[this.layer].upgrades[this.id].effect)+"x" }, // Add formatting to the effect + }, + 14: { + desc:() => "Replicators boost the generator base.", + cost:() => new Decimal(17), + unl() { return player[this.layer].upgrades.includes(13) }, // The upgrade is only visible when this is true + 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).log2().add(1).log2().add(1).cbrt() + return ret; + }, + effectDisplay(fx) { return "+"+format(tmp[this.layer].upgrades[this.id].effect) }, // Add formatting to the effect + }, + 15: { + desc:() => "This layer behaves like it was bought first.", + cost:() => new Decimal(20), + unl() { return player[this.layer].order > 0 && player[this.layer].upgrades.includes(14) }, // The upgrade is only visible when this is true + }, + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + if(layers[resettingLayer].row > this.row-1) player.r.power = new Decimal(1) + }, + convertToDecimal() { + player.r.power = new Decimal(player.r.power).max(1) + }, + layerShown() {return player.g.unl}, // Condition for when layer appears on the tree + automate() { + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + resetsNothing() {return false}, + onPrestige(gain) { + return + }, // 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. + update(diff) { + player.r.power = player.r.power.mul(layers[this.layer].effect().genProd.mul(diff).add(1)).max(1).min(tmp["r"].buyables[13].cost) + }, + hotkeys: [ + {key: "r", desc: "R: Reset generator power for replicators.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + prestigeButtonText() { //Is secretly HTML + return `Convert your generator power into +${formatWhole(tmp[layer].resetGain)} ${layers[layer].resource}

${(tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&layers[layer].canBuyMax && layers[layer].canBuyMax())?"Next":"Req"}: ${formatWhole(tmp[layer].baseAmount)} / ${(layers[layer].resCeil ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ layers[layer].baseResource }` + }, + getResetGain() { + if ((!layers[layer].canBuyMax()) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(1) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(layers[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(layers[layer].exponent, -1)) + if (gain.gte(12)) { + gain = gain.times(12).sqrt() + } + if (gain.gte(1225)) gain = gain.times(Decimal.pow(1225, 9)).pow(0.1) + return gain.floor().sub(player[layer].points).add(1).max(1); + }, + getNextAt() { + let amt = player[layer].points + if (amt.gte(1225)) amt = amt.pow(10).div(Decimal.pow(1225, 9)) + if (amt.gte(12)) { + amt = amt.pow(2).div(12) + } + let extraCost = Decimal.pow(layers[layer].base, amt.pow(layers[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() + return cost; + }, + canReset() { + return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt) + }, + tooltipLocked() { // Optional, tooltip displays when the layer is locked + return ("(Active layer) This layer requires " + this.requires() + " generator power. You only have " + formatWhole(player.g.power)) + }, + incr_order: ["e", "d"], + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your generator power into "}, {}], + ["display-text", + function() {return 'You have ' + format(player.r.power) + ' replicanti (Limit at '+format(tmp["r"].buyables[13].cost)+'), multiplying generator power gain by '+format(tmp.r.effect.powerBoost)+'.'}, + {"font-size": "14px"}], + "upgrades", "buyables", ["blank", "25px"], "milestones"], + branches: [["g", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + +addLayer("d", { + startData() { return { + unl: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [], + power: new Decimal(1), + order: 0, + banking: 0 + }}, + color:() => "#328ba8", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(1e32) + if (!player[this.layer].upgrades.includes(11)) if (player[this.layer].order > 0) req = req.pow(player[this.layer].order+1) + return req + }, // Can be a function that takes requirement increases into account + resource: "tachyon particles", // Name of prestige currency + baseResource: "prestige points", // Name of resource prestige is based on + baseAmount() {return player.p.points}, // Get the current amount of baseResource + type: "custom", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.750, // Prestige currency exponent + base: 500, // 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?) + canBuyMax() {return true}, // Only needed for static layers with buy max + effect() { + let base = new Decimal(1.1) + return Decimal.pow(base, player[this.layer].points.pow(0.9)) + }, + effectDescription:() => "multiplying dilated currency gain by "+format(layers[this.layer].effect())+"x", + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + row: 2, // Row the layer is in on the tree (0 is the first row) + milestones: { + 0: { + requirementDesc:() => "1 tachyon particle", + effectDesc:() => "You don't lose prestige upgrades on previous resets and this resets", + done() { + return player[this.layer].best.gte(1); + } + }, + 1: { + requirementDesc:() => "2 tachyon particles", + effectDesc:() => "You keep all booster and generator milestones on reset.", + done() { + return player[this.layer].best.gte(2); + } + }, + 2: { + requirementDesc:() => "4 tachyon particles", + effectDesc:() => "You keep booster and generator upgrades on reset.", + done() { + return player[this.layer].best.gte(4); + } + }, + 3: { + requirementDesc:() => "5 tachyon particles", + effectDesc:() => "Boosters and generators do not reset everything.", + done() { + return player[this.layer].best.gte(5); + } + }, + 4: { + requirementDesc:() => "8 tachyon particles", + effectDesc:() => "Automate boosters and generators.", + done() { + return player[this.layer].best.gte(8); + }, + toggles: [ + ["b", "auto"], + ["g", "auto"] + ] + } + }, + dilationMult() { + let mult = layers[this.layer].effect() + if (player.d.unl) mult = mult.times(layers.d.buyables[21].effect(player.d.buyables[21]).first) + return mult + }, + buyables: { + rows: 2, + cols: 3, + 11: { + title:() => "Dilated Prestige Points", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + return new Decimal(0) + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x.add(1).root(2) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return data.canAfford + ? "You have " + format(player[this.layer].buyables[this.id], 0) + " dilated prestige points, which are boosting prestige point multiplier by " + format(data.effect.first) + "x.\n\n\ + Dilation is currently " + (player[this.layer].banking == 1 ? "enabled.\n\ + Click here to disable dilation and gain " + format(player.p.points.mul(layers[this.layer].dilationMult()).sub(player.d.buyables[11]).max(0), 0) + " dilated prestige points." : "disabled.\n\ + Click here to enable dilation, which will force a dilation reset and square root all of your point generation speed, prestige point gain, generator effects, booster effects, and disable the second Prestige Upgrade.") + : "You need to obtain at least 2 tachyon particles before you can use this function." + }, + unl() { return player[this.layer].unl }, + canAfford() { + return true}, + buy() { + if (player.d.banking == 1) player.d.buyables[11] = player.d.buyables[11].max(player.p.points.mul(layers[this.layer].dilationMult())) + player.d.banking = player.d.banking == 1 ? 0 : 1 + doReset(this.layer, true) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 12: { + title:() => "Dilated Points", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + return new Decimal(0) + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x.add(1) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return data.canAfford + ? "You have " + format(player[this.layer].buyables[this.id], 0) + " dilated points, which are boosting point multiplier by " + format(data.effect.first) + "x.\n\n\ + Dilation is currently " + (player[this.layer].banking == 2 ? "enabled.\n\ + Click here to disable dilation and gain " + format(player.points.mul(layers[this.layer].dilationMult()).sub(player.d.buyables[12]).max(0), 0) + " dilated prestige points." : "disabled.\n\ + Click here to enable dilation, which will force a dilation reset and apply logarithm to your point generation.") + : "You need to obtain at least 3 tachyon particles before you can use this function." + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].points.gte(3)}, + buy() { + if (player.d.banking == 2) player.d.buyables[12] = player.d.buyables[12].max(player.points.mul(layers[this.layer].dilationMult())) + player.d.banking = player.d.banking == 2 ? 0 : 2 + doReset(this.layer, true) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 13: { + title:() => "Dilated Generator Power", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + return new Decimal(0) + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x.add(1).root(5) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return data.canAfford + ? "You have " + format(player[this.layer].buyables[this.id], 0) + " dilated generator power, which are boosting generator power gain by " + format(data.effect.first) + "x.\n\n\ + Dilation is currently " + (player[this.layer].banking == 3 ? "enabled.\n\ + Click here to disable dilation and gain " + format(player.g.power.mul(layers[this.layer].dilationMult()).sub(player.d.buyables[13]).max(0), 0) + " dilated generator power." : "disabled.\n\ + Click here to enable dilation, which will force a dilation reset, lock the generator and booster bases at 2, and double booster and generator cost multiplier.") + : "You need to obtain at least 7 tachyon particles before you can use this function." + }, + unl() { return player[this.layer].unl }, + canAfford() { + return player[this.layer].points.gte(7)}, + buy() { + if (player.d.banking == 3) player.d.buyables[13] = player.d.buyables[13].max(player.g.power.mul(layers[this.layer].dilationMult())) + player.d.banking = player.d.banking == 3 ? 0 : 3 + doReset(this.layer, true) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 21: { + title:() => "Dilation Boost", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + let cost = Decimal.pow("5000", x.add(1)) + return { + 1: cost.floor(), + 2: cost.sqrt().div(50).floor(), + 3: cost.pow(2).floor() + } + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = Decimal.pow(4, x) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Cost: " + format(data.cost[1]) + " dilated prestige points, " + format(data.cost[2]) + " dilated points, " + format(data.cost[3]) + " dilated generator power\n\ + Amount: " + player[this.layer].buyables[this.id] + "\n\ + Multiply all dilation currency gain by " + format(data.effect.first) + "x" + }, + unl() { return player[this.layer].unl }, + canAfford() { + return (player[this.layer].buyables[11].gte(tmp[this.layer].buyables[this.id].cost[1]) && player[this.layer].buyables[12].gte(tmp[this.layer].buyables[this.id].cost[2]) && player[this.layer].buyables[13].gte(tmp[this.layer].buyables[this.id].cost[3])) + }, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].buyables[11] = player[this.layer].buyables[11].sub(cost[1]) + player[this.layer].buyables[12] = player[this.layer].buyables[12].sub(cost[2]) + player[this.layer].buyables[13] = player[this.layer].buyables[13].sub(cost[3]) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 22: { + title:() => "shh", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + + let cost = Decimal.pow("5000", x.add(1)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Why are you here" + }, + unl() { return false }, + canAfford() { + return player[this.layer].buyables[11].gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].buyables[11] = player[this.layer].buyables[11].sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + 23: { + title:() => "shh", // Optional, displayed at the top in a larger font + cost() { // cost for buying xth buyable, can be an object if there are multiple currencies + let x = player[this.layer].buyables[this.id] + + let cost = Decimal.pow("5000", x.add(1)) + return cost.floor() + }, + effect() { // Effects of owning x of the items, x is a decimal + let x = player[this.layer].buyables[this.id] + let eff = {} + eff.first = x + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + return "Why are you here" + }, + unl() { return false }, + canAfford() { + return player[this.layer].buyables[11].gte(tmp[this.layer].buyables[this.id].cost)}, + buy() { + cost = tmp[this.layer].buyables[this.id].cost + player[this.layer].buyables[11] = player[this.layer].buyables[11].sub(cost) + player[this.layer].buyables[this.id] = player[this.layer].buyables[this.id].add(1) + }, + buyMax() {}, // You'll have to handle this yourself if you want + }, + }, + upgrades: { + rows: 1, + cols: 1, + 11: { + desc:() => "This layer no longer uses order.", + cost:() => new Decimal(15), + unl() { return player[this.layer].order > 0 }, // The upgrade is only visible when this is true + }, + }, + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + if(layers[resettingLayer].row > this.row-1) player.r.power = new Decimal(1) + }, + layerShown() {return player.b.unl}, // Condition for when layer appears on the tree + automate() { + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + resetsNothing() {return false}, + onPrestige(gain) { + return + }, // 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. + update(diff) { + }, + hotkeys: [ + {key: "d", desc: "D: Reset prestige points for tachyon particles.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + prestigeButtonText() { //Is secretly HTML + return `Convert your prestige points into +${formatWhole(tmp[layer].resetGain)} ${layers[layer].resource}

${(tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&layers[layer].canBuyMax && layers[layer].canBuyMax())?"Next":"Req"}: ${formatWhole(tmp[layer].baseAmount)} / ${(layers[layer].resCeil ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ layers[layer].baseResource }` + }, + getResetGain() { + if ((!layers[layer].canBuyMax()) || tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(1) + let gain = tmp[layer].baseAmount.div(tmp[layer].requires).div(tmp[layer].gainMult).max(1).log(layers[layer].base).times(tmp[layer].gainExp).pow(Decimal.pow(layers[layer].exponent, -1)) + if (gain.gte(12)) { + gain = gain.times(12).sqrt() + } + if (gain.gte(1225)) gain = gain.times(Decimal.pow(1225, 9)).pow(0.1) + return gain.floor().sub(player[layer].points).add(1).max(1); + }, + getNextAt() { + let amt = player[layer].points + if (amt.gte(1225)) amt = amt.pow(10).div(Decimal.pow(1225, 9)) + if (amt.gte(12)) { + amt = amt.pow(2).div(12) + } + let extraCost = Decimal.pow(layers[layer].base, amt.pow(layers[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() + return cost; + }, + canReset() { + return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt) + }, + tooltipLocked() { // Optional, tooltip displays when the layer is locked + return ("(Idle layer) This layer requires " + this.requires() + " prestige points. You only have " + formatWhole(player.p.points)) + }, + incr_order: ["r", "e"], + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your prestige points into "}, {}], + "upgrades", "buyables", ["blank", "25px"], "milestones"], + branches: [["b", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + +addLayer("pr", { + startData() { return { + unl: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [], + power: new Decimal(1), + order: 0 + }}, + color:() => "#e8d684", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(68) + return req + }, // Can be a function that takes requirement increases into account + resource: "ascension power", // Name of prestige currency + baseResource: "boosters", // Name of resource prestige is based on + baseAmount() {return player.b.points}, // Get the current amount of baseResource + type: "static", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.850, // Prestige currency exponent + base: 1.03, // Only needed for static layers, base of the formula (b^(x^exp)) + resCeil: true, // True if the cost needs to be rounded up (use when baseResource is static?) + canBuyMax() {return true}, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + row: 2, // Row the layer is in on the tree (0 is the first row) + effect() { + let base = new Decimal(1.03) + return Decimal.pow(base, player[this.layer].points.sub(8).max(0).sqrt()) + }, + effectDescription:() => "increasing the perk power by "+format(layers[this.layer].effect().sub(1).mul(100))+"%", + maxActivePerks() { + let number = 1; + if (player.s.challs.includes(11)) number += 1 + return number + }, + activePerks() { + let number = 0; + for (var i in player[this.layer].buyables) { + if (player[this.layer].buyables[i].gt(0)) number += 1 + } + return number + }, + perkPower() { + let power = layers[this.layer].effect() + return power + }, + buyables: { + rows: 1, + cols: 4, + 11: { + title:() => "Cost Perk", // Optional, displayed at the top in a larger font + cost(x) { // cost for buying xth buyable, can be an object if there are multiple currencies + let multiplier = new Decimal(30) + return multiplier + }, + effect(x) { // Effects of owning x of the items, x is a decimal + let eff = {} + eff.first = new Decimal(1e7) + eff.first = eff.first.pow(layers[this.layer].perkPower()) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + let activeThing = (player[this.layer].buyables[this.id].gt(1) ? "Active for "+format(player[this.layer].buyables[this.id], 0)+" seconds" : "Not Active") + + "\n\ + Divide booster and generator costs by /" + format(data.effect.first) + return activeThing + }, + unl() { return player[this.layer].unl }, + canAfford() { + return (layers[this.layer].activePerks() < layers[this.layer].maxActivePerks()) }, + buy() { + if (player[this.layer].buyables[this.id].gt(0)) return; + player[this.layer].buyables[this.id] = layers[this.layer].buyables[this.id].cost() + }, + }, + 12: { + title:() => "Base Perk", // Optional, displayed at the top in a larger font + cost(x) { // cost for buying xth buyable, can be an object if there are multiple currencies + let multiplier = new Decimal(30) + return multiplier + }, + effect(x) { // Effects of owning x of the items, x is a decimal + let eff = {} + eff.first = new Decimal(2) + eff.first = eff.first.pow(layers[this.layer].perkPower()) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + let activeThing = (player[this.layer].buyables[this.id].gt(1) ? "Active for "+format(player[this.layer].buyables[this.id], 0)+" seconds" : "Not Active") + + "\n\ + Add +" + format(data.effect.first) + " to the generator and booster bases" + return activeThing + }, + unl() { return player[this.layer].unl }, + canAfford() { + return (layers[this.layer].activePerks() < layers[this.layer].maxActivePerks()) }, + buy() { + if (player[this.layer].buyables[this.id].gt(0)) return; + player[this.layer].buyables[this.id] = layers[this.layer].buyables[this.id].cost() + }, + }, + 13: { + title:() => "Multiplier Perk", // Optional, displayed at the top in a larger font + cost(x) { // cost for buying xth buyable, can be an object if there are multiple currencies + let multiplier = new Decimal(30) + return multiplier + }, + effect(x) { // Effects of owning x of the items, x is a decimal + let eff = {} + eff.first = new Decimal(1e15) + eff.first = eff.first.pow(layers[this.layer].perkPower()) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + let activeThing = (player[this.layer].buyables[this.id].gt(1) ? "Active for "+format(player[this.layer].buyables[this.id], 0)+" seconds" : "Not Active") + + "\n\ + Multiply prestige point and prestige point gain by x" + format(data.effect.first, 1) + return activeThing + }, + unl() { return player[this.layer].unl }, + canAfford() { + return (layers[this.layer].activePerks() < layers[this.layer].maxActivePerks()) }, + buy() { + if (player[this.layer].buyables[this.id].gt(0)) return; + player[this.layer].buyables[this.id] = layers[this.layer].buyables[this.id].cost() + }, + }, + 14: { + title:() => "Bonus Perk", // Optional, displayed at the top in a larger font + cost(x) { // cost for buying xth buyable, can be an object if there are multiple currencies + let multiplier = new Decimal(30) + return multiplier + }, + effect(x) { // Effects of owning x of the items, x is a decimal + let eff = {} + eff.first = new Decimal(5) + eff.first = eff.first.pow(layers[this.layer].perkPower()) + return eff; + }, + display() { // Everything else displayed in the buyable button after the title + let data = tmp[this.layer].buyables[this.id] + let activeThing = (player[this.layer].buyables[this.id].gt(1) ? "Active for "+format(player[this.layer].buyables[this.id], 0)+" seconds" : "Not Active") + + "\n\ + Add +" + format(data.effect.first, 1) + " free boosters and generators" + return activeThing + }, + unl() { return player.s.challs.includes(12) }, + canAfford() { + return (layers[this.layer].activePerks() < layers[this.layer].maxActivePerks()) }, + buy() { + if (player[this.layer].buyables[this.id].gt(0)) return; + player[this.layer].buyables[this.id] = layers[this.layer].buyables[this.id].cost() + }, + }, + }, + layerShown() {return player.d.unl && player.e.unl && player.r.unl}, // Condition for when layer appears on the tree + automate() { + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + resetsNothing() {return true}, + onPrestige(gain) { + return + }, // 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. + update(diff) { + for (var i in player[this.layer].buyables) { + player[this.layer].buyables[i] = player[this.layer].buyables[i].sub(diff).max(0) + } + }, + hotkeys: [ + {key: "P", desc: "Shift+P: Reset boosters for ascension power.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + incr_order: ["s"], + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}, {}], + ["display-text", + function() {return '(Perk Power: '+format((layers.pr.perkPower()?layers.pr.perkPower():new Decimal(1)).mul(100))+'%)'}, + {"font-size": "16px", "color": "orange"}], + "buyables", ["blank", "25px"], "milestones"], + branches: [["b", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) + +addLayer("s", { + startData() { return { + unl: false, + points: new Decimal(0), + best: new Decimal(0), + total: new Decimal(0), + milestones: [], + order: 0 + }}, + color:() => "#fab4d9", + background:() => 'https://cdn.glitch.com/7460ed4d-c31b-459d-8407-710f48e787a3%2Fefdb5b70-5e55-4f23-9524-953a8eea4545.image.png?v=1601771864943', + requires() { + let req = new Decimal(67) + return req + }, // Can be a function that takes requirement increases into account + resource: "stadium power", // Name of prestige currency + baseResource: "generators", // Name of resource prestige is based on + baseAmount() {return player.g.points}, // Get the current amount of baseResource + type: "static", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.850, // Prestige currency exponent + base: 1.03, // Only needed for static layers, base of the formula (b^(x^exp)) + resCeil: true, // True if the cost needs to be rounded up (use when baseResource is static?) + canBuyMax() {return true}, // Only needed for static layers with buy max + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + effect() { + let base = new Decimal(1.02) + return Decimal.pow(base, player[this.layer].points.sub(8).max(0).add(1.25).log10()) + }, + effectDescription:() => "increasing the second prestige upgrade power by "+format(layers[this.layer].effect().sub(1).mul(100))+"%", + row: 2, // Row the layer is in on the tree (0 is the first row) + doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. + if(layers[resettingLayer].row > this.row-1) player.r.power = new Decimal(1) + }, + layerShown() {return player.d.unl && player.e.unl && player.r.unl}, // Condition for when layer appears on the tree + automate() { + }, // Do any automation inherent to this layer if appropriate + updateTemp() { + }, // Do any necessary temp updating, not that important usually + challengeUnlocks: ["1.80e308", "1e340", "1e370", "1e800"], + getChallengeUnlock() { + let number = 0 + for (var i in layers[this.layer].challs) { + if (layers[this.layer].challs[i].unl) if (layers[this.layer].challs[i].unl()) number += 1 + } + return number + }, + challs: { + rows: 2, + cols: 2, + 11: { + name:() => "Spaceon", + desc:() => "Prestige point gain is raised to the 10th root.", + unl() { return player.points.gt(layers[this.layer].challengeUnlocks[0]) || player[this.layer].challs.includes(11) || player[this.layer].active == 11 }, + goal:() => new Decimal("10000"), + currencyDisplayName: "prestige points", // Use if using a nonstandard currency + currencyInternalName: "points", // Use if using a nonstandard currency + currencyLayer: "p", // Leave empty if not in a layer + reward:() => "You can have two perks active at once.", + }, + 12: { + name:() => "Infinity", + desc:() => "Booster and generators are 90% weaker.", + unl() { return player.points.gt(layers[this.layer].challengeUnlocks[1]) || player[this.layer].challs.includes(12) || player[this.layer].active == 12 }, + goal:() => new Decimal("1e137"), + currencyDisplayName: "prestige points", // Use if using a nonstandard currency + currencyInternalName: "points", // Use if using a nonstandard currency + currencyLayer: "p", // Leave empty if not in a layer + reward:() => "Unlock a new perk, and generator and booster cost is divided by stadium and ascension power.", + effect() { + let ret = player[this.layer].points.add(player.pr.points).mul(100).pow(3).add(1) + return ret; + }, + effectDisplay(x) { return "/"+format(x) }, + }, + 21: { + name:() => "Eternity", + desc:() => "Time speed is reduced based on your points. (Hold P for more prestige gain)", + unl() { return player.points.gt(layers[this.layer].challengeUnlocks[2]) || player[this.layer].challs.includes(21) || player[this.layer].active == 21 }, + goal:() => new Decimal("1e147"), + currencyDisplayName: "prestige points", // Use if using a nonstandard currency + currencyInternalName: "points", // Use if using a nonstandard currency + currencyLayer: "p", // Leave empty if not in a layer + reward:() => "Generators and boosters multiply prestige point gain.", + effect() { + let ret = player.g.points.add(player.b.points).mul(1e5).pow(2).add(1) + return ret; + }, + effectDisplay(x) { return format(x)+"x" }, + }, + 22: { + name:() => "???", + desc:() => "Time speed is reduced based on your points.", + unl() { return player.points.gt(layers[this.layer].challengeUnlocks[3]) || player[this.layer].challs.includes(22) || player[this.layer].active == 22 }, + goal:() => new Decimal("1e50"), + currencyDisplayName: "prestige points", // Use if using a nonstandard currency + currencyInternalName: "points", // Use if using a nonstandard currency + currencyLayer: "p", // Leave empty if not in a layer + reward:() => "Generators and boosters multiply prestige point gain.", + effect() { + let ret = player.g.points.add(player.b.points).mul(1e5).pow(2).add(1) + return ret; + }, + effectDisplay(x) { return format(x)+"x" }, + }, + }, + resetsNothing() {return true}, + onPrestige(gain) { + return + }, // 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. + update(diff) { + }, + onReset() { + if (player[this.layer].active) doReset("d", true) + }, + hotkeys: [ + {key: "s", desc: "S: Reset generators for stadium power.", onPress(){if (player[this.layer].unl) doReset(this.layer)}}, + ], + + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. + tabFormat: ["main-display", + ["prestige-button", function() {return "Convert your points into "}, {}], + ["display-text", + function() {return 'Next stadium challenge at '+format(layers["s"].challengeUnlocks[layers["s"].getChallengeUnlock()])+" points."}, + {"font-size": "14px"}], "blank", "blank", + ["display-text", + function() {return '(Note: Perks do not work in stadium challenges)'}, + {"font-size": "10px"}], + "challs"], + branches: [["g", 1]] + /*style() {return { + 'background-color': '#3325CC' + }},*/ +}) \ No newline at end of file diff --git a/js/v.js b/js/v.js index 09e8191..3870889 100644 --- a/js/v.js +++ b/js/v.js @@ -5,17 +5,10 @@ function loadVue() { Vue.component('display-text', { props: ['layer', 'data'], template: ` - + ` }) - // data = a function returning html content, with some limited functionality - Vue.component('raw-html', { - props: ['layer', 'data'], - template: ` - - ` - }) // Blank space, data = optional height in px or pair with width and height in px Vue.component('blank', { @@ -33,7 +26,7 @@ function loadVue() { Vue.component('display-image', { props: ['layer', 'data'], template: ` - + ` }) @@ -45,8 +38,8 @@ function loadVue() {
-
-
+
+
@@ -60,9 +53,9 @@ function loadVue() {
-
-
-
+
+
+