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

Merge branch 'dev' into fix/medal-soldout

huangrunheng 2 месяцев назад
Родитель
Сommit
33613774c7
70 измененных файлов с 762 добавлено и 183 удалено
  1. 1 1
      .github/workflows/auto-create-pr.yaml
  2. 3 1
      .github/workflows/github-mirror.yml
  3. 68 1
      assets/i18n/zh-CN.json
  4. 3 1
      module/atom/click.py
  5. 6 0
      module/ocr/sub_ocr.py
  6. BIN
      tasks/ActivityShikigami/as/as_climb_mode_pass.png
  7. BIN
      tasks/ActivityShikigami/as/as_climb_mode_switch.png
  8. BIN
      tasks/ActivityShikigami/as/as_shi.png
  9. BIN
      tasks/ActivityShikigami/as/as_to_battle_main.png
  10. 3 3
      tasks/ActivityShikigami/as/pages.json
  11. 4 4
      tasks/ActivityShikigami/assets.py
  12. 38 38
      tasks/ActivityShikigami/config.py
  13. 6 6
      tasks/ActivityShikigami/fire/ocr.json
  14. 4 47
      tasks/ActivityShikigami/script_task.py
  15. 13 1
      tasks/Component/Costume/assets.py
  16. 3 2
      tasks/Component/Costume/config.py
  17. 3 3
      tasks/Component/Costume/costume_base.py
  18. 1 1
      tasks/Component/Costume/costume_test_shikigami.py
  19. 47 0
      tasks/Component/Costume/main16/image.json
  20. BIN
      tasks/Component/Costume/main16/main16_check_main_16.png
  21. BIN
      tasks/Component/Costume/main16/main16_main_goto_exploration_16.png
  22. BIN
      tasks/Component/Costume/main16/main16_main_goto_summon_16.png
  23. BIN
      tasks/Component/Costume/main16/main16_main_goto_town_16.png
  24. BIN
      tasks/Component/Costume/main16/main16_pet_house_16.png
  25. 17 0
      tasks/Component/CostumeBattle/assets.py
  26. BIN
      tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png
  27. BIN
      tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png
  28. BIN
      tasks/Component/CostumeBattle/battle15/battle15_exit_15.png
  29. BIN
      tasks/Component/CostumeBattle/battle15/battle15_false_15.png
  30. BIN
      tasks/Component/CostumeBattle/battle15/battle15_friends_15.png
  31. BIN
      tasks/Component/CostumeBattle/battle15/battle15_local_15.png
  32. BIN
      tasks/Component/CostumeBattle/battle15/battle15_win_15.png
  33. 65 0
      tasks/Component/CostumeBattle/battle15/image.json
  34. 43 0
      tasks/Component/CostumeShikigami/assets.py
  35. 182 0
      tasks/Component/CostumeShikigami/sk12/image.json
  36. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png
  37. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png
  38. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png
  39. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png
  40. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png
  41. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png
  42. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png
  43. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png
  44. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png
  45. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png
  46. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png
  47. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png
  48. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png
  49. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png
  50. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png
  51. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png
  52. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png
  53. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png
  54. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png
  55. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png
  56. 10 3
      tasks/Component/GeneralBattle/assets.py
  57. 4 0
      tasks/Component/GeneralBattle/battle.py
  58. 99 42
      tasks/Component/GeneralBattle/battle_wait.py
  59. 5 5
      tasks/Component/GeneralBattle/general_battle.py
  60. 2 2
      tasks/Component/GeneralBattle/gw/click.json
  61. 8 0
      tasks/Component/GeneralBattle/gw/click_activity.json
  62. BIN
      tasks/Component/GeneralBattle/gw/gw_end_fix_1.png
  63. BIN
      tasks/Component/GeneralBattle/gw/gw_end_fix_3.png
  64. 12 3
      tasks/Component/GeneralBattle/gw/image.json
  65. 3 0
      tasks/Exploration/base.py
  66. 4 1
      tasks/Exploration/solo.py
  67. 8 4
      tasks/FallenSun/script_task.py
  68. 3 4
      tasks/RichMan/mall/navbar.py
  69. 1 1
      tasks/SoulsTidy/script_task.py
  70. 93 9
      tests/tasks/Component/GeneralBattle/test_battle_wait.py

+ 1 - 1
.github/workflows/auto-create-pr.yaml

@@ -3,7 +3,7 @@ name: Auto Create PR from dev to master
 on:
   schedule:
     # 每周四北京时间21点触发(UTC时间13点)
-    - cron: '0 13 * * 4'
+    - cron: '7 13 * * 4'
   workflow_dispatch:
 
 jobs:

+ 3 - 1
.github/workflows/github-mirror.yml

@@ -6,6 +6,8 @@ on:
   push:
     branches:
       - master
+      - dev
+  pull_request:
 name: GitHub-Mirrors
 
 jobs:
@@ -62,4 +64,4 @@ jobs:
 
       - name: Print cache path
         run: |
-          ls -la ${{ github.workspace }}/hub-mirror-cache
+          ls -la ${{ github.workspace }}/hub-mirror-cache

+ 68 - 1
assets/i18n/zh-CN.json

@@ -42,6 +42,7 @@
   "emulator_startup_lead_time_help": "在开始运行任务之前提前启动模拟器的时间",
   "exit_four_help": "支持打九退四,保证稳定57级,要求设置好战斗主题,即 脚本->全局配置->游戏装饰自定义->战斗主题",
   "costume_main_15": "茨心乐园",
+  "costume_main_16": "狐栖归处",
   "check_true_orochi_enable": "是否在结束后检测真蛇",
   "check_true_orochi_enable_help": "开启后会在任务结束后检测是否出现真蛇, 若出现则自动拉起真蛇",
   "enable_book_auto": "自动选择",
@@ -70,5 +71,71 @@
   "long_rest_duration_help": "触发累计活跃上限后的强制休息时长。格式:天 时:分:秒。",
   "min_run_interval": "最小再运行间隔",
   "min_run_interval_help": "防风控:两次蹭卡运行之间的最小间隔,避免蹭卡过于频繁被服务端标记。设为 0(默认)保持原逻辑(按结界卡剩余时间安排下次)。格式:天 时:分:秒。",
-  "costume_shikigami_11": "花札幕台"
+  "costume_shikigami_11": "花札幕台",
+  "enable_switch_pass": "切换门票爬塔御魂",
+  "enable_switch_pass_help": "是否切换门票爬塔御魂",
+  "pass_group_team": "门票爬塔御魂分组",
+  "pass_group_team_help": "组1-7,队伍1-4 中间用英文,分隔",
+  "enable_switch_pass_by_name": "通过OCR切换门票爬塔御魂",
+  "enable_switch_pass_by_name_help": "是否通过OCR切换御魂",
+  "pass_group_team_name": "门票爬塔御魂分组名、队伍名",
+  "pass_group_team_name_help": "组名,队伍名 中间用英文,分隔",
+  "enable_switch_ap": "切换体力爬塔御魂",
+  "enable_switch_ap_help": "是否切换体力爬塔御魂",
+  "ap_group_team": "体力爬塔御魂分组",
+  "ap_group_team_help": "组1-7,队伍1-4 中间用英文,分隔",
+  "enable_switch_ap_by_name": "通过OCR切换体力爬塔御魂",
+  "enable_switch_ap_by_name_help": "是否通过OCR切换御魂",
+  "ap_group_team_name": "体力爬塔御魂分组名、队伍名",
+  "ap_group_team_name_help": "组名,队伍名 中间用英文,分隔",
+  "enable_switch_boss": "切换Boss爬塔御魂",
+  "enable_switch_boss_help": "是否切换boss爬塔御魂",
+  "boss_group_team": "Boss爬塔御魂分组",
+  "boss_group_team_help": "组1-7,队伍1-4 中间用英文,分隔",
+  "enable_switch_boss_by_name": "通过OCR切换Boss爬塔御魂",
+  "enable_switch_boss_by_name_help": "是否通过OCR切换御魂",
+  "boss_group_team_name": "Boss爬塔御魂分组名、队伍名",
+  "boss_group_team_name_help": "组名,队伍名 中间用英文,分隔",
+  "enable_switch_ap100": "切换100体爬塔御魂",
+  "enable_switch_ap100_help": "是否切换100体爬塔御魂",
+  "ap100_group_team": "100体爬塔御魂分组",
+  "ap100_group_team_help": "组1-7,队伍1-4 中间用英文,分隔",
+  "enable_switch_ap100_by_name": "通过OCR切换100体爬塔御魂",
+  "enable_switch_ap100_by_name_help": "是否通过OCR切换御魂",
+  "ap100_group_team_name": "100体爬塔御魂分组名、队伍名",
+  "ap100_group_team_name_help": "组名,队伍名 中间用英文,分隔",
+  "enable_pass_preset": "切换门票爬塔预设",
+  "enable_pass_preset_help": "是否切换门票爬塔预设, 仅数字切换御魂可用",
+  "enable_pass_green": "开启门票爬塔绿标",
+  "enable_pass_green_help": "是否开启门票爬塔绿标",
+  "pass_green_mark": "门票爬塔绿标位置",
+  "pass_green_mark_help": "门票爬塔绿标位置",
+  "enable_pass_anti_detect": "门票爬塔防检测",
+  "enable_pass_anti_detect_help": "门票爬塔战斗过程是否随机点击或滑动",
+  "enable_ap_preset": "切换体力爬塔预设",
+  "enable_ap_preset_help": "是否切换体力爬塔预设, 仅数字切换御魂可用",
+  "enable_ap_green": "开启体力爬塔绿标",
+  "enable_ap_green_help": "是否开启体力爬塔绿标",
+  "ap_green_mark": "体力爬塔绿标位置",
+  "ap_green_mark_help": "体力爬塔绿标位置",
+  "enable_ap_anti_detect": "体力爬塔防检测",
+  "enable_ap_anti_detect_help": "体力爬塔战斗过程是否随机点击或滑动",
+  "enable_boss_preset": "切换Boss爬塔预设",
+  "enable_boss_preset_help": "是否切换boss爬塔预设, 仅数字切换御魂可用",
+  "enable_boss_green": "开启Boss爬塔绿标",
+  "enable_boss_green_help": "是否开启boss爬塔绿标",
+  "boss_green_mark": "Boss爬塔绿标位置",
+  "boss_green_mark_help": "boss爬塔绿标位置",
+  "enable_boss_anti_detect": "Boss爬塔防检测",
+  "enable_boss_anti_detect_help": "boss爬塔战斗过程是否随机点击或滑动",
+  "enable_ap100_preset": "切换100体爬塔预设",
+  "enable_ap100_preset_help": "是否切换100体爬塔预设, 仅数字切换御魂可用",
+  "enable_ap100_green": "开启100体爬塔绿标",
+  "enable_ap100_green_help": "是否开启100体爬塔绿标",
+  "ap100_green_mark": "100体爬塔绿标位置",
+  "ap100_green_mark_help": "100体爬塔绿标位置",
+  "enable_ap100_anti_detect": "100体爬塔防检测",
+  "enable_ap100_anti_detect_help": "100体爬塔战斗过程是否随机点击或滑动",
+  "costume_battle_15": "灵狐寄愿",
+  "costume_shikigami_12": "拾光之窗"
 }

+ 3 - 1
module/atom/click.py

@@ -196,7 +196,9 @@ class RuleClickExclude(RuleClick):
         return self._coord_complement(self.distribution)
 
     def coord_in_excluded(self, areas: list[str] | None = None) -> tuple:
-        """Return a random coordinate inside one of the named excluded areas."""
+        """
+        
+        """
         if not areas:
             areas = ['C_END_1_1', 'C_END_1_2', 'C_END_1_3', 'C_END_1_4', 'C_END_1_5', 'C_END_1_6',
                      'C_END_2_1', 'C_END_2_2', 'C_END_2_3', 'C_END_2_4', 'C_END_2_5', 'C_END_2_6']

+ 6 - 0
module/ocr/sub_ocr.py

@@ -110,6 +110,12 @@ class Digit(Single):
         result = [char for char in result if char.isdigit()]
         result = ''.join(result)
 
+        # 如果结果全部是 '0' 且长度 >= 2,视为 OCR 错误(例如 900 → 00),强制设为 "1"
+        if result and all(ch == '0' for ch in result) and len(result) >= 2:
+            logger.warning(f'OCR [{self.name} {result}] all-zero with length>=2, force set to "1"')
+            result = '1'
+
+
         prev = result
         result = int(result) if result else 0
         if str(result) != prev:

BIN
tasks/ActivityShikigami/as/as_climb_mode_pass.png


BIN
tasks/ActivityShikigami/as/as_climb_mode_switch.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_to_battle_main.png


+ 3 - 3
tasks/ActivityShikigami/as/pages.json

@@ -38,8 +38,8 @@
   {
     "itemName": "to_battle_main",
     "imageName": "as_to_battle_main.png",
-    "roiFront": "600,418,38,152",
-    "roiBack": "499,347,238,269",
+    "roiFront": "302,178,98,111",
+    "roiBack": "223,110,238,269",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "进入主要的战斗界面"
@@ -48,7 +48,7 @@
     "itemName": "to_battle_boss",
     "imageName": "as_to_battle_boss.png",
     "roiFront": "1111,248,37,136",
-    "roiBack": "973,174,234,327",
+    "roiBack": "979,142,234,327",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击进入boss战斗页面"

+ 4 - 4
tasks/ActivityShikigami/assets.py

@@ -46,9 +46,9 @@ class ActivityShikigamiAssets:
 	# 红色退出 
 	I_RED_EXIT = RuleImage(roi_front=(1162,96,39,38), roi_back=(1120,49,110,135), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_red_exit.png")
 	# 进入主要的战斗界面 
-	I_TO_BATTLE_MAIN = RuleImage(roi_front=(600,418,38,152), roi_back=(499,347,238,269), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main.png")
+	I_TO_BATTLE_MAIN = RuleImage(roi_front=(302,178,98,111), roi_back=(223,110,238,269), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main.png")
 	# 点击进入boss战斗页面 
-	I_TO_BATTLE_BOSS = RuleImage(roi_front=(1111,248,37,136), roi_back=(973,174,234,327), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_boss.png")
+	I_TO_BATTLE_BOSS = RuleImage(roi_front=(1111,248,37,136), roi_back=(979,142,234,327), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_boss.png")
 	# description 
 	I_CHECK_BATTLE_MAIN = RuleImage(roi_front=(50,642,62,58), roi_back=(1,510,415,203), threshold=0.65, method="Template matching", file="./tasks/ActivityShikigami/as/as_check_battle_main.png")
 	# description 
@@ -94,9 +94,9 @@ class ActivityShikigamiAssets:
 	# 挑战 
 	O_FIRE = RuleOcr(roi=(1135,599,85,49), area=(1123,570,106,100), mode="Single", method="Default", keyword="挑战", name="fire")
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(944,28,63,27), area=(943,26,63,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(584,17,63,27), area=(583,16,63,30), mode="Digit", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
-	O_REMAIN_PASS = RuleOcr(roi=(563,26,50,29), area=(563,26,49,28), mode="DigitCounter", method="Default", keyword="", name="remain_pass")
+	O_REMAIN_PASS = RuleOcr(roi=(791,18,50,29), area=(791,18,49,28), mode="Digit", method="Default", keyword="", name="remain_pass")
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 	# 活动票数(没有百分比) 

+ 38 - 38
tasks/ActivityShikigami/config.py

@@ -36,25 +36,25 @@ def check_soul_by_ocr(enable_switch: bool, group_team: str, label: str):
 
 
 class SwitchSoulConfig(BaseModel):
-    enable_switch_pass: bool = Field(default=False, description='是否切换门票爬塔御魂')
-    pass_group_team: str = Field(default='-1,-1', description='组1-7,队伍1-4 中间用英文,分隔')
-    enable_switch_pass_by_name: bool = Field(default=False, description='是否通过ocr切换御魂')
-    pass_group_team_name: str = Field(default='', description='组名,队伍名 中间用英文,分隔')
-
-    enable_switch_ap: bool = Field(default=False, description='是否切换体力爬塔御魂')
-    ap_group_team: str = Field(default='-1,-1', description='组1-7,队伍1-4 中间用英文,分隔')
-    enable_switch_ap_by_name: bool = Field(default=False, description='是否通过ocr切换御魂')
-    ap_group_team_name: str = Field(default='', description='组名,队伍名 中间用英文,分隔')
-
-    enable_switch_boss: bool = Field(default=False, description='是否切换boss爬塔御魂')
-    boss_group_team: str = Field(default='-1,-1', description='组1-7,队伍1-4 中间用英文,分隔')
-    enable_switch_boss_by_name: bool = Field(default=False, description='是否通过ocr切换御魂')
-    boss_group_team_name: str = Field(default='', description='组名,队伍名 中间用英文,分隔')
-
-    enable_switch_ap100: bool = Field(default=False, description='是否切换100体爬塔御魂')
-    ap100_group_team: str = Field(default='-1,-1', description='组1-7,队伍1-4 中间用英文,分隔')
-    enable_switch_ap100_by_name: bool = Field(default=False, description='是否通过ocr切换御魂')
-    ap100_group_team_name: str = Field(default='', description='组名,队伍名 中间用英文,分隔')
+    enable_switch_pass: bool = Field(default=False, description='enable_switch_pass_help')
+    pass_group_team: str = Field(default='-1,-1', description='pass_group_team_help')
+    enable_switch_pass_by_name: bool = Field(default=False, description='enable_switch_pass_by_name_help')
+    pass_group_team_name: str = Field(default='', description='pass_group_team_name_help')
+
+    enable_switch_ap: bool = Field(default=False, description='enable_switch_ap_help')
+    ap_group_team: str = Field(default='-1,-1', description='ap_group_team_help')
+    enable_switch_ap_by_name: bool = Field(default=False, description='enable_switch_ap_by_name_help')
+    ap_group_team_name: str = Field(default='', description='ap_group_team_name_help')
+
+    enable_switch_boss: bool = Field(default=False, description='enable_switch_boss_help')
+    boss_group_team: str = Field(default='-1,-1', description='boss_group_team_help')
+    enable_switch_boss_by_name: bool = Field(default=False, description='enable_switch_boss_by_name_help')
+    boss_group_team_name: str = Field(default='', description='boss_group_team_name_help')
+
+    enable_switch_ap100: bool = Field(default=False, description='enable_switch_ap100_help')
+    ap100_group_team: str = Field(default='-1,-1', description='ap100_group_team_help')
+    enable_switch_ap100_by_name: bool = Field(default=False, description='enable_switch_ap100_by_name_help')
+    ap100_group_team_name: str = Field(default='', description='ap100_group_team_name_help')
 
     # @model_validator(mode='after')
     def validate_switch_soul(self):
@@ -75,25 +75,25 @@ class SwitchSoulConfig(BaseModel):
 
 
 class GeneralBattleConfig(BaseModel):
-    enable_pass_preset: bool = Field(default=False, description='是否切换门票爬塔预设, 仅数字切换御魂可用')
-    enable_pass_green: bool = Field(default=False, description='是否开启门票爬塔绿标')
-    pass_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='门票爬塔绿标位置')
-    enable_pass_anti_detect: bool = Field(default=False, description='门票爬塔战斗过程是否随机点击或滑动')
-
-    enable_ap_preset: bool = Field(default=False, description='是否切换体力爬塔预设, 仅数字切换御魂可用')
-    enable_ap_green: bool = Field(default=False, description='是否开启体力爬塔绿标')
-    ap_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='体力爬塔绿标位置')
-    enable_ap_anti_detect: bool = Field(default=False, description='体力爬塔战斗过程是否随机点击或滑动')
-
-    enable_boss_preset: bool = Field(default=False, description='是否切换boss爬塔预设, 仅数字切换御魂可用')
-    enable_boss_green: bool = Field(default=False, description='是否开启boss爬塔绿标')
-    boss_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='boss爬塔绿标位置')
-    enable_boss_anti_detect: bool = Field(default=False, description='boss爬塔战斗过程是否随机点击或滑动')
-
-    enable_ap100_preset: bool = Field(default=False, description='是否切换100体爬塔预设, 仅数字切换御魂可用')
-    enable_ap100_green: bool = Field(default=False, description='是否开启100体爬塔绿标')
-    ap100_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='100体爬塔绿标位置')
-    enable_ap100_anti_detect: bool = Field(default=False, description='100体爬塔战斗过程是否随机点击或滑动')
+    enable_pass_preset: bool = Field(default=False, description='enable_pass_preset_help')
+    enable_pass_green: bool = Field(default=False, description='enable_pass_green_help')
+    pass_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='pass_green_mark_help')
+    enable_pass_anti_detect: bool = Field(default=True, description='enable_pass_anti_detect_help')
+
+    enable_ap_preset: bool = Field(default=False, description='enable_ap_preset_help')
+    enable_ap_green: bool = Field(default=False, description='enable_ap_green_help')
+    ap_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='ap_green_mark_help')
+    enable_ap_anti_detect: bool = Field(default=True, description='enable_ap_anti_detect_help')
+
+    enable_boss_preset: bool = Field(default=False, description='enable_boss_preset_help')
+    enable_boss_green: bool = Field(default=False, description='enable_boss_green_help')
+    boss_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='boss_green_mark_help')
+    enable_boss_anti_detect: bool = Field(default=True, description='enable_boss_anti_detect_help')
+
+    enable_ap100_preset: bool = Field(default=False, description='enable_ap100_preset_help')
+    enable_ap100_green: bool = Field(default=False, description='enable_ap100_green_help')
+    ap100_green_mark: GreenMarkType = Field(default=GreenMarkType.GREEN_LEFT1, description='ap100_green_mark_help')
+    enable_ap100_anti_detect: bool = Field(default=True, description='enable_ap100_anti_detect_help')
 
 
 class ActivityShikigami(ConfigBase):

+ 6 - 6
tasks/ActivityShikigami/fire/ocr.json

@@ -10,18 +10,18 @@
   },
   {
     "itemName": "remain_ap",
-    "roiFront": "944,28,63,27",
-    "roiBack": "943,26,63,30",
-    "mode": "DigitCounter",
+    "roiFront": "584,17,63,27",
+    "roiBack": "583,16,63,30",
+    "mode": "Digit",
     "method": "Default",
     "keyword": "",
     "description": "体力的数量检测"
   },
   {
     "itemName": "remain_pass",
-    "roiFront": "563,26,50,29",
-    "roiBack": "563,26,49,28",
-    "mode": "DigitCounter",
+    "roiFront": "791,18,50,29",
+    "roiBack": "791,18,49,28",
+    "mode": "Digit",
     "method": "Default",
     "keyword": "",
     "description": "活动体力的剩余检测"

+ 4 - 47
tasks/ActivityShikigami/script_task.py

@@ -211,7 +211,7 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
             if self.start_battle():
                 continue
 
-        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=1)
+        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=4.5)
 
     def _run_ap(self):
         """
@@ -244,7 +244,7 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
             if self.start_battle():
                 continue
 
-        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=1)
+        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=4.5)
 
     def _run_boss(self):
         """
@@ -269,7 +269,7 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
             if self.start_battle():
                 continue
 
-        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_BOSS, interval=1)
+        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_BOSS, interval=4.5)
 
     def _run_ap100(self):
         """
@@ -297,50 +297,7 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
         # 运行战斗
         self.run_general_battle(config=self.get_general_battle_conf())
 
-    # def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-    #     # 通用战斗结束判断
-    #     self.device.stuck_record_add("BATTLE_STATUS_S")
-    #     self.device.click_record_clear()
-    #     logger.info(f"Start {self.climb_type} battle process")
-    #     self.count_map[self.climb_type] = self.current_count
-    #     for btn in (self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP, self.C_RANDOM_BOTTOM):
-    #         btn.name = "BATTLE_RANDOM"
-    #     ok_cnt, max_retry = 0, 8
-    #     while 1:
-    #         sleep(random.uniform(0.5, 1.5))
-    #         self.screenshot()
-    #         # 达到最大重试次数则直接交给上层处理
-    #         if ok_cnt > max_retry:
-    #             break
-    #         # 识别到挑战说明已经退出战斗
-    #         if ok_cnt > 0 and self.ocr_appear(self.O_FIRE):
-    #             return True
-    #         # 战斗失败
-    #         if self.appear(self.I_FALSE):
-    #             logger.warning("Battle failed")
-    #             self.ui_click_until_smt_disappear(self.random_reward_click(click_now=False), self.I_FALSE, interval=1.5)
-    #             return False
-    #         # 战斗成功
-    #         if self.appear_then_click(self.I_WIN, interval=2):
-    #             continue
-    #         #  出现 “魂” 和 紫蛇皮
-    #         if self.appear(self.I_REWARD) or self.appear(self.I_REWARD_PURPLE_SNAKE_SKIN) or \
-    #                 self.appear(self.I_REWARD_GOLD) or self.appear(self.I_REWARD_GOLD_SNAKE_SKIN):
-    #             self.random_reward_click(exclude_click=[self.C_RANDOM_TOP, self.C_RANDOM_LEFT])
-    #             ok_cnt += 1
-    #             continue
-    #         # 已经不在战斗中了, 且奖励也识别过了, 则随机点击
-    #         if ok_cnt > 3 and not self.is_in_battle(False):
-    #             self.random_reward_click(exclude_click=[self.C_RANDOM_TOP, self.C_RANDOM_LEFT])
-    #             self.device.stuck_record_clear()
-    #             ok_cnt += 1
-    #             continue
-    #         # 战斗中随机滑动
-    #         if ok_cnt == 0 and random_click_swipt_enable:
-    #             self.random_click_swipt()
-    #     return True
-
-    @battle_wait_strategy('reserve_default', 'idle_default', failure='default', success='soul')
+    @battle_wait_strategy(success='activity')
     def battle_wait(self, *args, **kwargs):
         return self.battle_wait_with_strategy(*args, **kwargs)
 

+ 13 - 1
tasks/Component/Costume/assets.py

@@ -101,6 +101,19 @@ class CostumeAssets:
 	I_PET_HOUSE_15 = RuleImage(roi_front=(951,383,31,50), roi_back=(900,330,150,150), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main15/main15_pet_house_15.png")
 
 
+	# Image Rule Assets
+	# 狐栖归处庭院判定
+	I_CHECK_MAIN_16 = RuleImage(roi_front=(260,168,80,54), roi_back=(180,100,240,180), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_check_main_16.png")
+	# 探索
+	I_MAIN_GOTO_EXPLORATION_16 = RuleImage(roi_front=(729,231,28,52), roi_back=(680,180,130,150), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_exploration_16.png")
+	# 召唤屋
+	I_MAIN_GOTO_SUMMON_16 = RuleImage(roi_front=(981,218,28,24), roi_back=(930,170,130,150), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_summon_16.png")
+	# 町中
+	I_MAIN_GOTO_TOWN_16 = RuleImage(roi_front=(1014,346,14,34), roi_back=(960,300,100,120), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_town_16.png")
+	# 宠物屋
+	I_PET_HOUSE_16 = RuleImage(roi_front=(1256,402,20,58), roi_back=(1210,340,70,140), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_pet_house_16.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_CHECK_MAIN_2 = RuleImage(roi_front=(1090,146,48,55), roi_back=(880,108,271,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main2/main2_check_main_2.png")
@@ -204,4 +217,3 @@ class CostumeAssets:
 	# description 
 	I_PET_HOUSE_9 = RuleImage(roi_front=(888,327,40,35), roi_back=(730,316,440,57), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_pet_house_9.png")
 
-

+ 3 - 2
tasks/Component/Costume/config.py

@@ -22,6 +22,7 @@ class MainType(str, Enum):
     COSTUME_MAIN_13 = 'costume_main_13'  # 云景阆苑
     COSTUME_MAIN_14 = 'costume_main_14'  # 雪月华庭
     COSTUME_MAIN_15 = 'costume_main_15'  # 茨心乐园
+    COSTUME_MAIN_16 = 'costume_main_16'  # 狐栖归处
 
 # 结界皮肤
 class RealmType(str, Enum):
@@ -52,6 +53,7 @@ class ShikigamiType(str, Enum):
     COSTUME_SHIKIGAMI_9 = 'costume_shikigami_9'  # 鹿眠之森
     COSTUME_SHIKIGAMI_10 = 'costume_shikigami_10'  # 今宵胧明
     COSTUME_SHIKIGAMI_11 = 'costume_shikigami_11'  # 花札幕台
+    COSTUME_SHIKIGAMI_12 = 'costume_shikigami_12'  # 拾光之窗
 
 # 签到主题
 class SignType(str, Enum):
@@ -74,7 +76,7 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_12 = 'costume_battle_12'  # 招财纳福
     COSTUME_BATTLE_13 = 'costume_battle_13'  # 登云问翠
     COSTUME_BATTLE_14 = 'costume_battle_14'  # 茸茨跃动
-
+    COSTUME_BATTLE_15 = 'costume_battle_15'  # 灵狐寄愿
 
 
 class CostumeConfig(BaseModel):
@@ -101,4 +103,3 @@ class CostumeConfig(BaseModel):
 
 
 
-

+ 3 - 3
tasks/Component/Costume/costume_base.py

@@ -21,7 +21,7 @@ main_costume_model = {
         'I_MAIN_GOTO_SUMMON': f'I_MAIN_GOTO_SUMMON_{i}',
         'I_MAIN_GOTO_TOWN': f'I_MAIN_GOTO_TOWN_{i}',
         'I_PET_HOUSE': f'I_PET_HOUSE_{i}'
-    } for i in range(1, 16)
+    } for i in range(1, 17)
 }
 
 
@@ -46,7 +46,7 @@ battle_theme_model = {
         'I_WIN': f'I_WIN_{i}', # 已知:8,12,13,14
         'I_DE_WIN': f'I_DE_WIN_{i}', # 已知:8,12,13,14
         'I_FALSE': f'I_FALSE_{i}' # 已知:8,12,13,14
-    } for i in range(1, 15)
+    } for i in range(1, 16)
 }
 
 # 幕间主题
@@ -69,7 +69,7 @@ shikigami_costume_model = {
         'I_ST_SOULS': f'I_ST_SOULS_{i}',
         'I_ST_REPLACE': f'I_ST_REPLACE_{i}',
     }
-    for i in range(1, 12)  # 目前支持 COSTUME_SHIKIGAMI_1 到 COSTUME_SHIKIGAMI_10
+    for i in range(1, 13)  # 目前支持 COSTUME_SHIKIGAMI_1 到 COSTUME_SHIKIGAMI_12
 }
 
 class CostumeBase:

+ 1 - 1
tasks/Component/Costume/costume_test_shikigami.py

@@ -162,6 +162,6 @@ if __name__ == '__main__':
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
-    t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_4)
+    t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_12)
     # t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_DEFAULT)
     t.run()

+ 47 - 0
tasks/Component/Costume/main16/image.json

@@ -0,0 +1,47 @@
+[
+  {
+    "itemName": "check_main_16",
+    "imageName": "main16_check_main_16.png",
+    "roiFront": "260,168,80,54",
+    "roiBack": "180,100,240,180",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "狐栖归处庭院判定"
+  },
+  {
+    "itemName": "main_goto_exploration_16",
+    "imageName": "main16_main_goto_exploration_16.png",
+    "roiFront": "729,231,28,52",
+    "roiBack": "680,180,130,150",
+    "method": "Template matching",
+    "threshold": 0.55,
+    "description": "探索"
+  },
+  {
+    "itemName": "main_goto_summon_16",
+    "imageName": "main16_main_goto_summon_16.png",
+    "roiFront": "981,218,28,24",
+    "roiBack": "930,170,130,150",
+    "method": "Template matching",
+    "threshold": 0.55,
+    "description": "召唤屋"
+  },
+  {
+    "itemName": "main_goto_town_16",
+    "imageName": "main16_main_goto_town_16.png",
+    "roiFront": "1014,346,14,34",
+    "roiBack": "960,300,100,120",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "町中"
+  },
+  {
+    "itemName": "pet_house_16",
+    "imageName": "main16_pet_house_16.png",
+    "roiFront": "1256,402,20,58",
+    "roiBack": "1210,340,70,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "宠物屋"
+  }
+]

BIN
tasks/Component/Costume/main16/main16_check_main_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_exploration_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_summon_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_town_16.png


BIN
tasks/Component/Costume/main16/main16_pet_house_16.png


+ 17 - 0
tasks/Component/CostumeBattle/assets.py

@@ -94,6 +94,23 @@ class CostumeBattleAssets:
 	I_BATTLE_INFO_14 = RuleImage(roi_front=(234,17,32,32), roi_back=(215,0,142,58), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle14/battle14_battle_info_14.png")
 
 
+	# Image Rule Assets
+	# 左上角退出 
+	I_EXIT_15 = RuleImage(roi_front=(25,20,22,25), roi_back=(10,10,69,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_exit_15.png")
+	# 左上角好友 
+	I_FRIENDS_15 = RuleImage(roi_front=(98,15,22,30), roi_back=(74,10,71,47), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_friends_15.png")
+	# 指针 
+	I_LOCAL_15 = RuleImage(roi_front=(25,561,28,37), roi_back=(9,485,110,121), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_local_15.png")
+	# 战斗胜利 
+	I_WIN_15 = RuleImage(roi_front=(544,190,68,67), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_win_15.png")
+	# 针对封魔的特殊 
+	I_DE_WIN_15 = RuleImage(roi_front=(590,152,87,129), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png")
+	# 失败 
+	I_FALSE_15 = RuleImage(roi_front=(597,190,57,66), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_false_15.png")
+	# 战斗信息标识 
+	I_BATTLE_INFO_15 = RuleImage(roi_front=(234,17,32,32), roi_back=(215,0,142,58), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_LOCAL_2 = RuleImage(roi_front=(30,569,21,22), roi_back=(30,569,21,22), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_local_2.png")

BIN
tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_exit_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_false_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_friends_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_local_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_win_15.png


+ 65 - 0
tasks/Component/CostumeBattle/battle15/image.json

@@ -0,0 +1,65 @@
+[
+  {
+    "itemName": "exit_15",
+    "imageName": "battle15_exit_15.png",
+    "roiFront": "25,20,22,25",
+    "roiBack": "10,10,69,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_15",
+    "imageName": "battle15_friends_15.png",
+    "roiFront": "98,15,22,30",
+    "roiBack": "74,10,71,47",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  },
+  {
+    "itemName": "local_15",
+    "imageName": "battle15_local_15.png",
+    "roiFront": "25,561,28,37",
+    "roiBack": "9,485,110,121",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "win_15",
+    "imageName": "battle15_win_15.png",
+    "roiFront": "544,190,68,67",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗胜利"
+  },
+  {
+    "itemName": "de_win_15",
+    "imageName": "battle15_de_win_15.png",
+    "roiFront": "590,152,87,129",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "针对封魔的特殊"
+  },
+  {
+    "itemName": "false_15",
+    "imageName": "battle15_false_15.png",
+    "roiFront": "597,190,57,66",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "失败"
+  },
+  {
+    "itemName": "battle_info_15",
+    "imageName": "battle15_battle_info_15.png",
+    "roiFront": "234,17,32,32",
+    "roiBack": "215,0,142,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗信息标识"
+  }
+]

+ 43 - 0
tasks/Component/CostumeShikigami/assets.py

@@ -139,6 +139,49 @@ class CostumeShikigamiAssets:
 	I_SOU_CLICK_PRESENT_11 = RuleImage(roi_front=(975,292,34,34), roi_back=(971,134,42,530), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_click_present_11.png")
 
 
+	# Image Rule Assets
+	# description 
+	I_CHECK_RECORDS_12 = RuleImage(roi_front=(276,81,31,36), roi_back=(269,73,44,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png")
+	# description 
+	I_RECORD_SOUL_BACK_12 = RuleImage(roi_front=(17,13,43,47), roi_back=(12,10,52,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_1_12 = RuleImage(roi_front=(1095,83,14,50), roi_back=(1092,81,21,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_2_12 = RuleImage(roi_front=(1095,155,14,39), roi_back=(1092,149,20,51), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_3_12 = RuleImage(roi_front=(1096,225,8,50), roi_back=(1093,220,17,56), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_4_12 = RuleImage(roi_front=(1093,295,11,47), roi_back=(1090,293,19,51), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_5_12 = RuleImage(roi_front=(1096,364,8,49), roi_back=(1092,361,15,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_6_12 = RuleImage(roi_front=(1093,442,11,37), roi_back=(1088,437,20,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_7_12 = RuleImage(roi_front=(1093,506,6,41), roi_back=(1091,500,13,53), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png")
+	# description 
+	I_SOU_SWITCH_1_12 = RuleImage(roi_front=(977,138,32,30), roi_back=(969,129,48,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png")
+	# description 
+	I_SOU_SWITCH_2_12 = RuleImage(roi_front=(973,293,37,32), roi_back=(968,287,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png")
+	# description 
+	I_SOU_SWITCH_3_12 = RuleImage(roi_front=(981,445,26,35), roi_back=(979,443,32,40), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png")
+	# description 
+	I_SOU_SWITCH_4_12 = RuleImage(roi_front=(979,602,28,25), roi_back=(973,598,39,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png")
+	# description 
+	I_SOU_TEAM_PRESENT_12 = RuleImage(roi_front=(734,77,100,41), roi_back=(726,71,115,54), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png")
+	# description 
+	I_SOU_SWITCH_SURE_12 = RuleImage(roi_front=(702,401,116,55), roi_back=(690,399,148,64), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png")
+	# description 
+	I_SOUL_PRESET_12 = RuleImage(roi_front=(342,85,74,31), roi_back=(338,77,83,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png")
+	# description 
+	I_ST_REPLACE_12 = RuleImage(roi_front=(884,169,63,67), roi_back=(872,155,86,99), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png")
+	# description 
+	I_ST_SOULS_12 = RuleImage(roi_front=(1192,237,40,67), roi_back=(1182,229,59,86), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png")
+	# description 
+	I_SOU_CHECK_IN_12 = RuleImage(roi_front=(274,74,43,49), roi_back=(271,69,48,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png")
+	# description 
+	I_SOU_CLICK_PRESENT_12 = RuleImage(roi_front=(975,292,34,34), roi_back=(971,134,42,530), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png")
+
+
 	# Image Rule Assets
 	# 用于判断在式神录 
 	I_CHECK_RECORDS_2 = RuleImage(roi_front=(267,76,51,46), roi_back=(265,74,55,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_check_records_2.png")

+ 182 - 0
tasks/Component/CostumeShikigami/sk12/image.json

@@ -0,0 +1,182 @@
+[
+  {
+    "itemName": "check_records_12",
+    "imageName": "sk12_check_records_12.png",
+    "roiFront": "276,81,31,36",
+    "roiBack": "269,73,44,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "record_soul_back_12",
+    "imageName": "sk12_record_soul_back_12.png",
+    "roiFront": "17,13,43,47",
+    "roiBack": "12,10,52,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_1_12",
+    "imageName": "sk12_sou_check_group_1_12.png",
+    "roiFront": "1095,83,14,50",
+    "roiBack": "1092,81,21,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_2_12",
+    "imageName": "sk12_sou_check_group_2_12.png",
+    "roiFront": "1095,155,14,39",
+    "roiBack": "1092,149,20,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_3_12",
+    "imageName": "sk12_sou_check_group_3_12.png",
+    "roiFront": "1096,225,8,50",
+    "roiBack": "1093,220,17,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_4_12",
+    "imageName": "sk12_sou_check_group_4_12.png",
+    "roiFront": "1093,295,11,47",
+    "roiBack": "1090,293,19,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_5_12",
+    "imageName": "sk12_sou_check_group_5_12.png",
+    "roiFront": "1096,364,8,49",
+    "roiBack": "1092,361,15,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_6_12",
+    "imageName": "sk12_sou_check_group_6_12.png",
+    "roiFront": "1093,442,11,37",
+    "roiBack": "1088,437,20,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_7_12",
+    "imageName": "sk12_sou_check_group_7_12.png",
+    "roiFront": "1093,506,6,41",
+    "roiBack": "1091,500,13,53",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_1_12",
+    "imageName": "sk12_sou_switch_1_12.png",
+    "roiFront": "977,138,32,30",
+    "roiBack": "969,129,48,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_2_12",
+    "imageName": "sk12_sou_switch_2_12.png",
+    "roiFront": "973,293,37,32",
+    "roiBack": "968,287,50,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_3_12",
+    "imageName": "sk12_sou_switch_3_12.png",
+    "roiFront": "981,445,26,35",
+    "roiBack": "979,443,32,40",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_4_12",
+    "imageName": "sk12_sou_switch_4_12.png",
+    "roiFront": "979,602,28,25",
+    "roiBack": "973,598,39,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_team_present_12",
+    "imageName": "sk12_sou_team_present_12.png",
+    "roiFront": "734,77,100,41",
+    "roiBack": "726,71,115,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_sure_12",
+    "imageName": "sk12_sou_switch_sure_12.png",
+    "roiFront": "702,401,116,55",
+    "roiBack": "690,399,148,64",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "soul_preset_12",
+    "imageName": "sk12_soul_preset_12.png",
+    "roiFront": "342,85,74,31",
+    "roiBack": "338,77,83,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_replace_12",
+    "imageName": "sk12_st_replace_12.png",
+    "roiFront": "884,169,63,67",
+    "roiBack": "872,155,86,99",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_souls_12",
+    "imageName": "sk12_st_souls_12.png",
+    "roiFront": "1192,237,40,67",
+    "roiBack": "1182,229,59,86",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_in_12",
+    "imageName": "sk12_sou_check_in_12.png",
+    "roiFront": "274,74,43,49",
+    "roiBack": "271,69,48,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_click_present_12",
+    "imageName": "sk12_sou_click_present_12.png",
+    "roiFront": "975,292,34,34",
+    "roiBack": "971,134,42,530",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

BIN
tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png


+ 10 - 3
tasks/Component/GeneralBattle/assets.py

@@ -168,7 +168,7 @@ class GeneralBattleAssets:
 
 	# Click Rule Assets
 	# 右上角的聊天信息 
-	C_END_MESSAGE_RIGHT_TOP = RuleClick(roi_front=(846,4,404,34), roi_back=(846,4,404,34), name="end_message_right_top")
+	C_END_MESSAGE_RIGHT_TOP = RuleClick(roi_front=(848,0,399,46), roi_back=(849,0,397,45), name="end_message_right_top")
 	# description 
 	C_END_BUFF_AREA_1 = RuleClick(roi_front=(150,638,295,41), roi_back=(150,638,295,41), name="end_buff_area_1")
 	# description 
@@ -236,10 +236,17 @@ class GeneralBattleAssets:
 	C_END_GREED = RuleClick(roi_front=(138,16,512,93), roi_back=(138,16,512,93), name="end_greed")
 
 
+	# Click Rule Assets
+	# 获得奖励中间的区域 
+	C_END_ACTIVITY_REWARD = RuleClick(roi_front=(400,250,493,226), roi_back=(401,252,494,230), name="end_activity_reward")
+
+
 	# Image Rule Assets
 	# description 
-	I_END_FIX_1 = RuleImage(roi_front=(896,251,218,64), roi_back=(119,66,1136,620), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
+	I_END_FIX_1 = RuleImage(roi_front=(721,119,89,58), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
 	# description 
-	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.7, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
+	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
+	#  
+	I_END_FIX_3 = RuleImage(roi_front=(871,278,150,49), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_3.png")
 
 

+ 4 - 0
tasks/Component/GeneralBattle/battle.py

@@ -0,0 +1,4 @@
+
+
+# 支持 外界的战斗开始阶段 | 内部的: 战斗准备阶段、切buff、切阵容、换式神。
+# 在 battle_wait 退出后多一层校验,

+ 99 - 42
tasks/Component/GeneralBattle/battle_wait.py

@@ -1,6 +1,7 @@
 import random
 import time
 import copy
+from copy import deepcopy
 
 
 from functools import wraps
@@ -190,12 +191,7 @@ class BattleWaitPlan:
         return self
 
 class battle_wait_strategy:
-    """
-    使用with 上下文临时修改  battle_wait_plan
-    首次装饰 func 初始化 battle_wait_plan
-    """
-    battle_wait_plan: BattleWaitPlan = None
-    options: dict[str: dict] = {
+    _DEFAULT_OPTIONS: dict[str: dict] = {
         'success': {
             'reward_exclude_click_1': ['C_END_MESSAGE_RIGHT_TOP', 'C_END_BUFF_AREA_1', 'C_END_BUFF_AREA_2', 'C_END_SOUL_RECORD', 'C_END_SOUL_DETAILS',],
             'reward_exclude_click_2': ['C_END_MESSAGE_RIGHT_TOP', 'C_END_BUFF_AREA_1', 'C_END_BUFF_AREA_2', 'C_END_SOUL_RECORD', 'C_END_SOUL_DETAILS',
@@ -204,44 +200,39 @@ class battle_wait_strategy:
         }
     }
 
+    battle_wait_plan: BattleWaitPlan = None
+    options: dict[str: dict] = deepcopy(_DEFAULT_OPTIONS)
+
+
 
     def __init__(self, *arg, **kwargs):
-        self._temp_options = kwargs.pop('options', None)
-        if self._temp_options is not None:
-            if not isinstance(self._temp_options, dict):
-                raise TypeError(f'temp_options must be a dict, got {self._temp_options!r}')
-            for key, value in self._temp_options.items():
+        self._options = kwargs.pop('options', None)
+        if self._options is not None:
+            if not isinstance(self._options, dict):
+                raise TypeError(f'temp_options must be a dict, got {self._options!r}')
+            for key, value in self._options.items():
                 if not isinstance(key, str):
                     raise
                 if not isinstance(value, dict):
-                    raise TypeError(f'temp_options must be a dict, got {self._temp_options!r}')
-            battle_wait_strategy.options.update(self._temp_options)
+                    raise TypeError(f'temp_options must be a dict, got {self._options!r}')
+            # battle_wait_strategy.options.update(self._options)
 
-        self._temp_battle_wait_plan = None
-        if battle_wait_strategy.battle_wait_plan is None:
-            # 首次装饰 func 初始化 battle_wait_plan
-            battle_wait_strategy.battle_wait_plan = BattleWaitPlan(*arg, **kwargs)  # pylint: disable=unused-argument
-        elif self._temp_battle_wait_plan is None:
-            # 使用 with 上下文临时修改 battle_wait_plan
-            self._temp_battle_wait_plan = BattleWaitPlan(*arg, **kwargs)
+        self._battle_wait_plan = BattleWaitPlan(*arg, **kwargs)
 
     def __enter__(self):
         self._previous_plan = battle_wait_strategy.battle_wait_plan
-
-        if self._temp_battle_wait_plan is not None:
-            battle_wait_strategy.battle_wait_plan = self._temp_battle_wait_plan
+        battle_wait_strategy.battle_wait_plan = self._battle_wait_plan
         return self
 
     def __exit__(self, *exc):
         battle_wait_strategy.battle_wait_plan = self._previous_plan
-        self._temp_options = None
+        self._options = None
         return False
 
     def __str__(self):
-        temp_plan = getattr(self, '_temp_battle_wait_plan', None)
+        temp_plan = getattr(self, '_battle_wait_plan', None)
         default_plan = getattr(self, 'battle_wait_plan', None)
         options = dict(battle_wait_strategy.options or {})
-        options.update(self._temp_options or {})
 
         if temp_plan is not None:
             plan = temp_plan
@@ -268,6 +259,14 @@ class battle_wait_strategy:
         return self
 
     def __call__(self, func: Callable[P, T]) -> Callable[P, T]:
+        # 跨任务重置配置和策略,但是不重置状态
+        battle_wait_strategy.options = (
+            deepcopy(self._options)
+            if self._options is not None
+            else deepcopy(self._DEFAULT_OPTIONS)
+        )
+        battle_wait_strategy.battle_wait_plan = self._battle_wait_plan
+
         @wraps(func)
         def inner(owner, *args: P.args, **kwargs: P.kwargs) -> T:
             # 兼容性处理
@@ -289,7 +288,6 @@ class battle_wait_strategy:
             #     self.battle_wait_plan,
             # )
             options = dict(battle_wait_strategy.options or {})
-            options.update(self._temp_options or {})
             return func(owner, battle_wait_plan=current_plan, options=options) \
                 if options else func(owner, battle_wait_plan=current_plan)
 
@@ -304,11 +302,8 @@ class battle_wait_strategy:
             if not isinstance(v, dict):
                 raise TypeError()
         # 先装饰器, 后临时变量
-        if battle_wait_strategy.options is None:
-            battle_wait_strategy.options = options
-            self._temp_options = None
-        else:
-            self._temp_options = options
+        self._previous_options = battle_wait_strategy.options
+        battle_wait_strategy.options = deepcopy(options)
         return self
 
 
@@ -409,7 +404,6 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                     self.device.click(x=x, y=y, control_name='reward_item')
                     continue
                 self.click(self._reward_exclude_click_2, interval=1.5)
-                pass
             else:
                 logger.info('Get all reward')
                 bw_ctx.success = True
@@ -425,6 +419,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         if self.appear(self.I_FALSE, threshold=0.8):
             logger.warning('False battle')
             self.ui_click_until_disappear(self.I_FALSE)
+            bw_ctx.success = False
             bw_ctx.completion = True
             return HookSignal.CONTINUE
         return HookSignal.CONTINUE
@@ -436,9 +431,12 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         return HookSignal.CONTINUE
 
     def _bw_randomclick_default(self, bw_ctx: BattleWaitContext) -> HookSignal:
+        done = getattr(bw_ctx, '_bw_randomclick_state', False)
+        if done:
+            return HookSignal.CONTINUE
         if not self.is_in_battle(is_screenshot=False):
             return HookSignal.CONTINUE
-        if 0 <= random.randint(0, 500) <= 20:  # 百分之4的概率
+        if random.random() < 0.005 :  # 低概率
             rand_type = random.randint(0, 2)
             match rand_type:
                 case 0:
@@ -447,6 +445,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                     self.swipe(self.S_BATTLE_RANDOM_LEFT, interval=20)
                 case 2:
                     self.swipe(self.S_BATTLE_RANDOM_RIGHT, interval=20)
+            setattr(bw_ctx, f'_bw_randomclick_state', True)
             # 重新设置为长战斗
             # self.device.stuck_record_add('BATTLE_STATUS_S')
         else:
@@ -495,19 +494,72 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                 break
         return HookSignal.CONTINUE
 
+    @cached_property
+    def exclude_click_activity(self, areas: list[str] = None) -> RuleClickExclude:
+        inputs = []
+        for area in ['C_END_MESSAGE_RIGHT_TOP', 'C_END_ACTIVITY_REWARD']:
+            click = getattr(self, area, None)
+            if click is None:
+                raise ValueError(f'Unknown success exclusion click: {area!r}')
+            inputs.append(click)
+        return RuleClickExclude(inputs, name='exclude_click_activity', strategy='rejection', distribution='uniform')
+
+    def _bw_success_activity(self, bw_ctx: BattleWaitContext) -> HookSignal:
+        """
+        战斗结算是有 “获得奖励” 的适用
+        """
+        if not self.appear(self.I_UI_REWARD):
+            return HookSignal.CONTINUE
+        self.screenshot()
+        if not self.appear(self.I_UI_REWARD):
+            return HookSignal.CONTINUE
+
+        logger.info('Win battle')
+        timer = Timer(20).start()
+        while 1:
+            self.screenshot()
+
+            # 不小心点到了具体的奖励,他会弹出这个物品的详细描述 里面必定包含有“获取途径”
+            if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2) or self.appear(self.I_END_FIX_3):
+                self.screenshot()
+                if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2) or self.appear(self.I_END_FIX_3):
+                    self.click(self.C_REWARD_2, interval=2.5)
+                continue
+
+            if self.appear(self.I_UI_REWARD):
+                if random.random() < 0.02:
+                    # 有一定的概率专门点击具体的奖励物品
+                    x, y = self.exclude_click_activity.coord_in_excluded(['C_END_ACTIVITY_REWARD'])
+                    self.device.click(x=x, y=y, control_name='reward_item')
+                    continue
+                self.click(self.exclude_click_activity, interval=2.5)
+            elif not self.appear(self.I_END_FIX_2):
+                self.screenshot()
+                if any([self.appear(self.I_UI_REWARD), self.appear(self.I_END_FIX_1), self.appear(self.I_END_FIX_2), self.appear(self.I_END_FIX_3)]):
+                    continue
+                logger.info('Get all reward')
+                bw_ctx.success = True
+                bw_ctx.completion = True
+                return HookSignal.DONE
+
+            if timer.reached_and_reset():
+                logger.warning('battle ')
+                break
+        return HookSignal.CONTINUE
+
 
     # ------------------------------------------------------------------------------------------------------------------
     def battle_wait_with_strategy(self, *args, **kwargs) -> bool:
         """
         三种自定义配置方法:
-        1. 使用装饰器battle_wait_strategy
+        1. 使用装饰器battle_wait_strategy, 将会覆盖掉类变量
             @battle_wait_strategy( 'reserve_default', 'idle_default', failure='default')
             def battle_wait(self, *args, **kwargs):
                 return self.battle_wait_with_strategy(*args, **kwargs)
-        2. 使用 with 上下文 (!在1基础上)
+        2. 使用 with 上下文 (!在1基础上), 将会临时覆盖掉原先的类变量,退出后恢复
             with battle_wait_strategy('reserve_default'):
                 test_battle_wait.battle_wait()
-        3. 调用时动态传参 (!在2基础上)
+        3. 调用时动态传参 (!在1基础上), 不覆盖,就临时更新策略
             obj.battle_wait(random_click_swipt_enable=1)  # 详细参数看 battle_wait_strategy.__call__()
 
         理解 event + strategy 概念: 把战斗过程抽象为一系列触发事件以及对应的实现函数,也称hook。
@@ -515,7 +567,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         这些 hook 跑在一个 while 里面,默认的调用顺序 BattleWaitPlan.SEQUENCE_DEFAULT = 'completion > interrupt > success > failure > idle'
         setup 没有跑在 while里面 而是在 while之前
 
-        event + strategy 拼成了一个hook, 一个 event 在一次战斗过程中只能挂载一个 strategy】
+        event + strategy 拼成了一个hook, 一个 event 在一次战斗过程中只能挂载一个 strategy
         自定义hook就是字符串拼起来:  battle_wait_strategy的入参可以有 ‘event_strategy’ 或者 'event=strategy'
         可以添加任意 event 以及其对应的 strategy。比如 ‘yyy_default’ 'abcd_edf'
         但是必须要实现对应的hook 上面的比如 _bw_yyy_default() 以及 _bw_abcd_edf()
@@ -523,13 +575,19 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         hook 可以自定义顺序,比如 battle_wait_strategy(sequence='completion > interrupt > success > failure > idle')
         如果没有指定sequence, 新增的event会按照传参时候从左到右排序,左边高优先级,新增的会插入到 failure 和 idle 之间
 
+        ----------------------------------------------------------------------------------------------------------------
         如果希望每一个hook带上参数:
-        1. 可以在装饰器定义 @battle_wait_strategy(options = options)
-        2. 上下文带上  with battle_wait_strategy(...).with_options(options)
+        1. 在 battle_wait_strategy 定义了一组默认的 options
+        2. 可以在装饰器定义 @battle_wait_strategy(options = options),这里将会覆盖掉原先的 battle_wait_strategy.options
+        3. 上下文带上  with battle_wait_strategy(...).with_options(options),同样也是临时覆盖掉 battle_wait_strategy.options
+        4.
         options: dict[str: dict] = {
             "setup": {...}
             ...
         }
+        ----------------------------------------------------------------------------------------------------------------
+        跨战斗,考虑把状态挂到方法上,而不是挂到类对象上。】
+        我突然感觉 一个类里面装了 策略和参数,这样不好,考虑拆分成两个装饰器
 
         """
         bw_ctx = BattleWaitContext()
@@ -553,7 +611,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             for handler in handlers:
                 result = handler(bw_ctx)
                 if handler.__name__.startswith('_bw_completion') and result == HookSignal.DONE:
-                    return True
+                    return bw_ctx.success
                 if result == HookSignal.CONTINUE:
                     continue
 
@@ -588,4 +646,3 @@ if __name__ == '__main__':
 
 
 
-

+ 5 - 5
tasks/Component/GeneralBattle/general_battle.py

@@ -43,7 +43,7 @@ class GeneralBattle(BattleWait, GeneralBuff):
         if self.is_in_battle(False):
             self.green_mark(config.green_enable, config.green_mark)
         # 战中设置
-        win = self.battle_wait(config.random_click_swipt_enable)
+        win = self.battle_wait(random_click_swipt_enable=config.random_click_swipt_enable)
         if win:
             return True
         else:
@@ -69,9 +69,9 @@ class GeneralBattle(BattleWait, GeneralBuff):
                         self.switch_preset_team(config.preset_enable, config.preset_group, config.preset_team)
                         self.check_and_open_buff(buff)
                         confed = True
-                # 点击准备(锁定阵容自动点准备,不锁定阵容前面也已经配置完毕需要点准备)
-                if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=0.8):
-                    continue
+                    # 点击准备(锁定阵容自动点准备,不锁定阵容前面也已经配置完毕需要点准备)
+                    if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=0.8):
+                        continue
                 continue
             # 未知界面, 既不是准备界面也不是战斗界面
             # logger.info('Wait for preparation page')  # 这玩意刷屏
@@ -87,7 +87,7 @@ class GeneralBattle(BattleWait, GeneralBuff):
         # 如果没有锁定队伍那么在点击准备后才退出的,退四的话就直接退出
         if not config.lock_team_enable and not exit_four:
             # 点击准备按钮
-            self.wait_until_appear(self.I_PREPARE_HIGHLIGHT)
+            self.wait_until_appear(self.I_PREPARE_HIGHLIGHT, wait_time=5)
             while 1:
                 self.screenshot()
                 if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):

+ 2 - 2
tasks/Component/GeneralBattle/gw/click.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "end_message_right_top",
-    "roiFront": "846,4,404,34",
-    "roiBack": "846,4,404,34",
+    "roiFront": "848,0,399,46",
+    "roiBack": "849,0,397,45",
     "description": "右上角的聊天信息"
   },
   {

+ 8 - 0
tasks/Component/GeneralBattle/gw/click_activity.json

@@ -0,0 +1,8 @@
+[
+  {
+    "itemName": "end_activity_reward",
+    "roiFront": "400,250,493,226",
+    "roiBack": "401,252,494,230",
+    "description": "获得奖励中间的区域"
+  }
+]

BIN
tasks/Component/GeneralBattle/gw/gw_end_fix_1.png


BIN
tasks/Component/GeneralBattle/gw/gw_end_fix_3.png


+ 12 - 3
tasks/Component/GeneralBattle/gw/image.json

@@ -2,10 +2,10 @@
   {
     "itemName": "end_fix_1",
     "imageName": "gw_end_fix_1.png",
-    "roiFront": "896,251,218,64",
+    "roiFront": "721,119,89,58",
     "roiBack": "119,66,1136,620",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.85,
     "description": "description"
   },
   {
@@ -14,7 +14,16 @@
     "roiFront": "800,251,100,33",
     "roiBack": "32,90,1137,547",
     "method": "Template matching",
-    "threshold": 0.7,
+    "threshold": 0.85,
     "description": "description"
+  },
+  {
+    "itemName": "end_fix_3",
+    "imageName": "gw_end_fix_3.png",
+    "roiFront": "871,278,150,49",
+    "roiBack": "119,66,1136,620",
+    "method": "Template matching",
+    "threshold": 0.85,
+    "description": ""
   }
 ]

+ 3 - 0
tasks/Exploration/base.py

@@ -198,6 +198,9 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
             if self.is_in_battle():
                 logger.warning('Opening settings failed due to now in battle')
                 return
+            if (self.appear_then_click(self.I_UI_CONFIRM, interval=1)
+                    or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1)):
+                continue
             if self.click(self.C_CLICK_SETTINGS, interval=2):
                 continue
 

+ 4 - 1
tasks/Exploration/solo.py

@@ -87,11 +87,14 @@ class SoloExploration(BaseExploration):
                 if not self.explore_init:
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
-                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON, timeout=5)
                     self.explore_init = True
                     continue
                 if self._handle_treasure_box():
                     continue
+                if (self.appear_then_click(self.I_UI_CONFIRM, interval=1)
+                        or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1)):
+                    continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
                     if self.ui_get_reward(self.I_BATTLE_REWARD):

+ 8 - 4
tasks/FallenSun/script_task.py

@@ -5,6 +5,9 @@ import random
 from time import sleep
 from datetime import time, datetime, timedelta
 
+from module.logger import logger
+from module.exception import TaskEnd
+
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff
@@ -14,8 +17,8 @@ from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.FallenSun.assets import FallenSunAssets
 from tasks.FallenSun.config import FallenSun, UserStatus
-from module.logger import logger
-from module.exception import TaskEnd
+from tasks.Component.GeneralBattle.battle_wait import battle_wait_strategy
+
 
 class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, FallenSunAssets):
 
@@ -457,8 +460,9 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
     #             break
     #
     #     return win
-    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-        return self.battle_wait_v2(random_click_swipt_enable=random_click_swipt_enable)
+    @battle_wait_strategy()
+    def battle_wait(self, *args, **kwargs):
+        return self.battle_wait_with_strategy(*args, **kwargs)
 
 
 if __name__ == '__main__':

+ 3 - 4
tasks/RichMan/mall/navbar.py

@@ -74,8 +74,7 @@ class MallNavbar(GameUi, RichManAssets):
         :return:
         """
         self._enter_sundry()
-        # 增加超时保护:15秒内未出现勋章页确认则放弃,避免入口点击无效时无限循环
-        self.ui_click(self.I_SIDE_SURE_MEDAL, self.I_SIDE_CHECK_MEDAL, timeout=15)
+        self.ui_click(self.I_SIDE_SURE_MEDAL, self.I_SIDE_CHECK_MEDAL, interval=3, timeout=15)
 
     def _enter_charisma(self):
         """
@@ -90,8 +89,8 @@ class MallNavbar(GameUi, RichManAssets):
         返回商城
         :return:
         """
-        # 增加超时保护:15秒内未回到商城则放弃,避免界面异常时无限点击返回按钮导致卡死
-        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_MALL, timeout=15)
+        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_MALL, interval=3, timeout=6)
+
 
     def mall_resource(self, index: int) -> int:
         """

+ 1 - 1
tasks/SoulsTidy/script_task.py

@@ -142,7 +142,7 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                     if firvel is None or firvel == '':
                         logger.info('ocr result is Null')
                         continue
-                    if firvel != '古':
+                    if (firvel != '古') and (firvel != '+0'):
                         # 问就是 把 +0 识别成了 古
                         logger.info('No zero level, bongna done')
                         break

+ 93 - 9
tests/tasks/Component/GeneralBattle/test_battle_wait.py

@@ -33,7 +33,7 @@ def test_decorator_passes_its_plan_to_the_wrapped_function():
     strategy = battle_wait_strategy('reserve_default', 'idle_default', failure='custom')
 
     @strategy
-    def battle_wait(owner, *, battle_wait_plan):
+    def battle_wait(owner, *, battle_wait_plan, options=None):
         return battle_wait_plan
 
     plan = battle_wait(object())
@@ -47,7 +47,7 @@ def test_with_context_uses_a_temporary_plan_and_restores_the_default_plan():
     strategy = battle_wait_strategy('success_default')
 
     @strategy
-    def battle_wait(owner, *, battle_wait_plan):
+    def battle_wait(owner, *, battle_wait_plan, options=None):
         return battle_wait_plan
 
     default_plan = battle_wait_strategy.battle_wait_plan
@@ -90,6 +90,7 @@ def test_setup_runs_before_the_wait_loop():
 
         def _bw_completion_finish(self, bw_ctx):
             self.events.append('completion')
+            bw_ctx.success = True
             return HookSignal.DONE
 
     battle_wait = OrderedBattleWait()
@@ -117,6 +118,7 @@ def test_custom_hook_is_resolved_and_executed_in_the_configured_sequence():
 
         def _bw_completion_finish(self, bw_ctx):
             self.events.append('completion')
+            bw_ctx.success = True
             return HookSignal.DONE
 
     battle_wait = CustomBattleWait()
@@ -157,7 +159,7 @@ def test_dynamic_override_does_not_modify_the_default_plan():
     strategy = battle_wait_strategy('success_default')
 
     @strategy
-    def battle_wait(owner, *, battle_wait_plan):
+    def battle_wait(owner, *, battle_wait_plan, options=None):
         return battle_wait_plan
 
     default_plan = battle_wait_strategy.battle_wait_plan
@@ -174,7 +176,7 @@ def test_dynamic_override_is_only_valid_for_the_current_call():
     strategy = battle_wait_strategy('success_default')
 
     @strategy
-    def battle_wait(owner, *, battle_wait_plan):
+    def battle_wait(owner, *, battle_wait_plan, options=None):
         return battle_wait_plan
 
     battle_wait(object(), random_click_swipt_enable=True)
@@ -183,7 +185,8 @@ def test_dynamic_override_is_only_valid_for_the_current_call():
     assert not hasattr(plan_without_override, 'randomclick')
 
 
-# 验证单层装饰器保存自己的 options,with_options() 只在上下文内临时覆盖,退出后恢复。
+# options 与 plan 同语义: 装饰器覆盖全局, with_options 临时覆盖并在退出时还原(__exit__ 还原 _previous_options)。
+# 本测试同时锁定 __exit__ 的还原行为 —— 若还原缺失, 最后一组断言会失败。
 def test_decorator_options_and_with_options_are_scoped_to_the_current_call():
     received_options = []
     decorator_options = {
@@ -207,6 +210,7 @@ def test_decorator_options_and_with_options_are_scoped_to_the_current_call():
 
         def _bw_completion_record(self, bw_ctx):
             received_options.append(bw_ctx.options)
+            bw_ctx.success = True
             return HookSignal.DONE
 
         @strategy
@@ -215,19 +219,99 @@ def test_decorator_options_and_with_options_are_scoped_to_the_current_call():
 
     battle_wait = object.__new__(OptionBattleWait)
 
+    # 装饰器覆盖全局: 调用方拿到装饰器的整份 options
     assert battle_wait.battle_wait() is True
     assert received_options[-1] == decorator_options
 
     with strategy.with_options(context_options):
+        # with 是整份覆盖, 不是合并: 装饰器的 completion 键也被覆盖掉
         assert battle_wait.battle_wait() is True
-        assert received_options[-1] == {
-            'completion': {'source': 'decorator'},
-            'success': {'excludes': ['C_END_MESSAGE_RIGHT_TOP']},
-        }
+        assert received_options[-1] == context_options
         strategy_text = str(strategy)
         assert 'options=' in strategy_text
         assert 'C_END_MESSAGE_RIGHT_TOP' in strategy_text
 
+    # 退出 with 后还原为装饰器覆盖的那份(需要 __exit__ 还原 _previous_options)
     assert battle_wait.battle_wait() is True
     assert received_options[-1] == decorator_options
     assert 'C_REWARD_1' in str(strategy)
+
+
+# 跨任务(两个装饰器)场景。复现 script.py 的调度时序: 每个任务运行前用 load_module
+# 重新执行自己的 script_task.py, 即"装饰器在任务运行时才生效, 后加载的任务覆盖前者"。
+# 契约: options 与 battle_wait_plan 语义完全一致 —— 都是全局槽位, 后加载装饰器整份覆盖,
+# 正在运行的任务拿到的正是自己模块装饰器声明的配置。
+def test_cross_task_decorators_switch_plan_and_keep_own_options():
+    # 任务 A 的装饰器: 默认 success hook + 自己的 options
+    strategy_a = battle_wait_strategy(
+        'success_default',
+        options={'success': {'market': 'task_a'}},
+    )
+
+    @strategy_a
+    def battle_wait_a(owner, *, battle_wait_plan, options=None):
+        # 被装饰后 wrapper 会注入当前生效的 battle_wait_plan / options, 这里原样抛回来断言
+        return battle_wait_plan, options
+
+    # 任务 A 运行: 生效的应是它自己的 plan 和 options
+    plan_a, options_a = battle_wait_a(object())
+    assert plan_a.success == 'default'
+    assert options_a['success']['market'] == 'task_a'
+    # A 装饰(模块加载)后, 全局生效 plan 和 options 都是 A 的
+    assert battle_wait_strategy.battle_wait_plan is plan_a
+    assert battle_wait_strategy.options['success']['market'] == 'task_a'
+
+    # 任务 B 后加载并装饰: 不同 success hook + 不同的 options → 整份覆盖全局
+    strategy_b = battle_wait_strategy(
+        success='activity',
+        options={'success': {'market': 'task_b'}},
+    )
+
+    @strategy_b
+    def battle_wait_b(owner, *, battle_wait_plan, options=None):
+        return battle_wait_plan, options
+
+    # 核心断言 1: B 装饰(加载)后, 全局生效 plan 和 options 都切成 B 自己的
+    assert battle_wait_strategy.battle_wait_plan is not plan_a
+    plan_b, options_b = battle_wait_b(object())
+    assert plan_b.success == 'activity'
+    assert battle_wait_strategy.battle_wait_plan is plan_b
+    assert options_b['success']['market'] == 'task_b'
+    assert battle_wait_strategy.options['success']['market'] == 'task_b'
+
+    # 观察 A 的"滞后"行为: 此刻全局已被 B 覆盖, A 再次调用跟随全局(B 的),
+    # options 和 plan 一样是"后加载者胜", 不再保留 A 自己的。
+    plan_a2, options_a2 = battle_wait_a(object())
+    assert plan_a2 is plan_b
+    assert options_a2['success']['market'] == 'task_b'
+
+
+# 未声明 options 的装饰器应重置回 _DEFAULT_OPTIONS, 而不是继承上一个任务的 options。
+# 这是"后加载者覆盖 + 未声明回默认"的兜底, 避免任务链里的 options 漂移。
+def test_cross_task_options_do_not_leak_between_tasks():
+    # 任务 A: 声明 options → 覆盖全局
+    strategy_a = battle_wait_strategy(
+        'success_default',
+        options={'success': {'market': 'task_a'}},
+    )
+
+    @strategy_a
+    def battle_wait_a(owner, *, battle_wait_plan, options=None):
+        return battle_wait_plan, options
+
+    _, options_a = battle_wait_a(object())
+    assert options_a['success']['market'] == 'task_a'
+
+    # 任务 B: 不声明 options → __call__ 重置回 _DEFAULT_OPTIONS, 不残留 A 的
+    strategy_b = battle_wait_strategy(success='activity')
+
+    @strategy_b
+    def battle_wait_b(owner, *, battle_wait_plan, options=None):
+        return battle_wait_plan, options
+
+    plan_b, options_b = battle_wait_b(object())
+    assert plan_b.success == 'activity'
+    assert 'task_a' not in options_b.get('success', {})
+    # 全局槽位也跟着回到默认(与 plan 的"后加载者覆盖"一致)
+    assert battle_wait_strategy.options == battle_wait_strategy._DEFAULT_OPTIONS
+    assert options_b == battle_wait_strategy._DEFAULT_OPTIONS