记录 4-48 实测失败与耗时复盘,修复前台输入及 Jev 配置
This commit is contained in:
+16
-8
@@ -1,4 +1,4 @@
|
|||||||
"""Bounded P/Enter batches through MCP; stop when the battle UI disappears."""
|
"""Bounded Win Rate batches through MCP, with a fresh UI check per turn."""
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
@@ -20,7 +20,7 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
deadline = time.monotonic() + min(50, max(1, args.seconds))
|
deadline = time.monotonic() + min(50, max(1, args.seconds))
|
||||||
pairs = 0
|
pairs = 0
|
||||||
with Session() as client:
|
with Session(raise_on_error=False) as client:
|
||||||
state = client.call('get_state')
|
state = client.call('get_state')
|
||||||
texts = ' '.join(item['text'] for item in state.get('items', []))
|
texts = ' '.join(item['text'] for item in state.get('items', []))
|
||||||
active = args.battle_confirmed or any(marker in texts.upper() for marker in ('WAVE', 'TURN', 'DURANTE', '胜率', '伤害'))
|
active = args.battle_confirmed or any(marker in texts.upper() for marker in ('WAVE', 'TURN', 'DURANTE', '胜率', '伤害'))
|
||||||
@@ -28,12 +28,20 @@ def main():
|
|||||||
# 战斗特写会隐藏 HUD;只有明确的结算/地图/选项信号才退出。
|
# 战斗特写会隐藏 HUD;只有明确的结算/地图/选项信号才退出。
|
||||||
if not active or is_terminal(state):
|
if not active or is_terminal(state):
|
||||||
break
|
break
|
||||||
# 短批次,批次末只检查界面是否仍为战斗,不分析拼点。
|
# P cycles between Win Rate and Damage in current game versions.
|
||||||
for _ in range(2):
|
# Only start a turn when its explicit Win Rate control is visible.
|
||||||
client.call('keypress', {'key': 'p'})
|
labels = [item['text'].replace(' ', '').lower()
|
||||||
client.call('keypress', {'key': 'enter'})
|
for item in state.get('items', [])]
|
||||||
pairs += 1
|
target = next((item['text'] for item in state.get('items', [])
|
||||||
time.sleep(1.5)
|
if item['text'].replace(' ', '').lower()
|
||||||
|
in ('win', 'winrate', '胜率')), None)
|
||||||
|
if target and any(label in ('turn', 'wave', '回合', '波次') for label in labels):
|
||||||
|
selected = client.call('click_text', {'text': target})
|
||||||
|
if selected.get('ok'):
|
||||||
|
time.sleep(.5)
|
||||||
|
client.call('keypress', {'key': 'enter'})
|
||||||
|
pairs += 1
|
||||||
|
time.sleep(2.5)
|
||||||
state = client.call('get_state')
|
state = client.call('get_state')
|
||||||
print(json.dumps({'pairs': pairs, 'state': state}, ensure_ascii=False))
|
print(json.dumps({'pairs': pairs, 'state': state}, ensure_ascii=False))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user