diff --git a/src/app/components/Defence.jsx b/src/app/components/Defence.jsx index 35fea165..576b65f6 100644 --- a/src/app/components/Defence.jsx +++ b/src/app/components/Defence.jsx @@ -76,6 +76,7 @@ export default class Defence extends TranslatedComponent { shieldSourcesData.push({ value: Math.round(shield.generator), label: translate('generator') }); shieldSourcesData.push({ value: Math.round(shield.boosters), label: translate('boosters') }); shieldSourcesData.push({ value: Math.round(shield.cells), label: translate('cells') }); + shieldSourcesData.push({ value: Math.round(shield.addition), label: translate('shield addition') }); if (shield.generator > 0) { shieldSourcesTt.push(
{translate('generator') + ' ' + formats.int(shield.generator)}{units.MJ}
); diff --git a/src/app/components/InternalSlot.jsx b/src/app/components/InternalSlot.jsx index 2bf0feb8..db3d9c81 100644 --- a/src/app/components/InternalSlot.jsx +++ b/src/app/components/InternalSlot.jsx @@ -63,6 +63,7 @@ export default class InternalSlot extends Slot { { m.getSpinup() ?
{translate('spinup')}: {formats.f1(m.getSpinup())}{u.s}
: null } { m.getDuration() ?
{translate('duration')}: {formats.f1(m.getDuration())}{u.s}
: null } { m.grp === 'scb' ?
{translate('cells')}: {formats.int(m.getAmmo() + 1)}
: null } + { m.grp === 'gsrp' ?
{translate('shield addition')}: {formats.int(m.getShieldAddition())}{u.MJ}
: null } { m.getShieldReinforcement() ?
{translate('shieldreinforcement')}: {formats.f1(m.getDuration() * m.getShieldReinforcement())}{u.MJ}
: null } { m.getShieldReinforcement() ?
{translate('total')}: {formats.int((m.getAmmo() + 1) * (m.getDuration() * m.getShieldReinforcement()))}{u.MJ}
: null } { m.repair ?
{translate('repair')}: {m.repair}
: null } diff --git a/src/app/i18n/en.json b/src/app/i18n/en.json index d028c2a5..2bc67723 100644 --- a/src/app/i18n/en.json +++ b/src/app/i18n/en.json @@ -258,6 +258,7 @@ "generator": "Generator", "boosters": "Boosters", "cells": "Cells", + "shield addition": "Shield Addition", "bulkheads": "Bulkheads", "reinforcement": "Reinforcement", "power and costs": "power and costs", diff --git a/src/app/shipyard/Calculations.js b/src/app/shipyard/Calculations.js index c1990b10..e7e85f98 100644 --- a/src/app/shipyard/Calculations.js +++ b/src/app/shipyard/Calculations.js @@ -60,7 +60,7 @@ export function shieldStrength(mass, baseShield, sg, multiplier) { let ynorm = Math.pow(xnorm, exponent); let mul = minMul + ynorm * (maxMul - minMul); - return baseShield * mul * multiplier; + return (baseShield * mul * multiplier); } /** @@ -358,6 +358,9 @@ export function shieldMetrics(ship, sys) { boosterKinDmg = boosterKinDmg * (1 - slot.m.getKineticResistance()); boosterThermDmg = boosterThermDmg * (1 - slot.m.getThermalResistance()); } + if (slot.m && slot.m.grp == 'gsrp') { + + } } // Calculate diminishing returns for boosters // Diminishing returns not currently in-game @@ -389,12 +392,19 @@ export function shieldMetrics(ship, sys) { // boosterKinDmg = boosterKinDmg > 0.7 ? boosterKinDmg : 0.7 - (0.7 - boosterKinDmg) / 2; // boosterThermDmg = boosterThermDmg > 0.7 ? boosterThermDmg : 0.7 - (0.7 - boosterThermDmg) / 2; // res.therm = res.therm > 0.7 ? res.therm : 0.7 - (0.7 - res.therm) / 2; - - const generatorStrength = this.shieldStrength(ship.hullMass, ship.baseShieldStrength, shieldGenerator, 1); + let shieldAddition = 0; + if (ship) { + for (const module of ship.internal) { + if (module && module.m && module.m.grp === 'gsrp') { + shieldAddition += module.m.getShieldAddition(); + } + } + } + let generatorStrength = this.shieldStrength(ship.hullMass, ship.baseShieldStrength, shieldGenerator, 1); const boostersStrength = generatorStrength * boost; // Recover time is the time taken to go from 0 to 50%. It includes a 16-second wait before shields start to recover - const shieldToRecover = (generatorStrength + boostersStrength) / 2; + const shieldToRecover = (generatorStrength + boostersStrength + shieldAddition) / 2; const powerDistributor = ship.standard[4].m; const sysRechargeRate = this.sysRechargeRate(powerDistributor, sys); @@ -421,7 +431,7 @@ export function shieldMetrics(ship, sys) { } // Recharge time is the time taken to go from 50% to 100% - const shieldToRecharge = (generatorStrength + boostersStrength) / 2; + const shieldToRecharge = (generatorStrength + boostersStrength + shieldAddition) / 2; // Our initial regeneration comes from the SYS capacitor store, which is replenished as it goes // 0.6 is a magic number from FD: each 0.6 MW of energy from the power distributor recharges 1 MJ/s of regeneration @@ -448,8 +458,9 @@ export function shieldMetrics(ship, sys) { shield = { generator: generatorStrength, boosters: boostersStrength, + addition: shieldAddition, cells: ship.shieldCells, - total: generatorStrength + boostersStrength + ship.shieldCells, + total: generatorStrength + boostersStrength + ship.shieldCells + shieldAddition, recover, recharge, }; diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index 193f37d2..285a9ef4 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -649,6 +649,14 @@ export default class Module { return this._getModifiedValue('shieldreinforcement'); } + /** + * Get the shield addition for this module, taking in to account modifications + * @return {Number} the shield addition for this module + */ + getShieldAddition() { + return this._getModifiedValue('shieldaddition'); + } + /** * Get the piercing for this module, taking in to account modifications * @return {Number} the piercing for this module diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 3e81877e..400a46d3 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -239,7 +239,6 @@ export default class Ship { } sg = sgSlot.m; } - // TODO Not accurate if the ship has modified shield boosters return Calc.shieldStrength(this.hullMass, this.baseShieldStrength, sg, 1 + (multiplierDelta || 0)); } @@ -943,7 +942,7 @@ export default class Ship { let armourChange = (slot === this.bulkheads) || (n && n.grp === 'hr') || (old && old.grp === 'hr') || (n && n.grp === 'mrp') || (old && old.grp === 'mrp'); - let shieldChange = (n && n.grp === 'bsg') || (old && old.grp === 'bsg') || (n && n.grp === 'psg') || (old && old.grp === 'psg') || (n && n.grp === 'sg') || (old && old.grp === 'sg') || (n && n.grp === 'sb') || (old && old.grp === 'sb'); + let shieldChange = (n && n.grp === 'bsg') || (old && old.grp === 'bsg') || (n && n.grp === 'psg') || (old && old.grp === 'psg') || (n && n.grp === 'sg') || (old && old.grp === 'sg') || (n && n.grp === 'sb') || (old && old.grp === 'sb') || (old && old.grp === 'gsrp'); let shieldCellsChange = (n && n.grp === 'scb') || (old && old.grp === 'scb'); @@ -1277,7 +1276,7 @@ export default class Ship { // Obtain shield metrics with 0 pips to sys (parts affected by SYS aren't used here) const metrics = Calc.shieldMetrics(this, 0); - this.shield = metrics.generator ? metrics.generator + metrics.boosters : 0; + this.shield = metrics.generator ? metrics.generator + metrics.boosters + metrics.addition : 0; this.shieldExplRes = this.shield > 0 ? 1 - metrics.explosive.total : null; this.shieldKinRes = this.shield > 0 ? 1 - metrics.kinetic.total : null; this.shieldThermRes = this.shield > 0 ? 1 - metrics.thermal.total : null;