mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Fixed shield proportion calc in defence panel
This commit is contained in:
@@ -102,19 +102,19 @@ export default class Defence extends TranslatedComponent {
|
|||||||
|
|
||||||
// Add effective shield from resistances
|
// Add effective shield from resistances
|
||||||
const rawMj = shield.generator + shield.boosters + shield.cells;
|
const rawMj = shield.generator + shield.boosters + shield.cells;
|
||||||
const explosiveMj = rawMj / shield.explosive.total - rawMj;
|
const explosiveMj = rawMj / (shield.explosive.base) - rawMj;
|
||||||
if (explosiveMj != 0) effectiveShieldExplosiveTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(explosiveMj)}{units.MJ}</div>);
|
if (explosiveMj != 0) effectiveShieldExplosiveTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(explosiveMj)}{units.MJ}</div>);
|
||||||
const kineticMj = rawMj / shield.kinetic.total - rawMj;
|
const kineticMj = rawMj / (shield.kinetic.base) - rawMj;
|
||||||
if (kineticMj != 0) effectiveShieldKineticTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(kineticMj)}{units.MJ}</div>);
|
if (kineticMj != 0) effectiveShieldKineticTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(kineticMj)}{units.MJ}</div>);
|
||||||
const thermalMj = rawMj / shield.thermal.total - rawMj;
|
const thermalMj = rawMj / (shield.thermal.base) - rawMj;
|
||||||
if (thermalMj != 0) effectiveShieldThermalTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(thermalMj)}{units.MJ}</div>);
|
if (thermalMj != 0) effectiveShieldThermalTt.push(<div key='resistance'>{translate('resistance') + ' ' + formats.int(thermalMj)}{units.MJ}</div>);
|
||||||
|
|
||||||
// Add effective shield from power distributor SYS pips
|
// Add effective shield from power distributor SYS pips
|
||||||
if (shield.absolute.sys != 1) {
|
if (shield.absolute.sys != 1) {
|
||||||
effectiveShieldAbsoluteTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.absolute.sys - rawMj)}{units.MJ}</div>);
|
effectiveShieldAbsoluteTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.absolute.total - rawMj)}{units.MJ}</div>);
|
||||||
effectiveShieldExplosiveTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.explosive.sys - rawMj)}{units.MJ}</div>);
|
effectiveShieldExplosiveTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.explosive.total - rawMj / shield.explosive.base)}{units.MJ}</div>);
|
||||||
effectiveShieldKineticTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.kinetic.sys - rawMj)}{units.MJ}</div>);
|
effectiveShieldKineticTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.kinetic.total - rawMj / shield.kinetic.base)}{units.MJ}</div>);
|
||||||
effectiveShieldThermalTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.thermal.sys - rawMj)}{units.MJ}</div>);
|
effectiveShieldThermalTt.push(<div key='power distributor'>{translate('power distributor') + ' ' + formats.int(rawMj / shield.thermal.total - rawMj / shield.thermal.base)}{units.MJ}</div>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -486,6 +486,7 @@ export function shieldMetrics(ship, sys) {
|
|||||||
generator: sgExplosiveDmg,
|
generator: sgExplosiveDmg,
|
||||||
boosters: sgSbExplosiveDmg - sgExplosiveDmg,
|
boosters: sgSbExplosiveDmg - sgExplosiveDmg,
|
||||||
sys: (1 - sysResistance),
|
sys: (1 - sysResistance),
|
||||||
|
base: sgSbExplosiveDmg,
|
||||||
total: sgSbExplosiveDmg * (1 - sysResistance),
|
total: sgSbExplosiveDmg * (1 - sysResistance),
|
||||||
max: sgSbExplosiveDmg * (1 - maxSysResistance),
|
max: sgSbExplosiveDmg * (1 - maxSysResistance),
|
||||||
};
|
};
|
||||||
@@ -496,6 +497,7 @@ export function shieldMetrics(ship, sys) {
|
|||||||
generator: sgKineticDmg,
|
generator: sgKineticDmg,
|
||||||
boosters: sgSbKineticDmg - sgKineticDmg,
|
boosters: sgSbKineticDmg - sgKineticDmg,
|
||||||
sys: (1 - sysResistance),
|
sys: (1 - sysResistance),
|
||||||
|
base: sgSbKineticDmg,
|
||||||
total: sgSbKineticDmg * (1 - sysResistance),
|
total: sgSbKineticDmg * (1 - sysResistance),
|
||||||
max: sgSbKineticDmg * (1 - maxSysResistance),
|
max: sgSbKineticDmg * (1 - maxSysResistance),
|
||||||
};
|
};
|
||||||
@@ -506,6 +508,7 @@ export function shieldMetrics(ship, sys) {
|
|||||||
generator: sgThermalDmg,
|
generator: sgThermalDmg,
|
||||||
boosters: sgSbThermalDmg - sgThermalDmg,
|
boosters: sgSbThermalDmg - sgThermalDmg,
|
||||||
sys: (1 - sysResistance),
|
sys: (1 - sysResistance),
|
||||||
|
base: sgSbThermalDmg,
|
||||||
total: sgSbThermalDmg * (1 - sysResistance),
|
total: sgSbThermalDmg * (1 - sysResistance),
|
||||||
max: sgSbThermalDmg * (1 - maxSysResistance),
|
max: sgSbThermalDmg * (1 - maxSysResistance),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user