mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: dpm
This commit is contained in:
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 = {
|
export const characteristics = {
|
||||||
gun_type({ attribute }) {
|
clip_size({ attribute }) {
|
||||||
|
return attribute(
|
||||||
|
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
gun_type({ attribute, characteristic }) {
|
||||||
const isPump = attribute(
|
const isPump = attribute(
|
||||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP
|
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isPump === 1) return GunType.AutoReloader;
|
if (isPump === 1) return GunType.AutoReloader;
|
||||||
|
|
||||||
const clipSize = attribute(
|
const clipSize = characteristic("clip_size")!;
|
||||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE
|
|
||||||
);
|
|
||||||
|
|
||||||
if (clipSize === 1) return GunType.Regular;
|
if (clipSize === 1) return GunType.Regular;
|
||||||
|
|
||||||
@@ -59,13 +63,25 @@ export const characteristics = {
|
|||||||
reload({ characteristic, attribute }) {
|
reload({ characteristic, attribute }) {
|
||||||
const gunType = characteristic("gun_type")!;
|
const gunType = characteristic("gun_type")!;
|
||||||
|
|
||||||
if (gunType !== GunType.Regular) return null;
|
if (gunType === GunType.AutoReloader) return null;
|
||||||
|
|
||||||
return attribute(
|
return attribute(
|
||||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RELOAD_TIME
|
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 }) {
|
dpm({ characteristic }) {
|
||||||
let dps: number;
|
let dps: number;
|
||||||
const gunType = characteristic("gun_type")!;
|
const gunType = characteristic("gun_type")!;
|
||||||
@@ -74,10 +90,20 @@ export const characteristics = {
|
|||||||
switch (gunType) {
|
switch (gunType) {
|
||||||
case GunType.Regular: {
|
case GunType.Regular: {
|
||||||
const reload = characteristic("reload")!;
|
const reload = characteristic("reload")!;
|
||||||
|
|
||||||
dps = damage / reload;
|
dps = damage / reload;
|
||||||
break;
|
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:
|
default:
|
||||||
throw new Error("Unknown gun type");
|
throw new Error("Unknown gun type");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export const characteristicsGroups: CharacteristicsOrder = [
|
|||||||
{ name: "damage" },
|
{ name: "damage" },
|
||||||
{ name: "module_damage" },
|
{ name: "module_damage" },
|
||||||
{ name: "penetration" },
|
{ name: "penetration" },
|
||||||
|
{ name: "clip_size" },
|
||||||
{ name: "reload" },
|
{ name: "reload" },
|
||||||
|
{ name: "intra_clip" },
|
||||||
|
|
||||||
{ toy: "reload" },
|
{ toy: "reload" },
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user