Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Health.js
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | |||||
Health.prototype.Kill = function() | Health.prototype.Kill = function() | ||||
{ | { | ||||
this.Reduce(this.hitpoints); | this.Reduce(this.hitpoints); | ||||
}; | }; | ||||
/** | /** | ||||
* Take damage according to the entity's resistance. | * Take damage according to the entity's resistance. | ||||
* @param {Object} strengths - { "hack": number, "pierce": number, "crush": number } or something like that. | * @param {Object} effectData - { "hack": number, "pierce": number, "crush": number } or something like that. | ||||
* @param {Object} attackerData - Data concerning the attacker of the form: { "entity" number, "owner": number }. | |||||
* @param {number} bonusMultiplier - the damage multiplier. | * @param {number} bonusMultiplier - the damage multiplier. | ||||
* Returns object of the form { "killed": false, "change": -12 }. | * Returns object of the form { "killed": false, "change": -12 }. | ||||
*/ | */ | ||||
Health.prototype.TakeDamage = function(effectData, attacker, attackerOwner, bonusMultiplier) | Health.prototype.TakeDamage = function(effectData, attackerData, bonusMultiplier) | ||||
{ | { | ||||
let cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance); | let cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance); | ||||
if (cmpResistance && cmpResistance.IsInvulnerable()) | if (cmpResistance && cmpResistance.IsInvulnerable()) | ||||
return { "killed": false }; | return { "killed": false }; | ||||
let total = Attacking.GetTotalAttackEffects(effectData, "Damage", cmpResistance) * bonusMultiplier; | let total = Attacking.GetTotalAttackEffects(effectData, "Damage", cmpResistance) * bonusMultiplier; | ||||
▲ Show 20 Lines • Show All 262 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator