just_another_tree/js/data/files.js

328 lines
13 KiB
JavaScript
Raw Normal View History

2024-03-09 13:28:55 +00:00
addLayer("f", {
name: "files", // This is optional, only used in a few places, If absent it just uses the layer id.
2024-03-13 17:02:37 +00:00
symbol: "🗎", // This appears on the layer's node. Default is the id with the first letter capitalized
position: 2, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
2024-03-09 13:28:55 +00:00
startData() { return {
unlocked: false,
points: new Decimal(0),
total: new Decimal(0)
}},
color: "#7f1bae",
2024-03-10 17:19:22 +00:00
requires() {
let req = new Decimal(250)
if (hasUpgrade(this.layer, 32)) { req = req.mul(0.5) }
if (hasMilestone(this.layer, 9)) { req = req.mul(0.5) }
2024-03-10 17:19:22 +00:00
return req
}, // Can be a function that takes requirement increases into account
2024-03-09 13:28:55 +00:00
resource: "files", // Name of prestige currency
baseResource: "super progress points", // Name of resource prestige is based on
baseAmount() {return player.sp.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
2024-03-24 19:50:21 +00:00
exponent() {
let exp = 1.3
if (hasUpgrade(this.layer, 52)) exp **= 0.9
return exp
}, // Prestige currency exponent
2024-03-10 17:35:06 +00:00
base() {
let base = 1.3
2024-03-10 17:35:06 +00:00
if (hasUpgrade(this.layer, 41)) base **= 0.95
return base
},
getResetGain(canMax = tmp[this.layer].canBuyMax) {
let tlyr = tmp[this.layer]
let plyr = player[this.layer]
2024-03-27 19:28:39 +00:00
let amount = tlyr.baseAmount.div(tlyr.requires).log(tlyr.base)
if (amount.gte(0)) amount = amount.root(tlyr.exponent).add(1)
2024-03-24 19:50:21 +00:00
.sub(plyr.points.mul(2).add(plyr.total).div(3)).sqrt().floor().max(0)
if (isNaN(amount)) return new Decimal(0)
if (!canMax && amount.gte(1)) return new Decimal(1)
2024-03-27 19:28:39 +00:00
return amount.max(0)
},
getNextAt(canMax = tmp[this.layer].canBuyMax) {
let tlyr = tmp[this.layer]
let plyr = player[this.layer]
2024-03-27 19:28:39 +00:00
if (!canMax) return plyr.points.mul(2).add(plyr.total).div(3).pow(tlyr.exponent)
2024-03-24 19:50:21 +00:00
.pow_base(tlyr.base).mul(tlyr.requires)
2024-03-27 19:28:39 +00:00
return tlyr.getResetGain.plus(1).pow(2).add(plyr.points.mul(2).add(plyr.total).div(3))
.minus(1).pow(tlyr.exponent).pow_base(tlyr.base).mul(tlyr.requires)
},
canReset() {
return tmp[this.layer].getResetGain.gte(1)
},
prestigeButtonText() {
return "Reset for " + format(tmp[this.layer].getResetGain.max(1)) + " " + tmp[this.layer].resource + "<br><br>Req: "
+ format(tmp[this.layer].baseAmount) + "/" + format(tmp[this.layer].getNextAt) + " " + tmp[this.layer].baseResource
},
prestigeNotify() { return tmp[this.layer].canReset },
2024-03-09 13:28:55 +00:00
gainMult() { // Calculate the multiplier for main currency from bonuses
return new Decimal(1)
},
gainExp() { // Calculate the exponent on main currency from bonuses
return new Decimal(1)
},
2024-03-10 17:19:22 +00:00
canBuyMax() {
return hasMilestone(this.layer, 8)
2024-03-10 17:19:22 +00:00
},
row: 2, // Row the layer is in on the tree (0 is the first row)
displayRow: 0,
2024-03-09 13:28:55 +00:00
hotkeys: [
{key: "f", description: "F: Reset for files", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
],
milestones: {
0: {
requirementDescription: "1 total File.",
2024-03-24 19:50:21 +00:00
effectDescription: "Triple PP and SPP gen.",
2024-03-09 13:28:55 +00:00
done() { return player.f.total.gte(1) }
},
1: {
requirementDescription: "2 total Files.",
2024-03-24 19:50:21 +00:00
effectDescription() {
return "Total levels and super levels boost point gen.<br>Effect: x"
+ format(getTotalLevel().add(getTotalSuperLevel()).add(7).log(2)) + "."
},
2024-03-09 13:28:55 +00:00
done() { return player.f.total.gte(2) }
},
2024-03-27 19:28:39 +00:00
2: {
2024-03-09 13:28:55 +00:00
requirementDescription: "3 total Files.",
2024-03-24 19:50:21 +00:00
effectDescription: "Halve PP req.",
done() { return player.f.total.gte(3) }
2024-03-09 13:28:55 +00:00
},
2024-03-27 19:28:39 +00:00
3: {
2024-03-09 13:28:55 +00:00
requirementDescription: "4 total Files.",
2024-03-24 19:50:21 +00:00
effectDescription: "SPP no longer resets PP.",
2024-03-09 13:28:55 +00:00
done() { return player.f.total.gte(4) }
},
4: {
requirementDescription: "5 total Files.",
2024-03-10 17:19:22 +00:00
effectDescription: "Unlock the Directory.",
done() { return player.f.total.gte(5) }
},
5: {
requirementDescription: "6 total Files.",
effectDescription: "You can now get fractional levels.",
done() { return player.f.total.gte(6) }
},
6: {
requirementDescription: "8 total Files.",
2024-03-09 15:11:14 +00:00
effectDescription() {
2024-03-17 19:58:26 +00:00
return "Total Files boost point gen.<br>Effect: x" + format(player[this.layer].total.div(2).add(1)) + "."
2024-03-09 15:11:14 +00:00
},
done() { return player.f.total.gte(8) }
2024-03-10 17:19:22 +00:00
},
7: {
2024-03-10 17:19:22 +00:00
requirementDescription: "10 total Files.",
effectDescription: "Autobuy all PP buyables.",
2024-03-10 17:19:22 +00:00
done() { return player.f.total.gte(10) }
2024-03-09 13:28:55 +00:00
},
8: {
2024-03-10 17:35:06 +00:00
requirementDescription: "15 total Files.",
effectDescription: "You can buy max files.",
2024-03-10 17:35:06 +00:00
done() { return player.f.total.gte(15) }
},
9: {
2024-03-13 17:02:37 +00:00
requirementDescription: "20 total Files.",
effectDescription: "Halve base file cost.",
2024-03-13 17:02:37 +00:00
done() { return player.f.total.gte(20) }
},
10: {
requirementDescription: "25 total Files.",
2024-03-24 19:50:21 +00:00
effectDescription: "Autobuy both SPP buyables.",
done() { return player.f.total.gte(25) }
},
11: {
2024-03-24 19:50:21 +00:00
requirementDescription: "50 total Files.",
effectDescription() {
return "Total super levels boost second softcap.<br>Effect: ^"
+ format(getTotalSuperLevel().pow(1/10).add(1).log(10).add(1)) + "."
},
done() { return player.f.total.gte(50) }
2024-03-13 17:02:37 +00:00
},
2024-03-09 13:28:55 +00:00
},
2024-03-10 17:19:22 +00:00
upgrades: {
11: {
description: "Total rank boosts point gen.",
effect() { return getTotalRank().add(2) },
2024-03-17 19:58:26 +00:00
effectDisplay() { return "^" + format(this.effect()) + "." },
2024-03-13 17:02:37 +00:00
cost: 1,
canAfford() { return hasMilestone(this.layer, 4) },
2024-03-10 17:19:22 +00:00
},
21: {
description: "Start with 2 free <b>Rebased</b> levels.",
cost: 3,
canAfford() { return hasUpgrade(this.layer, 11) },
2024-03-10 17:19:22 +00:00
branches: [11]
},
22: {
description: "Start with 2 free <b>Shorter bars</b> levels.",
cost: 3,
canAfford() { return hasUpgrade(this.layer, 11) },
2024-03-10 17:19:22 +00:00
branches: [11]
},
2024-03-10 17:35:06 +00:00
23: {
description: "Gain 10% of your PP gain every second.",
2024-03-10 17:35:06 +00:00
cost: 4,
canAfford() { return hasUpgrade(this.layer, 11) },
2024-03-10 17:35:06 +00:00
branches: [11]
},
2024-03-10 17:19:22 +00:00
31: {
description: "Make Gamma effect use total level as well.",
cost: 5,
canAfford() { return hasUpgrade(this.layer, 21) },
2024-03-10 17:19:22 +00:00
branches: [21]
},
32: {
description: "Halve base File cost.",
2024-03-10 17:19:22 +00:00
cost: 6,
canAfford() { return hasUpgrade(this.layer, 21) && hasUpgrade(this.layer, 22) },
2024-03-10 17:19:22 +00:00
branches: [21, 22]
},
33: {
description: "Multiply base PP cost by 0.75.",
cost: 5,
canAfford() { return hasUpgrade(this.layer, 22) },
2024-03-10 17:19:22 +00:00
branches: [22]
},
2024-03-10 17:35:06 +00:00
41: {
description: "Raise Beta, Delta, Zeta effects ^1.1.",
cost: 8,
canAfford() { return hasUpgrade(this.layer, 31) },
2024-03-10 17:35:06 +00:00
branches: [31]
},
2024-03-10 17:19:22 +00:00
42: {
2024-03-10 17:35:06 +00:00
description: "Raise File cost base ^0.95.",
2024-03-10 17:19:22 +00:00
cost: 8,
canAfford() { return hasUpgrade(this.layer, 32) },
2024-03-10 17:35:06 +00:00
branches: [32]
},
43: {
2024-03-24 19:50:21 +00:00
description: "Total Files divide PP cost.",
2024-03-10 17:35:06 +00:00
cost: 9,
canAfford() { return hasUpgrade(this.layer, 32) && hasUpgrade(this.layer, 33) },
2024-03-24 19:50:21 +00:00
effect() { return player[this.layer].total.add(3).log(2).add(1) },
2024-03-17 19:58:26 +00:00
effectDisplay() { return "/" + format(this.effect()) + "." },
2024-03-10 17:19:22 +00:00
branches: [32, 33]
},
2024-03-10 17:35:06 +00:00
44: {
description: "Gain another 15% of your PP gain every second.",
2024-03-10 17:19:22 +00:00
cost: 8,
canAfford() { return hasUpgrade(this.layer, 23) && hasUpgrade(this.layer, 33) },
2024-03-10 17:35:06 +00:00
branches: [[23, 2], 33]
2024-03-24 19:50:21 +00:00
},
51: {
description: "Multiply all rank effects by 2.",
cost: 15,
canAfford() { return hasUpgrade(this.layer, 41) && hasUpgrade(this.layer, 43) },
branches: [41, [43, 2]]
},
52: {
description: "Raise File cost exponent ^0.8.",
cost: 13,
canAfford() { return hasUpgrade(this.layer, 42) },
branches: [42]
},
53: {
description: "Total files boost point gen.",
cost: 14,
canAfford() { return hasUpgrade(this.layer, 43) },
effect() { return player[this.layer].points.log(10).add(1) },
effectDisplay() { return "^" + format(this.effect()) + "." },
branches: [43]
},
54: {
description: "Halve base SPP cost.",
cost: 13,
canAfford() { return hasUpgrade(this.layer, 43) },
branches: [43]
},
61: {
description: "Decrease the second softcap's log base.",
cost: 20,
canAfford() { return hasUpgrade(this.layer, 51) && hasUpgrade(this.layer, 52) },
branches: [51, 52]
},
62: {
description: "Gain 20% of your SPP gain per second.",
cost: 20,
canAfford() { return hasUpgrade(this.layer, 53) && hasUpgrade(this.layer, 44) },
branches: [53, [44, 2]]
}
},
buyables: {
11: {
title: "The finale of the intro",
effect() { return Decimal.pow(1.5, getBuyableAmount(this.layer, this.id)) },
cost() { return Decimal.mul(getBuyableAmount(this.layer, this.id), 10) },
display() {
return "Increase point gen.<br><br>Amount: " + format(getBuyableAmount(this.layer, this.id))
+ ".<br>Effect: x" + format(this.effect(getBuyableAmount(this.layer, this.id))) + ".<br>Cost: "
+ format(this.cost(getBuyableAmount(this.layer, this.id))) + " Files."
},
canAfford() {
return Decimal.gte(player[this.layer].points, this.cost())
&& hasUpgrade(this.layer, 61) && hasUpgrade(this.layer, 62)
},
buy() {
addBuyables(this.layer, this.id, 1)
player[this.layer].points = player[this.layer].points.sub(this.cost())
}
2024-03-10 17:19:22 +00:00
}
},
clickables: {
21: {
display() { return "Reset directory" },
onClick() {
2024-03-15 18:30:25 +00:00
if (confirm("Are you sure you want to respec? This will cause a File reset.")) {
if (player[this.layer].upgrades == 0) player.ach.has55 = true
player[this.layer].points = player[this.layer].total
2024-03-10 17:19:22 +00:00
player[this.layer].upgrades = []
2024-03-24 19:50:21 +00:00
player[this.layer].buyables[11] = new Decimal(0)
2024-03-15 18:30:25 +00:00
doReset('f', true)
2024-03-10 17:19:22 +00:00
}
},
canClick() { return true },
style: {
width: "60px",
minHeight: "60px"
}
}
},
2024-03-27 19:28:39 +00:00
layerShown(){ return player.sp.points.gte(200) || player[this.layer].unlocked },
2024-03-10 17:19:22 +00:00
branches: ['p'],
tabFormat: {
filestones: {
content: [
"main-display",
"prestige-button",
2024-03-10 17:19:22 +00:00
"resource-display",
"blank",
"blank",
["row", [
["milestones", [0, 2, 4, 6, 8, 10]],
["milestones", [1, 3, 5, 7, 9, 11]]
2024-03-10 17:19:22 +00:00
]]
]
},
directory: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
"blank",
"blank",
["clickable", 21],
"blank",
["upgrade-tree", [
[11],
2024-03-10 17:35:06 +00:00
[21, 22, 23],
2024-03-10 17:19:22 +00:00
[31, 32, 33],
2024-03-24 19:50:21 +00:00
[41, 42, 43, 44],
[51, 52, 53, 54],
[61, 62]
]],
"buyables"
2024-03-10 17:19:22 +00:00
],
unlocked() { return hasMilestone('f', 4) }
},
}
2024-03-09 13:28:55 +00:00
})