@@ -449,26 +449,40 @@ def phase_end(self) -> bool:
449449
450450 # wait and verify
451451 confirm_deadline = time .monotonic () + cfg .get ("MAX_END_SEC" , 20.0 )
452+
453+ # 抛竿图标连续稳定确认机制
454+ stable_confirm_time = 0.5
455+ cast_appeared_time = None
456+
452457 while time .monotonic () < confirm_deadline :
453- has_chance_icon , _ = self .find_fish_chance ()
454- if has_chance_icon :
458+ has_chance = self .find_fish_chance ()[ 0 ]
459+ if has_chance :
455460 logger .info ("确认已回到挥杆界面(检测到授渔以鱼)" )
456461 return True
457-
458- has_cast_icon , _ = self .find_fish_cast ()
459- self .stats ["last_cast_icon_found" ] = has_cast_icon
460- if has_cast_icon :
461- logger .info ("确认已回到挥杆界面" )
462- return True
463-
464- has_bite_icon , _ = self .find_fish_bite ()
465- self .stats ["last_bite_icon_found" ] = has_bite_icon
466- if has_bite_icon :
467- logger .info ("确认已回到挥杆界面" )
462+
463+ has_bite = self .find_fish_bite ()[0 ]
464+ if has_bite :
465+ logger .info ("确认已回到挥杆界面(检测到鱼咬钩被遗留)" )
468466 return True
469-
470- self .click_relative_random (0.6 , 0.3 , 0.95 , 0.7 )
467+
468+ has_cast = self .find_fish_cast ()[0 ]
469+ self .stats ["last_cast_icon_found" ] = has_cast
470+ if has_cast :
471+ if cast_appeared_time is None :
472+ # 记录第一次看见抛竿图标的时间
473+ cast_appeared_time = time .monotonic ()
474+ elif time .monotonic () - cast_appeared_time >= stable_confirm_time :
475+ # 第二次确认:抛竿图标连续显示,非画面闪现
476+ logger .info ("界面稳定,确认已回到抛竿界面" )
477+ return True
478+ else :
479+ # 抛竿图标消失,重置判定计时
480+ cast_appeared_time = None
481+
482+ # 继续保持点击屏幕左侧用来关闭那些可能无法单纯靠时间等待关闭的层叠UI
483+ self .click_relative_random (0.05 , 0.3 , 0.4 , 0.7 )
471484 self .sleep (0.5 )
485+
472486 logger .info ("结束阶段确认失败" )
473487 return False
474488
@@ -556,9 +570,6 @@ def do_run(self):
556570 logger .info (f" 剩余轮数: { remaining } " )
557571 logger .info ("=" * 50 )
558572
559- # 继续下一轮
560- self .sleep (1.0 )
561- self .sleep (1.0 )
562573 except TaskDisabledException :
563574 raise
564575 except Exception as e :
0 commit comments