From 690bc5a64ae7a8394c531f84f8c4b717fde57071 Mon Sep 17 00:00:00 2001 From: felixlinker Date: Fri, 20 Jul 2018 17:54:07 +0200 Subject: [PATCH] Resistance special effects now applied correctly --- src/app/shipyard/Module.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index 888d8e27..a213b388 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -47,7 +47,16 @@ export default class Module { if (modifierActions && modifierActions[name]) { // this special effect modifies our returned value const modification = Modifications.modifications[name]; - if (modification.method === 'additive') { + const multiplier = modification.type === 'percentage' ? 10000 : 100; + if (name === 'explres' || name === 'kinres' || name === 'thermres') { + // Resistance modifications in itself are additive, however their + // special effects are multiplicative. They affect the overall result + // by (special effect resistance) * (damage mult after modification), + // i. e. we need to apply the special effect as a multiplier to the + // overall result and then calculate the difference. + let baseMult = this[name] ? 1 - this[name] : 1; + result = (baseMult - (baseMult - result / multiplier) * (1 - modifierActions[name] / 100)) * multiplier; + } else if (modification.method === 'additive') { result = result + modifierActions[name] * 100; } else if (modification.method === 'overwrite') { result = modifierActions[name]; @@ -59,7 +68,6 @@ export default class Module { } else { mod = modifierActions[name]; } - const multiplier = modification.type === 'percentage' ? 10000 : 100; result = (((1 + result / multiplier) * (1 + mod)) - 1) * multiplier; } }