Просмотр исходного кода

fix[HeroTest]: 修改英杰试炼进入探索的方式(改为函数),同时每周第一次战斗时会弹出确认选择祝福的弹窗

GanSer 2 лет назад
Родитель
Сommit
fc7af375ad

BIN
tasks/HeroTest/as/as_start_challenge.png


+ 9 - 0
tasks/HeroTest/as/image.json

@@ -187,5 +187,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "通过兵藏秘境取消重置按钮"
+  },
+  {
+    "itemName": "start_challenge",
+    "imageName": "as_start_challenge.png",
+    "roiFront": "685,407,142,47",
+    "roiBack": "685,407,142,47",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "周一点击确认开始挑战"
   }
 ]

+ 2 - 0
tasks/HeroTest/assets.py

@@ -53,6 +53,8 @@ class HeroTestAssets:
 	I_BCMJ_RESET_CONFIRM = RuleImage(roi_front=(668,399,180,70), roi_back=(668,399,180,70), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_bcmj_reset_confirm.png")
 	# 通过兵藏秘境取消重置按钮 
 	I_BCMJ_RESET_CLOSE = RuleImage(roi_front=(429,397,186,71), roi_back=(429,397,186,71), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_bcmj_reset_close.png")
+	# 周一点击确认开始挑战 
+	I_START_CHALLENGE = RuleImage(roi_front=(685,407,142,47), roi_back=(685,407,142,47), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_start_challenge.png")
 
 
 	# Ocr Rule Assets

+ 25 - 18
tasks/HeroTest/script_task.py

@@ -8,6 +8,7 @@ from tasks.Component.BaseActivity.base_activity import BaseActivity
 from tasks.HeroTest.assets import HeroTestAssets
 from tasks.GameUi.page import page_main, page_shikigami_records
 from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_exploration
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 
 from module.logger import logger
@@ -52,6 +53,13 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
 
         self.ui_get_current_page()
         self.ui_goto(page_main)
+        # 启动经验加成
+        if is_update:
+            self.open_buff()
+            self.exp_100(True)
+            self.exp_50(True)
+            self.close_buff()
+        self.ui_goto(page_exploration)
         self.home_main()
         # 设定是否锁定阵容
         if is_update:
@@ -109,7 +117,7 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
             # 如果是兵藏秘境 看看是否有兵道帖
             if is_skill:
                 if not self.check_art_war_card():
-                    logger.info("Art war card is enough")
+                    logger.info("Art war card is not enough")
                     break
             # 点击战斗
             logger.info("Click battle")
@@ -122,6 +130,11 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
                     if not self.appear(self.I_BATTLE):
                         break
                 elif is_skill:
+                    if not self.check_art_war_card():
+                        logger.info("Art war card is not nough")
+                        break
+                    if self.appear_then_click(self.I_START_CHALLENGE, interval=1):
+                        continue
                     if self.appear_then_click(self.I_BCMJ_RESET_CONFIRM, interval=1):
                         continue
                     if self.appear_then_click(self.I_BCMJ_BATTLE, interval=2):
@@ -258,12 +271,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
         logger.hr("Enter HeroTest", 2)
         global is_update
         global is_skill
-        # 启动经验加成
-        if is_update:
-            self.open_buff()
-            self.exp_100(True)
-            self.exp_50(True)
-            self.close_buff()
         while 1:
             self.screenshot()
             if is_update:
@@ -272,8 +279,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
             if is_skill:
                 if self.appear(self.I_BCMJ_BATTLE):
                     break
-            if self.appear_then_click(self.I_ONE, interval=1):
-                continue
             if self.appear_then_click(self.I_TWO, interval=1):
                 continue
             if is_update:
@@ -292,14 +297,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
         global is_update
         while 1:
             self.screenshot()
-            if self.appear(self.I_ONE):
-                if is_update:
-                    # 关闭经验加成
-                    self.open_buff()
-                    self.exp_100(False)
-                    self.exp_50(False)
-                    self.close_buff()
-                break
             if self.appear_then_click(self.I_UI_BACK_RED, interval=2):
                 continue
             if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2):
@@ -308,13 +305,23 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
                 continue
             if self.appear_then_click(self.I_GBB_BACK, interval=2):
                 continue
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            if is_update:
+                # 关闭经验加成
+                self.open_buff()
+                self.exp_100(False)
+                self.exp_50(False)
+                self.close_buff()
+            break
+
 
 
 if __name__ == "__main__":
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config("oas1")
+    c = Config("oas2")
     d = Device(c)
     t = ScriptTask(c, d)