Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/DeathDamage.js
Show All 26 Lines | "<a:example>" + | ||||
"<Hack>0.0</Hack>" + | "<Hack>0.0</Hack>" + | ||||
"<Pierce>10.0</Pierce>" + | "<Pierce>10.0</Pierce>" + | ||||
"<Crush>50.0</Crush>" + | "<Crush>50.0</Crush>" + | ||||
"</a:example>" + | "</a:example>" + | ||||
"<element name='Shape' a:help='Shape of the splash damage, can be circular'><text/></element>" + | "<element name='Shape' a:help='Shape of the splash damage, can be circular'><text/></element>" + | ||||
"<element name='Range' a:help='Size of the area affected by the splash'><ref name='nonNegativeDecimal'/></element>" + | "<element name='Range' a:help='Size of the area affected by the splash'><ref name='nonNegativeDecimal'/></element>" + | ||||
"<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units'><data type='boolean'/></element>" + | "<element name='FriendlyFire' a:help='Whether the splash damage can hurt non enemy units'><data type='boolean'/></element>" + | ||||
"<element name='Damage'>" + | "<element name='Damage'>" + | ||||
DamageTypes.BuildSchema("damage strength") + | BuildDamageTypesSchema("damage strength") + | ||||
"</element>" + | "</element>" + | ||||
DeathDamage.prototype.bonusesSchema; | DeathDamage.prototype.bonusesSchema; | ||||
DeathDamage.prototype.Init = function() | DeathDamage.prototype.Init = function() | ||||
{ | { | ||||
}; | }; | ||||
DeathDamage.prototype.Serialize = null; // we have no dynamic state to save | DeathDamage.prototype.Serialize = null; // we have no dynamic state to save | ||||
DeathDamage.prototype.GetDeathDamageStrengths = function() | DeathDamage.prototype.GetDeathDamageStrengths = function() | ||||
{ | { | ||||
// Work out the damage values with technology effects | // Work out the damage values with technology effects | ||||
let applyMods = damageType => | let applyMods = damageType => | ||||
ApplyValueModificationsToEntity("DeathDamage/Damage/" + damageType, +(this.template.Damage[damageType] || 0), this.entity); | ApplyValueModificationsToEntity("DeathDamage/Damage/" + damageType, +(this.template.Damage[damageType] || 0), this.entity); | ||||
let ret = {}; | let ret = {}; | ||||
for (let damageType of DamageTypes.GetTypes()) | for (let damageType in this.template.Damage) | ||||
ret[damageType] = applyMods(damageType); | ret[damageType] = applyMods(damageType); | ||||
return ret; | return ret; | ||||
}; | }; | ||||
DeathDamage.prototype.GetBonusTemplate = function() | DeathDamage.prototype.GetBonusTemplate = function() | ||||
{ | { | ||||
return this.template.Bonuses || null; | return this.template.Bonuses || null; | ||||
Show All 33 Lines |
Wildfire Games · Phabricator