mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-19 20:03:51 +01:00
feat: test stats
This commit is contained in:
1 parent
aa93ae6918
commit
8d1745d47e
12 files changed
+170
-31
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { Heading } from '@radix-ui/themes';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import {
|
||||
mutateTankopediaTemporary,
|
||||
useTankopediaTemporary,
|
||||
} from '../../../../../../../stores/tankopedia';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Camouflage() {
|
||||
const camouflage = useTankopediaTemporary((state) => state.camouflage);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">Camouflage</Heading>
|
||||
|
||||
<ModuleButton
|
||||
selected={camouflage}
|
||||
first
|
||||
last
|
||||
type="camouflage"
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
draft.camouflage = !camouflage;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
interface ConfigurationChildWrapperProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function ConfigurationChildWrapper({
|
||||
children,
|
||||
}: ConfigurationChildWrapperProps) {
|
||||
return (
|
||||
<Flex direction="column" gap="2" align="end" style={{ width: '100%' }}>
|
||||
{children}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { Flex, Heading, Text } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import { checkConsumableProvisionInclusivity } from '../../../../../../../core/blitzkrieg/checkConsumableInclusivity';
|
||||
import { consumableDefinitions } from '../../../../../../../core/blitzkrieg/consumableDefinitions';
|
||||
import { useDuel } from '../../../../../../../stores/duel';
|
||||
import {
|
||||
mutateTankopediaTemporary,
|
||||
useTankopediaTemporary,
|
||||
} from '../../../../../../../stores/tankopedia';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Consumables() {
|
||||
const protagonist = useDuel((state) => state.protagonist!);
|
||||
const awaitedConsumableDefinitions = use(consumableDefinitions);
|
||||
const consumables = useTankopediaTemporary((state) => state.consumables);
|
||||
const consumablesList = Object.values(awaitedConsumableDefinitions).filter(
|
||||
(consumable) =>
|
||||
checkConsumableProvisionInclusivity(
|
||||
consumable,
|
||||
protagonist.tank,
|
||||
protagonist.gun,
|
||||
),
|
||||
);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">
|
||||
Consumables{' '}
|
||||
<Text color="gray">(max {protagonist.tank.consumables})</Text>
|
||||
</Heading>
|
||||
|
||||
<Flex>
|
||||
{consumablesList.map((consumable, index) => {
|
||||
const selected = consumables.includes(consumable.id);
|
||||
|
||||
return (
|
||||
<ModuleButton
|
||||
first={index === 0}
|
||||
last={index === consumablesList.length - 1}
|
||||
rowChild
|
||||
type="consumable"
|
||||
disabled={
|
||||
protagonist.tank.consumables === consumables.length && !selected
|
||||
}
|
||||
consumable={consumable.id}
|
||||
selected={selected}
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
if (selected) {
|
||||
draft.consumables = draft.consumables.filter(
|
||||
(id) => id !== consumable.id,
|
||||
);
|
||||
} else {
|
||||
draft.consumables.push(consumable.id);
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Flex, Heading, Slider, TextField } from '@radix-ui/themes';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Crew() {
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">Crew</Heading>
|
||||
|
||||
<Flex
|
||||
align="center"
|
||||
gap="4"
|
||||
style={{
|
||||
width: '100%',
|
||||
}}
|
||||
justify="end"
|
||||
>
|
||||
<Slider
|
||||
min={50}
|
||||
max={100}
|
||||
defaultValue={[100]}
|
||||
style={{ flex: 1, maxWidth: 208 }}
|
||||
/>
|
||||
<TextField.Root style={{ width: 64 }}>
|
||||
<TextField.Input defaultValue={100} />
|
||||
<TextField.Slot>%</TextField.Slot>
|
||||
</TextField.Root>
|
||||
</Flex>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import { equipmentDefinitions } from '../../../../../../../core/blitzkrieg/equipmentDefinitions';
|
||||
import { useDuel } from '../../../../../../../stores/duel';
|
||||
import {
|
||||
mutateTankopediaTemporary,
|
||||
useTankopediaTemporary,
|
||||
} from '../../../../../../../stores/tankopedia';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Equipments() {
|
||||
const protagonist = useDuel((state) => state.protagonist!);
|
||||
const awaitedEquipmentDefinitions = use(equipmentDefinitions);
|
||||
const equipmentRows =
|
||||
awaitedEquipmentDefinitions.presets[protagonist.tank.equipment];
|
||||
const equipmentMatrix = useTankopediaTemporary(
|
||||
(state) => state.equipmentMatrix,
|
||||
);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">Equipments</Heading>
|
||||
|
||||
<Flex direction="column" gap="2">
|
||||
{equipmentRows.map((equipmentRow, rowIndex) => (
|
||||
<Flex gap="2" key={rowIndex}>
|
||||
{equipmentRow.map((equipment, columnIndex) => (
|
||||
<Flex key={columnIndex}>
|
||||
<ModuleButton
|
||||
type="equipment"
|
||||
equipment={equipment[0]}
|
||||
first
|
||||
rowChild
|
||||
selected={equipmentMatrix[rowIndex][columnIndex] === -1}
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
if (equipmentMatrix[rowIndex][columnIndex] === -1) {
|
||||
draft.equipmentMatrix[rowIndex][columnIndex] = 0;
|
||||
} else {
|
||||
draft.equipmentMatrix[rowIndex][columnIndex] = -1;
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<ModuleButton
|
||||
type="equipment"
|
||||
equipment={equipment[1]}
|
||||
last
|
||||
rowChild
|
||||
selected={equipmentMatrix[rowIndex][columnIndex] === 1}
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
if (equipmentMatrix[rowIndex][columnIndex] === 1) {
|
||||
draft.equipmentMatrix[rowIndex][columnIndex] = 0;
|
||||
} else {
|
||||
draft.equipmentMatrix[rowIndex][columnIndex] = 1;
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
))}
|
||||
</Flex>
|
||||
))}
|
||||
</Flex>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Flex, Text } from '@radix-ui/themes';
|
||||
import { theme } from '../../../../../../../stitches.config';
|
||||
|
||||
interface InfoProps {
|
||||
name: string;
|
||||
value: string;
|
||||
unit: string;
|
||||
indent?: boolean;
|
||||
}
|
||||
|
||||
export function Info({ name, value, unit, indent = false }: InfoProps) {
|
||||
return (
|
||||
<Flex
|
||||
align="center"
|
||||
style={{ width: '100%', paddingLeft: indent ? 24 : 0 }}
|
||||
gap="4"
|
||||
>
|
||||
<Text>
|
||||
{name}{' '}
|
||||
<Text color="gray" size="1">
|
||||
{unit}
|
||||
</Text>
|
||||
</Text>
|
||||
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
height: 1,
|
||||
backgroundColor: theme.colors.componentCallToActionInteractive_alpha,
|
||||
}}
|
||||
/>
|
||||
|
||||
<Text>{value}</Text>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import { TIER_ROMAN_NUMERALS } from '../../../../../../../core/blitzkrieg/tankDefinitions';
|
||||
import { mutateDuel, useDuel } from '../../../../../../../stores/duel';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Modules() {
|
||||
const protagonist = useDuel((state) => state.protagonist!);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">Modules</Heading>
|
||||
|
||||
<Flex gap="2">
|
||||
<Flex>
|
||||
{protagonist.tank.turrets.map((thisTurret, index) => {
|
||||
return (
|
||||
<ModuleButton
|
||||
key={thisTurret.id}
|
||||
selected={protagonist.turret.id === thisTurret.id}
|
||||
type="module"
|
||||
module="turret"
|
||||
discriminator={TIER_ROMAN_NUMERALS[thisTurret.tier]}
|
||||
first={index === 0}
|
||||
last={index === protagonist.tank.turrets.length - 1}
|
||||
rowChild
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
draft.protagonist!.turret = thisTurret;
|
||||
draft.protagonist!.gun = thisTurret.guns.at(-1)!;
|
||||
draft.protagonist!.shell =
|
||||
thisTurret.guns.at(-1)!.shells[0];
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
|
||||
<Flex>
|
||||
{protagonist.turret.guns.map((thisGun, index) => {
|
||||
return (
|
||||
<ModuleButton
|
||||
key={thisGun.id}
|
||||
type="module"
|
||||
module="gun"
|
||||
discriminator={TIER_ROMAN_NUMERALS[thisGun.tier]}
|
||||
selected={protagonist.gun.id === thisGun.id}
|
||||
first={index === 0}
|
||||
last={index === protagonist.turret.guns.length - 1}
|
||||
rowChild
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
draft.protagonist!.gun = thisGun;
|
||||
draft.protagonist!.shell = thisGun.shells[0];
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
</Flex>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Flex, Heading, Text } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import { checkConsumableProvisionInclusivity } from '../../../../../../../core/blitzkrieg/checkConsumableInclusivity';
|
||||
import { provisionDefinitions } from '../../../../../../../core/blitzkrieg/provisionDefinitions';
|
||||
import { useDuel } from '../../../../../../../stores/duel';
|
||||
import {
|
||||
mutateTankopediaTemporary,
|
||||
useTankopediaTemporary,
|
||||
} from '../../../../../../../stores/tankopedia';
|
||||
import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
|
||||
|
||||
export function Provisions() {
|
||||
const protagonist = useDuel((state) => state.protagonist!);
|
||||
const awaitedProvisionDefinitions = use(provisionDefinitions);
|
||||
const provisions = useTankopediaTemporary((state) => state.provisions);
|
||||
const provisionsList = Object.values(awaitedProvisionDefinitions).filter(
|
||||
(provision) =>
|
||||
checkConsumableProvisionInclusivity(
|
||||
provision,
|
||||
protagonist.tank,
|
||||
protagonist.gun,
|
||||
),
|
||||
);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
<Heading size="4">
|
||||
Provisions <Text color="gray">(max {protagonist.tank.provisions})</Text>
|
||||
</Heading>
|
||||
|
||||
<Flex>
|
||||
{provisionsList.map((provision, index) => {
|
||||
const selected = provisions.includes(provision.id);
|
||||
|
||||
return (
|
||||
<ModuleButton
|
||||
first={index === 0}
|
||||
last={index === provisionsList.length - 1}
|
||||
rowChild
|
||||
type="provision"
|
||||
disabled={
|
||||
protagonist.tank.provisions === provisions.length && !selected
|
||||
}
|
||||
provision={provision.id}
|
||||
selected={selected}
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
if (selected) {
|
||||
draft.provisions = draft.provisions.filter(
|
||||
(id) => id !== provision.id,
|
||||
);
|
||||
} else {
|
||||
draft.provisions.push(provision.id);
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
</ConfigurationChildWrapper>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Flex } from '@radix-ui/themes';
|
||||
import { Info } from './Info';
|
||||
|
||||
export function Survivability() {
|
||||
return (
|
||||
<Flex>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { Camouflage } from './components/Camouflage';
|
||||
import { Consumables } from './components/Consumables';
|
||||
import { Crew } from './components/Crew';
|
||||
import { Equipments } from './components/Equipments';
|
||||
import { Info } from './components/Info';
|
||||
import { Modules } from './components/Modules';
|
||||
import { Provisions } from './components/Provisions';
|
||||
|
||||
export function Characteristics() {
|
||||
return (
|
||||
<Flex gap="4" direction="column">
|
||||
<Flex gap="8">
|
||||
<Flex
|
||||
style={{ flex: 1 }}
|
||||
wrap="wrap"
|
||||
direction="column"
|
||||
gap="4"
|
||||
align="end"
|
||||
>
|
||||
<Heading>Configure</Heading>
|
||||
|
||||
<Modules />
|
||||
<Equipments />
|
||||
<Crew />
|
||||
<Consumables />
|
||||
<Provisions />
|
||||
<Camouflage />
|
||||
</Flex>
|
||||
|
||||
<Flex style={{ flex: 1 }} wrap="wrap" direction="column" gap="4">
|
||||
<Heading>Statistics</Heading>
|
||||
|
||||
<Flex direction="column" gap="6">
|
||||
<Flex direction="column" gap="2">
|
||||
<Heading size="4">Survivability</Heading>
|
||||
<Info name="Health" value="2014" unit="hp" />
|
||||
</Flex>
|
||||
|
||||
<Flex direction="column" gap="2">
|
||||
<Heading size="4">Lethality</Heading>
|
||||
<Info name="Armor damage" value="330" unit="hp" />
|
||||
<Info indent name="Module damage" value="125" unit="hp" />
|
||||
<Info indent name="Caliber" value="100" unit="mm" />
|
||||
<Info name="Penetration" value="257" unit="mm" />
|
||||
<Info indent name="At 500m" value="240" unit="mm" />
|
||||
<Info name="Damage per minute" value="2316" unit="hp / min" />
|
||||
<Info indent name="Maximum" value="2316" unit="hp / min" />
|
||||
<Info
|
||||
indent
|
||||
name="Effective at 60s"
|
||||
value="2316"
|
||||
unit="hp / min"
|
||||
/>
|
||||
<Info name="Reload" value="5.73" unit="s" />
|
||||
<Info name="Shell velocity" value="1535" unit="m/s" />
|
||||
<Info name="Aim time" value="1.72" unit="s" />
|
||||
<Info name="Dispersion" value="0.326" unit="m" />
|
||||
<Info indent name="On move" value="0.100" unit="m" />
|
||||
<Info indent name="On hull traverse" value="0.100" unit="m" />
|
||||
<Info indent name="On turret traverse" value="0.070" unit="m" />
|
||||
<Info indent name="On shoot" value="3.500" unit="m" />
|
||||
</Flex>
|
||||
|
||||
<Flex direction="column" gap="2">
|
||||
<Heading size="4">Flexibility</Heading>
|
||||
<Info name="Gun depression" value="20" unit="°" />
|
||||
<Info indent name="Elevation" value="7" unit="°" />
|
||||
<Info indent name="Azimuth" value="30, 30" unit="°" />
|
||||
</Flex>
|
||||
|
||||
<Flex direction="column" gap="2">
|
||||
<Heading size="4">Mobility</Heading>
|
||||
<Info name="Weight" value="45" unit="mt" />
|
||||
<Info name="Speed forwards" value="55" unit="km/s" />
|
||||
<Info indent name="Backward" value="20" unit="km/s" />
|
||||
<Info
|
||||
name="Effective power on hard terrain"
|
||||
value="36.86"
|
||||
unit="hp/kg"
|
||||
/>
|
||||
<Info
|
||||
indent
|
||||
name="On medium terrain"
|
||||
value="36.86"
|
||||
unit="hp/kg"
|
||||
/>
|
||||
<Info indent name="On soft terrain" value="36.86" unit="hp/kg" />
|
||||
<Info
|
||||
name="Traverse speed on hard terrain"
|
||||
value="36.86"
|
||||
unit="°/s"
|
||||
/>
|
||||
<Info indent name="On medium terrain" value="36.86" unit="°/s" />
|
||||
<Info indent name="On soft terrain" value="36.86" unit="°/s" />
|
||||
</Flex>
|
||||
|
||||
<Flex direction="column" gap="2">
|
||||
<Heading size="4">Stealth</Heading>
|
||||
<Info name="View range" value="302" unit="m" />
|
||||
<Info name="Size" value="6.21 x 2.43 x 2.00" unit="m" />
|
||||
<Info name="Camouflage when still" value="30.00" unit="%" />
|
||||
<Info indent name="When moving" value="30.00" unit="%" />
|
||||
<Info indent name="When shooting still" value="30.00" unit="%" />
|
||||
<Info
|
||||
indent
|
||||
name="When shooting while moving"
|
||||
value="30.00"
|
||||
unit="%"
|
||||
/>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user