fix: 录像吞开头移动 & 录像冲突

This commit is contained in:
unanmed 2024-11-20 17:55:58 +08:00
parent fb5df24895
commit 3c5a310146
4 changed files with 21 additions and 18 deletions

View File

@ -654,8 +654,8 @@ utils.prototype.encodeRoute = function (route, compress = true) {
} }
if (cnt > 1) ans += cnt; if (cnt > 1) ans += cnt;
cnt = 0; cnt = 0;
lastMove = t;
} }
lastMove = t;
cnt++; cnt++;
} else { } else {
if (cnt > 0) { if (cnt > 0) {

View File

@ -535,7 +535,7 @@ gameKey
} }
core.playSound('光标移动'); core.playSound('光标移动');
HeroSkill.toggleSkill(HeroSkill.Blade); HeroSkill.toggleSkill(HeroSkill.Blade);
core.status.route.push('skill:Blade'); core.status.route.push('useSkill:Blade');
core.updateStatusBar(); core.updateStatusBar();
}) })
.realize('skill2', () => { .realize('skill2', () => {
@ -546,7 +546,7 @@ gameKey
HeroSkill.learnedSkill(HeroSkill.Jump) HeroSkill.learnedSkill(HeroSkill.Jump)
) { ) {
Mota.Plugin.require('skill_g').jumpSkill(); Mota.Plugin.require('skill_g').jumpSkill();
core.status.route.push('skill:Jump'); core.status.route.push('useSkill:Jump');
} else { } else {
if (core.hasItem('pickaxe')) { if (core.hasItem('pickaxe')) {
core.useItem('pickaxe'); core.useItem('pickaxe');
@ -562,7 +562,7 @@ gameKey
} }
core.playSound('光标移动'); core.playSound('光标移动');
HeroSkill.toggleSkill(HeroSkill.Shield); HeroSkill.toggleSkill(HeroSkill.Shield);
core.status.route.push('skill:Shield'); core.status.route.push('useSkill:Shield');
core.updateStatusBar(); core.updateStatusBar();
}) })
.realize('debug', () => { .realize('debug', () => {

View File

@ -487,8 +487,10 @@ export class HeroMover extends ObjectMoverBase {
const viewport = HeroMover.viewport; const viewport = HeroMover.viewport;
if (!adapter || !viewport) return; if (!adapter || !viewport) return;
// if (!core.isReplaying()) { // if (!core.isReplaying()) {
adapter.sync('startAnimate'); if (!core.isReplaying() || core.status.replay.speed <= 3) {
await adapter.all('readyMove'); adapter.sync('startAnimate');
await adapter.all('readyMove');
}
// } // }
// 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住 // 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住
if (!this.ignoreTerrain) { if (!this.ignoreTerrain) {
@ -512,8 +514,10 @@ export class HeroMover extends ObjectMoverBase {
const viewport = HeroMover.viewport; const viewport = HeroMover.viewport;
if (!adapter || !viewport) return; if (!adapter || !viewport) return;
// if (!core.isReplaying()) { // if (!core.isReplaying()) {
await adapter.all('endMove'); if (!core.isReplaying() || core.status.replay.speed <= 3) {
adapter.sync('endAnimate'); await adapter.all('endMove');
adapter.sync('endAnimate');
}
// } // }
viewport.sync('endMove'); viewport.sync('endMove');
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
@ -685,12 +689,12 @@ export class HeroMover extends ObjectMoverBase {
const speed = replay === 24 ? 1 : this.moveSpeed / replay; const speed = replay === 24 ? 1 : this.moveSpeed / replay;
viewport.all('moveTo', x, y, speed * 1.6); viewport.all('moveTo', x, y, speed * 1.6);
adapter.sync('setAnimateDir', showDir); adapter.sync('setAnimateDir', showDir);
// if (core.isReplaying()) { if (core.isReplaying() && core.status.replay.speed > 3) {
// await sleep(speed); await sleep(speed);
// await adapter.all('setHeroLoc', x, y); await adapter.all('setHeroLoc', x, y);
// } else { } else {
await adapter.all('move', moveDir); await adapter.all('move', moveDir);
// } }
} }
/** /**

View File

@ -184,12 +184,12 @@ export function init() {
} else { } else {
core.replay(); core.replay();
} }
core.status.route.push(`skill:${toEmit}`); core.status.route.push(`useSkill:${toEmit}`);
return true; return true;
} }
core.registerReplayAction('skill', name => { core.registerReplayAction('useSkill', name => {
if (!name.startsWith('skill:')) return false; if (!name.startsWith('useSkill:')) return false;
const [, skill] = name.split(':'); const [, skill] = name.split(':');
return skillAction(skill); return skillAction(skill);
}); });
@ -213,7 +213,6 @@ export function init() {
core.registerReplayAction('fly', action => { core.registerReplayAction('fly', action => {
if (!action.startsWith('fly:')) return false; if (!action.startsWith('fly:')) return false;
const floorId = action.slice(4) as FloorIds; const floorId = action.slice(4) as FloorIds;
const toIndex = core.floorIds.indexOf(floorId);
if ( if (
!core.canUseItem('fly') || !core.canUseItem('fly') ||
(core.flags.flyNearStair && !core.nearStair()) (core.flags.flyNearStair && !core.nearStair())