mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-20 08:29:50 +08:00
* 在路径追踪重构了部分冷却处理逻辑,战斗脚本e增加wait参数可等待技能冷却而不是跳过。采矿e增加等待。尝试修复路径追踪 UseElementalSkill 与采矿脚本冲突的问题。 * 给CombatCommand加入快速跳过e的选项 * 优化技能冷却处理逻辑,增加OcrSkillCd属性以支持OCR识别的技能冷却时间,并调整相关技能CD计算和等待逻辑,尝试修复纳西妲采集终止时按键未弹起的问题 * 优化战斗任务中的技能冷却处理逻辑 * 更新纳西妲技能冷却时间记录,改为使用UTC时间并增加日志输出以便调试 * 增加最大技能CD检查,以排除系统时间/日期同步导致无限卡死。修复跑图路切人。(ps:主板电池没电应该去修主板) * 修复CheckAvatarAvailable * fix AutoFightTask skill cooldown logic and improve comments * 尝试修复脚本在"当前角色"下的小问题 * 尝试修复脚本在"当前角色"下的小问题,Avatar类结构调整,重新做了"根据技能cd优化出招"部分。 * Refactor avatar retrieval in PathingConditionConfig to use GetAvatars method and update skill cooldown references * Fix variable naming for clarity in CombatScenes * 在自动战斗执行前预先过滤不可执行的脚本。 --------- Co-authored-by: 辉鸭蛋 <huiyadanli@gmail.com>
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
|
|
|
namespace BetterGenshinImpact.GameTask.AutoFight.Script;
|
|
|
|
public class CombatScriptBag(List<CombatScript> combatScripts)
|
|
{
|
|
private List<CombatScript> CombatScripts { get; set; } = combatScripts;
|
|
|
|
public CombatScriptBag(CombatScript combatScript) : this([combatScript])
|
|
{
|
|
}
|
|
|
|
public List<CombatCommand> FindCombatScript(ReadOnlyCollection<Avatar> avatars)
|
|
{
|
|
foreach (var combatScript in CombatScripts)
|
|
{
|
|
var matchCount = 0;
|
|
foreach (var avatar in avatars)
|
|
{
|
|
if (combatScript.AvatarNames.Contains(avatar.Name))
|
|
{
|
|
matchCount++;
|
|
}
|
|
|
|
if (matchCount != avatars.Count) continue;
|
|
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
|
|
return combatScript.CombatCommands;
|
|
}
|
|
|
|
combatScript.MatchCount = matchCount;
|
|
}
|
|
|
|
// 没有找到匹配的战斗脚本
|
|
// 按照匹配数量降序排序
|
|
CombatScripts.Sort((a, b) => b.MatchCount.CompareTo(a.MatchCount));
|
|
if (CombatScripts[0].MatchCount == 0)
|
|
{
|
|
throw new Exception("未匹配到任何战斗脚本");
|
|
}
|
|
|
|
Logger.LogWarning("未完整匹配到四人队伍,使用匹配度最高的队伍:{Name}", CombatScripts[0].Name);
|
|
return CombatScripts[0].CombatCommands;
|
|
}
|
|
}
|