Fix a Bug

This commit is contained in:
oc 2018-02-12 14:18:11 +08:00
parent 025f37911b
commit f9a147b0ba
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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指明目标点位置。