Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Capturable.js
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | Capturable.prototype.Capture = function(effectData, attacker, attackerOwner, bonusMultiplier) | ||||
let cmpHealth = Engine.QueryInterface(this.entity, IID_Health); | let cmpHealth = Engine.QueryInterface(this.entity, IID_Health); | ||||
if (attackerOwner == INVALID_PLAYER || !this.CanCapture(attackerOwner) || | if (attackerOwner == INVALID_PLAYER || !this.CanCapture(attackerOwner) || | ||||
!cmpHealth || cmpHealth.GetHitpoints() == 0) | !cmpHealth || cmpHealth.GetHitpoints() == 0) | ||||
return {}; | return {}; | ||||
bonusMultiplier *= cmpHealth.GetMaxHitpoints() / (0.1 * cmpHealth.GetMaxHitpoints() + 0.9 * cmpHealth.GetHitpoints()); | bonusMultiplier *= cmpHealth.GetMaxHitpoints() / (0.1 * cmpHealth.GetMaxHitpoints() + 0.9 * cmpHealth.GetHitpoints()); | ||||
let total = Attacking.GetTotalAttackEffects({ "Capture": effectData }, "Capture") * bonusMultiplier; | let total = Attacking.GetTotalAttackEffects({ "Capture": effectData }, "Capture", this.entity) * bonusMultiplier; | ||||
let change = this.Reduce(total, attackerOwner); | let change = this.Reduce(total, attackerOwner); | ||||
Stan: inline ? Maybe the whole function. Wonder if we have to return an object | |||||
Done Inline ActionsYes, we need the object (see the message sent in cmpResistance). Freagarach: Yes, we need the object (see the message sent in `cmpResistance`). | |||||
// TODO: implement loot | // TODO: implement loot | ||||
return { "captureChange": change }; | return { "captureChange": change }; | ||||
}; | }; | ||||
/** | /** | ||||
* Reduces the amount of capture points of an entity, | * Reduces the amount of capture points of an entity, | ||||
* in favour of the player of the source | * in favour of the player of the source | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
inline ? Maybe the whole function. Wonder if we have to return an object