From 2ccd6e45273852fd08287bafc05c11cfe394537a Mon Sep 17 00:00:00 2001 From: Admin Date: Fri, 18 Sep 2026 01:16:17 +0000 Subject: [PATCH] Test per-projectile hit wiring --- tests/wiring.test.mjs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index 109675d..3db6d75 100644 --- a/tests/wiring.test.mjs +++ b/tests/wiring.test.mjs @@ -43,7 +43,7 @@ test('player collision callback queues hits and processing occurs in scene updat assert.match(source, /this\.pendingPlayerHits\.push\(\{[\s\S]*?shot,[\s\S]*?damage,[\s\S]*?x: shot\.x,[\s\S]*?y: shot\.y/); assert.match(source, /this\.processPlayerHits\(\)/); - assert.match(source, /reducePlayerVolleyHits\(\{/); + assert.match(source, /reducePlayerProjectileHits\(\{/); assert.match(source, /combat:player-hit-queued/); assert.match(source, /combat:player-hit-processed/); }); @@ -95,17 +95,19 @@ test('player hit FX runs after queued hit processing, outside the overlap callba const source = await read('src/game-v4.js'); assert.match(source, /this\.pendingPlayerHits\.push\(\{[\s\S]*?x: shot\.x,[\s\S]*?y: shot\.y/); - assert.match(source, /if \(acceptedHits\.length > 0\) \{[\s\S]*?this\.spawnExplosion\(impact\.x, impact\.y, 0\.32\)/); + assert.match(source, /if \(appliedHits > 0\) \{[\s\S]*?for \(const impact of hits\) \{[\s\S]*?this\.spawnExplosion\(impact\.x, impact\.y, 0\.32\)/); assert.match(source, /this\.flashShip\(this\.player, 0xffcccc\)/); assert.match(source, /combat:player-hit-fx-error/); }); -test('pirate broadsides assign a volley id and player damage deduplicates by volley', async () => { + +test('player damage is per projectile with no global cooldown or volley suppression', async () => { const source = await read('src/game-v4.js'); - assert.match(source, /const volleyId = actor === 'pirate' \? this\.nextPirateVolleyId\+\+ : null/); - assert.match(source, /shot\.setData\('volleyId', volleyId\)/); - assert.match(source, /volleyId: shot\.getData\('volleyId'\)/); - assert.match(source, /seenVolleyIds: this\.damagedPlayerVolleys/); - assert.match(source, /this\.damagedPlayerVolleys = result\.seenVolleyIds/); + assert.match(source, /if \(shot\.getData\('playerHitQueued'\)\) return/); + assert.match(source, /reducePlayerProjectileHits\(\{/); + assert.doesNotMatch(source, /PLAYER_HIT_COOLDOWN_MS/); + assert.doesNotMatch(source, /damagedPlayerVolleys/); + assert.doesNotMatch(source, /nextPirateVolleyId/); + assert.doesNotMatch(source, /volleyId/); });