From 32fb66139a42e314e98bf795aedb32617a98c656 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Wed, 22 Mar 2017 09:20:51 +0000 Subject: [PATCH] Take base hull reinforcement resistances in to account when calculating modifiers --- ChangeLog.md | 1 + src/app/utils/CompanionApiUtils.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index eff8db7f..c03a9d5b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,6 +8,7 @@ * Show integrity value for relevant modules * Reset old modification values when a new roll is applied * Ensure that boost value is set correctly when modifications to power distributor enable/disable boost + * Ensure that hull reinforcement modifications take the inherent resistance in to account when calculating modification percentages #2.2.19 * Power management panel now displays modules in descending order of power usage by default diff --git a/src/app/utils/CompanionApiUtils.js b/src/app/utils/CompanionApiUtils.js index 461886cb..6c6a2272 100644 --- a/src/app/utils/CompanionApiUtils.js +++ b/src/app/utils/CompanionApiUtils.js @@ -384,15 +384,16 @@ function _addModifications(module, modifiers, blueprint, grade) { } // Hull reinforcement package resistance is actually a damage modifier, so needs to be inverted. + // In addition, the modification is based off the inherent resistance of the module if (module.grp === 'hr') { if (module.getModValue('explres')) { - module.setModValue('explres', ((module.getModValue('explres') / 10000) * -1) * 10000); + module.setModValue('explres', ((1 - (1 - module.explres) * (1 + module.getModValue('explres') / 10000)) - module.explres) * 10000); } if (module.getModValue('kinres')) { - module.setModValue('kinres', ((module.getModValue('kinres') / 10000) * -1) * 10000); + module.setModValue('kinres', ((1 - (1 - module.kinres) * (1 + module.getModValue('kinres') / 10000)) - module.kinres) * 10000); } if (module.getModValue('thermres')) { - module.setModValue('thermres', ((module.getModValue('thermres') / 10000) * -1) * 10000); + module.setModValue('thermres', ((1 - (1 - module.thermres) * (1 + module.getModValue('thermres') / 10000)) - module.thermres) * 10000); } }