diff --git a/e2e/effects.spec.ts b/e2e/effects.spec.ts index 41d9c87..5d42e46 100644 --- a/e2e/effects.spec.ts +++ b/e2e/effects.spec.ts @@ -42,3 +42,21 @@ test('CPU 戦では相手が帯の見出しで出る', async ({ page }) => { await page.evaluate(() => window.__novaria.startVersus('normal')); await page.waitForFunction(() => window.__novaria.fx.bannerTitle === 'VS CPU'); }); + +// 惑星めぐりで次の惑星へ渡ると、前の惑星で出した「10 CHAIN」や「+3」が新しい盤面の出だしに残っていた +test('新しい盤面を始めると、前の盤面の吹き出しと帯は残らない', async ({ page }) => { + await startGame(page); + await page.evaluate(() => { + const { fx, view } = window.__novaria; + fx.chain(view.colLeft(4), view.rowTop(12), 10, '#ff9ad8', 50); + fx.popup(view.colLeft(4), view.rowTop(13), '+3', '#bfe9ff', 26); + fx.banner('ESCAPE', '脱出', '#ffffff', 120); + window.__novaria.start(); + }); + const left = await page.evaluate(() => ({ + popups: window.__novaria.fx.popupCount, + banner: window.__novaria.fx.bannerTitle, + })); + expect(left.popups).toBe(0); + expect(left.banner).toBe('MISSION START'); +}); diff --git a/src/main.ts b/src/main.ts index 3d6976a..ce8ae2f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1355,7 +1355,7 @@ function beginPlay(started: Game): void { ending = false; finale = null; margin = null; - fx.resetShow(); + fx.clear(); view.lightsOn(); wasDanger = false; wasWarn = false; diff --git a/src/render/effects.ts b/src/render/effects.ts index f6fe84c..01a015b 100644 --- a/src/render/effects.ts +++ b/src/render/effects.ts @@ -282,6 +282,11 @@ export class Effects { return this.rivalCrown; } + /** いま出ている吹き出しの数。新しい盤面に前の盤面の字が残っていないかを e2e が見る */ + get popupCount(): number { + return this.popups.length; + } + /** いま出ている粒の数。上限を超えていないかを e2e が見る */ get particleCount(): number { return this.particles.length; @@ -605,7 +610,30 @@ export class Effects { this.crownOff = true; } - /** 決着の演出を片付ける。新しい盤面を始めるときに呼ぶ */ + /** + * 盤面に重ねたものをすべて片付ける。新しい盤面を始めるときに呼ぶ。 + * 惑星めぐりで次の惑星へ渡ると、前の盤面の吹き出しや帯が新しい盤面の出だしに残っていた + */ + clear(): void { + this.particles = []; + this.popups = []; + this.rings = []; + this.streaks = []; + this.flares = []; + this.beams = []; + this.bannerNow = null; + this.tracers = []; + this.impacts = []; + this.hit = 0; + this.hitCount = 0; + this.hitCols = []; + this.landed = 0; + this.shake = 0; + this.flash = 0; + this.resetShow(); + } + + /** 決着の演出を片付ける */ resetShow(): void { this.show = null; this.rockets = [];