#pragma once
#include "WeaponConfig.h"
#include <memory>

// 子弹追踪系统
class BulletTracker {
private:
    WeaponConfig config;
    
public:
    BulletTracker(const WeaponConfig& cfg) : config(cfg) {}
    
    // 超强追踪计算
    struct TrackingResult {
        bool targetLocked;
        float hitProbability;
        PriorityPart hitPart;
        float damage;
    };
    
    TrackingResult CalculateTracking(const Vector3& startPos, 
                                    const Vector3& targetPos, 
                                    const Vector3& targetVelocity);
    
    // 无敌弹道预测
    Vector3 PredictTargetPosition(const Vector3& currentPos, 
                                 const Vector3& velocity, 
                                 float bulletTime);
};

// 武器系统主类
class UltimateWeaponSystem {
private:
    WeaponConfigManager configManager;
    std::unordered_map<WeaponType, std::unique_ptr<BulletTracker>> trackers;
    
public:
    UltimateWeaponSystem();
    
    // 初始化武器系统
    bool Initialize(const std::string& configFile);
    
    // 射击计算 - 超强效果
    struct ShotResult {
        bool hit;
        float damage;
        PriorityPart hitPart;
        Vector3 hitPosition;
        bool isCritical;
    };
    
    ShotResult CalculateShot(WeaponType weapon, 
                           const Vector3& shooterPos,
                           const Vector3& targetPos,
                           const Vector3& targetVel = Vector3::Zero());
    
    // 实时更新追踪
    void UpdateTracking(WeaponType weapon, float deltaTime);
    
    // 获取武器状态
    WeaponConfig GetWeaponStats(WeaponType weapon) const;
    
    // 热重载配置
    bool ReloadConfig(const std::string& configFile);
};
