From 3c5a3101466bfdf4a206a0e20442c53ef6f79efa Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 20 Nov 2024 17:55:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BD=95=E5=83=8F=E5=90=9E=E5=BC=80?= =?UTF-8?q?=E5=A4=B4=E7=A7=BB=E5=8A=A8=20&=20=E5=BD=95=E5=83=8F=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/utils.js | 2 +- src/core/main/init/hotkey.ts | 6 +++--- src/game/state/move.ts | 24 ++++++++++++++---------- src/plugin/game/replay.ts | 7 +++---- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/public/libs/utils.js b/public/libs/utils.js index 68313be..722ceec 100644 --- a/public/libs/utils.js +++ b/public/libs/utils.js @@ -654,8 +654,8 @@ utils.prototype.encodeRoute = function (route, compress = true) { } if (cnt > 1) ans += cnt; cnt = 0; - lastMove = t; } + lastMove = t; cnt++; } else { if (cnt > 0) { diff --git a/src/core/main/init/hotkey.ts b/src/core/main/init/hotkey.ts index 18f7276..3165691 100644 --- a/src/core/main/init/hotkey.ts +++ b/src/core/main/init/hotkey.ts @@ -535,7 +535,7 @@ gameKey } core.playSound('光标移动'); HeroSkill.toggleSkill(HeroSkill.Blade); - core.status.route.push('skill:Blade'); + core.status.route.push('useSkill:Blade'); core.updateStatusBar(); }) .realize('skill2', () => { @@ -546,7 +546,7 @@ gameKey HeroSkill.learnedSkill(HeroSkill.Jump) ) { Mota.Plugin.require('skill_g').jumpSkill(); - core.status.route.push('skill:Jump'); + core.status.route.push('useSkill:Jump'); } else { if (core.hasItem('pickaxe')) { core.useItem('pickaxe'); @@ -562,7 +562,7 @@ gameKey } core.playSound('光标移动'); HeroSkill.toggleSkill(HeroSkill.Shield); - core.status.route.push('skill:Shield'); + core.status.route.push('useSkill:Shield'); core.updateStatusBar(); }) .realize('debug', () => { diff --git a/src/game/state/move.ts b/src/game/state/move.ts index 447f0e1..9bbcb5c 100644 --- a/src/game/state/move.ts +++ b/src/game/state/move.ts @@ -487,8 +487,10 @@ export class HeroMover extends ObjectMoverBase { const viewport = HeroMover.viewport; if (!adapter || !viewport) return; // if (!core.isReplaying()) { - adapter.sync('startAnimate'); - await adapter.all('readyMove'); + if (!core.isReplaying() || core.status.replay.speed <= 3) { + adapter.sync('startAnimate'); + await adapter.all('readyMove'); + } // } // 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住 if (!this.ignoreTerrain) { @@ -512,8 +514,10 @@ export class HeroMover extends ObjectMoverBase { const viewport = HeroMover.viewport; if (!adapter || !viewport) return; // if (!core.isReplaying()) { - await adapter.all('endMove'); - adapter.sync('endAnimate'); + if (!core.isReplaying() || core.status.replay.speed <= 3) { + await adapter.all('endMove'); + adapter.sync('endAnimate'); + } // } viewport.sync('endMove'); core.clearContinueAutomaticRoute(); @@ -685,12 +689,12 @@ export class HeroMover extends ObjectMoverBase { const speed = replay === 24 ? 1 : this.moveSpeed / replay; viewport.all('moveTo', x, y, speed * 1.6); adapter.sync('setAnimateDir', showDir); - // if (core.isReplaying()) { - // await sleep(speed); - // await adapter.all('setHeroLoc', x, y); - // } else { - await adapter.all('move', moveDir); - // } + if (core.isReplaying() && core.status.replay.speed > 3) { + await sleep(speed); + await adapter.all('setHeroLoc', x, y); + } else { + await adapter.all('move', moveDir); + } } /** diff --git a/src/plugin/game/replay.ts b/src/plugin/game/replay.ts index 67b3cfe..65eb71a 100644 --- a/src/plugin/game/replay.ts +++ b/src/plugin/game/replay.ts @@ -184,12 +184,12 @@ export function init() { } else { core.replay(); } - core.status.route.push(`skill:${toEmit}`); + core.status.route.push(`useSkill:${toEmit}`); return true; } - core.registerReplayAction('skill', name => { - if (!name.startsWith('skill:')) return false; + core.registerReplayAction('useSkill', name => { + if (!name.startsWith('useSkill:')) return false; const [, skill] = name.split(':'); return skillAction(skill); }); @@ -213,7 +213,6 @@ export function init() { core.registerReplayAction('fly', action => { if (!action.startsWith('fly:')) return false; const floorId = action.slice(4) as FloorIds; - const toIndex = core.floorIds.indexOf(floorId); if ( !core.canUseItem('fly') || (core.flags.flyNearStair && !core.nearStair())