mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Use damage distribution numbers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -153,7 +153,7 @@ export default class DamageDealt extends TranslatedComponent {
|
||||
}
|
||||
totals.effectiveness = totals.effectiveDps / totalDps;
|
||||
|
||||
return {weapons: weapons, totals: totals};
|
||||
return { weapons, totals };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -59,9 +59,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 == '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.getDamageType() && m.getDamageType().match('K') ? <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span> : ''}
|
||||
{m.getDamageType() && m.getDamageType().match('T') ? <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span> : ''}
|
||||
{m.getDamageType() && m.getDamageType().match('E') ? <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span> : ''}
|
||||
{m.getDamageDist() && m.getDamageDist().K ? <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span> : ''}
|
||||
{m.getDamageDist() && m.getDamageDist().T ? <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span> : ''}
|
||||
{m.getDamageDist() && m.getDamageDist().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 }
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user