All'Ingorgo la folla dipinta salta a tempo: la fascia della gente tagliata in strisce che sobbalzano sul battito, due fasce per scena, dietro piano e davanti forte (Andrea)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiECd9RWGMKV7n3K1mdy8T
This commit is contained in:
2026-10-31 13:42:55 +01:00
co-authored by Claude Fable 5.1
parent b10f031133
commit 4fe6bf4649
4 changed files with 47 additions and 6 deletions
+17
View File
@@ -154,3 +154,20 @@ test('le musiche e gli sfondi della festa esistono', () => {
assert.ok(files.size >= 10);
for (const f of files) assert.ok(existsSync(new URL('../' + f, import.meta.url)), `manca ${f}`);
});
test('alla festa la folla dipinta salta a tempo: l\'effetto crowd in tutte e cinque le scene, dietro piano e davanti forte', async () => {
const { EFFECTS } = await import('../src/engine/render.js');
assert.equal(typeof EFFECTS.crowd, 'function');
for (const id of ZONE.scenes) {
const crowds = (story.scenes[id].effects ?? []).filter(e => e.type === 'crowd');
assert.equal(crowds.length, 2, `${id}: due fasce di folla`);
assert.ok(crowds.every(e => e.phase === 'ingorgo' && e.bpm > 0 && e.area[1] + e.area[3] <= 360), id);
assert.ok(crowds[0].amount < crowds[1].amount, `${id}: quella davanti salta di più`);
}
// Il salto: ogni striscia va su e giù nel tempo; senza sfondo l'effetto non disegna niente.
const calls = [];
const ctx = { drawImage: (...a) => calls.push(a) };
const game = { backdrop: () => 'x.png' };
EFFECTS.crowd(ctx, { area: [0, 200, 640, 100], bpm: 120 }, 0, game);
assert.equal(calls.length, 0, 'senza sfondo caricato non disegna');
});