Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/globalscripts/Templates.js
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | function GetTemplateDataHelper(template, player, auraTemplates, modifiers = {}) | ||||
// @param {string} value_path - Route to the value within the template. | // @param {string} value_path - Route to the value within the template. | ||||
// @param {string} mod_key - Modification key, if not the same as the value_path. | // @param {string} mod_key - Modification key, if not the same as the value_path. | ||||
let getEntityValue = function(value_path, mod_key) { | let getEntityValue = function(value_path, mod_key) { | ||||
return GetModifiedTemplateDataValue(template, value_path, mod_key, player, modifiers); | return GetModifiedTemplateDataValue(template, value_path, mod_key, player, modifiers); | ||||
}; | }; | ||||
let ret = {}; | let ret = {}; | ||||
if (template.Armour) | if (template.Resistance) | ||||
{ | { | ||||
ret.armour = {}; | ret.resistance = {}; | ||||
for (let damageType in template.Armour) | for (let resistanceType in template.Resistance) | ||||
if (damageType != "Foundation") | { | ||||
ret.armour[damageType] = getEntityValue("Armour/" + damageType); | if (resistanceType == "Foundation") | ||||
Stan: filter ? | |||||
continue; | |||||
if (template.Resistance[resistanceType].Damage) | |||||
{ | |||||
if (!ret.resistance.Damage) | |||||
ret.resistance.Damage = {}; | |||||
for (let damageType in template.Resistance[resistanceType].Damage) | |||||
{ | |||||
if (!ret.resistance.Damage[damageType]) | |||||
ret.resistance.Damage[damageType] = 0; | |||||
ret.resistance.Damage[damageType] += getEntityValue("Resistance/" + resistanceType + "/Damage/" + damageType); | |||||
} | |||||
} | |||||
if (template.Resistance[resistanceType].Capture) | |||||
{ | |||||
if (!ret.resistance.Capture) | |||||
ret.resistance.Capture = 0; | |||||
ret.resistance.Capture += getEntityValue("Resistance/" + resistanceType + "/Capture"); | |||||
} | |||||
} | |||||
} | } | ||||
let getAttackEffects = (temp, path) => { | let getAttackEffects = (temp, path) => { | ||||
let effects = {}; | let effects = {}; | ||||
if (temp.Capture) | if (temp.Capture) | ||||
effects.Capture = getEntityValue(path + "/Capture"); | effects.Capture = getEntityValue(path + "/Capture"); | ||||
if (temp.Damage) | if (temp.Damage) | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
filter ?