Move to pure damage/distdraw/thermload numbers

This commit is contained in:
Cmdr McDonald
2016-11-03 10:52:54 +00:00
parent ba1f11a88b
commit 6727c2fc13
3 changed files with 79 additions and 80 deletions

View File

@@ -59,7 +59,7 @@ export default class HardpointSlot extends Slot {
{ m.getDps() ? <div className={'l'}>{translate('DPS')}: {formats.round1(m.getDps())} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) })</span> : null }</div> : null }
{ m.getEps() ? <div className={'l'}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getEps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }{u.MW})</span> : null }</div> : null }
{ m.getHps() ? <div className={'l'}>{translate('HPS')}: {formats.round1(m.getHps())} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getHps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) })</span> : null }</div> : null }
{ m.getDps() && m.getEps() ? <div className={'l'}>{translate('DPE')}: {formats.round1(m.getDps() / m.getEps())}</div> : null }
{ m.getDps() && m.getEps() ? <div className={'l'}>{translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}</div> : null }
{ m.getRoF() ? <div className={'l'}>{translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}</div> : null }
{ m.getRange() && !m.getDps() ? <div className={'l'}>{translate('Range')} : {formats.round(m.getRange() / 1000)}{u.km}</div> : null }
{ m.getShieldMul() ? <div className={'l'}>+{formats.rPct(m.getShieldMul())}</div> : null }

View File

@@ -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;
}
/**

View File

@@ -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;