mod: 优化跳跃手感,去iwanna元素

This commit is contained in:
cancerai committed 2026-11-01 01:50:53 +08:00
1 parent 6c07133a9d
commit 156887e4c3
5 files changed
+72 -26

No files matched your search

+23 -4
View File
@@ -69,7 +69,7 @@ void main() {
expect(world.player!.vx, closeTo(2.6, 0.001));
});
test('跳跃初速与重力与 web 版一致(JUMP 6.6 / GRAV 0.25)', () async {
test('跳跃初速与重力(当前调校:JUMP 6.326 / GRAV 0.23)', () async {
final world = await _start();
// 先落地,避免出生即空中导致二段跳语义不同
_step(world, 30);
@@ -77,8 +77,8 @@ void main() {
Input.onKey('ShiftLeft', true);
world.tick(17);
world.tick(17);
// 按住不放时持续受 GRAV = 0.25:-6.6 + 0.25 × 2
expect(P.vy, closeTo(-6.6 + 0.5, 0.001), reason: '上升重力不符');
// 按住不放时持续受 GRAV = 0.23:-6.326 + 0.23 × 2
expect(P.vy, closeTo(-6.326 + 0.46, 0.001), reason: '上升重力/初速不符');
});
test('松键即停:可变跳跃高度(与 web 版一致)', () async {
@@ -90,7 +90,26 @@ void main() {
// 中途松开:web 版 player.js 会把 vy 收紧到 -3,再叠加一帧重力 → -2.75
Input.onKey('ShiftLeft', false);
world.tick(17);
expect(P.vy, closeTo(-3 + 0.25, 0.001), reason: '松键后的上升速度未按 -3 收紧');
expect(P.vy, closeTo(-3 + 0.23, 0.001), reason: '松键后的上升速度未按 -3 收紧');
});
test('满力单跳顶点高度保持 ≈83.85px(飘但不改高度)', () async {
// 回归:改手感「更飘」必须保持顶点高度不变——否则天花板/平台间距会错位。
// 本改法是「同比例降重力 + 提初速」,顶点由 v²/(2g) 决定故应零变化。
final world = await _start();
_step(world, 30); // 落地稳定
final P = world.player!;
final double y0 = P.y;
Input.onKey('ShiftLeft', true); // 满力起跳(按住不放)
double minY = P.y;
for (int i = 0; i < 240; i++) {
world.tick(17);
if (P.y < minY) minY = P.y;
if (i > 5 && P.vy >= 0 && P.y >= y0) break; // 落回起跳高度
}
final double apex = y0 - minY;
expect(apex, closeTo(83.85, 0.5),
reason: '飘的改法必须保持单跳顶点高度 ≈83.85px(约 2.6 格)');
});
test('死亡后不自动重生,按 R 才回存档点', () async {