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

Merge upstream dev through 6e425254, retaining mail and activity safeguards

Integrate b1c7186c..6e425254 (4 commits including 2 merges).
Adopt fe98ffef's updated boss entry and boss-screen PNGs/search regions.
Fill omitted JSON metadata for both resources and correct declared sizes to
the actual PNG dimensions (96x26 and 18x99); retain upstream search bounds.

Resolve 77bd7fd7's mail 3-to-6-second timeout change with the existing local
30-second bounded collection flow: popup-first handling, confirmation retries,
reward collection and resettable idle wait remain intact. Do not regress to
the upstream read-before-claim flow or shorten the existing total timeout.

Resolve fe98ffef's completion check with the existing mode-specific boss/main
marker, which already handles boss return while preventing an unrelated mode
from completing the battle. Keep both reward styles and context-local battle
strategies. Both conflicted modules are AST-identical to pre-merge dev.
Other retained local raid, exploration, UI-crop and desktop fixes are untouched.

Validation: 392 pytest cases passed (tests/ and both FrogBoss test modules),
including 14 new boss resource cases. Initial metadata checks exposed both
upstream size mismatches; fixed and reran the full suite successfully.
2 Python syntax checks, 3 production imports, 2 PNG decodes, 7 metadata rules,
12 synthetic matching cases with ROI padding 0/2, and git diff --check passed.
Two pre-existing Pydantic deprecation warnings. No live game/emulator test.
unknown 3 недель назад
Родитель
Сommit
4c0fe0ec5e

BIN
tasks/ActivityShikigami/as/as_check_battle_boss.png


BIN
tasks/ActivityShikigami/as/as_to_battle_boss.png


+ 19 - 1
tasks/ActivityShikigami/as/image.json

@@ -43,5 +43,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "切换按键"
+  },
+  {
+    "itemName": "to_battle_boss",
+    "imageName": "as_to_battle_boss.png",
+    "roiFront": "1071,302,96,26",
+    "roiBack": "1000,250,200,120",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击进入boss战斗页面"
+  },
+  {
+    "itemName": "check_battle_boss",
+    "imageName": "as_check_battle_boss.png",
+    "roiFront": "402,142,18,99",
+    "roiBack": "370,120,70,154",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "boss战斗页面标志"
   }
-]
+]

+ 2 - 2
tasks/ActivityShikigami/assets.py

@@ -48,11 +48,11 @@ class ActivityShikigamiAssets:
 	# 进入主要的战斗界面 
 	I_TO_BATTLE_MAIN = RuleImage(roi_front=(220,247,97,44), roi_back=(172,122,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=(979,142,234,327), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_boss.png")
+	I_TO_BATTLE_BOSS = RuleImage(roi_front=(1071,302,96,26), roi_back=(1000,250,200,120), 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 
-	I_CHECK_BATTLE_BOSS = RuleImage(roi_front=(978,636,43,31), roi_back=(899,537,167,154), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_check_battle_boss.png")
+	I_CHECK_BATTLE_BOSS = RuleImage(roi_front=(402,142,18,99), roi_back=(370,120,70,154), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_check_battle_boss.png")
 	# 从main进入到式神录 
 	I_BATTLE_MAIN_TO_RECORDS = RuleImage(roi_front=(1001,558,39,42), roi_back=(966,534,140,100), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle_main_to_records.png")
 	# description 

+ 46 - 0
tests/tasks/ActivityShikigami/test_boss_assets.py

@@ -0,0 +1,46 @@
+"""Keep activity boss PNGs, rule metadata and search bounds in agreement."""
+from copy import deepcopy
+import json
+from pathlib import Path
+
+import numpy as np
+import pytest
+from PIL import Image
+
+from module.atom import image as image_module
+from tasks.ActivityShikigami.assets import ActivityShikigamiAssets
+
+
+@pytest.mark.parametrize('name', ['TO_BATTLE_BOSS', 'CHECK_BATTLE_BOSS'])
+@pytest.mark.parametrize('pad', [0, 2])
+@pytest.mark.parametrize('placement', ['original', 'shifted', 'outside'])
+def test_boss_template_matches_only_inside_search_region(monkeypatch, name, pad, placement):
+    monkeypatch.setattr(image_module, 'ROI_MATCH_PAD', pad)
+    rule = deepcopy(getattr(ActivityShikigamiAssets, 'I_' + name))
+    template = rule.image
+    h, w = template.shape[:2]
+    x, y = rule.roi_front[:2]
+    if placement == 'shifted':
+        x, y = x + 5, y + 5
+    elif placement == 'outside':
+        x, y = 100, 400
+    screen = np.zeros((720, 1280, 3), dtype=np.uint8)
+    screen[y:y + h, x:x + w] = template
+    assert rule.match(screen) is (placement != 'outside')
+    if placement != 'outside':
+        assert tuple(rule.roi_front[:2]) == (x, y)
+
+
+@pytest.mark.parametrize('name', ['TO_BATTLE_BOSS', 'CHECK_BATTLE_BOSS'])
+def test_boss_metadata_matches_png_and_runtime_rule(name):
+    rule = getattr(ActivityShikigamiAssets, 'I_' + name)
+    rows = json.loads(Path('tasks/ActivityShikigami/as/image.json').read_text(encoding='utf-8'))
+    row, = [item for item in rows if item['itemName'] == name.lower()]
+    with Image.open(rule.file) as png:
+        assert png.size == tuple(rule.roi_front[2:])
+        png.verify()
+    assert tuple(map(int, row['roiFront'].split(','))) == tuple(rule.roi_front)
+    assert tuple(map(int, row['roiBack'].split(','))) == tuple(rule.roi_back)
+    assert row['method'] == rule.method
+    assert row['threshold'] == rule.threshold
+    assert row['imageName'] == Path(rule.file).name