import java.util.ArrayList;
import java.util.List;

public class Gun {
    // 枪械的基本属性
    private int bulletSpeed; // 子弹速度
    private int spreadAngle; // 子弹散布角度
    private int range;       // 射击范围

    public Gun(int bulletSpeed, int spreadAngle, int range) {
        this.bulletSpeed = bulletSpeed;
        this.spreadAngle = spreadAngle;
        this.range = range;
    }

    // 射击方法
    public List<Bullet> shoot(double startX, double startY, double aimAngle) {
        List<Bullet> bullets = new ArrayList<>();
        // 根据散布角度生成多个子弹
        for (int i = -spreadAngle; i <= spreadAngle; i += spreadAngle / 5) {
            double angle = aimAngle + Math.toRadians(i);
            bullets.add(new Bullet(startX, startY, bulletSpeed, angle, range));
        }
        return bullets;
    }
}
