Stop battle macros on map headers with unreadable floor digits
This commit is contained in:
@@ -49,6 +49,11 @@ The timer includes English UI compatibility work and all interruptions.
|
||||
as its mouse fallback. The original fallback list omitted judgement.
|
||||
11. A changing event video clock reset repeat detection. Ignore both colon and
|
||||
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
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ def normalize(state):
|
||||
text = '选择遭遇战奖励卡'
|
||||
elif re.search(r'exploring(?:floor)?\d+', compact):
|
||||
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):
|
||||
text = '选择' + re.search(r'\d+/\d+', compact)[0]
|
||||
elif compact.startswith('refresh'):
|
||||
|
||||
@@ -10,6 +10,15 @@ from decision_router import DecisionRouter
|
||||
|
||||
|
||||
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):
|
||||
options = {'button_20': {'description': '当前可见且非灰色按钮:进行判定',
|
||||
'action': {'tool': 'keypress', 'args': {'key': 'enter'}}},
|
||||
|
||||
Reference in New Issue
Block a user