feat: stats organization

This commit is contained in:
TrèsAbhi committed 2024-02-01 12:06:13 -06:00
1 parent 9f2ced6bfd
commit e9c3953085
2 files changed
+62 -64

No files matched your search

@@ -4,7 +4,7 @@ import { theme } from '../../../../../../../stitches.config';
interface InfoProps { interface InfoProps {
name: string; name: string;
children: ReactNode; children?: ReactNode;
unit?: string; unit?: string;
indent?: boolean; indent?: boolean;
highlight?: boolean; highlight?: boolean;
@@ -35,17 +35,21 @@ export function Info({
)} )}
</Text> </Text>
<div {children !== undefined && (
style={{ <div
flex: 1, style={{
height: 1, flex: 1,
backgroundColor: highlight height: 1,
? theme.colors.componentCallToActionInteractive_amberAlpha backgroundColor: highlight
: theme.colors.componentCallToActionInteractive_alpha, ? theme.colors.componentCallToActionInteractive_amberAlpha
}} : theme.colors.componentCallToActionInteractive_alpha,
/> }}
/>
)}
<Text color={highlight ? 'amber' : undefined}>{children}</Text> {children !== undefined && (
<Text color={highlight ? 'amber' : undefined}>{children}</Text>
)}
</Flex> </Flex>
); );
} }
@@ -56,22 +56,23 @@ export function Characteristics() {
<Info name="View range" unit="m"> <Info name="View range" unit="m">
{turret.view_range} {turret.view_range}
</Info> </Info>
<Info name="Camouflage when still" unit="%"> <Info name="Camouflage" unit="%" />
<Info indent name="Still">
{(tank.camouflage.still * 100).toFixed(2)} {(tank.camouflage.still * 100).toFixed(2)}
</Info> </Info>
<Info indent name="Moving" unit="%"> <Info indent name="Moving">
{(tank.camouflage.moving * 100).toFixed(2)} {(tank.camouflage.moving * 100).toFixed(2)}
</Info> </Info>
<Info indent name="Shooting still" unit="%"> <Info indent name="Shooting still">
{(tank.camouflage.still * gun.camouflageLoss * 100).toFixed(2)} {(tank.camouflage.still * gun.camouflageLoss * 100).toFixed(2)}
</Info> </Info>
<Info indent name="Shooting on move" unit="%"> <Info indent name="Shooting on move">
{(tank.camouflage.moving * gun.camouflageLoss * 100).toFixed(2)} {(tank.camouflage.moving * gun.camouflageLoss * 100).toFixed(2)}
</Info> </Info>
<Info indent name="On fire penalty" unit="%"> <Info indent name="On fire">
{(tank.camouflage.onFire * 100).toFixed(2)} {(tank.camouflage.onFire * tank.camouflage.still * 100).toFixed(2)}
</Info> </Info>
<Info indent name="Size" unit="m"> <Info name="Size" unit="m">
{size.map((component) => component.toFixed(2)).join(' x ')} {size.map((component) => component.toFixed(2)).join(' x ')}
</Info> </Info>
</Flex> </Flex>
@@ -79,9 +80,6 @@ export function Characteristics() {
<Flex direction="column" gap="2"> <Flex direction="column" gap="2">
<Heading size="5">Fire</Heading> <Heading size="5">Fire</Heading>
<Info name="Gun type">{GUN_TYPE_NAMES[gun.type]}</Info> <Info name="Gun type">{GUN_TYPE_NAMES[gun.type]}</Info>
<Info name="Damage per minute" unit="hp / min">
{dpm.toFixed(0)}
</Info>
{gun.type === 'auto_reloader' && ( {gun.type === 'auto_reloader' && (
<> <>
<Info indent name="Maximum" unit="hp / min"> <Info indent name="Maximum" unit="hp / min">
@@ -107,91 +105,84 @@ export function Characteristics() {
{gun.reload.toFixed(2)} {gun.reload.toFixed(2)}
</Info> </Info>
)} )}
<Info name="Damage per minute" unit="hp / min">
{dpm.toFixed(0)}
</Info>
<Info name="Caliber" unit="mm"> <Info name="Caliber" unit="mm">
{shell.caliber} {shell.caliber}
</Info> </Info>
{gun.shells.map((shell, index) => ( <Info name="Penetration" unit="mm" />
<Info {gun.shells.map((shell) => (
indent={index > 0} <Info indent name={SHELL_NAMES[shell.type]}>
name={`${SHELL_NAMES[shell.type]}${index === 0 ? ' penetration' : ''}`}
unit="mm"
>
{resolveNearPenetration(shell.penetration)} {resolveNearPenetration(shell.penetration)}
</Info> </Info>
))} ))}
{gun.shells.map((shell, index) => ( <Info name="Damage" unit="hp" />
<Info {gun.shells.map((shell) => (
indent={index > 0} <Info indent name={SHELL_NAMES[shell.type]}>
name={`${SHELL_NAMES[shell.type]}${index === 0 ? ' damage' : ''}`}
unit="hp"
>
{shell.damage.armor} {shell.damage.armor}
</Info> </Info>
))} ))}
<Info name="Module damage" unit="hp" />
{gun.shells.map((shell, index) => ( {gun.shells.map((shell, index) => (
<Info <Info indent name={SHELL_NAMES[shell.type]}>
indent={index > 0}
name={`${SHELL_NAMES[shell.type]}${index === 0 ? ' module damage' : ''}`}
unit="hp"
>
{shell.damage.module} {shell.damage.module}
</Info> </Info>
))} ))}
<Info name="Shell velocity" unit="m/s" />
{gun.shells.map((shell, index) => ( {gun.shells.map((shell, index) => (
<Info <Info indent name={SHELL_NAMES[shell.type]}>
indent={index > 0}
name={`${SHELL_NAMES[shell.type]}${index === 0 ? ' velocity' : ''}`}
unit="m/s"
>
{shell.speed} {shell.speed}
</Info> </Info>
))} ))}
<Info name="Aim time" unit="s"> <Info name="Aim time" unit="s">
TODO TODO
</Info> </Info>
<Info name="Dispersion at 100m" unit="m"> <Info name="Dispersion at 100m" unit="m" />
<Info indent name="Still">
TODO TODO
</Info> </Info>
<Info indent name="On move" unit="m"> <Info indent name="Moving">
TODO TODO
</Info> </Info>
<Info indent name="On hull traverse" unit="m"> <Info indent name="Hull traversing">
TODO TODO
</Info> </Info>
<Info indent name="On turret traverse" unit="m"> <Info indent name="Turret traversing">
TODO TODO
</Info> </Info>
<Info indent name="On shoot" unit="m"> <Info indent name="After shooting">
TODO TODO
</Info> </Info>
<Info name="Gun depression" unit="°"> <Info name="Gun flexibility" unit="°" />
<Info indent name="Depression">
{gunModelDefinition.pitch.max} {gunModelDefinition.pitch.max}
</Info> </Info>
<Info indent name="Elevation" unit="°"> <Info indent name="Elevation">
{-gunModelDefinition.pitch.min} {-gunModelDefinition.pitch.min}
</Info> </Info>
{gunModelDefinition.pitch.front && ( {gunModelDefinition.pitch.front && (
<> <>
<Info indent name="Frontal depression" unit="°"> <Info indent name="Frontal depression">
{gunModelDefinition.pitch.front.max} {gunModelDefinition.pitch.front.max}
</Info> </Info>
<Info indent name="Frontal elevation" unit="°"> <Info indent name="Frontal elevation">
{-gunModelDefinition.pitch.front.min} {-gunModelDefinition.pitch.front.min}
</Info> </Info>
</> </>
)} )}
{gunModelDefinition.pitch.back && ( {gunModelDefinition.pitch.back && (
<> <>
<Info indent name="Rear depression" unit="°"> <Info indent name="Rear depression">
{gunModelDefinition.pitch.back.max} {gunModelDefinition.pitch.back.max}
</Info> </Info>
<Info indent name="Rear elevation" unit="°"> <Info indent name="Rear elevation">
{-gunModelDefinition.pitch.back.min} {-gunModelDefinition.pitch.back.min}
</Info> </Info>
</> </>
)} )}
{turretModelDefinition.yaw && ( {turretModelDefinition.yaw && (
<Info indent name="Azimuth" unit="°"> <Info indent name="Azimuth">
{-turretModelDefinition.yaw.min}, {turretModelDefinition.yaw.max} {-turretModelDefinition.yaw.min}, {turretModelDefinition.yaw.max}
</Info> </Info>
)} )}
@@ -199,34 +190,37 @@ export function Characteristics() {
<Flex direction="column" gap="2"> <Flex direction="column" gap="2">
<Heading size="5">Maneuverability</Heading> <Heading size="5">Maneuverability</Heading>
<Info name="Speed forwards" unit="km/s"> <Info name="Speed" unit="km/s" />
<Info indent name="Forwards">
TODO TODO
</Info> </Info>
<Info indent name="Average" unit="km/s"> <Info indent name="Average">
TODO TODO
</Info> </Info>
<Info indent name="Backwards" unit="km/s"> <Info indent name="Backwards">
TODO TODO
</Info> </Info>
<Info name="Effective power on hard terrain" unit="hp/kg"> <Info name="Power to weight ratio" unit="hp/kg" />
<Info indent name="On hard terrain">
TODO TODO
</Info> </Info>
<Info indent name="On medium terrain" unit="hp/kg"> <Info indent name="On medium terrain">
TODO TODO
</Info> </Info>
<Info indent name="On soft terrain" unit="hp/kg"> <Info indent name="On soft terrain">
TODO TODO
</Info> </Info>
<Info name="Weight" unit="mt"> <Info name="Weight" unit="mt">
TODO TODO
</Info> </Info>
<Info name="Traverse speed on hard terrain" unit="°/s"> <Info name="Traverse speed" unit="°/s" />
<Info indent name="On hard terrain">
TODO TODO
</Info> </Info>
<Info indent name="On medium terrain" unit="°/s"> <Info indent name="On medium terrain">
TODO TODO
</Info> </Info>
<Info indent name="On soft terrain" unit="°/s"> <Info indent name="On soft terrain">
TODO TODO
</Info> </Info>
</Flex> </Flex>