Compare commits

...

4 Commits
1.2.0 ... 1.3.0

Author SHA1 Message Date
Colin McLeod
f0bdcd5557 Bumping version to 1.3.0 2015-07-20 13:42:38 -07:00
Colin McLeod
b1ee0e44f3 Linting fixes, update unit test 2015-07-20 13:42:21 -07:00
Colin McLeod
c96e6afbd7 Power Distributor required for Boost. Resolves #17 2015-07-20 13:37:03 -07:00
Colin McLeod
77334341ea Armour value improved by bulkhead 2015-07-20 00:55:51 -07:00
29 changed files with 81 additions and 27 deletions

View File

@@ -371,6 +371,10 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.costTab = tab;
};
$scope.pdWarning = function(pd) {
return pd.enginecapacity < ship.boostEnergy;
};
// Hide any open menu/slot/etc if the background is clicked
$scope.$on('close', function() {
$scope.selectedSlot = null;

View File

@@ -2,7 +2,7 @@ angular.module('app').directive('componentSelect', function() {
// Generting the HTML in this manner is MUCH faster than using an angular template.
function appendGroup(list, opts, cid, mass) {
function appendGroup(list, opts, cid, mass, checkWarning) {
var prevClass = null, prevRating = null;
for (var i = 0; i < opts.length; i++) {
var o = opts[i];
@@ -18,6 +18,10 @@ angular.module('app').directive('componentSelect', function() {
list.push(' active');
}
if (checkWarning && checkWarning(opts[i])) {
list.push(' warning');
}
list.push((o.maxmass && mass > o.maxmass) ? ' disabled"' : '" cpid="', id, '">');
if (o.mode) {
@@ -47,7 +51,8 @@ angular.module('app').directive('componentSelect', function() {
opts: '=', // Component Options object
groups: '=', // Groups of Component Options
mass: '=', // Current ship unladen mass
s: '=' // Current Slot
s: '=', // Current Slot
warning: '=' // Check warning function
},
link: function(scope, element) {
var list = [];
@@ -64,12 +69,12 @@ angular.module('app').directive('componentSelect', function() {
var grp = groups[g];
var grpCode = grp[Object.keys(grp)[0]].grp; // Nasty operation to get the grp property of the first/any single component
list.push('<div id="', grpCode, '" class="select-group">', g, '</div><ul>');
appendGroup(list, grp, cid, mass);
appendGroup(list, grp, cid, mass, scope.warning);
list.push('</ul>');
}
} else {
list.push('<ul>');
appendGroup(list, opts, cid, mass);
appendGroup(list, opts, cid, mass, scope.warning);
list.push('</ul>');
}

View File

@@ -1,4 +1,4 @@
angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', 'calcJumpRange', 'calcTotalRange', 'lodash', function(Components, calcShieldStrength, calcJumpRange, calcTotalRange, _) {
angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', 'calcJumpRange', 'calcTotalRange', 'lodash', 'ArmourMultiplier', function(Components, calcShieldStrength, calcJumpRange, calcTotalRange, _, ArmourMultiplier) {
/**
* Returns the power usage type of a slot and it's particular component
@@ -84,10 +84,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
this.cargoCapacity = 0;
this.ladenMass = 0;
this.armourAdded = 0;
this.armourMultiplier = 1;
this.shieldMultiplier = 1;
this.totalCost = this.c.incCost ? this.c.discountedCost : 0;
this.unladenMass = this.hullMass;
this.armour = this.baseArmour;
this.totalDps = 0;
this.bulkheads.c = null;
@@ -158,6 +158,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
this.bulkheads.id = index;
this.bulkheads.c = Components.bulkheads(this.id, index);
this.bulkheads.discountedCost = this.bulkheads.c.cost * this.componentCostMultiplier;
this.armourMultiplier = ArmourMultiplier[index];
this.updateStats(this.bulkheads, this.bulkheads.c, oldBulkhead, preventUpdate);
};
@@ -359,7 +360,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
}
this.ladenMass = this.unladenMass + this.cargoCapacity + this.fuelCapacity;
this.armour = this.armourAdded + this.baseArmour;
this.armour = this.armourAdded + Math.round(this.baseArmour * this.armourMultiplier);
if (!preventUpdate) {
if (powerChange) {

View File

@@ -10,6 +10,13 @@ angular.module('shipyard', ['ngLodash'])
// Create 'angularized' references to DB.This will aid testing
.constant('ShipsDB', DB.ships)
.constant('ComponentsDB', DB.components)
.value('ArmourMultiplier', [
1, // Lightweight
1.4, // Reinforced
1.945, // Military
1.945, // Mirrored
1.945 // Reactive
])
.value('commonArray', [
'Power Plant',
'Thrusters',

View File

@@ -66,3 +66,7 @@
color: @warning-disabled;
fill: @warning-disabled;
}
.bg-warning-disabled {
background-color: @warning-disabled;
}

View File

@@ -77,18 +77,10 @@ select {
stroke: @primary-disabled;
&:hover {
border-color: @primary;
color: @primary;
stroke: @primary;
}
&.disabled {
cursor: not-allowed;
color: @disabled;
stroke: @disabled;
}
&.active {
color: @secondary;
stroke: @secondary;
}
}
.lc, .c {
@@ -96,15 +88,27 @@ select {
padding: 0.1em 0.2em;
margin: 0.3em;
&.warning {
border-color: @warning-disabled;
color: @warning-disabled;
stroke: @warning-disabled;
&:hover {
border:1px solid @primary;
border-color: @warning;
color: @warning;
stroke: @warning;
}
}
&.disabled {
border:1px solid @disabled;
border-color: @disabled;
color: @disabled;
stroke: @disabled;
}
&.active {
border:1px solid @secondary;
border-color: @secondary;
color: @secondary;
stroke: @secondary;
}
}

View File

@@ -32,7 +32,7 @@
<th rowspan="2">Size</th>
<th rowspan="2">Agility</th>
<th rowspan="2">Speed</th>
<th rowspan="2">Boost</th>
<th rowspan="2" ng-class="{'bg-warning-disabled': pd.c.enginecapacity < ship.boostEnergy}">Boost</th>
<th rowspan="2">DPS</th>
<th rowspan="2">Armour</th>
<th rowspan="2">Shields</th>
@@ -60,9 +60,16 @@
<td ng-bind="SZ[ship.class]"></td>
<td>{{ship.agility}}/10</td>
<td>{{fRound(ship.speed)}} <u>m/s</u></td>
<td>{{fRound(ship.boost)}} <u>m/s</u></td>
<td>
<span ng-if="pd.c.enginecapacity >= ship.boostEnergy">{{fRound(ship.boost)}} <u>m/s</u></span>
<span class="warning" ng-if="pd.c.enginecapacity < ship.boostEnergy">0 <svg class="icon"><use xlink:href="#warning"></use></svg></span>
</td>
<td>{{fRound(ship.totalDps)}}</td>
<td>{{ship.armour}} <span ng-if="ship.armourAdded">({{ship.baseArmour}} + {{ship.armourAdded}})</span></td>
<td>
{{ship.armour}}
<span ng-if="ship.armourAdded || ship.armourMultiplier > 1">(<span ng-if="ship.armourMultiplier > 1">{{fRPct(ship.armourMultiplier)}}</span>
<span ng-if="ship.armourAdded">+ {{ship.armourAdded}}</span>)</span>
</td>
<td>{{fRound(ship.shieldStrength)}} <u>MJ</u> <span ng-if="ship.shieldMultiplier > 1 && ship.shieldStrength > 0">({{fRPct(ship.shieldMultiplier)}})</span></td>
<td>{{ship.hullMass}} <u>T</u></td>
<td>{{fRound(ship.unladenMass)}} <u>T</u></td>
@@ -144,7 +151,7 @@
<div component-select class="select" s="ls" opts="availCS.common[3]" ng-if="selectedSlot==ls" ng-click="select('c',ls,$event)"></div>
</div>
<div class="slot" ng-click="selectSlot($event, pd)" ng-class="{selected: selectedSlot==pd}">
<div class="details">
<div class="details" ng-class="{warning: pd.c.enginecapacity < ship.boostEnergy}">
<div class="sz">{{::pd.maxClass}}</div>
<div class="l">{{pd.id}} Power Distributor</div>
<div class="r">{{pd.c.mass}} <u>T</u></div>
@@ -153,7 +160,7 @@
<div class="l">SYS: {{pd.c.systemcapacity}} <u>MJ</u> / {{pd.c.systemrecharge}} <u>MW</u></div>
<div class="l">ENG: {{pd.c.enginecapacity}} <u>MJ</u> / {{pd.c.enginerecharge}} <u>MW</u></div>
</div>
<div component-select class="select" s="pd" opts="availCS.common[4]" ng-if="selectedSlot==pd" ng-click="select('c',pd,$event)"></div>
<div component-select class="select" s="pd" warning="pdWarning" opts="availCS.common[4]" ng-if="selectedSlot==pd" ng-click="select('c',pd,$event)"></div>
</div>
<div class="slot" ng-click="selectSlot($event, ss)" ng-class="{selected: selectedSlot==ss}">
<div class="details">

View File

@@ -7,6 +7,7 @@
"hullCost": 39993,
"speed": 220,
"boost": 320,
"boostEnergy": 9,
"agility": 8,
"baseShieldStrength": 60,
"baseArmour": 162,

View File

@@ -7,6 +7,7 @@
"hullCost": 141889932,
"speed": 180,
"boost": 240,
"boostEnergy": 29,
"agility": 2,
"baseShieldStrength": 350,
"baseArmour": 945,

View File

@@ -7,6 +7,7 @@
"hullCost": 6135658,
"speed": 250,
"boost": 340,
"boostEnergy": 14,
"agility": 6,
"baseShieldStrength": 140,
"baseArmour": 378,

View File

@@ -7,6 +7,7 @@
"hullCost": 235787,
"speed": 280,
"boost": 400,
"boostEnergy": 11,
"agility": 6,
"baseShieldStrength": 80,
"baseArmour": 216,

View File

@@ -7,6 +7,7 @@
"hullCost": 461341,
"speed": 283,
"boost": 384,
"boostEnergy": 11,
"agility": 8,
"baseShieldStrength": 118,
"baseArmour": 216,

View File

@@ -7,6 +7,7 @@
"hullCost": 1635691,
"speed": 242,
"boost": 316,
"boostEnergy": 14,
"agility": 5,
"baseShieldStrength": 146,
"baseArmour": 270,

View File

@@ -7,6 +7,7 @@
"hullCost": 10446,
"speed": 240,
"boost": 350,
"boostEnergy": 9,
"agility": 10,
"baseShieldStrength": 60,
"baseArmour": 72,

View File

@@ -7,6 +7,7 @@
"hullCost": 18969990,
"speed": 180,
"boost": 300,
"boostEnergy": 21,
"agility": 2,
"baseShieldStrength": 200,
"baseArmour": 540,

View File

@@ -7,6 +7,7 @@
"hullCost": 51232230,
"speed": 260,
"boost": 350,
"boostEnergy": 21,
"agility": 6,
"baseShieldStrength": 300,
"baseArmour": 405,

View File

@@ -8,6 +8,7 @@
"speed": 200,
"boost": 300,
"agility": 6,
"boostEnergy": 7,
"baseShieldStrength": 50,
"baseArmour": 90,
"hullMass": 14,

View File

@@ -7,6 +7,7 @@
"hullCost": 21077784,
"speed": 300,
"boost": 380,
"boostEnergy": 21,
"agility": 2,
"baseShieldStrength": 180,
"baseArmour": 486,

View File

@@ -7,6 +7,7 @@
"hullCost": 2481552,
"speed": 277,
"boost": 380,
"boostEnergy": 11,
"agility": 6,
"baseShieldStrength": 197,
"baseArmour": 144,

View File

@@ -7,6 +7,7 @@
"hullCost": 47798079,
"speed": 300,
"boost": 380,
"boostEnergy": 17,
"agility": 2,
"baseShieldStrength": 220,
"baseArmour": 396,

View File

@@ -7,6 +7,7 @@
"hullCost": 55171395,
"speed": 230,
"boost": 280,
"boostEnergy": 24,
"agility": 6,
"baseShieldStrength": 260,
"baseArmour": 468,

View File

@@ -7,6 +7,7 @@
"hullCost": 12887,
"speed": 220,
"boost": 320,
"boostEnergy": 7,
"agility": 8,
"baseShieldStrength": 40,
"baseArmour": 108,

View File

@@ -7,6 +7,7 @@
"hullCost": 865782,
"speed": 220,
"boost": 350,
"boostEnergy": 11,
"agility": 3,
"baseShieldStrength": 90,
"baseArmour": 162,

View File

@@ -7,6 +7,7 @@
"hullCost": 16881511,
"speed": 180,
"boost": 300,
"boostEnergy": 11,
"agility": 2,
"baseShieldStrength": 120,
"baseArmour": 216,

View File

@@ -7,6 +7,7 @@
"hullCost": 73255168,
"speed": 130,
"boost": 200,
"boostEnergy": 21,
"agility": 0,
"baseShieldStrength": 240,
"baseArmour": 432,

View File

@@ -7,6 +7,7 @@
"hullCost": 95893,
"speed": 320,
"boost": 400,
"boostEnergy": 11,
"agility": 6,
"baseShieldStrength": 105,
"baseArmour": 126,

View File

@@ -7,6 +7,7 @@
"hullCost": 4689629,
"speed": 210,
"boost": 340,
"boostEnergy": 17,
"agility": 9,
"baseShieldStrength": 240,
"baseArmour": 288,

View File

@@ -1,6 +1,6 @@
{
"name": "coriolis_shipyard",
"version": "1.2.0",
"version": "1.3.0",
"repository": {
"type": "git",
"url": "https://github.com/cmmcleod/coriolis"

View File

@@ -188,6 +188,7 @@
"hullCost": 141889932,
"speed": 180,
"boost": 240,
"boostEnergy": 29,
"agility": 2,
"baseShieldStrength": 350,
"baseArmour": 945,
@@ -198,11 +199,12 @@
"fuelCapacity": 32,
"cargoCapacity": 128,
"ladenMass": 1339.2,
"armour": 2078,
"armourAdded": 240,
"armourMultiplier": 1.95,
"shieldMultiplier": 1.4,
"totalCost": 882362049,
"unladenMass": 1179.2,
"armour": 1185,
"totalDps": 29,
"powerAvailable": 36,
"powerRetracted": 23.93,