diff --git a/ChangeLog.md b/ChangeLog.md index 13eb8550..2429a876 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -19,6 +19,7 @@ * Add 'Hardness' information to ship summary * Add module copy functionality - drag module whilst holding 'alt' to copy * Add base resistances to defence summary tooltip + * Update shield recovery/regeneration calculations #2.2.5 * Calculate rate of fire for multi-burst weapons diff --git a/src/app/components/InternalSlot.jsx b/src/app/components/InternalSlot.jsx index cfa066b4..1bb7bf4b 100644 --- a/src/app/components/InternalSlot.jsx +++ b/src/app/components/InternalSlot.jsx @@ -64,6 +64,8 @@ export default class InternalSlot extends Slot { { showModuleResistances && m.getExplosiveResistance() ?
{translate('explres')}: {formats.pct(m.getExplosiveResistance())}
: null } { showModuleResistances && m.getKineticResistance() ?
{translate('kinres')}: {formats.pct(m.getKineticResistance())}
: null } { showModuleResistances && m.getThermalResistance() ?
{translate('thermres')}: {formats.pct(m.getThermalResistance())}
: null } + { m.getRegenerationRate() ?
{translate('regen')}: {formats.round1(m.getRegenerationRate())}{u.ps}
: null } + { m.getBrokenRegenerationRate() ?
{translate('brokenregen')}: {formats.round1(m.getBrokenRegenerationRate())}{u.ps}
: null } { m && validMods.length > 0 ?
: null } diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 9778fae2..22fd21d9 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -201,13 +201,11 @@ export default class Ship { * @return {Number} Recovery time in seconds */ calcShieldRecovery() { - if (this.shield > 0) { - const sgSlot = this.findInternalByGroup('sg'); - if (sgSlot != null) { - let brokenRegenRate = 1 + sgSlot.m.getModValue('brokenregen') / 10000; - // 50% of shield strength / recovery recharge rate + 15 second delay before recharge starts - return ((this.shield / 2) / (sgSlot.m.recover * brokenRegenRate)) + 15; - } + const shieldGenerator = this.findShieldGenerator(); + if (shieldGenerator) { + const brokenRegenRate = shieldGenerator.getBrokenRegenerationRate(); + // 50% of shield strength / broken recharge rate + 15 second delay before recharge starts + return ((this.shield / 2) / brokenRegenRate) + 15; } return 0; } @@ -219,13 +217,12 @@ export default class Ship { * @return {Number} 50 - 100% Recharge time in seconds */ calcShieldRecharge() { - if (this.shield > 0) { - const sgSlot = this.findInternalByGroup('sg'); - if (sgSlot != null) { - let regenRate = 1 + sgSlot.m.getModValue('regen') / 10000; - // 50% -> 100% recharge time, Bi-Weave shields charge at 1.8 MJ/s - return (this.shield / 2) / ((sgSlot.m.grp == 'bsg' ? 1.8 : 1) * regenRate); - } + const shieldGenerator = this.findShieldGenerator(); + if (shieldGenerator) { + const regenRate = shieldGenerator.getRegenerationRate(); + + // 50% of shield strength / recharge rate + return (this.shield / 2) / regenRate; } return 0; }