Skip to content

fix: 增加模糊匹配,修复寻路节点前移问题#456

Merged
kuainx merged 3 commits into
OpenWSGR:mainfrom
cwlm:main
Apr 21, 2026
Merged

fix: 增加模糊匹配,修复寻路节点前移问题#456
kuainx merged 3 commits into
OpenWSGR:mainfrom
cwlm:main

Conversation

@cwlm
Copy link
Copy Markdown
Contributor

@cwlm cwlm commented Apr 21, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 21, 2026 04:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 旨在改进地图节点判定的鲁棒性(增加“模糊匹配/阈值命中”思路以缓解移动过程中节点被过早前推),并在“决战”流程中更可靠地处理“船坞已满”这一战斗结果分支。

Changes:

  • 调整 NodeTracker.update_node():引入射线命中阈值与回退选择策略,降低移动过程中的节点误判/前推概率。
  • 在决战 _handle_combat() 中识别 ConditionFlag.DOCK_FULL 并直接切换到 DecisivePhase.DOCK_FULL,避免依赖战后短暂弹窗检测。
  • 章节导航批量点击分支做了小幅代码整理(等价重构)。

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
autowsgr/ui/map/panels/sortie.py 章节导航批量点击逻辑的小幅重构(保持行为一致)。
autowsgr/ops/decisive/handlers.py 决战战斗结束后基于战斗结果标志直接路由到 DOCK_FULL 阶段。
autowsgr/combat/node_tracker.py 节点判定引入射线命中阈值与回退策略,提升移动判定稳定性。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# 将当前节点也作为候选,避免在移动途中被强制前推
candidate_names = list(dict.fromkeys([self._current_node, *current_data.next_nodes]))

ray_hit_threshold = 0.01
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

ray_hit_threshold = 0.01 是一个新引入的魔法数,且当前没有说明其单位/来源(节点坐标为 0~1 归一化)。建议将其提升为类常量或配置项(例如按地图/分辨率可调),并在注释中解释为何选择 0.01 以及该阈值对“命中/未命中”的预期影响。

Copilot uses AI. Check for mistakes.
Comment on lines +480 to +487
_log.warning(
'[NodeTracker] 射线距离未命中阈值 (<{:.4f}),回退到最小射线距离选择',
ray_hit_threshold,
)
best_node, best_ray_distance, best_euclidean_distance = min(
candidate_distances,
key=lambda item: (item[1], item[2]),
)
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

这里在候选点都未满足 ray_hit_threshold 时使用 _log.warning,但 update_node() 会在战斗地图轮询中高频调用;如果“未命中阈值”是常态,会导致日志被 warning 淹没并影响排障信噪比。建议改为 debug/info,或增加节流(例如仅每 N 秒/每次节点变化最多记录一次),并把阈值/回退选择的上下文(当前节点、候选列表)放到 debug 里。

Copilot uses AI. Check for mistakes.
@kuainx kuainx merged commit bc62737 into OpenWSGR:main Apr 21, 2026
5 of 6 checks passed
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.

3 participants