feat: dpm

This commit is contained in:
TrèsAbhi committed 2025-12-19 14:51:18 -06:00
1 parent f2d0f68f07
commit e66daed7ae
2 files changed
+33 -5

No files matched your search

@@ -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");
}
@@ -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" },