feat: ricochet incapable shells

This commit is contained in:
TrèsAbhi committed 2024-01-11 12:04:01 -06:00
1 parent 28a9f9a849
commit 9ed2b79a4b
5 files changed
+71 -22

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import { ShellDefinition } from '../blitzkrieg/tankDefinitions';
export function canRicochet(
type: ShellDefinition['type'],
): type is 'ap' | 'ap_cr' {
return type === 'ap' || type === 'ap_cr';
}
+9 -10
View File
@@ -58,6 +58,14 @@ interface GunDefinitionAutoReloader {
interClip: number;
count: number;
}
export interface RicochetCapableShell {
type: 'ap' | 'ap_cr';
normalization: number;
ricochet: number;
}
export interface RicochetIncapableShell {
type: 'hc' | 'he';
}
export type ShellDefinition = {
id: number;
name: string;
@@ -66,16 +74,7 @@ export type ShellDefinition = {
caliber: number;
icon: string;
penetration: number | Vector2Tuple;
} & (
| {
type: Omit<ShellType, 'hc' | 'he'>;
normalization: number;
ricochet: number;
}
| {
type: Omit<ShellType, 'ap' | 'ap_cr'>;
}
);
} & (RicochetCapableShell | RicochetIncapableShell);
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
cache: 'no-cache',