diff --git a/libs/actions.js b/libs/actions.js index 12bc5f21..cf364da2 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1442,6 +1442,10 @@ actions.prototype._keyUpViewMaps = function (keycode) { } return; } + if (keycode == 71 && !core.isReplaying()) { + core.useFly(false); + return; + } return; } diff --git a/libs/events.js b/libs/events.js index defb4204..a723975c 100644 --- a/libs/events.js +++ b/libs/events.js @@ -2707,6 +2707,17 @@ events.prototype.openBook = function (fromUserAction) { ////// 点击楼层传送器时的打开操作 ////// events.prototype.useFly = function (fromUserAction) { if (core.isReplaying()) return; + // 从“浏览地图”页面:尝试直接传送到该层 + if (core.status.event.id == 'viewMaps') { + if (!core.hasItem('fly')) { + core.drawTip('你没有' + core.material.items['fly'].name, 'fly'); + } else if (!core.canUseItem('fly')) { + core.drawTip('无法传送到当前层', 'fly'); + } + core.flyTo(core.status.event.data.floorId); + return; + } + if (!this._checkStatus('fly', fromUserAction, true)) return; if (core.flags.flyNearStair && !core.nearStair()) { core.playSound('操作失败'); diff --git a/libs/ui.js b/libs/ui.js index a9b0d329..1b9f3187 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2480,10 +2480,10 @@ ui.prototype._drawViewMaps = function (index, x, y) { core.lockControl(); core.status.event.id = 'viewMaps'; this.clearUI(); - if (index == null) return this._drawMaps_drawHint(); + if (index == null) return this._drawViewMaps_drawHint(); core.animateFrame.tip = null; core.status.checkBlock.cache = {}; - var data = this._drawMaps_buildData(index, x, y); + var data = this._drawViewMaps_buildData(index, x, y); core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, '#000000'); core.drawThumbnail(data.floorId, null, {damage: data.damage, ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all}); core.clearMap('data'); @@ -2499,7 +2499,7 @@ ui.prototype._drawViewMaps = function (index, x, y) { core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)'); } -ui.prototype._drawMaps_drawHint = function () { +ui.prototype._drawViewMaps_drawHint = function () { core.playSound('打开界面'); core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL, 'rgba(0,0,0,0.4)'); core.setTextAlign('ui', 'center'); @@ -2539,7 +2539,7 @@ ui.prototype._drawMaps_drawHint = function () { core.setTextBaseline('ui', 'alphabetic'); } -ui.prototype._drawMaps_buildData = function (index, x, y) { +ui.prototype._drawViewMaps_buildData = function (index, x, y) { var damage = (core.status.event.data||{}).damage; var all = (core.status.event.data||{all: true}).all; if (index.damage != null) damage=index.damage; diff --git a/project/items.js b/project/items.js index b8f75f88..2904fd09 100644 --- a/project/items.js +++ b/project/items.js @@ -322,7 +322,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "hideInReplay": true, "hideInToolbox": true, "useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));", - "canUseItemEffect": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();" + "canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair()) return false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();" }, "coin": { "cls": "constants",