diff --git a/src/app/components/HardpointSlot.jsx b/src/app/components/HardpointSlot.jsx
index ede05551..11c1b0f4 100644
--- a/src/app/components/HardpointSlot.jsx
+++ b/src/app/components/HardpointSlot.jsx
@@ -59,7 +59,7 @@ export default class HardpointSlot extends Slot {
{ m.getDps() ?
{translate('DPS')}: {formats.round1(m.getDps())} { m.getClip() ? ({formats.round1((m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }) : null }
: null }
{ m.getEps() ? {translate('EPS')}: {formats.round1(m.getEps())}{u.MW} { m.getClip() ? ({formats.round1((m.getClip() * m.getEps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }{u.MW}) : null }
: null }
{ m.getHps() ? {translate('HPS')}: {formats.round1(m.getHps())} { m.getClip() ? ({formats.round1((m.getClip() * m.getHps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }) : null }
: null }
- { m.getDps() && m.getEps() ? {translate('DPE')}: {formats.round1(m.getDps() / m.getEps())}
: null }
+ { m.getDps() && m.getEps() ? {translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}
: null }
{ m.getRoF() ? {translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}
: null }
{ m.getRange() && !m.getDps() ? {translate('Range')} : {formats.round(m.getRange() / 1000)}{u.km}
: null }
{ m.getShieldMul() ? +{formats.rPct(m.getShieldMul())}
: null }
diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js
index 5bc804b0..d97b7580 100755
--- a/src/app/shipyard/Module.js
+++ b/src/app/shipyard/Module.js
@@ -129,39 +129,6 @@ export default class Module {
return this._getModifiedValue('optmult');
}
- /**
- * Get the damage per second for this module, taking in to account modifications
- * @return {Number} the damage per second of this module
- */
- getDamagePerSecond() {
- return this._getModifiedValue('dps');
- }
-
- /**
- * Get the energy per second for this module, taking in to account modifications
- * @return {Number} the energy per second of this module
- */
- getEnergyPerSecond() {
- return this._getModifiedValue('eps');
- }
-
- /**
- * Get the heat per second for this module, taking in to account modifications
- * @return {Number} the heat per second of this module
- */
- getHeatPerSecond() {
- // Modifier for hps is thermload
- let result = 0;
- if (this['hps']) {
- result = this['hps'];
- if (result) {
- let mult = this.getModValue('thermload');
- if (mult) { result = result * (1 + mult); }
- }
- }
- return result;
- }
-
/**
* Get the maximum fuel per jump for this module, taking in to account modifications
* @return {Number} the maximum fuel per jump of this module
@@ -406,46 +373,78 @@ export default class Module {
return this._getModifiedValue('shieldmul');
}
+ /**
+ * Get the damage for this module, taking in to account modifications
+ * @return {Number} the damage of this module
+ */
+ getDamage() {
+ return this._getModifiedValue('damage');
+ }
+
+ /**
+ * Get the distributor draw for this module, taking in to account modifications
+ * @return {Number} the distributor draw of this module
+ */
+ getDistDraw() {
+ return this._getModifiedValue('distdraw');
+ }
+
+ /**
+ * Get the thermal load for this module, taking in to account modifications
+ * @return {Number} the thermal load of this module
+ */
+ getThermalLoad() {
+ return this._getModifiedValue('thermload');
+ }
+
+ /**
+ * Get the rounds per shot for this module, taking in to account modifications
+ * @return {Number} the rounds per shot of this module
+ */
+ getRoundsPerShot() {
+ return this._getModifiedValue('roundspershot');
+ }
/**
* Get the DPS for this module, taking in to account modifications
* @return {Number} the DPS of this module
*/
getDps() {
- // Modifications are not made to DPS directly, but to damage and rate of fire
-
- // Obtain unmodified rate of fire
- let rof = this['rof'];
+ // DPS is a synthetic value
+ let damage = this.getDamage();
+ let rpshot = this.getRoundsPerShot() || 1;
+ let rof = this.getRoF();
- // Obtain unmodified damage
- let damage = this['dps'] / rof;
-
- // Obtain modified rate of fire
- let modRof = this._getModifiedValue('rof');
-
- // Obtain modified damage
- let damageMult = this.getModValue('damage');
- let modDamage = damageMult ? damage * (1 + damageMult) : damage;
-
- return modDamage * modRof;
+ return damage * rpshot * rof;
}
/**
- * Get the heat generated per second for this module, taking in to account modifications
- * @return {Number} the heat generated per second of this module
- */
- getHps() {
- // TODO this is not correct; need to include other factors such as rate of fire, damage, etc.
- return this._getModifiedValue('hps');
- }
-
- /**
- * Get the energy used per second for this module, taking in to account modifications
- * @return {Number} the energy used per second of this module
+ * Get the EPS for this module, taking in to account modifications
+ * @return {Number} the EPS of this module
*/
getEps() {
- // TODO this is not correct; need to include other factors such as rate of fire, damage, etc.
- return this._getModifiedValue('eps');
+ // EPS is a synthetic value
+ let distdraw = this.getDistDraw();
+ console.log('distdraw is ' + distdraw);
+ let rpshot = this.getRoundsPerShot() || 1;
+ console.log('rpshot is ' + rpshot);
+ let rof = this.getRoF();
+ console.log('rof is ' + rof);
+
+ return distdraw * rpshot * rof;
+ }
+
+ /**
+ * Get the HPS for this module, taking in to account modifications
+ * @return {Number} the HPS of this module
+ */
+ getHps() {
+ // HPS is a synthetic value
+ let heat = this.getThermalLoad();
+ let rpshot = this.getRoundsPerShot() || 1;
+ let rof = this.getRoF();
+
+ return heat * rpshot * rof;
}
/**
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index 16a6aa43..d9b5c2b5 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -704,14 +704,14 @@ export default class Ship {
if (ModuleUtils.isShieldGenerator(slot.m.grp) || slot.m.grp == 'sb') {
this.updateShield();
}
- if (slot.m.dps) {
- this.totalDps += slot.m.dps * (enabled ? 1 : -1);
+ if (slot.m.getDps()) {
+ this.totalDps += slot.m.getDps() * (enabled ? 1 : -1);
}
- if (slot.m.eps) {
- this.totalEps += slot.m.eps * (enabled ? 1 : -1);
+ if (slot.m.getEps()) {
+ this.totalEps += slot.m.getEps() * (enabled ? 1 : -1);
}
- if (slot.m.hps) {
- this.totalHps += slot.m.hps * (enabled ? 1 : -1);
+ if (slot.m.getHps()) {
+ this.totalHps += slot.m.getHps() * (enabled ? 1 : -1);
}
this.updatePower();
@@ -782,14 +782,14 @@ export default class Ship {
this.priorityBands[slot.priority][powerUsageType(slot, old)] -= old.getPowerUsage();
powerChange = true;
- if (old.dps) {
- this.totalDps -= old.dps;
+ if (old.getDps()) {
+ this.totalDps -= old.getDps();
}
- if (old.eps) {
- this.totalEps -= old.eps;
+ if (old.getEps()) {
+ this.totalEps -= old.getEps();
}
- if (old.hps) {
- this.totalHps -= old.hps;
+ if (old.getHps()) {
+ this.totalHps -= old.getHps();
}
}
this.unladenMass -= old.getMass() || 0;
@@ -813,14 +813,14 @@ export default class Ship {
this.priorityBands[slot.priority][powerUsageType(slot, n)] += n.getPowerUsage();
powerChange = true;
- if (n.dps) {
- this.totalDps += n.dps;
+ if (n.getDps()) {
+ this.totalDps += n.getDps();
}
- if (n.eps) {
- this.totalEps += n.eps;
+ if (n.getEps()) {
+ this.totalEps += n.getEps();
}
- if (n.hps) {
- this.totalHps += n.hps;
+ if (n.getHps()) {
+ this.totalHps += n.getHps();
}
}
this.unladenMass += n.getMass() || 0;