@@ -123,13 +126,13 @@ export default class OutfittingSubpages extends TranslatedComponent {
* @return {React.Component} Tab contents
*/
_offenceTab() {
- const { ship, sys, eng, wep, cargo, fuel, boost, engagementRange, opponent, opponentBuild } = this.props;
+ const { ship, sys, eng, wep, cargo, fuel, boost, engagementRange, opponent, opponentBuild, opponentSys } = this.props;
Persist.setOutfittingTab('offence');
- const marker = `${ship.toString()}:${opponent.toString()}:${opponentBuild}:${engagementRange}`;
+ const marker = `${ship.toString()}${opponent.toString()}${opponentBuild}${engagementRange}${opponentSys}`;
return
-
+
;
}
@@ -138,13 +141,13 @@ export default class OutfittingSubpages extends TranslatedComponent {
* @return {React.Component} Tab contents
*/
_defenceTab() {
- const { ship, sys, eng, wep, cargo, fuel, boost, engagementRange, opponent, opponentBuild } = this.props;
+ const { ship, sys, eng, wep, cargo, fuel, boost, engagementRange, opponent, opponentBuild, opponentWep } = this.props;
Persist.setOutfittingTab('defence');
- const marker = `${ship.toString()}:${opponent.toString()}:${opponentBuild}:${engagementRange}`;
+ const marker = `${ship.toString()}${opponent.toString()}{opponentBuild}${engagementRange}${opponentWep}`;
return
-
+
;
}
diff --git a/src/app/components/ShipPicker.jsx b/src/app/components/ShipPicker.jsx
index c2bcb9a4..93505b8d 100644
--- a/src/app/components/ShipPicker.jsx
+++ b/src/app/components/ShipPicker.jsx
@@ -45,7 +45,7 @@ export default class ShipPicker extends TranslatedComponent {
this._closeMenu();
// Ensure that the ship has changed
- if (ship !== this.props.ship || this.build !== this.props.build) {
+ if (ship !== this.props.ship || build !== this.props.build) {
this.props.onChange(ship, build);
}
}
diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx
index 11b4b71a..81372ec8 100644
--- a/src/app/pages/OutfittingPage.jsx
+++ b/src/app/pages/OutfittingPage.jsx
@@ -299,16 +299,22 @@ export default class OutfittingPage extends Page {
Persist.saveBuild(shipId, newBuildName, code);
this._updateRoute(shipId, newBuildName, code);
- let opponent, opponentBuild;
+ let opponent, opponentBuild, opponentSys, opponentEng, opponentWep;
if (shipId === this.state.opponent.id && buildName === this.state.opponentBuild) {
// This is a save of our current opponent build; update it
opponentBuild = newBuildName;
opponent = new Ship(shipId, Ships[shipId].properties, Ships[shipId].slots).buildFrom(code);
+ opponentSys = this.state.sys;
+ opponentEng = this.state.eng;
+ opponentWep = this.state.wep;
} else {
opponentBuild = this.state.opponentBuild;
opponent = this.state.opponent;
+ opponentSys = this.state.opponentSys;
+ opponentEng = this.state.opponentEng;
+ opponentWep = this.state.opponentWep;
}
- this.setState({ buildName: newBuildName, code, savedCode: code, opponent, opponentBuild, title: this._getTitle(newBuildName) });
+ this.setState({ buildName: newBuildName, code, savedCode: code, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, title: this._getTitle(newBuildName) });
}
/**
@@ -507,7 +513,7 @@ export default class OutfittingPage extends Page {
let state = this.state,
{ language, termtip, tooltip, sizeRatio, onWindowResize } = this.context,
{ translate, units, formats } = language,
- { ship, code, savedCode, buildName, newBuildName, sys, eng, wep, boost, fuel, cargo, opponent, opponentBuild, engagementRange } = state,
+ { ship, code, savedCode, buildName, newBuildName, sys, eng, wep, boost, fuel, cargo, opponent, opponentBuild, opponentSys, opponentEng, opponentWep, engagementRange } = state,
hide = tooltip.bind(null, null),
menu = this.props.currentMenu,
shipUpdated = this._shipUpdated,
@@ -616,6 +622,9 @@ export default class OutfittingPage extends Page {
engagementRange={engagementRange}
opponent={opponent}
opponentBuild={opponentBuild}
+ opponentSys={opponentSys}
+ opponentEng={opponentEng}
+ opponentWep={opponentWep}
/>
);
diff --git a/src/app/shipyard/Calculations.js b/src/app/shipyard/Calculations.js
index 30432949..3b806710 100644
--- a/src/app/shipyard/Calculations.js
+++ b/src/app/shipyard/Calculations.js
@@ -533,10 +533,11 @@ export function armourMetrics(ship) {
* @param {Object} ship The ship
* @param {Object} opponent The opponent ship
* @param {int} sys The pips to SYS
+ * @param {int} opponentWep The pips to pponent's WEP
* @param {int} engagementrange The range between the ship and opponent
* @returns {Object} Defence metrics
*/
-export function defenceMetrics(ship, opponent, sys, engagementrange) {
+export function defenceMetrics(ship, opponent, sys, opponentWep, engagementrange) {
// Obtain the shield metrics
const shield = this.shieldMetrics(ship, sys);
@@ -572,15 +573,16 @@ export function defenceMetrics(ship, opponent, sys, engagementrange) {
* @param {Object} ship The ship
* @param {Object} opponent The opponent ship
* @param {int} wep The pips to WEP
+ * @param {int} opponentSys The pips to opponent's SYS
* @param {int} engagementrange The range between the ship and opponent
* @returns {array} Offence metrics
*/
-export function offenceMetrics(ship, opponent, wep, engagementrange) {
+export function offenceMetrics(ship, opponent, wep, opponentSys, engagementrange) {
// Per-weapon and total damage
const damage = [];
// Obtain the opponent's shield and armour metrics
- const opponentShields = this.shieldMetrics(opponent, 4);
+ const opponentShields = this.shieldMetrics(opponent, opponentSys);
const opponentArmour = this.armourMetrics(opponent);
// Per-weapon and total damage to shields
@@ -612,18 +614,6 @@ export function offenceMetrics(ship, opponent, wep, engagementrange) {
}
return damage;
-
- const shielddamage = opponentShields.generator ? {
- absolute: {
- weapon1: 10,
- weapon2: 10,
- weapon3: 10,
- weapon4: 10,
- total: 40
- }
- } : {};
-
- return damage;
}
/**
@@ -632,7 +622,7 @@ export function offenceMetrics(ship, opponent, wep, engagementrange) {
* @returns {integer} the resistance for the given pips
*/
export function sysResistance(sys) {
- return Math.pow(sys,0.85) * 0.6 / Math.pow(4,0.85);
+ return Math.pow(sys, 0.85) * 0.6 / Math.pow(4, 0.85);
}
/**