diff --git a/libs/control.js b/libs/control.js index 6333fe22..df2efb46 100644 --- a/libs/control.js +++ b/libs/control.js @@ -684,7 +684,7 @@ control.prototype.automaticRoute = function (destX, destY) { } deepAdd+=core.status.checkBlock.damage[nid]*10; // 绕过捕捉 - if (core.status.checkBlock.ambush[nid]) + if ((core.status.checkBlock.ambush||[])[nid]) deepAdd += 10000; if (nx == destX && ny == destY) { @@ -1288,7 +1288,7 @@ control.prototype.checkBlock = function () { core.snipe(snipe); } // 检查捕捉 - var ambush = core.status.checkBlock.ambush[x+core.bigmap.width*y]; + var ambush = (core.status.checkBlock.ambush||[])[x+core.bigmap.width*y]; if (core.isset(ambush)) { // 捕捉效果 var actions = []; diff --git a/libs/maps.js b/libs/maps.js index b1ab018d..c11bc33c 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -427,7 +427,7 @@ maps.prototype.canMoveDirectly = function (destX,destY) { if (!core.canMoveHero(nowX, nowY, dir)) continue; var nx=nowX+directions[dir][0], ny=nowY+directions[dir][1]; if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height||visited[nx+core.bigmap.width*ny]||core.getBlock(nx,ny)!=null - ||core.status.checkBlock.damage[nx+core.bigmap.width*ny]>0||core.status.checkBlock.ambush[nx+core.bigmap.width*ny]) continue; + ||core.status.checkBlock.damage[nx+core.bigmap.width*ny]>0||(core.status.checkBlock.ambush||[])[nx+core.bigmap.width*ny]) continue; visited[nx+core.bigmap.width*ny]=visited[nowX+core.bigmap.width*nowY]+1; if (nx==destX&&ny==destY) return visited[nx+core.bigmap.width*ny]; queue.push(nx+core.bigmap.width*ny);