Stop battle macros on map headers with unreadable floor digits

Browse Source
This commit is contained in:
Codex Agent
2026-10-03 15:38:20 +08:00
parent bb549c0265
commit 6cd0b2742a
3 changed files with 18 additions and 0 deletions
+5
View File
@@ -49,6 +49,11 @@ The timer includes English UI compatibility work and all interruptions.
as its mouse fallback. The original fallback list omitted judgement. as its mouse fallback. The original fallback list omitted judgement.
11. A changing event video clock reset repeat detection. Ignore both colon and 11. A changing event video clock reset repeat detection. Ignore both colon and
decimal clock formats when detecting unsuccessful confirmations. decimal clock formats when detecting unsuccessful confirmations.
12. After combat, OCR read the map heading as `Exploring Floor` or
`Exploring FloorT` without a valid digit. The old normalizer failed to mark
this as a map, so P/Enter batches continued on the map for several minutes.
Recognize the map heading independently of its floor number and retain
the previously known floor. Added a regression against continuing battle.
## Progress verified so far ## Progress verified so far
+4
View File
@@ -52,6 +52,10 @@ def normalize(state):
text = '选择遭遇战奖励卡' text = '选择遭遇战奖励卡'
elif re.search(r'exploring(?:floor)?\d+', compact): elif re.search(r'exploring(?:floor)?\d+', compact):
text = '正在探索第%s层' % re.search(r'\d+', compact)[0] text = '正在探索第%s层' % re.search(r'\d+', compact)[0]
elif compact.startswith('exploringfloor'):
# A missing/misread floor number still identifies the map.
# Leave the stored floor unchanged rather than invent a digit.
text = '正在探索 ' + raw
elif compact.startswith('select') and re.search(r'\d+/\d+', compact): elif compact.startswith('select') and re.search(r'\d+/\d+', compact):
text = '选择' + re.search(r'\d+/\d+', compact)[0] text = '选择' + re.search(r'\d+/\d+', compact)[0]
elif compact.startswith('refresh'): elif compact.startswith('refresh'):
+9
View File
@@ -10,6 +10,15 @@ from decision_router import DecisionRouter
class EnglishMirrorBoundaryTest(unittest.TestCase): class EnglishMirrorBoundaryTest(unittest.TestCase):
def test_map_header_without_recognized_floor_number_stops_battle(self):
for label in ('Exploring Floor', 'Exploring FloorT'):
with self.subTest(label=label):
state = normalize({'items': [{'text': label, 'x': 60, 'y': 131,
'w': 302, 'h': 51, 'score': .975}]})
self.assertTrue(agent.battle_is_terminal(state))
with mock.patch.object(agent, 'map_candidates', return_value={}):
self.assertNotIn('battle', agent.candidates(state, previous_battle=True))
def test_enabled_commence_precedes_reselecting_sinners(self): def test_enabled_commence_precedes_reselecting_sinners(self):
options = {'button_20': {'description': '当前可见且非灰色按钮:进行判定', options = {'button_20': {'description': '当前可见且非灰色按钮:进行判定',
'action': {'tool': 'keypress', 'args': {'key': 'enter'}}}, 'action': {'tool': 'keypress', 'args': {'key': 'enter'}}},