diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index 00747503d..b54f5739a 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -65,6 +65,11 @@ export function InfoWithDelta({ : (stats[props.value] as number); const delta = useDelta(uhWhatDoICallThisVariable); const protagonistTank = Duel.use((state) => state.protagonist.tank); + const shellIndex = Duel.use((state) => + state.protagonist.gun.gun_type!.value.base.shells.indexOf( + state.protagonist.shell, + ), + ); const others = useMemo(() => { const defaultSkills = createDefaultSkills(skillDefinitions); @@ -86,6 +91,10 @@ export function InfoWithDelta({ provisionDefinitions, ); + if (member.gun.gun_type!.value.base.shells[shellIndex] === undefined) { + return undefined; + } + return tankCharacteristics( { applyDynamicArmor: false, @@ -98,7 +107,7 @@ export function InfoWithDelta({ engine: member.engine, gun: member.gun, equipmentMatrix: member.equipmentMatrix, - shell: member.shell, + shell: member.gun.gun_type!.value.base.shells[shellIndex], stockEngine: tank.engines[0], stockGun: tank.turrets[0].guns[0], stockTrack: tank.tracks[0], @@ -115,14 +124,16 @@ export function InfoWithDelta({ ); }) .filter((tank) => { + if (tank === undefined) return false; + const othersValue = typeof props.value === 'function' ? props.value(tank)! : (tank[props.value] as number); return othersValue !== undefined; - }); - }, [relativeAgainst]); + }) as TankCharacteristics[]; + }, [relativeAgainst, shellIndex]); const betterTanks = others.filter((tank) => { const othersValue = typeof props.value === 'function'