From 2a97678574e0e024ab076ce70f655a8ad777a098 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Wed, 23 Nov 2016 13:02:23 +0000 Subject: [PATCH] Move to method for damage type to allow for modifications --- src/app/components/HardpointSlot.jsx | 6 +++--- src/app/shipyard/Module.js | 8 ++++++++ src/app/shipyard/Ship.js | 12 ++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/components/HardpointSlot.jsx b/src/app/components/HardpointSlot.jsx index b3851423..b2c32edf 100644 --- a/src/app/components/HardpointSlot.jsx +++ b/src/app/components/HardpointSlot.jsx @@ -56,9 +56,9 @@ export default class HardpointSlot extends Slot { {m.mount && m.mount == 'F' ? : ''} {m.mount && m.mount == 'G' ? : ''} {m.mount && m.mount == 'T' ? : ''} - {m.type && m.type.match('K') ? : ''} - {m.type && m.type.match('T') ? : ''} - {m.type && m.type.match('E') ? : ''} + {m.getDamageType() && m.getDamageType().match('K') ? : ''} + {m.getDamageType() && m.getDamageType().match('T') ? : ''} + {m.getDamageType() && m.getDamageType().match('E') ? : ''} {classRating} {translate(m.name || m.grp)}{ m.mods && Object.keys(m.mods).length > 0 ? : null } diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index e6d3bae9..a6378157 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -540,4 +540,12 @@ export default class Module { getJitter() { return this._getModifiedValue('jitter', true); } + + /** + * Get the damage type for this module, taking in to account modifications + * @return {string} the damage types for this module; any combination of E T and K + */ + getDamageType() { + return this.type; + } } diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index a8e74fc7..c1f5082c 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -930,22 +930,22 @@ export default class Ship { totalDpe += dpe; totalDps += dps; totalSDps += sdps; - if (slot.m.type === 'E') { + if (slot.m.getDamageType() === 'E') { totalExplDpe += dpe; totalExplDps += dps; totalExplSDps += sdps; } - if (slot.m.type === 'K') { + if (slot.m.getDamageType() === 'K') { totalKinDpe += dpe; totalKinDps += dps; totalKinSDps += sdps; } - if (slot.m.type === 'T') { + if (slot.m.getDamageType() === 'T') { totalThermDpe += dpe; totalThermDps += dps; totalThermSDps += sdps; } - if (slot.m.type === 'EK') { + if (slot.m.getDamageType() === 'EK') { totalExplDpe += dpe / 2; totalKinDpe += dpe / 2; totalExplDps += dps / 2; @@ -953,7 +953,7 @@ export default class Ship { totalExplSDps += sdps / 2; totalKinSDps += sdps / 2; } - if (slot.m.type === 'ET') { + if (slot.m.getDamageType() === 'ET') { totalExplDpe += dpe / 2; totalThermDpe += dpe / 2; totalExplDps += dps / 2; @@ -961,7 +961,7 @@ export default class Ship { totalExplSDps += sdps / 2; totalThermSDps += sdps / 2; } - if (slot.m.type === 'KT') { + if (slot.m.getDamageType() === 'KT') { totalKinDpe += dpe / 2; totalThermDpe += dpe / 2; totalKinDps += dps / 2;