feat: module damage

This commit is contained in:
tresabhi committed 2024-11-09 19:22:21 -06:00
1 parent 3b933f2cbc
commit e4a35600a4
4 files changed
+22

No files matched your search

@@ -108,6 +108,14 @@ export function Sort() {
>
Damage
</DropdownMenu.CheckboxItem>
<DropdownMenu.CheckboxItem
checked={tankopediaSort.by === 'fire.moduleDamage'}
onClick={() => {
$tankopediaSort.setKey('by', 'fire.moduleDamage');
}}
>
Module damage
</DropdownMenu.CheckboxItem>
<DropdownMenu.CheckboxItem
checked={tankopediaSort.by === 'fire.shellVelocity'}
onClick={() => {
@@ -47,6 +47,8 @@ export function TankCard({ tank, onSelect }: TankCardProps) {
return shell0.caliber.toFixed(0);
case 'fire.damage':
return shell0.armor_damage.toFixed(0);
case 'fire.moduleDamage':
return shell0.armor_damage.toFixed(0);
case 'fire.dispersionMoving':
return tracks.dispersion_move.toFixed(3);
case 'fire.dispersionStill':
@@ -255,6 +255,16 @@ export const TankSearch = memo<TankSearchProps>(
);
break;
case 'fire.moduleDamage':
sorted = filtered.sort(
(a, b) =>
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
.module_damage -
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
.module_damage,
);
break;
case 'fire.shellVelocity':
sorted = filtered.sort(
(a, b) =>
@@ -6,6 +6,7 @@ export const SORT_UNITS: Record<TankopediaSortBy, string | undefined> = {
'fire.aimTime': 's',
'fire.caliber': 'mm',
'fire.damage': 'hp',
'fire.moduleDamage': 'hp',
'fire.dispersionMoving': 'm',
'fire.dispersionStill': 'm',
'fire.dpm': undefined,
@@ -47,6 +48,7 @@ export const SORT_NAMES = {
'fire.standardPenetration': 'standard penetration',
'fire.premiumPenetration': 'premium penetration',
'fire.damage': 'damage',
'fire.moduleDamage': 'module damage',
'fire.shellVelocity': 'shell velocity',
'fire.shellRange': 'shell range',
'fire.shellCapacity': 'shell capacity',