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
This commit is contained in:
Felix Linker
2019-01-15 00:32:33 +01:00
committed by William
parent 4b854b8305
commit a498452943
3 changed files with 6 additions and 6 deletions

View File

@@ -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 = [];

View File

@@ -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); }
}

View File

@@ -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);