Move to method for damage type to allow for modifications

This commit is contained in:
Cmdr McDonald
2016-11-23 13:02:23 +00:00
parent 3b8444482f
commit 11af7f567a
3 changed files with 17 additions and 9 deletions

View File

@@ -56,9 +56,9 @@ export default class HardpointSlot extends Slot {
{m.mount && m.mount == 'F' ? <span onMouseOver={termtip.bind(null, 'fixed')} onMouseOut={tooltip.bind(null, null)}><MountFixed /></span> : ''} {m.mount && m.mount == 'F' ? <span onMouseOver={termtip.bind(null, 'fixed')} onMouseOut={tooltip.bind(null, null)}><MountFixed /></span> : ''}
{m.mount && m.mount == 'G' ? <span onMouseOver={termtip.bind(null, 'gimballed')} onMouseOut={tooltip.bind(null, null)}><MountGimballed /></span> : ''} {m.mount && m.mount == 'G' ? <span onMouseOver={termtip.bind(null, 'gimballed')} onMouseOut={tooltip.bind(null, null)}><MountGimballed /></span> : ''}
{m.mount && m.mount == 'T' ? <span onMouseOver={termtip.bind(null, 'turreted')} onMouseOut={tooltip.bind(null, null)}><MountTurret /></span> : ''} {m.mount && m.mount == 'T' ? <span onMouseOver={termtip.bind(null, 'turreted')} onMouseOut={tooltip.bind(null, null)}><MountTurret /></span> : ''}
{m.type && m.type.match('K') ? <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span> : ''} {m.getDamageType() && m.getDamageType().match('K') ? <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span> : ''}
{m.type && m.type.match('T') ? <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span> : ''} {m.getDamageType() && m.getDamageType().match('T') ? <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span> : ''}
{m.type && m.type.match('E') ? <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span> : ''} {m.getDamageType() && m.getDamageType().match('E') ? <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span> : ''}
{classRating} {translate(m.name || m.grp)}{ m.mods && Object.keys(m.mods).length > 0 ? <span className='r' onMouseOver={termtip.bind(null, modTT)} onMouseOut={tooltip.bind(null, null)}><Modified /></span> : null } {classRating} {translate(m.name || m.grp)}{ m.mods && Object.keys(m.mods).length > 0 ? <span className='r' onMouseOver={termtip.bind(null, modTT)} onMouseOut={tooltip.bind(null, null)}><Modified /></span> : null }
</div> </div>

View File

@@ -540,4 +540,12 @@ export default class Module {
getJitter() { getJitter() {
return this._getModifiedValue('jitter', true); 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;
}
} }

View File

@@ -930,22 +930,22 @@ export default class Ship {
totalDpe += dpe; totalDpe += dpe;
totalDps += dps; totalDps += dps;
totalSDps += sdps; totalSDps += sdps;
if (slot.m.type === 'E') { if (slot.m.getDamageType() === 'E') {
totalExplDpe += dpe; totalExplDpe += dpe;
totalExplDps += dps; totalExplDps += dps;
totalExplSDps += sdps; totalExplSDps += sdps;
} }
if (slot.m.type === 'K') { if (slot.m.getDamageType() === 'K') {
totalKinDpe += dpe; totalKinDpe += dpe;
totalKinDps += dps; totalKinDps += dps;
totalKinSDps += sdps; totalKinSDps += sdps;
} }
if (slot.m.type === 'T') { if (slot.m.getDamageType() === 'T') {
totalThermDpe += dpe; totalThermDpe += dpe;
totalThermDps += dps; totalThermDps += dps;
totalThermSDps += sdps; totalThermSDps += sdps;
} }
if (slot.m.type === 'EK') { if (slot.m.getDamageType() === 'EK') {
totalExplDpe += dpe / 2; totalExplDpe += dpe / 2;
totalKinDpe += dpe / 2; totalKinDpe += dpe / 2;
totalExplDps += dps / 2; totalExplDps += dps / 2;
@@ -953,7 +953,7 @@ export default class Ship {
totalExplSDps += sdps / 2; totalExplSDps += sdps / 2;
totalKinSDps += sdps / 2; totalKinSDps += sdps / 2;
} }
if (slot.m.type === 'ET') { if (slot.m.getDamageType() === 'ET') {
totalExplDpe += dpe / 2; totalExplDpe += dpe / 2;
totalThermDpe += dpe / 2; totalThermDpe += dpe / 2;
totalExplDps += dps / 2; totalExplDps += dps / 2;
@@ -961,7 +961,7 @@ export default class Ship {
totalExplSDps += sdps / 2; totalExplSDps += sdps / 2;
totalThermSDps += sdps / 2; totalThermSDps += sdps / 2;
} }
if (slot.m.type === 'KT') { if (slot.m.getDamageType() === 'KT') {
totalKinDpe += dpe / 2; totalKinDpe += dpe / 2;
totalThermDpe += dpe / 2; totalThermDpe += dpe / 2;
totalKinDps += dps / 2; totalKinDps += dps / 2;