14 lines
471 B
TypeScript
14 lines
471 B
TypeScript
export const WEAPON_CATEGORIES = ['Shotgun', 'Rifle', 'MMR', 'AR', 'LMG', 'SMG'] as const;
|
|
|
|
export type WeaponCategory = (typeof WEAPON_CATEGORIES)[number];
|
|
|
|
export function attachWeaponCategoryBonuses<
|
|
TWeapon extends { category: unknown },
|
|
TBonus extends { weapon_category: unknown }
|
|
>(weapons: TWeapon[], bonuses: TBonus[]) {
|
|
return weapons.map((weapon) => ({
|
|
...weapon,
|
|
baseBonuses: bonuses.filter((bonus) => bonus.weapon_category === weapon.category)
|
|
}));
|
|
}
|