mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-12 20:26:10 +01:00
feat: some stats
This commit is contained in:
1 parent
bd412cdaa2
commit
f696c5f3c9
15 files changed
+192
-123
No files matched your search
@@ -10,7 +10,9 @@ export function Equipment() {
|
||||
const awaitedEquipmentDefinitions = use(equipmentDefinitions);
|
||||
const equipmentRows =
|
||||
awaitedEquipmentDefinitions.presets[protagonist.tank.equipment];
|
||||
const equipmentMatrix = useDuel((state) => state.protagonist!.equipment);
|
||||
const equipmentMatrix = useDuel(
|
||||
(state) => state.protagonist!.equipmentMatrix,
|
||||
);
|
||||
|
||||
return (
|
||||
<ConfigurationChildWrapper>
|
||||
@@ -21,7 +23,7 @@ export function Equipment() {
|
||||
color="red"
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
draft.protagonist!.equipment.forEach((row) => {
|
||||
draft.protagonist!.equipmentMatrix.forEach((row) => {
|
||||
row.forEach((_, index) => {
|
||||
row[index] = 0;
|
||||
});
|
||||
@@ -46,10 +48,13 @@ export function Equipment() {
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
if (equipmentMatrix[rowIndex][columnIndex] === -1) {
|
||||
draft.protagonist!.equipment[rowIndex][columnIndex] = 0;
|
||||
draft.protagonist!.equipmentMatrix[rowIndex][
|
||||
columnIndex
|
||||
] = 0;
|
||||
} else {
|
||||
draft.protagonist!.equipment[rowIndex][columnIndex] =
|
||||
-1;
|
||||
draft.protagonist!.equipmentMatrix[rowIndex][
|
||||
columnIndex
|
||||
] = -1;
|
||||
}
|
||||
});
|
||||
}}
|
||||
@@ -62,9 +67,13 @@ export function Equipment() {
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
if (equipmentMatrix[rowIndex][columnIndex] === 1) {
|
||||
draft.protagonist!.equipment[rowIndex][columnIndex] = 0;
|
||||
draft.protagonist!.equipmentMatrix[rowIndex][
|
||||
columnIndex
|
||||
] = 0;
|
||||
} else {
|
||||
draft.protagonist!.equipment[rowIndex][columnIndex] = 1;
|
||||
draft.protagonist!.equipmentMatrix[rowIndex][
|
||||
columnIndex
|
||||
] = 1;
|
||||
}
|
||||
});
|
||||
}}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { isExplosive } from '../../../../../../core/blitz/isExplosive';
|
||||
import { coefficient } from '../../../../../../core/blitzkrieg/coefficient';
|
||||
import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions';
|
||||
import { provisionDefinitions } from '../../../../../../core/blitzkrieg/provisionDefinitions';
|
||||
import { tankCharacteristics } from '../../../../../../core/blitzkrieg/tankCharacteristics';
|
||||
import {
|
||||
CREW_MEMBER_NAMES,
|
||||
GUN_TYPE_NAMES,
|
||||
@@ -24,7 +25,6 @@ import {
|
||||
} from '../../../../../../core/blitzkrieg/tankDefinitions/constants';
|
||||
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
||||
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
||||
import { useTankCharacteristics } from '../../../../../../hooks/useTankCharacteristics';
|
||||
import { mutateDuel, useDuel } from '../../../../../../stores/duel';
|
||||
import { useTankopediaTemporary } from '../../../../../../stores/tankopedia';
|
||||
import { Info } from './components/Info';
|
||||
@@ -53,7 +53,9 @@ export function Characteristics() {
|
||||
const crewMemberMastery = commanderMastery * 1.1;
|
||||
const consumables = useDuel((state) => state.protagonist!.consumables);
|
||||
const camouflage = useDuel((state) => state.protagonist!.camouflage);
|
||||
const equipmentMatrix = useDuel((state) => state.protagonist!.equipment);
|
||||
const equipmentMatrix = useDuel(
|
||||
(state) => state.protagonist!.equipmentMatrix,
|
||||
);
|
||||
const { tank, turret, gun, engine, track, shell } = useDuel(
|
||||
(state) => state.protagonist!,
|
||||
);
|
||||
@@ -64,24 +66,26 @@ export function Characteristics() {
|
||||
const tankModelDefinition = awaitedModelDefinitions[tank.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const stats = useTankCharacteristics({
|
||||
tank,
|
||||
camouflage,
|
||||
consumables,
|
||||
crewMastery,
|
||||
crewSkills,
|
||||
engine,
|
||||
equipmentMatrix,
|
||||
gun,
|
||||
provisions,
|
||||
shell,
|
||||
turret,
|
||||
track,
|
||||
stockEngine,
|
||||
stockGun,
|
||||
stockTrack,
|
||||
stockTurret,
|
||||
});
|
||||
const stats = use(
|
||||
tankCharacteristics({
|
||||
tank,
|
||||
camouflage,
|
||||
consumables,
|
||||
crewMastery,
|
||||
crewSkills,
|
||||
engine,
|
||||
equipmentMatrix,
|
||||
gun,
|
||||
provisions,
|
||||
shell,
|
||||
turret,
|
||||
track,
|
||||
stockEngine,
|
||||
stockGun,
|
||||
stockTrack,
|
||||
stockTurret,
|
||||
}),
|
||||
);
|
||||
|
||||
const hasSupercharger = useEquipment(107);
|
||||
const hasCalibratedShells = useEquipment(103);
|
||||
|
||||
@@ -73,7 +73,7 @@ export function Controls() {
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist!.tank.equipment,
|
||||
duel.protagonist!.equipment,
|
||||
duel.protagonist!.equipmentMatrix,
|
||||
);
|
||||
|
||||
switch (event) {
|
||||
|
||||
@@ -166,7 +166,7 @@ export const TankModel = memo(() => {
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist!.tank.equipment,
|
||||
duel.protagonist!.equipment,
|
||||
duel.protagonist!.equipmentMatrix,
|
||||
);
|
||||
[pitch, yaw] = applyPitchYawLimits(
|
||||
pitch,
|
||||
@@ -232,7 +232,7 @@ export const TankModel = memo(() => {
|
||||
const hasImprovedVerticalStabilizer = await hasEquipment(
|
||||
122,
|
||||
duel.protagonist!.tank.equipment,
|
||||
duel.protagonist!.equipment,
|
||||
duel.protagonist!.equipmentMatrix,
|
||||
);
|
||||
[pitch, yaw] = applyPitchYawLimits(
|
||||
pitch - event.movementY * (Math.PI / canvas.height),
|
||||
|
||||
@@ -159,7 +159,9 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
|
||||
active={hasCalibratedShells}
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
draft.antagonist!.equipment[0][0] = hasCalibratedShells ? 0 : 1;
|
||||
draft.antagonist!.equipmentMatrix[0][0] = hasCalibratedShells
|
||||
? 0
|
||||
: 1;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@@ -168,7 +170,9 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
|
||||
active={hasEnhancedArmor}
|
||||
onClick={() => {
|
||||
mutateDuel((draft) => {
|
||||
draft.protagonist!.equipment[1][1] = hasEnhancedArmor ? 0 : -1;
|
||||
draft.protagonist!.equipmentMatrix[1][1] = hasEnhancedArmor
|
||||
? 0
|
||||
: -1;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user