core: add arrow block

This commit is contained in:
echo 2017-12-17 16:58:51 +08:00
parent 050138f486
commit f6a138b57f
2 changed files with 5 additions and 3 deletions

View File

@ -882,7 +882,8 @@ core.prototype.automaticRoute = function (destX, destY) {
if (nowBlock!=null){ if (nowBlock!=null){
nowId = nowBlock.block.event.id; nowId = nowBlock.block.event.id;
nowArrow = nowId.slice(5).toLowerCase(); 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; var nx = nowX + scan[direction].x;
@ -894,7 +895,8 @@ core.prototype.automaticRoute = function (destX, destY) {
if (nextBlock!=null){ if (nextBlock!=null){
nextId = nextBlock.block.event.id; nextId = nextBlock.block.event.id;
nextArrow = nextId.slice(5).toLowerCase(); 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; var nid = 13 * nx + ny;

View File

@ -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 == 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 == 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 == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
// 单向箭头 // 单向行走箭头
if (id == 15) tmp.event = {'cls': 'terrains', 'id': 'arrowUp','noPass': false}; // 上行箭头 if (id == 15) tmp.event = {'cls': 'terrains', 'id': 'arrowUp','noPass': false}; // 上行箭头
if (id == 16) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft','noPass': false}; // 左行箭头 if (id == 16) tmp.event = {'cls': 'terrains', 'id': 'arrowLeft','noPass': false}; // 左行箭头
if (id == 17) tmp.event = {'cls': 'terrains', 'id': 'arrowDown','noPass': false}; // 下行箭头 if (id == 17) tmp.event = {'cls': 'terrains', 'id': 'arrowDown','noPass': false}; // 下行箭头