just_another_tree/js/files.js

182 lines
6.5 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.
symbol: "🗎", // This appears on the layer's node. Default is the id with the first letter capitalized
position: 1, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
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(5000)
if (hasUpgrade('f', 32)) { req = req.mul(0.75) }
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: "progress points", // Name of resource prestige is based on
baseAmount() {return player.p.points}, // Get the current amount of baseResource
2024-03-09 17:38:32 +00:00
type: "static", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
2024-03-10 17:19:22 +00:00
exponent: 1, // Prestige currency exponent
base: 1.2,
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, 6)
},
2024-03-09 13:28:55 +00:00
row: 1, // Row the layer is in on the tree (0 is the first row)
hotkeys: [
{key: "f", description: "F: Reset for files", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
],
milestones: {
0: {
requirementDescription: "1 total File.",
effectDescription() {
return "Total levels boost point gen.<br>Effect: x" + getTotalLevel().add(1).log(5).add(1) + "."
},
done() { return player.f.total.gte(1) }
},
1: {
requirementDescription: "2 total Files.",
effectDescription: "Triple point gen.",
done() { return player.f.total.gte(2) }
},
2: {
requirementDescription: "3 total Files.",
2024-03-10 17:19:22 +00:00
effectDescription: "Multiply PP requirement by 0.5x.",
2024-03-09 13:28:55 +00:00
done() { return player.f.total.gte(3) }
},
3: {
requirementDescription: "4 total Files.",
2024-03-10 17:19:22 +00:00
effectDescription: "Square point gen.",
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: "7 total Files.",
2024-03-09 15:11:14 +00:00
effectDescription() {
2024-03-10 17:19:22 +00:00
return "Total Files boost point gen.<br>Effect: x" + player[this.layer].total.div(2).add(1) + "."
2024-03-09 15:11:14 +00:00
},
2024-03-10 17:19:22 +00:00
done() { return player.f.total.gte(7) }
},
6: {
requirementDescription: "10 total Files.",
effectDescription: "You can buy max files.",
done() { return player.f.total.gte(10) }
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) },
effectDisplay() { return "^" + this.effect() + "." },
cost: 1
},
21: {
description: "Start with 2 free <b>Rebased</b> levels.",
cost: 3,
unlocked() { return hasUpgrade(this.layer, 11) },
branches: [11]
},
22: {
description: "Start with 2 free <b>Shorter bars</b> levels.",
cost: 3,
unlocked() { return hasUpgrade(this.layer, 11) },
branches: [11]
},
31: {
description: "Make Gamma effect use total level as well.",
cost: 5,
unlocked() { return hasUpgrade(this.layer, 21) },
branches: [21]
},
32: {
description: "Multiply base File cost by 0.75.",
cost: 6,
unlocked() { return hasUpgrade(this.layer, 21) || hasUpgrade(this.layer, 22) },
branches: [21, 22]
},
33: {
description: "Multiply base PP cost by 0.75.",
cost: 5,
unlocked() { return hasUpgrade(this.layer, 22) },
branches: [22]
},
42: {
description: "Files divide PP cost.",
cost: 8,
unlocked() { return hasUpgrade(this.layer, 32) || hasUpgrade(this.layer, 33) },
effect() { return player[this.layer].points.add(3).log(2).add(1) },
effectDisplay() { return "/" + this.effect() + "." },
branches: [32, 33]
},
43: {
description: "Gain 5% of your PP gain every second.",
cost: 8,
unlocked() { return hasUpgrade(this.layer, 33) },
branches: [33]
}
},
clickables: {
21: {
display() { return "Reset directory" },
onClick() {
if (confirm("Are you sure you want to respec?")) {
for (let i of player[this.layer].upgrades) {
player[this.layer].points = player[this.layer].points.add(tmp[this.layer].upgrades[i].cost)
}
player[this.layer].upgrades = []
}
},
canClick() { return true },
style: {
width: "60px",
minHeight: "60px"
}
}
},
2024-03-09 17:38:32 +00:00
layerShown(){ return player.p.points.gte(4000) || player[this.layer].unlocked },
2024-03-10 17:19:22 +00:00
branches: ['p'],
tabFormat: {
filestones: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
"blank",
"blank",
["row", [
["milestones", [0, 2, 4, 6]],
["milestones", [1, 3, 5]]
]]
]
},
directory: {
content: [
"main-display",
["row", ["prestige-button", ["clickable", 11]]],
"resource-display",
"blank",
"blank",
["clickable", 21],
"blank",
["upgrade-tree", [
[11],
[21, 22],
[31, 32, 33],
[42, 43]
]]
],
unlocked() { return hasMilestone('f', 4) }
},
}
2024-03-09 13:28:55 +00:00
})