From 2e42a328e0199a0bea4f334c78e84de35ad14c76 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Mon, 19 Dec 2016 17:56:54 +0000 Subject: [PATCH] Add base resistances to defence summary tooltip --- ChangeLog.md | 1 + src/app/components/DefenceSummary.jsx | 31 +++++++++++++++++++++------ src/app/shipyard/Ship.js | 9 ++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index db6b395f..13eb8550 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -18,6 +18,7 @@ * Add 'Piercing' information to hardpoints * Add 'Hardness' information to ship summary * Add module copy functionality - drag module whilst holding 'alt' to copy + * Add base resistances to defence summary tooltip #2.2.5 * Calculate rate of fire for multi-burst weapons diff --git a/src/app/components/DefenceSummary.jsx b/src/app/components/DefenceSummary.jsx index 94831068..a20b1bb5 100644 --- a/src/app/components/DefenceSummary.jsx +++ b/src/app/components/DefenceSummary.jsx @@ -29,6 +29,8 @@ export default class DefenceSummary extends TranslatedComponent { let { formats, translate, units } = language; let hide = tooltip.bind(null, null); + const shieldGenerator = ship.findShieldGenerator(); + return (

{translate('defence summary')}

@@ -48,9 +50,18 @@ export default class DefenceSummary extends TranslatedComponent { {ship.shield ? {translate('damage from')} - {formats.pct1(ship.shieldExplRes || 1)} - {formats.pct1(ship.shieldKinRes || 1)} - {formats.pct1(ship.shieldThermRes || 1)} + +   + {formats.pct1(ship.shieldExplRes || 1)} + + +   + {formats.pct1(ship.shieldKinRes || 1)} + + +   + {formats.pct1(ship.shieldThermRes || 1)} + : null } { ship.shield && ship.shieldCells ? @@ -63,9 +74,17 @@ export default class DefenceSummary extends TranslatedComponent { {translate('damage from')} - {formats.pct1(ship.hullExplRes || 1)} - {formats.pct1(ship.hullKinRes || 1)} - {formats.pct1(ship.hullThermRes || 1)} + +   + {formats.pct1(ship.hullExplRes || 1)} + +   + {formats.pct1(ship.hullKinRes || 1)} + + +   + {formats.pct1(ship.hullThermRes || 1)} + {ship.modulearmour > 0 ? diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 34f54f84..9778fae2 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -295,6 +295,15 @@ export default class Ship { } } + /** + * Find the shield generator for this ship + * @return {object} The shield generator module for this ship + */ + findShieldGenerator() { + const slot = this.internal.find(slot => slot.m && ModuleUtils.isShieldGenerator(slot.m.grp)); + return slot ? slot.m : undefined; + } + /** * Serializes the ship to a string * @return {String} Serialized ship 'code'