Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/globalscripts/Templates.js
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | function GetTemplateDataHelper(template, player, auraTemplates, resources, damageTypes, modifiers={}) | ||||
if (template.Attack) | if (template.Attack) | ||||
{ | { | ||||
ret.attack = {}; | ret.attack = {}; | ||||
for (let type in template.Attack) | for (let type in template.Attack) | ||||
{ | { | ||||
let getAttackStat = function(stat) { | let getAttackStat = function(stat) { | ||||
return getEntityValue("Attack/" + type + "/" + stat); | return getEntityValue("Attack/" + type + "/" + stat); | ||||
}; | }; | ||||
if (type == "Capture") | |||||
ret.attack.Capture = { | |||||
"value": getAttackStat("Value") | |||||
}; | |||||
else | |||||
{ | |||||
ret.attack[type] = { | ret.attack[type] = { | ||||
"tooltipHeader": template.Attack[type].TooltipHeader, | |||||
"minRange": getAttackStat("MinRange"), | "minRange": getAttackStat("MinRange"), | ||||
"maxRange": getAttackStat("MaxRange"), | "maxRange": getAttackStat("MaxRange"), | ||||
"elevationBonus": getAttackStat("ElevationBonus"), | "elevationBonus": getAttackStat("ElevationBonus"), | ||||
"damage": {} | "damage": {} | ||||
}; | }; | ||||
for (let damageType of damageTypes.GetTypes()) | for (let damageType of damageTypes.GetTypes()) | ||||
ret.attack[type].damage[damageType] = getAttackStat("Damage/" + damageType); | ret.attack[type].damage[damageType] = getAttackStat("Damage/" + damageType); | ||||
ret.attack[type].elevationAdaptedRange = Math.sqrt(ret.attack[type].maxRange * | ret.attack[type].elevationAdaptedRange = Math.sqrt(ret.attack[type].maxRange * | ||||
(2 * ret.attack[type].elevationBonus + ret.attack[type].maxRange)); | (2 * ret.attack[type].elevationBonus + ret.attack[type].maxRange)); | ||||
} | |||||
ret.attack[type].repeatTime = getAttackStat("RepeatTime"); | ret.attack[type].repeatTime = getAttackStat("RepeatTime"); | ||||
if (template.Attack[type].Splash) | if (template.Attack[type].Splash) | ||||
{ | { | ||||
ret.attack[type].splash = { | ret.attack[type].splash = { | ||||
// true if undefined | // true if undefined | ||||
"friendlyFire": template.Attack[type].Splash.FriendlyFire != "false", | "friendlyFire": template.Attack[type].Splash.FriendlyFire != "false", | ||||
"shape": template.Attack[type].Splash.Shape, | "shape": template.Attack[type].Splash.Shape, | ||||
▲ Show 20 Lines • Show All 338 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator