Skip to content

fix(worlds/minecraft): auto 攻击 8 格外弓射不出时受阻收手,不再空转占住事件循环 - #183

Merged
Phantivia merged 3 commits into
mainfrom
fix/mc-blocked-shot-spin
Oct 6, 2026
Merged

Phantivia merged 3 commits into
mainfrom
fix/mc-blocked-shot-spin

Conversation

@Phantivia

Copy link
Copy Markdown
Member

中文

修 #175。skillAttack 的 auto 模式在 8 格外选弓;BowController.shoot 即时拒绝(no_los / too_close / no_solution 等)后,原代码改近战并 continue,下一轮 chooseHybridWeapon('melee', d≥8) 又选回弓。拒绝路径不经过定时器,循环一直不让出事件循环,心跳和实体更新进不来,服务端判 Timed out。

受阻处理契约:

  • auto 在 8 格外这一箭射不出:本步受阻,回执写原因、相距格数、已放箭/挥击数,例如 目标被方块挡住,没有射线;相距 36 格,auto 在 8 格外不改近战;挥击 0 次命中 0 次,放箭 7 支命中 0 支。换站位、等待或改 mode 由 agent 决定,与 ranged/kite 受阻不暗换近战的做法一致。
  • 8 格内射不出:照旧改近战(这段距离选武器不会切回弓,原来就能正常接上近战)。
  • 不对飞行目标做地面追击。

判断用 chooseHybridWeapon('melee', 当前距离, ready) 本身,与下一轮选武器的规则同源,不另设阈值。技能说明和 minecraft README 同步写了这条。

验证:新增测试用真 BowController 制造 20 格外 no_los,修复前该测试在 2 秒墙钟取消时以 aborted 失败(期间零延时定时器进不来),修复后一次拒绝即受阻。issue 附带的 attack-spin.mjs 两条入口(no_los / too_close)现在都只拒绝 1 次就退出。未连真服务器实测。

English

Fixes #175. In auto mode, a bow shot rejected immediately at 8+ blocks switched to melee and looped; the next iteration picked the bow again, so the loop never yielded and the server timed the bot out. Now a rejected shot at a distance where auto would re-pick the bow ends the step as blocked, reporting the reason, distance and attack stats; the agent decides where to reposition. Within 8 blocks the melee fallback is unchanged. A new test drives the real BowController with a no_los rejection at 20 blocks; it fails on the old code (wall-clock abort, zero-delay timer starved) and passes now. Not verified against a live server.

Checks

  • pnpm test
  • pnpm run typecheck
  • pnpm typecheck:web (browser code changed / 改了浏览器代码)
  • A bug fix carries a test that fails before the fix / 修 bug 附带修复前会失败的测试

🤖 Generated with Claude Code

Phantivia and others added 2 commits October 5, 2026 22:35
auto 在 8 格外选弓;这一箭被即时拒绝(射线被挡、太近、没弹道)后改近战,
下一轮按同一距离又选回弓。拒绝不经过定时器,循环一直不让出事件循环,
心跳与实体更新进不来,服务端判超时断线。

现在 8 格外射不出就受阻,回执写明原因、相距格数和已放箭数,换站位由 agent 决定;
8 格内照旧改近战。

Fixes #175

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…写现行规则

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/worlds/minecraft/README.md
Comment thread src/worlds/minecraft/melee.ts Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor 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.

先前两处 Incident history 已不成立:README、melee.ts 注释和测试名现在只写现行规则。

— Cortico PR Gate via Cursor Cloud Agent

Open in Web View Automation 

Sent by Cursor Automation: Cortico PR Gate

@Phantivia
Phantivia merged commit 493dd21 into main Oct 6, 2026
3 checks passed
@Phantivia
Phantivia deleted the fix/mc-blocked-shot-spin branch October 6, 2026 03:59
@Phantivia Phantivia mentioned this pull request Oct 6, 2026
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.

Minecraft: blocked auto shots starve the engine event loop

1 participant