From d5888c49fdd6a1cc7213332f86637bb58486cb43 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 12 Jun 2020 15:40:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9E=AC=E7=A7=BB=E7=A9=BF=E8=BF=87=E7=BB=BF?= =?UTF-8?q?=E7=82=B9&=E7=9F=AD=E8=B7=9D=E7=A6=BB=E7=9E=AC=E7=A7=BB?= =?UTF-8?q?=E5=BD=95=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 7 +++++-- libs/maps.js | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/libs/control.js b/libs/control.js index 16cf3e86..d3133af9 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1588,7 +1588,8 @@ control.prototype._replayAction_moveDirectly = function (action) { var pos=action.substring(5).split(":"); var x=parseInt(pos[0]), y=parseInt(pos[1]); var nowx=core.getHeroLoc('x'), nowy=core.getHeroLoc('y'); - if (!core.moveDirectly(x, y)) return false; + var ignoreSteps = core.canMoveDirectly(x, y); + if (!core.moveDirectly(x, y, ignoreSteps)) return false; if (core.status.replay.speed == 24) { core.replay(); return true; @@ -1596,10 +1597,12 @@ control.prototype._replayAction_moveDirectly = function (action) { core.ui.drawArrow('ui', 32*nowx+16-core.bigmap.offsetX, 32*nowy+16-core.bigmap.offsetY, 32*x+16-core.bigmap.offsetX, 32*y+16-core.bigmap.offsetY, '#FF0000', 3); + var timeout = this.__replay_getTimeout(); + if (ignoreSteps < 10) timeout = timeout * ignoreSteps / 10; setTimeout(function () { core.clearMap('ui'); core.replay(); - }, core.control.__replay_getTimeout()); + }, timeout); return true; } diff --git a/libs/maps.js b/libs/maps.js index cae19c65..a5a8e2d9 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -638,7 +638,12 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans) { // if (nx == ex && ny == ey) return visited[nindex]; for (var i in ans) { if (locs[i][0] == nx && locs[i][1] == ny && ans[i] == null) { - ans[i] = visited[nindex]; + // 不可以绿点为终点 + if (blocksObj[nx + "," + ny] && blocksObj[nx + "," + ny].event.trigger) { + ans[i] = -1; + } else { + ans[i] = visited[nindex]; + } number--; if (number == 0) return ans; } @@ -655,9 +660,17 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans) { maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) { var index = x + "," + y; - // 该点是否有事件 - if (blocksObj[index] && (blocksObj[index].event.trigger || blocksObj[index].event.noPass - || blocksObj[index].event.script)) return false; + // 该点是否不可通行或有脚本 + if (blocksObj[index] && (blocksObj[index].event.noPass || blocksObj[index].event.script)) + return false; + // 该点是否是绿点可触发 + if (blocksObj[index] && blocksObj[index].event.trigger) { + if (blocksObj[index].event.trigger != 'changeFloor') return false; + var ignore = core.flags.ignoreChangeFloor; + if (blocksObj[index].event.data && blocksObj[index].event.data.ignoreChangeFloor != null) + ignore = blocksObj[index].event.data.ignoreChangeFloor; + if (!ignore) return false; + } // 是否存在阻激夹域伤害 if (core.status.checkBlock.damage[index]) return false; // 是否存在捕捉