diff --git a/ChangeLog.md b/ChangeLog.md index 0115f76c..bb6bc4c2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,6 @@ #2.2.10 * Fix detailed export of module reinforcement packages + * Use damagedist for exact breakdown of weapons that have more than one type of damage #2.2.9 * Use SSL-enabled server for shortlinks diff --git a/src/app/components/DamageDealt.jsx b/src/app/components/DamageDealt.jsx index eb27dc20..5d0f27b2 100644 --- a/src/app/components/DamageDealt.jsx +++ b/src/app/components/DamageDealt.jsx @@ -153,7 +153,7 @@ export default class DamageDealt extends TranslatedComponent { } totals.effectiveness = totals.effectiveDps / totalDps; - return {weapons: weapons, totals: totals}; + return { weapons, totals }; } /** diff --git a/src/app/components/DamageReceived.jsx b/src/app/components/DamageReceived.jsx index 7268d5c4..3b254025 100644 --- a/src/app/components/DamageReceived.jsx +++ b/src/app/components/DamageReceived.jsx @@ -93,7 +93,7 @@ export default class DamageReceived extends TranslatedComponent { let weapons = []; for (let grp in Modules.hardpoints) { - if (Modules.hardpoints[grp][0].damage && Modules.hardpoints[grp][0].type) { + if (Modules.hardpoints[grp][0].damage && Modules.hardpoints[grp][0].damagedist) { for (let mId in Modules.hardpoints[grp]) { const m = new Module(Modules.hardpoints[grp][mId]); const classRating = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`; @@ -104,37 +104,35 @@ export default class DamageReceived extends TranslatedComponent { // Effective DPS taking in to account shield resistance let effectivenessShields = 0; - if (m.getDamageType().indexOf('E') != -1) { - effectivenessShields += (1 - ship.shieldExplRes); + if (m.getDamageDist().E) { + effectivenessShields += m.getDamageDist().E * (1 - ship.shieldExplRes); } - if (m.getDamageType().indexOf('K') != -1) { - effectivenessShields += (1 - ship.shieldKinRes); + if (m.getDamageDist().K) { + effectivenessShields += m.getDamageDist().K * (1 - ship.shieldKinRes); } - if (m.getDamageType().indexOf('T') != -1) { - effectivenessShields += (1 - ship.shieldThermRes); + if (m.getDamageDist().T) { + effectivenessShields += m.getDamageDist().T * (1 - ship.shieldThermRes); } - if (m.getDamageType().indexOf('A') != -1) { - effectivenessShields += 1; + if (m.getDamageDist().A) { + effectivenessShields += m.getDamageDist().A; } - effectivenessShields /= m.getDamageType().length; const effectiveDpsShields = baseDps * effectivenessShields; const effectiveSDpsShields = baseSDps * effectivenessShields; // Effective DPS taking in to account hull hardness and resistance let effectivenessHull = 0; - if (m.getDamageType().indexOf('E') != -1) { - effectivenessHull += (1 - ship.hullExplRes); + if (m.getDamageDist().E) { + effectivenessHull += m.getDamageDist().E * (1 - ship.hullExplRes); } - if (m.getDamageType().indexOf('K') != -1) { - effectivenessHull += (1 - ship.hullKinRes); + if (m.getDamageDist().K) { + effectivenessHull += m.getDamageDist().K * (1 - ship.hullKinRes); } - if (m.getDamageType().indexOf('T') != -1) { - effectivenessHull += (1 - ship.hullThermRes); + if (m.getDamageDist().T) { + effectivenessHull += m.getDamageDist().T * (1 - ship.hullThermRes); } - if (m.getDamageType().indexOf('A') != -1) { - effectivenessHull += 1; + if (m.getDamageDist().A) { + effectivenessHull += m.getDamageDist().A; } - effectivenessHull /= m.getDamageType().length; effectivenessHull *= Math.min(m.getPiercing() / ship.hardness, 1); const effectiveDpsHull = baseDps * effectivenessHull; const effectiveSDpsHull = baseSDps * effectivenessHull; diff --git a/src/app/components/HardpointSlot.jsx b/src/app/components/HardpointSlot.jsx index e4d75d6e..8436331b 100644 --- a/src/app/components/HardpointSlot.jsx +++ b/src/app/components/HardpointSlot.jsx @@ -59,9 +59,9 @@ export default class HardpointSlot extends Slot { {m.mount && m.mount == 'F' ? : ''} {m.mount && m.mount == 'G' ? : ''} {m.mount && m.mount == 'T' ? : ''} - {m.getDamageType() && m.getDamageType().match('K') ? : ''} - {m.getDamageType() && m.getDamageType().match('T') ? : ''} - {m.getDamageType() && m.getDamageType().match('E') ? : ''} + {m.getDamageDist() && m.getDamageDist().K ? : ''} + {m.getDamageDist() && m.getDamageDist().T ? : ''} + {m.getDamageDist() && m.getDamageDist().E ? : ''} {classRating} {translate(m.name || m.grp)}{ m.mods && Object.keys(m.mods).length > 0 ? : null } diff --git a/src/app/components/Modification.jsx b/src/app/components/Modification.jsx index 3813681e..809175f7 100644 --- a/src/app/components/Modification.jsx +++ b/src/app/components/Modification.jsx @@ -63,8 +63,8 @@ export default class Modification extends TranslatedComponent { let translate = this.context.language.translate; let name = this.props.name; - if (name === 'type') { - // We don't show type + if (name === 'damagedist') { + // We don't show damage distribution return null; } diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index 36911b33..bd4b9adb 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -650,10 +650,10 @@ export default class Module { } /** - * 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 + * Get the damage distribution for this module, taking in to account modifications + * @return {string} the damage distribution for this module */ - getDamageType() { - return this.getModValue('type') || this.type; + getDamageDist() { + return this.getModValue('damagedist') || this.damagedist; } } diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 1342ff20..1f9fd2fc 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -954,20 +954,22 @@ export default class Ship { totalDpe += dpe; totalDps += dps; totalSDps += sdps; - if (slot.m.getDamageType().indexOf('E') != -1) { - totalExplDpe += dpe / slot.m.getDamageType().length; - totalExplDps += dps / slot.m.getDamageType().length; - totalExplSDps += sdps / slot.m.getDamageType().length; - } - if (slot.m.getDamageType().indexOf('K') != -1) { - totalKinDpe += dpe / slot.m.getDamageType().length; - totalKinDps += dps / slot.m.getDamageType().length; - totalKinSDps += sdps / slot.m.getDamageType().length; - } - if (slot.m.getDamageType().indexOf('T') != -1) { - totalThermDpe += dpe / slot.m.getDamageType().length; - totalThermDps += dps / slot.m.getDamageType().length; - totalThermSDps += sdps / slot.m.getDamageType().length; + if (slot.m.getDamageDist()) { + if (slot.m.getDamageDist().E) { + totalExplDpe += dpe * slot.m.getDamageDist().E; + totalExplDps += dps * slot.m.getDamageDist().E; + totalExplSDps += sdps * slot.m.getDamageDist().E; + } + if (slot.m.getDamageDist().K) { + totalKinDpe += dpe * slot.m.getDamageDist().K; + totalKinDps += dps * slot.m.getDamageDist().K; + totalKinSDps += sdps * slot.m.getDamageDist().K; + } + if (slot.m.getDamageDist().T) { + totalThermDpe += dpe * slot.m.getDamageDist().T; + totalThermDps += dps * slot.m.getDamageDist().T; + totalThermSDps += sdps * slot.m.getDamageDist().T; + } } } }