Преглед изворни кода

fix(SigRealms): Exit while battle failure

ryland пре 2 година
родитељ
комит
67ec2bf447
2 измењених фајлова са 11 додато и 9 уклоњено
  1. 3 3
      dev_tools/assets_test.py
  2. 8 6
      tasks/SixRealms/moon_sea/moon_sea.py

+ 3 - 3
dev_tools/assets_test.py

@@ -34,11 +34,11 @@ def detect_ocr(file: str, target: RuleOcr):
 
 
 # 图片文件路径 可以是相对路径
-IMAGE_FILE = r"C:\Users\萌萌哒\Desktop\349772746-36423909-af3d-4d9c-bae4-9d2597e2ecda.png"
+IMAGE_FILE = r"C:\Users\Ryland\Desktop\2024-07-31_21-14-21-574521.png"
 if __name__ == '__main__':
-    from tasks.RyouToppa.assets import RyouToppaAssets
+    from tasks.SixRealms.assets import SixRealmsAssets
     from tasks.GameUi.assets import GameUiAssets
-    targe = GameUiAssets.I_MAIN_GOTO_GUILD
+    targe = SixRealmsAssets.I_BACK_EXIT
     print(detect_image(IMAGE_FILE, targe))
 
     # ocr demo

+ 8 - 6
tasks/SixRealms/moon_sea/moon_sea.py

@@ -183,11 +183,11 @@ class MoonSea(MoonSeaMap, MoonSeaL101, MoonSeaL102, MoonSeaL103, MoonSeaL104, Mo
             self.screenshot()
             if self.appear(self.I_BOSS_SHARE):
                 break
-            if self.appear(self.I_BOSS_BATTLE_AGAIN):
-                # 打boss失败了重新挑战
-                logger.warning('Boss battle again')
-                self.ui_click_until_disappear(self.I_BOSS_BATTLE_AGAIN, interval=1)
-                return False
+            if self.appear(self.I_BOSS_BATTLE_GIVEUP):
+                # 打boss失败了
+                logger.warning('Boss battle give up')
+                self.ui_click_until_disappear(self.I_BOSS_BATTLE_GIVEUP, interval=1)
+                continue
 
             if self.appear(self.I_BOSS_USE_DOUBLE, interval=1):
                 # 双倍奖励
@@ -198,9 +198,11 @@ class MoonSea(MoonSeaMap, MoonSeaL101, MoonSeaL102, MoonSeaL103, MoonSeaL104, Mo
             if self.appear_then_click(self.I_BOSS_GET_EXP, interval=1):
                 logger.info('Get EXP')
                 continue
-            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+            if self.appear_then_click(self.I_UI_CANCEL, interval=1):
                 # 取消购买 万相赐福
                 continue
+            if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
+                continue
             if self.appear_then_click(self.I_BOSS_SKIP, interval=1):
                 # 第二个boss
                 self.device.stuck_record_clear()