import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;

public class AimAssistConfig {
    // 映射字符串到身体部位
    private Map<String, BodyPart> partMapping;
    // 存储AKMBulletTrajectory_AimAssistAAIM的参数，每个参数是一个整数数组
    private List<int[]> aimAssistParams;
    // 存储AKMAssaultRifle_BulletFiringTrajectoryBias的偏好部位键
    private String trajectoryBias;
    // 首次瞄准头部的概率
    private int firstAimHeadProbability;

    // 构造函数
    public AimAssistConfig() {
        partMapping = new HashMap<>();
        aimAssistParams = new ArrayList<>();
        firstAimHeadProbability = 100; // 默认100%
    }

    // 设置部位映射
    public void setPartMapping(String key, BodyPart part) {
        partMapping.put(key, part);
    }

    // 添加AimAssist参数
    public void addAimAssistParam(int[] param) {
        if (param.length == 3) {
            aimAssistParams.add(param);
        } else {
            throw new IllegalArgumentException("Parameter array must have exactly 3 integers.");
        }
    }

    // 设置TrajectoryBias
    public void setTrajectoryBias(String bias) {
        trajectoryBias = bias;
    }

    // 设置概率
    public void setFirstAimHeadProbability(int probability) {
        if (probability < 0 || probability > 100) {
            throw new IllegalArgumentException("Probability must be between 0 and 100.");
        }
        firstAimHeadProbability = probability;
    }

    // 其他getter方法如果需要的话...

    // 示例方法：根据配置获取瞄准部位
    public BodyPart getAimAssistPart() {
        // 这里根据概率决定是否瞄准头部
        // 简单示例：根据概率随机返回头部或身体
        double random = Math.random() * 100;
        if (random < firstAimHeadProbability) {
            return BodyPart.HEAD;
        } else {
            return BodyPart.BODY;
        }
    }

    // 可能还有其他方法，根据参数计算轨迹偏差等...
}