diff --git a/src/app/tools/tankopedia/[id]/components/AntagonistBar/index.tsx b/src/app/tools/tankopedia/[id]/components/AntagonistBar/index.tsx index 3d0a2721c..55907e0a0 100644 --- a/src/app/tools/tankopedia/[id]/components/AntagonistBar/index.tsx +++ b/src/app/tools/tankopedia/[id]/components/AntagonistBar/index.tsx @@ -18,7 +18,10 @@ import { TIER_ROMAN_NUMERALS, } from '../../../../../../core/blitzkrieg/tankDefinitions'; import { mutateDuel, useDuel } from '../../../../../../stores/duel'; -import { useTankopediaTemporary } from '../../../../../../stores/tankopedia'; +import { + mutateTankopediaTemporary, + useTankopediaTemporary, +} from '../../../../../../stores/tankopedia'; import { TankSearch } from '../../../components/TankSearch'; export function AntagonistBar() { @@ -47,6 +50,9 @@ export function AntagonistBar() { onClick={() => { mutateDuel((draft) => { draft.antagonist!.shell = shell; + mutateTankopediaTemporary((draft) => { + draft.shot = undefined; + }); }); }} /> diff --git a/src/app/tools/tankopedia/[id]/page.tsx b/src/app/tools/tankopedia/[id]/page.tsx index 8d631e6bf..d07221278 100644 --- a/src/app/tools/tankopedia/[id]/page.tsx +++ b/src/app/tools/tankopedia/[id]/page.tsx @@ -56,17 +56,26 @@ export default function Page({ params }: { params: { id: string } }) { function handleKeyDown(event: KeyboardEvent) { if (document.activeElement instanceof HTMLInputElement) return; + function wipeShot() { + mutateTankopediaTemporary((draft) => { + draft.shot = undefined; + }); + } + if (event.key === '1') { + wipeShot(); mutateDuel((draft) => { draft.antagonist!.shell = draft.antagonist!.gun.shells[0]; }); } else if (event.key === '2') { + wipeShot(); mutateDuel((draft) => { if (draft.antagonist!.gun.shells[1]) { draft.antagonist!.shell = draft.antagonist!.gun.shells[1]; } }); } else if (event.key === '3') { + wipeShot(); mutateDuel((draft) => { if (draft.antagonist!.gun.shells[2]) { draft.antagonist!.shell = draft.antagonist!.gun.shells[2]; diff --git a/src/components/ShotDisplay.tsx b/src/components/ShotDisplay.tsx index 31d17814d..311c4fc86 100644 --- a/src/components/ShotDisplay.tsx +++ b/src/components/ShotDisplay.tsx @@ -134,7 +134,7 @@ export function ShotDisplay() { )} mm {layer.type === 'gap' && isExplosive(shell.type) - ? ` (${Math.round(Math.min(100, 0.5 * layer.gap * 100))}% pen. loss)` + ? ` (-${Math.round(Math.min(100, 0.5 * layer.gap * 100))}% penetration)` : ''}