diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/components/Info.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/components/Info.tsx index aa13d7507..10e294607 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/components/Info.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/components/Info.tsx @@ -12,6 +12,7 @@ export interface InfoProps { delta?: number; decimals?: number; prefix?: string; + deltaType?: 'higherIsBetter' | 'lowerIsBetter'; } export function Info({ @@ -23,6 +24,7 @@ export function Info({ delta, decimals, prefix, + deltaType = 'higherIsBetter', }: InfoProps) { return ( {delta !== undefined && delta !== 0 && ( <> - 0 ? 'green' : 'tomato'}> + 0 + ? 'green' + : 'tomato' + } + > {decimals !== undefined ? Math.abs(delta).toFixed(decimals) : Math.abs(delta)} - 0 ? 'green' : 'tomato'}> + 0 + ? 'green' + : 'tomato' + } + > {delta > 0 ? : } diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx index d578be26c..4bc4a6045 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx @@ -1,5 +1,6 @@ import { Flex, Heading } from '@radix-ui/themes'; import { use } from 'react'; +import { isExplosive } from '../../../../../../core/blitz/isExplosive'; import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration'; import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions'; import { normalizeBoundingBox } from '../../../../../../core/blitzkrieg/normalizeBoundingBox'; @@ -43,34 +44,91 @@ export function Characteristics() { stockTurret.weight + stockGun.weight; const hasRammer = useEquipment(100); + const hasCalibratedShells = useEquipment(103); + const hasEnhancedGunLayingDrive = useEquipment(104); + const hasSupercharger = useEquipment(107); + const hasVerticalStabilizer = useEquipment(105); + const hasRefinedGun = useEquipment(106); + const hasImprovedAssembly = useEquipment(111); + const hasImprovedOptics = useEquipment(114); + const hasImprovedControl = useEquipment(116); + const hasEngineAccelerator = useEquipment(117); + const hasCamouflageNet = useEquipment(115); + const hasImprovedVerticalStabilizer = useEquipment(122); + const hasImprovedSuspension = useEquipment(123); + + /** + * TODO: + * - Improved Ventilation + */ return ( Survivability - {tank.health + turret.health} + {(tank.health + turret.health) * (hasImprovedAssembly ? 1.06 : 1)} - + {Math.round(engine.fireChance * 100)} - {turret.viewRange} + {turret.viewRange * + (hasImprovedOptics + ? tank.type === 'tankDestroyer' + ? 1.05 + : tank.type === 'heavy' + ? 1.07 + : 1.1 + : 1)} - - {tank.camouflage.still * 100} + + {tank.camouflage.still * + 100 * + (hasCamouflageNet + ? tank.type === 'heavy' + ? 1.03 + : tank.type === 'tankDestroyer' + ? 1.07 + : 1.05 + : 1)} - + {tank.camouflage.moving * 100} - + {tank.camouflage.still * gun.camouflageLoss * 100} - + {tank.camouflage.moving * gun.camouflageLoss * 100} - + {tank.camouflage.onFire * tank.camouflage.still * 100} @@ -124,19 +182,27 @@ export function Characteristics() { )} {gun.type === 'autoReloader' ? ( - gun.reload.map((reload, index) => ( - 0} - name={index > 0 ? `Shell ${index + 1}` : 'Reload on shell 1'} - unit="s" - decimals={2} - > - {reload} - - )) + <> + + {gun.reload.map((reload, index) => ( + + {reload} + + ))} + ) : ( - + {gun.reload * (hasRammer ? 0.93 : 1)} )} @@ -145,14 +211,39 @@ export function Characteristics() { {gun.shells.map((shell) => ( - - {resolveNearPenetration(shell.penetration)} - + <> + + {resolveNearPenetration(shell.penetration) * + (hasCalibratedShells + ? isExplosive(shell.type) + ? 1.1 + : 1.05 + : 1)} + + {typeof shell.penetration !== 'number' && ( + + {(hasSupercharger + ? shell.penetration[1] + + 0.5 * (shell.penetration[0] - shell.penetration[1]) + : shell.penetration[1]) * + (hasCalibratedShells + ? isExplosive(shell.type) + ? 1.1 + : 1.05 + : 1)} + + )} + ))} {gun.shells.map((shell) => ( @@ -184,18 +275,36 @@ export function Characteristics() { indent name={SHELL_NAMES[shell.type]} > - {shell.speed} + {shell.speed * (hasSupercharger ? 1.3 : 1)} ))} - - {gun.aimTime} + + {gun.aimTime * (hasEnhancedGunLayingDrive ? 0.9 : 1)} - - {gun.dispersion.base} + + {gun.dispersion.base * (hasRefinedGun ? 0.9 : 1)} - - {track.dispersion.move} + + {track.dispersion.move * (hasVerticalStabilizer ? 0.85 : 1)} - {track.dispersion.traverse} + {track.dispersion.traverse * (hasVerticalStabilizer ? 0.85 : 1)} - {gun.dispersion.traverse} + {gun.dispersion.traverse * (hasVerticalStabilizer ? 0.85 : 1)} {gun.dispersion.shot} @@ -230,15 +342,18 @@ export function Characteristics() { indent name="Gun damaged" unit="scalar" + deltaType="lowerIsBetter" > {gun.dispersion.damaged} - {gunModelDefinition.pitch.max} + {gunModelDefinition.pitch.max + + (hasImprovedVerticalStabilizer ? 3 : 0)} - {-gunModelDefinition.pitch.min} + {-gunModelDefinition.pitch.min + + (hasImprovedVerticalStabilizer ? 3 : 0)} {gunModelDefinition.pitch.front && ( <> @@ -286,15 +401,41 @@ export function Characteristics() { - {engine.power / weightMt / track.resistance.hard} + {(engine.power / + weightMt / + (track.resistance.hard * (hasImprovedSuspension ? 0.75 : 1))) * + (hasEngineAccelerator + ? tank.type === 'light' || tank.type === 'medium' + ? 1.05 + : 1.07 + : 1)} - {engine.power / weightMt / track.resistance.medium} + {(engine.power / + weightMt / + (track.resistance.medium * (hasImprovedSuspension ? 0.75 : 1))) * + (hasEngineAccelerator + ? tank.type === 'light' || tank.type === 'medium' + ? 1.05 + : 1.07 + : 1)} - {engine.power / weightMt / track.resistance.soft} + {(engine.power / + weightMt / + (track.resistance.soft * (hasImprovedSuspension ? 0.75 : 1))) * + (hasEngineAccelerator + ? tank.type === 'light' || tank.type === 'medium' + ? 1.05 + : 1.07 + : 1)} - + {weightMt} @@ -302,19 +443,22 @@ export function Characteristics() { {(engine.power / stockEngine.power) * track.traverseSpeed * (track.resistance.hard / track.resistance.hard) * - (stockWeight / weight)} + (stockWeight / weight) * + (hasImprovedControl ? 1.1 : 1)} {(engine.power / stockEngine.power) * track.traverseSpeed * (track.resistance.hard / track.resistance.medium) * - (stockWeight / weight)} + (stockWeight / weight) * + (hasImprovedControl ? 1.1 : 1)} {(engine.power / stockEngine.power) * track.traverseSpeed * (track.resistance.hard / track.resistance.soft) * - (stockWeight / weight)} + (stockWeight / weight) * + (hasImprovedControl ? 1.1 : 1)}