fea: 优化死亡特效

This commit is contained in:
cancerai committed 2026-10-24 02:35:03 +08:00
1 parent afe2f64b9b
commit e7200989ab
9 files changed
+373 -94

No files matched your search

+27 -7
View File
@@ -1,4 +1,4 @@
// 回归测试:R 键必须"自杀回存档点",不能把整关重开(否则存档点白碰)
// 回归测试:R 键必须"重生回存档点",不能把整关重开(否则存档点白碰)
const noop = () => { };
const els = new Map();
function mkEl(id = '') {
@@ -73,19 +73,39 @@ const cp = P.savePoint;
console.log(` 存档点激活=${!!cp} 位置=(${cp?.x.toFixed(0)},${cp?.y.toFixed(0)}) 关卡出生点x=${L0.spawn.x.toFixed(0)}`);
if (!cp) err('存档点未激活');
// ---- 按 R ----
// ---- 按 R(活着)= 原地播死亡动画后当帧重生回存档点(不计死亡、不留红叉、不等动画)----
const deaths0 = api.G.deaths;
const marks0 = L0.deathMarks.length;
P.x = L0.spawn.x; P.y = L0.spawn.y; // 先站到出生点,验证能回到存档点而非原地不动
step(5);
const beforeX = api.G.player.x;
key('keydown', 'KeyR');
step(2);
key('keyup', 'KeyR');
step(60);
console.log(` 活着按 R 后:玩家x=${beforeX.toFixed(0)}→${api.G.player.x.toFixed(0)} alive=${api.G.player.alive} dead=${api.G.player.dead} 死亡数=${deaths0}→${api.G.deaths} 红叉数=${marks0}→${L0.deathMarks.length} 粒子=${L0.particles.list.length} 冲击环=${L0.deathFX.length}`);
if (api.G.player.dead || !api.G.player.alive) err('活着按 R 没有当帧重生');
if (api.G.deaths !== deaths0) err('主动重生被计入了死亡数(主动重生不是死亡)');
if (L0.deathMarks.length !== marks0) err('主动重生留下了红叉(不应留血迹)');
if (Math.abs(api.G.player.x - cp.x) > 4) err(`按 R 没有回到存档点(x=${api.G.player.x.toFixed(0)} 期望 ${cp.x.toFixed(0)})`);
if (!(L0.particles.list.length > 0)) err('死亡演出粒子缺失(应留在死亡位置播完)');
if (!L0.deathFX.length) err('死亡演出冲击环缺失(应留在死亡位置播完)');
// ---- 死亡中按 R = 手动重生回存档点 ----
api.G.player.kill();
step(3);
if (!api.G.player.dead) err('kill 后未进入死亡定格状态');
key('keydown', 'KeyR');
step(2);
key('keyup', 'KeyR');
step(10);
const survivedLevel = api.G.level === L0;
console.log(` 按 R 后:关卡对象未被重建=${survivedLevel} 玩家x=${api.G.player.x.toFixed(0)} 死亡=${deaths0}→${api.G.deaths}`);
console.log(` 死亡中按 R 重生后:关卡对象未被重建=${survivedLevel} 玩家x=${api.G.player.x.toFixed(0)} alive=${api.G.player.alive} 残余粒子=${L0.particles.list.length}`);
if (!survivedLevel) err('R 键把整关重开了,存档进度丢失');
if (Math.abs(api.G.player.x - cp.x) > 4) err(`R 键后没有回到存档点(x=${api.G.player.x.toFixed(0)} 期望 ${cp.x.toFixed(0)})`);
if (api.G.deaths !== deaths0 + 1) err('R 键没有计入死亡数');
if (Math.abs(api.G.player.x - L0.spawn.x) < 4) err('R 键后被送回了关卡起点');
if (api.G.player.dead || !api.G.player.alive) err('死亡中按 R 未手动重生');
if (Math.abs(api.G.player.x - cp.x) > 4) err(`重生后没有回到存档点(x=${api.G.player.x.toFixed(0)} 期望 ${cp.x.toFixed(0)})`);
if (Math.abs(api.G.player.x - L0.spawn.x) < 4) err('重生后被送回了关卡起点');
if (!(L0.particles.list.length > 0)) err('死亡中按 R 重生把特效清掉了(应留在死亡位置播完)');
// ---- 按 Backspace = 整关重来 ----
key('keydown', 'Backspace');