feat: rename tank types to tank classes

This commit is contained in:
TrèsAbhi committed 2024-03-07 18:30:02 -06:00
1 parent 3325536bbc
commit 53174db351
18 files changed
+53 -64

No files matched your search

@@ -136,12 +136,13 @@ export function Characteristics() {
]);
const enginePowerCoefficient = coefficient(
[
hasEngineAccelerator && (tank.type === 'lightTank' || tank.type === 'mediumTank'),
hasEngineAccelerator &&
(tank.class === 'lightTank' || tank.class === 'mediumTank'),
0.05,
],
[
hasEngineAccelerator &&
(tank.type === 'heavyTank' || tank.type === 'AT-SPG'),
(tank.class === 'heavyTank' || tank.class === 'AT-SPG'),
0.07,
],
[hasEnginePowerBoost, 0.2],
@@ -163,7 +164,7 @@ export function Characteristics() {
const viewRangeCoefficient =
coefficient([
hasImprovedOptics,
tank.type === 'AT-SPG' ? 0.05 : tank.type === 'heavyTank' ? 0.07 : 0.1,
tank.class === 'AT-SPG' ? 0.05 : tank.class === 'heavyTank' ? 0.07 : 0.1,
]) * coefficient([true, progressiveStat(commanderMastery)]);
const fireChanceCoefficient = coefficient([hasProtectiveKit, -0.2]);
@@ -180,38 +181,26 @@ export function Characteristics() {
const camouflageSumMoving = sum(
[
hasCamouflageNet,
tank.type === 'heavyTank'
? 0.03
: tank.type === 'AT-SPG'
? 0.07
: 0.05,
tank.class === 'heavyTank' ? 0.03 : tank.class === 'AT-SPG' ? 0.07 : 0.05,
],
[
camouflage,
tank.type === 'AT-SPG'
? 0.04
: tank.type === 'heavyTank'
? 0.03
: 0.02,
tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02,
],
);
const camouflageSumStill = sum(
[
hasCamouflageNet,
2 *
(tank.type === 'heavyTank'
(tank.class === 'heavyTank'
? 0.03
: tank.type === 'AT-SPG'
: tank.class === 'AT-SPG'
? 0.07
: 0.05),
],
[
camouflage,
tank.type === 'AT-SPG'
? 0.04
: tank.type === 'heavyTank'
? 0.03
: 0.02,
tank.class === 'AT-SPG' ? 0.04 : tank.class === 'heavyTank' ? 0.03 : 0.02,
],
);
@@ -30,7 +30,7 @@ export function Title() {
<img
src={
TREE_TYPE_ICONS[protagonist.tank.treeType][
protagonist.tank.type
protagonist.tank.class
]
}
style={{
@@ -5,7 +5,7 @@ import { Button, DropdownMenu, Flex } from '@radix-ui/themes';
import { use } from 'react';
import { Flag } from '../../../../../../../components/Flag';
import {
TANK_TYPES,
TANK_CLASSES,
TREE_TYPES,
TREE_TYPE_ICONS,
TREE_TYPE_IMAGES,
@@ -121,7 +121,7 @@ export function Options() {
))}
</Flex>
<Flex>
{[...TANK_TYPES].map((type, index) => (
{[...TANK_CLASSES].map((type, index) => (
<Button
key={type}
color={filters.types.includes(type) ? undefined : 'gray'}
@@ -132,9 +132,9 @@ export function Options() {
borderTopLeftRadius: index === 0 ? undefined : 0,
borderBottomLeftRadius: index === 0 ? undefined : 0,
borderTopRightRadius:
index === TANK_TYPES.length - 1 ? undefined : 0,
index === TANK_CLASSES.length - 1 ? undefined : 0,
borderBottomRightRadius:
index === TANK_TYPES.length - 1 ? undefined : 0,
index === TANK_CLASSES.length - 1 ? undefined : 0,
}}
onClick={() =>
mutateTankopediaPersistent((draft) => {
@@ -15,7 +15,7 @@ import {
} from '@radix-ui/themes';
import { go } from 'fuzzysort';
import { use, useEffect, useMemo, useRef, useState } from 'react';
import { TANK_TYPES, TreeType } from '../../../../../components/Tanks';
import { TANK_CLASSES, TreeType } from '../../../../../components/Tanks';
import { resolveNearPenetration } from '../../../../../core/blitz/resolveNearPenetration';
import { asset } from '../../../../../core/blitzkrieg/asset';
import { modelDefinitions } from '../../../../../core/blitzkrieg/modelDefinitions';
@@ -69,7 +69,7 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) {
)
.sort(
(a, b) =>
(TANK_TYPES.indexOf(a.type) - TANK_TYPES.indexOf(b.type)) *
(TANK_CLASSES.indexOf(a.class) - TANK_CLASSES.indexOf(b.class)) *
(sort.direction === 'descending' ? -1 : 1),
)
.sort(
@@ -88,7 +88,7 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) {
: filters.tiers.includes(tank.tier)) &&
(filters.types.length === 0
? true
: filters.types.includes(tank.type)) &&
: filters.types.includes(tank.class)) &&
(filters.treeTypes.length === 0
? true
: filters.treeTypes.includes(tank.treeType)) &&
@@ -843,7 +843,7 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) {
? TANK_ICONS_COLLECTOR
: tank.treeType === 'premium'
? TANK_ICONS_PREMIUM
: TANK_ICONS)[tank.type]
: TANK_ICONS)[tank.class]
}
style={{ width: '1em', height: '1em' }}
/>