feat: more stats 3

This commit is contained in:
TrèsAbhi committed 2024-04-04 22:14:30 -05:00
1 parent b929e9449d
commit ad57d284bb
5 files changed
+104 -30

No files matched your search

+77 -7
View File
@@ -149,7 +149,7 @@ export default function Page() {
index === 0 ||
value === undefined ||
values[0] === undefined ||
value > values[0]
value === values[0]
? undefined
: (
deltaType === 'higherIsBetter'
@@ -223,12 +223,7 @@ export default function Page() {
{members.length > 0 && (
<Flex justify="center">
<Table.Root
variant="surface"
style={{
maxWidth: '100%',
}}
>
<Table.Root variant="surface" style={{ maxWidth: '100%' }}>
<Table.Header>
<Table.Row>
<Table.ColumnHeaderCell />
@@ -348,6 +343,81 @@ export default function Page() {
value="gunElevation"
display={(stats) => stats.gunElevation.toFixed(1)}
/>
<Row name="Speed forwards" value="speedForwards" />
<Row name="Speed backwards" value="speedBackwards" />
<Row name="Engine power" value="enginePower" />
<Row
name="Power to weight ratio on hard terrain"
value="powerToWeightRatioHardTerrain"
display={(stats) =>
stats.powerToWeightRatioHardTerrain.toFixed(1)
}
/>
<Row
name="Power to weight ratio on medium terrain"
value="powerToWeightRatioMediumTerrain"
display={(stats) =>
stats.powerToWeightRatioMediumTerrain.toFixed(1)
}
/>
<Row
name="Power to weight ratio on soft terrain"
value="powerToWeightRatioSoftTerrain"
display={(stats) =>
stats.powerToWeightRatioSoftTerrain.toFixed(1)
}
/>
<Row name="Health" value="health" />
<Row
name="Fire chance"
value="fireChance"
display={(stats) => (stats.fireChance * 100).toFixed(0)}
/>
<Row
name="View range"
value="viewRange"
display={(stats) => stats.viewRange.toFixed(0)}
/>
<Row
name="Camouflage still"
value="camouflageStill"
display={(stats) => (stats.camouflageStill * 100).toFixed(0)}
/>
<Row
name="Camouflage moving"
value="camouflageMoving"
display={(stats) => (stats.camouflageMoving * 100).toFixed(0)}
/>
<Row
name="Camouflage shooting still"
value="camouflageShootingStill"
display={(stats) =>
(stats.camouflageShootingStill * 100).toFixed(0)
}
/>
<Row
name="Camouflage shooting moving"
value="camouflageShootingMoving"
display={(stats) =>
(stats.camouflageShootingMoving * 100).toFixed(0)
}
/>
<Row
name="Camouflage caught on fire"
value="camouflageCaughtOnFire"
display={(stats) =>
(stats.camouflageCaughtOnFire * 100).toFixed(0)
}
/>
<Row
name="Size"
value={(stats) => Math.max(...stats.tankSize)}
display={(stats) =>
stats.tankSize
.map((tankSize) => tankSize.toFixed(1))
.join(' x ')
}
/>
</Table.Body>
</Table.Root>
</Flex>
@@ -11,6 +11,7 @@ import {
import { use } from 'react';
import { GenericTankComponentButton } from '../../../../../../../../components/ModuleButtons/GenericTankComponentButton';
import { asset } from '../../../../../../../../core/blitzkrieg/asset';
import { createDefaultSkills } from '../../../../../../../../core/blitzkrieg/createDefaultSkills';
import { skillDefinitions } from '../../../../../../../../core/blitzkrieg/skillDefinitions';
import { Tier } from '../../../../../../../../core/blitzkrieg/tankDefinitions';
import { TIER_ROMAN_NUMERALS } from '../../../../../../../../core/blitzkrieg/tankDefinitions/constants';
@@ -27,11 +28,7 @@ export function Skills() {
if (Object.keys(skillLevels).length === 0) {
mutateTankopediaTemporary((draft) => {
Object.values(awaitedSkillDefinitions.classes).forEach((skills) => {
skills.forEach((skill) => {
draft.skills[skill] = permanentSkills.includes(skill) ? 7 : 0;
});
});
draft.skills = createDefaultSkills(awaitedSkillDefinitions);
});
return null;
@@ -408,7 +408,7 @@ export function Characteristics() {
<InfoWithDelta decimals={0} indent name="Backwards">
{stats.speedBackwards}
</InfoWithDelta>
<InfoWithDelta decimals={0} name="Power" unit="hp">
<InfoWithDelta decimals={0} name="Engine power" unit="hp">
{stats.enginePower}
</InfoWithDelta>
<Info name="Power to weight ratio" unit="hp/tn" />
@@ -461,23 +461,23 @@ export function Characteristics() {
{stats.viewRange}
</InfoWithDelta>
<Info name="Camouflage" unit="%" />
<InfoWithDelta indent name="Still" decimals={2}>
<InfoWithDelta indent name="Still" decimals={0}>
{stats.camouflageStill * 100}
</InfoWithDelta>
<InfoWithDelta indent name="Moving" decimals={2}>
<InfoWithDelta indent name="Moving" decimals={0}>
{stats.camouflageMoving * 100}
</InfoWithDelta>
<InfoWithDelta indent name="Shooting still" decimals={2}>
<InfoWithDelta indent name="Shooting still" decimals={0}>
{stats.camouflageShootingStill * 100}
</InfoWithDelta>
<InfoWithDelta indent name="Shooting on move" decimals={2}>
<InfoWithDelta indent name="Shooting moving" decimals={0}>
{stats.camouflageShootingMoving * 100}
</InfoWithDelta>
<InfoWithDelta indent name="Caught on fire" decimals={2}>
<InfoWithDelta indent name="Caught on fire" decimals={0}>
{stats.camouflageCaughtOnFire * 100}
</InfoWithDelta>
<Info name="Size" unit="m">
{stats.tankSize.map((component) => component.toFixed(2)).join(' x ')}
{stats.tankSize.map((component) => component.toFixed(1)).join(' x ')}
</Info>
</Flex>
@@ -0,0 +1,14 @@
import { permanentSkills } from '../../app/tools/tankopedia/[id]/components/Characteristics/components/Skills/constants';
import { SkillDefinitions } from './skillDefinitions';
export function createDefaultSkills(skillDefinitions: SkillDefinitions) {
const skills: Record<string, number> = {};
Object.values(skillDefinitions.classes).forEach((tankSkills) => {
tankSkills.forEach((skill) => {
skills[skill] = permanentSkills.includes(skill) ? 7 : 0;
});
});
return skills;
}
+4 -11
View File
@@ -1,4 +1,5 @@
import { CompareMember } from '../../stores/compare';
import { createDefaultSkills } from './createDefaultSkills';
import { SkillDefinitions } from './skillDefinitions';
import { TankDefinition } from './tankDefinitions';
import { tankToDuelMember } from './tankToDuelMember';
@@ -7,16 +8,8 @@ export function tankToCompareMember(
tank: TankDefinition,
skillDefinitions: SkillDefinitions,
) {
const member = {
return {
...tankToDuelMember(tank),
crewSkills: {},
} as CompareMember;
Object.values(skillDefinitions.classes).forEach((skills) => {
skills.forEach((skill) => {
member.crewSkills[skill] = 0;
});
});
return member;
crewSkills: createDefaultSkills(skillDefinitions),
} satisfies CompareMember;
}