Move sustained factor calculation into own function

Closes #517
This commit is contained in:
Felix Linker
2019-08-24 14:16:03 +02:00
parent af37c2bfc5
commit 4f1e32b154
2 changed files with 16 additions and 8 deletions

View File

@@ -818,12 +818,11 @@ export default class Module {
}
/**
* Get the SDPS for this module
* Return the factor that gets applied when calculating certain "sustained"
* values, e.g. `SDPS = this.getSustainedFactor() * DPS`.
* @param {Boolean} [modified=true] Whether to take modifications into account
* @return {Number} The SDPS of this module
*/
getSDps(modified = true) {
let dps = this.getDps(modified);
getSustainedFactor(modified = true) {
let clipSize = this.getClip(modified);
if (clipSize) {
// If auto-loader is applied, effective clip size will be nearly doubled
@@ -838,12 +837,21 @@ export default class Module {
// rof we need to take another burst without pause into account
let burstOverhead = (burstSize - 1) / (this.get('burstrof', modified) || 1);
let srof = clipSize / ((clipSize - burstSize) / rof + burstOverhead + this.getReload(modified));
return dps * srof / rof;
return srof / rof;
} else {
return dps;
return 1;
}
}
/**
* Get the SDPS for this module
* @param {Boolean} [modified=true] Whether to take modifications into account
* @return {Number} The SDPS of this module
*/
getSDps(modified = true) {
return this.getDps(modified) * this.getSustainedFactor(modified);
}
/**
* Get the EPS for this module
* @param {Boolean} [modified=true] Whether to take modifications into account