Fix modification value for additive modifications

This commit is contained in:
Cmdr McDonald
2016-11-10 15:18:05 +00:00
parent 0688faac93
commit 5b81a0b25f

View File

@@ -59,22 +59,20 @@ export default class Module {
* @return {Number} the mass of this module * @return {Number} the mass of this module
*/ */
_getModifiedValue(name, additive) { _getModifiedValue(name, additive) {
let result = 0; let result = this[name] || (additive ? 0 : null); // Additive NULL === 0
if (this[name]) { if (result != null) {
result = this[name]; const modValue = this.getModValue(name);
if (result) { if (modValue) {
const modValue = this.getModValue(name); if (additive) {
if (modValue) { result = result + modValue;
if (additive) { } else {
result = result + modValue; result = result * (1 + modValue);
} else {
result = result * (1 + modValue);
}
} }
} }
} }
return result; return result;
} }
/** /**
* Get the power generation of this module, taking in to account modifications * Get the power generation of this module, taking in to account modifications
* @return {Number} the power generation of this module * @return {Number} the power generation of this module