mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-28 02:51:55 +00:00
51 lines
No EOL
1.4 KiB
JavaScript
51 lines
No EOL
1.4 KiB
JavaScript
function updateTemp() {
|
|
|
|
if (!tmp.challActive) {tmp.challActive = {}}
|
|
for (layer in layers) {
|
|
if(layers[layer].challs !== undefined){
|
|
tmp.challActive[layer] = {}
|
|
updateChallTemp(layer)
|
|
}
|
|
}
|
|
|
|
|
|
if (!tmp.layerEffs) tmp.layerEffs = {}
|
|
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
|
|
|
|
if (!tmp.layerReqs) tmp.layerReqs = {}
|
|
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
|
|
|
|
if (!tmp.gainMults) tmp.gainMults = {}
|
|
if (!tmp.gainExp) tmp.gainExp = {}
|
|
if (!tmp.resetGain) tmp.resetGain = {}
|
|
if (!tmp.nextAt) tmp.nextAt = {}
|
|
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)
|
|
}
|
|
|
|
tmp.pointGen = getPointGen()
|
|
|
|
for (layer in layers){
|
|
if (layers[layer].updateTemp) layers[layer].updateTemp()
|
|
}
|
|
}
|
|
|
|
function updateChallTemp(layer) {
|
|
if (player[layer] === undefined) return
|
|
|
|
let data = tmp.challActive[layer]
|
|
let data2 = layers[layer].challs
|
|
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]
|
|
}
|
|
}
|
|
} |