From a41c91f61dafa23246aba7d13edc2335c74e9b96 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 12 Aug 2021 13:25:26 +0800 Subject: [PATCH] =?UTF-8?q?npc=E4=B9=9F=E6=94=AF=E6=8C=81=E5=A4=A7?= =?UTF-8?q?=E7=B4=A0=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 2 +- _server/table/comment.js | 17 ++++++++++++++++- libs/control.js | 2 +- libs/enemys.js | 2 +- libs/maps.js | 11 ++++++----- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index f50b9dd8..10a37142 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3891,7 +3891,7 @@ Arithmetic_List AssignOperator_List : '设为'|'增加'|'减少'|'乘以'|'除以'|'乘方'|'除以并取商'|'除以并取余'|'设为不小于'|'设为不大于' - /*AssignOperator_List ['=','+=','-=','*=','/=','**=','//=','%=','min=','max=']*/; + /*AssignOperator_List ['=','+=','-=','*=','/=','**=','//=','%=','max=','min=']*/; UnaryOperator_List : '向下取整'|'向上取整'|'四舍五入'|'整数截断'|'绝对值'|'开方'|'变量类型' diff --git a/_server/table/comment.js b/_server/table/comment.js index 87ad4b30..298507be 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -155,7 +155,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return current[0]; }).toString(), "_docs": "绑定贴图", - "_data": "该怪物绑定的怪物贴图" + "_data": "该怪物绑定的怪物贴图,用法详见文档" }, "hp": { "_leaf": true, @@ -397,6 +397,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_event": "faceIds", "_docs": "行走图朝向", "_data": "行走图朝向。在勇士撞上图块时,或图块在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。" + }, + "bigImage": { + "_leaf": true, + "_type": "material", + "_directory": "./project/images/", + "_transform": (function (one) { + if (one.endsWith('.png')) return one; + return null; + }).toString(), + "_onconfirm": (function (previous, current) { + if (current.length == 0) return null; + return current[0]; + }).toString(), + "_docs": "绑定贴图", + "_data": "该图块绑定的贴图,用法详见文档" } } }, diff --git a/libs/control.js b/libs/control.js index dc0a8587..d217ad50 100644 --- a/libs/control.js +++ b/libs/control.js @@ -146,7 +146,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { if (core.status.floorId) { // Global Animate core.status.globalAnimateObjs.forEach(function (block) { - core.drawBlock(block, core.status.globalAnimateStatus % (block.event.animate||1)); + core.drawBlock(block, core.status.globalAnimateStatus); }); // Global floor images diff --git a/libs/enemys.js b/libs/enemys.js index 79406f2f..aba7a43b 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -386,7 +386,7 @@ enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) { if (!enemy) return null; // 检查朝向;displayIdInBook - return core.material.enemys[(enemy.faceIds || {}).down] || core.material.enemys[enemy.displayIdInBook] || enemy; + return core.material.enemys[enemy.displayIdInBook] || core.material.enemys[(enemy.faceIds || {}).down] || enemy; } enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x, y, floorId) { diff --git a/libs/maps.js b/libs/maps.js index 6711bf3c..e41c7278 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -960,7 +960,7 @@ maps.prototype._getBigImageInfo = function (bigImage, face, animate) { var per_width = bigImage.width / 4; var per_height = bigImage.height / 4; var sx = animate * per_width, sy; - if (per_height < per_width / 2) { // 强制视为 1*4 的怪物 + if (per_height <= per_width / 2) { // 强制视为 1*4 的怪物 per_height = bigImage.height; sy = 0; } else { @@ -1968,13 +1968,14 @@ maps.prototype.getBlockInfo = function (block) { break; } } + if (block.event.bigImage) bigImage = core.material.images.images[block.event.bigImage]; if (core.material.enemys[id]) { name = core.material.enemys[id].name; - bigImage = core.material.images.images[core.material.enemys[id].bigImage] || null; - if (bigImage != null) animate = 4; + bigImage = core.material.images.images[core.material.enemys[id].bigImage]; } else if (core.material.items[id]) { name = core.material.items[id].name; } + if (bigImage != null) animate = 4; } return {number: number, id: id, cls: cls, name: name, image: image, posX: posX, @@ -2582,7 +2583,7 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) { } maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) { - var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0; + var animateTotal = blockInfo.animate, animateTime = 0; var _run = function () { var animate = window.setInterval(function () { if (blockInfo.cls != 'tileset') { @@ -2872,7 +2873,7 @@ maps.prototype.addGlobalAnimate = function (block) { core.status.autotileAnimateObjs.push(block); } else { - if (!block.event.animate || block.event.animate == 1) return; + if (!block.event.bigImage && (!block.event.animate || block.event.animate == 1)) return; core.status.globalAnimateObjs.push(block); } }