diff --git a/Old Code/archivedFunctions.js b/Old Code/archivedFunctions.js deleted file mode 100644 index 532ce83..0000000 --- a/Old Code/archivedFunctions.js +++ /dev/null @@ -1,1216 +0,0 @@ - -function getScaling12Boosters() { - let x = new Decimal(1) - if (player.ps.upgrades.includes(22)) x = x.times(LAYER_UPGS.ps[22].currently()) - return x -} - -function addToBoosterBase() { - let toAdd = new Decimal(0) - if (player.b.upgrades.includes(12)) toAdd = toAdd.add(LAYER_UPGS.b[12].currently()) - if (player.b.upgrades.includes(13)) toAdd = toAdd.add(LAYER_UPGS.b[13].currently()) - if (player.t.upgrades.includes(11)&&!(tmp.challActive?tmp.challActive.h[12]:true)) toAdd = toAdd.add(LAYER_UPGS.t[11].currently()) - if (player.t.upgrades.includes(31)&&!(tmp.challActive?tmp.challActive.h[12]:true)) toAdd = toAdd.add(25) - if (player.t.upgrades.includes(33)&&!(tmp.challActive?tmp.challActive.h[12]:true)) toAdd = toAdd.add(40) - if (player.e.unl) toAdd = toAdd.add(tmp.enhEff2) - if (player.e.upgrades.includes(11)&&!(tmp.challActive?tmp.challActive.h[12]:true)) toAdd = toAdd.add(LAYER_UPGS.e[11].currently().b) - if (player.s.unl && tmp.s !== undefined) toAdd = toAdd.add(tmp.s.sbEff[2]) - if (player.sb.upgrades.includes(21)) toAdd = toAdd.add(LAYER_UPGS.sb[21].currently()) - - if (player.b.upgrades.includes(31)) toAdd = toAdd.times(LAYER_UPGS.b[31].currently()) - if (player.q.upgrades.includes(53)) toAdd = toAdd.times(tmp.enhEff2) - if (player.sb.unl) toAdd = toAdd.times(tmp.layerEffs.sb) - return toAdd -} - -function getFreeBoosters() { - let free = new Decimal(0) - if (player.t.upgrades.includes(24)&&!(tmp.challActive?tmp.challActive.h[12]:true)) free = free.add(18) - if (player.b.upgrades.includes(32)) free = free.add(LAYER_UPGS.b[32].currently()) - if (player.b.upgrades.includes(33)) free = free.add(100) - return free -} - -function getBoosterPower() { - let power = new Decimal(1) - if (spellActive(1)) power = power.times(tmp.spellEffs[1]) - if (player.sp.upgrades.includes(34)) power = power.times(1.25) - return power -} - -function addToGenBase() { - let toAdd = new Decimal(0) - if (player.g.upgrades.includes(12)) toAdd = toAdd.add(LAYER_UPGS.g[12].currently()) - if (player.g.upgrades.includes(13)) toAdd = toAdd.add(LAYER_UPGS.g[13].currently()) - if (player.g.upgrades.includes(33)) toAdd = toAdd.add(LAYER_UPGS.g[33].currently()) - if (player.e.unl) toAdd = toAdd.add(tmp.enhEff2) - if (player.e.upgrades.includes(11)&&!(tmp.challActive?tmp.challActive.h[12]:true)) toAdd = toAdd.add(LAYER_UPGS.e[11].currently().g) - if (player.s.unl && tmp.s !== undefined) toAdd = toAdd.add(tmp.s.sbEff[2]) - - if (player.h.challs.includes(51)) toAdd = toAdd.times(LAYER_CHALLS.h[51].currently()) - if (player.q.upgrades.includes(53)) toAdd = toAdd.times(tmp.enhEff2) - return toAdd -} - -function getGenPow() { - let pow = new Decimal(1) - if (player.g.upgrades.includes(34)) pow = pow.times(LAYER_UPGS.g[34].currently()) - if (player.sp.upgrades.includes(34)) pow = pow.times(1.25) - return pow -} - -function getGenPowerGainMult() { - let mult = new Decimal(1) - if (player.g.upgrades.includes(21)) mult = mult.times(LAYER_UPGS.g[21].currently()) - if (player.g.upgrades.includes(25)) mult = mult.times(LAYER_UPGS.g[25].currently()) - if (player.e.upgrades.includes(35)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.e[35].currently()) - if (player.s.upgrades.includes(12)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.s[12].currently()) - if (player.s.upgrades.includes(13)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.s[13].currently()) - if (player.q.unl && tmp.quirkEff) mult = mult.times(tmp.quirkEff) - if (player.g.upgrades.includes(35)) mult = mult.times(LAYER_UPGS.g[35].currently()) - return mult -} - -function getGenPowerEffExp() { - let exp = new Decimal(1/3) - if (player.s.upgrades.includes(34)&&!(tmp.challActive?tmp.challActive.h[12]:true)) exp = exp.add(LAYER_UPGS.s[34].currently()) - if (player.b.upgrades.includes(21)) exp = exp.times(2) - if (player.b.upgrades.includes(22)) exp = exp.times(1.2) - if (player.e.upgrades.includes(21)&&!(tmp.challActive?tmp.challActive.h[12]:true)) exp = exp.times(1.15) - if (player.h.challs.includes(11)) exp = exp.times(1.25) - if (player.h.challs.includes(42)) exp = exp.times(3) - return exp; -} - -function getGenPowerEff() { - if (tmp.challActive ? tmp.challActive.h[11] : true) return new Decimal(1) - let eff = player.g.power.add(1).pow(getGenPowerEffExp()); - return eff -} - - -function getEnhancerPow() { - if (tmp.challActive ? tmp.challActive.h[22] : true) return new Decimal(0); - if (tmp.challActive ? tmp.challActive.h[41] : true) return new Decimal(0); - let pow = new Decimal(1) - if (player.e.upgrades.includes(25)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(LAYER_UPGS.e[25].currently()) - if (player.e.upgrades.includes(31)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(LAYER_UPGS.e[31].currently()) - if (player.h.challs.includes(31)) pow = pow.times(2) - if (player.q.upgrades.includes(42)) pow = pow.times(1.4) - if (player.ba.upgrades.includes(32)) pow = pow.times(LAYER_UPGS.ba[32].currently()) - return pow -} - -function getEnhancerEff() { - if (!player.e.unl) return new Decimal(1) - let e = player.e.enhancers.sub(tmp.subbedEnh).times(tmp.enhPow) - let eff; - if (e.gte(0)) eff = Decimal.pow(25, e.pow(1.1)) - else eff = Decimal.pow(1/25, e.times(-1).pow(1.1)) - return eff -} - -function getEnhancerEff2() { - if (!player.e.unl) return new Decimal(0) - let e = player.e.enhancers.sub(tmp.subbedEnh).times(tmp.enhPow) - let eff; - if (e.gte(0)) eff = e.pow(0.8) - else eff = e.times(-1).pow(0.8).times(-1) - return eff; -} - -function getEnhancerCost() { - let e = player.e.enhancers - if (e.gte(25)) e = e.pow(2).div(25) - let cost = Decimal.pow(2, e.pow(1.5)) - return cost.floor() -} - -function buyEnhancer() { - let cost = getEnhancerCost() - if (player.e.points.lt(cost)) return - player.e.points = player.e.points.sub(cost) - player.e.enhancers = player.e.enhancers.add(1) -} - -function maxEnhancers() { - let target = player.e.points.max(1).log(2).root(1.5) - if (target.gte(25)) target = target.times(25).sqrt() - target = target.add(1).floor() - if (target.lte(player.e.enhancers)) return - player.e.enhancers = player.e.enhancers.max(target) -} - -function getFreeExtCapsules() { - let amt = new Decimal(0) - if (player.t.upgrades.includes(12)&&!(tmp.challActive?tmp.challActive.h[12]:true)) amt = amt.add(1) - if (player.h.unl) amt = amt.add(tmp.layerEffs.h) - return amt -} - -function getCapPow() { - if (tmp.challActive ? tmp.challActive.h[41] : true) return new Decimal(0) - let pow = new Decimal(1) - if (player.q.upgrades.includes(33)) pow = pow.times(LAYER_UPGS.q[33].currently()) - if (spellActive(2)) pow = pow.times(tmp.spellEffs[2]) - return pow -} - -function getFreeExtPow() { - if (tmp.challActive ? tmp.challActive.h[22] : true) return new Decimal(0) - let pow = new Decimal(1) - return pow -} - -function getTimeEnergyEff() { - if (!player.t.unl) return new Decimal(1) - let exp = 1.2 - if (player.t.upgrades.includes(21)&&!(tmp.challActive?tmp.challActive.h[12]:true)) exp = 1.75 - let eff = player.t.energy.add(1).pow(exp) - return eff; -} - -function getTimeEnergyGainMult() { - if (!player.t.unl) return new Decimal(1) - let mult = new Decimal(1); - if (player.t.upgrades.includes(21)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[21].currently()) - if (player.t.upgrades.includes(22)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[22].currently()) - if (player.t.upgrades.includes(23)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[23].currently()) - if (player.t.upgrades.includes(34)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[34].currently()) - return mult; -} - -function getTimeEnergyLimitMult() { - if (!player.t.unl) return new Decimal(1) - let mult = new Decimal(1); - if (player.t.upgrades.includes(12)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[12].currently()) - if (player.t.upgrades.includes(21)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[21].currently()) - if (player.t.upgrades.includes(22)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[22].currently()) - if (player.t.upgrades.includes(23)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[23].currently()) - if (player.t.upgrades.includes(34)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mult = mult.times(LAYER_UPGS.t[34].currently()) - if (player.q.upgrades.includes(23)) mult = mult.times(1e10) - if (player.q.upgrades.includes(24)) mult = mult.times(LAYER_UPGS.q[24].currently()) - if (player.m.upgrades.includes(23)) mult = mult.times("1e500") - return mult; -} - -function getExtCapsuleCost() { - let amt = player.t.extCapsules - if (amt.gte(25) && !player.ba.upgrades.includes(43)) amt = amt.pow(2).div(25) - let cost = amt.times(0.4).pow(1.2).add(1).times(10) - return cost.floor() -} - -function buyExtCapsule() { - if (!player.t.unl) return - let cost = getExtCapsuleCost() - if (player.b.points.lt(cost)) return - player.b.points = player.b.points.sub(cost) - player.t.extCapsules = player.t.extCapsules.add(1) -} - -function maxExtTimeCapsules() { - let target = player.b.points.add(1).div(10).sub(1).root(1.2).div(0.4) - if (target.gte(25)&&!player.ba.upgrades.includes(43)) target = target.times(25).sqrt() - target = target.add(1).floor().max(0) - player.t.extCapsules = player.t.extCapsules.max(target) -} - -function addToTimeBase() { - let toAdd = new Decimal(0) - if (player.m.upgrades.includes(44)) toAdd = toAdd.add(LAYER_UPGS.m[44].currently()) - return toAdd -} - -function multiplyToTimeBase() { - let x = new Decimal(1) - if (player.l.unl && tmp.l !== undefined) x = x.times(tmp.l.lbEff[3]) - return x -} - -function getSpace() { - let baseSpace = player.s.best.pow(1.1).times(3).floor() - if (player.s.upgrades.includes(13)&&!(tmp.challActive?tmp.challActive.h[12]:true)) baseSpace = baseSpace.add(2); - if (player.s.upgrades.includes(24)&&!(tmp.challActive?tmp.challActive.h[12]:true)) baseSpace = baseSpace.add(3); - if (player.ss.unl) baseSpace = baseSpace.add(tmp.ssEff1) - if (player.ss.upgrades.includes(11)) baseSpace = baseSpace.add(LAYER_UPGS.ss[11].currently()) - return baseSpace.sub(player.s.spent).max(0) -} - -let SPACE_BUILDINGS = { - max: 10, - 1: { - cost: new Decimal(1e3), - eff(x) { - let ret = Decimal.pow(Decimal.add(1, x.pow((player.s.upgrades.includes(31)&&!(tmp.challActive?tmp.challActive.h[12]:true))?2.75:1)), player.s.points.sqrt()).times(Decimal.mul(4, x.pow((player.s.upgrades.includes(31)&&!(tmp.challActive?tmp.challActive.h[12]:true))?2.75:1))).max(1) - if (player.ba.upgrades.includes(42)) ret = ret.pow(LAYER_UPGS.ba[42].currently()) - return ret - }, - effDesc(x) { - return "Space Energy boosts Point gain & Prestige Point gain ("+format(x)+"x)" - } - }, - 2: { - cost: new Decimal(1e10), - eff(x) { - if (player.s.upgrades.includes(43)) { - x = Decimal.pow(1.0001, x).times(x.sqrt()) - if (x.gte("e600")) x = Decimal.pow(10, x.log10().times(600).sqrt()) - return x - } else return x.sqrt() - }, - effDesc(x) { - return "Adds to base of Booster/Generator effects by "+format(x) - } - }, - 3: { - cost: new Decimal(1e25), - eff(x) { - x = Decimal.pow(1e18, x.pow(0.9)) - if (x.gte("e3e9")) x = Decimal.pow(10, x.log10().times(9e18).cbrt()) - return x - }, - effDesc(x) { - return "Makes Boosters/Generators cheaper by "+format(x)+"x" - } - }, - 4: { - cost: new Decimal(1e48), - eff(x) { - let ret = x.add(1).pow(1.25) - if (ret.gte(1e6)) ret = ret.log10().times(1e6/6) - return ret; - }, - effDesc(x) { - return "Booster Upgrade 6's effect is raised to the power of "+format(x) - } - }, - 5: { - cost: new Decimal(1e100), - eff(x) { - return x.sqrt().times(2) - }, - effDesc(x) { - return "Add "+format(x)+" free levels to all previous Space Buildings" - } - }, - 6: { - cost: new Decimal("e6000000"), - eff(x) { - return x.div(1e3).add(1).sqrt() - }, - effDesc(x) { - return "You produce Life Power " + format(x) + "x faster" - } - }, - 7: { - cost: new Decimal("e6500000"), - eff(x) { - return Decimal.pow(1.05, x) - }, - effDesc(x) { - return "Reduce the requirement of Phantom Souls by " + format(x) + "x" - } - }, - 8: { - cost: new Decimal("e7000000"), - eff(x) { - return x.sqrt().div(100) - }, - effDesc(x) { - return "Gain " + format(x) + " free extra Quirk layers" - } - }, - 9: { - cost: new Decimal("e8000000"), - eff(x) { - return x.max(1).log10().div(3).max(1).cbrt() - }, - effDesc(x) { - return "Reduce the cost scaling of Hyperspace by " + format(Decimal.sub(1, x.recip()).times(100)) + "%" - } - }, - 10: { - cost: new Decimal("e9500000"), - eff(x) { - return x.max(1).log10().div(5).max(1) - }, - effDesc(x) { - return "Super-Upgrades are " + format(x.sub(1).times(100)) + "% stronger" - } - }, -} - -function getSpaceBuildingCostMod() { - let mod = new Decimal(1) - if (player.s.upgrades.includes(24)&&!(tmp.challActive?tmp.challActive.h[12]:true)) mod = mod.times(0.5) - if (player.s.upgrades.includes(42)) mod = mod.times(0.6) - if (spellActive(4)) mod = mod.times(Decimal.sub(1, tmp.spellEffs[4].sub(1))) - if (player.ba.upgrades.includes(15)) mod = mod.div(LAYER_UPGS.ba[15].currently()) - return mod; -} - -function getSpaceBuildingCostMult() { - let mult = new Decimal(1) - if (player.ss.unl) mult = mult.div(tmp.ssEff2) - if (player.s.upgrades.includes(41)) mult = mult.div(LAYER_UPGS.s[41].currently()) - return mult -} - -function getSpaceBuildingCost(x) { - let inputVal = SPACE_BUILDINGS[x].cost - let bought = tmp.s.sb[x] - if (bought.gte(100)) bought = bought.pow(2).div(100) - let cost = Decimal.pow(inputVal, bought.times(tmp.s.sbCostMod).pow(1.35)).times(inputVal).times((bought.gt(0)||x>1)?1:0).times(tmp.s.sbCostMult) - return cost -} - -function getSpaceBuildingTarg(x) { - let inputVal = SPACE_BUILDINGS[x].cost - let target = player.g.power.div(tmp.s.sbCostMult).div(inputVal).max(1).log(inputVal).pow(1/1.35).div(tmp.s.sbCostMod) - if (target.gte(100)) target = target.times(100).sqrt() - return target.add(1).floor() -} - -function getSpaceBuildingPow() { - if (!player.s.unl) return new Decimal(0) - if (tmp.challActive ? tmp.challActive.h[22] : true) return new Decimal(0) - if (tmp.challActive ? tmp.challActive.h[41] : true) return new Decimal(0) - let pow = new Decimal(1) - if (player.s.upgrades.includes(21)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(LAYER_UPGS.s[21].currently()) - if (player.s.upgrades.includes(22)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(LAYER_UPGS.s[22].currently()) - if (player.s.upgrades.includes(23)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(LAYER_UPGS.s[23].currently()) - if (player.s.upgrades.includes(44)&&!(tmp.challActive?tmp.challActive.h[12]:true)) pow = pow.times(1.25) - if (player.q.upgrades.includes(41)) pow = pow.times(1.4) - if (player.ss.unl) pow = pow.times(tmp.ssEff3) - if (player.ba.upgrades.includes(44)) pow = pow.times(1.5) - return pow -} - -function getExtraBuildingLevels() { - let lvl = new Decimal(0) - if (player.s.upgrades.includes(11)&&!(tmp.challActive?tmp.challActive.h[12]:true)) lvl = lvl.add(1); - if (player.s.upgrades.includes(14)&&!(tmp.challActive?tmp.challActive.h[12]:true)) lvl = lvl.add(1); - if (player.q.upgrades.includes(31)) lvl = lvl.add(1); - if (player.m.upgrades.includes(32)) lvl = lvl.add(LAYER_UPGS.m[32].currently()) - return lvl -} - -function getSpaceBuildingEff(x) { - let bought - if (!player.s.unl) bought = new Decimal(0) - else { - bought = tmp.s.sb[x].add(tmp.s.sbExtra) - if (x < 5 && tmp.s.trueSbUnl >= 5) bought = bought.add(tmp.s.sbEff[5]) - - var compressLvl = new Decimal(1) - if (tmp.i !== undefined && layerUnl("i") && tmp.i.compressed >= x) compressLvl = tmp.s.sbUnl.sub(x - SPACE_BUILDINGS.max - 1).div(SPACE_BUILDINGS.max).ceil().cbrt() - - bought = bought.times(tmp.s.sbPow).times(compressLvl) - if (tmp.hs !== undefined && layerUnl("hs")) { - tmp.hs.suEff[x] = HYPERSPACE.effs[x](bought, fixValue(tmp.hs.su[x]).times(tmp.hs.eff).times(compressLvl)) - bought = bought.times(tmp.hs.suEff[x]) - } - } - return SPACE_BUILDINGS[x].eff(bought) -} - -function getSpaceBuildingEffDesc(x) { - let eff = tmp.s.sbEff[x] - return SPACE_BUILDINGS[x].effDesc(eff) -} - -function buyBuilding(x) { - if (!player.s.unl) return - if (tmp.s.trueSbUnl= 8) layers = layers.add(tmp.s.sbEff[8]) - return layers; -} - -function getQuirkEnergyGainExp() { - let mult = new Decimal(1) - if (spellActive(3)) mult = mult.times(tmp.spellEffs[3]) - return player.q.layers.add(getExtraQuirkLayers()).sub(1).times(mult) -} - -function getQuirkEnergyEff() { - let eff = player.q.energy.add(1).pow(2) - if (player.q.upgrades.includes(12)) { - let mod = player.q.energy.add(1).log10().add(1).log10().add(1) - if (mod.gte(2)) { - eff = eff.times(mod.div(2).pow(10)) - mod = new Decimal(2) - } - eff = eff.pow(mod) - } - if (player.q.upgrades.includes(32)) eff = eff.pow(2) - if (player.h.challs.includes(61)) eff = eff.pow(1.2) - if (player.ba.upgrades.includes(13)) eff = eff.pow(3) - return eff; -} - -function buyQuirkLayer() { - if (!player.q.unl) return - let cost = getQuirkLayerCost() - if (player.q.points.lt(cost)) return - player.q.points = player.q.points.sub(cost) - player.q.layers = player.q.layers.add(1) -} - -function maxQuirkLayers() { - if (!player.q.unl) return - let cost = getQuirkLayerCost() - if (player.q.points.lt(cost)) return - let target = getQuirkLayerTarg() - if (target.lte(player.q.layers)) return - player.q.points = player.q.points.sub(cost) - player.q.layers = player.q.layers.max(target) -} - - -function getSubspaceEff1() { - if (!player.ss.unl) return new Decimal(0) - let eff = player.ss.subspace.times(player.ss.points).add(1).log10().times(100) - if (player.sp.upgrades.includes(35)) eff = eff.times(LAYER_UPGS.sp[35].currently()) - return eff.floor(); -} - -function getSubspaceEff2() { - if (!player.ss.unl) return new Decimal(1) - let eff = player.ss.subspace.add(1).pow(750) - if (player.sp.upgrades.includes(35)) eff = eff.pow(LAYER_UPGS.sp[35].currently()) - return eff; -} - -function getSubspaceEff3() { - if (!player.ss.unl) return new Decimal(1) - let eff = player.ss.subspace.add(1).log10().add(1).log10().div(2.5).add(1) - if (player.ss.upgrades.includes(13)) eff = eff.times(1.5) - if (player.sp.upgrades.includes(35)) eff = eff.times(LAYER_UPGS.sp[35].currently()) - if (eff.gte(2)) eff = eff.log2().add(1) - return eff; -} - -function getSubspaceGainMult() { - let mult = new Decimal(1) - if (player.ss.upgrades.includes(12)) mult = mult.times(LAYER_UPGS.ss[12].currently()) - if (player.ss.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.ss[22].currently()) - if (player.ss.upgrades.includes(24)) mult = mult.times(LAYER_UPGS.ss[24].currently()) - if (player.ss.upgrades.includes(25)) mult = mult.times(LAYER_UPGS.ss[25].currently()) - if (player.ba.upgrades.includes(12)) mult = mult.times(LAYER_UPGS.ba[12].currently()) - return mult -} - -function addToHBBase() { - let toAdd = new Decimal(0) - if (player.m.upgrades.includes(13)) toAdd = toAdd.add(LAYER_UPGS.m[13].currently()) - if (player.m.upgrades.includes(33)) toAdd = toAdd.add(LAYER_UPGS.m[33].currently()) - return toAdd -} - -function getHyperBoosterExp() { - let exp = new Decimal(1) - if (player.hb.order>0) exp = new Decimal(0.5) - return exp -} - -function getExtraHyperBoosters() { - let x = new Decimal(0) - if (player.l.unl && tmp.l !== undefined) x = x.add(tmp.l.lbEff[1]) - return x -} - -function getHyperBoosterPow() { - let pow = new Decimal(1) - if (player.hb.upgrades.includes(12)) pow = pow.times(LAYER_UPGS.hb[12].currently()) - return pow; -} - -function getBalancePowerEff() { - let eff = player.ba.power.times(2).add(1).pow(2/3) - if (player.ba.upgrades.includes(14)) eff = eff.pow(3.85) - if (player.ba.upgrades.includes(33)) eff = eff.pow(2) - return eff; -} - -function getBalanceTypesEff() { - let mod = player.ba.positivity.add(1).log10().add(1).div(player.ba.negativity.add(1).log10().add(1)).log10().abs().add(1).pow(-1) - let pos = player.ba.positivity.add(1).log10().add(1) - let neg = player.ba.negativity.add(1).log10().add(1) - if (player.ba.upgrades.includes(34)) mod = mod.times(1.5) - if (player.ba.upgrades.includes(53)) mod = mod.times(LAYER_UPGS.ba[53].currently()) - let eff = pos.times(neg).pow(mod) - return eff; -} - -function getBalanceEnergyExp() { - let exp = new Decimal(1) - if (player.ba.unl) exp = exp.times(1.5) - return exp; -} - -function getPosGainMult() { - let mult = new Decimal(1) - if (player.ba.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.ba[22].currently()) - return mult; -} - -function getNegGainMult() { - let mult = new Decimal(1) - if (player.ba.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.ba[22].currently()) - return mult; -} - -function getBalPowGainMult() { - let mult = new Decimal(1) - if (player.sp.upgrades.includes(14)) mult = mult.times(LAYER_UPGS.sp[14].currently()) - return mult; -} - - -const MAX_SPELLS = 4 - -const SPELL_NAMES = { - 1: "Booster Launch", - 2: "Time Warp", - 3: "Quirk Amplification", - 4: "Spacial Compression", -} - -const SPELL_DESCS = { - 1: "Boosters are X% stronger", - 2: "Time Capsules are X% stronger", - 3: "Quirk Layers are X% more efficient", - 4: "Space Buildings cost scale X% slower", -} - -const SPELL_BASE = { - 1: 1.25, - 2: 1.1, - 3: 1.04, - 4: 1.01, -} - -function getSpellPower(x) { - let power = new Decimal(1); - if (player.m.upgrades.includes(11)) power = power.times(LAYER_UPGS.m[11].currently()) - if (player.m.upgrades.includes(21) && (x==2||x==3)) power = power.times(LAYER_UPGS.m[21].currently()) - if (player.m.upgrades.includes(22) && (x==2)) power = power.times(10) - if (player.m.upgrades.includes(41)) { - let casted = player.m.casted[x] - power = power.times(casted.max(1).log10().add(1).log10().div(5).add(1)) - } - if (player.sp.upgrades.includes(23)) power = power.times(LAYER_UPGS.sp[23].currently()) - if (player.ps.upgrades.includes(13)) power = power.times(LAYER_UPGS.ps[13].currently()) - - if (power.gte(50)) power = power.log10().times(50/Math.log10(50)).min(power) - return power.max(1); -} - -function getSpellEff(x) { - let base = SPELL_BASE[x] - let power = getSpellPower(x) - let eff = Decimal.pow(base, power) - if (x==4) eff = Decimal.sub(2, Decimal.div(base, power.log2().add(1))) - return eff -} - -function getSpellDesc(x) { - let desc = SPELL_DESCS[x] - let eff = tmp.spellEffs[x] - return desc.replace("X", format(eff.sub(1).times(100))) -} - -function getSpellTime() { - let time = 60 - if (player.m.total.gte(2.5e9)) time *= 4 - if (player.m.upgrades.includes(43)) time *= LAYER_UPGS.m[43].currently().toNumber() - return time -} - -function spellActive(x) { - if (!player.m.unl) return false - if (!tmp.spellEffs) return false - if (tmp.spellsUnl0 -} - -function activateSpell(x, force=false) { - if (tmp.spellsUnl= 6) x = x.times(tmp.s.sbEff[6]) - return x -} - -function getLifePowerExp() { - let x = tmp.layerEffs.ps.exp - return x -} - -function getLifePowerSoftcapStart() { - let x = tmp.layerEffs.l - return x -} - -function getLifePowerSoftcapExp() { - let x = 1/3 - return x -} - -let LIFE_BOOSTERS = { - max: 5, - unl() { - if (player.ps.upgrades.includes(21)) return 5 - return 4 - }, - calcNewPower(diff) { - if (!player.l.unl) return new Decimal(0) - - let exp = getLifePowerExp() - let cap = getLifePowerSoftcapStart() - let capExp = getLifePowerSoftcapExp() - - let power = player.l.power - if (power.gt(1)) power = power.root(exp) - if (power.gt(cap)) power = power.div(cap).pow(1/capExp).times(cap) - power = power.add(getLifePowerMult().times(diff)) - if (power.gt(cap)) power = power.div(cap).pow(capExp).times(cap) - if (power.gt(1)) power = power.pow(exp) - - return power - }, - eff() { - return player.l.power.add(1).log10() - }, - req(x) { - return tmp.l.lb[x].times(this[x].reqMult).add(this[x].req) - }, - reqTarget(x) { - return player.ps.points.sub(this[x].req).div(this[x].reqMult).add(1).floor() - }, - 1: { - req: new Decimal(1), - reqMult: new Decimal(1), - eff(str) { - return str.pow(0.15).div(3) - }, - effDesc(x) { - return "Add " + format(x) + " Hyper-Boosters to its effect" - } - }, - 2: { - req: new Decimal(1.5), - reqMult: new Decimal(1.5), - eff(str) { - let x = Decimal.pow(1e20, str.pow(0.75)) - if (x.gte("1e400")) x = Decimal.pow(10, x.log10().times(400).sqrt()) - return x - }, - effDesc(x) { - return "Gain " + format(x) + "x more Hexes" - } - }, - 3: { - req: new Decimal(3.5), - reqMult: new Decimal(2.5), - eff(str) { - return str.div(1.5).max(1).log10().add(1) - }, - effDesc(x) { - return "Multiply the base of Time Capsule effect by " + format(x) + "x" - } - }, - 4: { - req: new Decimal(10), - reqMult: new Decimal(3), - eff(str) { - return str.div(40).add(1) - }, - effDesc(x) { - return "Reduce the requirement of Super-Boosters, Super-Generators, and Hyper-Boosters by " + format(x) + "x" - } - }, - 5: { - req: new Decimal(5), - reqMult: new Decimal(6), - eff(str) { - return Decimal.pow(3, str.sqrt()) - }, - effDesc(x) { - return "Gain " + format(x) + "x more Hyperspace Energy" - } - }, -} - -let HYPERSPACE = { - cost(x) { - if (x === undefined) x = player.hs.space - if (tmp.s !== undefined && tmp.s.trueSbUnl >= 9) x = x.div(tmp.s.sbEff[9]) - let reduction = this.costReduction() - return { - hs: Decimal.pow(2, x.sqr()).div(reduction).floor(), - ba: Decimal.pow(10, x.max(x.div(2).sqr()).times(20).add(150)).div(reduction).floor() - } - }, - costReduction() { - let r = new Decimal(1) - if (player.ba.upgrades.includes(45)) r = LAYER_UPGS.ba[45].currently() - return r - }, - canBuy() { - let cost = this.cost() - return player.hs.points.gte(cost.hs) && player.ba.points.gte(cost.ba) - }, - buy() { - let cost = this.cost() - if (!this.canBuy()) return - player.ba.points = player.ba.points.sub(cost.ba) - player.hs.points = player.hs.points.sub(cost.hs) - player.hs.space = player.hs.space.add(1) - }, - canSuperUpg(x) { - return player.hs.space.gt(player.hs.spent) && tmp.hs.su[x].lt(player.hs.superUpgradeCap) - }, - superUpg(x) { - if (!this.canSuperUpg(x)) return - player.hs.spent = player.hs.spent.add(1) - tmp.hs.su[x] = tmp.hs.su[x].add(1) - player.hs.superUpgrades[x] = tmp.hs.su[x] - }, - respec(x) { - if (!player.hs.unl || !confirm("Are you sure?")) return - player.hs.spent = new Decimal(0) - player.hs.superUpgrades = {} - doReset("hs", true) - }, - eff() { - let r = new Decimal(1) - if (player.ba.upgrades.includes(35)) r = r.times(1.25) - if (tmp.s !== undefined && tmp.s.trueSbUnl >= 10) r = r.times(tmp.s.sbEff[10]) - return r - }, - nextCapReq(x) { - if (x === undefined) x = player.hs.superUpgradeCap - return Decimal.times(x, 200).add(1300) - }, - nextCapTarget() { - let x = player.g.points.sub(1300).div(200) - return x.floor().add(1) - }, - effs: { - 1(sb, su) { - return sb.add(1).pow(su.sqrt().times(2.5)) - }, - 2(sb, su) { - return sb.pow(0.25).times(su.sqrt()).div(120).add(1) - }, - 3(sb, su) { - return sb.cbrt().times(su.sqrt()).times(0.75).add(1) - }, - 4(sb, su) { - return Decimal.pow(2.5, sb.cbrt().times(su.sqrt())) - }, - 5(sb, su) { - return sb.add(10).log10().times(su.sqrt()).div(1.75).max(1) - }, - 6(sb, su) { - return Decimal.pow(sb.div(1e3).add(1), su) - }, - 7(sb, su) { - return sb.add(1).log10().times(su.cbrt()).div(25).add(1) - }, - 8(sb, su) { - return sb.times(su.sqr()).div(100).max(1).log10().add(1) - }, - 9(sb, su) { - return sb.times(su).max(1).log10().add(1) - }, - 10(sb, su) { - return sb.add(1).pow(su.cbrt().div(5)) - } - } -} - - -let IMPERIUM = { - lifeReq() { - return Decimal.pow(10, player.i.lifeBricks.times(2).sqr().add(15)) - }, - lifeTarget() { - return player.l.power.log10().sub(15).sqrt().div(2).add(1).floor() - }, - canBuild() { - let cost = this.cost() - return player.i.building || (player.i.points.gte(cost.i) && player.i.lifeBricks.gte(cost.l)) - }, - build() { - if (!this.canBuild()) return - if (player.i.building) { - if (!confirm("Are you sure?")) return - delete player.i.building - } else { - let cost = this.cost() - player.i.points = player.i.points.sub(cost.i) - player.i.lifeBricks = player.i.lifeBricks.sub(cost.l) - player.i.building = 1 - doReset("i", true) - } - player.i.progress = 0 - }, - cost(x) { - if (x === undefined) x = player.i.extraBuildings - let sub = player.sp.upgrades.includes(45) ? 3 : 0 - return { - i: x.times(1.75).add(0.5).sub(sub).ceil(), - l: x.times(1.5).add(1).sub(sub).ceil() - } - }, - speed() { - let x = Decimal.pow(3.75, player.i.extraBuildings.add(5)).recip() - x = x.times(IMPERIUM.sgSpeedBoost()) - if (player.sp.upgrades.includes(45)) x = x.times(5) - return x - }, - sgSpeedBoost() { - return player.sg.points.add(1).pow(2) - }, - collapsed(row) { - return tmp.i !== undefined && tmp.i.collapse !== undefined && tmp.i.collapse[row] - }, - maxCollapseRows: 1 -} - -/*case 1: - var keepUpgrades = 0 - if (player.h.best.gte(1) || player.q.best.gte(1)) keepUpgrades = 1 - else if (LAYER_ROW[layer] == 2 && player[layer].best.gte(layer == "e" ? 10 : 3)) keepUpgrades = 1 - else if (LAYER_ROW[layer] == 1 && player[layer].best.gte(8)) keepUpgrades = 1 - - player.points = new Decimal(10) - player.p.points = new Decimal(0) - if (!keepUpgrades) player.p.upgrades = [] - player.g.power = new Decimal(0) - break; - case 2: - var keepMilestones = 0 - if (player.h.best.gte(2) || player.q.best.gte(2)) keepMilestones = 1 - else if (LAYER_ROW[layer] == 2 && player[layer].best.gte(layer == "sb" ? 4 : 2)) keepMilestones = 1 - - var keepUpgrades = 0 - if (player.sp.total.gte(1)) keepUpgrades = 1 - - player.b.points = new Decimal(0) - if (!keepMilestones) player.b.best = new Decimal(0) - if (!keepUpgrades && !player.t.best.gte(4)) player.b.upgrades = [] - - player.g.points = new Decimal(0) - player.g.power = new Decimal(0) - if (!keepMilestones) player.g.best = new Decimal(0) - if (!keepUpgrades && !player.s.best.gte(4)) player.g.upgrades = [] - - player.t.energy = new Decimal(0) - break - case 3: - player.t.points = new Decimal(0); - player.t.order = 0 - if (player.h.best.lt(2)&&player.m.total.lt(1)) player.t.best = new Decimal(0); - if (player.h.best.lt(4)&&!player.sp.total.gte(1)) player.t.upgrades = []; - player.t.extCapsules = new Decimal(0); - player.e.order = 0 - player.e.points = new Decimal(0); - if (player.h.best.lt(2)&&player.m.total.lt(1)) player.e.best = new Decimal(0); - player.e.enhancers = new Decimal(0); - if (player.h.best.lt(4)&&!player.sp.total.gte(1)) player.e.upgrades = []; - player.s = { - unl: player.s.unl, - order: 0, - points: new Decimal(0), - best: (player.h.best.gte(2)||player.m.total.gte(1)) ? player.s.best : new Decimal(0), - spent: (player.q.best.gte(4)&&(layer=="h"||layer=="q"||layer=="ss"||layer=="hb")) ? player.s.spent : new Decimal(0), - buildings: (player.q.best.gte(4)&&(layer=="h"||layer=="q"||layer=="ss"||layer=="hb")) ? player.s.buildings : ({}), - upgrades: (player.h.best.gte(4)||player.sp.total.gte(1)) ? player.s.upgrades : [], - auto: player.s.auto, - autoBuild: player.s.autoBuild, - } - player.sb = { - unl: player.sb.unl, - auto: player.sb.auto, - order: 0, - points: new Decimal(0), - best: (player.h.best.gte(2)||player.m.total.gte(1)) ? player.sb.best : new Decimal(0), - upgrades: (player.h.best.gte(10)||player.sp.total.gte(1)) ? player.sb.upgrades : [], - } - player.sg = { - unl: player.sg.unl, - auto: player.sg.auto, - points: new Decimal(0), - best: player.sg.best, - power: new Decimal(0), - upgrades: player.sg.upgrades, - } - player.h.time = 0 - player.q.time = new Decimal(0); - player.q.energy = new Decimal(0); - break; - case 4: - player.h = { - unl: player.h.unl, - time: 0, - points: new Decimal(0), - best: (player.ba.best.gte(1)||player.m.total.gte(1))?player.h.best:new Decimal(0), - challs: (player.m.total.gte(2)||player.sp.total.gte(1))?player.h.challs:[], - } - player.q = { - unl: player.q.unl, - auto: player.q.auto, - points: new Decimal(0), - best: (player.ba.best.gte(1)||player.m.total.gte(1))?player.q.best:new Decimal(0), - layers: new Decimal(0), - energy: new Decimal(0), - time: new Decimal(0), - upgrades: (player.ba.best.gte(2)||player.sp.total.gte(1))?player.q.upgrades:[], - } - player.hb = { - unl: player.hb.unl, - auto: player.hb.auto, - order: player.hb.order, - points: new Decimal(0), - best: (player.ba.best.gte(1)||player.m.total.gte(1))?player.hb.best:new Decimal(0), - upgrades: (player.ba.best.gte(5)||player.sp.total.gte(1))?player.hb.upgrades:[], - } - player.ss = { - unl: player.ss.unl, - auto: player.ss.auto, - order: player.ss.order, - points: new Decimal(0), - best: (player.ba.best.gte(1)||player.m.total.gte(1))?player.ss.best:new Decimal(0), - subspace: new Decimal(0), - upgrades: (player.ba.best.gte(5)||player.sp.total.gte(1))?player.ss.upgrades:[], - } - break; - case 5: - player.m = { - unl: player.m.unl, - auto: player.m.auto, - autoIns: player.m.autoIns, - points: new Decimal(0), - best: new Decimal(0), - total: player.sp.total.gte(2) ? player.m.total : new Decimal(0), - spellTimes: { - 1: 0, - 2: 0, - 3: 0, - 4: 0, - }, - hexes: new Decimal(0), - toCast: player.m.toCast, - casted: { - 1: new Decimal(1), - 2: new Decimal(1), - 3: new Decimal(1), - 4: new Decimal(1), - }, - upgrades: player.sp.total.gte(1) ? player.m.upgrades : [], - } - player.ba = { - unl: player.ba.unl, - points: new Decimal(0), - best: player.sp.total.gte(5) ? player.ba.best : new Decimal(0), - power: new Decimal(0), - positivity: new Decimal(0), - negativity: new Decimal(0), - upgrades: player.sp.total.gte(1) ? player.ba.upgrades : [], - } - player.ps = { - unl: player.ps.unl, - auto: player.ps.auto, - points: new Decimal(0), - best: player.ps.best, - upgrades: player.ps.upgrades, - } - player.l.power = new Decimal(0) - break; - case 6: - var start = getStartPlayer() - player.sp = start.sp - player.l = start.l - player.hs = start.hs - player.i = start.i - break;*/ \ No newline at end of file diff --git a/Old Code/archivedHTML.html b/Old Code/archivedHTML.html deleted file mode 100644 index 9a6181a..0000000 --- a/Old Code/archivedHTML.html +++ /dev/null @@ -1,188 +0,0 @@ -
- - - - -

8 Generators


Keep Prestige Upgrades on reset

10 Generators


Gain 100% of Prestige Point gain every second

15 Generators


You can buy max Generators


- You have {{format(player.g.power)}} Generator Power, which multiplies Point gain by {{format(tmp.genPowEff)}} -
-
- - - -

2 enhance points


Keep Booster/Generator milestones on reset

10 enhance points


Keep Prestige Upgrades on reset


- -
-
- - - - - - -

2 time capsules


Keep Booster/Generator milestones on reset

3 time capsules


Keep Prestige Upgrades on reset

4 time capsules


Keep Booster Upgrades on all row 3 resets

5 time capsules


Automatically purchase Boosters   

12 time capsules


Boosters reset nothing


- You have {{format(player.t.energy)}} Time Energy, which multiplies Point gain & Prestige Point gain by {{format(tmp.timeEff)}}
- You have {{ format(player.b.points) }} Boosters

- -
-
- - - - - - -

2 space energy


Keep Booster/Generator milestones on reset

3 space energy


Keep Prestige Upgrades on reset

4 space energy


Keep Generator Upgrades on all row 3 resets

5 space energy


Automatically purchase Generators   

12 space energy


Generators reset nothing


- You have {{formatWhole(getSpace())}} Space remaining for Space Buildings.
- You have {{ format(player.g.power) }} Generator Power

-
-
-
-

-
- -
-
-
-
- -

3 Super-Boosters


Keep Prestige Upgrades on reset

4 Super-Boosters


Keep Booster/Generator milestones on reset
-
-
- - - -

1 Super-Generator


You can buy max Super-Generators, and Super-Generators reset nothing

2 Super-Generators


Automatically purchase Super-Generators   


- You have {{format(player.sg.power)}} Super-Generator Power, which multiplies the Generator base by {{format(tmp.sGenPowEff)}} -
-
- - - - - - - - -

1 Hindrance Spirit


Keep Prestige Upgrades on all previous resets, and gain 100x more Enhance Points

2 Hindrance Spirit


Keep all third row milestones on all fourth row resets, and start with your best-ever Space

4 Hindrance Spirit


Keep Time, Enhance, and Space Upgrades on all fourth row resets

5 Hindrance Spirit


Automatically purchase Extra Time Capsules   

10 Hindrance Spirit


Keep Prestige & Super-Booster Upgrades on all fourth row resets

15 Hindrance Spirit


Automatically purchase Super-Boosters   

25 Hindrance Spirit


Time resets reset nothing

2,500 Hindrance Spirit


Super-Boosters reset nothing
-
-
- - - - - - - - -

1 Quirk


Keep Prestige Upgrades on all previous resets, and gain 100x more Enhance Points

2 Quirks


You can buy max Time Capsules & Space Energy

4 Quirks


Keep Space Buildings on all fourth row resets

5 Quirks


Automatically purchase Enhancers   

10 Quirks


Automatically purchase Time Capsules & Space Energy
 

15 Quirks


Gain 100% of Enhance Point gain every second

25 Quirks


Space resets reset nothing

2,500 Quirks


You can destroy individual Space Buildings


- You have {{format(player.q.energy)}} Quirk Energy (generated by Quirk Layers), which multiplies Point & Generator Power gain by {{format(tmp.quirkEff)}}
- -
-
- - -

1 Hyper-Booster


You can buy max Super-Boosters
-
-
- - -

1 Subspace Energy


Automatically purchase Space Buildings   


- You have {{format(player.ss.subspace)}} Subspace, which provides you with {{formatWhole(tmp.ssEff1)}} extra Space, makes all Space Buildings {{format(tmp.ssEff2)}}x cheaper, and makes all Space Buildings {{format(tmp.ssEff3.sub(1).times(100))}}% stronger -
-
- - - - - - - -

1 total Magic


Keep row 4 milestones on all resets

2 total Magic


Keep Hindrance completions on all resets

3 total Magic


Gain 100% of Hindrance Spirit & Quirk gain every second

4 total Magic


Automatically purchase Hyper-Boosters & Subspace      

50 total Magic


Automatically cast Spells   

2.5e9 total Magic


Gain 100% of Hex gain every second, and Spells last 4x longer


- Note: Activating a Spell costs Magic.
-
-
-

-
-

-
-
-
- You have {{formatWhole(player.m.hexes)}} Hexes, which are multiplying Hindrance Spirit & Quirk gain by {{format(tmp.hexEff)}} -
-
- - - - - - -

1 Balance Energy


Keep row 4 milestones on all resets

2 Balance Energy


Keep Quirk Upgrades on all resets

3 Balance Energy


Automatically purchase Quirk Layers   

5 Balance Energy


Keep Hyper-Booster & Subspace Upgrades on all resets

8 Balance Energy


You can buy max Hyper-Boosters & Subspace Energy, and Hyper-Boosters/Subspace Energy reset nothing


- You have {{format(player.ba.power)}} Balance Power, which is multiplying Hindrance Spirit & Quirk gain by {{format(tmp.balEff)}}
- You have {{format(player.ba.positivity)}} Positivity and {{format(player.ba.negativity)}} Negativity, which are multiplying Balance Power gain by {{format(tmp.balEff2)}} -
-
- - - -

2 Phantom Souls


Automatically purchase Phantom Souls   

5 Phantom Souls


You can buy max Phantom Souls, and Phantom Souls reset nothing


-
-
- - - - - -

1 total Super-Prestige Point


Upgrades of Rows 1-5 and Hindrances are kept on all resets

2 total Super-Prestige Points


Keep Magic Milestones on reset, Spells do not cost Magic, and Magic Upgrade 13's effect can be auto-set to your current Magic   

5 total Super-Prestige Points


Keep Balance Milestones on reset

10 total Super-Prestige Points


Gain 100% of Magic & Balance Power gain every second
-
-
-

- You have {{format(player.l.power)}} Life Power (+{{format(LIFE_BOOSTERS.calcNewPower(1).sub(player.l.power))}}/s),
- which is translating to: -
-
- -
-
- You have {{formatWhole(player.ps.points)}} Phantom Souls, {{getLayerEffDesc("ps")}} -
-
- - -

20,000 Hyperspace Energy


Gain 1% of Super-Prestige Points gain every second
-

- You have {{formatWhole(player.ba.points)}} Balance Energy -
- -

-
-
-
- -
-
-
- Get {{formatWhole(player.g.points)}} / {{formatWhole(HYPERSPACE.nextCapReq())}} Generators to increase the cap of Super-Upgrades -
-
- - -

3 Imperium Bricks


You can max out Imperium Bricks
-

- You have {{formatWhole(player.i.lifeBricks)}} Life Bricks
- Next Life Brick is at {{format(player.l.power)}} / {{format(IMPERIUM.lifeReq())}} Life Power -

- -
- Your Work is currently {{format(tmp.i.work)}}, which reduces the gain power of rows 1 - 5 by {{format(tmp.i.workEff)}}x -
Your Work also collapses row {{i}} layers by {{format(tmp.i.collapse[i].times(100))}}%
-
\ No newline at end of file diff --git a/Old Code/gametest.js b/Old Code/gametest.js deleted file mode 100644 index b1256df..0000000 --- a/Old Code/gametest.js +++ /dev/null @@ -1,494 +0,0 @@ -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 challenge = player[layer].active - if (challenge==toNumber(id)) return true - - if (layers[layer].challenges[challenge].countsAs) - return layers[layer].challenges[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].challenges = [] - if (layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)) { - if (player.subtabs[layer] == undefined) player.subtabs[layer] = {} - if (player.subtabs[layer].mainTabs == undefined) player.subtabs[layer].mainTabs = Object.keys(layers[layer].tabFormat)[0] - } - - 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)) completeChallenge(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 hasChallenge(layer, id){ - if (!layers[layer].challenges) return false - - return (player[layer].challenges.includes(toNumber(id)) || player[layer].challenges.includes(id.toString())) -} - -function buyablesOwned(layer, id){ - return (player[layer].buyables[id]) -} - -function clickableState(layer, id){ - return (player[layer].clickables[id]) -} - -function upgEffect(layer, id){ - if (!layers[layer].upgrades) return {} - - return (tmp[layer].upgrades[id].effect) -} - -function challengeEffect(layer, id){ - if (!layers[layer].challenge) return false - - return (tmp[layer].challenges[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 startChallenge(layer, x) { - let enter = false - if (!player[layer].unl) return - if (player[layer].active == x) { - completeChallenge(layer, x) - delete player[layer].active - } else { - enter = true - } - doReset(layer, true) - if(enter) player[layer].active = x - - updateChallengeTemp(layer) -} - -function canCompleteChallenge(layer, x) -{ - if (x != player[layer].active) return - - let challenge = layers[layer].challenges[x] - - if (challenge.currencyInternalName){ - let name = challenge.currencyInternalName - if (challenge.currencyLayer){ - let lr = challenge.currencyLayer - return !(player[lr][name].lt(readData(challenge.goal))) - } - else { - return !(player[name].lt(challenge.cost)) - } - } - else { - return !(player[layer].points.lt(challenge.cost)) - } - -} - -function completeChallenge(layer, x) { - var x = player[layer].active - if (!x) return - if (! canCompleteChallenge(layer, x)) return - if (!player[layer].challenges.includes(x)) { - needCanvasUpdate = true - player[layer].challenges.push(x); - if (layers[layer].challenges[x].onComplete) layers[layer].challenges[x].onComplete() - } - delete player[layer].active - updateChallengeTemp(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/Old Code/test.js b/Old Code/test.js deleted file mode 100644 index e5cb029..0000000 --- a/Old Code/test.js +++ /dev/null @@ -1,1872 +0,0 @@ -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/Old Code/2.0-format-changes.md b/Old Things/2.0-format-changes.md similarity index 100% rename from Old Code/2.0-format-changes.md rename to Old Things/2.0-format-changes.md diff --git a/changelog.md b/changelog.md index 3ac4bba..456e6e7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # The Modding Tree changelog: +## v2.3.1 - 12/12/20 +- Another attempt to fix flickering tooltips. +- The "this" keyword should work everywhere except tabFormat arrays (although I may have missed some things). +- Fixed tree branches not updating when scrolling on the right-side tab. +- Fixed a spacing issue when a node's symbol is "" +- Removed some old, unneeded files. + ## v2.3: Cooler and Newer Edition - 12/10/20 - Added achievement/milestone popups (thank you to Jacorb for this contribution!) - The changelog tab is back, and can be set in mod.js. diff --git a/demo.html b/demo.html index a903e5f..bc389dc 100644 --- a/demo.html +++ b/demo.html @@ -80,7 +80,7 @@ -
+
diff --git a/docs/milestones.md b/docs/milestones.md index bc40833..f15add6 100644 --- a/docs/milestones.md +++ b/docs/milestones.md @@ -5,8 +5,8 @@ Milestones are awarded to the player when they meet a certain goal, and give som ```js milestones: { 0: { - requirementDesc: "123 waffles", - effectDesc: "blah", + requirementDescription: "123 waffles", + effectDescription: "blah", done() { return player.w.points.gte(123) } } etc diff --git a/index.html b/index.html index 52d9c50..f2ac692 100644 --- a/index.html +++ b/index.html @@ -78,7 +78,7 @@
-
+
diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index e7253a5..d54343f 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -195,7 +195,7 @@ addLayer("c", { let amount = getBuyableAmount(this.layer, this.id) if (amount.lte(0)) return // Only sell one if there is at least one setBuyableAmount(this.layer, this.id, amount.sub(1)) - player[this.layer].points = player[this.layer].points.add(this.cost()) + player[this.layer].points = player[this.layer].points.add(this.cost) }, }, }, diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 5461186..f7797d8 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -11,7 +11,7 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.3", + num: "2.3.1", name: "Cooler and Newer Edition", } diff --git a/js/Demo/demoTree.js b/js/Demo/demoTree.js index 088c35f..c344a5c 100644 --- a/js/Demo/demoTree.js +++ b/js/Demo/demoTree.js @@ -25,7 +25,8 @@ addNode("g", { canClick() {return player.points.gte(10)}, tooltip: "Thanos your points", tooltipLocked: "Thanos your points", - onClick() {player.points = player.points.div(2)} + onClick() {player.points = player.points.div(2) + console.log(this.layer)} }, ) diff --git a/js/components.js b/js/components.js index ee13be3..3d523c5 100644 --- a/js/components.js +++ b/js/components.js @@ -311,7 +311,8 @@ function loadVue() { Vue.component('master-button', { props: ['layer', 'data'], template: ` - + ` }) @@ -401,13 +402,15 @@ function loadVue() { Vue.component('sell-one', { props: ['layer', 'data'], template: ` - + ` }) Vue.component('sell-all', { props: ['layer', 'data'], template: ` - + ` }) diff --git a/js/game.js b/js/game.js index e982e20..a9b4933 100644 --- a/js/game.js +++ b/js/game.js @@ -4,8 +4,8 @@ var gameEnded = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.3", - tmtName: "Cooler and Newer" + tmtNum: "2.3.1", + tmtName: "Cooler and Newer Edition" } function getResetGain(layer, useType = null) { @@ -86,7 +86,7 @@ function shouldNotify(layer){ } function canReset(layer) -{ +{ if(tmp[layer].type == "normal") return tmp[layer].baseAmount.gte(tmp[layer].requires) else if(tmp[layer].type== "static") @@ -94,7 +94,7 @@ function canReset(layer) if(tmp[layer].type == "none") return false else - return layers[layer].canReset() + return run(layers[layer].canReset, tmp[layer]) } function rowReset(row, layer) { @@ -102,7 +102,7 @@ function rowReset(row, layer) { if(layers[lr].doReset) { player[lr].activeChallenge = null // Exit challenges on any row reset on an equal or higher row - layers[lr].doReset(layer) + run(layers[lr].doReset, tmp[lr], layer) } else if(tmp[layer].row > tmp[lr].row && row !== "side" && !isNaN(row)) layerDataReset(lr) @@ -164,7 +164,7 @@ function doReset(layer, force=false) { } if (layers[layer].onPrestige) - layers[layer].onPrestige(gain) + run(layers[layer].onPrestige, tmp[layer], gain) addPoints(layer, gain) updateMilestones(layer) @@ -246,7 +246,7 @@ function canCompleteChallenge(layer, x) } else if (challenge.currencyLayer){ let lr = challenge.currencyLayer - return !(player[lr][name].lt(readData(challenge.goal))) + return !(player[lr][name].lt(challenge.goal)) } else { return !(player[name].lt(challenge.goal)) @@ -268,7 +268,7 @@ function completeChallenge(layer, x) { if (player[layer].challenges[x] < tmp[layer].challenges[x].completionLimit) { needCanvasUpdate = true player[layer].challenges[x] += 1 - if (layers[layer].challenges[x].onComplete) layers[layer].challenges[x].onComplete() + if (layers[layer].challenges[x].onComplete) run(layers[layer].challenges[x].onComplete, tmp[layer].challenges[x]) } player[layer].activeChallenge = null updateChallengeTemp(layer) diff --git a/js/technical/systemComponents.js b/js/technical/systemComponents.js index 5eb24d8..5fca880 100644 --- a/js/technical/systemComponents.js +++ b/js/technical/systemComponents.js @@ -17,7 +17,7 @@ var systemComponents = { v-bind:id="layer" v-on:click="function() { if(tmp[layer].isLayer) {showTab(layer)} - else {layers[layer].onClick()} + else {run(layers[layer].onClick, tmp[layer])} }" v-bind:tooltip="(tmp[layer].tooltip == '') ? false : (tmp[layer].isLayer) ? ( @@ -44,7 +44,7 @@ var systemComponents = { v-bind:style="[(tmp[layer].isLayer && layerunlocked(layer)) || (!tmp[layer].isLayer && tmp[layer].canClick) ? { 'background-color': tmp[layer].color, } : {}, tmp[layer].nodeStyle]"> - {{abb}} + {{(abb !== '' ? abb : ' ')}} ` }, diff --git a/js/utils.js b/js/utils.js index e33d267..4664d78 100644 --- a/js/utils.js +++ b/js/utils.js @@ -454,7 +454,7 @@ 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 \"" + (tmp[layer].name ? tmp[layer].name : layer) + "\" reset as well!")) return - layers[layer].buyables.respec() + run(layers[layer].buyables.respec, tmp[layer].buyables) updateBuyableTemp(layer) document.activeElement.blur() } @@ -559,7 +559,7 @@ function buyUpg(layer, id) { if (upg.canAfford === false) return let pay = layers[layer].upgrades[id].pay if (pay !== undefined) - pay() + run(pay, upg) else { let cost = tmp[layer].upgrades[id].cost @@ -587,7 +587,7 @@ function buyUpg(layer, id) { } player[layer].upgrades.push(id); if (upg.onPurchase != undefined) - upg.onPurchase() + run(upg.onPurchase, upg) } function buyMaxBuyable(layer, id) { @@ -596,7 +596,7 @@ function buyMaxBuyable(layer, id) { if (!tmp[layer].buyables[id].canAfford) return if (!layers[layer].buyables[id].buyMax) return - layers[layer].buyables[id].buyMax() + run(layers[layer].buyables[id].buyMax, tmp[layer].buyables[id]) updateBuyableTemp(layer) } @@ -605,7 +605,7 @@ function buyBuyable(layer, id) { if (!tmp[layer].buyables[id].unlocked) return if (!tmp[layer].buyables[id].canAfford) return - layers[layer].buyables[id].buy() + run(layers[layer].buyables[id].buy, tmp[layer].buyables[id]) updateBuyableTemp(layer) } @@ -614,7 +614,7 @@ function clickClickable(layer, id) { if (!tmp[layer].clickables[id].unlocked) return if (!tmp[layer].clickables[id].canClick) return - layers[layer].clickables[id].onClick() + run(layers[layer].clickables[id].onClick, tmp[layer].clickables[id]) updateClickableTemp(layer) } @@ -848,4 +848,13 @@ function adjustPopupTime(diff) { activePopups.splice(popup,1); // Remove popup when time hits 0 } } +} + +function run(func, target, args=null){ + if (!!(func && func.constructor && func.call && func.apply)){ + let bound = func.bind(target) + return bound(args) + } + else + return func; } \ No newline at end of file diff --git a/style.css b/style.css index 93ca2f8..34a5c2e 100644 --- a/style.css +++ b/style.css @@ -551,8 +551,6 @@ ul { [tooltip]:before, [tooltip]:after { visibility: hidden; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; pointer-events: none; white-space: pre-wrap; @@ -598,7 +596,6 @@ ul { [tooltip]:hover:before, [tooltip]:hover:after { visibility: visible; - filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100); opacity: 1; white-space: pre-wrap; }