just_another_tree/js/mod.js
2024-03-09 13:28:55 +00:00

96 lines
No EOL
2.7 KiB
JavaScript

let modInfo = {
name: "Progressbar Incremental",
id: "nif/pbic",
author: "Nif",
pointsName: "points",
modFiles: ["ranks.js", "levels.js", "progress.js", "files.js", "tree.js"],
discordName: "",
discordLink: "",
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: "1",
name: "The first release.",
}
let changelog = `<h1>Changelog:</h1><br><br>
<h3>v1</h3><br>
- Added progress points.<br>
- Added bars Alpha to Zeta.<br>
- Added Ranks.<br>
- Added Buyables.<br>
- Added Files.<br>
- Added 5 File milestones.<br>
- Endgame: 6 Files.<br>`
let winText = `Download 100% complete.<br><br>You won! Congratulations!<br>Beyond this point may be unbalanced / incomplete, 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)
var doNotCallTheseFunctionsEveryTick = ["blowUpEverything"]
function getStartPoints(){
return new Decimal(modInfo.initialStartPoints)
}
// Determines if it should show points/sec
function canGenPoints(){
return getAlphaLevel().gte(0)
}
// Calculate points/sec!
function getPointGen() {
if(!canGenPoints()) return new Decimal(0)
// additive
let gain = getAlphaEffect()
// multiplicative
gain = gain.mul(getBetaEffect())
gain = gain.mul(getGammaEffect())
gain = gain.mul(getDeltaEffect())
gain = gain.mul(getZetaEffect())
if (hasMilestone('f', 0)) gain = gain.mul(getTotalLevel().add(1).log(5).add(1))
if (hasMilestone('f', 1)) gain = gain.mul(3)
if (hasMilestone('f', 3) && gain.gte(1)) gain = gain.pow(2)
// exponentiative
gain = gain.pow(getEpsilonEffect())
if (hasMilestone('f', 4)) gain = gain.pow(getTotalRank().div(2).add(1))
// softcaps
gain = softcap(gain, 1000, d => d.add(1).log(2))
return gain
}
// You can add non-layer related variables that should to into "player" and be saved here, along with default values
function addedPlayerData() { return {
}}
// Display extra things at the top of the page
var displayThings = [
]
// Determines when the game "ends"
function isEndgame() {
return player.f.points.gte(6)
}
// Less important things beyond this point!
// Style for the background, can be a function
var backgroundStyle = {
}
// You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() {
return(3600) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,
// you can cap their current resources with this.
function fixOldSave(oldVersion){
}