import _ from "lodash" ; import Enemy , { EnemyState } from "classes/Enemy" ; import Sound from "classes/Sound" ; import shotgun_shot from "sounds/weapons/shotgun_shot" ; import Weapon from "./Weapon" ; import { WeaponType } from "./types" ; class Shotgun extends Weapon { public readonly name : WeaponType = "shotgun" ; public readonly timePerShot : number = 1000 ; public maxBulletCount : number = 20 ; public bulletCount : number = 0 ; protected readonly sound : Sound = shotgun_shot ; private readonly maxEnemiesPerShot : number = 1000 ; protected shootingStrategy ( enemies ) { _ . chain ( enemies ) . chunk ( this . maxEnemiesPerShot ) . head ( ) . value ( ) ?. forEach ( enemy => { if ( this . isEnemyInShootingAngle ( enemy ) ) { enemy . setState ( EnemyState . dead ) ; } } ) ; } } export default Shotgun ;