Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Attacking.js
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | Attacking.prototype.GetStatusEffectsModifications = function(valueModifRoot, template, entity, effect) | ||||
return modifiers; | return modifiers; | ||||
}; | }; | ||||
/** | /** | ||||
* Calculate the total effect taking bonus and resistance into account. | * Calculate the total effect taking bonus and resistance into account. | ||||
* | * | ||||
* @param {number} target - The target of the attack. | * @param {number} target - The target of the attack. | ||||
* @param {Object} effectData - The effects calculate the effect for. | * @param {Object} effectData - The effects calculate the effect for. | ||||
* @param {string} effectType - The type of effect to apply (e.g. Damage, Capture or StatusEffect). | * @param {string} effectType - The type of effect to apply (e.g. Damage, Capture or ApplyStatus). | ||||
* @param {number} bonusMultiplier - The factor to multiply the total effect with. | * @param {number} bonusMultiplier - The factor to multiply the total effect with. | ||||
* @param {Object} cmpResistance - Optionally the resistance component of the target. | * @param {Object} cmpResistance - Optionally the resistance component of the target. | ||||
* | * | ||||
* @return {number} - The total value of the effect. | * @return {number} - The total value of the effect. | ||||
*/ | */ | ||||
Attacking.prototype.GetTotalAttackEffects = function(target, effectData, effectType, bonusMultiplier, cmpResistance) | Attacking.prototype.GetTotalAttackEffects = function(target, effectData, effectType, bonusMultiplier, cmpResistance) | ||||
{ | { | ||||
let total = 0; | let total = 0; | ||||
Show All 9 Lines | Attacking.prototype.GetTotalAttackEffects = function(target, effectData, effectType, bonusMultiplier, cmpResistance) | ||||
{ | { | ||||
total = effectData.Capture * Math.pow(0.9, resistanceStrengths.Capture || 0); | total = effectData.Capture * Math.pow(0.9, resistanceStrengths.Capture || 0); | ||||
// If Health is lower we are more susceptible to capture attacks. | // If Health is lower we are more susceptible to capture attacks. | ||||
let cmpHealth = Engine.QueryInterface(target, IID_Health); | let cmpHealth = Engine.QueryInterface(target, IID_Health); | ||||
if (cmpHealth) | if (cmpHealth) | ||||
total /= 0.1 + 0.9 * cmpHealth.GetHitpoints() / cmpHealth.GetMaxHitpoints(); | total /= 0.1 + 0.9 * cmpHealth.GetHitpoints() / cmpHealth.GetMaxHitpoints(); | ||||
} | } | ||||
else if (effectType == "StatusEffect") | else if (effectType == "ApplyStatus") | ||||
return effectData[effectType]; | return effectData[effectType]; | ||||
return total * bonusMultiplier; | return total * bonusMultiplier; | ||||
}; | }; | ||||
/** | /** | ||||
* Gives the position of the given entity, taking the lateness into account. | * Gives the position of the given entity, taking the lateness into account. | ||||
* @param {number} ent - Entity id of the entity we are finding the location for. | * @param {number} ent - Entity id of the entity we are finding the location for. | ||||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator