From f590171c4f6efbe668390081b8fcdd50bc6c026b Mon Sep 17 00:00:00 2001 From: TJCgames Date: Thu, 7 Mar 2024 17:49:20 +0000 Subject: [PATCH] v0/a1 Ask and you shall receive --- js/layers.js | 28 ------------- js/levels.js | 35 ++++++++++++++++ js/mod.js | 33 ++++++++------- js/progress.js | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 43 deletions(-) delete mode 100644 js/layers.js create mode 100644 js/levels.js create mode 100644 js/progress.js diff --git a/js/layers.js b/js/layers.js deleted file mode 100644 index f9488fb..0000000 --- a/js/layers.js +++ /dev/null @@ -1,28 +0,0 @@ -addLayer("p", { - name: "prestige", // This is optional, only used in a few places, If absent it just uses the layer id. - symbol: "P", // This appears on the layer's node. Default is the id with the first letter capitalized - position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order - startData() { return { - unlocked: true, - points: new Decimal(0), - }}, - color: "#4BDC13", - 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 - 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: 0, // Row the layer is in on the tree (0 is the first row) - hotkeys: [ - {key: "p", description: "P: Reset for prestige points", onPress(){if (canReset(this.layer)) doReset(this.layer)}}, - ], - layerShown(){return true} -}) diff --git a/js/levels.js b/js/levels.js new file mode 100644 index 0000000..3015282 --- /dev/null +++ b/js/levels.js @@ -0,0 +1,35 @@ +function getAlphaLevel(points = player.p.points) { + if (Decimal.eq(points, 0)) return new Decimal(0) + return Decimal.add(points, 10).div(11).log(1.1).add(1).floor().max(0) +} +function getNextAlphaCost(points = player.p.points) { + return getAlphaLevel(points).pow_base(1.1).mul(11).sub(10) +} +function getBetaLevel(points = player.p.points) { + if (Decimal.eq(points, 0)) return new Decimal(0) + return Decimal.add(points, 20).div(25).log(1.25).add(1).floor().max(0) +} +function getNextBetaCost(points = player.p.points) { + return getBetaLevel(points).pow_base(1.25).mul(25).sub(20) +} +function getGammaLevel(points = player.p.points) { + if (Decimal.eq(points, 0)) return new Decimal(0) + return Decimal.add(points, 30).div(45).log(1.5).add(1).floor().max(0) +} +function getNextGammaCost(points = player.p.points) { + return getGammaLevel(points).pow_base(1.5).mul(45).sub(30) +} +function getDeltaLevel(points = player.p.points) { + if (Decimal.eq(points, 0)) return new Decimal(0) + return Decimal.add(points, 30).div(60).log(2).add(1).floor().max(0) +} +function getNextDeltaCost(points = player.p.points) { + return getDeltaLevel(points).pow_base(2).mul(60).sub(30) +} +function getEpsilonLevel(points = player.p.points) { + if (Decimal.eq(points, 0)) return new Decimal(0) + return Decimal.add(points, 25).div(75).log(3).add(1).floor().max(0) +} +function getNextEpsilonCost(points = player.p.points) { + return getEpsilonLevel(points).pow_base(3).mul(75).sub(25) +} \ No newline at end of file diff --git a/js/mod.js b/js/mod.js index 6175517..760ab61 100644 --- a/js/mod.js +++ b/js/mod.js @@ -1,28 +1,28 @@ let modInfo = { - name: "The ??? Tree", - id: "mymod", - author: "nobody", + name: "Progressbar Incremental", + id: "nif/pbic", + author: "Nif", pointsName: "points", - modFiles: ["layers.js", "tree.js"], + modFiles: ["levels.js", "progress.js", "tree.js"], discordName: "", discordLink: "", - initialStartPoints: new Decimal (10), // Used for hard resets and new players + initialStartPoints: new Decimal (1), // Used for hard resets and new players offlineLimit: 1, // In hours } // Set your version in num and name let VERSION = { - num: "0.0", - name: "Literally nothing", + num: "0/a1", + name: "You guys wanted it.", } let changelog = `

Changelog:


-

v0.0


- - Added things.
- - Added stuff.` +

v0/a1


+ - Added progress points.
+ - Added bars Alpha to Epsilon.
` -let winText = `Congratulations! You have reached the end and beaten this game, but for now...` +let winText = `Download 100% complete.

You won! Congratulations!
Beyond this point may be unbalanced, proceed with caution!` // If you add new functions anywhere inside of a layer, and those functions have an effect when called, add them here. // (The ones here are examples, all official functions are already taken care of) @@ -34,15 +34,18 @@ function getStartPoints(){ // Determines if it should show points/sec function canGenPoints(){ - return true + return getAlphaLevel().gte(0) } // Calculate points/sec! function getPointGen() { - if(!canGenPoints()) - return new Decimal(0) + if(!canGenPoints()) return new Decimal(0) - let gain = new Decimal(1) + let gain = getAlphaLevel().div(20) + gain = gain.mul(getBetaLevel().div(20).add(1)) + gain = gain.mul(getGammaLevel().div(15).add(1)) + gain = gain.pow(getDeltaLevel().div(50).add(1)) + gain = gain.pow(getEpsilonLevel().div(10).add(1)) return gain } diff --git a/js/progress.js b/js/progress.js new file mode 100644 index 0000000..625cfd0 --- /dev/null +++ b/js/progress.js @@ -0,0 +1,106 @@ +addLayer("p", { + name: "progress", // This is optional, only used in a few places, If absent it just uses the layer id. + symbol: "%", // This appears on the layer's node. Default is the id with the first letter capitalized + position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order + startData() { return { + unlocked: true, + points: new Decimal(0), + best: new Decimal(0), + levels: { + epsilon: new Decimal(0), + } + }}, + color: "#0c6949", + requires: new Decimal(1), // Can be a function that takes requirement increases into account + resource: "progress 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 + 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: 0, // Row the layer is in on the tree (0 is the first row) + hotkeys: [ + {key: "p", description: "P: Reset for progress points", onPress(){if (canReset(this.layer)) doReset(this.layer)}}, + ], + bars: { + alpha: { + direction: RIGHT, + width: 300, + height: 50, + progress() { return player[this.layer].points.div(getNextAlphaCost()) }, + display() { + return "Alpha - Level " + getAlphaLevel() + " (" + player[this.layer].points + "/" + getNextAlphaCost() + + ")
Effect: +" + getAlphaLevel().div(20) + " to point gen." + }, + fillStyle: {backgroundColor: "#0c6949"} + }, + beta: { + direction: RIGHT, + width: 300, + height: 50, + progress() { return player[this.layer].points.div(getNextBetaCost()) }, + display() { + return "Beta - Level " + getBetaLevel() + " (" + player[this.layer].points + "/" + getNextBetaCost() + + ")
Effect: x" + getBetaLevel().div(20).add(1) + " to point gen." + }, + fillStyle: {backgroundColor: "#0c6949"} + }, + gamma: { + direction: RIGHT, + width: 300, + height: 50, + progress() { return player[this.layer].points.div(getNextGammaCost()) }, + display() { + return "Gamma - Level " + getGammaLevel() + " (" + player[this.layer].points + "/" + getNextGammaCost() + + ")
Effect: x" + getGammaLevel().div(15).add(1) + " to point gen." + }, + fillStyle: {backgroundColor: "#0c6949"} + }, + delta: { + direction: RIGHT, + width: 300, + height: 50, + progress() { return player[this.layer].points.div(getNextDeltaCost()) }, + display() { + return "Delta - Level " + getDeltaLevel() + " (" + player[this.layer].points + "/" + getNextDeltaCost() + + ")
Effect: ^" + getDeltaLevel().div(50).add(1) + " to point gen." + }, + fillStyle: {backgroundColor: "#0c6949"} + }, + epsilon: { + direction: RIGHT, + width: 300, + height: 50, + progress() { return player[this.layer].points.div(getNextEpsilonCost()) }, + display() { + return "Epsilon - Level " + getEpsilonLevel() + " (" + player[this.layer].points + "/" + getNextEpsilonCost() + + ")
Effect: x" + getEpsilonLevel().div(10).add(1) + " to point gen." + }, + fillStyle: {backgroundColor: "#0c6949"} + }, + }, + update(diff) { + if (player[this.layer].points.gte(player[this.layer].levels.epsilon.pow_base(5).mul(125/2))) { + player[this.layer].levels.epsilon = player[this.layer].levels.epsilon.add(1) + } + }, + tabFormat: [ + "main-display", + "prestige-button", + "blank", + "h-line", + "blank", + ["bar", "alpha"], + ["bar", "beta"], + ["bar", "gamma"], + ["bar", "delta"], + ["bar", "epsilon"], + ], + layerShown(){return true} +})