1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-22 00:21:32 +00:00
The-Modding-Tree/js/game.js

2261 lines
79 KiB
JavaScript
Raw Normal View History

2020-08-19 02:50:24 +00:00
var player;
2020-08-21 19:02:34 +00:00
var tmp = {};
2020-09-01 00:39:33 +00:00
var offTime = {
remain: 0,
speed: 1,
};
2020-08-19 02:50:24 +00:00
var needCanvasUpdate = true;
2020-08-24 02:01:14 +00:00
var NaNalert = false;
2020-08-19 02:50:24 +00:00
function getStartPlayer() {
return {
tab: "tree",
time: Date.now(),
autosave: true,
2020-08-27 19:12:20 +00:00
msDisplay: "always",
2020-08-24 02:01:14 +00:00
versionType: "beta",
2020-08-26 01:45:22 +00:00
version: 1.1,
2020-08-23 19:36:03 +00:00
timePlayed: 0,
2020-08-24 02:01:14 +00:00
hasNaN: false,
2020-08-19 02:50:24 +00:00
points: new Decimal(10),
p: {
unl: false,
points: new Decimal(0),
best: new Decimal(0),
upgrades: [],
},
b: {
unl: false,
points: new Decimal(0),
best: new Decimal(0),
upgrades: [],
2020-08-20 04:55:26 +00:00
auto: false,
2020-08-19 02:50:24 +00:00
},
g: {
unl: false,
points: new Decimal(0),
power: new Decimal(0),
best: new Decimal(0),
upgrades: [],
2020-08-20 04:55:26 +00:00
auto: false,
2020-08-19 02:50:24 +00:00
},
e: {
unl: false,
2020-08-26 03:32:27 +00:00
auto: false,
2020-08-19 02:50:24 +00:00
order: 0,
points: new Decimal(0),
best: new Decimal(0),
enhancers: new Decimal(0),
upgrades: [],
},
t: {
unl: false,
2020-08-26 03:32:27 +00:00
auto: false,
autoCap: false,
2020-08-19 02:50:24 +00:00
order: 0,
points: new Decimal(0),
best: new Decimal(0),
energy: new Decimal(0),
extCapsules: new Decimal(0),
upgrades: [],
},
s: {
unl: false,
2020-08-26 03:32:27 +00:00
auto: false,
2020-08-30 01:39:01 +00:00
autoBuild: false,
2020-08-19 02:50:24 +00:00
order: 0,
points: new Decimal(0),
best: new Decimal(0),
spent: new Decimal(0),
buildings: {
1: new Decimal(0),
2: new Decimal(0),
2020-08-19 19:53:14 +00:00
3: new Decimal(0),
2020-08-20 20:37:22 +00:00
4: new Decimal(0),
5: new Decimal(0)
2020-08-19 02:50:24 +00:00
},
upgrades: [],
},
2020-08-22 01:16:23 +00:00
sb: {
unl: false,
order: 0,
2020-08-26 14:16:23 +00:00
auto: false,
2020-08-22 01:16:23 +00:00
points: new Decimal(0),
best: new Decimal(0),
upgrades: [],
},
2020-08-26 01:45:22 +00:00
h: {
unl: false,
2020-08-29 19:45:18 +00:00
time: 0,
2020-08-26 01:45:22 +00:00
points: new Decimal(0),
best: new Decimal(0),
2020-08-26 16:26:46 +00:00
active: 0,
2020-08-26 01:45:22 +00:00
challs: [],
upgrades: [],
},
q: {
unl: false,
points: new Decimal(0),
best: new Decimal(0),
layers: new Decimal(0),
energy: new Decimal(0),
time: new Decimal(0),
upgrades: [],
},
2020-08-29 23:43:53 +00:00
hb: {
unl: false,
order: 0,
points: new Decimal(0),
best: new Decimal(0),
upgrades: [],
},
ss: {
unl: false,
order: 0,
points: new Decimal(0),
best: new Decimal(0),
subspace: new Decimal(0),
upgrades: [],
},
2020-08-19 02:50:24 +00:00
}
}
2020-08-29 23:43:53 +00:00
const LAYERS = ["p", "b", "g", "e", "t", "s", "sb", "h", "q", "hb", "ss"]
2020-08-19 02:50:24 +00:00
const LAYER_REQS = {
p: new Decimal(10),
b: new Decimal(200),
g: new Decimal(200),
e: new Decimal(1e120),
t: new Decimal(1e120),
s: new Decimal(1e120),
2020-08-22 01:16:23 +00:00
sb: new Decimal(180),
2020-08-26 01:45:22 +00:00
h: new Decimal(1e220),
q: new Decimal("1e512"),
2020-08-29 23:43:53 +00:00
hb: new Decimal(12),
ss: new Decimal(36),
2020-08-19 02:50:24 +00:00
}
const LAYER_RES = {
p: "prestige points",
b: "boosters",
g: "generators",
e: "enhance points",
t: "time capsules",
s: "space energy",
2020-08-22 01:16:23 +00:00
sb: "super-boosters",
2020-08-26 03:32:27 +00:00
h: "hindrance spirit",
2020-08-26 01:45:22 +00:00
q: "quirks",
2020-08-29 23:43:53 +00:00
hb: "hyper-boosters",
ss: "subspace energy",
2020-08-19 02:50:24 +00:00
}
2020-08-29 23:43:53 +00:00
const LAYER_RES_CEIL = ["sb", "hb", "ss"]
2020-08-25 22:42:43 +00:00
2020-08-19 02:50:24 +00:00
const LAYER_TYPE = {
p: "normal",
b: "static",
g: "static",
e: "normal",
t: "static",
s: "static",
2020-08-22 01:16:23 +00:00
sb: "static",
2020-08-26 01:45:22 +00:00
h: "normal",
q: "normal",
2020-08-29 23:43:53 +00:00
hb: "static",
ss: "static",
2020-08-19 02:50:24 +00:00
}
const LAYER_EXP = {
p: new Decimal(0.5),
b: new Decimal(1.25),
g: new Decimal(1.25),
e: new Decimal(0.02),
2020-08-19 19:53:14 +00:00
t: new Decimal(1.85),
s: new Decimal(1.85),
2020-08-22 01:16:23 +00:00
sb: new Decimal(1.25),
2020-08-26 01:45:22 +00:00
h: new Decimal(0.015),
q: new Decimal(0.0075),
2020-08-30 01:39:01 +00:00
hb: new Decimal(2.5),
2020-08-29 23:43:53 +00:00
ss: new Decimal(1.1),
2020-08-19 02:50:24 +00:00
}
const LAYER_BASE = {
b: new Decimal(5),
g: new Decimal(5),
t: new Decimal(1e15),
s: new Decimal(1e15),
2020-08-22 01:16:23 +00:00
sb: new Decimal(1.05),
2020-08-29 23:43:53 +00:00
hb: new Decimal(1.05),
ss: new Decimal(1.15),
2020-08-19 02:50:24 +00:00
}
const LAYER_ROW = {
p: 0,
b: 1,
g: 1,
e: 2,
t: 2,
s: 2,
2020-08-22 01:16:23 +00:00
sb: 2,
2020-08-26 01:45:22 +00:00
h: 3,
q: 3,
2020-08-29 23:43:53 +00:00
hb: 3,
ss: 3,
2020-08-26 01:45:22 +00:00
future_layer: 4,
2020-08-19 02:50:24 +00:00
}
const ROW_LAYERS = [
["p"],
["b","g"],
2020-08-22 01:16:23 +00:00
["e","t","s","sb"],
2020-08-29 23:43:53 +00:00
["h","q","hb","ss"],
2020-08-19 02:50:24 +00:00
["future_layer"],
]
2020-08-31 02:35:50 +00:00
const ORDER_UP = [
[],
[],
["e","t","s","sb"],
["hb","ss"],
[],
]
2020-08-19 02:50:24 +00:00
const LAYER_EFFS = {
2020-08-26 16:26:46 +00:00
b: function() {
2020-08-26 19:08:00 +00:00
if (tmp.hcActive ? tmp.hcActive[11] : true) return new Decimal(1);
2020-09-01 02:11:22 +00:00
return Decimal.pow(Decimal.add(2, tmp.atbb).max(0), player.b.points.plus(getFreeBoosters())).max(0)
2020-08-26 16:26:46 +00:00
},
2020-09-01 02:11:22 +00:00
g: function() { return Decimal.pow(Decimal.add(2, tmp.atgb).max(0), player.g.points.times(getGenPow())).sub(1).times(getGenPowerGainMult()).max(0) },
2020-08-19 02:50:24 +00:00
t: function() { return {
2020-08-27 19:12:20 +00:00
gain: Decimal.pow(3, player.t.points.plus(player.t.extCapsules.plus(tmp.freeExtCap).times(getFreeExtPow())).times(getCapPow())).sub(1).times(getTimeEnergyGainMult()),
limit: Decimal.pow(2, player.t.points.plus(player.t.extCapsules.plus(tmp.freeExtCap).times(getFreeExtPow())).times(getCapPow())).sub(1).times(100).times(getTimeEnergyLimitMult()),
2020-08-19 02:50:24 +00:00
}},
2020-08-26 22:42:19 +00:00
sb: function() { return Decimal.pow(Decimal.add(1.5, addToSBBase()), player.sb.points.times(getSuperBoosterPow())) },
2020-08-26 16:26:46 +00:00
h: function() {
let ret = player.h.points.plus(1).times(player.points.times(player.h.points).plus(1).log10().plus(1).log10().plus(1)).log10().times(5).root(player.q.upgrades.includes(12)?1.25:2);
if (ret.gte(100)) ret = ret.log10().times(50).min(ret);
return ret;
},
2020-08-30 01:39:01 +00:00
hb: function() { return Decimal.pow(1.6, player.hb.points.pow(getHyperBoosterExp()).times(getHyperBoosterPow())) },
ss: function() { return player.ss.points.pow(2.5).times(getSubspaceGainMult()) },
2020-08-19 02:50:24 +00:00
}
const LAYER_UPGS = {
p: {
2020-08-23 19:36:03 +00:00
rows: 3,
2020-08-19 02:50:24 +00:00
cols: 3,
11: {
desc: "Gain 1 Point every second.",
cost: new Decimal(1),
unl: function() { return player.p.unl },
},
12: {
desc: "Point generation is faster based on your unspent Prestige Points.",
cost: new Decimal(1),
unl: function() { return player.p.upgrades.includes(11) },
2020-08-27 19:12:20 +00:00
currently: function() {
if (tmp.hcActive ? tmp.hcActive[32] : true) return new Decimal(1)
return player.p.points.plus(1).pow(player.g.upgrades.includes(24)?1.1:(player.g.upgrades.includes(14)?0.75:0.5))
},
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return format(x)+"x" },
},
13: {
desc: "Point generation is faster based on your Point amount.",
cost: new Decimal(5),
unl: function() { return player.p.upgrades.includes(12) },
currently: function() {
let ret = player.points.plus(1).log10().pow(0.75).plus(1)
if (player.g.upgrades.includes(15)) ret = ret.pow(LAYER_UPGS.g[15].currently())
return ret;
},
effDisp: function(x) { return format(x)+"x" },
},
21: {
desc: "Prestige Point gain is doubled.",
cost: new Decimal(20),
unl: function() { return (player.b.unl||player.g.unl)&&player.p.upgrades.includes(11) },
},
22: {
desc: "Point generation is faster based on your Prestige Upgrades bought.",
cost: new Decimal(75),
unl: function() { return (player.b.unl||player.g.unl)&&player.p.upgrades.includes(12) },
currently: function() { return Decimal.pow(1.4, player.p.upgrades.length) },
effDisp: function(x) { return format(x)+"x" },
},
23: {
desc: "Prestige Point gain is boosted by your Point amount.",
cost: new Decimal(5e3),
unl: function() { return (player.b.unl||player.g.unl)&&player.p.upgrades.includes(13) },
currently: function() {
let ret = player.points.plus(1).log10().cbrt().plus(1)
if (player.g.upgrades.includes(23)) ret = ret.pow(LAYER_UPGS.g[23].currently())
2020-08-23 19:36:03 +00:00
if (player.p.upgrades.includes(33)) ret = ret.pow(1.25)
2020-08-19 02:50:24 +00:00
return ret;
},
effDisp: function(x) { return format(x)+"x" },
},
2020-08-23 19:36:03 +00:00
31: {
desc: "Prestige Point gain is boosted by your Prestige Point amount.",
cost: new Decimal("1e4450"),
unl: function() { return player.e.upgrades.includes(33) },
2020-08-27 15:38:26 +00:00
currently: function() {
let ret = player.p.points.plus(1).log10().plus(1).pow(player.p.points.plus(1).log10().div(200).plus(1)).pow(player.p.upgrades.includes(32) ? LAYER_UPGS.p[32].currently() : 1)
if (ret.gte("1e1000")) ret = ret.log10().times("1e997")
return ret;
},
2020-08-23 19:36:03 +00:00
effDisp: function(x) { return format(x)+"x" },
},
32: {
desc: "The upgrade to the left is stronger based on your Points.",
cost: new Decimal("1e5140"),
unl: function() { return player.e.upgrades.includes(33) },
currently: function() { return player.points.plus(1).log10().plus(1).root(16) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
33: {
desc: "The above upgrade is 25% stronger.",
cost: new Decimal("1e5500"),
unl: function() { return player.e.upgrades.includes(33) },
},
2020-08-19 02:50:24 +00:00
},
b: {
2020-08-30 16:18:34 +00:00
rows: 3,
2020-08-19 02:50:24 +00:00
cols: 3,
11: {
desc: "Boosters boost Prestige Point gain.",
cost: new Decimal(3),
unl: function() { return player.b.unl },
2020-08-19 19:53:14 +00:00
currently: function() { return player.b.points.sqrt().plus(1).max(1.5) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return format(x)+"x" },
},
12: {
desc: "Generators add to the Booster effect.",
cost: new Decimal(7),
unl: function() { return player.g.unl },
2020-08-26 19:08:00 +00:00
currently: function() { return player.g.points.plus(1).log10().sqrt().div(3).times((player.t.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true))?8.5:1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return "+"+format(x)+" to base" },
},
13: {
desc: "Prestige Points add to the Booster effect.",
cost: new Decimal(8),
unl: function() { return player.b.best.gte(8) },
currently: function() { return player.p.points.plus(1).log10().plus(1).log10().div(3) },
effDisp: function(x) { return "+"+format(x)+" to base" },
},
21: {
desc: "Square the Generator Power effect.",
cost: new Decimal(10),
unl: function() { return player.b.upgrades.includes(11) && player.b.upgrades.includes(12) },
},
22: {
desc: "The Generator Power effect is raised to the power of 1.2.",
cost: new Decimal(15),
unl: function() { return player.b.upgrades.includes(12) && player.b.upgrades.includes(13) },
},
23: {
desc: "Boosters are cheaper based on your points.",
cost: new Decimal(18),
unl: function() { return player.b.upgrades.includes(21) || player.b.upgrades.includes(22) },
2020-08-21 19:02:34 +00:00
currently: function() { return player.points.plus(1).log10().plus(1).pow(3.2).pow(tmp.spaceBuildEff?tmp.spaceBuildEff[4]:1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return "/"+format(x) },
},
2020-08-30 16:18:34 +00:00
31: {
desc: "Hyper-Boosters multiply the Booster base.",
cost: new Decimal(1250),
unl: function() { return player.hb.upgrades.includes(14) },
currently: function() { return Decimal.pow(4, player.hb.points.pow(2)) },
effDisp: function(x) { return format(x)+"x" },
},
32: {
2020-08-31 18:33:29 +00:00
desc: "Add free Boosters based on your Generator Power.",
2020-09-01 02:27:52 +00:00
cost: new Decimal(1263),
2020-08-30 16:18:34 +00:00
unl: function() { return player.hb.upgrades.includes(14) },
2020-08-31 18:33:29 +00:00
currently: function() { return player.g.power.plus(1).log10().sqrt().floor() },
effDisp: function(x) { return "+"+formatWhole(x) },
2020-08-30 16:18:34 +00:00
},
33: {
2020-09-01 00:39:33 +00:00
desc: "Add 100 free Boosters.",
cost: new Decimal(1270),
2020-08-30 16:18:34 +00:00
unl: function() { return player.hb.upgrades.includes(14) },
},
2020-08-19 02:50:24 +00:00
},
g: {
2020-08-30 16:18:34 +00:00
rows: 3,
2020-08-19 02:50:24 +00:00
cols: 5,
11: {
desc: "Generators boost Prestige Point gain.",
cost: new Decimal(3),
unl: function() { return player.g.unl },
2020-08-19 19:53:14 +00:00
currently: function() { return player.g.points.sqrt().plus(1).max(1.5) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return format(x)+"x" },
},
12: {
desc: "Boosters boost Generator Power gain.",
cost: new Decimal(7),
unl: function() { return player.b.unl },
2020-08-26 19:08:00 +00:00
currently: function() { return player.b.points.plus(1).log10().sqrt().div(3).times((player.t.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true))?3.75:1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return "+"+format(x)+" to base" },
},
13: {
desc: "Prestige Points boost Generator Power gain.",
cost: new Decimal(8),
unl: function() { return player.g.best.gte(8) },
currently: function() { return player.p.points.plus(1).log10().plus(1).log10().div(3) },
effDisp: function(x) { return "+"+format(x)+" to base" },
},
14: {
desc: "Prestige Upgrade 2 uses a better formula.",
cost: new Decimal(13),
unl: function() { return player.g.best.gte(10) },
},
15: {
desc: "Prestige Upgrade 3 is stronger based on your Generators.",
cost: new Decimal(15),
unl: function() { return player.g.upgrades.includes(13) },
2020-08-26 19:08:00 +00:00
currently: function() { return player.g.points.sqrt().plus(1).times((player.e.upgrades.includes(32)&&!(tmp.hcActive?tmp.hcActive[12]:true)) ? LAYER_UPGS.e[32].currently() : 1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return "^"+format(x) },
},
21: {
desc: "Generator Power generates faster based on its amount.",
cost: new Decimal(18),
unl: function() { return player.g.upgrades.includes(15) },
currently: function() { return player.g.power.plus(1).log10().plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
22: {
desc: "Generators are cheaper based on your Prestige Points.",
cost: new Decimal(19),
unl: function() { return player.g.upgrades.includes(15) },
2020-08-31 02:35:50 +00:00
currently: function() { return player.p.points.plus(1).pow(0.25).pow(player.g.upgrades.includes(32)?2.5:1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return "/"+format(x) },
},
23: {
desc: "Prestige Upgrade 6 is stronger based on your Boosters.",
cost: new Decimal(20),
unl: function() { return player.b.unl && player.g.upgrades.includes(15) },
currently: function() { return player.b.points.pow(0.75).plus(1) },
effDisp: function(x) { return "^"+format(x) },
},
24: {
desc: "Prestige Upgrade 2 uses an even better formula.",
cost: new Decimal(22),
unl: function() { return player.g.upgrades.includes(14) && (player.g.upgrades.includes(21)||player.g.upgrades.includes(22)) },
},
25: {
desc: "Prestige Points boost Generator Power gain.",
cost: new Decimal(28),
unl: function() { return player.g.upgrades.includes(23) && player.g.upgrades.includes(24) },
2020-08-30 16:18:34 +00:00
currently: function() { return player.p.points.plus(1).log10().sqrt().plus(1).pow((player.t.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true))?2.75:1).pow(player.g.upgrades.includes(31) ? LAYER_UPGS.g[31].currently() : 1) },
2020-08-19 02:50:24 +00:00
effDisp: function(x) { return format(x)+"x" },
},
2020-08-30 16:18:34 +00:00
31: {
2020-08-31 02:35:50 +00:00
desc: "Generator Upgrade 10 is stronger based on your Generators.",
2020-08-30 16:18:34 +00:00
cost: new Decimal(950),
unl: function() { return player.ss.upgrades.includes(21) },
currently: function() { return player.g.points.plus(1).log10().pow(3.6).plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
32: {
2020-08-31 02:35:50 +00:00
desc: "Generator Upgrade 7 is 150% stronger.",
cost: new Decimal(960),
2020-08-30 16:18:34 +00:00
unl: function() { return player.ss.upgrades.includes(21) },
},
33: {
2020-08-31 02:35:50 +00:00
desc: "Generator Power adds to the Generator base.",
cost: new Decimal(1025),
2020-08-30 16:18:34 +00:00
unl: function() { return player.ss.upgrades.includes(21) },
2020-08-31 02:35:50 +00:00
currently: function() { return player.g.power.plus(1).log10().div(15).plus(1) },
effDisp: function(x) { return "+"+format(x) },
2020-08-30 16:18:34 +00:00
},
34: {
2020-09-01 00:39:33 +00:00
desc: "Generators are stronger based on their amount.",
2020-09-01 02:27:52 +00:00
cost: new Decimal(1070),
2020-08-30 16:18:34 +00:00
unl: function() { return player.ss.upgrades.includes(21) },
2020-09-01 00:39:33 +00:00
currently: function() { return player.g.points.plus(1).log10().plus(1).log10().plus(1).sqrt() },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
2020-08-30 16:18:34 +00:00
},
35: {
2020-09-01 00:39:33 +00:00
desc: "Subspace boosts Generator Power gain.",
2020-09-01 02:27:52 +00:00
cost: new Decimal(1130),
2020-08-30 16:18:34 +00:00
unl: function() { return player.ss.upgrades.includes(21) },
2020-09-01 00:39:33 +00:00
currently: function() { return player.ss.subspace.plus(1).pow(25) },
effDisp: function(x) { return format(x)+"x" },
2020-08-30 16:18:34 +00:00
},
2020-08-19 02:50:24 +00:00
},
e: {
2020-08-23 19:36:03 +00:00
rows: 3,
2020-08-20 04:55:26 +00:00
cols: 5,
2020-08-19 19:53:14 +00:00
11: {
desc: "Boosters & Generators boost each other.",
cost: new Decimal(40),
unl: function() { return player.e.unl },
2020-08-20 04:55:26 +00:00
currently: function() {
let exp = 1
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true)) exp = 1.5
2020-08-20 04:55:26 +00:00
return {g: player.b.points.plus(1).log10().pow(exp), b: player.g.points.plus(1).log10().pow(exp)}
},
2020-08-19 19:53:14 +00:00
effDisp: function(x) { return "+"+format(x.g)+" to Generator base, +"+format(x.b)+" to Booster base" },
},
12: {
desc: "Unspent Enhance Points boost Prestige Point gain.",
cost: new Decimal(150),
unl: function() { return player.e.unl&&player.e.best.gte(40) },
2020-08-27 15:38:26 +00:00
currently: function() {
let ret = player.e.points.plus(1).pow((player.e.upgrades.includes(15)&&!(tmp.hcActive?tmp.hcActive[12]:true))?3.25:1.5)
if (ret.gte("1e1500")) ret = ret.sqrt().times("1e750")
return ret
},
2020-08-19 19:53:14 +00:00
effDisp: function(x) { return format(x)+"x" },
},
13: {
desc: "You gain 1e10x as many Prestige Points.",
cost: new Decimal(1000),
unl: function() { return player.e.upgrades.includes(11)||player.e.upgrades.includes(12) },
},
2020-08-20 04:55:26 +00:00
14: {
desc: "Enhance Upgrade 1 uses a better formula.",
cost: new Decimal(5e7),
unl: function() { return player.e.upgrades.includes(13)&&(player.t.unl||player.s.unl) },
},
15: {
desc: "Enhance Upgrade 2 uses a better formula.",
cost: new Decimal(2e10),
unl: function() { return player.e.upgrades.includes(14)&&(player.t.unl||player.s.unl)&&player.e.best.gte(1e9) },
},
2020-08-20 20:37:22 +00:00
21: {
desc: "The Generator Power effect is raised to the power of 1.15.",
cost: new Decimal(1e15),
unl: function() { return player.t.unl&&(player.t.order==1||player.s.unl)&&player.e.upgrades.includes(14) },
},
22: {
2020-08-21 03:33:13 +00:00
desc: "This layer behaves as if you chose it first (base req is now 1e120 points)",
cost: new Decimal(1e22),
unl: function() { return (player.t.unl&&player.s.unl&&player.e.order==2)||player.e.upgrades.includes(22)||player.e.upgrades.includes(23) },
2020-08-20 20:37:22 +00:00
},
23: {
2020-08-21 03:33:13 +00:00
desc: "This layer behaves as if you chose it first (base req is now 1e120 points)",
cost: new Decimal(1e40),
2020-08-21 19:02:34 +00:00
unl: function() { return (player.t.unl&&player.s.unl)||player.e.upgrades.includes(22)||player.e.upgrades.includes(23) },
2020-08-20 20:37:22 +00:00
},
24: {
2020-08-21 19:02:34 +00:00
desc: "Prestige Points boost Enhance Point gain.",
cost: new Decimal(1e65),
unl: function() { return player.t.unl&&player.s.unl&&player.e.best.gte(1e50) },
currently: function() { return player.p.points.plus(1).pow(0.002) },
effDisp: function(x) { return format(x)+"x" },
2020-08-20 20:37:22 +00:00
},
25: {
2020-08-21 19:02:34 +00:00
desc: "Enhancers are stronger based on your Space Energy & Time Capsules.",
cost: new Decimal(7.777e77),
unl: function() { return player.t.unl&&player.s.unl&&player.e.best.gte(1e60) },
currently: function() {
let ret = player.s.points.plus(player.t.points).div(32).plus(1);
2020-08-23 19:36:03 +00:00
if (ret.gte(2)) ret = ret.log(2).plus(1).times(2).sqrt();
2020-08-21 19:02:34 +00:00
return ret;
},
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
2020-08-20 20:37:22 +00:00
},
2020-08-23 19:36:03 +00:00
31: {
desc: "Enhancers are stronger based on your Super-Boosters.",
cost: new Decimal(1e90),
unl: function() { return player.e.upgrades.includes(25)&&player.sb.unl },
currently: function() { return player.sb.points.pow(0.75).div(4).plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
32: {
desc: "Generator Upgrade 5 is stronger based on your Enhance Points.",
cost: new Decimal(7.5e108),
unl: function() { return player.e.upgrades.includes(25)&&player.sb.unl },
currently: function() {
2020-08-27 15:38:26 +00:00
let ret = Decimal.pow(10, player.e.points.plus(1).log10().pow(0.085)).div(10).max(1).min(10);
2020-08-23 19:36:03 +00:00
return ret;
},
effDisp: function(x) { return format(x)+"x" },
},
33: {
desc: "Unlock 3 new Prestige Upgrades.",
cost: new Decimal(2.5e139),
unl: function() { return player.e.upgrades.includes(31)||player.e.upgrades.includes(32) },
},
34: {
desc: "You gain 1e40x as many Prestige Points.",
cost: new Decimal(1e152),
unl: function() { return player.e.upgrades.includes(31)&&player.e.upgrades.includes(32) },
},
35: {
desc: "Points boost Generator Power gain.",
cost: new Decimal(2e189),
unl: function() { return player.e.upgrades.includes(33)||player.e.upgrades.includes(34) },
currently: function() { return player.points.plus(1).pow(0.004) },
effDisp: function(x) { return format(x)+"x" },
},
2020-08-19 02:50:24 +00:00
},
t: {
2020-08-20 20:37:22 +00:00
rows: 3,
2020-08-19 19:53:14 +00:00
cols: 4,
11: {
desc: "Non-extra Time Capsules boost the Booster effect.",
cost: new Decimal(2),
unl: function() { return player.t.unl },
2020-08-26 19:08:00 +00:00
currently: function() { return player.t.points.pow(0.9).plus(0.5).plus((player.t.upgrades.includes(13)&&!(tmp.hcActive?tmp.hcActive[12]:true))?LAYER_UPGS.t[13].currently():0) },
2020-08-19 19:53:14 +00:00
effDisp: function(x) { return "+"+format(x)+" to base" },
},
12: {
desc: "The Time Energy cap starts later based on your Boosters, and you get a free Extra Time Capsule.",
cost: new Decimal(3),
unl: function() { return player.t.best.gte(2)&&player.t.unl },
2020-08-29 19:45:18 +00:00
currently: function() { return player.b.points.pow(0.95).plus(1).pow(player.q.upgrades.includes(43)?16:1) },
2020-08-19 19:53:14 +00:00
effDisp: function(x) { return format(x)+"x" },
},
13: {
desc: "Extra Time Capsules are added to the first Time Upgrade's effect formula, but at a reduced amount.",
cost: new Decimal(3),
unl: function() { return player.t.upgrades.includes(11) },
2020-08-21 19:02:34 +00:00
currently: function() { return player.t.extCapsules.plus(tmp.freeExtCap).pow(0.95) },
2020-08-19 19:53:14 +00:00
effDisp: function(x) { return "+"+format(x) },
},
14: {
2020-08-19 22:12:31 +00:00
desc: "Generator Upgrades 2 & 10 are 275% stronger, and Booster Upgrade 2 is 750% stronger.",
2020-08-19 19:53:14 +00:00
cost: new Decimal(4),
unl: function() { return player.t.upgrades.includes(12)||player.t.upgrades.includes(13) },
},
2020-08-19 22:12:31 +00:00
21: {
2020-08-20 01:27:52 +00:00
desc: "Time Energy boosts its own production & limit, and the Time Energy effect uses a better formula.",
2020-08-19 22:12:31 +00:00
cost: new Decimal(4),
unl: function() { return player.t.upgrades.includes(14) },
currently: function() { return player.t.energy.plus(1).log10().pow(1.1).plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
22: {
2020-08-20 01:27:52 +00:00
desc: "Time Energy production & limit are boosted by your Enhance Points.",
cost: new Decimal(5),
unl: function() { return player.t.upgrades.includes(14)&&player.e.unl },
2020-08-27 15:38:26 +00:00
currently: function() {
let ret = player.e.points.plus(1).pow(0.8/(1+player.t.order))
if (ret.gte("1e400")) ret = ret.log10().times(Decimal.div("1e400", 400)).min(ret)
return ret;
},
2020-08-20 01:27:52 +00:00
effDisp: function(x) { return format(x)+"x" },
2020-08-19 22:12:31 +00:00
},
23: {
2020-08-20 01:27:52 +00:00
desc: "Time Energy production & limit are boosted by your Space Energy.",
cost: new Decimal(5),
unl: function() { return player.t.upgrades.includes(14)&&player.s.unl },
currently: function() { return Decimal.pow(3, player.s.points.pow(0.9)) },
effDisp: function(x) { return format(x)+"x" },
2020-08-19 22:12:31 +00:00
},
24: {
2020-08-20 04:55:26 +00:00
desc: "Get 18 free boosters added to their effect.",
cost: new Decimal(7),
unl: function() { return player.t.upgrades.includes(21)&&player.t.best.gte(5) },
2020-08-19 22:12:31 +00:00
},
2020-08-20 20:37:22 +00:00
31: {
desc: "Add 25 to the booster effect base.",
cost: new Decimal(8),
unl: function() { return (player.t.upgrades.includes(22)&&(player.e.order==1||player.s.unl))||(player.t.upgrades.includes(23)&&(player.s.order==1||player.e.unl)) },
},
32: {
2020-08-21 03:33:13 +00:00
desc: "This layer behaves as if you chose it first (base req is now 1e120 points)",
cost: new Decimal(12),
unl: function() { return (player.s.unl&&player.e.unl)||player.t.upgrades.includes(32) },
2020-08-20 20:37:22 +00:00
},
33: {
2020-08-21 19:02:34 +00:00
desc: "Add 40 to the booster effect base.",
cost: new Decimal(16),
unl: function() { return player.s.unl&&player.e.unl&&player.t.upgrades.includes(32) },
2020-08-20 20:37:22 +00:00
},
34: {
2020-08-22 03:59:24 +00:00
desc: "Time Energy caps later and generates faster based on your non-free Time Capsules.",
2020-08-23 19:36:03 +00:00
cost: new Decimal(18),
unl: function() { return player.t.upgrades.includes(33)&&player.sb.unl },
currently: function() { return Decimal.pow(10, player.t.points.pow(1.2)) },
2020-08-22 03:59:24 +00:00
effDisp: function(x) { return format(x)+"x" },
2020-08-20 20:37:22 +00:00
},
2020-08-19 02:50:24 +00:00
},
s: {
2020-08-20 20:37:22 +00:00
rows: 3,
2020-08-19 19:53:14 +00:00
cols: 4,
11: {
desc: "Add a free level to all Space Buildings.",
cost: new Decimal(2),
unl: function() { return player.s.unl },
},
12: {
desc: "Generator Power boosts its own generation.",
cost: new Decimal(3),
unl: function() { return player.s.best.gte(2)&&player.s.unl },
currently: function() { return player.g.power.plus(1).log10().plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
13: {
desc: "Space Building Levels boost Generator Power gain, and get 2 extra Space.",
cost: new Decimal(3),
unl: function() { return player.s.upgrades.includes(11) },
currently: function() { return Decimal.pow(20, Object.values(player.s.buildings).reduce((a,b) => Decimal.add(a,b))) },
effDisp: function(x) { return format(x)+"x" },
},
14: {
desc: "Unlock a 4th Space Building, and add a free level to all Space Buildings.",
cost: new Decimal(4),
unl: function() { return player.s.upgrades.includes(12)&&player.s.upgrades.includes(13) },
},
2020-08-19 22:12:31 +00:00
21: {
desc: "All Space Buildings are stronger based on your Generators.",
cost: new Decimal(4),
unl: function() { return player.s.upgrades.includes(14) },
currently: function() { return player.g.points.plus(1).log10().div(1.5).plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
22: {
2020-08-20 04:55:26 +00:00
desc: "Space Buildings are stronger based on your Time Energy.",
cost: new Decimal(6),
unl: function() { return player.s.upgrades.includes(14)&&player.t.unl },
currently: function() { return player.t.energy.plus(1).log10().plus(1).log10().div(5).plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
2020-08-19 22:12:31 +00:00
},
23: {
2020-08-20 04:55:26 +00:00
desc: "Space Buildings are stronger based on your Enhancers.",
cost: new Decimal(5),
unl: function() { return player.s.upgrades.includes(14)&&player.e.unl },
currently: function() { return player.e.enhancers.sqrt().div((player.s.order==0)?5:7).plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
2020-08-19 22:12:31 +00:00
},
24: {
2020-08-20 04:55:26 +00:00
desc: "Space Building costs scale half as fast, and you have 3 more Space.",
cost: new Decimal(7),
unl: function() { return player.s.upgrades.includes(21)&&(player.t.unl||player.e.unl) },
2020-08-19 22:12:31 +00:00
},
2020-08-20 20:37:22 +00:00
31: {
desc: "Space Building 1 uses a better formula.",
cost: new Decimal(7),
unl: function() { return (player.s.upgrades.includes(22)&&(player.t.order==0||player.e.unl))||(player.s.upgrades.includes(23)&&(player.e.order==0||player.t.unl)) },
},
32: {
desc: "Unlock a 5th Space Building.",
cost: new Decimal(8),
unl: function() { return (player.s.upgrades.includes(22)&&(player.t.order==1||player.e.unl))||(player.s.upgrades.includes(23)&&(player.e.order==1||player.t.unl)) },
},
33: {
2020-08-21 03:33:13 +00:00
desc: "This layer behaves as if you chose it first (base req is now 1e120 points)",
cost: new Decimal(12),
unl: function() { return (player.t.unl&&player.e.unl)||player.s.upgrades.includes(33) },
2020-08-20 20:37:22 +00:00
},
34: {
2020-08-21 03:33:13 +00:00
desc: "Space Buildings boost the Generator Power effect (before all other boosts).",
cost: new Decimal(15),
unl: function() { return player.t.unl&&player.e.unl&&player.t.order==0&&player.e.order==0&&player.s.order==0 },
currently: function() { return Decimal.pow(Object.values(player.s.buildings).reduce((a,b) => Decimal.add(a,b)), 0.2).div(17.5) },
effDisp: function(x) { return "Add "+format(x)+" to exponent" },
2020-08-20 20:37:22 +00:00
},
2020-08-19 02:50:24 +00:00
},
2020-08-22 01:16:23 +00:00
sb: {
2020-08-27 19:12:20 +00:00
rows: 2,
2020-08-22 03:59:24 +00:00
cols: 2,
2020-08-22 01:16:23 +00:00
11: {
desc: "Super-Boosters are stronger based on your Prestige Points.",
cost: new Decimal(2),
unl: function() { return player.sb.unl },
2020-08-22 03:59:24 +00:00
currently: function() {
let ret = Decimal.pow(10, player.p.points.plus(1).log10().div(1e5).sqrt());
if (ret.gte(2.5)) ret = ret.log(2.5).plus(1.5).min(ret);
2020-08-23 19:36:03 +00:00
return ret.max(1);
2020-08-22 03:59:24 +00:00
},
effDisp: function(x) { return format(x)+"x" },
},
12: {
desc: "Super-Boosters are stronger based on your Generators.",
2020-08-23 19:36:03 +00:00
cost: new Decimal(4),
2020-08-22 03:59:24 +00:00
unl: function() { return player.sb.upgrades.includes(11) },
2020-08-23 19:36:03 +00:00
currently: function() { return player.g.points.div(10).pow(0.04).max(1) },
2020-08-22 01:16:23 +00:00
effDisp: function(x) { return format(x)+"x" },
},
2020-08-27 19:12:20 +00:00
21: {
desc: "Super-Boosters add to the Booster base.",
cost: new Decimal(8),
unl: function() { return player.h.challs.includes(32) },
currently: function() { return player.sb.points.pow(2.15) },
effDisp: function(x) { return "+"+format(x) },
},
22: {
2020-08-29 19:45:18 +00:00
desc: "Super-Boosters add to the Super-Booster base.",
cost: new Decimal(12),
2020-08-27 19:12:20 +00:00
unl: function() { return player.h.challs.includes(32) },
2020-08-29 19:45:18 +00:00
currently: function() { return player.sb.points.plus(1).log10().div(3) },
effDisp: function(x) { return "+"+format(x) },
2020-08-27 19:12:20 +00:00
},
2020-08-22 01:16:23 +00:00
},
2020-08-26 01:45:22 +00:00
h: {
rows: 0,
cols: 0,
},
q: {
2020-08-29 18:00:32 +00:00
rows: 4,
2020-08-29 16:43:58 +00:00
cols: 4,
2020-08-26 03:32:27 +00:00
11: {
desc: "Quirks & Hindrance Spirit boost Point, Prestige Point, and Enhance Point gain.",
cost: new Decimal(1),
unl: function() { return player.q.unl&&player.q.layers.gt(0) },
currently: function() { return player.q.points.plus(1).times(player.h.points.plus(1)).pow(0.75) },
effDisp: function(x) { return format(x)+"x" },
},
12: {
desc: "The Quirk Energy and Hindrance Spirit effects use better formulas.",
cost: new Decimal(5),
unl: function() { return player.q.upgrades.includes(11)&&player.h.best.gte(3) },
},
2020-08-26 16:26:46 +00:00
13: {
desc: "Quirk Layers are twice as fast.",
cost: new Decimal(50),
unl: function() { return player.q.upgrades.includes(11)&&player.h.challs.includes(11) },
},
2020-08-29 16:43:58 +00:00
14: {
desc: "Quirk Layers are thrice as fast.",
cost: new Decimal(2e10),
2020-08-29 18:00:32 +00:00
unl: function() { return player.h.challs.includes(32) },
2020-08-29 16:43:58 +00:00
},
2020-08-26 19:08:00 +00:00
21: {
desc: "Quirk Layers are faster based on your Quirks.",
cost: new Decimal(160),
unl: function() { return (player.q.upgrades.includes(12)||player.q.upgrades.includes(13))&&player.h.challs.includes(12) },
currently: function() { return player.q.points.plus(1).log10().plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
22: {
2020-08-26 20:40:54 +00:00
desc: "Quirk & Hindrance Spirit gain boost each other.",
cost: new Decimal(400),
2020-08-26 19:08:00 +00:00
unl: function() { return player.q.upgrades.includes(12)&&player.q.upgrades.includes(13)&&player.h.challs.includes(12) },
2020-08-26 20:40:54 +00:00
currently: function() { return {
q: player.h.points.div(10).plus(1).sqrt(),
h: player.q.points.div(10).plus(1).sqrt(),
}},
effDisp: function(x) { return format(x.q)+"x to Quirk gain, "+format(x.h)+"x to Hindrance Spirit gain" },
2020-08-26 19:08:00 +00:00
},
23: {
2020-08-26 22:42:19 +00:00
desc: "The Time Energy limit is 1e10x higher.",
cost: new Decimal(5000),
2020-08-26 19:08:00 +00:00
unl: function() { return player.q.upgrades.includes(21)||player.q.upgrades.includes(22) },
},
2020-08-29 16:43:58 +00:00
24: {
desc: "The Time Energy limit is higher based on your Quirk Energy.",
cost: new Decimal(5e10),
2020-08-29 18:00:32 +00:00
unl: function() { return player.h.challs.includes(32) },
2020-08-29 16:43:58 +00:00
currently: function() { return player.q.energy.div(1e6).plus(1).pow(0.9) },
effDisp: function(x) { return format(x)+"x" },
},
2020-08-27 15:38:26 +00:00
31: {
desc: "Get 1 of each Space Building for free.",
cost: new Decimal(150000),
unl: function() { return player.q.upgrades.includes(21)&&player.q.upgrades.includes(22) },
},
32: {
desc: "The Quirk Energy effect is squared.",
cost: new Decimal(500000),
unl: function() { return player.q.upgrades.includes(23)||player.q.upgrades.includes(31) },
},
33: {
2020-08-29 16:43:58 +00:00
desc: "Time Capsules are stronger based on their amount.",
2020-08-27 19:12:20 +00:00
cost: new Decimal(2e9),
unl: function() { return player.q.upgrades.includes(23)&&player.q.upgrades.includes(31) },
currently: function() { return player.t.points.plus(player.t.extCapsules.plus(tmp.freeExtCap)).plus(1).log10().plus(1) },
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
2020-08-27 15:38:26 +00:00
},
2020-08-29 16:43:58 +00:00
34: {
desc: "Enhance Points boost Hindrance Spirit & Quirk gain.",
cost: new Decimal(1e11),
2020-08-29 18:00:32 +00:00
unl: function() { return player.h.challs.includes(32) },
2020-08-29 16:43:58 +00:00
currently: function() { return player.e.points.plus(1).log10().cbrt().plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
2020-08-29 18:00:32 +00:00
41: {
desc: "Space Buildings are 40% stronger.",
cost: new Decimal(2.5e13),
unl: function() { return player.h.challs.includes(32) },
},
42: {
desc: "Enhancers are 40% stronger.",
cost: new Decimal(2e14),
unl: function() { return player.h.challs.includes(32) },
},
43: {
2020-08-29 19:45:18 +00:00
desc: "Time Upgrade 2 is 1,500% stronger.",
cost: new Decimal(1e16),
2020-08-29 18:00:32 +00:00
unl: function() { return player.h.challs.includes(32) },
},
44: {
2020-08-29 19:45:18 +00:00
desc: "You gain more Hindrance Spirit based on your Quirk Energy.",
cost: new Decimal(4e16),
2020-08-29 18:00:32 +00:00
unl: function() { return player.h.challs.includes(32) },
2020-08-29 19:45:18 +00:00
currently: function() { return player.q.energy.plus(1).log10().plus(1) },
effDisp: function(x) { return format(x)+"x" },
2020-08-29 18:00:32 +00:00
},
2020-08-26 01:45:22 +00:00
},
2020-08-29 23:43:53 +00:00
hb: {
2020-08-30 01:39:01 +00:00
rows: 1,
2020-08-30 16:18:34 +00:00
cols: 4,
2020-08-30 01:39:01 +00:00
11: {
desc: "Super-Boosters are stronger based on your Hyper-Boosters.",
cost: new Decimal(2),
unl: function() { return player.hb.unl },
2020-08-30 02:28:21 +00:00
currently: function() { return player.hb.points.sqrt().div(4).plus(1) },
2020-08-30 01:39:01 +00:00
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
12: {
desc: "Hyper-Boosters are stronger based on your Super-Boosters.",
cost: new Decimal(2),
unl: function() { return player.hb.unl },
2020-08-30 02:28:21 +00:00
currently: function() { return player.sb.points.div(10).plus(1).log10().plus(1) },
2020-08-30 01:39:01 +00:00
effDisp: function(x) { return format(x.sub(1).times(100))+"% stronger" },
},
2020-08-30 02:28:21 +00:00
13: {
desc: "This layer behaves as if you chose it first.",
cost: new Decimal(2),
unl: function() { return player.hb.order>0||(player.ss.upgrades.includes(15))||player.hb.upgrades.includes(13) },
},
2020-08-30 16:18:34 +00:00
14: {
desc: "Unlock 3 new Booster Upgrades.",
cost: new Decimal(3),
unl: function() { return player.hb.upgrades.includes(13)&&player.ss.upgrades.includes(15) },
},
2020-08-29 23:43:53 +00:00
},
ss: {
2020-08-30 16:18:34 +00:00
rows: 2,
2020-08-30 02:28:21 +00:00
cols: 5,
2020-08-30 01:39:01 +00:00
11: {
desc: "You get more Space based on your Subspace Energy.",
cost: new Decimal(1),
unl: function() { return player.ss.unl },
currently: function() { return player.ss.points.sqrt().times(150).floor() },
effDisp: function(x) { return formatWhole(x)+" more Space" },
},
12: {
desc: "You generate Subspace faster based on your Points.",
cost: new Decimal(2),
unl: function() { return player.ss.unl },
currently: function() { return player.points.plus(1).log10().div(1e4).plus(1) },
effDisp: function(x) { return format(x)+"x" },
},
13: {
desc: "Subspace's third effect is 50% stronger.",
cost: new Decimal(2),
unl: function() { return player.ss.unl },
},
14: {
2020-08-30 02:28:21 +00:00
desc: "Super-Boosters are 8.25% cheaper.",
2020-08-30 01:39:01 +00:00
cost: new Decimal(2),
unl: function() { return player.hb.unl },
},
2020-08-30 02:28:21 +00:00
15: {
desc: "This layer behaves as if you chose it first.",
cost: new Decimal(3),
unl: function() { return player.ss.order>0||(player.hb.upgrades.includes(13))||player.ss.upgrades.includes(15) },
},
2020-08-30 16:18:34 +00:00
21: {
desc: "Unlock 5 new Generator Upgrades.",
cost: new Decimal(4),
unl: function() { return player.hb.upgrades.includes(13)&&player.ss.upgrades.includes(15) },
},
22: {
2020-09-01 00:39:33 +00:00
desc: "You generate Subspace faster based on its amount.",
cost: new Decimal(5),
unl: function() { return player.ss.upgrades.includes(21)&&(player.h.challs.includes(51)||player.h.challs.includes(52)) },
currently: function() { return player.ss.subspace.plus(1).root(2.5) },
effDisp: function(x) { return format(x)+"x" },
2020-08-30 16:18:34 +00:00
},
23: {
desc: "???",
cost: new Decimal(1/0),
unl: function() { return false },
},
24: {
desc: "???",
cost: new Decimal(1/0),
unl: function() { return false },
},
25: {
desc: "???",
cost: new Decimal(1/0),
unl: function() { return false },
},
2020-08-29 23:43:53 +00:00
},
2020-08-19 02:50:24 +00:00
}
const TAB_REQS = {
tree: function() { return true },
options: function() { return true },
2020-08-19 22:12:31 +00:00
info: function() { return true },
2020-08-20 04:55:26 +00:00
changelog: function() { return true },
2020-08-25 22:42:43 +00:00
credits: function() { return true },
2020-08-21 19:02:34 +00:00
p: function() { return (player.p.unl||player.points.gte(tmp.layerReqs.p))&&layerUnl('p') },
b: function() { return (player.b.unl||player.points.gte(tmp.layerReqs.b))&&layerUnl('b') },
g: function() { return (player.g.unl||player.points.gte(tmp.layerReqs.g))&&layerUnl('g') },
e: function() { return (player.e.unl||player.points.gte(tmp.layerReqs.e))&&layerUnl('e') },
t: function() { return (player.t.unl||player.points.gte(tmp.layerReqs.t))&&layerUnl('t') },
s: function() { return (player.s.unl||player.points.gte(tmp.layerReqs.s))&&layerUnl('s') },
2020-08-22 01:16:23 +00:00
sb: function() { return (player.sb.unl||player.b.points.gte(tmp.layerReqs.sb))&&layerUnl('sb') },
2020-08-26 01:45:22 +00:00
h: function() { return (player.h.unl||player.t.energy.gte(tmp.layerReqs.h))&&layerUnl('h') },
q: function() { return (player.q.unl||player.g.power.gte(tmp.layerReqs.q))&&layerUnl('q') },
2020-08-29 23:43:53 +00:00
hb: function() { return (player.hb.unl||player.sb.points.gte(tmp.layerReqs.hb))&&layerUnl('hb') },
ss: function() { return (player.ss.unl||player.s.points.gte(tmp.layerReqs.ss))&&layerUnl('ss') },
2020-08-22 01:16:23 +00:00
}
const LAYER_AMT_NAMES = {
p: "points",
b: "points",
g: "points",
t: "points",
e: "points",
s: "points",
2020-08-26 01:45:22 +00:00
sb: "boosters",
h: "time energy",
q: "generator power",
2020-08-29 23:43:53 +00:00
hb: "super-boosters",
ss: "space energy",
2020-08-22 01:16:23 +00:00
}
function getLayerAmt(layer) {
let amt = player.points
switch(layer) {
case "sb":
return player.b.points;
break;
2020-08-26 01:45:22 +00:00
case "h":
return player.t.energy;
break;
case "q":
return player.g.power;
break;
2020-08-29 23:43:53 +00:00
case "hb":
return player.sb.points;
break;
case "ss":
return player.s.points;
break;
2020-08-22 01:16:23 +00:00
}
return amt
2020-08-19 02:50:24 +00:00
}
function getLayerEffDesc(layer) {
if (!Object.keys(LAYER_EFFS).includes(layer)) return "???"
2020-08-21 19:02:34 +00:00
let eff = tmp.layerEffs[layer]
2020-08-19 02:50:24 +00:00
switch(layer) {
case "b":
return "translated to a "+format(eff)+"x multiplier to point gain"
break;
case "g":
return "which are generating "+format(eff)+" Generator Power/sec"
break;
case "t":
return "which are generating "+format(eff.gain)+" Time Energy/sec, but with a limit of "+format(eff.limit)+" Time Energy"
break;
2020-08-22 01:16:23 +00:00
case "sb":
2020-08-23 19:36:03 +00:00
return "which are multiplying the Booster effect base by "+format(eff)
2020-08-22 01:16:23 +00:00
break;
2020-08-26 01:45:22 +00:00
case "h":
return "which are providing "+format(eff)+" free extra Time Capsules (boosted by your points)"
break;
2020-08-29 23:43:53 +00:00
case "hb":
return "which are multiplying the Super-Booster effect base by "+format(eff)
break;
case "ss":
return "which are generating "+format(eff)+" Subspace/sec"
break;
2020-08-19 02:50:24 +00:00
}
}
function save() {
localStorage.setItem("prestige-tree", btoa(JSON.stringify(player)))
}
function load() {
let get = localStorage.getItem("prestige-tree");
2020-08-19 19:53:14 +00:00
if (get===null||get===undefined) player = getStartPlayer()
2020-08-19 02:50:24 +00:00
else player = JSON.parse(atob(get))
player.tab = "tree"
2020-09-01 00:39:33 +00:00
offTime.remain = (Date.now()-player.time)/1000
player.time = Date.now()
2020-08-19 02:50:24 +00:00
checkForVars();
convertToDecimal();
2020-08-23 19:36:03 +00:00
versionCheck();
2020-08-21 19:02:34 +00:00
updateTemp();
2020-09-01 00:39:33 +00:00
updateTemp();
2020-08-19 02:50:24 +00:00
loadVue();
}
function exportSave() {
let str = btoa(JSON.stringify(player))
const el = document.createElement("textarea");
el.value = str;
document.body.appendChild(el);
el.select();
el.setSelectionRange(0, 99999);
document.execCommand("copy");
document.body.removeChild(el);
}
2020-08-23 19:36:03 +00:00
function importSave(imported=undefined) {
if (imported===undefined) imported = prompt("Paste your save here")
2020-08-19 02:50:24 +00:00
try {
player = JSON.parse(atob(imported))
save()
window.location.reload()
} catch(e) {
return;
}
}
2020-08-23 19:36:03 +00:00
function versionCheck() {
let setVersion = true
if (player.versionType===undefined||player.version===undefined) {
player.versionType = "alpha"
player.version = 0
}
if (player.versionType=="alpha") {
if (player.version<10&&player.sb.unl) {
2020-08-24 02:01:14 +00:00
if (confirm("Since the last time you played, several changes to Super-Booster effects have been made. Would you like to roll back your save to that point in the progression, in order for you to experience the new features properly?")) importSave(SAVES.PRE_SUPER_BOOSTERS)
2020-08-23 19:36:03 +00:00
setVersion = false;
}
}
2020-08-31 02:35:50 +00:00
if (player.versionType=="beta") {
if (player.version<=1.1) if (!(player.hb.unl||player.ss.unl)) {
player.hb.order = 0
player.ss.order = 0
}
}
2020-08-23 19:36:03 +00:00
if (setVersion) {
player.versionType = getStartPlayer().versionType
player.version = getStartPlayer().version
}
}
2020-08-19 02:50:24 +00:00
function checkForVars() {
if (player.autosave===undefined) player.autosave = true;
if (player.b===undefined) player.b = getStartPlayer().b
if (player.g===undefined) player.g = getStartPlayer().g
if (player.p.best===undefined) player.p.best = player.p.points
if (player.b.best===undefined) player.b.best = player.b.points
2020-08-20 04:55:26 +00:00
if (player.b.auto===undefined) player.b.auto = false
2020-08-19 02:50:24 +00:00
if (player.g.best===undefined) player.g.best = player.g.points
2020-08-20 04:55:26 +00:00
if (player.g.auto===undefined) player.g.auto = false
2020-08-19 02:50:24 +00:00
if (player.e === undefined) player.e = getStartPlayer().e
if (player.e.order === undefined) player.e.order = 0
2020-08-26 03:32:27 +00:00
if (player.e.auto===undefined) player.e.auto = false
2020-08-19 02:50:24 +00:00
if (player.t === undefined) player.t = getStartPlayer().t
2020-08-26 03:32:27 +00:00
if (player.t.auto===undefined) player.t.auto = false
if (player.t.autoCap===undefined) player.t.autoCap = false
2020-08-19 02:50:24 +00:00
if (player.s === undefined) player.s = getStartPlayer().s
2020-08-19 19:53:14 +00:00
if (player.s.buildings[4] === undefined) player.s.buildings[4] = new Decimal(0);
2020-08-20 20:37:22 +00:00
if (player.s.buildings[5] === undefined) player.s.buildings[5] = new Decimal(0);
2020-08-26 03:32:27 +00:00
if (player.s.auto === undefined) player.s.auto = false
2020-08-30 01:39:01 +00:00
if (player.s.autoBuild === undefined) player.s.autoBuild = false
2020-08-22 01:16:23 +00:00
if (player.sb === undefined) player.sb = getStartPlayer().sb
2020-08-26 14:16:23 +00:00
if (player.sb.auto === undefined) player.sb.auto = false
2020-08-23 19:36:03 +00:00
if (player.timePlayed === undefined) player.timePlayed = 0
2020-08-24 02:01:14 +00:00
if (player.hasNaN === undefined) player.hasNaN = false
2020-08-26 01:45:22 +00:00
if (player.h === undefined) player.h = getStartPlayer().h
2020-08-26 16:26:46 +00:00
if (player.h.active === undefined) player.h.active = 0
2020-08-29 19:45:18 +00:00
if (player.h.time === undefined) player.h.time = 0
2020-08-26 01:45:22 +00:00
if (player.q === undefined) player.q = getStartPlayer().q
2020-08-27 19:12:20 +00:00
if (player.msDisplay === undefined) player.msDisplay = "always"
2020-08-29 23:43:53 +00:00
if (player.hb === undefined) player.hb = getStartPlayer().hb
if (player.ss === undefined) player.ss = getStartPlayer().ss
2020-08-19 02:50:24 +00:00
}
function convertToDecimal() {
player.points = new Decimal(player.points)
player.p.points = new Decimal(player.p.points)
player.p.best = new Decimal(player.p.best)
player.b.points = new Decimal(player.b.points)
player.b.best = new Decimal(player.b.best)
player.g.points = new Decimal(player.g.points)
player.g.best = new Decimal(player.g.best)
player.g.power = new Decimal(player.g.power)
player.e.points = new Decimal(player.e.points)
player.e.best = new Decimal(player.e.best)
player.e.enhancers = new Decimal(player.e.enhancers)
player.t.points = new Decimal(player.t.points)
player.t.best = new Decimal(player.t.best)
player.t.energy = new Decimal(player.t.energy)
player.t.extCapsules = new Decimal(player.t.extCapsules)
player.s.points = new Decimal(player.s.points)
player.s.best = new Decimal(player.s.best)
player.s.spent = new Decimal(player.s.spent)
2020-08-20 20:37:22 +00:00
for (let i=1;i<=5;i++) player.s.buildings[i] = new Decimal(player.s.buildings[i])
2020-08-22 01:16:23 +00:00
player.sb.points = new Decimal(player.sb.points)
player.sb.best = new Decimal(player.sb.best)
2020-08-26 01:45:22 +00:00
player.h.points = new Decimal(player.h.points)
player.h.best = new Decimal(player.h.best)
player.q.points = new Decimal(player.q.points)
player.q.best = new Decimal(player.q.best)
player.q.layers = new Decimal(player.q.layers)
player.q.energy = new Decimal(player.q.energy)
player.q.time = new Decimal(player.q.time)
2020-08-29 23:43:53 +00:00
player.hb.points = new Decimal(player.hb.points)
player.hb.best = new Decimal(player.hb.best)
player.ss.points = new Decimal(player.ss.points)
player.ss.best = new Decimal(player.ss.best)
player.ss.subspace = new Decimal(player.ss.subspace)
2020-08-19 02:50:24 +00:00
}
function toggleOpt(name) {
player[name] = !player[name]
}
function exponentialFormat(num, precision) {
let e = num.log10().floor()
let m = num.div(Decimal.pow(10, e))
return m.toStringWithDecimalPlaces(3)+"e"+e.toStringWithDecimalPlaces(0)
}
function commaFormat(num, precision) {
if (num === null || num === undefined) return "NaN"
return num.toStringWithDecimalPlaces(precision).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
}
function format(decimal, precision=3) {
decimal = new Decimal(decimal)
2020-08-24 02:01:14 +00:00
if (isNaN(decimal.sign)||isNaN(decimal.layer)||isNaN(decimal.mag)) {
player.hasNaN = true;
return "NaN"
}
2020-08-23 19:36:03 +00:00
if (decimal.eq(1/0)) return "Infinity"
2020-08-21 03:33:13 +00:00
if (decimal.gte("eee1000")) return exponentialFormat(decimal, precision)
else if (decimal.gte("ee1000")) return "ee"+format(decimal.log10().log10())
2020-08-21 19:02:34 +00:00
else if (decimal.gte("1e1000")) return decimal.div(Decimal.pow(10, decimal.log10().floor())).toStringWithDecimalPlaces(3)+"e"+format(decimal.log10().floor())
2020-08-21 03:33:13 +00:00
else if (decimal.gte(1e9)) return exponentialFormat(decimal, precision)
2020-08-19 19:53:14 +00:00
else if (decimal.gte(1e3)) return commaFormat(decimal, 0)
2020-08-19 02:50:24 +00:00
else return commaFormat(decimal, precision)
}
function formatWhole(decimal) {
return format(decimal, 0)
}
2020-08-24 02:01:14 +00:00
function formatTime(s) {
if (s<60) return format(s)+"s"
else if (s<3600) return formatWhole(Math.floor(s/60))+"m "+format(s%60)+"s"
else return formatWhole(Math.floor(s/3600))+"h "+formatWhole(Math.floor(s/60)%60)+"m "+format(s%60)+"s"
}
2020-08-19 02:50:24 +00:00
function showTab(name) {
if (!TAB_REQS[name]()) return
player.tab = name
if (name=="tree") needCanvasUpdate = true;
}
function canBuyMax(layer) {
switch(layer) {
case "b":
return player.b.best.gte(15)
break;
case "g":
return player.g.best.gte(15)
break;
2020-08-26 03:32:27 +00:00
case "t":
return player.q.best.gte(2)
break;
case "s":
return player.q.best.gte(2)
break;
2020-08-30 16:18:34 +00:00
case "sb":
return player.hb.best.gte(1)
break;
2020-08-19 02:50:24 +00:00
}
return false;
}
function getLayerReq(layer) {
let req = LAYER_REQS[layer]
switch(layer) {
case "b":
if (player.g.unl && !player.b.unl) req = req.times(5000)
break;
case "g":
if (player.b.unl && !player.g.unl) req = req.times(5000)
break;
case "e":
2020-08-20 01:27:52 +00:00
req = req.times(Decimal.pow("1e200", Decimal.pow(player.e.order, 2)))
2020-08-19 02:50:24 +00:00
break;
case "t":
2020-08-20 01:27:52 +00:00
req = req.times(Decimal.pow("1e200", Decimal.pow(player.t.order, 2)))
2020-08-19 02:50:24 +00:00
break;
case "s":
2020-08-20 01:27:52 +00:00
req = req.times(Decimal.pow("1e200", Decimal.pow(player.s.order, 2)))
2020-08-19 02:50:24 +00:00
break;
2020-08-29 23:43:53 +00:00
case "hb":
2020-08-30 01:39:01 +00:00
if (player.hb.order>0) req = new Decimal(15)
2020-08-29 23:43:53 +00:00
break;
case "ss":
2020-08-30 01:39:01 +00:00
if (player.ss.order>0) req = new Decimal(45)
2020-08-29 23:43:53 +00:00
break;
2020-08-19 02:50:24 +00:00
}
return req
}
function getLayerGainMult(layer) {
let mult = new Decimal(1)
switch(layer) {
case "p":
if (player.p.upgrades.includes(21)) mult = mult.times(2)
if (player.p.upgrades.includes(23)) mult = mult.times(LAYER_UPGS.p[23].currently())
2020-08-23 19:36:03 +00:00
if (player.p.upgrades.includes(31)) mult = mult.times(LAYER_UPGS.p[31].currently())
2020-08-19 02:50:24 +00:00
if (player.b.upgrades.includes(11)) mult = mult.times(LAYER_UPGS.b[11].currently())
if (player.g.upgrades.includes(11)) mult = mult.times(LAYER_UPGS.g[11].currently())
2020-08-21 19:02:34 +00:00
if (player.e.unl) mult = mult.times(tmp.enhEff)
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(12)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.e[12].currently())
if (player.e.upgrades.includes(13)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(1e10)
if (player.e.upgrades.includes(34)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(1e40)
2020-08-21 19:02:34 +00:00
if (player.t.unl) mult = mult.times(tmp.timeEff)
if (player.s.unl && tmp.spaceBuildEff) mult = mult.times(tmp.spaceBuildEff[1])
2020-08-26 03:32:27 +00:00
if (player.q.upgrades.includes(11)) mult = mult.times(LAYER_UPGS.q[11].currently())
2020-08-19 02:50:24 +00:00
break;
case "b":
if (player.b.upgrades.includes(23)) mult = mult.div(LAYER_UPGS.b[23].currently())
2020-08-21 19:02:34 +00:00
if (player.s.unl && tmp.spaceBuildEff) mult = mult.div(tmp.spaceBuildEff[3])
2020-08-19 02:50:24 +00:00
break;
case "g":
if (player.g.upgrades.includes(22)) mult = mult.div(LAYER_UPGS.g[22].currently())
2020-08-21 19:02:34 +00:00
if (player.s.unl && tmp.spaceBuildEff) mult = mult.div(tmp.spaceBuildEff[3])
break;
case "e":
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(24)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.e[24].currently())
2020-08-26 01:45:22 +00:00
if (player.h.best.gte(1)) mult = mult.times(100)
if (player.q.best.gte(1)) mult = mult.times(100)
2020-08-26 03:32:27 +00:00
if (player.q.upgrades.includes(11)) mult = mult.times(LAYER_UPGS.q[11].currently())
2020-08-19 02:50:24 +00:00
break;
2020-08-26 20:40:54 +00:00
case "t":
if (player.h.challs.includes(21)) mult = mult.div(H_CHALLS[21].currently())
break;
case "s":
if (player.h.challs.includes(21)) mult = mult.div(H_CHALLS[21].currently())
break;
2020-08-30 01:39:01 +00:00
case "sb":
2020-08-30 02:28:21 +00:00
if (player.ss.upgrades.includes(14)) mult = mult.div(1.0825)
2020-08-30 01:39:01 +00:00
break;
2020-08-26 20:40:54 +00:00
case "h":
if (player.q.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.q[22].currently().h)
2020-08-29 16:43:58 +00:00
if (player.q.upgrades.includes(34)) mult = mult.times(LAYER_UPGS.q[34].currently())
2020-08-29 19:45:18 +00:00
if (player.q.upgrades.includes(44)) mult = mult.times(LAYER_UPGS.q[44].currently())
2020-08-26 20:40:54 +00:00
break;
2020-08-26 19:08:00 +00:00
case "q":
if (player.h.challs.includes(12)) mult = mult.times(H_CHALLS[12].currently())
2020-08-26 20:40:54 +00:00
if (player.q.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.q[22].currently().q)
2020-08-29 16:43:58 +00:00
if (player.q.upgrades.includes(34)) mult = mult.times(LAYER_UPGS.q[34].currently())
2020-08-26 19:08:00 +00:00
break;
2020-08-19 02:50:24 +00:00
}
return mult
}
2020-08-26 20:40:54 +00:00
function getGainExp(layer) {
let exp = new Decimal(1);
switch(layer) {
case "p":
if (tmp.hcActive ? tmp.hcActive[21] : true) exp = exp.div(100)
break;
}
return exp;
}
2020-08-19 02:50:24 +00:00
function getResetGain(layer) {
if (LAYER_TYPE[layer]=="static") {
2020-08-22 01:16:23 +00:00
if ((!canBuyMax(layer)) || tmp.layerAmt[layer].lt(tmp.layerReqs[layer])) return new Decimal(1)
let gain = tmp.layerAmt[layer].div(tmp.layerReqs[layer]).div(tmp.gainMults[layer]).max(1).log(LAYER_BASE[layer]).pow(Decimal.pow(LAYER_EXP[layer], -1))
2020-08-19 02:50:24 +00:00
if (gain.gte(12)) gain = gain.times(12).sqrt()
2020-08-30 02:28:21 +00:00
if (gain.gte(1225)) gain = gain.times(Decimal.pow(1225, 9)).pow(0.1)
2020-08-19 02:50:24 +00:00
return gain.floor().sub(player[layer].points).plus(1).max(1);
}
2020-08-22 01:16:23 +00:00
if (tmp.layerAmt[layer].lt(tmp.layerReqs[layer])) return new Decimal(0)
2020-08-26 20:40:54 +00:00
let gain = tmp.layerAmt[layer].div(tmp.layerReqs[layer]).pow(LAYER_EXP[layer]).times(tmp.gainMults[layer]).pow(getGainExp(layer))
2020-08-19 02:50:24 +00:00
return gain.floor().max(0);
}
function getNextAt(layer) {
if (LAYER_TYPE[layer]=="static") {
let amt = player[layer].points
2020-08-30 02:28:21 +00:00
if (amt.gte(1225)) amt = amt.pow(10).div(Decimal.pow(1225, 9))
2020-08-19 02:50:24 +00:00
if (amt.gte(12)) amt = amt.pow(2).div(12)
2020-08-21 19:02:34 +00:00
let extraCost = Decimal.pow(LAYER_BASE[layer], amt.pow(LAYER_EXP[layer])).times(tmp.gainMults[layer])
2020-08-25 22:42:43 +00:00
let cost = extraCost.times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer])
if (LAYER_RES_CEIL.includes(layer)) cost = cost.ceil()
return cost;
} else {
2020-08-26 20:40:54 +00:00
let next = tmp.resetGain[layer].plus(1).root(getGainExp(layer)).div(tmp.gainMults[layer]).root(LAYER_EXP[layer]).times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer])
2020-08-25 22:42:43 +00:00
if (LAYER_RES_CEIL.includes(layer)) next = next.ceil()
return next;
}
2020-08-19 02:50:24 +00:00
}
function layerUnl(layer) {
switch(layer) {
case "p":
return true;
break;
case "b":
return player.p.unl;
break;
case "g":
return player.p.unl;
break;
case "e":
return player.b.unl&&player.g.unl;
break;
case "t":
return player.b.unl;
break;
case "s":
return player.g.unl;
break;
2020-08-22 01:16:23 +00:00
case "sb":
return player.e.unl&&player.t.unl&&player.s.unl;
break;
2020-08-26 01:45:22 +00:00
case "h":
return player.t.unl&&player.sb.unl
break;
case "q":
return player.e.unl&&player.sb.unl
break;
2020-08-29 23:43:53 +00:00
case "hb":
return player.sb.unl&&player.h.unl&&player.q.unl
break;
case "ss":
return player.s.unl&&player.h.unl&&player.q.unl
break;
2020-08-19 02:50:24 +00:00
}
}
function rowReset(row, layer) {
let prev = JSON.parse(JSON.stringify(player)) // Deep Copy
2020-08-26 01:45:22 +00:00
let start = getStartPlayer()
2020-08-19 02:50:24 +00:00
switch(row) {
case 0:
player.points = new Decimal(0);
break;
case 1:
player.points = new Decimal(10);
player.p.points = new Decimal(0);
2020-08-26 14:16:23 +00:00
if (LAYER_ROW[layer]>=3 && player.h.best.gte(10)) player.p.upgrades = prev.p.upgrades;
else if ((player.h.best.lt(1)&&player.q.best.lt(1))||LAYER_ROW[layer]>=3) {
2020-08-26 01:45:22 +00:00
if (layer=="b"||layer=="g") {
if (player[layer].best.lt(8)) player.p.upgrades = [];
} else if (layer=="t"||layer=="s"||layer=="sb") {
if (player[layer].best.lt(3)) player.p.upgrades = [];
} else if (layer=="e") {
if (player[layer].best.lt(10)) player.p.upgrades = [];
} else player.p.upgrades = [];
}
2020-08-19 02:50:24 +00:00
player.g.power = new Decimal(0);
break;
case 2:
player.b.points = new Decimal(0);
player.b.best = new Decimal(0);
2020-08-19 22:12:31 +00:00
if (!player.t.best.gte(4)) player.b.upgrades = [];
2020-08-19 02:50:24 +00:00
player.g.points = new Decimal(0);
player.g.power = new Decimal(0);
player.g.best = new Decimal(0);
2020-08-19 22:12:31 +00:00
if (!player.s.best.gte(4)) player.g.upgrades = [];
2020-08-19 02:50:24 +00:00
player.t.energy = new Decimal(0);
if (layer=="t"||layer=="e"||layer=="s") {
if (player[layer].best.gte(2)) {
player.b.best = new Decimal(prev.b.best)
player.g.best = new Decimal(prev.g.best)
}
2020-08-23 19:36:03 +00:00
} else if (player.sb.best.gte(4)&&layer=="sb") {
2020-08-22 03:59:24 +00:00
player.b.best = new Decimal(prev.b.best)
player.g.best = new Decimal(prev.g.best)
2020-08-19 02:50:24 +00:00
}
break;
case 3:
player.t.points = new Decimal(0);
player.t.order = 0
2020-08-26 03:32:27 +00:00
if (player.h.best.lt(2)) player.t.best = new Decimal(0);
if (player.h.best.lt(4)) player.t.upgrades = [];
2020-08-19 02:50:24 +00:00
player.t.extCapsules = new Decimal(0);
player.e.order = 0
player.e.points = new Decimal(0);
2020-08-26 03:32:27 +00:00
if (player.h.best.lt(2)) player.e.best = new Decimal(0);
2020-08-19 02:50:24 +00:00
player.e.enhancers = new Decimal(0);
2020-08-26 03:32:27 +00:00
if (player.h.best.lt(4)) player.e.upgrades = [];
2020-08-19 02:50:24 +00:00
player.s = {
unl: player.s.unl,
order: 0,
points: new Decimal(0),
2020-08-26 03:32:27 +00:00
best: player.h.best.gte(2) ? player.s.best : new Decimal(0),
spent: player.q.best.gte(4) ? player.s.spent : new Decimal(0),
buildings: player.q.best.gte(4) ? player.s.buildings : ({
2020-08-19 02:50:24 +00:00
1: new Decimal(0),
2: new Decimal(0),
2020-08-19 19:53:14 +00:00
3: new Decimal(0),
2020-08-20 20:37:22 +00:00
4: new Decimal(0),
5: new Decimal(0)
2020-08-26 03:32:27 +00:00
}),
2020-08-26 14:16:23 +00:00
upgrades: player.h.best.gte(4) ? player.s.upgrades : [],
auto: player.s.auto,
2020-08-30 01:39:01 +00:00
autoBuild: player.s.autoBuild,
2020-08-19 02:50:24 +00:00
}
2020-08-22 01:16:23 +00:00
player.sb = {
unl: player.sb.unl,
2020-08-26 14:16:23 +00:00
auto: player.sb.auto,
2020-08-22 01:16:23 +00:00
order: 0,
points: new Decimal(0),
2020-08-26 03:32:27 +00:00
best: player.h.best.gte(2) ? player.sb.best : new Decimal(0),
2020-08-26 14:16:23 +00:00
upgrades: player.h.best.gte(10) ? player.sb.upgrades : [],
2020-08-22 01:16:23 +00:00
}
2020-08-29 19:45:18 +00:00
player.h.time = 0
2020-08-26 01:45:22 +00:00
player.q.time = new Decimal(0);
player.q.energy = new Decimal(0);
break;
case 4:
player.h = start.h
player.q = start.q
2020-08-29 23:43:53 +00:00
player.hb = start.hb
player.ss = start.ss
2020-08-19 02:50:24 +00:00
break;
}
}
function doReset(layer, force=false) {
if (!force) {
2020-08-22 01:16:23 +00:00
if (tmp.layerAmt[layer].lt(tmp.layerReqs[layer])) return;
2020-08-21 19:02:34 +00:00
let gain = tmp.resetGain[layer]
2020-08-19 02:50:24 +00:00
if (LAYER_TYPE[layer]=="static") {
2020-08-22 01:16:23 +00:00
if (tmp.layerAmt[layer].lt(tmp.nextAt[layer])) return;
2020-08-19 02:50:24 +00:00
player[layer].points = player[layer].points.plus(canBuyMax(layer)?gain:1)
} else player[layer].points = player[layer].points.plus(gain)
player[layer].best = player[layer].best.max(player[layer].points)
if (!player[layer].unl) {
player[layer].unl = true;
needCanvasUpdate = true;
let layers = ROW_LAYERS[LAYER_ROW[layer]]
2020-08-31 02:35:50 +00:00
for (let i in layers) if (!player[layers[i]].unl && player[layers[i]]!==undefined) player[layers[i]].order += ORDER_UP[LAYER_ROW[layer]].includes(layer)?1:0
2020-08-19 02:50:24 +00:00
}
2020-08-22 03:59:24 +00:00
tmp.layerAmt[layer] = new Decimal(0) // quick fix
2020-08-19 02:50:24 +00:00
}
2020-08-21 03:33:13 +00:00
if ((layer=="b"&&player.t.best.gte(12))||(layer=="g"&&player.s.best.gte(12))) return;
2020-08-26 22:42:19 +00:00
if ((layer=="t"&&player.h.best.gte(25))||(layer=="s"&&player.q.best.gte(25))||(layer=="sb"&&player.h.best.gte(2500))) return;
2020-08-19 02:50:24 +00:00
let row = LAYER_ROW[layer]
if (row==0) rowReset(0, layer)
else for (let x=row;x>=1;x--) rowReset(x, layer)
2020-08-26 19:08:00 +00:00
updateTemp()
2020-08-19 02:50:24 +00:00
}
function buyUpg(layer, id) {
if (!player[layer].unl) return
if (!LAYER_UPGS[layer][id].unl()) return
if (player[layer].upgrades.includes(id)) return
if (player[layer].points.lt(LAYER_UPGS[layer][id].cost)) return
player[layer].points = player[layer].points.sub(LAYER_UPGS[layer][id].cost)
player[layer].upgrades.push(id);
2020-08-21 03:33:13 +00:00
if (layer=="t"&&id==32) player.t.order = 0;
if (layer=="e"&&(id==22||id==23)) {
player.e.order = 0;
if (!player.e.upgrades.includes(22)) player.e.upgrades.push(22)
if (!player.e.upgrades.includes(23)) player.e.upgrades.push(23)
}
if (layer=="s"&&id==33) player.s.order = 0;
2020-08-30 02:28:21 +00:00
if (layer=="hb"&&id==13) player.hb.order = 0;
if (layer=="ss"&&id==15) player.ss.order = 0;
2020-08-19 02:50:24 +00:00
}
function getPointGen() {
let gain = new Decimal(1)
if (player.p.upgrades.includes(12)) gain = gain.times(LAYER_UPGS.p[12].currently())
if (player.p.upgrades.includes(13)) gain = gain.times(LAYER_UPGS.p[13].currently())
if (player.p.upgrades.includes(22)) gain = gain.times(LAYER_UPGS.p[22].currently())
2020-08-21 19:02:34 +00:00
if (player.b.unl) gain = gain.times(tmp.layerEffs.b)
if (player.g.unl) gain = gain.times(tmp.genPowEff)
if (player.t.unl) gain = gain.times(tmp.timeEff)
if (player.s.unl && tmp.spaceBuildEff) gain = gain.times(tmp.spaceBuildEff[1])
2020-08-26 01:45:22 +00:00
if (player.q.unl && tmp.quirkEff) gain = gain.times(tmp.quirkEff)
2020-08-26 03:32:27 +00:00
if (player.q.upgrades.includes(11)) gain = gain.times(LAYER_UPGS.q[11].currently())
2020-08-27 15:38:26 +00:00
if (tmp.hcActive ? tmp.hcActive[31] : true) gain = gain.tetrate(0.1)
2020-08-19 02:50:24 +00:00
return gain
}
function addToBoosterBase() {
let toAdd = new Decimal(0)
if (player.b.upgrades.includes(12)) toAdd = toAdd.plus(LAYER_UPGS.b[12].currently())
if (player.b.upgrades.includes(13)) toAdd = toAdd.plus(LAYER_UPGS.b[13].currently())
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(11)&&!(tmp.hcActive?tmp.hcActive[12]:true)) toAdd = toAdd.plus(LAYER_UPGS.t[11].currently())
if (player.t.upgrades.includes(31)&&!(tmp.hcActive?tmp.hcActive[12]:true)) toAdd = toAdd.plus(25)
if (player.t.upgrades.includes(33)&&!(tmp.hcActive?tmp.hcActive[12]:true)) toAdd = toAdd.plus(40)
2020-08-21 19:02:34 +00:00
if (player.e.unl) toAdd = toAdd.plus(tmp.enhEff2)
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(11)&&!(tmp.hcActive?tmp.hcActive[12]:true)) toAdd = toAdd.plus(LAYER_UPGS.e[11].currently().b)
2020-08-21 19:02:34 +00:00
if (player.s.unl && tmp.spaceBuildEff) toAdd = toAdd.plus(tmp.spaceBuildEff[2])
2020-08-27 19:12:20 +00:00
if (player.sb.upgrades.includes(21)) toAdd = toAdd.plus(LAYER_UPGS.sb[21].currently())
2020-08-30 16:18:34 +00:00
if (player.b.upgrades.includes(31)) toAdd = toAdd.times(LAYER_UPGS.b[31].currently())
2020-08-23 19:36:03 +00:00
if (player.sb.unl) toAdd = toAdd.times(tmp.layerEffs.sb)
2020-08-19 02:50:24 +00:00
return toAdd
}
2020-08-20 04:55:26 +00:00
function getFreeBoosters() {
let free = new Decimal(0)
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(24)&&!(tmp.hcActive?tmp.hcActive[12]:true)) free = free.plus(18)
2020-08-31 18:33:29 +00:00
if (player.b.upgrades.includes(32)) free = free.plus(LAYER_UPGS.b[32].currently())
2020-09-01 00:39:33 +00:00
if (player.b.upgrades.includes(33)) free = free.plus(100)
2020-08-20 04:55:26 +00:00
return free
}
2020-08-19 02:50:24 +00:00
function addToGenBase() {
let toAdd = new Decimal(0)
if (player.g.upgrades.includes(12)) toAdd = toAdd.plus(LAYER_UPGS.g[12].currently())
if (player.g.upgrades.includes(13)) toAdd = toAdd.plus(LAYER_UPGS.g[13].currently())
2020-08-31 02:35:50 +00:00
if (player.g.upgrades.includes(33)) toAdd = toAdd.plus(LAYER_UPGS.g[33].currently())
2020-08-21 19:02:34 +00:00
if (player.e.unl) toAdd = toAdd.plus(tmp.enhEff2)
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(11)&&!(tmp.hcActive?tmp.hcActive[12]:true)) toAdd = toAdd.plus(LAYER_UPGS.e[11].currently().g)
2020-08-21 19:02:34 +00:00
if (player.s.unl && tmp.spaceBuildEff) toAdd = toAdd.plus(tmp.spaceBuildEff[2])
2020-08-30 16:18:34 +00:00
if (player.h.challs.includes(51)) toAdd = toAdd.times(H_CHALLS[51].currently())
2020-08-19 02:50:24 +00:00
return toAdd
}
2020-09-01 00:39:33 +00:00
function getGenPow() {
let pow = new Decimal(1)
if (player.g.upgrades.includes(34)) pow = pow.times(LAYER_UPGS.g[34].currently())
return pow
}
2020-08-19 02:50:24 +00:00
function getGenPowerGainMult() {
let mult = new Decimal(1)
if (player.g.upgrades.includes(21)) mult = mult.times(LAYER_UPGS.g[21].currently())
if (player.g.upgrades.includes(25)) mult = mult.times(LAYER_UPGS.g[25].currently())
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(35)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.e[35].currently())
if (player.s.upgrades.includes(12)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.s[12].currently())
if (player.s.upgrades.includes(13)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.s[13].currently())
2020-08-26 01:45:22 +00:00
if (player.q.unl && tmp.quirkEff) mult = mult.times(tmp.quirkEff)
2020-09-01 00:39:33 +00:00
if (player.g.upgrades.includes(35)) mult = mult.times(LAYER_UPGS.g[35].currently())
2020-08-19 02:50:24 +00:00
return mult
}
2020-08-21 03:33:13 +00:00
function getGenPowerEffExp() {
let exp = new Decimal(1/3)
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(34)&&!(tmp.hcActive?tmp.hcActive[12]:true)) exp = exp.plus(LAYER_UPGS.s[34].currently())
2020-08-21 03:33:13 +00:00
if (player.b.upgrades.includes(21)) exp = exp.times(2)
if (player.b.upgrades.includes(22)) exp = exp.times(1.2)
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(21)&&!(tmp.hcActive?tmp.hcActive[12]:true)) exp = exp.times(1.15)
2020-08-26 16:26:46 +00:00
if (player.h.challs.includes(11)) exp = exp.times(1.25)
2020-08-29 19:45:18 +00:00
if (player.h.challs.includes(42)) exp = exp.times(3)
2020-08-21 03:33:13 +00:00
return exp;
}
2020-08-19 02:50:24 +00:00
function getGenPowerEff() {
2020-08-26 19:08:00 +00:00
if (tmp.hcActive ? tmp.hcActive[11] : true) return new Decimal(1)
2020-08-21 03:33:13 +00:00
let eff = player.g.power.plus(1).pow(getGenPowerEffExp());
2020-08-19 02:50:24 +00:00
return eff
}
function resetRow(row) {
if (prompt('Are you sure you want to reset this row? It is highly recommended that you wait until the end of your current run before doing this! Type "I WANT TO RESET THIS" to confirm')!="I WANT TO RESET THIS") return
let pre_layers = ROW_LAYERS[row-1]
let layers = ROW_LAYERS[row]
let post_layers = ROW_LAYERS[row+1]
rowReset(row+1, post_layers[0])
doReset(pre_layers[0], true)
for (let layer in layers) {
player[layers[layer]].unl = false
2020-08-21 03:33:13 +00:00
if (player[layers[layer]].order) player[layers[layer]].order = 0
2020-08-19 02:50:24 +00:00
}
2020-08-21 19:02:34 +00:00
updateTemp();
2020-08-19 02:50:24 +00:00
resizeCanvas();
}
2020-08-21 19:02:34 +00:00
function getEnhancerPow() {
2020-08-26 22:42:19 +00:00
if (tmp.hcActive ? tmp.hcActive[22] : true) return new Decimal(0);
2020-08-29 16:43:58 +00:00
if (tmp.hcActive ? tmp.hcActive[41] : true) return new Decimal(0);
2020-08-21 19:02:34 +00:00
let pow = new Decimal(1)
2020-08-26 19:08:00 +00:00
if (player.e.upgrades.includes(25)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.e[25].currently())
if (player.e.upgrades.includes(31)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.e[31].currently())
2020-08-27 15:38:26 +00:00
if (player.h.challs.includes(31)) pow = pow.times(2)
2020-08-29 18:00:32 +00:00
if (player.q.upgrades.includes(42)) pow = pow.times(1.4)
2020-08-21 19:02:34 +00:00
return pow
}
2020-08-19 02:50:24 +00:00
function getEnhancerEff() {
if (!player.e.unl) return new Decimal(1)
2020-08-31 18:33:29 +00:00
let e = player.e.enhancers.sub(tmp.subbedEnh).times(tmp.enhPow)
let eff;
if (e.gte(0)) eff = Decimal.pow(25, e.pow(1.1))
else eff = Decimal.pow(1/25, e.times(-1).pow(1.1))
2020-08-19 02:50:24 +00:00
return eff
}
function getEnhancerEff2() {
if (!player.e.unl) return new Decimal(0)
2020-08-31 18:33:29 +00:00
let e = player.e.enhancers.sub(tmp.subbedEnh).times(tmp.enhPow)
let eff;
if (e.gte(0)) eff = e.pow(0.8)
else eff = e.times(-1).pow(0.8).times(-1)
2020-08-19 02:50:24 +00:00
return eff;
}
2020-08-26 03:32:27 +00:00
function getEnhancerCost() {
let e = player.e.enhancers
if (e.gte(25)) e = e.pow(2).div(25)
let cost = Decimal.pow(2, e.pow(1.5))
return cost.floor()
}
2020-08-19 02:50:24 +00:00
function buyEnhancer() {
let cost = getEnhancerCost()
if (player.e.points.lt(cost)) return
player.e.points = player.e.points.sub(cost)
player.e.enhancers = player.e.enhancers.plus(1)
}
2020-08-26 03:32:27 +00:00
function maxEnhancers() {
let target = player.e.points.max(1).log(2).root(1.5)
if (target.gte(25)) target = target.times(25).sqrt()
target = target.plus(1).floor()
if (target.lte(player.e.enhancers)) return
player.e.enhancers = player.e.enhancers.max(target)
}
2020-08-19 19:53:14 +00:00
function getFreeExtCapsules() {
let amt = new Decimal(0)
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(12)&&!(tmp.hcActive?tmp.hcActive[12]:true)) amt = amt.plus(1)
2020-08-26 01:45:22 +00:00
if (player.h.unl) amt = amt.plus(tmp.layerEffs.h)
2020-08-19 19:53:14 +00:00
return amt
}
2020-08-27 19:12:20 +00:00
function getCapPow() {
2020-08-29 16:43:58 +00:00
if (tmp.hcActive ? tmp.hcActive[41] : true) return new Decimal(0)
2020-08-27 19:12:20 +00:00
let pow = new Decimal(1)
if (player.q.upgrades.includes(33)) pow = pow.times(LAYER_UPGS.q[33].currently())
return pow
}
2020-08-26 22:42:19 +00:00
function getFreeExtPow() {
if (tmp.hcActive ? tmp.hcActive[22] : true) return new Decimal(0)
let pow = new Decimal(1)
return pow
}
2020-08-19 02:50:24 +00:00
function getTimeEnergyEff() {
if (!player.t.unl) return new Decimal(1)
2020-08-19 22:12:31 +00:00
let exp = 1.2
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(21)&&!(tmp.hcActive?tmp.hcActive[12]:true)) exp = 1.75
2020-08-19 22:12:31 +00:00
let eff = player.t.energy.plus(1).pow(exp)
2020-08-19 02:50:24 +00:00
return eff;
}
2020-08-19 22:12:31 +00:00
function getTimeEnergyGainMult() {
if (!player.t.unl) return new Decimal(1)
let mult = new Decimal(1);
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(21)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[21].currently())
if (player.t.upgrades.includes(22)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[22].currently())
if (player.t.upgrades.includes(23)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[23].currently())
if (player.t.upgrades.includes(34)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[34].currently())
2020-08-19 22:12:31 +00:00
return mult;
}
2020-08-19 19:53:14 +00:00
function getTimeEnergyLimitMult() {
if (!player.t.unl) return new Decimal(1)
let mult = new Decimal(1);
2020-08-26 19:08:00 +00:00
if (player.t.upgrades.includes(12)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[12].currently())
if (player.t.upgrades.includes(21)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[21].currently())
if (player.t.upgrades.includes(22)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[22].currently())
if (player.t.upgrades.includes(23)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[23].currently())
if (player.t.upgrades.includes(34)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mult = mult.times(LAYER_UPGS.t[34].currently())
2020-08-26 22:42:19 +00:00
if (player.q.upgrades.includes(23)) mult = mult.times(1e10)
2020-08-29 16:43:58 +00:00
if (player.q.upgrades.includes(24)) mult = mult.times(LAYER_UPGS.q[24].currently())
2020-08-19 19:53:14 +00:00
return mult;
}
2020-08-19 02:50:24 +00:00
function getExtCapsuleCost() {
2020-08-21 03:33:13 +00:00
let amt = player.t.extCapsules
if (amt.gte(25)) amt = amt.pow(2).div(25)
let cost = amt.times(0.4).pow(1.2).plus(1).times(10)
2020-08-19 02:50:24 +00:00
return cost.floor()
}
function buyExtCapsule() {
if (!player.t.unl) return
let cost = getExtCapsuleCost()
if (player.b.points.lt(cost)) return
player.b.points = player.b.points.sub(cost)
player.t.extCapsules = player.t.extCapsules.plus(1)
}
2020-08-26 03:32:27 +00:00
function maxExtTimeCapsules() {
2020-08-26 20:40:54 +00:00
let target = player.b.points.plus(1).div(10).sub(1).root(1.2).div(0.4)
2020-08-26 03:32:27 +00:00
if (target.gte(25)) target = target.times(25).sqrt()
2020-08-26 20:40:54 +00:00
target = target.plus(1).floor().max(0)
2020-08-26 03:32:27 +00:00
player.t.extCapsules = player.t.extCapsules.max(target)
}
2020-08-19 02:50:24 +00:00
function getSpace() {
let baseSpace = player.s.best.pow(1.1).times(3).floor()
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(13)&&!(tmp.hcActive?tmp.hcActive[12]:true)) baseSpace = baseSpace.plus(2);
if (player.s.upgrades.includes(24)&&!(tmp.hcActive?tmp.hcActive[12]:true)) baseSpace = baseSpace.plus(3);
2020-08-29 23:43:53 +00:00
if (player.ss.unl) baseSpace = baseSpace.plus(tmp.ssEff1)
2020-08-30 01:39:01 +00:00
if (player.ss.upgrades.includes(11)) baseSpace = baseSpace.plus(LAYER_UPGS.ss[11].currently())
2020-08-26 20:40:54 +00:00
return baseSpace.sub(player.s.spent).max(0)
2020-08-19 02:50:24 +00:00
}
2020-08-20 04:55:26 +00:00
function getSpaceBuildingCostMod() {
let mod = new Decimal(1)
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(24)&&!(tmp.hcActive?tmp.hcActive[12]:true)) mod = new Decimal(0.5)
2020-08-20 04:55:26 +00:00
return mod;
}
2020-08-29 23:43:53 +00:00
function getSpaceBuildingCostMult() {
let mult = new Decimal(1)
if (player.ss.unl) mult = mult.div(tmp.ssEff2)
return mult
}
2020-08-19 02:50:24 +00:00
function getSpaceBuildingCost(x) {
2020-08-20 20:37:22 +00:00
let inputVal = new Decimal([1e3,1e10,1e25,1e48,1e100][x-1])
2020-08-19 02:50:24 +00:00
let bought = player.s.buildings[x]
2020-08-27 15:38:26 +00:00
if (bought.gte(100)) bought = bought.pow(2).div(100)
2020-08-29 23:43:53 +00:00
let cost = Decimal.pow(inputVal, bought.times(getSpaceBuildingCostMod()).pow(1.35)).times(inputVal).times((bought.gt(0)||x>1)?1:0).times(getSpaceBuildingCostMult())
2020-08-19 02:50:24 +00:00
return cost
}
2020-08-30 01:39:01 +00:00
function getSpaceBuildingTarg(x) {
let inputVal = new Decimal([1e3,1e10,1e25,1e48,1e100][x-1])
let target = player.g.power.div(getSpaceBuildingCostMult()).div(inputVal).max(1).log(inputVal).pow(1/1.35).div(getSpaceBuildingCostMod())
if (target.gte(100)) target = target.times(100).sqrt()
return target.plus(1).floor()
}
2020-08-19 22:12:31 +00:00
function getSpaceBuildingPow() {
if (!player.s.unl) return new Decimal(0)
2020-08-26 22:42:19 +00:00
if (tmp.hcActive ? tmp.hcActive[22] : true) return new Decimal(0)
2020-08-29 16:43:58 +00:00
if (tmp.hcActive ? tmp.hcActive[41] : true) return new Decimal(0)
2020-08-19 22:12:31 +00:00
let pow = new Decimal(1)
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(21)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.s[21].currently())
if (player.s.upgrades.includes(22)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.s[22].currently())
if (player.s.upgrades.includes(23)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.s[23].currently())
2020-08-29 18:00:32 +00:00
if (player.q.upgrades.includes(41)) pow = pow.times(1.4)
2020-08-29 23:43:53 +00:00
if (player.ss.unl) pow = pow.times(tmp.ssEff3)
2020-08-19 22:12:31 +00:00
return pow
}
2020-08-19 19:53:14 +00:00
function getExtraBuildingLevels(x) {
let lvl = new Decimal(0)
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(11)&&!(tmp.hcActive?tmp.hcActive[12]:true)) lvl = lvl.plus(1);
if (player.s.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true)) lvl = lvl.plus(1);
2020-08-27 15:38:26 +00:00
if (player.q.upgrades.includes(31)) lvl = lvl.plus(1);
2020-08-21 19:02:34 +00:00
if (x<5) lvl = lvl.plus(tmp.spaceBuildEff[5])
2020-08-19 19:53:14 +00:00
return lvl
}
2020-08-19 02:50:24 +00:00
function getSpaceBuildingEff(x) {
2020-08-19 19:53:14 +00:00
let bought = player.s.buildings[x].plus(getExtraBuildingLevels(x));
2020-08-19 02:50:24 +00:00
if (!player.s.unl) bought = new Decimal(0);
2020-08-21 19:02:34 +00:00
if (tmp.sbUnl<x) bought = new Decimal(0);
2020-08-19 22:12:31 +00:00
let power = getSpaceBuildingPow()
bought = bought.times(power)
2020-08-19 02:50:24 +00:00
switch(x) {
case 1:
2020-08-26 19:08:00 +00:00
return Decimal.pow(Decimal.add(1, bought.pow((player.s.upgrades.includes(31)&&!(tmp.hcActive?tmp.hcActive[12]:true))?2.75:1)), player.s.points.sqrt()).times(Decimal.mul(4, bought.pow((player.s.upgrades.includes(31)&&!(tmp.hcActive?tmp.hcActive[12]:true))?2.75:1))).max(1)
2020-08-19 02:50:24 +00:00
break;
case 2:
return bought.sqrt()
break;
case 3:
2020-08-19 19:53:14 +00:00
return Decimal.pow(1e18, bought.pow(0.9))
break;
case 4:
return bought.plus(1).pow(1.25)
2020-08-19 02:50:24 +00:00
break;
2020-08-20 20:37:22 +00:00
case 5:
return bought.sqrt().times(2)
break;
2020-08-19 02:50:24 +00:00
}
}
function getSpaceBuildingEffDesc(x) {
2020-08-21 19:02:34 +00:00
let eff = tmp.spaceBuildEff[x]
2020-08-19 02:50:24 +00:00
switch(x) {
case 1:
return "Space Energy boosts Point gain & Prestige Point gain ("+format(eff)+"x)"
break;
case 2:
return "Adds to base of Booster/Generator effects by "+format(eff)
break;
case 3:
return "Makes Boosters/Generators cheaper by "+format(eff)+"x"
break;
2020-08-19 19:53:14 +00:00
case 4:
return "Booster Upgrade 6's effect is raised to the power of "+format(eff)
2020-08-20 20:37:22 +00:00
break;
case 5:
return "Add "+format(eff)+" free levels to all previous Space Buildings."
break;
2020-08-19 02:50:24 +00:00
}
}
function buyBuilding(x) {
if (!player.s.unl) return
2020-08-21 19:02:34 +00:00
if (tmp.sbUnl<x) return
2020-08-19 02:50:24 +00:00
if (getSpace().lt(1)) return
let cost = getSpaceBuildingCost(x)
if (player.g.power.lt(cost)) return
player.g.power = player.g.power.sub(cost)
player.s.spent = player.s.spent.plus(1)
player.s.buildings[x] = player.s.buildings[x].plus(1)
}
2020-08-30 01:39:01 +00:00
function maxSpaceBuilding(x) {
if (!player.s.unl) return
if (tmp.sbUnl<x) return
let space = getSpace()
if (space.lt(1)) return
let target = getSpaceBuildingTarg(x)
let bulk = target.sub(player.s.buildings[x]).min(space)
if (bulk.lt(1)) return
player.s.spent = player.s.spent.plus(bulk)
player.s.buildings[x] = player.s.buildings[x].plus(bulk)
}
2020-08-29 18:00:32 +00:00
function destroyBuilding(x, all=false) {
if (!player.s.unl) return
if (tmp.sbUnl<x) return
if (player.s.buildings[x].lt(1)) return
if (player.q.best.lt(2500)) return
player.s.spent = player.s.spent.sub(all?player.s.buildings[x]:1)
player.s.buildings[x] = all?new Decimal(0):player.s.buildings[x].sub(1)
}
2020-08-19 02:50:24 +00:00
function respecSpaceBuildings() {
if (!player.s.unl) return;
if (!confirm("Are you sure you want to reset your Space Buildings? This will force you to do a Space reset as well!")) return
2020-08-20 20:37:22 +00:00
for (let i=1;i<=5;i++) player.s.buildings[i] = new Decimal(0)
2020-08-19 02:50:24 +00:00
player.s.spent = new Decimal(0)
2020-08-19 19:53:14 +00:00
doReset("s", true)
}
function getSpaceBuildingsUnl() {
let x = 3
2020-08-26 19:08:00 +00:00
if (player.s.upgrades.includes(14)&&!(tmp.hcActive?tmp.hcActive[12]:true)) x++;
if (player.s.upgrades.includes(32)&&!(tmp.hcActive?tmp.hcActive[12]:true)) x++;
2020-08-19 19:53:14 +00:00
return x;
2020-08-19 02:50:24 +00:00
}
2020-08-26 03:32:27 +00:00
function toggleAuto(layer, end="") {
if (player[layer]["auto"+end]===undefined) return;
player[layer]["auto"+end] = !player[layer]["auto"+end]
2020-08-20 04:55:26 +00:00
}
2020-08-22 01:16:23 +00:00
function getSuperBoosterPow() {
2020-08-29 16:43:58 +00:00
if (tmp.hcActive ? tmp.hcActive[41] : true) return new Decimal(0)
2020-08-22 01:16:23 +00:00
let pow = new Decimal(1)
2020-08-26 19:08:00 +00:00
if (player.sb.upgrades.includes(11)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.sb[11].currently())
if (player.sb.upgrades.includes(12)&&!(tmp.hcActive?tmp.hcActive[12]:true)) pow = pow.times(LAYER_UPGS.sb[12].currently())
2020-08-30 01:39:01 +00:00
if (player.hb.upgrades.includes(11)) pow = pow.times(LAYER_UPGS.hb[11].currently())
2020-08-22 01:16:23 +00:00
return pow;
}
2020-08-26 22:42:19 +00:00
function addToSBBase() {
let toAdd = new Decimal(0)
if (player.h.challs.includes(22)) toAdd = toAdd.plus(0.25)
2020-08-29 16:43:58 +00:00
if (player.h.challs.includes(41)) toAdd = toAdd.plus(0.25)
2020-08-29 19:45:18 +00:00
if (player.sb.upgrades.includes(22)) toAdd = toAdd.plus(LAYER_UPGS.sb[22].currently())
2020-08-29 23:43:53 +00:00
if (player.hb.unl) toAdd = toAdd.times(tmp.layerEffs.hb)
2020-08-26 22:42:19 +00:00
return toAdd
}
2020-08-26 01:45:22 +00:00
function getQuirkLayerCost() {
let cost = Decimal.pow(2, Decimal.pow(2, player.q.layers)).sub(1)
return cost.max(1);
}
2020-08-26 16:26:46 +00:00
function getQuirkLayerMult() {
let mult = new Decimal(1)
if (player.q.upgrades.includes(13)) mult = mult.times(2)
2020-08-29 16:43:58 +00:00
if (player.q.upgrades.includes(14)) mult = mult.times(3)
2020-08-26 19:08:00 +00:00
if (player.q.upgrades.includes(21)) mult = mult.times(LAYER_UPGS.q[21].currently())
2020-08-31 18:33:29 +00:00
if (player.h.challs.includes(52)) mult = mult.times(H_CHALLS[52].currently())
2020-08-26 16:26:46 +00:00
return mult
}
2020-08-26 01:45:22 +00:00
function getQuirkEnergyGainExp() {
return player.q.layers.sub(1)
}
function getQuirkEnergyEff() {
let eff = player.q.energy.plus(1).pow(2)
2020-08-26 16:26:46 +00:00
if (player.q.upgrades.includes(12)) {
let mod = player.q.energy.plus(1).log10().plus(1).log10().plus(1)
if (mod.gte(2)) {
eff = eff.times(mod.div(2).pow(10))
mod = new Decimal(2)
}
eff = eff.pow(mod)
}
2020-08-27 15:38:26 +00:00
if (player.q.upgrades.includes(32)) eff = eff.pow(2)
2020-08-26 01:45:22 +00:00
return eff;
}
function buyQuirkLayer() {
if (!player.q.unl) return
let cost = getQuirkLayerCost()
if (player.q.points.lt(cost)) return
player.q.points = player.q.points.sub(cost)
player.q.layers = player.q.layers.plus(1)
}
2020-08-26 16:26:46 +00:00
const H_CHALLS = {
2020-08-30 16:18:34 +00:00
rows: 5,
2020-08-26 19:08:00 +00:00
cols: 2,
2020-08-26 16:26:46 +00:00
11: {
name: "Skip the Second",
desc: "Boosters and Generator Power do nothing",
unl: function() { return player.h.best.gt(0) },
goal: new Decimal("1e2400"),
reward: "The generator power effect is raised to the power of 1.25",
},
2020-08-26 19:08:00 +00:00
12: {
name: "Anti-Upgrades",
desc: "Row 3 Upgrades do nothing",
unl: function() { return player.h.challs.includes(11) },
goal: new Decimal("1e840"),
reward: "Quirk gain is boosted by your Quirk Layers",
currently: function() { return Decimal.pow(1.5, player.q.layers) },
effDisp: function(x) { return format(x)+"x" },
},
2020-08-26 20:40:54 +00:00
21: {
name: "Prestigeless",
desc: "Prestige Point gain is raised to the power of 0.01",
unl: function() { return player.h.challs.includes(12) },
goal: new Decimal("1e1200"),
reward: "Hindrance Spirit & Quirks make Time Capsules & Space Energy cheaper.",
currently: function() { return player.h.points.plus(player.q.points).div(2).plus(1).pow(1000) },
effDisp: function(x) { return format(x)+"x cheaper" },
},
22: {
2020-08-26 22:42:19 +00:00
name: "Impaired Nodes",
desc: "Enhancers, Extra Time Capsules, and Space Buildings do nothing.",
2020-08-26 20:40:54 +00:00
unl: function() { return player.h.challs.includes(12) },
2020-08-26 22:42:19 +00:00
goal: new Decimal("1e4600"),
reward: "Add 0.25 to the Super-Booster base.",
2020-08-26 20:40:54 +00:00
},
2020-08-27 15:38:26 +00:00
31: {
name: "Flattened Curve",
desc: "Point generation is tetrated by 0.1",
unl: function() { return player.h.challs.includes(21)||player.h.challs.includes(22) },
goal: new Decimal(1e208),
reward: "Enhancers are twice as strong.",
},
32: {
2020-08-27 19:12:20 +00:00
name: "Surprise Junction",
desc: "Prestige Upgrade 2 does nothing",
unl: function() { return player.h.challs.includes(21)&&player.h.challs.includes(22) },
goal: new Decimal("1e2580"),
2020-08-29 18:00:32 +00:00
reward: "Unlock 2 new Super-Booster Upgrades and 7 new Quirk Upgrades.",
2020-08-27 15:38:26 +00:00
},
2020-08-29 16:43:58 +00:00
41: {
name: "Skip the Third",
desc: "Enhancers, Time Capsules, Space Buildings, and Super-Boosters do nothing.",
unl: function() { return player.h.challs.includes(31)||player.h.challs.includes(32) },
goal: new Decimal("4.444e4444"),
reward: "Add 0.25 to the Super-Booster base.",
},
42: {
2020-08-29 19:45:18 +00:00
name: "Slowed to a Halt",
desc: "Time slows down over time, halting to a stop after 10 seconds.",
unl: function() { return player.h.challs.includes(31)&&player.h.challs.includes(32) },
goal: new Decimal("1e16500"),
reward: "Cube the Generator Power effect.",
2020-08-29 16:43:58 +00:00
},
2020-08-30 16:18:34 +00:00
51: {
name: "It's all Gone",
desc: '"Skip the Second" and "Skip the Third" are both applied at once.',
unl: function() { return player.h.challs.includes(41)&&player.h.challs.includes(42) },
goal: new Decimal("1e2840"),
reward: "Super-Boosters multiply the Generator base.",
currently: function() { return player.sb.points.plus(1).sqrt() },
effDisp: function(x) { return format(x)+"x" },
},
52: {
2020-08-31 18:33:29 +00:00
name: "Anti-Enhancers",
2020-09-01 02:11:22 +00:00
desc: "You lose Enhancers over time, which can make your Enhancer amount get below 0.",
unl: function() { return player.h.challs.includes(41)&&player.h.challs.includes(42)&&player.h.challs.includes(51) },
goal: new Decimal("1e440000"),
2020-08-31 18:33:29 +00:00
reward: "Quirk Layers are faster based on your Hindrance Spirit & Quirks.",
currently: function() {
let h = player.h.points.times(player.q.points).sqrt();
if (h.gte(1e150)) h = h.log10().pow(50).times(1e150/Math.pow(150, 50)).min(h)
if (h.gte(1e100)) h = h.times(1e100).sqrt()
let ret = h.plus(1).pow(0.04);
return ret;
},
effDisp: function(x) { return format(x)+"x" },
2020-08-30 16:18:34 +00:00
},
2020-08-26 16:26:46 +00:00
}
function HCActive(x) {
2020-08-30 16:18:34 +00:00
if (x==11||x==41) if (HCActive(51)) return true
2020-08-26 16:26:46 +00:00
return player.h.active==x;
}
function startHindrance(x) {
if (!player.h.unl) return
if (player.h.active==x) {
if (player.points.gte(H_CHALLS[x].goal) && !player.h.challs.includes(x)) player.h.challs.push(x);
player.h.active = 0
} else {
player.h.active = x
}
doReset("h", true)
}
2020-08-27 19:12:20 +00:00
function adjustMSDisp() {
let displays = ["always", "automation", "incomplete", "never"];
player.msDisplay = displays[(displays.indexOf(player.msDisplay)+1)%4]
}
function milestoneShown(complete, auto=false) {
switch(player.msDisplay) {
case "always":
return true;
break;
case "automation":
return auto||!complete
break;
case "incomplete":
return !complete
break;
case "never":
return false;
break;
}
return false;
}
2020-08-29 23:43:53 +00:00
function getSubspaceEff1() {
if (!player.ss.unl) return new Decimal(0)
let eff = player.ss.subspace.times(player.ss.points).plus(1).log10().times(100)
return eff.floor();
}
function getSubspaceEff2() {
if (!player.ss.unl) return new Decimal(1)
let eff = player.ss.subspace.plus(1).pow(750)
return eff;
}
function getSubspaceEff3() {
if (!player.ss.unl) return new Decimal(1)
let eff = player.ss.subspace.plus(1).log10().plus(1).log10().div(2.5).plus(1)
2020-08-30 01:39:01 +00:00
if (player.ss.upgrades.includes(13)) eff = eff.times(1.5)
if (eff.gte(2)) eff = eff.log2().plus(1)
2020-08-29 23:43:53 +00:00
return eff;
}
2020-08-30 01:39:01 +00:00
function getSubspaceGainMult() {
let mult = new Decimal(1)
if (player.ss.upgrades.includes(12)) mult = mult.times(LAYER_UPGS.ss[12].currently())
2020-09-01 00:39:33 +00:00
if (player.ss.upgrades.includes(22)) mult = mult.times(LAYER_UPGS.ss[22].currently())
2020-08-30 01:39:01 +00:00
return mult
}
function getHyperBoosterExp() {
let exp = new Decimal(1)
if (player.hb.order>0) exp = new Decimal(0.5)
return exp
}
function getHyperBoosterPow() {
let pow = new Decimal(1)
if (player.hb.upgrades.includes(12)) pow = pow.times(LAYER_UPGS.hb[12].currently())
return pow;
}
2020-08-19 02:50:24 +00:00
function gameLoop(diff) {
2020-08-30 01:39:01 +00:00
diff = new Decimal(diff)
2020-08-29 19:45:18 +00:00
if (isNaN(diff.toNumber())) diff = new Decimal(0);
player.h.time += diff.toNumber()
if (tmp.hcActive ? tmp.hcActive[42] : true) {
if (player.h.time>=10) diff = new Decimal(0)
else diff = diff.div(Decimal.div(10, Decimal.sub(10, player.h.time+1)).pow(1000))
}
player.timePlayed += diff.toNumber()
2020-08-27 15:38:26 +00:00
if (player.p.upgrades.includes(11)) player.points = player.points.plus(tmp.pointGen.times(diff)).max(0)
if (player.g.unl) player.g.power = player.g.power.plus(tmp.layerEffs.g.times(diff)).max(0)
if (player.g.best.gte(10)) player.p.points = player.p.points.plus(tmp.resetGain.p.times(diff)).max(0)
2020-08-19 02:50:24 +00:00
if (player.t.unl) {
2020-08-21 19:02:34 +00:00
let data = tmp.layerEffs.t
2020-08-27 15:38:26 +00:00
player.t.energy = player.t.energy.plus(data.gain.times(diff)).min(data.limit).max(0)
2020-08-19 02:50:24 +00:00
}
2020-08-26 01:45:22 +00:00
if (player.q.unl) {
2020-08-26 16:26:46 +00:00
let mult = getQuirkLayerMult()
2020-08-27 15:38:26 +00:00
player.q.time = player.q.time.plus(mult.times(diff)).max(0)
2020-08-26 01:45:22 +00:00
let exp = getQuirkEnergyGainExp()
2020-08-27 15:38:26 +00:00
if (exp.gte(0)) player.q.energy = player.q.energy.plus(player.q.time.pow(exp).times(mult).times(diff)).max(0)
2020-08-26 01:45:22 +00:00
}
2020-08-27 15:38:26 +00:00
if (player.q.best.gte(15)) player.e.points = player.e.points.plus(tmp.resetGain.e.times(diff)).max(0)
2020-08-29 23:43:53 +00:00
if (player.ss.unl) player.ss.subspace = player.ss.subspace.plus(tmp.layerEffs.ss.times(diff)).max(0)
2020-08-26 03:32:27 +00:00
if (player.b.auto&&player.t.best.gte(5)) doReset("b")
if (player.g.auto&&player.s.best.gte(5)) doReset("g")
if (player.e.auto&&player.q.best.gte(5)) maxEnhancers()
if (player.t.autoCap&&player.h.best.gte(5)) maxExtTimeCapsules()
2020-08-26 14:16:23 +00:00
if (player.t.auto&&player.q.best.gte(10)) doReset("t")
if (player.s.auto&&player.q.best.gte(10)) doReset("s")
2020-08-30 16:18:34 +00:00
if (player.s.autoBuild&&player.ss.best.gte(1)) for (let i=tmp.sbUnl;i>=1;i--) maxSpaceBuilding(i)
2020-08-26 14:16:23 +00:00
if (player.sb.auto&&player.h.best.gte(15)) doReset("sb")
2020-08-26 03:32:27 +00:00
2020-08-24 02:01:14 +00:00
if (player.hasNaN&&!NaNalert) {
alert("We have detected a corruption in your save. Please visit https://discord.gg/wwQfgPa for help.")
2020-08-25 22:42:43 +00:00
clearInterval(interval);
2020-08-26 01:45:22 +00:00
player.autosave = false;
2020-08-24 02:01:14 +00:00
NaNalert = true;
}
2020-08-19 02:50:24 +00:00
}
function hardReset() {
if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return
player = getStartPlayer()
save();
window.location.reload();
}
var saveInterval = setInterval(function() {
2020-08-19 22:20:42 +00:00
if (player===undefined) return;
2020-08-19 02:50:24 +00:00
if (player.autosave) save();
}, 5000)
var interval = setInterval(function() {
2020-08-31 18:33:29 +00:00
if (player===undefined||tmp===undefined) return;
2020-08-19 02:50:24 +00:00
let diff = (Date.now()-player.time)/1000
2020-09-01 00:39:33 +00:00
if (offTime.remain>0) {
offTime.speed = offTime.remain/5+1
diff += offTime.speed/50
offTime.remain = Math.max(offTime.remain-offTime.speed/50, 0)
}
2020-08-19 02:50:24 +00:00
player.time = Date.now()
2020-08-22 03:59:24 +00:00
if (needCanvasUpdate) resizeCanvas();
2020-08-21 19:02:34 +00:00
updateTemp();
2020-08-29 19:45:18 +00:00
gameLoop(new Decimal(diff))
2020-08-19 22:12:31 +00:00
}, 50)
document.onkeydown = function(e) {
2020-08-19 22:20:42 +00:00
if (player===undefined) return;
2020-08-19 22:12:31 +00:00
let shiftDown = e.shiftKey
2020-08-29 23:43:53 +00:00
let ctrlDown = e.ctrlKey
2020-08-19 22:12:31 +00:00
let key = e.key
2020-08-29 23:43:53 +00:00
if ((!LAYERS.includes(key))||ctrlDown||shiftDown) {
2020-08-22 03:59:24 +00:00
switch(key) {
2020-08-29 23:43:53 +00:00
case "b":
if (ctrlDown && player.hb.unl) doReset("hb")
break;
2020-08-22 03:59:24 +00:00
case "B":
if (player.sb.unl) doReset("sb")
break;
2020-08-29 23:43:53 +00:00
case "S":
if (player.ss.unl) doReset("ss")
break;
2020-08-22 03:59:24 +00:00
}
} else if (player[key].unl) doReset(key)
2020-08-19 22:12:31 +00:00
}