feat: 简化自动战斗日志输出 (#2732)

This commit is contained in:
躁动的氨气
2026-02-03 17:35:23 +08:00
committed by GitHub
parent 688bdcd8ae
commit a948c70baf
4 changed files with 19 additions and 13 deletions

View File

@@ -320,7 +320,8 @@ namespace BetterGenshinImpact.GameTask.AutoFight
if (retryCount == 0) if (retryCount == 0)
{ {
await Delay(delayTime,ct); await Delay(delayTime,ct);
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime); // Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
Logger.LogInformation("打开编队界面检查战斗是否结束");
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen); Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
await Delay(detectDelayTime, ct); await Delay(detectDelayTime, ct);
var ra3 = CaptureToRectArea(); var ra3 = CaptureToRectArea();

View File

@@ -444,7 +444,7 @@ public class AutoFightTask : ISoloTask
if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time)) if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time))
{ {
delayTime = time; delayTime = time;
Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒"); // Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
} }
else else
{ {
@@ -766,7 +766,8 @@ public class AutoFightTask : ISoloTask
if (!_finishDetectConfig.RotateFindEnemyEnabled)await Delay(delayTime, _ct); if (!_finishDetectConfig.RotateFindEnemyEnabled)await Delay(delayTime, _ct);
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime); // Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
Logger.LogInformation("打开编队界面检查战斗是否结束");
// 最终方案确认战斗结束 // 最终方案确认战斗结束
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen); Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
await Delay(detectDelayTime, _ct); await Delay(detectDelayTime, _ct);
@@ -789,8 +790,9 @@ public class AutoFightTask : ISoloTask
return true; return true;
} }
Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}"); // Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}"); // Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
Logger.LogInformation($"未识别到战斗结束: yellow{b3.Item0},{b3.Item1},{b3.Item2};white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
if (_finishDetectConfig.RotateFindEnemyEnabled) if (_finishDetectConfig.RotateFindEnemyEnabled)
{ {

View File

@@ -254,10 +254,10 @@ public class Avatar
// 切换成功 // 切换成功
if (CombatScenes.GetActiveAvatarIndex(region, context) == Index) if (CombatScenes.GetActiveAvatarIndex(region, context) == Index)
{ {
if (needLog && i > 0) // if (needLog && i > 0)
{ // {
Logger.LogInformation("成功切换角色:{Name}", Name); // Logger.LogInformation("成功切换角色:{Name}", Name);
} // }
return true; return true;
} }
@@ -268,6 +268,8 @@ public class Avatar
Sleep(250, Ct); Sleep(250, Ct);
} }
Logger.LogWarning("切换角色失败:{Name}", Name);
return false; return false;
} }
@@ -472,8 +474,8 @@ public class Avatar
var cd = AfterUseSkill(region); var cd = AfterUseSkill(region);
if (cd > 0) if (cd > 0)
{ {
Logger.LogInformation(hold ? "{Name} 长按元素战技cd:{Cd} 秒" : "{Name} 点按元素战技cd:{Cd} 秒", Name, // Logger.LogInformation(hold ? "{Name} 长按元素战技cd:{Cd} 秒" : "{Name} 点按元素战技cd:{Cd} 秒", Name,
Math.Round(cd, 2)); // Math.Round(cd, 2));
return; return;
} }
} }

View File

@@ -28,8 +28,9 @@ public class CombatScriptBag(List<CombatScript> combatScripts)
} }
if (matchCount != avatars.Count) continue; if (matchCount != avatars.Count) continue;
Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}", // Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}",
combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames)); // combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames));
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
return combatScript.CombatCommands; return combatScript.CombatCommands;
} }