diff --git a/docs/event.md b/docs/event.md index 8bdf07cb..296357f9 100644 --- a/docs/event.md +++ b/docs/event.md @@ -954,6 +954,8 @@ core.insertAction(list) //往当前事件列表中插入一系列事件。使用 由于NPC是自定义事件,因此我们需要写events。注意到events中不覆盖trigger,则还是怪物时,存在系统trigger因此会战斗;变成NPC后没有系统trigger因此会触发自定义事件。 +请注意打死怪物时默认会禁用该点,因此替换后需要手动进行show来启用。 + ``` js "events": { "x,y": [ @@ -962,7 +964,8 @@ core.insertAction(list) //往当前事件列表中插入一系列事件。使用 }, "afterBattle": { "x,y": [ - {"type": "setBlock", "number": 121} // 变成老人 + {"type": "setBlock", "number": 121}, // 变成老人 + {"type": "show", "loc": [x,y]} // 启用该点 ] } ``` diff --git a/libs/core.js b/libs/core.js index 33de6eae..cabcaa00 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){ @@ -2218,17 +2220,16 @@ core.prototype.openDoor = function (id, x, y, needKey, callback) { var speed=30; if (needKey) { var key = id.replace("Door", "Key"); - if (!core.removeItem(key)) { + if (!core.hasItem(key)) { if (key != "specialKey") core.drawTip("你没有" + core.material.items[key].name); else core.drawTip("无法开启此门"); core.clearContinueAutomaticRoute(); return; } - } - - if (!core.isset(core.status.event.id)) // 自动存档 core.autosave(true); + core.removeItem(key); + } // open core.playSound("door.ogg"); @@ -2344,7 +2345,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; @@ -4389,11 +4390,11 @@ core.prototype.openSettings = function (need) { ////// 自动存档 ////// core.prototype.autosave = function (removeLast) { - var x; + var x=null; if (removeLast) x=core.status.route.pop(); core.saveData("autoSave"); - if (removeLast) + if (removeLast && core.isset(x)) core.status.route.push(x); } diff --git a/libs/events.js b/libs/events.js index 533cb8f6..457cedea 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1229,6 +1229,7 @@ events.prototype.clickShop = function(x,y) { core.status.route.push("shop:"+core.status.event.data.id+":"+core.status.event.data.actions.join("")); } + core.status.event.data.actions = []; core.status.boxAnimateObjs = []; if (core.status.event.data.fromList) core.ui.drawQuickShop(); @@ -1258,6 +1259,8 @@ events.prototype.keyUpShop = function (keycode) { core.status.route.push("shop:"+core.status.event.data.id+":"+core.status.event.data.actions.join("")); } + core.status.event.data.actions = []; + core.status.boxAnimateObjs = []; if (core.status.event.data.fromList) diff --git a/project/floors/sample0.js b/project/floors/sample0.js index 6e44dc0a..3cbd4a72 100644 --- a/project/floors/sample0.js +++ b/project/floors/sample0.js @@ -35,7 +35,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中修改代码。", @@ -78,6 +77,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指明目标点位置。 diff --git a/常用工具/地图生成器.exe b/常用工具/地图生成器.exe index 286aa26b..6d56bf06 100644 Binary files a/常用工具/地图生成器.exe and b/常用工具/地图生成器.exe differ