mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-25 01:41:45 +00:00
A few small improvements.
This commit is contained in:
parent
923f096aa0
commit
79639ce03d
2 changed files with 27 additions and 142 deletions
|
@ -141,7 +141,7 @@ Key:
|
||||||
and layers are sorted in alphabetical order.
|
and layers are sorted in alphabetical order.
|
||||||
|
|
||||||
- branches: **optional**, an array of layer ids. On a tree, a line will appear from this layer to all of the layers
|
- branches: **optional**, an array of layer ids. On a tree, a line will appear from this layer to all of the layers
|
||||||
in the list. Alternatively, an entry in the array can be a pair consisting of the layer id and a color
|
in the list. Alternatively, an entry in the array can be a 2-element array consisting of the layer id and a color
|
||||||
value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors)
|
value. The color value can either be a string with a hex color code, or a number from 1-3 (theme-affected colors)
|
||||||
|
|
||||||
- nodeStyle: **optional**, a CSS object, where the keys are CSS attributes, which styles this layer's node on the tree
|
- nodeStyle: **optional**, a CSS object, where the keys are CSS attributes, which styles this layer's node on the tree
|
||||||
|
|
167
js/layers.js
167
js/layers.js
|
@ -11,8 +11,8 @@ addLayer("c", {
|
||||||
buyables: {}, // You don't actually have to initialize this one
|
buyables: {}, // You don't actually have to initialize this one
|
||||||
beep: false,
|
beep: false,
|
||||||
}},
|
}},
|
||||||
color:() => "#4BDC13",
|
color: "#4BDC13",
|
||||||
requires:() => new Decimal(10), // Can be a function that takes requirement increases into account
|
requires: new Decimal(10), // Can be a function that takes requirement increases into account
|
||||||
resource: "lollipops", // Name of prestige currency
|
resource: "lollipops", // Name of prestige currency
|
||||||
baseResource: "candies", // Name of resource prestige is based on
|
baseResource: "candies", // Name of resource prestige is based on
|
||||||
baseAmount() {return player.points}, // Get the current amount of baseResource
|
baseAmount() {return player.points}, // Get the current amount of baseResource
|
||||||
|
@ -42,14 +42,14 @@ addLayer("c", {
|
||||||
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
||||||
},
|
},
|
||||||
milestones: {
|
milestones: {
|
||||||
0: {requirementDescription:() => "3 Lollipops",
|
0: {requirementDescription: "3 Lollipops",
|
||||||
done() {return player[this.layer].best.gte(3)}, // Used to determine when to give the milestone
|
done() {return player[this.layer].best.gte(3)}, // Used to determine when to give the milestone
|
||||||
effectDescription:() => "Unlock the next milestone",
|
effectDescription: "Unlock the next milestone",
|
||||||
},
|
},
|
||||||
1: {requirementDescription:() => "4 Lollipops",
|
1: {requirementDescription: "4 Lollipops",
|
||||||
unlocked() {return hasMilestone(this.layer, 0)},
|
unlocked() {return hasMilestone(this.layer, 0)},
|
||||||
done() {return player[this.layer].best.gte(4)},
|
done() {return player[this.layer].best.gte(4)},
|
||||||
effectDescription:() => "You can toggle beep and boop (which do nothing)",
|
effectDescription: "You can toggle beep and boop (which do nothing)",
|
||||||
toggles: [
|
toggles: [
|
||||||
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
|
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
|
||||||
["f", "boop"]],
|
["f", "boop"]],
|
||||||
|
@ -64,11 +64,11 @@ addLayer("c", {
|
||||||
rows: 2,
|
rows: 2,
|
||||||
cols: 12,
|
cols: 12,
|
||||||
11: {
|
11: {
|
||||||
name:() => "Fun",
|
name: "Fun",
|
||||||
completionLimit: 3,
|
completionLimit: 3,
|
||||||
challengeDescription() {return "Makes the game 0% harder<br>"+challengeCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"},
|
challengeDescription() {return "Makes the game 0% harder<br>"+challengeCompletions(this.layer, this.id) + "/" + this.completionLimit + " completions"},
|
||||||
unlocked() { return player[this.layer].best.gt(0) },
|
unlocked() { return player[this.layer].best.gt(0) },
|
||||||
goal:() => new Decimal("20"),
|
goal: new Decimal("20"),
|
||||||
currencyDisplayName: "lollipops", // Use if using a nonstandard currency
|
currencyDisplayName: "lollipops", // Use if using a nonstandard currency
|
||||||
currencyInternalName: "points", // Use if using a nonstandard currency
|
currencyInternalName: "points", // Use if using a nonstandard currency
|
||||||
currencyLayer: this.layer, // Leave empty if not in a layer
|
currencyLayer: this.layer, // Leave empty if not in a layer
|
||||||
|
@ -86,14 +86,14 @@ addLayer("c", {
|
||||||
rows: 2,
|
rows: 2,
|
||||||
cols: 3,
|
cols: 3,
|
||||||
11: {
|
11: {
|
||||||
title:() => "Generator of Genericness",
|
title: "Generator of Genericness",
|
||||||
description:() => "Gain 1 Point every second.",
|
description: "Gain 1 Point every second.",
|
||||||
cost:() => new Decimal(1),
|
cost: new Decimal(1),
|
||||||
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
||||||
},
|
},
|
||||||
12: {
|
12: {
|
||||||
description:() => "Candy generation is faster based on your unspent Lollipops.",
|
description: "Candy generation is faster based on your unspent Lollipops.",
|
||||||
cost:() => new Decimal(1),
|
cost: new Decimal(1),
|
||||||
unlocked() { return (hasUpgrade(this.layer, 11))},
|
unlocked() { return (hasUpgrade(this.layer, 11))},
|
||||||
effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values
|
effect() { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values
|
||||||
let ret = player[this.layer].points.add(1).pow(player[this.layer].upgrades.includes(24)?1.1:(player[this.layer].upgrades.includes(14)?0.75:0.5))
|
let ret = player[this.layer].points.add(1).pow(player[this.layer].upgrades.includes(24)?1.1:(player[this.layer].upgrades.includes(14)?0.75:0.5))
|
||||||
|
@ -103,8 +103,8 @@ addLayer("c", {
|
||||||
effectDisplay() { return format(this.effect())+"x" }, // Add formatting to the effect
|
effectDisplay() { return format(this.effect())+"x" }, // Add formatting to the effect
|
||||||
},
|
},
|
||||||
13: {
|
13: {
|
||||||
description:() => "Unlock a <b>secret subtab</b> and make this layer act if you unlocked it first.",
|
description: "Unlock a <b>secret subtab</b> and make this layer act if you unlocked it first.",
|
||||||
cost:() => new Decimal(69),
|
cost: new Decimal(69),
|
||||||
currencyDisplayName: "candies", // Use if using a nonstandard currency
|
currencyDisplayName: "candies", // Use if using a nonstandard currency
|
||||||
currencyInternalName: "points", // Use if using a nonstandard currency
|
currencyInternalName: "points", // Use if using a nonstandard currency
|
||||||
currencyLayer: "", // Leave empty if not in a layer "e.g. points"
|
currencyLayer: "", // Leave empty if not in a layer "e.g. points"
|
||||||
|
@ -124,9 +124,9 @@ addLayer("c", {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
22: {
|
22: {
|
||||||
title:() => "This upgrade doesn't exist",
|
title: "This upgrade doesn't exist",
|
||||||
description:() => "Or does it?.",
|
description: "Or does it?.",
|
||||||
cost:() => new Decimal(3),
|
cost: new Decimal(3),
|
||||||
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
unlocked() { return player[this.layer].unlocked }, // The upgrade is only visible when this is true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -138,9 +138,9 @@ addLayer("c", {
|
||||||
resetBuyables(this.layer)
|
resetBuyables(this.layer)
|
||||||
doReset(this.layer, true) // Force a reset
|
doReset(this.layer, true) // Force a reset
|
||||||
},
|
},
|
||||||
respecText:() => "Respec Thingies", // Text on Respec button, optional
|
respecText: "Respec Thingies", // Text on Respec button, optional
|
||||||
11: {
|
11: {
|
||||||
title:() => "Exhancers", // Optional, displayed at the top in a larger font
|
title: "Exhancers", // Optional, displayed at the top in a larger font
|
||||||
cost(x=player[this.layer].buyables[this.id]) { // cost for buying xth buyable, can be an object if there are multiple currencies
|
cost(x=player[this.layer].buyables[this.id]) { // cost for buying xth buyable, can be an object if there are multiple currencies
|
||||||
if (x.gte(25)) x = x.pow(2).div(25)
|
if (x.gte(25)) x = x.pow(2).div(25)
|
||||||
let cost = Decimal.pow(2, x.pow(1.5))
|
let cost = Decimal.pow(2, x.pow(1.5))
|
||||||
|
@ -224,7 +224,7 @@ addLayer("c", {
|
||||||
display() {
|
display() {
|
||||||
return format(player.points) + " / 1e10 points"
|
return format(player.points) + " / 1e10 points"
|
||||||
},
|
},
|
||||||
unlocked:() => true,
|
unlocked: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
tallBoi: {
|
tallBoi: {
|
||||||
|
@ -242,7 +242,7 @@ addLayer("c", {
|
||||||
display() {
|
display() {
|
||||||
return formatWhole((player.points.div(1)).min(100)) + "%"
|
return formatWhole((player.points.div(1)).min(100)) + "%"
|
||||||
},
|
},
|
||||||
unlocked:() => true,
|
unlocked: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
flatBoi: {
|
flatBoi: {
|
||||||
|
@ -257,7 +257,7 @@ addLayer("c", {
|
||||||
progress() {
|
progress() {
|
||||||
return player.c.points.div(50)
|
return player.c.points.div(50)
|
||||||
},
|
},
|
||||||
unlocked:() => true,
|
unlocked: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -348,7 +348,7 @@ addLayer("f", {
|
||||||
boop: false,
|
boop: false,
|
||||||
clickables: {[11]: "Start"} // Optional default Clickable state
|
clickables: {[11]: "Start"} // Optional default Clickable state
|
||||||
}},
|
}},
|
||||||
color:() => "#FE0102",
|
color: "#FE0102",
|
||||||
requires() {return new Decimal(10)},
|
requires() {return new Decimal(10)},
|
||||||
resource: "farm points",
|
resource: "farm points",
|
||||||
baseResource: "candies",
|
baseResource: "candies",
|
||||||
|
@ -357,7 +357,7 @@ addLayer("f", {
|
||||||
exponent: 0.5,
|
exponent: 0.5,
|
||||||
base: 3,
|
base: 3,
|
||||||
roundUpCost: true,
|
roundUpCost: true,
|
||||||
canBuyMax:() => true,
|
canBuyMax() {return hasAchievement('a', 13)},
|
||||||
gainMult() {
|
gainMult() {
|
||||||
return new Decimal(1)
|
return new Decimal(1)
|
||||||
},
|
},
|
||||||
|
@ -401,7 +401,7 @@ addLayer("f", {
|
||||||
},
|
},
|
||||||
masterButtonText() {return (getClickableState(this.layer, 11) == "Borkened...") ? "Fix the clickable!" : "Does nothing"}, // Text on Respec button, optional
|
masterButtonText() {return (getClickableState(this.layer, 11) == "Borkened...") ? "Fix the clickable!" : "Does nothing"}, // Text on Respec button, optional
|
||||||
11: {
|
11: {
|
||||||
title:() => "Clicky clicky!", // Optional, displayed at the top in a larger font
|
title: "Clicky clicky!", // Optional, displayed at the top in a larger font
|
||||||
display() { // Everything else displayed in the buyable button after the title
|
display() { // Everything else displayed in the buyable button after the title
|
||||||
let data = getClickableState(this.layer, this.id)
|
let data = getClickableState(this.layer, this.id)
|
||||||
return "Current state:<br>" + data
|
return "Current state:<br>" + data
|
||||||
|
@ -453,121 +453,6 @@ addLayer("f", {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// This layer is mostly minimal but it uses a custom prestige type and a clickable
|
|
||||||
addLayer("f", {
|
|
||||||
startData() { return {
|
|
||||||
unlocked: false,
|
|
||||||
points: new Decimal(0),
|
|
||||||
boop: false,
|
|
||||||
clickables: {[11]: "Start"} // Optional default Clickable state
|
|
||||||
}},
|
|
||||||
color:() => "#FE0102",
|
|
||||||
requires() {return new Decimal(10)},
|
|
||||||
resource: "farm points",
|
|
||||||
baseResource: "candies",
|
|
||||||
baseAmount() {return player.points},
|
|
||||||
type: "custom", // A "Custom" type which is effectively static
|
|
||||||
exponent: 0.5,
|
|
||||||
base: 3,
|
|
||||||
roundUpCost: true,
|
|
||||||
canBuyMax:() => true,
|
|
||||||
gainMult() {
|
|
||||||
return new Decimal(1)
|
|
||||||
},
|
|
||||||
gainExp() {
|
|
||||||
return new Decimal(1)
|
|
||||||
},
|
|
||||||
row: 1,
|
|
||||||
layerShown() {return true},
|
|
||||||
branches: ["c"], // When this layer appears, a branch will appear from this layer to any layers here. Each entry can be a pair consisting of a layer id and a color.
|
|
||||||
|
|
||||||
tooltipLocked() { // Optional, tooltip displays when the layer is locked
|
|
||||||
return ("This weird farmer dinosaur will only see you if you have at least " + this.requires() + " candies. You only have " + formatWhole(player.points))
|
|
||||||
},
|
|
||||||
|
|
||||||
midsection: [
|
|
||||||
"blank", ['display-image', 'https://images.beano.com/store/24ab3094eb95e5373bca1ccd6f330d4406db8d1f517fc4170b32e146f80d?auto=compress%2Cformat&dpr=1&w=390'],
|
|
||||||
["display-text", "Bork bork!"]
|
|
||||||
],
|
|
||||||
|
|
||||||
// The following are only currently used for "custom" Prestige type:
|
|
||||||
prestigeButtonText() { //Is secretly HTML
|
|
||||||
if (!this.canBuyMax()) return "Hi! I'm a <u>weird dinosaur</u> and I'll give you a Farm Point in exchange for all of your candies and lollipops! (At least " + formatWhole(tmp[this.layer].nextAt) + " candies)"
|
|
||||||
if (this.canBuyMax()) return "Hi! I'm a <u>weird dinosaur</u> and I'll give you <b>" + formatWhole(tmp[this.layer].resetGain) + "</b> Farm Points in exchange for all of your candies and lollipops! (You'll get another one at " + formatWhole(tmp[layer].nextAtDisp) + " candies)"
|
|
||||||
},
|
|
||||||
getResetGain() {
|
|
||||||
return getResetGain(this.layer, useType = "static")
|
|
||||||
},
|
|
||||||
getNextAt(canMax=false) { //
|
|
||||||
return getNextAt(this.layer, canMax, useType = "static")
|
|
||||||
},
|
|
||||||
canReset() {
|
|
||||||
return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt)
|
|
||||||
},
|
|
||||||
// This is also non minimal, a Clickable!
|
|
||||||
clickables: {
|
|
||||||
rows: 1,
|
|
||||||
cols: 1,
|
|
||||||
masterButtonPress() { // Optional, reset things and give back your currency. Having this function makes a respec button appear
|
|
||||||
if (getClickableState(this.layer, 11) == "Borkened...")
|
|
||||||
player[this.layer].clickables[11] = "Start"
|
|
||||||
},
|
|
||||||
masterButtonText() {return (getClickableState(this.layer, 11) == "Borkened...") ? "Fix the clickable!" : "Does nothing"}, // Text on Respec button, optional
|
|
||||||
11: {
|
|
||||||
title:() => "Clicky clicky!", // Optional, displayed at the top in a larger font
|
|
||||||
display() { // Everything else displayed in the buyable button after the title
|
|
||||||
let data = getClickableState(this.layer, this.id)
|
|
||||||
return "Current state:<br>" + data
|
|
||||||
},
|
|
||||||
unlocked() { return player[this.layer].unlocked },
|
|
||||||
canClick() {
|
|
||||||
return getClickableState(this.layer, this.id) !== "Borkened..."},
|
|
||||||
onClick() {
|
|
||||||
switch(getClickableState(this.layer, this.id)){
|
|
||||||
case "Start":
|
|
||||||
player[this.layer].clickables[this.id] = "A new state!"
|
|
||||||
break;
|
|
||||||
case "A new state!":
|
|
||||||
player[this.layer].clickables[this.id] = "Keep going!"
|
|
||||||
break;
|
|
||||||
case "Keep going!":
|
|
||||||
player[this.layer].clickables[this.id] = "Maybe that's a bit too far..."
|
|
||||||
break;
|
|
||||||
case "Maybe that's a bit too far...":
|
|
||||||
player[this.layer].clickables[this.id] = "Borkened..."
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
player[this.layer].clickables[this.id] = "Start"
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style() {
|
|
||||||
switch(getClickableState(this.layer, this.id)){
|
|
||||||
case "Start":
|
|
||||||
return {'background-color': 'green'}
|
|
||||||
break;
|
|
||||||
case "A new state!":
|
|
||||||
return {'background-color': 'yellow'}
|
|
||||||
break;
|
|
||||||
case "Keep going!":
|
|
||||||
return {'background-color': 'orange'}
|
|
||||||
break;
|
|
||||||
case "Maybe that's a bit too far...":
|
|
||||||
return {'background-color': 'red'}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return {}
|
|
||||||
break;
|
|
||||||
}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
// This layer is mostly minimal but it uses a custom prestige type and a clickable
|
// This layer is mostly minimal but it uses a custom prestige type and a clickable
|
||||||
addLayer("a", {
|
addLayer("a", {
|
||||||
startData() { return {
|
startData() { return {
|
||||||
|
|
Loading…
Reference in a new issue