From a498452943a88e647e19e9745dff4544d7940bd4 Mon Sep 17 00:00:00 2001 From: Felix Linker Date: Tue, 15 Jan 2019 00:32:33 +0100 Subject: [PATCH] Multiple bug fixes (#463) * Don't allow manually modifying multiplicative mods with base value zero * Add missing argument when calculating fullTankRange * Use opponent PD when calculating how long shields will hold Closes #430 * Allow modifying max mass ONLY for shield generators Closes #453 --- src/app/components/Defence.jsx | 4 ++-- src/app/shipyard/Module.js | 6 +++--- src/app/shipyard/Ship.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/Defence.jsx b/src/app/components/Defence.jsx index 7987f943..d26bbfc1 100644 --- a/src/app/components/Defence.jsx +++ b/src/app/components/Defence.jsx @@ -52,12 +52,12 @@ export default class Defence extends TranslatedComponent { * @return {React.Component} contents */ render() { - const { ship, sys, opponentWep } = this.props; + const { opponent, sys, opponentWep } = this.props; const { language, tooltip, termtip } = this.context; const { formats, translate, units } = language; const { shield, armour, shielddamage, armourdamage } = this.state; - const pd = ship.standard[4].m; + const pd = opponent.standard[4].m; const shieldSourcesData = []; const effectiveShieldData = []; diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index 7b4e45e6..b4cb3615 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -167,7 +167,7 @@ export default class Module { } else if (name === 'shieldboost' || name === 'hullboost') { modValue = (1 + value) / (1 + baseValue) - 1; } else { // multiplicative - modValue = value / baseValue - 1; + modValue = baseValue == 0 ? 0 : value / baseValue - 1; } if (modification.type === 'percentage') { @@ -703,8 +703,8 @@ export default class Module { let result = 0; if (this['maxmass']) { result = this['maxmass']; - // max mass is only modified for non-shield boosters - if (result && modified && this.grp !== 'sg') { + // max mass is only modified for shield generators + if (result && modified && this.grp === 'sg') { let mult = this.getModValue('optmass') / 10000; if (mult) { result = result * (1 + mult); } } diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 92aab6e7..23c57d03 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -1308,7 +1308,7 @@ export default class Ship { let fsd = this.standard[2].m; // Frame Shift Drive; let { unladenMass, fuelCapacity } = this; this.unladenRange = this.calcUnladenRange(); // Includes fuel weight for jump - this.fullTankRange = Calc.jumpRange(unladenMass + fuelCapacity, fsd, this); // Full Tank + this.fullTankRange = Calc.jumpRange(unladenMass + fuelCapacity, fsd, fuelCapacity, this); // Full Tank this.ladenRange = this.calcLadenRange(); // Includes full tank and caro this.unladenFastestRange = Calc.totalJumpRange(unladenMass + this.fuelCapacity, fsd, fuelCapacity, this); this.ladenFastestRange = Calc.totalJumpRange(unladenMass + this.fuelCapacity + this.cargoCapacity, fsd, fuelCapacity, this);