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