import configparser
import time

def read_config():
    config = configparser.ConfigParser()
    config.read('Aim.ini')
    return config

def write_config(config):
    with open('Aim.ini', 'w') as configfile:
        config.write(configfile)

def detect_enemy():
    # 模拟检测敌人的逻辑
    print("检测敌人...")
    time.sleep(2)  # 模拟检测时间
    return True  # 假设总是检测到敌人

def aim_at_enemy(config):
    # 模拟瞄准敌人的逻辑
    print("瞄准敌人...")
    time.sleep(2)  # 模拟瞄准时间
    config['AimAssist']['hit_target'] = 'true'
    write_config(config)
    print("命中敌人!")

def chase_enemy(config):
    # 模拟追击敌人的逻辑
    print("追击敌人...")
    time.sleep(2)  # 模拟追击时间
    config['AimAssist']['aim_strength'] = '2.0'
    config['AimAssist']['aim_speed'] = '2.0'
    write_config(config)
    print("瞄准力度和速度变大!")

def main():
    config = read_config()
    
    if config['AimAssist']['enabled'].lower() == 'true':
        if detect_enemy():
            aim_at_enemy(config)
            chase_enemy(config)
        else:
            print("未检测到敌人")
    else:
        print("辅助瞄准未启用")

if __name__ == "__main__":
    main()
