mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
29 lines
727 B
TypeScript
29 lines
727 B
TypeScript
import { GunDefinition, ShellDefinition } from './tankDefinitions';
|
|
|
|
export function resolveDpm(
|
|
gun: GunDefinition,
|
|
shell: ShellDefinition,
|
|
damageCoefficient = 1,
|
|
reloadCoefficient = 1,
|
|
intraClipCoefficient = 1,
|
|
) {
|
|
const alpha = shell.damage.armor * damageCoefficient;
|
|
|
|
if (gun.type === 'regular') {
|
|
return (alpha / (reloadCoefficient * gun.reload)) * 60;
|
|
} else if (gun.type === 'autoLoader') {
|
|
return (
|
|
((alpha * gun.count) /
|
|
(gun.reload + (gun.count - 1) * gun.intraClip * intraClipCoefficient)) *
|
|
60
|
|
);
|
|
} else {
|
|
return (
|
|
((alpha * gun.count) /
|
|
(gun.reload.reduce((a, b) => a + b, 0) +
|
|
(gun.count - 1) * gun.intraClip)) *
|
|
60
|
|
);
|
|
}
|
|
}
|