Test per-projectile hit wiring

This commit is contained in:
Admin 2026-09-18 01:16:17 +00:00
parent 0755d0820c
commit 2ccd6e4527

View File

@ -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\.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, /this\.processPlayerHits\(\)/);
assert.match(source, /reducePlayerVolleyHits\(\{/); assert.match(source, /reducePlayerProjectileHits\(\{/);
assert.match(source, /combat:player-hit-queued/); assert.match(source, /combat:player-hit-queued/);
assert.match(source, /combat:player-hit-processed/); 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'); 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, /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, /this\.flashShip\(this\.player, 0xffcccc\)/);
assert.match(source, /combat:player-hit-fx-error/); 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'); const source = await read('src/game-v4.js');
assert.match(source, /const volleyId = actor === 'pirate' \? this\.nextPirateVolleyId\+\+ : null/); assert.match(source, /if \(shot\.getData\('playerHitQueued'\)\) return/);
assert.match(source, /shot\.setData\('volleyId', volleyId\)/); assert.match(source, /reducePlayerProjectileHits\(\{/);
assert.match(source, /volleyId: shot\.getData\('volleyId'\)/); assert.doesNotMatch(source, /PLAYER_HIT_COOLDOWN_MS/);
assert.match(source, /seenVolleyIds: this\.damagedPlayerVolleys/); assert.doesNotMatch(source, /damagedPlayerVolleys/);
assert.match(source, /this\.damagedPlayerVolleys = result\.seenVolleyIds/); assert.doesNotMatch(source, /nextPirateVolleyId/);
assert.doesNotMatch(source, /volleyId/);
}); });