Handle no shield

This commit is contained in:
Felix Linker
2020-10-31 13:02:51 +01:00
parent 14453f6b80
commit d006bbcb0f

View File

@@ -65,15 +65,13 @@ export default class ShipSummaryTable extends TranslatedComponent {
muted: !shieldGenerator, muted: !shieldGenerator,
}); });
const sgTooltip = shieldGenerator ? 'TT_SUMMARY_SHIELDS' : 'TT_SUMMARY_SHIELDS_NONFUNCTIONAL'; const sgTooltip = shieldGenerator ? 'TT_SUMMARY_SHIELDS' : 'TT_SUMMARY_SHIELDS_NONFUNCTIONAL';
let shieldColour; const sgType = shieldGenerator ? shieldGenerator.readMeta('type') : undefined;
switch (shieldGenerator.readMeta('type')) { let shieldColour = 'blue';
switch (sgType) {
case 'biweaveshieldgen': shieldColour = 'purple'; break; case 'biweaveshieldgen': shieldColour = 'purple'; break;
case 'prismaticshieldgen': shieldColour = 'green'; break; case 'prismaticshieldgen': shieldColour = 'green'; break;
default: shieldColour = 'blue';
} }
this.state = { this.state = { shieldColour };
shieldColour
};
const jumpRangeMetrics = ship.getMetrics(JUMP_METRICS); const jumpRangeMetrics = ship.getMetrics(JUMP_METRICS);
// TODO: // TODO:
@@ -227,7 +225,7 @@ export default class ShipSummaryTable extends TranslatedComponent {
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{translate(shieldGenerator.readMeta('type') || 'No Shield')}</td> <td>{translate(sgType || 'No Shield')}</td>
<td>{formats.pct1(1 - sgMetrics.explosive.damageMultiplier)}</td> <td>{formats.pct1(1 - sgMetrics.explosive.damageMultiplier)}</td>
<td>{formats.pct1(1 - sgMetrics.kinetic.damageMultiplier)}</td> <td>{formats.pct1(1 - sgMetrics.kinetic.damageMultiplier)}</td>
<td>{formats.pct1(1 - sgMetrics.thermal.damageMultiplier)}</td> <td>{formats.pct1(1 - sgMetrics.thermal.damageMultiplier)}</td>