Allow 3dp for ship and module discounts

This commit is contained in:
Cmdr McDonald
2016-11-05 13:59:23 +00:00
parent be45637435
commit 07df44a907
3 changed files with 9 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ function normalizePercent(val) {
if (val === '' || isNaN(val)) {
return 0;
}
val = Math.round(val * 100) / 100;
val = Math.round(val * 1000) / 1000;
return val >= 100 ? 100 : val;
}
@@ -512,4 +512,4 @@ export default class Header extends TranslatedComponent {
);
}
}
}

View File

@@ -115,6 +115,11 @@ export function toDetailedBuild(buildName, ship) {
return data;
};
/**
* Instantiates a ship from a ship-loadout object, using the code
* @param {Object} detailedBuild ship-loadout object
* @return {Ship} Ship instance
*/
export function fromDetailedBuild(detailedBuild) {
let shipId = Object.keys(Ships).find((shipId) => Ships[shipId].properties.name.toLowerCase() == detailedBuild.ship.toLowerCase());

View File

@@ -4,7 +4,7 @@ import Module from './Module';
import LZString from 'lz-string';
import isEqual from 'lodash/lang';
import { Modifications } from 'coriolis-data/dist';
var zlib = require('zlib');
const zlib = require('zlib');
const UNIQUE_MODULES = ['psg', 'sg', 'bsg', 'rf', 'fs', 'fh'];
@@ -234,7 +234,7 @@ export default class Ship {
}
// TODO obtain shield boost
//return Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sg, this.shieldMultiplier + (multiplierDelta || 0));
// return Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sg, this.shieldMultiplier + (multiplierDelta || 0));
return Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sg, 0 + (multiplierDelta || 0));
}