1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2025-05-12 13:01:05 +00:00

1.2: This changes everything!

This commit is contained in:
Acamaeda 2020-10-03 15:45:47 -04:00
parent 7929873a11
commit eca8970c38
15 changed files with 389 additions and 401 deletions

View file

@ -5,8 +5,8 @@ var NaNalert = false;
var gameEnded = false;
let VERSION = {
num: "1.1.1",
name: "Enhanced Edition"
num: "1.2",
name: "This changes everything!"
}
function startPlayerBase() {
@ -293,7 +293,7 @@ function getNextAt(layer) {
}
function nodeShown(layer) {
if (layers[layer].layerShown()) return true
if (tmp.layerShown[layer]) return true
switch(layer) {
case "idk":
return player.l.unl
@ -405,7 +405,7 @@ function respecBuyables(layer) {
function canAffordUpg(layer, id) {
upg = layers[layer].upgrades[id]
cost = upg.cost
cost = tmp.upgrades[layer][id].cost
return canAffordPurchase(layer, upg, cost)
}
@ -421,7 +421,6 @@ function hasChall(layer, id){
return (player[layer].challs.includes(id))
}
function canAffordPurchase(layer, thing, cost) {
if (thing.currencyInternalName){
let name = thing.currencyInternalName
@ -443,22 +442,23 @@ function buyUpg(layer, id) {
if (!layers[layer].upgrades[id].unl()) return
if (player[layer].upgrades.includes(id)) return
upg = layers[layer].upgrades[id]
cost = tmp.upgrades[layer][id].cost
if (upg.currencyInternalName){
let name = upg.currencyInternalName
if (upg.currencyLayer){
let lr = upg.currencyLayer
if (player[lr][name].lt(upg.cost)) return
player[lr][name] = player[lr][name].sub(upg.cost)
if (player[lr][name].lt(cost)) return
player[lr][name] = player[lr][name].sub(cost)
}
else {
if (player[name].lt(upg.cost)) return
player[name] = player[name].sub(upg.cost)
if (player[name].lt(cost)) return
player[name] = player[name].sub(cost)
}
}
else {
if (player[layer].points.lt(upg.cost)) return
player[layer].points = player[layer].points.sub(upg.cost)
if (player[layer].points.lt(cost)) return
player[layer].points = player[layer].points.sub(cost)
}
player[layer].upgrades.push(id);
if (upg.onPurchase != undefined)
@ -467,8 +467,8 @@ function buyUpg(layer, id) {
function buyBuyable(layer, id) {
if (!player[layer].unl) return
if (!layers[layer].buyables[id].unl()) return
if (!layers[layer].buyables[id].canAfford()) return
if (!tmp.buyables[layer][id].unl) return
if (!tmp.buyables[layer][id].canAfford) return
layers[layer].buyables[id].buy()
}
@ -517,7 +517,7 @@ function canCompleteChall(layer, x)
let name = chall.currencyInternalName
if (chall.currencyLayer){
let lr = chall.currencyLayer
return !(player[lr][name].lt(chall.goal))
return !(player[lr][name].lt(readData(chall.goal)))
}
else {
return !(player[name].lt(chall.cost))
@ -719,21 +719,6 @@ function switchTheme() {
resizeCanvas()
}
function updateHotkeys()
{
hotkeys = {};
for (layer in layers){
hk = layers[layer].hotkeys
if (hk){
for (id in hk){
hotkeys[hk[id].key] = hk[id]
hotkeys[hk[id].key].layer = layer
}
}
}
}
updateHotkeys()
document.onkeydown = function(e) {
if (player===undefined) return;
if (gameEnded&&!player.keepGoing) return;

85
js/layerSupport.js Normal file
View file

@ -0,0 +1,85 @@
var layers = {}
function layerShown(layer){
return layers[layer].layerShown();
}
var LAYERS = Object.keys(layers);
var hotkeys = {};
function updateHotkeys()
{
hotkeys = {};
for (layer in layers){
hk = layers[layer].hotkeys
if (hk){
for (id in hk){
hotkeys[hk[id].key] = hk[id]
hotkeys[hk[id].key].layer = layer
}
}
}
}
var ROW_LAYERS = {}
function updateLayers(){
LAYERS = Object.keys(layers);
ROW_LAYERS = {}
for (layer in layers){
layers[layer].layer = layer
if (layers[layer].upgrades){
for (thing in layers[layer].upgrades){
if (!isNaN(thing)){
layers[layer].upgrades[thing].id = thing
layers[layer].upgrades[thing].layer = layer
}
}
}
if (layers[layer].milestones){
for (thing in layers[layer].milestones){
if (!isNaN(thing)){
layers[layer].milestones[thing].id = thing
layers[layer].milestones[thing].layer = layer
}
}
}
if (layers[layer].challs){
for (thing in layers[layer].challs){
if (!isNaN(thing)){
layers[layer].challs[thing].id = thing
layers[layer].challs[thing].layer = layer
}
}
}
if (layers[layer].buyables){
layers[layer].buyables.layer = layer
for (thing in layers[layer].buyables){
if (!isNaN(thing)){
layers[layer].buyables[thing].id = thing
layers[layer].buyables[thing].layer = layer
}
}
}
row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
ROW_LAYERS[row][layer]=layer;
}
updateHotkeys()
}
function addLayer(layerName, layerData){ // Call this to add layers from a different file!
layers[layerName] = layerData
updateLayers()
}
// If data is a function, return the result of calling it. Otherwise, return the data.
function readData(data, args=null){
if (!!(data && data.constructor && data.call && data.apply))
return data(args);
else
return data;
}

View file

@ -1,5 +1,5 @@
var layers = {
c: {
addLayer("c", {
layer: "c", // This is assigned automatically, both to the layer and all upgrades, etc. Shown here so you know about it
startData() { return {
unl: true,
points: new Decimal(0),
@ -8,75 +8,98 @@ var layers = {
buyables: {}, // You don't actually have to initialize this one
beep: false,
}},
color: "#4BEC13",
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
color:() => "#4BEC13",
requires:() => new Decimal(10), // Can be a function that takes requirement increases into account
resource: "lollipops", // Name of prestige currency
baseResource: "candies", // Name of resource prestige is based on
baseAmount() {return player.points},
baseAmount() {return player.points}, // Get the current amount of baseResource
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
exponent: 0.5, // Prestige currency exponent
base: 5, // Only needed for static layers, base of the formula (b^(x^exp))
resCeil: false, // True if the resource needs to be rounded up
canBuyMax() {}, // Only needed for static layers
gainMult() {
resCeil: false, // True if the cost needs to be rounded up (use when baseResource is static?)
canBuyMax() {}, // Only needed for static layers with buy max
gainMult() { // Calculate the multiplier for main currency from bonuses
mult = new Decimal(1)
if (player.c.upgrades.includes(21)) mult = mult.times(2)
if (player.c.upgrades.includes(23)) mult = mult.times(LAYER_UPGS.c[23].currently())
if (player[this.layer].upgrades.includes(21)) mult = mult.times(2)
if (player[this.layer].upgrades.includes(23)) mult = mult.times(this.upgrades[23].currently())
return mult
},
gainExp() {
gainExp() { // Calculate the exponent on main currency from bonuses
return new Decimal(1)
},
row: 0,
effect() {return { // Formulas for any boosts inherent to resources in the layer. Can return a single value instead of an object if there is just one effect
waffleBoost: (true == false ? 0 : Decimal.pow(player.c.points, 0.2)),
icecreamCap: (player.c.points * 10)
row: 0, // Row the layer is in on the tree (0 is the first row)
effect() {
return { // Formulas for any boosts inherent to resources in the layer. Can return a single value instead of an object if there is just one effect
waffleBoost: (true == false ? 0 : Decimal.pow(player[this.layer].points, 0.2)),
icecreamCap: (player[this.layer].points * 10)
}},
effectDescription() {
eff = layers.c.effect();
effectDescription() { // Optional text to describe the effects
eff = this.effect;
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
},
milestones: {
0: {requirementDesc: "3 Lollipops",
done() {return player.c.best.gte(3)},
effectDesc: "Makes this green",
0: {requirementDesc:() => "3 Lollipops",
done() {return player[this.layer].best.gte(3)}, // Used to determine when to give the milestone
effectDesc:() => "Makes this green",
},
1: {requirementDesc: "4 Lollipops",
done() {return player.c.best.gte(4)},
effectDesc: "You can toggle beep and boop (which do nothing)",
1: {requirementDesc:() => "4 Lollipops",
done() {return player[this.layer].best.gte(4)},
effectDesc:() => "You can toggle beep and boop (which do nothing)",
toggles: [
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
[this.layer, "beep"], // Each toggle is defined by a layer and the data toggled for that layer
["f", "boop"]],
}
},
challs: {
rows: 1,
cols: 1,
11: {
name:() => "Fun",
desc:() => "Makes the game 0% harder",
unl() { return player[this.layer].best.gt(0) },
goal:() => new Decimal("20"),
currencyDisplayName: "lollipops", // Use if using a nonstandard currency
currencyInternalName: "points", // Use if using a nonstandard currency
currencyLayer: this.layer, // Leave empty if not in a layer
effect() {
let ret = player[this.layer].points.add(1).tetrate(0.02)
return ret;
},
effectDisplay(x) { return format(x)+"x" },
countsAs: [12, 21], // Use this for if a challenge includes the effects of other challenges. Being in this challenge "counts as" being in these.
reward:() => "Says hi",
onComplete() {console.log("hiii")} // Called when you complete the challenge
},
},
upgrades: {
rows: 1,
cols: 3,
11: {
desc: "Gain 1 Candy every second.",
cost: new Decimal(1),
unl() { return player.c.unl },
title:() => "Generator of Genericness",
desc:() => "Gain 1 Point every second.",
cost:() => new Decimal(1),
unl() { return player[this.layer].unl }, // The upgrade is only visible when this is true
},
12: {
desc: "Candy generation is faster based on your unspent Lollipops.",
cost: new Decimal(1),
unl() { return player.c.upgrades.includes(11) },
effect() {
let ret = player.c.points.add(1).pow(player.c.upgrades.includes(24)?1.1:(player.c.upgrades.includes(14)?0.75:0.5))
desc:() => "Candy generation is faster based on your unspent Lollipops.",
cost:() => new Decimal(1),
unl() { return player[this.layer].upgrades.includes(11) },
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))
if (ret.gte("1e20000000")) ret = ret.sqrt().times("1e10000000")
return ret;
},
effDisp(fx) { return format(fx)+"x" },
effectDisplay(fx) { return format(fx)+"x" }, // Add formatting to the effect
},
13: {
desc: "Make this layer act like you bought it first.",
cost: new Decimal(69),
desc:() => "Make this layer act like you bought it first.",
cost:() => new Decimal(69),
currencyDisplayName: "candies", // 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"
unl() { return player.c.upgrades.includes(12) },
onPurchase() {
player.c.order = 0
unl() { return player[this.layer].upgrades.includes(12) },
onPurchase() { // This function triggers when the upgrade is purchased
player[this.layer].order = 0
}
},
},
@ -84,13 +107,13 @@ var layers = {
rows: 1,
cols: 1,
respec() { // Optional, reset things and give back your currency. Having this function makes a respec button appear
player.c.points = player.c.points.add(player.c.spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value
resetBuyables("c")
doReset("c", true) // Force a reset
player[this.layer].points = player[this.layer].points.add(player[this.layer].spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value
resetBuyables(this.layer)
doReset(this.layer, true) // Force a reset
},
respecText: "Respec Thingies", // Text on Respec button, optional
respecText:() => "Respec Thingies", // Text on Respec button, optional
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) { // cost for buying xth buyable, can be an object if there are multiple currencies
if (x.gte(25)) x = x.pow(2).div(25)
let cost = Decimal.pow(2, x.pow(1.5))
@ -105,66 +128,71 @@ var layers = {
else eff.second = x.times(-1).pow(0.8).times(-1)
return eff;
},
display (){
let data = tmp.buyables.c["11"]
display() { // Everything else displayed in the buyable button after the title
let data = tmp.buyables[this.layer]["11"]
return "Cost: " + format(data.cost) + " lollipops\n\
Amount: " + player.c.buyables["11"] + "\n\
Adds + " + format(data.effects.first) + " things and multiplies stuff by " + format(data.effects.second)
Amount: " + player[this.layer].buyables["11"] + "\n\
Adds + " + format(data.effect.first) + " things and multiplies stuff by " + format(data.effect.second)
},
unl() { return player.c.unl },
canAfford() {return player.c.points.gte(tmp.buyables.c[11].cost)},
buy() {
cost = tmp.buyables.c[11].cost
player.c.points = player.c.points.sub(cost)
player.c.buyables[11] = player.c.buyables[11].add(1)
player.c.spentOnBuyables = player.c.spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value
unl() { return player[this.layer].unl },
canAfford() {
return player[this.layer].points.gte(tmp.buyables["c"][11].cost)},
buy() {
cost = tmp.buyables[this.layer][11].cost
player[this.layer].points = player[this.layer].points.sub(cost)
player[this.layer].buyables[11] = player[this.layer].buyables[11].add(1)
player[this.layer].spentOnBuyables = player[this.layer].spentOnBuyables.add(cost) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value
},
buyMax() {}, // You'll have to handle this yourself if you want
},
},
doReset(layer){
if(layers[layer].row > layers["c"].row) fullLayerReset('c') // This is actually the default behavior
doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row.
if(layers[resettingLayer].row > this.row) fullLayerReset(this.layer) // This is actually the default behavior
},
convertToDecimal() {
// Convert any layer-specific values (besides points, total, and best) to Decimal
// Convert any layer-specific Decimal values (besides points, total, and best) from String to Decimal (used when loading save)
},
layerShown() {return true}, // Condition for when layer appears
layerShown() {return true}, // Condition for when layer appears on the tree
update(diff) {
if (player.c.upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
if (player[this.layer].upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
}, // Do any gameloop things (e.g. resource generation) inherent to this layer
automate() {
}, // Do any automation inherent to this layer if appropriate
updateTemp() {
}, // Do any necessary temp updating
}, // Do any necessary temp updating, not that important usually
resetsNothing() {return false},
onPrestige(gain) {
return
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
hotkeys: [
{key: "c", desc: "C: reset for lollipops or whatever", onPress(){if (player.c.unl) doReset("c")}},
{key: "ctrl+c", desc: "Ctrl+c: respec things", onPress(){if (player.c.unl) respecBuyables("c")}},
{key: this.layer, desc: "C: reset for lollipops or whatever", onPress(){if (player[this.layer].unl) doReset(this.layer)}},
{key: "ctrl+" + this.layer, desc: "Ctrl+c: respec things", onPress(){if (player[this.layer].unl) respecBuyables(this.layer)}},
],
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
// Optional, lets you format the tab yourself by listing components. You can create your own components in v.js.
tabFormat: ["main-display",
["prestige-button", function(){return "Melt your points into "}],
["prestige-button", function() {return "Melt your points into "}],
["raw-html", function() {return "<button onclick='console.log(`yeet`)'>'HI'</button>"}],
["display-text",
function() {return 'I have ' + format(player.points) + ' pointy points!'},
{"color": "red", "font-size": "32px", "font-family": "Comic Sans MS"}],
["buyables", "150px"],
["toggle", ["c", "beep"]],
"milestones", "upgrades"],
style: {
["toggle", [this.layer, "beep"]],
"milestones", "upgrades", "challs"],
style() {return {
'background-color': 'blue'
},
},
}},
})
f: {
addLayer("f", {
startData() { return {
unl: false,
points: new Decimal(0),
boop: false,
}},
color: "#FE0102",
color:() => "#FE0102",
requires() {return new Decimal(200)},
resource: "farm points",
baseResource: "candies",
@ -181,35 +209,6 @@ var layers = {
layerShown() {return true},
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
},
}
function layerShown(layer){
return layers[layer].layerShown();
}
var LAYERS = Object.keys(layers);
var hotkeys = {};
)
var ROW_LAYERS = {}
for (layer in layers){
row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
ROW_LAYERS[row][layer]=layer;
}
function addLayer(layerName, layerData){ // Call this to add layers from a different file!
layers[layerName] = layerData
LAYERS = Object.keys(layers);
ROW_LAYERS = {}
for (layer in layers){
row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
ROW_LAYERS[row][layer]=layer;
}
updateHotkeys()
}

View file

@ -1,6 +1,6 @@
function updateTemp() {
if (!tmp.challActive) {tmp.challActive = {}}
if (!tmp.challs) tmp.challs = {}
for (layer in layers) {
if(layers[layer].challs !== undefined){
tmp.challActive[layer] = {}
@ -8,7 +8,20 @@ function updateTemp() {
}
}
if (!tmp.upgrades) tmp.upgrades = {}
for (layer in layers) {
if(layers[layer].upgrades !== undefined){
updateUpgradeTemp(layer)
}
}
if (!tmp.milestones) tmp.milestones = {}
for (layer in layers) {
if(layers[layer].milestones !== undefined){
updateMilestoneTemp(layer)
}
}
if (!tmp.layerEffs) tmp.layerEffs = {}
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
@ -17,12 +30,8 @@ function updateTemp() {
if (!tmp.buyables) tmp.buyables = {}
for (layer in layers) if (layers[layer].buyables) {
if (!tmp.buyables[layer]) tmp.buyables[layer] = {}
for (id in player[layer].buyables){
if (!tmp.buyables[layer][id]) tmp.buyables[layer][id] = {}
tmp.buyables[layer][id]
tmp.buyables[layer][id].cost = layers[layer].buyables[id].cost(player[layer].buyables[id])
tmp.buyables[layer][id].effects = layers[layer].buyables[id].effect(player[layer].buyables[id])
if(layers[layer].buyables !== undefined){
updateBuyableTemp(layer)
}
}
@ -31,13 +40,23 @@ function updateTemp() {
if (!tmp.resetGain) tmp.resetGain = {}
if (!tmp.nextAt) tmp.nextAt = {}
if (!tmp.layerAmt) tmp.layerAmt = {}
if (!tmp.layerColor) tmp.layerColor = {}
if (!tmp.layerShown) tmp.layerShown = {}
if (!tmp.effectDescription) tmp.effectDescription = {}
if (!tmp.style) tmp.style = {}
for (layer in layers) {
if (layers[layer].color) tmp.layerColor[layer] = layers[layer].color()
if (layers[layer].style) tmp.style[layer] = layers[layer].style()
tmp.layerShown[layer] = layers[layer].layerShown()
tmp.layerAmt[layer] = layers[layer].baseAmount()
tmp.gainMults[layer] = layers[layer].gainMult()
tmp.gainExp[layer] = layers[layer].gainExp()
tmp.resetGain[layer] = getResetGain(layer)
tmp.nextAt[layer] = getNextAt(layer)
if (layers[layer].effectDescription) tmp.effectDescription[layer] = layers[layer].effectDescription()
}
tmp.pointGen = getPointGen()
@ -49,6 +68,7 @@ function updateTemp() {
function updateChallTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.challs[layer]) tmp.challs[layer] = {}
let data = tmp.challActive[layer]
let data2 = layers[layer].challs
@ -56,8 +76,72 @@ function updateChallTemp(layer) {
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
tmp.challs[layer][id] = {}
tmp.challs[layer][id].unl = data2[id].unl()
if(data2[id].name) tmp.challs[layer][id].name = data2[id].name()
if(data2[id].desc) tmp.challs[layer][id].desc = data2[id].desc()
if(data2[id].reward) tmp.challs[layer][id].reward = data2[id].reward()
if(data2[id].effect) tmp.challs[layer][id].effect = data2[id].effect()
if(data2[id].effectDisplay) tmp.challs[layer][id].effectDisplay = data2[id].effectDisplay(tmp.challs[layer][id].effect)
tmp.challs[layer][id].goal = data2[id].goal()
if (customActive ? data2.active(id) : player[layer].active == id) data[id] = 1
else delete data[id]
}
}
}
function updateUpgradeTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.upgrades[layer]) tmp.upgrades[layer] = {}
let data2 = layers[layer].upgrades
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
tmp.upgrades[layer][id] = {}
tmp.upgrades[layer][id].unl = data2[id].unl()
if(data2[id].title) tmp.upgrades[layer][id].title = data2[id].title()
if(data2[id].effect) tmp.upgrades[layer][id].effect = data2[id].effect()
if(data2[id].effectDisplay) tmp.upgrades[layer][id].effectDisplay = data2[id].effectDisplay(tmp.upgrades[layer][id].effect)
if(data2[id].desc) tmp.upgrades[layer][id].desc = data2[id].desc()
tmp.upgrades[layer][id].cost = data2[id].cost()
}
}
}
function updateMilestoneTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.milestones[layer]) tmp.milestones[layer] = {}
let data2 = layers[layer].milestones
for (id in data2) {
tmp.milestones[layer][id] = {}
tmp.milestones[layer][id].done = data2[id].done()
if(data2[id].requirementDesc) tmp.milestones[layer][id].requirementDesc = data2[id].requirementDesc()
if(data2[id].effectDesc) tmp.milestones[layer][id].effectDesc = data2[id].effectDesc()
}
}
function updateBuyableTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.buyables[layer]) tmp.buyables[layer] = {}
let data2 = layers[layer].buyables
if(data2.respecText) tmp.buyables[layer].respecText = data2.respecText()
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
let id = row * 10 + col
let amt = player[layer].buyables[id]
tmp.buyables[layer][id] = {}
tmp.buyables[layer][id].unl = data2[id].unl()
if(data2[id].effect) tmp.buyables[layer][id].effect = data2[id].effect(amt)
tmp.buyables[layer][id].cost = data2[id].cost(amt)
tmp.buyables[layer][id].canAfford = data2[id].canAfford()
if(data2[id].title) tmp.buyables[layer][id].title = data2[id].title()
if(data2[id].display) tmp.buyables[layer][id].display = data2[id].display()
}
}
}

53
js/v.js
View file

@ -16,12 +16,12 @@ function loadVue() {
v-bind:class="{
treeNode: true,
[layer]: true,
hidden: !layers[layer].layerShown(),
locked: !player[layer].unl && !tmp.layerAmt[layer].gte(tmp.layerReqs[layer]),
hidden: !tmp.layerShown[layer],
locked: player[layer].unl && !tmp.layerAmt[layer].gte(tmp.layerReqs[layer]),
can: layerUnl(layer),
}"
v-bind:style="{
'background-color': layers[layer].color,
'background-color': tmp.layerColor[layer],
}">
{{abb}}
</button>
@ -34,13 +34,13 @@ function loadVue() {
<div v-if="layers[layer].challs" class="upgTable">
<div v-for="row in layers[layer].challs.rows" class="upgRow">
<div v-for="col in layers[layer].challs.cols">
<div v-if="layers[layer].challs[row*10+col].unl()" v-bind:class="{hChall: true, done: player[layer].challs.includes(row*10+col), canComplete: tmp.challActive[layer][row*10+col]&&!player[layer].challs.includes(row*10+col)&&canCompleteChall(layer, row*10+col)}">
<br><h3>{{layers[layer].challs[row*10+col].name}}</h3><br><br>
<button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': layers[layer].color}" v-on:click="startChall(layer, row*10+col)">{{player[layer].active==(row*10+col)?(canCompleteChall(layer, row*10+col)?"Finish":"Exit Early"):(player[layer].challs.includes(row*10+col)?"Completed":"Start")}}</button><br><br>
{{layers[layer].challs[row*10+col].desc}}<br>
Goal: {{format(layers[layer].challs[row*10+col].goal)}} {{layers[layer].challs[row*10+col].currencyDisplayName ? layers[layer].challs[row*10+col].currencyDisplayName : "points"}}<br>
Reward: {{layers[layer].challs[row*10+col].reward}}<br>
<span v-if="layers[layer].challs[row*10+col].effDisp!==undefined">Currently: {{(layers[layer].challs[row*10+col].effDisp) ? (layers[layer].challs[row*10+col].effDisp(layers[layer].challs[row*10+col].effect())) : format(layers[layer].challs[row*10+col].effect())}}</span>
<div v-if="tmp.challs[layer][row*10+col].unl" v-bind:class="{hChall: true, done: player[layer].challs.includes(row*10+col), canComplete: tmp.challActive[layer][row*10+col]&&!player[layer].challs.includes(row*10+col)&&canCompleteChall(layer, row*10+col)}">
<br><h3>{{tmp.challs[layer][row*10+col].name}}</h3><br><br>
<button v-bind:class="{ longUpg: true, can: true, [layer]: true }" v-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="startChall(layer, row*10+col)">{{player[layer].active==(row*10+col)?(canCompleteChall(layer, row*10+col)?"Finish":"Exit Early"):(player[layer].challs.includes(row*10+col)?"Completed":"Start")}}</button><br><br>
{{tmp.challs[layer][row*10+col].desc}}<br>
Goal: {{format(tmp.challs[layer][row*10+col].goal)}} {{layers[layer].challs[row*10+col].currencyDisplayName ? layers[layer].challs[row*10+col].currencyDisplayName : "points"}}<br>
Reward: {{tmp.challs[layer][row*10+col].reward}}<br>
<span v-if="tmp.challs[layer][row*10+col].effect!==undefined">Currently: {{(tmp.challs[layer][row*10+col].effectDisplay) ? (tmp.challs[layer][row*10+col].effectDisplay) : format(tmp.challs[layer][row*10+col].effect)}}</span>
</div>
</div>
</div>
@ -54,7 +54,11 @@ function loadVue() {
<div v-if="layers[layer].upgrades" class="upgTable">
<div v-for="row in layers[layer].upgrades.rows" class="upgRow">
<div v-for="col in layers[layer].upgrades.cols" class="upgAlign">
<button v-if="layers[layer].upgrades[row*10+col].unl()" v-on:click="buyUpg(layer, row*10+col)" v-bind:class="{ [layer]: true, upg: true, bought: player[layer].upgrades.includes(row*10+col), locked: (!(canAffordUpg(layer, row*10+col))&&!player[layer].upgrades.includes(row*10+col)), can: (canAffordUpg(layer, row*10+col)&&!player[layer].upgrades.includes(row*10+col))}" v-bind:style="{'background-color': layers[layer].color}">{{ layers[layer].upgrades[row*10+col].desc }}<span v-if="layers[layer].upgrades[row*10+col].effect"><br>Currently: {{(layers[layer].upgrades[row*10+col].effDisp) ? (layers[layer].upgrades[row*10+col].effDisp(layers[layer].upgrades[row*10+col].effect())) : format(layers[layer].upgrades[row*10+col].effect())}}</span><br><br>Cost: {{ formatWhole(layers[layer].upgrades[row*10+col].cost) }} {{(layers[layer].upgrades[row*10+col].currencyDisplayName ? layers[layer].upgrades[row*10+col].currencyDisplayName : layers[layer].resource)}}</button>
<button v-if="tmp.upgrades[layer][row*10+col].unl" v-on:click="buyUpg(layer, row*10+col)" v-bind:class="{ [layer]: true, upg: true, bought: player[layer].upgrades.includes(row*10+col), locked: (!(canAffordUpg(layer, row*10+col))&&!player[layer].upgrades.includes(row*10+col)), can: (canAffordUpg(layer, row*10+col)&&!player[layer].upgrades.includes(row*10+col))}" v-bind:style="{'background-color': tmp.layerColor[layer]}">
<span v-if= "tmp.upgrades[layer][row*10+col].title"><h3>{{tmp.upgrades[layer][row*10+col].title}}</h3><br></span>
{{ tmp.upgrades[layer][row*10+col].desc }}
<span v-if="tmp.upgrades[layer][row*10+col].effect"><br>Currently: {{(tmp.upgrades[layer][row*10+col].effectDisplay) ? (tmp.upgrades[layer][row*10+col].effectDisplay) : format(tmp.upgrades[layer][row*10+col].effect)}}</span>
<br><br>Cost: {{ formatWhole(tmp.upgrades[layer][row*10+col].cost) }} {{(layers[layer].upgrades[row*10+col].currencyDisplayName ? layers[layer].upgrades[row*10+col].currencyDisplayName : layers[layer].resource)}}</button>
</div>
</div>
<br>
@ -68,7 +72,7 @@ function loadVue() {
<div v-if="layers[layer].milestones">
<table>
<tr v-for="id in Object.keys(layers[layer].milestones)">
<td v-if="milestoneShown(layer, id)" v-bind:class="{milestone: !player[layer].milestones.includes(id), milestoneDone: player[layer].milestones.includes(id)}"><h3>{{layers[layer].milestones[id].requirementDesc}}</h3><br>{{layers[layer].milestones[id].effectDesc}}<br><span v-if="(layers[layer].milestones[id].toggles)&&(player[layer].milestones.includes(id))" v-for="toggle in layers[layer].milestones[id].toggles"><toggle :layer= "layer" :data= "toggle"></toggle>&nbsp;</span></td></tr>
<td v-if="milestoneShown(layer, id)" v-bind:class="{milestone: !player[layer].milestones.includes(id), milestoneDone: player[layer].milestones.includes(id)}"><h3>{{tmp.milestones[layer][id].requirementDesc}}</h3><br>{{tmp.milestones[layer][id].effectDesc}}<br><span v-if="(layers[layer].milestones[id].toggles)&&(player[layer].milestones.includes(id))" v-for="toggle in layers[layer].milestones[id].toggles"><toggle :layer= "layer" :data= "toggle"></toggle>&nbsp;</span></td></tr>
</tr>
</table>
<br>
@ -79,7 +83,7 @@ function loadVue() {
Vue.component('toggle', {
props: ['layer', 'data'],
template: `
<button class="smallUpg can" v-bind:style="{'background-color': layers[data[0]].color}" v-on:click="toggleAuto(data)">{{player[data[0]][data[1]]?"ON":"OFF"}}</button>
<button class="smallUpg can" v-bind:style="{'background-color': tmp.layerColor[layer])}" v-on:click="toggleAuto(data)">{{player[data[0]][data[1]]?"ON":"OFF"}}</button>
`
})
@ -88,8 +92,8 @@ function loadVue() {
props: ['layer', 'data'],
template: `
<span>
<button v-if="layers[layer].type=='normal'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.layerReqs[layer]), can: tmp.layerAmt[layer].gte(tmp.layerReqs[layer]) }" v-bind:style="{'background-color': layers[layer].color}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(1e3)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<span v-if="tmp.resetGain[layer].lt(100) && player[layer].points.lt(1e3)"><br><br>Next at {{ (layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer])) }} {{ layers[layer].baseResource }}</span></button>
<button v-if="layers[layer].type=='static'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.nextAt[layer]), can: tmp.layerAmt[layer].gte(tmp.nextAt[layer]) }" v-bind:style="{'background-color': layers[layer].color}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(10)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<br><br><span v-if="player[layer].points.lt(10)">Req: {{formatWhole(tmp.layerAmt[layer])}} / </span>{{(layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer]))}} {{ layers[layer].baseResource }}</button>
<button v-if="layers[layer].type=='normal'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.layerReqs[layer]), can: tmp.layerAmt[layer].gte(tmp.layerReqs[layer]) }" v-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(1e3)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<span v-if="tmp.resetGain[layer].lt(100) && player[layer].points.lt(1e3)"><br><br>Next at {{ (layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer])) }} {{ layers[layer].baseResource }}</span></button>
<button v-if="layers[layer].type=='static'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.nextAt[layer]), can: tmp.layerAmt[layer].gte(tmp.nextAt[layer]) }" v-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(10)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<br><br><span v-if="player[layer].points.lt(10)">Req: {{formatWhole(tmp.layerAmt[layer])}} / </span>{{(layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer]))}} {{ layers[layer].baseResource }}</button>
</span>
`
})
@ -98,7 +102,7 @@ function loadVue() {
Vue.component('main-display', {
props: ['layer'],
template: `
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': layers[layer].color, 'text-shadow': '0px 0px 10px' + layers[layer].color}">{{formatWhole(player[layer].points)}}</h2> {{layers[layer].resource}}<span v-if="layers[layer].effectDescription">, {{layers[layer].effectDescription()}}</span><br><br></span>
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': tmp.layerColor[layer], 'text-shadow': '0px 0px 10px' + tmp.layerColor[layer]}">{{formatWhole(player[layer].points)}}</h2> {{layers[layer].resource}}<span v-if="layers[layer].effectDescription">, {{tmp.effectDescription[layer]}}</span><br><br></span>
`
})
@ -107,7 +111,7 @@ function loadVue() {
props: ['layer', 'data'],
template: `
<div v-if="layers[layer].buyables" class="upgTable">
<button v-if="layers[layer].buyables.respec" v-on:click="respecBuyables(layer)" v-bind:class="{ longUpg: true, can: player[layer].unl, locked: !player[layer].unl }">{{layers[layer].buyables.respecText ? layers[layer].buyables.respecText : "Respec"}}</button><br>
<button v-if="layers[layer].buyables.respec" v-on:click="respecBuyables(layer)" v-bind:class="{ longUpg: true, can: player[layer].unl, locked: !player[layer].unl }">{{layers[layer].buyables.respecText ? tmp.buyables[layer].respecText : "Respec"}}</button><br>
<div v-for="row in layers[layer].buyables.rows" class="upgRow">
<div v-for="col in layers[layer].buyables.cols" class="upgAlign" v-bind:style="{'margin-left': '7px', 'margin-right': '7px', 'height': (data ? data : '200px'),}">
<buyable :layer = "layer" :data = "row*10+col" :size = "data"></buyable>
@ -124,12 +128,12 @@ function loadVue() {
template: `
<div v-if="layers[layer].buyables">
<button
v-if="layers[layer].buyables[data].unl()"
v-bind:class="{ upg: true, can: layers[layer].buyables[data].canAfford(), locked: !layers[layer].buyables[data].canAfford()}"
v-bind:style="{'background-color': layers[layer].color, 'height': (size ? size : '200px'), 'width': (size ? size : '200px')}"
v-if="tmp.buyables[layer][data].unl"
v-bind:class="{ upg: true, can: tmp.buyables[layer][data].canAfford, locked: !tmp.buyables[layer][data].canAfford}"
v-bind:style="{'background-color': tmp.layerColor[layer], 'height': (size ? size : '200px'), 'width': (size ? size : '200px')}"
v-on:click="buyBuyable(layer, data)">
<span v-if= "layers[layer].buyables[data].title"><h2>{{layers[layer].buyables[data].title}}</h2><br></span>
<span v-bind:style="{'white-space': 'pre-line'}">{{layers[layer].buyables[data].display()}}</span>
<span v-if= "layers[layer].buyables[data].title"><h2>{{tmp.buyables[layer][data].title}}</h2><br></span>
<span v-bind:style="{'white-space': 'pre-line'}">{{tmp.buyables[layer][data].display}}</span>
</button>
</div>
`
@ -139,7 +143,7 @@ function loadVue() {
Vue.component('display-text', {
props: ['layer', 'data'],
template: `
<span>{{data()}}</span>
<span>{{readData(data)}}</span>
`
})
@ -147,7 +151,7 @@ function loadVue() {
Vue.component('raw-html', {
props: ['layer', 'data'],
template: `
<span v-html="data()"></span>
<span v-html="readData(data)"></span>
`
})
@ -164,7 +168,6 @@ function loadVue() {
data: {
player,
tmp,
layers,
Decimal,
format,
formatWhole,