Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/entity.js
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | m.Template = m.Class({ | ||||
"getPopulationBonus": function() { return +this.get("Cost/PopulationBonus"); }, | "getPopulationBonus": function() { return +this.get("Cost/PopulationBonus"); }, | ||||
"armourStrengths": function() { | "armourStrengths": function() { | ||||
let armourDamageTypes = this.get("Armour"); | let armourDamageTypes = this.get("Armour"); | ||||
if (!armourDamageTypes) | if (!armourDamageTypes) | ||||
return undefined; | return undefined; | ||||
let armour = {}; | let armour = {}; | ||||
for (let damageType in armourDamageTypes) | let effectTypes = ["Damage", "Capture"]; | ||||
if (damageType != "Foundation") | for (let effectType of effectTypes) | ||||
armour[damageType] = +armourDamageTypes[damageType]; | for (let resistanceType in armourDamageTypes) | ||||
bb: Can't we query g_EffectType here? | |||||
{ | |||||
let template = armourDamageTypes[resistanceType][effectType]; | |||||
if (template) | |||||
{ | |||||
Done Inline Actionsif(!template) Stan: if(!template)
continue ? | |||||
if (effectType == "Capture") | |||||
{ | |||||
if (!armour.Capture) | |||||
armour.Capture = 0; | |||||
armour.Capture += +this.get("Armour/" + resistanceType + "/Capture"); | |||||
} | |||||
else if (effectType == "Damage") | |||||
{ | |||||
if (!armour.Damage) | |||||
armour.Damage = {}; | |||||
for (let damageType in template) | |||||
{ | |||||
if (!armour.Damage[damageType]) | |||||
armour.Damage[damageType] = 0; | |||||
armour.Damage[damageType] += +this.get("Armour/" + resistanceType + "/Damage/" + damageType); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
return armour; | return armour; | ||||
}, | }, | ||||
"attackTypes": function() { | "attackTypes": function() { | ||||
if (!this.get("Attack")) | if (!this.get("Attack")) | ||||
return undefined; | return undefined; | ||||
▲ Show 20 Lines • Show All 732 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Can't we query g_EffectType here?