From f9a147b0ba47fd5717c89b568da7a318975871ed Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 12 Feb 2018 14:18:11 +0800 Subject: [PATCH] Fix a Bug --- libs/core.js | 10 ++++++---- libs/floors/sample0.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/core.js b/libs/core.js index 56d32eec..8176977a 100644 --- a/libs/core.js +++ b/libs/core.js @@ -1943,9 +1943,11 @@ core.prototype.canMoveHero = function(x,y,direction,floorId) { if (!core.isset(floorId)) floorId=core.status.floorId; // 检查当前块的cannotMove - var cannotMove = core.floors[floorId].cannotMove[x+","+y]; - if (core.isset(cannotMove) && cannotMove instanceof Array && cannotMove.indexOf(direction)>=0) - return false; + if (core.isset(core.floors[floorId].cannotMove)) { + var cannotMove = core.floors[floorId].cannotMove[x+","+y]; + if (core.isset(cannotMove) && cannotMove instanceof Array && cannotMove.indexOf(direction)>=0) + return false; + } var nowBlock = core.getBlock(x,y,floorId); if (nowBlock!=null){ @@ -2344,7 +2346,7 @@ core.prototype.trigger = function (x, y) { var trigger = mapBlocks[b].event.trigger; // 转换楼层能否穿透 - if (trigger=='changeFloor') { + if (trigger=='changeFloor' && !noPass) { var canCross = core.flags.portalWithoutTrigger; if (core.isset(mapBlocks[b].event.data) && core.isset(mapBlocks[b].event.data.portalWithoutTrigger)) canCross=mapBlocks[b].event.data.portalWithoutTrigger; diff --git a/libs/floors/sample0.js b/libs/floors/sample0.js index 5fb84bfd..5f0fa6d7 100644 --- a/libs/floors/sample0.js +++ b/libs/floors/sample0.js @@ -34,7 +34,6 @@ main.floors.sample0 = { "本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。", ], "events": { // 该楼的所有可能事件列表 - "10,9": [ // 守着道具的老人 "\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。", "\t[老人,man]\b[up]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。", @@ -77,6 +76,7 @@ main.floors.sample0 = { }, }, "changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖 + "7,9": {"floorId": "sample1", "stair": "downFloor"}, "6,0": {"floorId": "sample1", "stair": "downFloor"}, // 目标点:sample1层的下楼梯位置 "0,11": {"floorId": "sample0", "loc": [0,12]}, // 目标点:sample0层的x=0,y=12位置 "0,12": {"floorId": "sample0", "stair": "upFloor"}, // 注意,目标层有多个楼梯的话,写stair可能会导致到达位置不确定。这时候推荐写loc指明目标点位置。