Differential D2808 Diff 13313 binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Property | Old Value | New Value |
---|---|---|
svn:executable | * \ No newline at end of property | null |
Show All 27 Lines | |||||
* @param {number} attackerOwner - The player ID of the attacker. | * @param {number} attackerOwner - The player ID of the attacker. | ||||
* @param {number} bonusMultiplier - A value to multiply the damage with (not implemented yet for SE). | * @param {number} bonusMultiplier - A value to multiply the damage with (not implemented yet for SE). | ||||
* | * | ||||
* @return {Object} - The names of the status effects which were processed. | * @return {Object} - The names of the status effects which were processed. | ||||
*/ | */ | ||||
StatusEffectsReceiver.prototype.ApplyStatus = function(effectData, attacker, attackerOwner) | StatusEffectsReceiver.prototype.ApplyStatus = function(effectData, attacker, attackerOwner) | ||||
{ | { | ||||
let attackerData = { "entity": attacker, "owner": attackerOwner }; | let attackerData = { "entity": attacker, "owner": attackerOwner }; | ||||
for (let effect in effectData) | for (let effect in effectData) | ||||
Stan: Typo StatusEffectsReceiver here and below | |||||
this.AddStatus(effect, effectData[effect], attackerData); | this.AddStatus(effect, effectData[effect], attackerData); | ||||
// TODO: implement loot / resistance. | // TODO: implement loot / resistance. | ||||
Done Inline Actions-resistance Freagarach: -`resistance` | |||||
return { "inflictedStatuses": Object.keys(effectData) }; | return { "inflictedStatuses": Object.keys(effectData) }; | ||||
}; | }; | ||||
/** | /** | ||||
* Adds a status effect to the entity. | * Adds a status effect to the entity. | ||||
* | * | ||||
* @param {string} statusName - The name of the status effect. | * @param {string} statusName - The name of the status effect. | ||||
Done Inline Actionsname -> code Freagarach: `name` -> `code` | |||||
* @param {Object} data - The various effects and timings. | * @param {Object} data - The various effects and timings. | ||||
* @param {Object} attackerData - The attacker and attackerOwner. | * @param {Object} attackerData - The attacker and attackerOwner. | ||||
*/ | */ | ||||
StatusEffectsReceiver.prototype.AddStatus = function(statusName, data, attackerData) | StatusEffectsReceiver.prototype.AddStatus = function(statusName, data, attackerData) | ||||
{ | { | ||||
if (this.activeStatusEffects[statusName]) | if (this.activeStatusEffects[statusName]) | ||||
{ | { | ||||
if (data.Stackability == "Ignore") | if (data.Stackability == "Ignore") | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if (statusEffect._timer) | ||||
cmpTimer.CancelTimer(statusEffect._timer); | cmpTimer.CancelTimer(statusEffect._timer); | ||||
} | } | ||||
delete this.activeStatusEffects[statusName]; | delete this.activeStatusEffects[statusName]; | ||||
}; | }; | ||||
/** | /** | ||||
* Called by the timers. Executes a status effect. | * Called by the timers. Executes a status effect. | ||||
* | * | ||||
* @param {string} statusName - The name of the status effect to be executed. | * @param {string} statusName - The name of the status effect to be executed. | ||||
Done Inline Actionsname -> code Freagarach: `name` -> `code` | |||||
* @param {number} lateness - The delay between the calling of the function and the actual execution (turn time?). | * @param {number} lateness - The delay between the calling of the function and the actual execution (turn time?). | ||||
*/ | */ | ||||
StatusEffectsReceiver.prototype.ExecuteEffect = function(statusName, lateness) | StatusEffectsReceiver.prototype.ExecuteEffect = function(statusName, lateness) | ||||
{ | { | ||||
let status = this.activeStatusEffects[statusName]; | let status = this.activeStatusEffects[statusName]; | ||||
if (!status) | if (!status) | ||||
return; | return; | ||||
if (status.Damage || status.Capture) | if (status.Damage || status.Capture) | ||||
Attacking.HandleAttackEffects(statusName, status, this.entity, status.source.entity, status.source.owner); | Attacking.HandleAttackEffects(this.entity, statusName, status, status.source.entity, status.source.owner); | ||||
if (!status.Duration) | if (!status.Duration) | ||||
return; | return; | ||||
if (status._firstTime) | if (status._firstTime) | ||||
{ | { | ||||
status._firstTime = false; | status._firstTime = false; | ||||
status._timeElapsed += lateness; | status._timeElapsed += lateness; | ||||
Show All 9 Lines |
Wildfire Games · Phabricator
Typo StatusEffectsReceiver here and below