Fasi del giorno legate alla storia (pomeriggio, tramonto, sera) ed effetti animati: lucine, lampioni, acqua, fumo, bandiere, foglie, pulviscolo, occhi che sbattono
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
@@ -75,3 +75,15 @@ test('le apparizioni (lo spirito del Trebbio) hanno la loro immagine e parlano c
|
||||
assert.ok(sc.speakers?.[a.who], `${id}: il fumetto di ${a.who} non ha un posto`);
|
||||
}
|
||||
});
|
||||
|
||||
test('gli effetti delle scene: tipi che il motore conosce, e dentro la scena', async () => {
|
||||
const { story } = await import('../src/story/story.js');
|
||||
const { EFFECTS } = await import('../src/engine/render.js');
|
||||
const phases = new Set((story.phases ?? []).map(p => p.id));
|
||||
for (const [id, sc] of Object.entries(story.scenes)) for (const e of sc.effects ?? []) {
|
||||
assert.ok(EFFECTS[e.type], `${id}: effetto sconosciuto ${e.type}`);
|
||||
for (const ph of [e.phase ?? []].flat()) assert.ok(phases.has(ph), `${id}: fase sconosciuta ${ph}`);
|
||||
const pts = [...(e.points ?? []), ...(e.at ? [e.at] : []), ...(e.area ? [e.area.slice(0, 2), [e.area[0] + e.area[2], e.area[1] + e.area[3]]] : []), ...(e.rects ?? []).map(r => r.slice(0, 2))];
|
||||
for (const [x, y] of pts) assert.ok(x >= 0 && x <= 640 && y >= 0 && y <= 360, `${id}: ${e.type} fuori scena`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -122,6 +122,19 @@ test('il taccuino: lungo la soluzione le tappe si spuntano in ordine, una alla v
|
||||
assert.equal(g.notebook().done.length, story.notebook.length);
|
||||
});
|
||||
|
||||
test('le fasi del giorno seguono la storia: pomeriggio, poi tramonto, poi sera, senza tornare indietro', () => {
|
||||
const g = new Game(story);
|
||||
g.go(story.start.scene, story.start.at);
|
||||
settle(g);
|
||||
const ids = story.phases.map(p => p.id), seen = [g.phase().id];
|
||||
for (const [verb, target, item] of solution) {
|
||||
if (verb === 'choose') g.choose(g.options().findIndex(o => o.text === target)); else g.act(verb, target, item);
|
||||
settle(g);
|
||||
if (seen.at(-1) !== g.phase().id) seen.push(g.phase().id);
|
||||
}
|
||||
assert.deepEqual(seen, ids);
|
||||
});
|
||||
|
||||
test('la ricerca della mappa: pezzi di parola, senza maiuscole, accenti e apostrofi', () => {
|
||||
assert.ok(matchPlace('Campomigliaio', 'camp'));
|
||||
assert.ok(matchPlace('Via de\' Medici', 'de medici'));
|
||||
|
||||
Reference in New Issue
Block a user