From e66daed7ae5f58bc89bdf96bb794167d5364f5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 19 Dec 2025 14:51:18 -0600 Subject: [PATCH] feat: dpm --- .../src/core/tankopedia/characteristics.ts | 36 ++++++++++++++++--- .../core/tankopedia/characteristicsGroups.ts | 2 ++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/packages/website-ue/src/core/tankopedia/characteristics.ts b/packages/website-ue/src/core/tankopedia/characteristics.ts index d1ca733f8..007471e4a 100644 --- a/packages/website-ue/src/core/tankopedia/characteristics.ts +++ b/packages/website-ue/src/core/tankopedia/characteristics.ts @@ -22,16 +22,20 @@ export enum GunType { } export const characteristics = { - gun_type({ attribute }) { + clip_size({ attribute }) { + return attribute( + TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE + ); + }, + + gun_type({ attribute, characteristic }) { const isPump = attribute( TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP ); if (isPump === 1) return GunType.AutoReloader; - const clipSize = attribute( - TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE - ); + const clipSize = characteristic("clip_size")!; if (clipSize === 1) return GunType.Regular; @@ -59,13 +63,25 @@ export const characteristics = { reload({ characteristic, attribute }) { const gunType = characteristic("gun_type")!; - if (gunType !== GunType.Regular) return null; + if (gunType === GunType.AutoReloader) return null; return attribute( TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RELOAD_TIME ); }, + intra_clip({ characteristic, attribute }) { + const gunType = characteristic("gun_type")!; + + if (gunType === GunType.Regular) return null; + + const clipRate = attribute( + TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_RATE + ); + + return 60 / clipRate; + }, + dpm({ characteristic }) { let dps: number; const gunType = characteristic("gun_type")!; @@ -74,10 +90,20 @@ export const characteristics = { switch (gunType) { case GunType.Regular: { const reload = characteristic("reload")!; + dps = damage / reload; break; } + case GunType.AutoLoader: { + const reload = characteristic("reload")!; + const intraClip = characteristic("intra_clip")!; + const clipSize = characteristic("clip_size")!; + + dps = (damage * clipSize) / (reload + (clipSize - 1) * intraClip); + break; + } + default: throw new Error("Unknown gun type"); } diff --git a/packages/website-ue/src/core/tankopedia/characteristicsGroups.ts b/packages/website-ue/src/core/tankopedia/characteristicsGroups.ts index 4e0e164e9..03c4aad48 100644 --- a/packages/website-ue/src/core/tankopedia/characteristicsGroups.ts +++ b/packages/website-ue/src/core/tankopedia/characteristicsGroups.ts @@ -27,7 +27,9 @@ export const characteristicsGroups: CharacteristicsOrder = [ { name: "damage" }, { name: "module_damage" }, { name: "penetration" }, + { name: "clip_size" }, { name: "reload" }, + { name: "intra_clip" }, { toy: "reload" },