From f6a138b57f42e9cfa071dbe2a614484ae8ba8eb6 Mon Sep 17 00:00:00 2001 From: echo Date: Sun, 17 Dec 2017 16:58:51 +0800 Subject: [PATCH] core: add arrow block --- libs/core.js | 6 ++++-- libs/maps.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/core.js b/libs/core.js index 0f2df930..8accfd29 100644 --- a/libs/core.js +++ b/libs/core.js @@ -882,7 +882,8 @@ core.prototype.automaticRoute = function (destX, destY) { if (nowBlock!=null){ nowId = nowBlock.block.event.id; nowArrow = nowId.slice(5).toLowerCase(); - if (direction != nowArrow) continue; + var isArrow = nowId.slice(0, 5).toLowerCase() == 'arrow'; + if (isArrow && direction != nowArrow) continue; } var nx = nowX + scan[direction].x; @@ -894,7 +895,8 @@ core.prototype.automaticRoute = function (destX, destY) { if (nextBlock!=null){ nextId = nextBlock.block.event.id; nextArrow = nextId.slice(5).toLowerCase(); - if ( (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) continue; + var isArrow = nextId.slice(0, 5).toLowerCase() == 'arrow'; + if (isArrow && (scan[direction].x + scan[nextArrow].x) == 0 && (scan[direction].y + scan[nextArrow].y) == 0 ) continue; } var nid = 13 * nx + ny; diff --git a/libs/maps.js b/libs/maps.js index e26c277a..c56ae375 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -78,7 +78,7 @@ maps.prototype.getBlock = function (x, y, id) { if (id == 12) tmp.event = {'cls': 'animates', 'id': 'poisonNet', 'noPass': false, 'trigger': 'passNet'}; // 毒网 if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网 if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网 - // 单向箭头 + // 单向行走箭头 if (id == 15) tmp.event = {'cls': 'terrains', 'id': 'arrowUp','noPass': false}; // 上行箭头 if (id == 16) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft','noPass': false}; // 左行箭头 if (id == 17) tmp.event = {'cls': 'terrains', 'id': 'arrowDown','noPass': false}; // 下行箭头