mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-17 09:26:50 +08:00
自动吃药 添加了是否携带食物的检测
This commit is contained in:
@@ -391,7 +391,7 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
while (!_cts.Token.IsCancellationRequested)
|
||||
{
|
||||
if (IsLowHealth())
|
||||
if (IsLowHealth() && IsTakeFood())
|
||||
{
|
||||
// 模拟按键 "Z"
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_Z);
|
||||
@@ -420,6 +420,16 @@ public class AutoDomainTask : ISoloTask
|
||||
return pixelColor is { Item2: 255, Item1: 90, Item0: 90 };
|
||||
}
|
||||
|
||||
private bool IsTakeFood()
|
||||
{
|
||||
// 获取图像
|
||||
using var ra = CaptureToRectArea();
|
||||
// 识别道具图标下是否是数字
|
||||
var countArea = ra.DeriveCrop(1800, 845, 40, 20);
|
||||
var count = OcrFactory.Paddle.OcrWithoutDetector(countArea.SrcGreyMat);
|
||||
return StringUtils.TryParseInt(count) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 旋转视角后寻找石化古树
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user