From 53573ead5efff4e02075357af02f444051700f92 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 4 Jul 2020 18:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=BB=98=E5=88=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96;=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _docs/api.md | 17 +++- _server/CodeMirror/defs.js | 17 +++- _server/editor.js | 2 +- libs/control.js | 2 +- libs/core.js | 3 +- libs/enemys.js | 9 +- libs/events.js | 4 +- libs/maps.js | 166 ++++++++++++++++++++++--------------- libs/utils.js | 25 +++++- migration.html | 10 +-- project/floors/sample2.js | 30 +++---- project/functions.js | 123 +++++++++++++++------------ project/items.js | 4 +- runtime.d.ts | 20 +++-- 14 files changed, 260 insertions(+), 172 deletions(-) diff --git a/_docs/api.md b/_docs/api.md index a78eead0..737333e3 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -1222,13 +1222,16 @@ nearStair: fn() -> bool turnBlock: fn(direction?: string, x?: number, y?: number, floorId?: string) 事件转向 -getMapArray: fn(floorId?: string) -> [[number]] +getMapArray: fn(floorId?: string, noCache?: bool) -> [[number]] 生成事件层矩阵 例如:core.getMapArray('MT0'); // 生成主塔0层的事件层矩阵,隐藏的图块视为0 floorId: 地图id,不填视为当前地图 showDisable: 可选,true表示隐藏的图块也会被表示出来 返回值:事件层矩阵,注意对其阵元的访问是[y][x] +getMapNumber: fn(x: number, y: number, floorId?: string, noCache?: bool) -> number +获得事件层某个点的数字 + jumpBlock: fn(sx: number, sy: number, ex: number, ey: number, time?: number, keep?: bool, callback?: fn()) 跳跃图块;从V2.7开始不再有音效 例如:core.jumpBlock(0, 0, 0, 0); // 令地图左上角的图块原地跳跃半秒,再花半秒淡出 @@ -1373,6 +1376,14 @@ floorId: 地图id,不填视为当前地图 showDisable: 隐藏点是否不返回null,true表示不返回null 返回值:图块id,该点无图块则返回null +getBlockNumber: fn(x: number, y: number, floorId?: string, showDisable?: bool) -> number +判定某个点的图块数字 +x: 横坐标 +y: 纵坐标 +floorId: 地图id,不填视为当前地图 +showDisable: 隐藏点是否不返回null,true表示不返回null +返回值:图块数字,该点无图块则返回null + loadFloor: fn(floorId?: string, map?: ?) 从文件或存档中加载某个楼层 @@ -1401,7 +1412,7 @@ x: 横坐标 y: 纵坐标 floorId: 地图id,不填视为当前地图 -getMapBlocksObj: fn(floorId?: string, showDisable?: bool) +getMapBlocksObj: fn(floorId?: string, noCache?: bool) 以x,y的形式返回每个点的事件 removeGlobalAnimate: fn(x?: number, y?: number, name?: string) @@ -1442,7 +1453,7 @@ drawFg: fn(floorId?: string, ctx?: CanvasRenderingContext2D) floorId: 地图id,不填视为当前地图 ctx: 某画布的ctx,用于绘制缩略图,一般不需要 -getBlock: fn(x: number, y: number, floorId?: string, showDisable?: bool) -> {index: number, block: block} +getBlock: fn(x: number, y: number, floorId?: string, showDisable?: bool) -> block: block 获得某个点的block initBlock: fn(x: number, y: number, id: string|number, addInfo?: bool, eventFloor?: ?) -> block diff --git a/_server/CodeMirror/defs.js b/_server/CodeMirror/defs.js index 88d75062..22b340a8 100644 --- a/_server/CodeMirror/defs.js +++ b/_server/CodeMirror/defs.js @@ -1932,6 +1932,9 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "fgmaps": { "!doc": "各地图前景层" }, + "mapBlockObjs": { + "!doc": "以<位置,block>存放的各地图图块信息" + }, "boxAnimateObjs": { "!doc": "(手册和剧情文本的)帧动画对象" }, @@ -3060,8 +3063,12 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ }, "getMapArray": { "!doc": "生成事件层矩阵
例如:core.getMapArray('MT0'); // 生成主塔0层的事件层矩阵,隐藏的图块视为0
floorId: 地图id,不填视为当前地图
showDisable: 可选,true表示隐藏的图块也会被表示出来
返回值:事件层矩阵,注意对其阵元的访问是[y][x]", - "!type": "fn(floorId?: string) -> [[number]]" + "!type": "fn(floorId?: string, noCache?: bool) -> [[number]]" }, + "getMapNumber": { + "!doc": "获得事件层某个点的数字", + "!type": "fn(x: number, y: number, floorId?: string, noCache?: bool) -> number" + }, "jumpBlock": { "!doc": "跳跃图块;从V2.7开始不再有音效
例如:core.jumpBlock(0, 0, 0, 0); // 令地图左上角的图块原地跳跃半秒,再花半秒淡出
sx: 起点的横坐标
sy: 起点的纵坐标
ex: 终点的横坐标
ey: 终点的纵坐标
time: 单步和淡出用时,单位为毫秒。不填视为半秒
keep: 是否不淡出,true表示不淡出
callback: 落地或淡出后的回调函数,可选", "!type": "fn(sx: number, sy: number, ex: number, ey: number, time?: number, keep?: bool, callback?: fn())" @@ -3186,6 +3193,10 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "!doc": "判定某个点的图块id
例如:if(core.getBlockId(x1, y1) != 'greenSlime' && core.getBlockId(x2, y2) != 'redSlime') core.openDoor(x3, y3); // 一个简单的机关门事件,打败或炸掉这一对绿头怪和红头怪就开门
x: 横坐标
y: 纵坐标
floorId: 地图id,不填视为当前地图
showDisable: 隐藏点是否不返回null,true表示不返回null
返回值:图块id,该点无图块则返回null", "!type": "fn(x: number, y: number, floorId?: string, showDisable?: bool) -> string" }, + "getBlockNumber": { + "!doc": "判定某个点的图块数字
x: 横坐标
y: 纵坐标
floorId: 地图id,不填视为当前地图
showDisable: 隐藏点是否不返回null,true表示不返回null
返回值:图块数字,该点无图块则返回null", + "!type": "fn(x: number, y: number, floorId?: string, showDisable?: bool) -> number" + }, "loadFloor": { "!doc": "从文件或存档中加载某个楼层", "!type": "fn(floorId?: string, map?: ?)" @@ -3212,7 +3223,7 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ }, "getMapBlocksObj": { "!doc": "以x,y的形式返回每个点的事件", - "!type": "fn(floorId?: string, showDisable?: bool)" + "!type": "fn(floorId?: string, noCache?: bool)" }, "removeGlobalAnimate": { "!doc": "删除一个或所有全局动画", @@ -3244,7 +3255,7 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ }, "getBlock": { "!doc": "获得某个点的block", - "!type": "fn(x: number, y: number, floorId?: string, showDisable?: bool) -> {index: number, block: block}" + "!type": "fn(x: number, y: number, floorId?: string, showDisable?: bool) -> block" }, "initBlock": { "!doc": "初始化一个图块", diff --git a/_server/editor.js b/_server/editor.js index 86d2bb30..45b1b554 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -457,7 +457,7 @@ editor.prototype._updateMap_bigmap = function () { bm.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); bm.fillStyle = '#000000'; bm.fillRect(0, 0, core.__PIXELS__, core.__PIXELS__); - core.drawThumbnail(editor.currentFloorId, core.status.thisMap.blocks, {ctx: bm, all: true}); + core.drawThumbnail(editor.currentFloorId, null, {ctx: bm, all: true}); var width = editor.currentFloorData.width; var height = editor.currentFloorData.height; editor.uivalues.bigmapInfo.top = core.__PIXELS__ * Math.max(0, (1 - height / width) / 2); diff --git a/libs/control.js b/libs/control.js index e7df98a5..2df68e93 100644 --- a/libs/control.js +++ b/libs/control.js @@ -143,7 +143,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { core.maps._drawFloorImages(core.status.floorId, core.canvas.fg, 'fg', core.status.floorAnimateObjs||[], core.status.globalAnimateStatus); // Global Autotile Animate - core.status.autotileAnimateObjs.blocks.forEach(function (block) { + core.status.autotileAnimateObjs.forEach(function (block) { core.maps._drawAutotileAnimate(block, core.status.globalAnimateStatus); }); diff --git a/libs/core.js b/libs/core.js index b3a54999..77baf55e 100644 --- a/libs/core.js +++ b/libs/core.js @@ -132,6 +132,7 @@ function core() { 'maps': null, 'bgmaps': {}, 'fgmaps': {}, + 'mapBlockObjs': {}, 'checkBlock': {}, // 每个点的阻激夹域信息 'damage': { // 每个点的显伤绘制 'posX': 0, @@ -221,7 +222,7 @@ function core() { 'globalAnimateObjs': [], 'floorAnimateObjs': [], 'boxAnimateObjs': [], - 'autotileAnimateObjs': {"blocks": [], "map": null, "bgmap": null, "fgmap": null}, + 'autotileAnimateObjs': [], "globalAnimateStatus": 0, 'animateObjs': [], }; diff --git a/libs/enemys.js b/libs/enemys.js index 978a89e7..bbd05e97 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -336,12 +336,11 @@ enemys.prototype.getCurrentEnemys = function (floorId) { floorId = floorId || core.status.floorId; var enemys = [], used = {}; core.extractBlocks(floorId); - var mapBlocks = core.status.maps[floorId].blocks; - for (var b = 0; b < mapBlocks.length; b++) { - if (!mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy') == 0) { - this._getCurrentEnemys_addEnemy(mapBlocks[b].event.id, enemys, used, floorId); + core.status.maps[floorId].blocks.forEach(function (block) { + if (!block.disable && block.event.cls.indexOf('enemy') == 0) { + this._getCurrentEnemys_addEnemy(block.event.id, enemys, used, floorId); } - } + }, this); return this._getCurrentEnemys_sort(enemys); } diff --git a/libs/events.js b/libs/events.js index 08a5ff00..b7e0a2c8 100644 --- a/libs/events.js +++ b/libs/events.js @@ -335,7 +335,6 @@ events.prototype.trigger = function (x, y, callback) { var block = core.getBlock(x, y); if (block == null) return _executeCallback(); - block = block.block; // 执行该点的脚本 if (block.event.script) { @@ -363,7 +362,6 @@ events.prototype._trigger_inAction = function (x, y) { var block = core.getBlock(x, y); if (block == null) return core.doAction(); - block = block.block; // 执行该点的脚本 try { @@ -612,7 +610,7 @@ events.prototype._canGetNextItem = function (direction) { var nx = core.getHeroLoc('x') + core.utils.scan[direction].x; var ny = core.getHeroLoc('y') + core.utils.scan[direction].y; var block = core.getBlock(nx, ny); - return block != null && block.block.event.trigger == 'getItem'; + return block != null && block.event.trigger == 'getItem'; } events.prototype._getNextItem = function (direction, noRoute) { diff --git a/libs/maps.js b/libs/maps.js index 60c3363f..8353cdda 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -410,11 +410,26 @@ maps.prototype.resizeMap = function (floorId) { } ////// 将当前地图重新变成二维数组形式 ////// -maps.prototype.getMapArray = function (floorId) { +maps.prototype.getMapArray = function (floorId, noCache) { floorId = floorId || core.status.floorId; var map = core.status.maps[floorId]; - if (!map.blocks) return map.map; - return this._getMapArrayFromBlocks(map.blocks, map.width, map.height); + if (!map.blocks || !noCache) return map.map; + return map.map = this._getMapArrayFromBlocks(map.blocks, map.width, map.height); +} + +////// 获得地图上某点的数字 +maps.prototype.getMapNumber = function (x, y, floorId, noCache) { + return this.getMapArray(floorId, noCache)[y][x]; +} + +maps.prototype._updateMapArray = function (floorId, x, y) { + floorId = floorId || core.status.floorId; + var map = core.status.maps[floorId]; + if (!map.blocks) return; + if (x == null || y == null) return this.getMapArray(floorId, true); + var block = this.getBlock(x, y, floorId, true); + if (block == null || block.disable) map.map[y][x] = 0; + else map.map[y][x] = block.id; } maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height) { @@ -428,15 +443,17 @@ maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height) { } ////// 以x,y的形式返回每个点的事件 ////// -maps.prototype.getMapBlocksObj = function (floorId, showDisable) { +maps.prototype.getMapBlocksObj = function (floorId, noCache) { floorId = floorId || core.status.floorId; + if (core.status.mapBlockObjs[floorId] && !noCache) + return core.status.mapBlockObjs[floorId]; + var obj = {}; core.extractBlocks(floorId); core.status.maps[floorId].blocks.forEach(function (block) { - if (!block.disable || showDisable) - obj[block.x + "," + block.y] = block; + obj[block.x + "," + block.y] = block; }); - return obj; + return core.status.mapBlockObjs[floorId] = obj; } ////// 将背景前景层变成二维数组的形式 ////// @@ -564,7 +581,7 @@ maps.prototype._canMoveHero_checkPoint = function (x, y, direction, floorId, arr // 3. 检查是否能进将死的领域 if (floorId == core.status.floorId && !core.flags.canGoDeadZone && core.status.hero.hp <= (core.status.checkBlock.damage[nx + "," + ny]||0) - && extraData.eventArray[ny][nx] == 0) + && arrays.eventArray[ny][nx] == 0) return false; return true; @@ -635,14 +652,14 @@ maps.prototype._canMoveDirectly_checkStartPoint = function (sx, sy) { var block = core.getBlock(sx, sy); if (block != null) { // 只有起点是传送点才是能无视 - return block.block.event.trigger == 'changeFloor'; + return block.event.trigger == 'changeFloor'; } return true; } maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans, canMoveArray) { canMoveArray = canMoveArray || this.generateMovableArray(); - var blocksObj = this.getMapBlocksObj(core.status.floorId); + var blocksObj = this.getMapBlocksObj(); // 滑冰 var bgMap = this.getBgMapArray(); @@ -663,7 +680,8 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans, canMo for (var i in ans) { if (locs[i][0] == nx && locs[i][1] == ny && ans[i] == null) { // 不可以绿点为终点 - if (blocksObj[nx + "," + ny] && blocksObj[nx + "," + ny].event.trigger) { + var block = blocksObj[nx + "," + ny]; + if (block && !block.disable && block.event.trigger) { ans[i] = -1; } else { ans[i] = visited[nindex]; @@ -684,15 +702,16 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans, canMo maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) { var index = x + "," + y; + var block = blocksObj[index]; // 该点是否不可通行或有脚本 - if (blocksObj[index] && (blocksObj[index].event.noPass || blocksObj[index].event.script)) + if (block && !block.disable && (block.event.noPass || block.event.script)) return false; // 该点是否是绿点可触发 - if (blocksObj[index] && blocksObj[index].event.trigger) { - if (blocksObj[index].event.trigger != 'changeFloor') return false; + if (block && !block.disable && block.event.trigger) { + if (block.event.trigger != 'changeFloor') return false; var ignore = core.flags.ignoreChangeFloor; - if (blocksObj[index].event.data && blocksObj[index].event.data.ignoreChangeFloor != null) - ignore = blocksObj[index].event.data.ignoreChangeFloor; + if (block.event.data && block.event.data.ignoreChangeFloor != null) + ignore = block.event.data.ignoreChangeFloor; if (!ignore) return false; } // 是否存在阻激夹域伤害 @@ -755,7 +774,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) { // 判定每个可通行点的损耗值,越高越应该绕路 var deepAdd = 1; var block = blocks[x+","+y]; - if (block != null){ + if (block && !block.disable) { var id = block.event.id; // 绕过亮灯 if (id == "light") deepAdd += 100; @@ -764,7 +783,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) { // 绕过血瓶和绿宝石 if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenGem')) deepAdd += 100; // 绕过传送点 - // if (block.block.event.trigger == 'changeFloor') deepAdd+=10; + // if (block.event.trigger == 'changeFloor') deepAdd+=10; } // 绕过存在伤害的地方 deepAdd += (core.status.checkBlock.damage[x+","+y]||0) * 100; @@ -988,13 +1007,23 @@ maps.prototype.drawEvents = function (floorId, blocks, config) { if (core.bigmap.v2) cacheCtx.translate(32, 32); } + var arr = null; if (!blocks) { core.extractBlocks(floorId); blocks = core.status.maps[floorId].blocks; + arr = this.getMapArray(floorId, !config.redraw) + } else { + arr = this._getMapArrayFromBlocks(blocks, core.floors[floorId].width, core.floors[floorId].height); } - var arr = this._getMapArrayFromBlocks(blocks, core.floors[floorId].width, core.floors[floorId].height); blocks.filter(function (block) { + if (config.onMap && core.bigmap.v2) { + // 判定是否绘制 + var posX = core.bigmap.posX, posY = core.bigmap.posY; + if (block.x < posX - 1 || block.y < posY - 1 || block.x > posX + core.__SIZE__ || block.y > posY + core.__SIZE__ + 1) { // +1 for 48 height + return false; + } + } return block.event && !block.disable; }).forEach(function (block) { core.maps._drawMap_drawBlockInfo(cacheCtx, block, core.maps.getBlockInfo(block), arr, config.onMap); @@ -1003,7 +1032,6 @@ maps.prototype.drawEvents = function (floorId, blocks, config) { if (config.onMap) { core.drawImage(toDrawCtx, cacheCtx.canvas, core.bigmap.v2 ? -32 : 0, core.bigmap.v2 ? -32 : 0); cacheCtx.translate(0, 0); - core.status.autotileAnimateObjs.map = arr; } } @@ -1082,8 +1110,6 @@ maps.prototype._drawBgFgMap = function (floorId, name, config) { if (blur) config.ctx.globalAlpha = alpha; } } - if (config.onMap) - core.status.autotileAnimateObjs[name + "map"] = arr; } ////// 是否应当存在事件时虚化前景层 ////// @@ -1340,10 +1366,10 @@ maps.prototype._drawAutotileAnimate = function (block, animate) { if (block.name) { if (block.name == 'bg') core.drawImage('bg', core.material.groundCanvas.canvas, 32 * x - 32 * core.bigmap.posX, 32 * y - 32 * core.bigmap.posY); - this._drawAutotile(cv, core.status.autotileAnimateObjs[block.name+"map"], block, 32, 0, 0, animate, true); + this._drawAutotile(cv, this._getBgFgMapArray(block.name), block, 32, 0, 0, animate, true); } else { - this._drawAutotile(cv, core.status.autotileAnimateObjs.map, block, 32, 0, 0, animate, true); + this._drawAutotile(cv, this.getMapArray(), block, 32, 0, 0, animate, true); } } @@ -1400,10 +1426,6 @@ maps.prototype.drawThumbnail = function (floorId, blocks, options) { } maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, options) { - if (!blocks) { - core.extractBlocks(floorId); - blocks = core.status.maps[floorId].blocks; - } var width = core.floors[floorId].width; var height = core.floors[floorId].height; // 绘制到tempCanvas上面 @@ -1523,21 +1545,21 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) { maps.prototype.noPass = function (x, y, floorId) { var block = core.getBlock(x, y, floorId); if (block == null) return false; - return block.block.event.noPass; + return block.event.noPass; } ////// 某个点是否存在NPC ////// maps.prototype.npcExists = function (x, y, floorId) { var block = this.getBlock(x, y, floorId); if (block == null) return false; - return block.block.event.cls.indexOf('npc') == 0; + return block.event.cls.indexOf('npc') == 0; } ////// 某个点是否存在(指定的)地形 ////// maps.prototype.terrainExists = function (x, y, id, floorId) { var block = this.getBlock(x, y, floorId); if (block == null) return false; - return block.block.event.cls == 'terrains' && (id ? block.block.event.id == id : true); + return block.event.cls == 'terrains' && (id ? block.event.id == id : true); } ////// 某个点是否存在楼梯 ////// @@ -1560,7 +1582,7 @@ maps.prototype.nearStair = function () { maps.prototype.enemyExists = function (x, y, id, floorId) { var block = this.getBlock(x, y, floorId); if (block == null) return false; - return block.block.event.cls.indexOf('enemy') == 0 && (id ? block.block.event.id == id : true); + return block.event.cls.indexOf('enemy') == 0 && (id ? block.event.id == id : true); } ////// 获得某个点的block ////// @@ -1568,26 +1590,28 @@ maps.prototype.getBlock = function (x, y, floorId, showDisable) { floorId = floorId || core.status.floorId; if (!floorId) return null; core.extractBlocks(floorId); - var blocks = core.status.maps[floorId].blocks; - for (var n = 0; n < blocks.length; n++) { - if (blocks[n].x == x && blocks[n].y == y) { - if (!showDisable && blocks[n].disable) return null; - return {"index": n, "block": blocks[n]}; - } - } + var blockObjs = this.getMapBlocksObj(floorId); + var block = blockObjs[x + "," + y]; + if (block && (showDisable || !block.disable)) return block; return null; } ////// 获得某个点的blockId ////// maps.prototype.getBlockId = function (x, y, floorId, showDisable) { var block = core.getBlock(x, y, floorId, showDisable); - return block == null ? null : block.block.event.id; + return block == null ? null : block.event.id; +} + +////// 获得某个点的数字 ////// +maps.prototype.getBlockNumber = function (x, y, floorId, showDisable) { + var block = core.getBlock(x, y, floorId, showDisable); + return block == null ? null : block.id; } ////// 获得某个点的blockCls ////// maps.prototype.getBlockCls = function (x, y, floorId, showDisable) { var block = core.getBlock(x, y, floorId, showDisable); - return block == null ? null : block.block.event.cls; + return block == null ? null : block.event.cls; } ////// 获得某个图块或素材的信息,包括 ID,cls,图片,坐标,faceIds 等等 ////// @@ -1649,7 +1673,7 @@ maps.prototype.searchBlock = function (id, floorId, showDisable) { for (var i = 0; i < core.status.maps[floorId].blocks.length; ++i) { var block = core.status.maps[floorId].blocks[i]; if ((showDisable || !block.disable) && (core.matchWildcard(id, block.event.id) || core.matchRegex(id, block.event.id))) { - result.push({floorId: floorId, index: i, block: block, x: block.x, y: block.y}); + result.push({floorId: floorId, x: block.x, y: block.y, block: block}); } } return result; @@ -1663,7 +1687,6 @@ maps.prototype.showBlock = function (x, y, floorId) { if (!floorId) return; var block = core.getBlock(x, y, floorId, true); if (block == null) return; // 不存在 - block = block.block; // 本身是禁用事件,启用之 if (block.disable) { block.disable = false; @@ -1689,10 +1712,11 @@ maps.prototype.hideBlock = function (x, y, floorId) { var block = core.getBlock(x, y, floorId, true); if (block == null) return; // 不存在 - core.hideBlockByIndex(block.index, floorId); + block.disable = true; + core.setMapBlockDisabled(floorId, block.x, block.y, true); // 删除动画,清除地图 - this._removeBlockFromMap(floorId, block.block); + this._removeBlockFromMap(floorId, block); } ////// 根据图块的索引来隐藏图块 ////// @@ -1703,6 +1727,7 @@ maps.prototype.hideBlockByIndex = function (index, floorId) { var blocks = core.status.maps[floorId].blocks, block = blocks[index]; block.disable = true; core.setMapBlockDisabled(floorId, block.x, block.y, true); + this._updateMapArray(floorId, block.x, block.y); } ////// 一次性隐藏多个block ////// @@ -1736,14 +1761,15 @@ maps.prototype.removeBlock = function (x, y, floorId) { floorId = floorId || core.status.floorId; if (!floorId) return false; - var block = core.getBlock(x, y, floorId, true); - if (block == null) return false; // 不存在 - - core.removeBlockByIndex(block.index, floorId); - - // 删除动画,清除地图 - this._removeBlockFromMap(floorId, block.block); - return true; + for (var i in core.status.maps[floorId].blocks) { + var block = core.status.maps[floorId].blocks[i]; + if (block.x == x && block.y == y) { + this.removeBlockByIndex(i, floorId); + this._removeBlockFromMap(floorId, block); + return true; + } + } + return false; } ////// 根据block的索引(尽可能)删除该块 ////// @@ -1753,7 +1779,10 @@ maps.prototype.removeBlockByIndex = function (index, floorId) { core.extractBlocks(floorId); var blocks = core.status.maps[floorId].blocks, block = blocks[index]; blocks.splice(index, 1); + if (core.status.mapBlockObjs[floorId]) + delete core.status.mapBlockObjs[floorId][block.x+","+block.y]; core.setMapBlockDisabled(floorId, block.x, block.y, true); + this._updateMapArray(floorId, block.x, block.y); } ////// 一次性删除多个block ////// @@ -1853,17 +1882,20 @@ maps.prototype.setBlock = function (number, x, y, floorId) { return; } var originBlock = core.getBlock(x, y, floorId, true); - var originEvent = originBlock == null ? null : originBlock.block.event; + var originEvent = originBlock == null ? null : originBlock.event; if (originBlock == null) { core.status.maps[floorId].blocks.push(block); + if (core.status.mapBlockObjs[floorId]) + core.status.mapBlockObjs[floorId][block.x+","+block.y] = block; core.setMapBlockDisabled(floorId, block.x, block.y, false); delete block.disable; } else { - originBlock.block.id = number; - originBlock.block.event = block.event; - block = originBlock.block; + originBlock.id = number; + originBlock.event = block.event; + block = originBlock; } + this._updateMapArray(floorId, x, y); if (floorId == core.status.floorId) { // 有任何一个是autotile直接重绘地图 if ((originEvent != null && originEvent.cls == 'autotile') || block.event.cls == 'autotile') { @@ -1898,7 +1930,7 @@ maps.prototype.animateSetBlock = function (number, x, y, floorId, time, callback var block = this.initBlock(x, y, number, true, core.floors[floorId]); // 如果原本是启用的 - if (originBlock != null && !originBlock.block.disable) { + if (originBlock != null && !originBlock.disable) { return this._animateSetBlock_originEnabled(block, number, x, y, floorId, time, callback); } @@ -1908,7 +1940,7 @@ maps.prototype.animateSetBlock = function (number, x, y, floorId, time, callback } // 如果原本存在且禁用;应当直接设置,没有动画 - if (originBlock != null && originBlock.block.disable) { + if (originBlock != null && originBlock.disable) { return this._animateSetBlock_originDisabled(number, x, y, floorId, callback); } if (callback) callback(); @@ -2015,8 +2047,10 @@ maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) { for (var one in toBlock.event) { block.event[one] = core.clone(toBlock.event[one]); } + this._updateMapArray(floorId, block.x, block.y); } - }); + }, this); + if (floorId == core.status.floorId) core.drawMap(); } ////// 改变前景背景的图块 ////// @@ -2135,7 +2169,6 @@ maps.prototype._deleteDetachedBlock = function (canvases) { maps.prototype._getAndRemoveBlock = function (x, y) { var block = core.getBlock(x, y); if (block == null) return null; - block = block.block; var blockInfo = this.getBlockInfo(block); if (blockInfo == null) return; core.removeBlock(x, y); @@ -2348,7 +2381,6 @@ maps.prototype._animateBlock_getList = function (loc, type) { loc.forEach(function (t) { var block = core.getBlock(t[0], t[1], null, true); if (block == null) return; - block = block.block; var blockInfo = core.maps.getBlockInfo(block); if (blockInfo == null) { @@ -2388,12 +2420,10 @@ maps.prototype._animateBlock_drawList = function (list, opacity) { maps.prototype.addGlobalAnimate = function (block) { if (!block || !block.event) return; this.removeGlobalAnimate(block.x, block.y, block.name); - if (!block.name && core.status.autotileAnimateObjs.map) - core.status.autotileAnimateObjs.map[block.y][block.x] = block.id; if (block.event.cls == 'autotile') { var id = block.event.id, img = core.material.images.autotile[id]; if (!img || img.width == 96) return; - core.status.autotileAnimateObjs.blocks.push(block); + core.status.autotileAnimateObjs.push(block); } else { if (!block.event.animate || block.event.animate == 1) return; @@ -2407,7 +2437,7 @@ maps.prototype.removeGlobalAnimate = function (x, y, name) { if (x == null || y == null) { core.status.globalAnimateStatus = 0; core.status.globalAnimateObjs = []; - core.status.autotileAnimateObjs = {"blocks": [], "map": null, "bgmap": null, "fgmap": null}; + core.status.autotileAnimateObjs = []; core.status.floorAnimateObjs = []; return; } @@ -2417,11 +2447,9 @@ maps.prototype.removeGlobalAnimate = function (x, y, name) { }); // 检查Autotile - core.status.autotileAnimateObjs.blocks = core.status.autotileAnimateObjs.blocks.filter(function (block) { + core.status.autotileAnimateObjs = core.status.autotileAnimateObjs.filter(function (block) { return block.x != x || block.y != y || block.name != name; }); - if (!name && core.status.autotileAnimateObjs.map) - core.status.autotileAnimateObjs.map[y][x] = 0; } ////// 绘制UI层的box动画 ////// diff --git a/libs/utils.js b/libs/utils.js index db10c44b..44e1a115 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -715,11 +715,30 @@ utils.prototype.setStatusBarInnerHTML = function (name, value, css) { var length = this.strlen(value) || 1; style += 'font-size: ' + Math.min(1, 7 / length) + 'em; '; if (css) style += css; + var _isNumber = core.statusBar[name].getAttribute('_isNumber') == "1"; + var _style = core.statusBar[name].getAttribute('_style'); + var _value = core.statusBar[name].getAttribute('_value'); if (isNumber) { - core.statusBar[name].innerHTML = "" + value + ""; + if (_isNumber && _style == style) { + if (value == _value) return; + core.statusBar[name].innerText = value; + } else { + core.statusBar[name].innerHTML = "" + value + ""; + core.statusBar[name].setAttribute('_isNumber', '1'); + core.statusBar[name].setAttribute('_style', style); + } + core.statusBar[name].setAttribute('_value', value); } else { - core.statusBar[name].innerHTML = ""; - core.statusBar[name].children[0].innerText = value; + if (!_isNumber && _style == style) { + if (value == _value) return; + core.statusBar[name].children[0].innerText = value; + } else { + core.statusBar[name].innerHTML = ""; + core.statusBar[name].children[0].innerText = value; + core.statusBar[name].setAttribute('_isNumber', '0'); + core.statusBar[name].setAttribute('_style', style); + } + core.statusBar[name].setAttribute('_value', value); } } diff --git a/migration.html b/migration.html index 5f0681d8..c50d916b 100644 --- a/migration.html +++ b/migration.html @@ -483,8 +483,8 @@ function action_items(callback) { "cls": "tools", "name": "破墙镐", "text": "可以破坏勇士面前的墙", - "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", - "canUseItemEffect": "true" + "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", + "canUseItemEffect": "true" }, "icePickaxe": { "cls": "tools", @@ -497,8 +497,8 @@ function action_items(callback) { "cls": "tools", "name": "炸弹", "text": "可以炸掉勇士面前的怪物", - "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", - "canUseItemEffect": "true" + "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", + "canUseItemEffect": "true" }, "upFly": { "cls": "tools", @@ -518,7 +518,7 @@ function action_items(callback) { "cls": "tools", "name": "地震卷轴", "text": "可以破坏当前层的所有墙", - "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();", + "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap();\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", "canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();" }, }; diff --git a/project/floors/sample2.js b/project/floors/sample2.js index 26f62f75..940b3699 100644 --- a/project/floors/sample2.js +++ b/project/floors/sample2.js @@ -13,14 +13,14 @@ main.floors.sample2= [201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], diff --git a/project/functions.js b/project/functions.js index c8172847..c857e7f8 100644 --- a/project/functions.js +++ b/project/functions.js @@ -125,6 +125,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (block.disable && core.enemys.hasSpecial(block.event.id, 23)) { block.disable = false; core.setMapBlockDisabled(floorId, block.x, block.y, false); + core.maps._updateMapArray(floorId, block.x, block.y); } }); core.control.gatherFollowers(); @@ -284,15 +285,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = return; } - // 删除该块 var guards = []; // 支援 if (x != null && y != null) { - // 检查是否是重生怪物;如果是则仅隐藏不删除 - if (core.hasSpecial(enemy.special, 23)) { - core.hideBlock(x, y); - } else { - core.removeBlock(x, y); - } guards = core.getFlag("__guards__" + x + "_" + y, []); core.removeFlag("__guards__" + x + "_" + y); } @@ -389,7 +383,18 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 如果事件不为空,将其插入 if (todo.length > 0) core.insertAction(todo, x, y); - core.updateStatusBar(); + + // 因为removeBlock和hideBlock都会刷新状态栏,因此移动到这里并保证刷新只执行一次,以提升效率 + if (core.getBlock(x, y) != null) { + // 检查是否是重生怪物;如果是则仅隐藏不删除 + if (core.hasSpecial(enemy.special, 23)) { + core.hideBlock(x, y); + } else { + core.removeBlock(x, y); + } + } else { + core.updateStatusBar(); + } // 如果已有事件正在处理中 if (core.status.event.id == null) @@ -1137,8 +1142,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.setStatusBarInnerHTML('fly', "飞" + core.itemCount('centerFly')); // 难度 - core.statusBar.hard.innerText = core.status.hard; - core.statusBar.hard.style.color = core.getFlag('__hardColor__', 'red'); + if (core.statusBar.hard.innerText != core.status.hard) { + core.statusBar.hard.innerText = core.status.hard; + core.statusBar.hard.style.color = core.getFlag('__hardColor__', 'red'); + } // 自定义状态栏绘制 core.drawStatusBar(); @@ -1160,6 +1167,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = type = {}, // 每个点的伤害类型 repulse = {}, // 每个点的阻击怪信息 ambush = {}; // 每个点的捕捉信息 + var betweenAttackLocs = {}; // 所有带夹击的怪物 var needCache = false; var canGoDeadZone = core.flags.canGoDeadZone; core.flags.canGoDeadZone = true; @@ -1171,6 +1179,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = y = block.y, id = block.event.id, enemy = core.material.enemys[id]; + if (block.disable) continue; type[loc] = type[loc] || {}; @@ -1266,6 +1275,18 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } } + // 夹击;在这里提前计算所有可能的夹击点,具体计算逻辑在下面 + // 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true + if (enemy && core.enemys.hasSpecial(enemy.special, 16) && !core.hasFlag('no_betweenAttack')) { + for (var dir in core.utils.scan) { + var nx = x + core.utils.scan[dir].x, + ny = y + core.utils.scan[dir].y, + currloc = nx + "," + ny; + if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue; + betweenAttackLocs[currloc] = true; + } + } + // 检查地图范围类技能 var specialFlag = core.getSpecialFlag(enemy); if (specialFlag & 1) needCache = true; @@ -1275,48 +1296,46 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 更新夹击伤害 // 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true - if (!core.hasFlag('no_betweenAttack')) { - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var loc = x + "," + y; - // 夹击怪物的ID - var enemyId1 = null, - enemyId2 = null; - // 检查左右夹击 - var leftBlock = blocks[(x - 1) + "," + y], - rightBlock = blocks[(x + 1) + "," + y]; - if (leftBlock && rightBlock && leftBlock.id == rightBlock.id) { - if (core.hasSpecial(leftBlock.event.id, 16)) - enemyId1 = leftBlock.event.id; - } - // 检查上下夹击 - var topBlock = blocks[x + "," + (y - 1)], - bottomBlock = blocks[x + "," + (y + 1)]; - if (topBlock && bottomBlock && topBlock.id == bottomBlock.id) { - if (core.hasSpecial(topBlock.event.id, 16)) - enemyId2 = topBlock.event.id; - } + for (var loc in betweenAttackLocs) { + var xy = loc.split(","), + x = parseInt(xy[0]), + y = parseInt(xy[1]); + // 夹击怪物的ID + var enemyId1 = null, + enemyId2 = null; + // 检查左右夹击 + var leftBlock = blocks[(x - 1) + "," + y], + rightBlock = blocks[(x + 1) + "," + y]; + if (leftBlock && !leftBlock.disable && rightBlock && !rightBlock.disable && leftBlock.id == rightBlock.id) { + if (core.hasSpecial(leftBlock.event.id, 16)) + enemyId1 = leftBlock.event.id; + } + // 检查上下夹击 + var topBlock = blocks[x + "," + (y - 1)], + bottomBlock = blocks[x + "," + (y + 1)]; + if (topBlock && !topBlock.disable && bottomBlock && !bottomBlock.disable && topBlock.id == bottomBlock.id) { + if (core.hasSpecial(topBlock.event.id, 16)) + enemyId2 = topBlock.event.id; + } - if (enemyId1 != null || enemyId2 != null) { - var leftHp = core.status.hero.hp - (damage[loc] || 0); - if (leftHp > 1) { - // 夹击伤害值 - var value = Math.floor(leftHp / 2); - // 是否不超过怪物伤害值 - if (core.flags.betweenAttackMax) { - var enemyDamage1 = core.getDamage(enemyId1, x, y, floorId); - if (enemyDamage1 != null && enemyDamage1 < value) - value = enemyDamage1; - var enemyDamage2 = core.getDamage(enemyId2, x, y, floorId); - if (enemyDamage2 != null && enemyDamage2 < value) - value = enemyDamage2; - } - if (value > 0) { - damage[loc] = (damage[loc] || 0) + value; - type[loc] = type[loc] || {}; - type[loc]["夹击伤害"] = true; - } - } + if (enemyId1 != null || enemyId2 != null) { + var leftHp = core.status.hero.hp - (damage[loc] || 0); + if (leftHp > 1) { + // 夹击伤害值 + var value = Math.floor(leftHp / 2); + // 是否不超过怪物伤害值 + if (core.flags.betweenAttackMax) { + var enemyDamage1 = core.getDamage(enemyId1, x, y, floorId); + if (enemyDamage1 != null && enemyDamage1 < value) + value = enemyDamage1; + var enemyDamage2 = core.getDamage(enemyId2, x, y, floorId); + if (enemyDamage2 != null && enemyDamage2 < value) + value = enemyDamage2; + } + if (value > 0) { + damage[loc] = (damage[loc] || 0) + value; + type[loc] = type[loc] || {}; + type[loc]["夹击伤害"] = true; } } } @@ -1372,7 +1391,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = nowy = core.getHeroLoc('y'); var block = core.getBlock(nowx, nowy); var hasTrigger = false; - if (block != null && block.block.event.trigger == 'getItem' && + if (block != null && block.event.trigger == 'getItem' && !core.floors[core.status.floorId].afterGetItem[nowx + "," + nowy]) { hasTrigger = true; core.trigger(nowx, nowy, callback); diff --git a/project/items.js b/project/items.js index cc334474..3227ecef 100644 --- a/project/items.js +++ b/project/items.js @@ -374,7 +374,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "破墙镐", "text": "可以破坏勇士面前的墙", - "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", + "useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();", "canUseItemEffect": "true" }, "icePickaxe": { @@ -388,7 +388,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "炸弹", "text": "可以炸掉勇士面前的怪物", - "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", + "useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();", "canUseItemEffect": "true" }, "centerFly": { diff --git a/runtime.d.ts b/runtime.d.ts index 9a873016..acb2cf43 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -149,6 +149,7 @@ type gameStatus = { thisMap: ResolvedMap bgmaps: { [key: string]: number[][] } fgmaps: { [key: string]: number[][] } + mapBlockObjs: { [key: string]: any } /** 显伤伤害 */ checkBlock: {} damage: {} @@ -231,12 +232,7 @@ type gameStatus = { globalAnimateObjs: [] floorAnimateObjs: [] boxAnimateObjs: [] - autotileAnimateObjs: { - blocks: [], - map: any - bgmap: any - fgmap: null - } + autotileAnimateObjs: [] globalAnimateStatus: number animateObjs: [] } @@ -1414,7 +1410,10 @@ declare class maps { * @param showDisable 可选,true表示隐藏的图块也会被表示出来 * @returns 事件层矩阵,注意对其阵元的访问是[y][x] */ - getMapArray(floorId?: string): number[][] + getMapArray(floorId?: string, noCache?: boolean): number[][] + + /** 判定图块的事件层数字;不存在为0 */ + getMapNumber(floorId?: string, noCache?: boolean): number /** * 生成背景层矩阵 @@ -1554,6 +1553,9 @@ declare class maps { */ getBlockId(x: number, y: number, floorId?: string, showDisable?: boolean): string | null + /** 判定某个点的图块数字;空图块为0 */ + getBlockNumber(x: number, y: number, floorId?: string, showDisable?: boolean): number + /** * 判定某个点的图块类型 * @example if(core.getBlockCls(x1, y1) != 'enemys' && core.getBlockCls(x2, y2) != 'enemy48') core.openDoor(x3, y3); // 另一个简单的机关门事件,打败或炸掉这一对不同身高的敌人就开门 @@ -1742,7 +1744,7 @@ declare class maps { resizeMap(floorId?: string): void /** 以x,y的形式返回每个点的事件 */ - getMapBlocksObj(floorId?: string, showDisable?: any): any + getMapBlocksObj(floorId?: string, noCache?: boolean): any /** 获得某些点可否通行的信息 */ canMoveDirectlyArray(locs?: any): any @@ -1769,7 +1771,7 @@ declare class maps { enemyExists(x?: number, y?: number, id?: string, floorId?: string): boolean /** 获得某个点的block */ - getBlock(x?: number, y?: number, floorId?: string, showDisable?: boolean): any + getBlock(x?: number, y?: number, floorId?: string, showDisable?: boolean): Block /** 获得某个图块或素材的信息,包括ID,cls,图片,坐标,faceIds等等 */ getBlockInfo(block?: any): any