mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: remove textual reference
This commit is contained in:
1 parent
2b354770c7
commit
b5188331bd
3 files changed
+35
-34
No files matched your search
@@ -1,32 +0,0 @@
|
|||||||
import { Flex, Heading, Text } from '@radix-ui/themes';
|
|
||||||
import { sumBy } from 'lodash';
|
|
||||||
import { use, useMemo } from 'react';
|
|
||||||
import { tankDefinitions } from '../../../../../core/blitzkrieg/tankDefinitions';
|
|
||||||
import { useDuel } from '../../../../../stores/duel';
|
|
||||||
|
|
||||||
export function TextualReference() {
|
|
||||||
const awaitedTankDefinitions = use(tankDefinitions);
|
|
||||||
const tank = useDuel((state) => state.protagonist!.tank);
|
|
||||||
const tierTanks = useMemo(
|
|
||||||
() =>
|
|
||||||
Object.values(awaitedTankDefinitions).filter(
|
|
||||||
({ tier }) => tank.tier === tier,
|
|
||||||
),
|
|
||||||
[tank.id],
|
|
||||||
);
|
|
||||||
const averageDamage =
|
|
||||||
sumBy(
|
|
||||||
tierTanks,
|
|
||||||
(tank) => tank.turrets.at(-1)!.guns.at(-1)!.shells[0].damage.armor,
|
|
||||||
) / tierTanks.length;
|
|
||||||
|
|
||||||
console.log(averageDamage);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Flex direction="column" gap="2" mt="4">
|
|
||||||
<Heading size="6">Textual reference</Heading>
|
|
||||||
|
|
||||||
<Text></Text>
|
|
||||||
</Flex>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,6 @@ import { Modules } from './components/Characteristics/components/Modules';
|
|||||||
import { Provisions } from './components/Characteristics/components/Provisions';
|
import { Provisions } from './components/Characteristics/components/Provisions';
|
||||||
import { Skills } from './components/Characteristics/components/Skills';
|
import { Skills } from './components/Characteristics/components/Skills';
|
||||||
import { TankSandbox } from './components/Model/TankSandbox';
|
import { TankSandbox } from './components/Model/TankSandbox';
|
||||||
import { TextualReference } from './components/TextualReference';
|
|
||||||
import { Title } from './components/Title';
|
import { Title } from './components/Title';
|
||||||
import { Videos } from './components/Videos';
|
import { Videos } from './components/Videos';
|
||||||
|
|
||||||
@@ -113,7 +112,6 @@ export default function Page({ params }: { params: { id: string } }) {
|
|||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Videos />
|
<Videos />
|
||||||
<TextualReference />
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { sumBy } from 'lodash';
|
||||||
|
import { use, useMemo } from 'react';
|
||||||
|
import {
|
||||||
|
TankDefinition,
|
||||||
|
tankDefinitions,
|
||||||
|
} from '../core/blitzkrieg/tankDefinitions';
|
||||||
|
import { useDuel } from '../stores/duel';
|
||||||
|
|
||||||
|
export enum UseEccentricityMode {
|
||||||
|
Tier,
|
||||||
|
Class,
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useEccentricity(mode: UseEccentricityMode) {
|
||||||
|
const awaitedTankDefinitions = use(tankDefinitions);
|
||||||
|
const tank = useDuel((state) => state.protagonist!.tank);
|
||||||
|
const similarTanks = useMemo(
|
||||||
|
() =>
|
||||||
|
Object.values(awaitedTankDefinitions).filter(
|
||||||
|
(tankB) =>
|
||||||
|
tank.tier === tankB.tier &&
|
||||||
|
(mode === UseEccentricityMode.Class
|
||||||
|
? tank.class === tankB.class
|
||||||
|
: true),
|
||||||
|
),
|
||||||
|
[tank.id],
|
||||||
|
);
|
||||||
|
|
||||||
|
function eccentricity(property: (tank: TankDefinition) => number) {
|
||||||
|
const average = sumBy(similarTanks, property) / similarTanks.length;
|
||||||
|
return property(tank) / average;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eccentricity;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user