fix: consider shells

This commit is contained in:
TrèsAbhi committed 2025-08-01 12:37:40 -05:00
1 parent e1b5b21fae
commit a704b291fd
7 files changed
+24 -13

No files matched your search

+1 -1
View File
@@ -294,7 +294,7 @@ export interface TankDefinition {
crew: Crew[];
health: number;
nation: string;
name: I18nString | undefined;
name: I18nString;
type: TankType;
max_consumables: number;
max_provisions: number;
@@ -2,7 +2,10 @@ import { DragHandleDots2Icon } from '@radix-ui/react-icons';
import { Box, Flex, Text } from '@radix-ui/themes';
import { useEffect, useRef, useState } from 'react';
import { clamp } from 'three/src/math/MathUtils.js';
import { fakeLogInverse } from '../../../../../../../../../core/blitzkit/fakeLog';
import {
fakeLog,
fakeLogInverse,
} from '../../../../../../../../../core/blitzkit/fakeLog';
import { Var } from '../../../../../../../../../core/radix/var';
import { Duel } from '../../../../../../../../../stores/duel';
import './index.css';
@@ -13,7 +16,10 @@ interface Props {
}
export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) {
const [x, setX] = useState(0.5);
const assaultDistance = Duel.use(
(state) => state.protagonist.assaultDistance,
);
const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2));
const cursor = useRef<HTMLDivElement>(null);
const mutateDuel = Duel.useMutation();
@@ -120,7 +120,7 @@ export function Firepower({ stats }: StatsAcceptorProps) {
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
{gun.gun_type!.value.base.assault_ranges && (
{gun.gun_type!.value.base.assault_ranges?.types.includes(shell.type) && (
<AssaultRangesVisualizer
stats={stats}
ranges={gun.gun_type!.value.base.assault_ranges}
@@ -73,6 +73,9 @@ export function SceneProps() {
const crewSkills = TankopediaEphemeral.use((state) => state.skills);
const consumables = Duel.use((state) => state.protagonist.consumables);
const provisions = Duel.use((state) => state.protagonist.provisions);
const assaultDistance = Duel.use(
(state) => state.protagonist.assaultDistance,
);
const equipmentMatrix = Duel.use(
(state) => state.protagonist.equipmentMatrix,
);
@@ -96,7 +99,7 @@ export function SceneProps() {
stockTurret: tank.turrets[0],
stockTrack: tank.tracks[0],
track,
assaultDistance: 0,
assaultDistance,
},
{ equipmentDefinitions, provisionDefinitions, tankModelDefinition },
);
@@ -159,12 +159,13 @@ export function tankCharacteristics(
[applyDynamicArmor, -0.1],
[applySpallLiner && shell.type === ShellType.HE, -0.2],
);
const assaultDamageCoefficient = gun.gun_type!.value.base.assault_ranges
? // && gun.gun_type!.value.base.assault_ranges.types.includes(shell.type)
(gun.gun_type!.value.base.assault_ranges.ranges.find(
({ distance }) => distance >= assaultDistance,
)?.factor ?? 0)
: 1;
const assaultDamageCoefficient =
gun.gun_type!.value.base.assault_ranges &&
gun.gun_type!.value.base.assault_ranges.types.includes(shell.type)
? (gun.gun_type!.value.base.assault_ranges.ranges.find(
({ distance }) => distance >= assaultDistance,
)?.factor ?? 0)
: 1;
const moduleDamageCoefficient =
coefficient([hasTungsten, 0.15]) * assaultDamageCoefficient;
const reloadCoefficient =
@@ -40,6 +40,7 @@ export function tankToDuelMember(
yaw,
pitch,
turret,
assaultDistance: 0,
assaultDistance:
(gun.gun_type!.value.base.assault_ranges?.ranges[0].distance ?? 0) / 2,
} satisfies DuelMember;
}
@@ -85,7 +85,7 @@ function Content() {
member.key !== thisMember.key &&
member.provisions.includes(101),
),
assaultDistance: 0,
assaultDistance: thisMember.assaultDistance,
},
{
equipmentDefinitions: equipmentDefinitions,