Differential D368 Diff 18582 binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/StatusEffectsReceiver.js
Show All 15 Lines | |||||
* @return {Object} - An object containing the status effects which currently affect the entity. | * @return {Object} - An object containing the status effects which currently affect the entity. | ||||
*/ | */ | ||||
StatusEffectsReceiver.prototype.GetActiveStatuses = function() | StatusEffectsReceiver.prototype.GetActiveStatuses = function() | ||||
{ | { | ||||
return this.activeStatusEffects; | return this.activeStatusEffects; | ||||
}; | }; | ||||
/** | /** | ||||
* Quantify how much the effect does, relative to the maximum amount. | |||||
* For now just check if there is some effect. TODO: Improve this. | |||||
*/ | |||||
StatusEffectsReceiver.prototype.GetRelativeStatusEffect = function(effectData, effectType, bonusMultiplier, attackerOwner) | |||||
{ | |||||
// return canTakeEffect ? | |||||
// AttackHelper.GetTotalAttackEffects( | |||||
// this.entity, | |||||
// effectData, | |||||
// effectType, | |||||
// bonusMultiplier, | |||||
// QueryMiragedInterface(this.entity, IID_Resistance) | |||||
// ) / this.max : | |||||
// 0; | |||||
return effectData[effectType] ? 1 : 0; | |||||
}; | |||||
/** | |||||
* Called by Attacking effects. Adds status effects for each entry in the effectData. | * Called by Attacking effects. Adds status effects for each entry in the effectData. | ||||
* | * | ||||
* @param {Object} effectData - An object containing the status effects to give to the entity. | * @param {Object} effectData - An object containing the status effects to give to the entity. | ||||
* @param {number} attacker - The entity ID of the attacker. | * @param {number} attacker - The entity ID of the attacker. | ||||
* @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 codes of the status effects which were processed. | * @return {Object} - The codes of the status effects which were processed. | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | StatusEffectsReceiver.prototype.ExecuteEffect = function(statusCode, lateness) | ||||
} | } | ||||
else | else | ||||
status._timeElapsed += +(status.Interval || status._interval) + lateness; | status._timeElapsed += +(status.Interval || status._interval) + lateness; | ||||
if (status._timeElapsed >= +status.Duration) | if (status._timeElapsed >= +status.Duration) | ||||
this.RemoveStatus(statusCode); | this.RemoveStatus(statusCode); | ||||
}; | }; | ||||
function StatusEffectsReceiverMirage() {} | |||||
StatusEffectsReceiverMirage.prototype.Init = function(cmpStatusEffectsReceiver) | |||||
{ | |||||
}; | |||||
StatusEffectsReceiverMirage.prototype.GetRelativeStatusEffect = StatusEffectsReceiver.prototype.GetRelativeStatusEffect; | |||||
Engine.RegisterGlobal("StatusEffectsReceiverMirage", StatusEffectsReceiverMirage); | |||||
StatusEffectsReceiver.prototype.Mirage = function() | |||||
{ | |||||
const mirage = new StatusEffectsReceiverMirage(); | |||||
mirage.Init(this); | |||||
return mirage; | |||||
}; | |||||
Engine.RegisterComponentType(IID_StatusEffectsReceiver, "StatusEffectsReceiver", StatusEffectsReceiver); | Engine.RegisterComponentType(IID_StatusEffectsReceiver, "StatusEffectsReceiver", StatusEffectsReceiver); |
Wildfire Games · Phabricator