Files
blitzkit/packages/website/src/config/characteristics.ts
T

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-08-31 20:13:31 -05:00
import {
CharacteristicType,
type Characteristic,
} from "../types/characteristics";
export const characteristics = {
gun_type: {
type: CharacteristicType.Enum,
compute({ gun }) {
return gun.gun_type!.$case;
},
},
clip_size: {
type: CharacteristicType.Number,
should_render({ gun }) {
return gun.gun_type!.$case !== "regular";
},
compute({ gun }) {
if (gun.gun_type!.$case === "regular") return 1;
return gun.gun_type!.value.shell_count;
},
},
damage: {
type: CharacteristicType.Number,
2026-10-01 15:52:14 -05:00
compute({ characteristic, gun, shell, environment }) {
2026-08-31 20:13:31 -05:00
let coefficient = 1;
2026-09-06 21:06:02 -05:00
if (gun.assault_ranges && gun.assault_ranges.types.includes(shell.type)) {
const match = gun.assault_ranges.ranges.find(
2026-10-01 15:52:14 -05:00
({ distance }) => distance >= environment.assault_distance,
2026-09-06 21:06:02 -05:00
);
if (match !== undefined) {
coefficient *= match.factor;
}
}
2026-10-01 15:52:14 -05:00
// coefficient *= equalizer.damage;
2026-08-31 20:13:31 -05:00
return coefficient * shell.armor_damage;
},
},
} satisfies Record<string, Characteristic>;