From ad23687274c1c3baae173f8e227a9c6a7e7318f1 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Sun, 22 Feb 2026 10:59:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=98=BB=E5=87=BB=E5=8A=A0=E9=80=9F?= =?UTF-8?q?=EF=BC=88=E5=BE=85=E6=B5=8B=E8=AF=95bug=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 8 +++---- libs/maps.js | 60 +++++++++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/libs/control.js b/libs/control.js index fa7e01f9..079ea74e 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1242,7 +1242,7 @@ control.prototype._checkBlock_repulse = function (repulse) { if (!repulse || repulse.length == 0) return []; var actions = []; repulse.forEach(function (t) { - actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 100, "keep": true, "async": true }); + actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 80, "keep": true, "async": true }); }); if (actions.length > 0) actions.push({ "type": "waitAsync" }); return actions; @@ -1293,7 +1293,7 @@ control.prototype._checkBlock_chase = function (chase) { actions.push({ "type": "if", "condition": "!core.getBlock(" + aimx + "," + aimy + ")", "true": [ - { "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] }, + { "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] }, ], "false": [ { "type": "setValue", "name": "flag:chaseAimCls", "value": `core.getBlockCls(${aimx},${aimy})` }, @@ -1309,8 +1309,8 @@ control.prototype._checkBlock_chase = function (chase) { }, ], "false": [ - { "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] }, - { "type": "move", "loc": [aimx, aimy], "time": 100, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] }, + { "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] }, + { "type": "move", "loc": [aimx, aimy], "time": 80, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] }, ] }, { "type": "waitAsync", "excludeAnimates": true }, diff --git a/libs/maps.js b/libs/maps.js index 3f88b1a5..81680c4c 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -2706,25 +2706,30 @@ maps.prototype._getAndRemoveBlock = function (x, y) { maps.prototype.moveBlock = function (x, y, steps, time, keep, callback, noMoveEInfo) { if (core.status.replay.speed == 24) time = 1; time = time || 500; - var blockArr = this._getAndRemoveBlock(x, y); + const blockArr = this._getAndRemoveBlock(x, y); if (blockArr == null) { if (callback) callback(); return; } - var block = blockArr[0], blockInfo = blockArr[1]; - var moveSteps = (steps || []).map(function (t) { + const block = blockArr[0], blockInfo = blockArr[1]; + const moveSteps = (steps || []).map(function (t) { return [t.split(':')[0], parseInt(t.split(':')[1] || "1")]; }).filter(function (t) { return ['up', 'down', 'left', 'right', 'forward', 'backward', 'leftup', 'leftdown', 'rightup', 'rightdown', 'speed'].indexOf(t[0]) >= 0 && !(t[0] == 'speed' && t[1] < 16) }); - var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false); + const canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false); this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases); - var moveInfo = { + const per_time = time / 16 / core.status.replay.speed; + let oneStepLength = 2; + if (time / core.status.replay.speed < 50) oneStepLength = 8; // 当time较小时增大步长 + else if (time / core.status.replay.speed < 100) oneStepLength = 4; + + const moveInfo = { sx: x, sy: y, x: x, y: y, px: 32 * x, py: 32 * y, opacity: 1, keep: keep, lastDirection: null, offset: 1, - moveSteps: moveSteps, step: 0, per_time: time / 16 / core.status.replay.speed - } + moveSteps: moveSteps, step: 0, per_time, oneStepLength, + }; this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback, noMoveEInfo); } @@ -2770,23 +2775,6 @@ maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, call _run(); } -maps.prototype.exchangeBlock = function (x1, y1, x2, y2, dir, time, callback) { - const floorId = core.status.floorId; - - let callbackCount = 0; - function myCallback() { - callbackCount++; - if (callbackCount === 2) { - core.exchangeEnemyOnPoint(x1, y1, x2, y2, floorId); - if (callback) callback(); - } - } - - const reverseDir = { 'up': 'down', 'down': 'up', 'left': 'right', 'right': 'left' }; - this.moveBlock(x1, y1, [dir], time, true, myCallback, true); - this.moveBlock(x2, y2, [reverseDir[dir]], time, true, myCallback, true); -} - maps.prototype._moveBlock_updateSpeed = function (moveInfo) { if (moveInfo.step == 0 && moveInfo.moveSteps[0][0] == 'speed' && moveInfo.moveSteps[0][1] >= 16) { moveInfo.per_time = moveInfo.moveSteps[0][1] / 16 / core.status.replay.speed; @@ -2856,10 +2844,10 @@ maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) { } var curr = moveInfo.moveSteps[0]; moveInfo.step++; - moveInfo.px += core.utils.scan2[curr[0]].x * 2 * moveInfo.offset; - moveInfo.py += core.utils.scan2[curr[0]].y * 2 * moveInfo.offset; + moveInfo.px += core.utils.scan2[curr[0]].x * moveInfo.offset * moveInfo.oneStepLength; + moveInfo.py += core.utils.scan2[curr[0]].y * moveInfo.offset * moveInfo.oneStepLength; this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases); - if (moveInfo.step == Math.round(32 / (moveInfo.offset * 2))) { + if (moveInfo.step == Math.abs(Math.round(32 / (moveInfo.offset * moveInfo.oneStepLength)))) { moveInfo.step = 0; moveInfo.moveSteps[0][1]--; if (moveInfo.moveSteps[0][1] <= 0) { @@ -2868,6 +2856,24 @@ maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) { } } +maps.prototype.exchangeBlock = function (x1, y1, x2, y2, dir, time, callback) { + const floorId = core.status.floorId; + + let callbackCount = 0; + function myCallback() { + callbackCount++; + if (callbackCount === 2) { + core.exchangeEnemyOnPoint(x1, y1, x2, y2, floorId); + if (callback) callback(); + } + } + + const reverseDir = { 'up': 'down', 'down': 'up', 'left': 'right', 'right': 'left' }; + this.moveBlock(x1, y1, [dir], time, true, myCallback, true); + this.moveBlock(x2, y2, [reverseDir[dir]], time, true, myCallback, true); +} + + ////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 ////// maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) { time = time || 500;