From 0b828387aa4beb4cedd40099a384dd1b50d74961 Mon Sep 17 00:00:00 2001 From: shen <> Date: Sat, 17 Oct 2026 05:42:44 -0700 Subject: [PATCH] fix: let auto hunt recover from an occupied blocked terrain cell --- audit/history.jsonl | 1 + docs/AVA2-FOLLOWUP-20261016.md | 10 +++++++ src/port/UserInterface/AutoHuntNavigation.h | 13 +++++++++ .../UserInterface/PythonPlayerAutoHunt.cpp | 9 ++++-- tests/host/autohunt_navigation_test.cpp | 29 +++++++++++++++++++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/audit/history.jsonl b/audit/history.jsonl index 6dd61693..8aa63fcd 100644 --- a/audit/history.jsonl +++ b/audit/history.jsonl @@ -652,3 +652,4 @@ {"date": "2026-09-30", "unit": "Client/root/uiaffectshower.py", "result": "RUN_AS_IS unchanged; authorized PORT extension for server rates", "evidence": ["src/platform/ScriptLib/ServerBonusScript.inc", "tools/server/autohunt-pull-range/server_bonuses.h", "build/autohunt-fix-test.log", "build/autohunt-fix-mobile-test.log", "build/autohunt-bonuses-android.png"], "finding": "40250 global privileges emit login notices rather than character AFFECT packets; added distinct status channel, packed scripts unchanged."} {"date": "2026-10-01", "unit": "UserInterface/PythonPlayerAutoHunt.cpp", "action": "user-authorized-extension", "evidence": ["docs/AUTO-HUNT-ENHANCEMENTS.md", "build/autohunt-enhance-test.log", "build/autohunt-enhance-mobile-test.log", "build/autohunt-enhance-mac-build.log", "build/autohunt-enhance-android-build.log", "build/qa/autohunt-enhance-ui/settings.png"], "finding": "Added bounded terrain/scene-collision A* and reachability for combat/loot/return; independent learned skill-ID selection with legacy config migration; optional server restart_here and 5-second/70%-HP recovery; acknowledged dismount/cast/remount batching. Original manual movement and packed Python scripts unchanged. Desktop/mobile fake-server integration and macOS/Android builds pass; real-server soak not claimed."} {"date": "2026-10-16", "unit": "UserInterface/PythonApplication.cpp:Destroy / PythonBoot::Stop", "action": "fix-host-teardown-order", "finding": "40250 drains flying instances before effects/characters; host previously reset effects before CFlyingManager destruction. Explicit flying and character cleanup fixes live-projectile shutdown; overall Destroy remains DIVERGENT for unrelated omissions.", "evidence": ["tests/port/port_app_loop_test.cpp", "build/followup-shutdown-before.log", "build/followup-shutdown-after.log"]} +{"date": "2026-10-17", "unit": "UserInterface/PythonPlayerAutoHunt.cpp::__AutoHunt_BuildPath", "action": "user-authorized-extension", "finding": "Live snow floor 1 knockback left the player at (18730.742,22544.762), inside blocked attribute row 225. Exact-start-only exemption rejected every path/attack sample, including monsters 90 units away. Permit only the occupied loaded blocked terrain cell, retaining adjacent blocked cells, scene collision and unloaded-data rejection. AutoHunt is an authorized extension, not a newly claimed 40250 counterpart.", "evidence": ["tests/host/autohunt_navigation_test.cpp", "docs/AVA2-FOLLOWUP-20261016.md"], "remaining": "Live dungeon soak pending; no parity status upgraded. Port-map helper script absent on this branch."} diff --git a/docs/AVA2-FOLLOWUP-20261016.md b/docs/AVA2-FOLLOWUP-20261016.md index ae10a1e3..ee28240a 100644 --- a/docs/AVA2-FOLLOWUP-20261016.md +++ b/docs/AVA2-FOLLOWUP-20261016.md @@ -58,3 +58,13 @@ sbtest 独立 db 目录保存原型副本,安装器现在同步并备份这些 第二轮已由客户端自动狩猎完成第一层,约 210 秒进入第二层,未执行 GM 清怪命令;使用 QA 专用测试装备(武器怪物伤害 +100%、攻击 +5000、暴击/穿透 100;铠甲 HP +30000、防御 +1000、冰抗/格挡/闪避 100),不能据此比较普通装备的效率。日志在忽略目录 snow-run.jsonl。 部署排查修正:整份 conf 覆盖 db 会丢掉原有 db 独有的 25170/30331–30333,第二轮因此无法掉落封印钥匙,已中断。已从最初备份恢复 db,再逐表合并 16 件披风;安装器回归现在明确验证 db 独有行保留。恢复后的磁盘原型已核对四件副本道具,下一次隔离重启加载。第二层及之后不能计为通过。本次事故未涉及正式服。 + +### 击退进入禁行格时的自动狩猎卡点 + +第三轮在第一层 (18730.742,22544.762) 卡住,日志持续输出目标距离约 90 却无路径。原始雪地图 attr.atr 确认角色站在禁行的第 225 行,相邻第 224 行可走。原来的“只放行精确起点”无法通过任何后续采样,导致目标选择和攻击视线均被拒绝。 + +新增 TerrainWalkable 允许离开当前占用的已加载禁行格;相邻禁行格、未加载数据、静态体积碰撞和原来薄墙/拐角检查保持。使用捕获坐标和原属性布局回归:旧回调无路,新回调能到相邻怪物;穿过更深禁区及未知区域仍拒绝。macOS 已重新构建;完整副本复测尚在进行。该模块是用户授权扩展,没有宣称与 40250 逐语句一致。 + +旧 52 级任务已真实点击“警备队长的信”(任务 144),数据库状态由 letterfromboss 推进到 askbeakgo(574123079),ghostsleft=4。随后地图 61 重登时该状态的 is_destination_village 分支无报错;主城返回 NPC 的正向分支仍需后续确认。 + +导航专项、聚怪安全检查通过;macOS/Android 原生构建及 APK 封装通过,APK 中 libmain.so 与本次构建逐字节一致。port.login_flow 较大回归失败 29 个检查;临时恢复本次修改前的两个导航源码后重建重跑,失败位置和数量完全一致(频道状态、商店、NPC、仓库),随后已恢复当前源码并重建。该测试不能报告通过,也未将现存失败归为本次导航回归。日志:build/acceptance-20261017/{nav-escape-tests,baseline-login-flow}.log。 diff --git a/src/port/UserInterface/AutoHuntNavigation.h b/src/port/UserInterface/AutoHuntNavigation.h index 896b9e55..b06ebf2c 100644 --- a/src/port/UserInterface/AutoHuntNavigation.h +++ b/src/port/UserInterface/AutoHuntNavigation.h @@ -12,6 +12,19 @@ namespace AutoHuntNavigation { struct Point { float x, y; }; inline float Distance(Point a, Point b) { return std::hypot(a.x-b.x, a.y-b.y); } using Walkable = std::function; +// Terrain queries return -1 for unloaded data, 0 for clear, 1 for blocked. +// Knockback can leave the actor inside a blocked cell. Permit leaving that +// occupied cell, while keeping adjacent blocked cells and missing data closed. +inline Walkable TerrainWalkable(Point start, const std::function& attribute, float cell) { + const bool startBlocked=attribute(start)>0; + return [=](Point p) { + const int value=attribute(p); + if (value<0) return false; + if (!value) return true; + return startBlocked && std::floor(p.x/cell)==std::floor(start.x/cell) && + std::floor(p.y/cell)==std::floor(start.y/cell); + }; +} inline bool Segment(Point a, Point b, const Walkable& walkable) { const int samples = std::max(1, int(std::ceil(Distance(a,b) / 40.f))); Point previous=a; diff --git a/src/port/UserInterface/PythonPlayerAutoHunt.cpp b/src/port/UserInterface/PythonPlayerAutoHunt.cpp index 1476558b..e7431195 100644 --- a/src/port/UserInterface/PythonPlayerAutoHunt.cpp +++ b/src/port/UserInterface/PythonPlayerAutoHunt.cpp @@ -1182,6 +1182,12 @@ bool CPythonPlayer::__AutoHunt_BuildPath(const TPixelPosition& goal, float arriv // client's movement test only stops a sphere entering one. std::set around; { CollisionProbe probe; probe.hits=&around; probeAt(start.x,start.y,probe); } + const auto terrainWalkable=AutoHuntNavigation::TerrainWalkable({start.x,start.y}, + [&](AutoHuntNavigation::Point p) { + BYTE attr=0; + if (!background.GetAttr(p.x,p.y,&attr)) return -1; + return (attr&CTerrainImpl::ATTRIBUTE_BLOCK) ? 1 : 0; + },float(CTerrainImpl::HALF_CELLSCALE)); auto walkable=[&](AutoHuntNavigation::Point p) { if (std::hypot(p.x-m_kPPosAutoHuntAnchor.x,p.y-m_kPPosAutoHuntAnchor.y)>bound) return false; // Where the player already stands is walkable whatever the attribute map says (a ship's deck @@ -1189,8 +1195,7 @@ bool CPythonPlayer::__AutoHunt_BuildPath(const TPixelPosition& goal, float arriv if (std::hypot(p.x-start.x,p.y-start.y)<1.f) return true; // Missing/unloaded terrain is not a traversable cell. A small footprint keeps turns off wall edges. for (const auto offset : {AutoHuntNavigation::Point{0,0}, {25,0}, {-25,0}, {0,25}, {0,-25}}) { - BYTE attr=0; - if (!background.GetAttr(p.x+offset.x,p.y+offset.y,&attr) || (attr&CTerrainImpl::ATTRIBUTE_BLOCK)) return false; + if (!terrainWalkable({p.x+offset.x,p.y+offset.y})) return false; } CollisionProbe probe; probe.ignore=&around; probeAt(p.x,p.y,probe); diff --git a/tests/host/autohunt_navigation_test.cpp b/tests/host/autohunt_navigation_test.cpp index 4ee09510..88c5b028 100644 --- a/tests/host/autohunt_navigation_test.cpp +++ b/tests/host/autohunt_navigation_test.cpp @@ -42,6 +42,35 @@ int main() { assert(Distance(prev,{1000,0})<=450); auto around=FindPath({0,0},{1000,0},450,[&](Point p) { return lake(p) && wall(p); },3500,350); assert(around.size()>1 && Distance(around.back(),{1000,0})<=450); + // Captured snow floor 1: knockback put the actor in blocked terrain row + // 225, 90 units from monsters in clear row 224. The old exact-start-only + // exemption rejected every intermediate sample and stalled both combat + // selection and recovery movement. + const Point knocked{18730.742f,22544.762f}, enemy{18730.742f,22454.762f}; + auto attributes=[](Point p) { + if (p.x<0 || p.y<0) return -1; + return p.y>=22500 ? 1 : 0; + }; + auto oldFootprint=[&](Point p) { + if (Distance(p,knocked)<1.f) return true; + for (const Point offset : {Point{0,0},{25,0},{-25,0},{0,25},{0,-25}}) + if (attributes({p.x+offset.x,p.y+offset.y})!=0) return false; + return true; + }; + assert(FindPath(knocked,enemy,100,oldFootprint).empty()); + auto terrain=TerrainWalkable(knocked,attributes,100); + auto footprint=[&](Point p) { + for (const Point offset : {Point{0,0},{25,0},{-25,0},{0,25},{0,-25}}) + if (!terrain({p.x+offset.x,p.y+offset.y})) return false; + return true; + }; + assert(FindPath(knocked,enemy,100,footprint).size()==1); + assert(FindPath(knocked,enemy,0,footprint,3500,0,true).size()==1); + assert(FindPath(knocked,{18730,22800},0,footprint).empty()); + auto clearStart=TerrainWalkable({18730,22400},attributes,100); + assert(!clearStart({18730,22510})); + auto unloaded=TerrainWalkable(knocked,[](Point){return -1;},100); + assert(FindPath(knocked,enemy,0,unloaded).empty()); // A blocked combat sight line must not explore the room looking for a // detour that the caller immediately rejects. Simulate 240 crowded targets. int normalQueries=0, sightQueries=0;