From 6d1ed1e56efcb0b728d671bc02b77acbad48677f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 12 Mar 2024 17:09:21 -0500 Subject: [PATCH] fix: reveals a few hidden values --- scripts/buildAssets/definitions.ts | 4 +- .../[id]/components/Characteristics/index.tsx | 48 ++++++++++--------- src/core/blitzkrieg/resolveDpm.ts | 6 +-- src/core/blitzkrieg/resolveReload.ts | 4 +- src/core/blitzkrieg/tankDefinitions.ts | 4 +- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/scripts/buildAssets/definitions.ts b/scripts/buildAssets/definitions.ts index d73cf9208..78aa8972b 100644 --- a/scripts/buildAssets/definitions.ts +++ b/scripts/buildAssets/definitions.ts @@ -674,7 +674,7 @@ export async function definitions(production: boolean) { : turretGunEntry.reloadTime; const gunClipCount = gunType === 'regular' ? undefined : turretGunEntry.clip!.count; - const gunInterClip = + const gunIntraClip = gunType === 'regular' ? undefined : 60 / turretGunEntry.clip!.rate; @@ -722,7 +722,7 @@ export async function definitions(production: boolean) { type: gunType, reload: gunReload, count: gunClipCount, - interClip: gunInterClip, + intraClip: gunIntraClip, camouflageLoss: typeof turretGunEntry.invisibilityFactorAtShot === 'number' ? turretGunEntry.invisibilityFactorAtShot diff --git a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx index 0acab5ee4..284d9a5c8 100644 --- a/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx +++ b/src/app/tools/tankopedia/[id]/components/Characteristics/index.tsx @@ -113,7 +113,7 @@ export function Characteristics() { // TODO: add max rolls [hasTungsten, 0.15], ); - const interClipCoefficient = coefficient([hasShellReloadBoost, -0.3]); + const intraClipCoefficient = coefficient([hasShellReloadBoost, -0.3]); const shellVelocityCoefficient = coefficient( [hasSupercharger, 0.3], [hasImprovedGunPowder, 0.3], @@ -210,7 +210,7 @@ export function Characteristics() { shell, damageCoefficient, reloadCoefficient, - interClipCoefficient, + intraClipCoefficient, ); useEffect(() => { @@ -255,7 +255,7 @@ export function Characteristics() { <> {gun.reload.at(-1)! < gun.reload.at(-2)! - ? (shell.damage.armor / (gun.reload.at(-1)! + gun.interClip)) * + ? (shell.damage.armor / (gun.reload.at(-1)! + gun.intraClip)) * 60 : (shell.damage.armor / gun.reload[0]) * 60} @@ -266,12 +266,12 @@ export function Characteristics() { unit="hp / min" > {gun.reload.at(-1)! < gun.reload.at(-2)! - ? (shell.damage.armor / (gun.reload.at(-1)! + gun.interClip)) * + ? (shell.damage.armor / (gun.reload.at(-1)! + gun.intraClip)) * (60 - - (gun.reload.slice(0, -1).length - 1) * gun.interClip) + + (gun.reload.slice(0, -1).length - 1) * gun.intraClip) + shell.damage.armor * gun.reload.slice(0, -1).length - : (shell.damage.armor / (gun.reload[0] + gun.interClip)) * - (60 - (gun.reload.slice(1).length - 1) * gun.interClip) + + : (shell.damage.armor / (gun.reload[0] + gun.intraClip)) * + (60 - (gun.reload.slice(1).length - 1) * gun.intraClip) + shell.damage.armor * gun.reload.slice(1).length} } /> - - {gun.reload.at(-1)! < gun.reload.at(-2)! ? gun.reload.length : 1} - )} {gun.type === 'autoReloader' ? ( <> - + {gun.reload.length} + + {gun.reload.at(-1)! < gun.reload.at(-2)! ? gun.reload.length : 1} + + {gun.reload.map((reload, index) => ( - {reload} + {reload * reloadCoefficient} ))} @@ -315,17 +316,18 @@ export function Characteristics() { {gun.reload * reloadCoefficient} )} - {gun.type === 'autoLoader' && ( - - {gun.interClip * interClipCoefficient} - - )} + {gun.type === 'autoLoader' || + (gun.type === 'autoReloader' && ( + + {gun.intraClip * intraClipCoefficient} + + ))} {shell.caliber} diff --git a/src/core/blitzkrieg/resolveDpm.ts b/src/core/blitzkrieg/resolveDpm.ts index 440f610ba..9224442b8 100644 --- a/src/core/blitzkrieg/resolveDpm.ts +++ b/src/core/blitzkrieg/resolveDpm.ts @@ -5,7 +5,7 @@ export function resolveDpm( shell: ShellDefinition, damageCoefficient = 1, reloadCoefficient = 1, - interClipCoefficient = 1, + intraClipCoefficient = 1, ) { const alpha = shell.damage.armor * damageCoefficient; @@ -14,14 +14,14 @@ export function resolveDpm( } else if (gun.type === 'autoLoader') { return ( ((alpha * gun.count) / - (gun.reload + (gun.count - 1) * gun.interClip * interClipCoefficient)) * + (gun.reload + (gun.count - 1) * gun.intraClip * intraClipCoefficient)) * 60 ); } else { return ( ((alpha * gun.count) / (gun.reload.reduce((a, b) => a + b, 0) + - (gun.count - 1) * gun.interClip)) * + (gun.count - 1) * gun.intraClip)) * 60 ); } diff --git a/src/core/blitzkrieg/resolveReload.ts b/src/core/blitzkrieg/resolveReload.ts index 358683428..c9c2b9840 100644 --- a/src/core/blitzkrieg/resolveReload.ts +++ b/src/core/blitzkrieg/resolveReload.ts @@ -4,10 +4,10 @@ export function resolveReload(gun: GunDefinition) { if (gun.type === 'regular') { return gun.reload; } else if (gun.type === 'autoLoader') { - return gun.reload + (gun.count - 1) * gun.interClip; + return gun.reload + (gun.count - 1) * gun.intraClip; } else { return ( - gun.reload.reduce((a, b) => a + b, 0) + (gun.count - 1) * gun.interClip + gun.reload.reduce((a, b) => a + b, 0) + (gun.count - 1) * gun.intraClip ); } } diff --git a/src/core/blitzkrieg/tankDefinitions.ts b/src/core/blitzkrieg/tankDefinitions.ts index 7258cf30d..3322f34f9 100644 --- a/src/core/blitzkrieg/tankDefinitions.ts +++ b/src/core/blitzkrieg/tankDefinitions.ts @@ -125,13 +125,13 @@ interface GunDefinitionRegular extends GunDefinitionBase { interface GunDefinitionAutoLoader extends GunDefinitionBase { type: 'autoLoader'; reload: number; - interClip: number; + intraClip: number; count: number; } interface GunDefinitionAutoReloader extends GunDefinitionBase { type: 'autoReloader'; reload: number[]; - interClip: number; + intraClip: number; count: number; } export type ShellDefinition = {