1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-28 02:51:55 +00:00
The-Modding-Tree/js/temp.js

51 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-08-21 19:02:34 +00:00
function updateTemp() {
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-01 00:39:33 +00:00
2020-08-21 19:02:34 +00:00
if (!tmp.layerEffs) tmp.layerEffs = {}
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
2020-08-21 19:02:34 +00:00
if (!tmp.layerReqs) tmp.layerReqs = {}
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
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 = {}
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
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]
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
}