Update combat and control wiring coverage
This commit is contained in:
parent
d7614ac85b
commit
87bf4a4f5e
@ -23,6 +23,8 @@ test('drag control emits and HUD consumes one shared helm vector event', async (
|
||||
assert.match(index, /CustomEvent\('airship:helm-vector'/);
|
||||
assert.match(index, /emitHelmVector\(dx \/ radius, dy \/ radius\)/);
|
||||
assert.match(index, /emitHelmVector\(0, 0\)/);
|
||||
assert.doesNotMatch(index, /setHeld\('Arrow/);
|
||||
assert.doesNotMatch(index, /keyMap/);
|
||||
|
||||
assert.match(hud, /addEventListener\('airship:helm-vector'/);
|
||||
assert.match(hud, /setHelmKnob\(event\.detail\?\.x \?\? 0, event\.detail\?\.y \?\? 0\)/);
|
||||
@ -132,8 +134,10 @@ test('mobile HUD uses uploaded player and enemy health sprite sheets', async ()
|
||||
assert.match(source, /addHealthPiece\('steam-enemy-card', enemyHealthSrc/);
|
||||
assert.match(source, /const healthFrame = \(current, max\) =>/);
|
||||
assert.match(source, /const setHealthFrame = \(piece, frame\) =>/);
|
||||
assert.match(source, /setHealthFrame\(playerHealthPiece, healthFrame\(playerHull, 100\)\)/);
|
||||
assert.match(source, /setHealthFrame\(enemyHealthPiece, pirate \? healthFrame\(enemyHull, 120\) : 11\)/);
|
||||
assert.match(source, /player-health-cover/);
|
||||
assert.match(source, /player-health-tint/);
|
||||
assert.match(source, /const enemyMaxHull = pirate \? Math\.max\(1, pirate\.getData\?\.\('maxHull'\) \?\? 120\) : 120/);
|
||||
assert.match(source, /setHealthFrame\(enemyHealthPiece, pirate \? healthFrame\(enemyHull, enemyMaxHull\) : 11\)/);
|
||||
assert.doesNotMatch(source, /steam-bar-fill/);
|
||||
});
|
||||
|
||||
@ -149,8 +153,31 @@ test('game consumes analog helm vector and keeps broadside cooldowns independent
|
||||
const source = await read('src/game-v4.js');
|
||||
|
||||
assert.match(source, /addEventListener\('airship:helm-vector', this\.handleHelmVector\)/);
|
||||
assert.match(source, /const rawHelmX = Math\.abs\(this\.helmVector\.x\) > HELM_DEAD_ZONE/);
|
||||
assert.match(source, /Math\.pow\(Math\.abs\(rawHelmX\), HELM_STEER_CURVE\)/);
|
||||
assert.match(source, /const throttleForward = this\.cursors\.up\.isDown \? 1 : Math\.max\(0, -helmY\)/);
|
||||
assert.match(source, /const turnInput = keyboardTurn \|\| helmX/);
|
||||
assert.match(source, /const broadside = side < 0 \? 'port' : 'starboard'/);
|
||||
assert.match(source, /this\.lastPlayerShot\[broadside\]/);
|
||||
});
|
||||
|
||||
|
||||
test('pirate combat uses class stats and separation steering', async () => {
|
||||
const source = await read('src/game-v4.js');
|
||||
|
||||
assert.match(source, /pirateClassForWave\(this\.wave, i, count\)/);
|
||||
assert.match(source, /separationVector\(pirate, pirates\)/);
|
||||
assert.match(source, /pirate\.getData\('reloadMs'\)/);
|
||||
assert.match(source, /pirate\.getData\('maxHull'\)/);
|
||||
assert.match(source, /nearestHull \/ nearestMaxHull/);
|
||||
});
|
||||
|
||||
test('mobile cannon HUD shows independent reload progress', async () => {
|
||||
const source = await read('src/mobile-hud.js');
|
||||
|
||||
assert.match(source, /data-steam="port-reload"/);
|
||||
assert.match(source, /data-steam="starboard-reload"/);
|
||||
assert.match(source, /scene\.playerBroadsideReloadMs \|\| 850/);
|
||||
assert.match(source, /scene\.lastPlayerShot\?\.port/);
|
||||
assert.match(source, /scene\.lastPlayerShot\?\.starboard/);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user