just_another_tree/js/mod.js
2024-03-24 19:57:05 +00:00

145 lines
No EOL
5.1 KiB
JavaScript

let modInfo = {
name: "Progressbar Incremental",
id: "nif/pbic",
author: "Nif",
pointsName: "points",
modFiles: ["data/ranks.js", "data/levels.js", "data/progress.js", "data/super progress.js", "data/files.js", "data/integrals.js", "data/achievements.js", "data/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.5",
name: "The great rebalancing",
}
let changelog = `<h1>Changelog:</h1><br><br>
<h3>v1.5</h3><br>
- Clarified some effects.<br>
- Decreased SPP requirement.<br>
- Made <b>Even more progress</b> affect SPP gain.<br>
- Made Files need SPP instead of PP.<br>
- Made File cost dependent on total and points.<br>
- Made other changes to File cost.<br>
- Reshuffled some Filestones.<br>
- Added a new softcap.<br>
- Made Directory upgrade [4,3] use total Files.<br>
- Added more Filestones and Directory upgrades.<br>
- Added a Directory buyable.<br>
- Slightly increased Integral cost.<br><br>
<h3>v1.2</h3><br>
- Added a few missing format() calls.<br>
- Added a note for the hardcap.<br>
- Decreased Integral requirement.<br><br>
<h3>v1.1</h3><br>
- Made all renders of Decimal objects use format().<br>
- Adjusted file costs and filestone 2 effect.<br><br>
<h3>v1.0 First Release</h3><br>
- Added Progress, Super Progress, and File layers.<br>
- Added bars Alpha to Lambda.<br>
- Added ranks Alpha to Zeta.<br>
- Added 3 buyables and 2 super buyables.<br>
- Added 10 Filestones.<br>
- Added 11 Directory upgrades.<br>
- Added Integral reset.<br>
- Added 29 achievements.<br>
- Current endgame: 1 integral.<br>`
let winText = `Download 100% complete.<br><br>You won! Congratulations!<br>More content coming soon...`
// 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()
gain = gain.add(getEtaEffect())
// multiplicative
gain = gain.mul(getBetaEffect())
gain = gain.mul(getGammaEffect())
gain = gain.mul(getDeltaEffect())
gain = gain.mul(getZetaEffect())
gain = gain.mul(getLambdaEffect())
gain = gain.mul(tmp.ach.effect)
gain = gain.mul(buyableEffect('f', 11))
if (hasMilestone('f', 1)) gain = gain.mul(getTotalLevel().add(7).log(2))
if (hasMilestone('f', 6)) gain = gain.mul(player.f.total.div(2).add(1))
// exponentiative
if (gain.gte(1)) {
gain = gain.pow(getEpsilonEffect())
gain = gain.pow(getIotaEffect())
gain = gain.pow(buyableEffect('sp', 12))
if (hasMilestone('f', 3)) gain = gain.pow(2)
if (hasUpgrade('f', 11)) gain = gain.pow(upgradeEffect('f', 11))
if (hasUpgrade('f', 53)) gain = gain.pow(upgradeEffect('f', 53))
}
// softcaps
gain = softcap(gain, getKappaEffect().mul(1000), d => d.add(1).log(Math.E).add(1).pow(2).sub(1).div(2))
gain = softcap(gain,
Decimal.pow(1e6, (hasMilestone('f', 11) ? getTotalSuperLevel().add(1).log(2).add(1).log(2).add(1) : 1)),
d => d.add(1).log(3 - hasUpgrade('f', 61)).add(1)
)
gain = softcap(gain, Decimal.pow(2, 128), _ => new Decimal(0), player.points)
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 = [
"All exponentiative upgrades only take affect above 1.",
() => getPointGen().gte(getKappaEffect().mul(1000)) ? "Your points per second are being logarithmically softcapped over "
+ format(getKappaEffect().mul(1000)) + "/s" : "",
() => getPointGen().gte(
Decimal.pow(1e6, hasMilestone('f', 10) ? getTotalSuperLevel().pow(1/10).add(1).log(10).add(1) : 1)
) ? "Your points per second are being logarithmically softcapped again over "
+ format(Decimal.pow(
1e6, hasMilestone('f', 11) ? getTotalSuperLevel().pow(1/10).add(1).log(10).add(1) : 1
)) + "/s"
: "",
() => getPointGen().add(player.points).gte(Decimal.pow(2, 128)) ? "Your points per second are being hardcapped over "
+ format(Decimal.pow(2, 128)) : ""
]
// Determines when the game "ends"
function isEndgame() {
return player.i.points.gt(0)
}
// 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) {
}