Differential D2092 Diff 9179 binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
function StatusEffectsReceiver() {} | function StatusEffectsReceiver() {} | ||||
StatusEffectsReceiver.prototype.Init = function() | StatusEffectsReceiver.prototype.Init = function() | ||||
{ | { | ||||
this.activeStatusEffects = {}; | this.activeStatusEffects = {}; | ||||
}; | }; | ||||
StatusEffectsReceiver.prototype.HandleAttackEffects = function(effectData, attacker, attackerOwner, bonusMultiplier) | |||||
{ | |||||
this.InflictEffects(effectData); | |||||
// TODO: implement loot / resistance. | |||||
return { "inflictedEffects": Object.keys(effectData) }; | |||||
}; | |||||
StatusEffectsReceiver.prototype.InflictEffects = function(statusEffects) | StatusEffectsReceiver.prototype.InflictEffects = function(statusEffects) | ||||
{ | { | ||||
for (let effect in statusEffects) | for (let effect in statusEffects) | ||||
this.InflictEffect(effect, statusEffects[effect]); | this.InflictEffect(effect, statusEffects[effect]); | ||||
}; | }; | ||||
StatusEffectsReceiver.prototype.InflictEffect = function(statusName, data) | StatusEffectsReceiver.prototype.InflictEffect = function(statusName, data) | ||||
{ | { | ||||
Show All 31 Lines | StatusEffectsReceiver.prototype.ExecuteEffect = function(statusName, lateness) | ||||
{ | { | ||||
status.firstTime = false; | status.firstTime = false; | ||||
status.timeElapsed += lateness; | status.timeElapsed += lateness; | ||||
} | } | ||||
else | else | ||||
status.timeElapsed += status.interval + lateness; | status.timeElapsed += status.interval + lateness; | ||||
let cmpDamage = Engine.QueryInterface(SYSTEM_ENTITY, IID_Damage); | let cmpDamage = Engine.QueryInterface(SYSTEM_ENTITY, IID_Damage); | ||||
cmpDamage.HandleAttackEffects(statusName, { "Damage": { [statusName]: status.damage } }, this.entity, -1, -1); | |||||
cmpDamage.CauseDamage({ | |||||
"strengths": { [statusName]: status.damage }, | |||||
"target": this.entity, | |||||
"attacker": -1, | |||||
"multiplier": 1, | |||||
"type": statusName, | |||||
"attackerOwner": -1 | |||||
Freagarach: Why does it have no owner? If I was poisoned by someone and I die, that person should have it… | |||||
Done Inline ActionsThe implementation doesn't keep track of the poisoning entity, so no owner. We could, but it's for another diff imo. wraitii: The implementation doesn't keep track of the poisoning entity, so no owner. We //could//, but… | |||||
}); | |||||
if (status.timeElapsed >= status.duration) | if (status.timeElapsed >= status.duration) | ||||
this.RemoveEffect(statusName); | this.RemoveEffect(statusName); | ||||
}; | }; | ||||
Engine.RegisterComponentType(IID_StatusEffectsReceiver, "StatusEffectsReceiver", StatusEffectsReceiver); | Engine.RegisterComponentType(IID_StatusEffectsReceiver, "StatusEffectsReceiver", StatusEffectsReceiver); |
Wildfire Games · Phabricator
Why does it have no owner? If I was poisoned by someone and I die, that person should have it on his/hers record right?