Skip to content

Fix-team-explor - #1704

Merged
runhey merged 7 commits into
runhey:devfrom
musJinx:fix-explor
Jul 29, 2026
Merged

Fix-team-explor#1704
runhey merged 7 commits into
runhey:devfrom
musJinx:fix-explor

Conversation

@musJinx

@musJinx musJinx commented Jul 27, 2026

Copy link
Copy Markdown

优化双人组队探索逻辑

  1. 优化退出探索逻辑,相似场景识别区域改为最右,判断间隔缩短
  2. 宝箱点击逻辑改为探索场景内点击,减少妖气太多时漏点概率
  3. 优化离队识别逻辑,加上战斗内组队标识识别,缩减离队判断时间,并为队友加上离队识别
  4. 修复组队邀请时概率卡死任务失败问题

Summary by Sourcery

改进双人队伍的探索行为,包括更可靠的地图末端检测、队友离开处理以及宝箱交互。

Bug Fixes:

  • 防止在探索过程中发送或接收组队邀请时出现软锁(卡死)情况。
  • 修正队友离开检测,避免在队伍探索中出现延迟或遗漏的退出判断。

Enhancements:

  • 调整宝箱检测逻辑,改为依赖探索过程中的点击,并更新识别区域,以减少在场景拥挤时遗漏宝箱的情况。
  • 缩短并统一队友离开及邀请处理相关的超时时间,使探索流程更加流畅、响应更及时。
  • 优化滑动结束检测,在固定区域使用图像差分,并在连续滑动不再推动地图时退出探索。
Original summary in English

Summary by Sourcery

Improve dual-team exploration behavior, including more robust end-of-map detection, teammate leave handling, and treasure chest interaction.

Bug Fixes:

  • Prevent soft-locks when sending or receiving team invitations during exploration.
  • Correct teammate departure detection to avoid delayed or missed exits from team exploration.

Enhancements:

  • Adjust treasure chest detection to rely on in-exploration clicks with updated recognition regions to reduce missed chests in crowded scenes.
  • Shorten and centralize timeouts for teammate-leave and invite handling to make exploration flow more responsive.
  • Refine swipe-end detection using image-diff on a fixed region and exit exploration when repeated swipes no longer move the map.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了 1 个问题,并留下了一些整体性的反馈:

  • invite_friend 中,条件 if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2): 是冗余的并且很可能是一个 bug;它很可能本意是检查第二个控件或者使用 and,请根据预期的状态判断逻辑调整这里的实现。
  • 新增的 _check_mate_leave 辅助函数在调用方已经根据 I_TEAM_EMOJI/I_TEAM_EMOJI_FIGHT 分支处理之后,又重新执行了一遍这些检查,这会让调用点更难理解;建议把 appear 检查逻辑完全移动到该辅助函数内部,并简化调用方,以避免重复检查和重复逻辑。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `invite_friend`, the condition `if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):` is redundant and likely a bug; it probably meant to check a second control or use `and`, so please adjust this logic to reflect the intended state check.
- The new `_check_mate_leave` helper re-runs the `I_TEAM_EMOJI`/`I_TEAM_EMOJI_FIGHT` checks even when the callers have already branched on those conditions, which makes the call sites harder to reason about; consider moving the appear checks fully inside the helper and simplifying the call sites to avoid redundant checks and duplicated logic.

## Individual Comments

### Comment 1
<location path="tasks/Exploration/solo.py" line_range="373-374" />
<code_context>
                 continue
             if self.appear_then_click(self.I_ADD_5_4, interval=1):
                 continue
+            # 避免中途队友进来邀请死循环
+            if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):
+                # 可能刚好点到人,点一下空地方
+                self.device.click(x=370, y=480, control_name='exploration_invite_friend_prevent')
</code_context>
<issue_to_address>
**issue (bug_risk):** The `invite_friend` guard condition uses the same check twice and may not reflect the intended logic.

`if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):` is logically the same as a single `if not self.appear(self.I_ADD_2):`, so the second clause is redundant. Given the comment about preventing an invite deadlock when teammates join mid-process, please confirm whether a different condition (e.g., another icon or a different state combined via `and`/`or`) was intended here, and then either simplify or correct the condition accordingly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
帮助我变得更有用!请对每条评论点一下 👍 或 👎,我会根据这些反馈改进后续的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • In invite_friend, the condition if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2): is redundant and likely a bug; it probably meant to check a second control or use and, so please adjust this logic to reflect the intended state check.
  • The new _check_mate_leave helper re-runs the I_TEAM_EMOJI/I_TEAM_EMOJI_FIGHT checks even when the callers have already branched on those conditions, which makes the call sites harder to reason about; consider moving the appear checks fully inside the helper and simplifying the call sites to avoid redundant checks and duplicated logic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `invite_friend`, the condition `if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):` is redundant and likely a bug; it probably meant to check a second control or use `and`, so please adjust this logic to reflect the intended state check.
- The new `_check_mate_leave` helper re-runs the `I_TEAM_EMOJI`/`I_TEAM_EMOJI_FIGHT` checks even when the callers have already branched on those conditions, which makes the call sites harder to reason about; consider moving the appear checks fully inside the helper and simplifying the call sites to avoid redundant checks and duplicated logic.

## Individual Comments

### Comment 1
<location path="tasks/Exploration/solo.py" line_range="373-374" />
<code_context>
                 continue
             if self.appear_then_click(self.I_ADD_5_4, interval=1):
                 continue
+            # 避免中途队友进来邀请死循环
+            if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):
+                # 可能刚好点到人,点一下空地方
+                self.device.click(x=370, y=480, control_name='exploration_invite_friend_prevent')
</code_context>
<issue_to_address>
**issue (bug_risk):** The `invite_friend` guard condition uses the same check twice and may not reflect the intended logic.

`if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_2):` is logically the same as a single `if not self.appear(self.I_ADD_2):`, so the second clause is redundant. Given the comment about preventing an invite deadlock when teammates join mid-process, please confirm whether a different condition (e.g., another icon or a different state combined via `and`/`or`) was intended here, and then either simplify or correct the condition accordingly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tasks/Exploration/solo.py Outdated
@musJinx

musJinx commented Jul 27, 2026

Copy link
Copy Markdown
Author

一边肝绘卷一边改的,可以比较顺畅的挂满绘卷模式的一轮。组队全打到组队只打达摩。有个优先级比较低的bug,跨区好友邀请会卡在寮友,这里没修

@runhey

runhey commented Jul 27, 2026

Copy link
Copy Markdown
Owner

挺好的

@runhey

runhey commented Jul 27, 2026

Copy link
Copy Markdown
Owner

tasks/Exploration/res/res_exp_leader.png 这个是多余的呀

@runhey

runhey commented Jul 27, 2026

Copy link
Copy Markdown
Owner

我很不喜欢ai写的东西,
删掉这个self._match_end.stable,然后来写了一堆又丑又长的逻辑来达到类似的东西

@runhey

runhey commented Jul 27, 2026

Copy link
Copy Markdown
Owner

10秒改成三秒太激进了,一个网络波动或者低配置机器就没了

@runhey

runhey commented Jul 27, 2026

Copy link
Copy Markdown
Owner

想起来了,当时 D:\Project\OnmyojiAutoScript\tasks\WantedQuests\explore.py 这里修改了滑动的逻辑,但是忘记同步过去了,

@musJinx

musJinx commented Jul 29, 2026

Copy link
Copy Markdown
Author

tasks/Exploration/res/res_exp_leader.png 这个是多余的呀

删掉了

10秒改成三秒太激进了,一个网络波动或者低配置机器就没了

这里加了战斗场景中组队状态识别,所以 3s 是留给加载页面的,我 2g2核 的配置双开是 ok 的。个人认为 在指定加成探索场景 为低概率情况去大幅增加频繁退出的成本是得不偿失的,在全打场景偶尔误退出的损失也是可以接受的

想起来了,当时 D:\Project\OnmyojiAutoScript\tasks\WantedQuests\explore.py 这里修改了滑动的逻辑,但是忘记同步过去了,

当时着急用没深究原来的代码,ai 说可能是缓存导致的问题就直接新起了套,现在参考 WantedQuests\explore.py 改了一版。

这两个提交影响的功能简单测了几轮,下次肝绘卷我再多测测(

@musJinx

musJinx commented Jul 29, 2026

Copy link
Copy Markdown
Author

另外 RuleAnimate.stable 这个方法第一次存的整张图,后面存截取之后的图,所以会导致需要连续匹配两次才会退出 (6s+),不知道这是否符合预期。这个改了影响面会比较大我就没动

@musJinx

musJinx commented Jul 29, 2026

Copy link
Copy Markdown
Author

tasks/Exploration/res/res_swipe_end.png 的区域改成最右侧的一条,减少怪物移动的影响

@runhey
runhey merged commit be64473 into runhey:dev Jul 29, 2026
1 check passed
@runhey

runhey commented Jul 29, 2026

Copy link
Copy Markdown
Owner

可以可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants