Use modifiers when calculating regen rates

This commit is contained in:
Cmdr McDonald
2016-11-02 11:11:45 +00:00
parent 7c71555384
commit c490f97c22
2 changed files with 7 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ export default class Module {
/**
* Get a value for a given modification
* @param {Number} name The name of the modification
* @return {Number} The value of the modification, as a decimal value from -1 to 1
* @return {Number} The value of the modification, as a decimal value where 1 is 100%
*/
getModValue(name) {
return this.mods && this.mods[name] ? this.mods[name] / 10000 : null;
@@ -38,7 +38,7 @@ export default class Module {
/**
* Set a value for a given modification ID
* @param {Number} name The name of the modification
* @param {Number} value The value of the modification, as a decimal value from -1 to 1
* @param {Number} value The value of the modification, as a decimal value where 1 is 100%
*/
setModValue(name, value) {
if (value == null || value == 0) {

View File

@@ -212,8 +212,10 @@ export default class Ship {
*/
calcShieldRecovery() {
if (this.shieldStrength && this.sgSlot) {
let brokenRegenRate = 1 + this.sgSlot.m.getModValue('brokenregen');
console.log('Broken regen rate is ' + brokenRegenRate);
// 50% of shield strength / recovery recharge rate + 15 second delay before recharge starts
return ((this.shieldStrength / 2) / this.sgSlot.m.recover) + 15;
return ((this.shieldStrength / 2) / (this.sgSlot.m.recover * brokenRegenRate)) + 15;
}
return 0;
}
@@ -226,8 +228,9 @@ export default class Ship {
*/
calcShieldRecharge() {
if (this.shieldStrength && this.sgSlot) {
let regenRate = 1 + this.sgSlot.m.getModValue('regen');
// 50% -> 100% recharge time, Bi-Weave shields charge at 1.8 MJ/s
return (this.shieldStrength / 2) / (this.sgSlot.m.grp == 'bsg' ? 1.8 : 1);
return (this.shieldStrength / 2) / ((this.sgSlot.m.grp == 'bsg' ? 1.8 : 1) * regenRate);
}
return 0;
}