Differential D2296 Diff 12233 ps/trunk/binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Show All 40 Lines | StatusEffectsReceiver.prototype.ApplyStatus = function(effectData, attacker, attackerOwner, bonusMultiplier) | ||||
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. | ||||
* @param {object} data - The various effects and timings. | * @param {object} data - The various effects and timings. | ||||
* @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]) | ||||
{ | { | ||||
// TODO: implement different behaviour when receiving the same status multiple times. | if (data.Stackability == "Ignore") | ||||
// For now, these are ignored. | |||||
return; | return; | ||||
if (data.Stackability == "Extend") | |||||
{ | |||||
this.activeStatusEffects[statusName].Duration += data.Duration; | |||||
return; | |||||
} | |||||
if (data.Stackability == "Replace") | |||||
this.RemoveStatus(statusName); | |||||
else if (data.Stackability == "Stack") | |||||
{ | |||||
let i = 0; | |||||
let temp; | |||||
do | |||||
temp = statusName + "_" + i++; | |||||
while (!!this.activeStatusEffects[temp]); | |||||
statusName = temp; | |||||
} | |||||
} | } | ||||
this.activeStatusEffects[statusName] = {}; | this.activeStatusEffects[statusName] = {}; | ||||
let status = this.activeStatusEffects[statusName]; | let status = this.activeStatusEffects[statusName]; | ||||
Object.assign(status, data); | Object.assign(status, data); | ||||
if (status.Modifiers) | if (status.Modifiers) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator