This commit is contained in:
辉鸭蛋 2024-12-13 02:23:57 +08:00
parent 3ca7ab6d4c
commit 0c435a9393
2 changed files with 19 additions and 6 deletions

View File

@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
<AssemblyName>BetterGI</AssemblyName>
<AssemblyVersion>0.37.4</AssemblyVersion>
<AssemblyVersion>0.37.5</AssemblyVersion>
<Platforms>x64</Platforms>
<DebugType>embedded</DebugType>
</PropertyGroup>

View File

@ -15,6 +15,7 @@ using BetterGenshinImpact.Core.Recognition.OpenCv;
using BetterGenshinImpact.GameTask.Common.Job;
using OpenCvSharp;
using Vanara;
using Vanara.PInvoke;
namespace BetterGenshinImpact.GameTask.AutoFight;
@ -77,7 +78,7 @@ public class AutoFightTask : ISoloTask
command.Execute(combatScenes);
}
if (await CheckFightFinish())
if (_taskParam is { FightFinishDetectEnabled: true } && await CheckFightFinish())
{
break;
}
@ -126,7 +127,7 @@ public class AutoFightTask : ISoloTask
if (_taskParam is { FightFinishDetectEnabled: true, PickDropsAfterFightEnabled: true })
{
//
// 执行自动拾取掉落物的功能
await new ScanPickTask().Start(ct);
}
@ -168,8 +169,20 @@ public class AutoFightTask : ISoloTask
}
// 最终方案确认战斗结束
Logger.LogInformation("识别到战斗结束");
return true;
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_L);
await Delay(450, _ct);
var ra = CaptureToRectArea();
var b3 = ra.SrcMat.At<Vec3b>(50, 790);
if (b3.Equals(new Vec3b(95, 235, 255)))
{
Logger.LogInformation("识别到战斗结束");
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
return true;
}
else
{
return false;
}
}
return false;
@ -195,4 +208,4 @@ public class AutoFightTask : ISoloTask
// // 要大于 gadgetMat 的 1/2
// return list.Any(r => r.Width > gadgetMat.Width / 2 && r.Height > gadgetMat.Height / 2);
// }
}
}