Calculate top boost speed

This commit is contained in:
Colin McLeod
2015-09-21 20:47:31 -07:00
parent 75c22de166
commit 231fcbb3bc
3 changed files with 15 additions and 9 deletions

View File

@@ -100,11 +100,12 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.speedSeries = {
xMin: 0,
xMax: ship.cargoCapacity,
yMax: calcSpeed(ship.unladenMass, ship.speed, $scope.th.c, ship.pipSpeed)['4 Pips'],
yMax: calcSpeed(ship.unladenMass, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed)['boost'],
yMin: 0,
series: ['4 Pips', '2 Pips', '0 Pips'],
series: ['boost', '4 Pips', '2 Pips', '0 Pips'],
colors: ['#0088d2', '#ff8c0d', '#D26D00', '#c06400'],
func: function(cargo) { // X Axis is Cargo
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, $scope.th.c, ship.pipSpeed);
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed);
}
};
$scope.speedChart = {
@@ -360,7 +361,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.speedSeries.xMax = $scope.trSeries.xMax = $scope.jrSeries.xMax = ship.cargoCapacity;
$scope.jrSeries.yMax = ship.unladenRange;
$scope.trSeries.yMax = ship.unladenTotalRange;
$scope.speedSeries.yMax = calcSpeed(ship.unladenMass, ship.speed, $scope.th.c, ship.pipSpeed)['4 Pips'];
$scope.speedSeries.yMax = calcSpeed(ship.unladenMass, ship.speed, ship.boost, $scope.th.c, ship.pipSpeed)['boost'];
updateRetrofitCosts();
win.triggerHandler('pwrchange');
}

View File

@@ -398,7 +398,9 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
};
Ship.prototype.updateTopSpeed = function() {
this.topSpeed = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.common[1].c, this.pipSpeed)['4 Pips'];
var speeds = calcSpeed(this.unladenMass + this.fuelCapacity, this.speed, this.boost, this.common[1].c, this.pipSpeed);
this.topSpeed = speeds['4 Pips'];
this.topBoost = speeds['boost'];
};
Ship.prototype.updateShieldStrength = function() {

View File

@@ -33,7 +33,7 @@ angular.module('shipyard', ['ngLodash'])
sc: 'Scanner',
am: 'Auto Field-Maintenance Unit',
cr: 'Cargo Rack',
fi: 'FSD Interdictor',
fi: 'Frame Shift Drive Interdictor',
hb: 'Hatch Breaker Limpet Controller',
hr: 'Hull Reinforcement Package',
rf: 'Refinery',
@@ -233,16 +233,19 @@ angular.module('shipyard', ['ngLodash'])
*
* @param {number} mass Current mass of the ship
* @param {number} baseSpeed Base speed m/s for ship
* @param {number} baseBoost Base boost speed m/s for ship
* @param {object} thrusters The Thrusters used
* @param {number} pipSpeed Speed pip multiplier
* @return {object} Approximate speed by pips
*/
.value('calcSpeed', function(mass, baseSpeed, thrusters, pipSpeed) {
var speed = baseSpeed * ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
.value('calcSpeed', function(mass, baseSpeed, baseBoost, thrusters, pipSpeed) {
var multiplier = mass > thrusters.maxmass ? 0 : ((1 - thrusters.M) + (thrusters.M * Math.pow(3 - (2 * Math.max(0.5, mass / thrusters.optmass)), thrusters.P)));
var speed = baseSpeed * multiplier;
return {
'0 Pips': speed * (1 - (pipSpeed * 4)),
'2 Pips': speed * (1 - (pipSpeed * 2)),
'4 Pips': speed
'4 Pips': speed,
'boost': baseBoost * multiplier
};
});