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

已挑战过的鬼王不再重复挑战

ChengRanORZ пре 2 година
родитељ
комит
34cf39e545

+ 2 - 0
tasks/AreaBoss/assets.py

@@ -97,6 +97,8 @@ class AreaBossAssets:
 	I_AB_JI_FLOOR_LIST_CHECK = RuleImage(roi_front=(390,150,60,290), roi_back=(390,150,60,290), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_list_check.png")
 	# 极地鬼 一层 
 	I_AB_JI_FLOOR_ONE = RuleImage(roi_front=(390,150,60,290), roi_back=(390,150,60,290), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_one.png")
+	# 小组内未取得名次 
+	I_AB_GROUP_RANK_NONE = RuleImage(roi_front=(890,415,95,85), roi_back=(890,415,95,85), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_rank_none.png")
 
 
 	# Ocr Rule Assets

BIN
tasks/AreaBoss/res/ab_rank_none.png


+ 10 - 1
tasks/AreaBoss/res/image.json

@@ -170,7 +170,7 @@
     "threshold": 0.8,
     "description": "极地鬼 层数列表打开 标志"
   },
-    {
+  {
     "itemName": "ab_ji_floor_one",
     "imageName": "ab_ji_floor_one.png",
     "roiFront": "390,150,60,290",
@@ -178,5 +178,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "极地鬼 一层"
+  },
+  {
+    "itemName": "ab_group_rank_none",
+    "imageName": "ab_rank_none.png",
+    "roiFront": "890,415,95,85",
+    "roiBack": "890,415,95,85",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "小组内未取得名次"
   }
 ]

+ 12 - 0
tasks/AreaBoss/script_task.py

@@ -142,6 +142,11 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.open_filter()
         self.ui_click(battle, self.I_AB_CLOSE_RED)
 
+        if self.is_group_ranked():
+            # 如果已经打过该BOSS,直接跳过不打了
+            self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=1)
+            return True
+
         if ultra:
             if not self.get_difficulty():
                 # 判断是否能切换到极地鬼
@@ -312,6 +317,13 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             return 0
         return self.O_AB_NUM_OF_CHALLENGE.ocr_digit(self.device.image)
 
+    def is_group_ranked(self):
+        """
+            判断该鬼王是否已经获取到小组排名
+        """
+        return not self.appear(self.I_AB_GROUP_RANK_NONE)
+        pass
+
     def open_filter(self):
         logger.info("openFilter")
         self.ui_click(self.I_FILTER, self.I_AB_FILTER_OPENED, interval=1)