mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
clean up a bit
This commit is contained in:
1 parent
fe7282aae7
commit
5b4ad95a14
1 file changed
+11
-32
@@ -24,42 +24,21 @@ export const characteristics = {
|
||||
},
|
||||
},
|
||||
|
||||
assault_damage_coefficient: {
|
||||
type: CharacteristicType.Number,
|
||||
|
||||
compute({ gun, shell, assault_distance }) {
|
||||
if (
|
||||
!gun.assault_ranges ||
|
||||
!gun.assault_ranges.types.includes(shell.type)
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (
|
||||
gun.assault_ranges.ranges.find(
|
||||
({ distance }) => distance >= assault_distance,
|
||||
)?.factor ?? 0
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
armor_damage_coefficient: {
|
||||
type: CharacteristicType.Number,
|
||||
|
||||
compute() {
|
||||
let coefficient = 1;
|
||||
|
||||
return coefficient;
|
||||
},
|
||||
},
|
||||
|
||||
damage: {
|
||||
type: CharacteristicType.Number,
|
||||
compute({ characteristic, shell, equalizer }) {
|
||||
compute({ characteristic, gun, shell, equalizer, assault_distance }) {
|
||||
let coefficient = 1;
|
||||
|
||||
coefficient *= characteristic("armor_damage_coefficient") as number;
|
||||
coefficient *= characteristic("assault_damage_coefficient") as number;
|
||||
if (gun.assault_ranges && gun.assault_ranges.types.includes(shell.type)) {
|
||||
const match = gun.assault_ranges.ranges.find(
|
||||
({ distance }) => distance >= assault_distance,
|
||||
);
|
||||
|
||||
if (match !== undefined) {
|
||||
coefficient *= match.factor;
|
||||
}
|
||||
}
|
||||
|
||||
coefficient *= equalizer.damage;
|
||||
|
||||
return coefficient * shell.armor_damage;
|
||||
|
||||
Reference in new issue
Block a user