From 5b81a0b25f5a4ed1e8cc9aebb88c3bb9808b34b2 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Thu, 10 Nov 2016 15:18:05 +0000 Subject: [PATCH] Fix modification value for additive modifications --- src/app/shipyard/Module.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index a7f152de..dbc3488e 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -59,22 +59,20 @@ export default class Module { * @return {Number} the mass of this module */ _getModifiedValue(name, additive) { - let result = 0; - if (this[name]) { - result = this[name]; - if (result) { - const modValue = this.getModValue(name); - if (modValue) { - if (additive) { - result = result + modValue; - } else { - result = result * (1 + modValue); - } + let result = this[name] || (additive ? 0 : null); // Additive NULL === 0 + if (result != null) { + const modValue = this.getModValue(name); + if (modValue) { + if (additive) { + result = result + modValue; + } else { + result = result * (1 + modValue); } } } return result; } + /** * Get the power generation of this module, taking in to account modifications * @return {Number} the power generation of this module