2020-08-21 19:02:34 +00:00
|
|
|
function updateTemp() {
|
2020-09-24 15:54:41 +00:00
|
|
|
|
|
|
|
if (!tmp.challActive) {tmp.challActive = {}}
|
|
|
|
for (layer in layers) {
|
|
|
|
if(layers[layer].challs !== undefined){
|
|
|
|
tmp.challActive[layer] = {}
|
|
|
|
updateChallTemp(layer)
|
2020-09-01 00:39:33 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-24 15:54:41 +00:00
|
|
|
|
2020-09-01 00:39:33 +00:00
|
|
|
|
2020-08-21 19:02:34 +00:00
|
|
|
if (!tmp.layerEffs) tmp.layerEffs = {}
|
2020-09-24 22:42:52 +00:00
|
|
|
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
|
2020-09-12 14:26:57 +00:00
|
|
|
|
2020-08-21 19:02:34 +00:00
|
|
|
if (!tmp.layerReqs) tmp.layerReqs = {}
|
2020-09-24 15:54:41 +00:00
|
|
|
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
|
2020-09-12 14:26:57 +00:00
|
|
|
|
2020-10-01 00:25:14 +00:00
|
|
|
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])
|
2020-10-01 05:30:59 +00:00
|
|
|
tmp.buyables[layer][id].effects = layers[layer].buyables[id].effect(player[layer].buyables[id])
|
2020-10-01 00:25:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-21 19:02:34 +00:00
|
|
|
if (!tmp.gainMults) tmp.gainMults = {}
|
2020-09-13 02:38:32 +00:00
|
|
|
if (!tmp.gainExp) tmp.gainExp = {}
|
2020-08-21 19:02:34 +00:00
|
|
|
if (!tmp.resetGain) tmp.resetGain = {}
|
|
|
|
if (!tmp.nextAt) tmp.nextAt = {}
|
2020-08-22 01:16:23 +00:00
|
|
|
if (!tmp.layerAmt) tmp.layerAmt = {}
|
2020-10-01 00:25:14 +00:00
|
|
|
|
2020-09-24 15:54:41 +00:00
|
|
|
for (layer in layers) {
|
|
|
|
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)
|
2020-08-21 19:02:34 +00:00
|
|
|
}
|
2020-09-10 02:44:25 +00:00
|
|
|
|
2020-08-21 19:02:34 +00:00
|
|
|
tmp.pointGen = getPointGen()
|
2020-09-10 02:44:25 +00:00
|
|
|
|
2020-09-24 15:54:41 +00:00
|
|
|
for (layer in layers){
|
|
|
|
if (layers[layer].updateTemp) layers[layer].updateTemp()
|
2020-09-14 02:41:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateChallTemp(layer) {
|
|
|
|
if (player[layer] === undefined) return
|
|
|
|
|
|
|
|
let data = tmp.challActive[layer]
|
2020-09-24 15:54:41 +00:00
|
|
|
let data2 = layers[layer].challs
|
2020-09-14 02:41:42 +00:00
|
|
|
let customActive = data2.active !== undefined
|
|
|
|
for (let row = 1; row <= data2.rows; row++) {
|
|
|
|
for (let col = 1; col <= data2.cols; col++) {
|
|
|
|
let id = row * 10 + col
|
|
|
|
if (customActive ? data2.active(id) : player[layer].active == id) data[id] = 1
|
|
|
|
else delete data[id]
|
|
|
|
}
|
2020-09-13 02:38:32 +00:00
|
|
|
}
|
2020-08-21 19:02:34 +00:00
|
|
|
}
|