From f87bbefdc1f9bd035c17dcef326070db581c7bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Fri, 12 Sep 2025 01:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=206.0=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=20=E9=98=9F=E4=BC=8D=E4=B8=8B=E7=9A=84=E8=8D=89=E9=9C=B2?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=AF=BC=E8=87=B4=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=BD=8D=E7=BD=AE=E5=81=8F=E7=A7=BB=E7=9A=84?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameTask/AutoFight/Model/CombatScenes.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/BetterGenshinImpact/GameTask/AutoFight/Model/CombatScenes.cs b/BetterGenshinImpact/GameTask/AutoFight/Model/CombatScenes.cs index bab92d4f..3a559cef 100644 --- a/BetterGenshinImpact/GameTask/AutoFight/Model/CombatScenes.cs +++ b/BetterGenshinImpact/GameTask/AutoFight/Model/CombatScenes.cs @@ -100,6 +100,9 @@ public class CombatScenes : IDisposable avatarSideIconRectList = AutoFightAssets.Instance.AvatarSideIconRectList; avatarIndexRectList = AutoFightAssets.Instance.AvatarIndexRectList; } + + // 6.0 版本 队伍下的 草露 进度条 导致位置偏移 + AvatarSideFixOffset(imageRegion, avatarSideIconRectList, avatarIndexRectList); // 识别队伍 var names = new string[avatarSideIconRectList.Count]; @@ -137,6 +140,49 @@ public class CombatScenes : IDisposable return this; } + + /// + /// 6.0 版本 队伍下的 草露 进度条 导致位置偏移 + /// + /// + /// + /// + /// + public void AvatarSideFixOffset(ImageRegion imageRegion, List avatarSideIconRectList, List avatarIndexRectList) + { + // 角色序号 左上角 坐标偏移(+2, -5)后存在3个白色点,则认为存在 草露 进度条 + // 存在 草露 进度条时候整体上移 14 个像素 + int whitePointCount = 0; + foreach (var rectIndex in avatarIndexRectList) + { + int x = rectIndex.X + 2; + int y = rectIndex.Y - 5; + var color = imageRegion.SrcMat.At(y, x); + if (color is { Item0: 255, Item1: 255, Item2: 255 }) + { + whitePointCount++; + } + } + + if (whitePointCount >= 3) + { + Logger.LogInformation("检测到右侧队伍偏移,进行位置修正"); + for (int i = 0; i < avatarSideIconRectList.Count; i++) + { + var rect = avatarSideIconRectList[i]; + rect.Y -= 14; + avatarSideIconRectList[i] = rect; + } + + for (int i = 0; i < avatarIndexRectList.Count; i++) + { + var rect = avatarIndexRectList[i]; + rect.Y -= 14; + avatarIndexRectList[i] = rect; + } + } + } + public (string, string) ClassifyAvatarCnName(Image img, int index) {