联防 plays the official escaped stage's own corrosion BGM (#110)

The 联防 phase plays m_bat_corrosion (intro + loop), the track of the official escaped stages, instead of carrying on with the round's battle music; without the downloaded track it falls back to the battle music. Asset plan, manifest entry (audio.bgm.unite), audio.js and tests. Contributed by @Convey123.
This commit is contained in:
Convey123 authored and GitHub committed 2026-10-05 14:34:42 +08:00
1 parent 763e224b8d
commit bd892a4dd6
5 files changed
+32 -6

No files matched your search

+10 -1
View File
@@ -30,7 +30,8 @@ describe('bgm selection', () => {
assert.equal(bgmKeyFor('game', { phase: PHASE.PREP }), 'prep');
assert.equal(bgmKeyFor('game', { phase: PHASE.SP_DRAFT }), 'prep');
assert.equal(bgmKeyFor('game', { phase: PHASE.COMBAT }), 'combat');
assert.equal(bgmKeyFor('game', { phase: PHASE.UNITE }), 'combat');
// 联防 has its own track: the official escaped_single / escaped_multi levels declare bgmEvent = corrosion
assert.equal(bgmKeyFor('game', { phase: PHASE.UNITE }), 'unite');
assert.equal(bgmKeyFor('game', { phase: PHASE.FINAL_ASSAULT, bossId: 'boss_4' }), 'boss:boss_4');
assert.equal(bgmKeyFor('game', { phase: PHASE.FINAL_ASSAULT }), 'boss');
assert.equal(bgmKeyFor('game', { phase: PHASE.HIDDEN_CORE, bossId: 'boss_1', hiddenBossId: 'boss_9' }), 'boss:boss_9');
@@ -44,6 +45,14 @@ describe('bgm selection', () => {
assert.equal(b4.loop, manifest.audio.bossBgm.boss_4.loop);
assert.equal(resolveBgm(manifest, 'boss:nope').loop, manifest.audio.bgm.boss.loop);
assert.equal(resolveBgm(manifest, 'prep').intro, manifest.audio.bgm.prep.intro ?? null);
// 联防's own track (bgm.unite = corrosion, the official escaped levels' bgmEvent), and the fallback for an older
// manifest that has no `unite` entry (the music must not go silent)
const unite = manifest.audio.bgm.unite;
assert.ok(unite && typeof unite.loop === 'string', 'the manifest carries 联防’s own track');
assert.equal(resolveBgm(manifest, 'unite').loop, unite.loop);
assert.equal(resolveBgm(manifest, 'unite').intro, unite.intro ?? null);
assert.notEqual(unite.loop, manifest.audio.bgm.combat.loop, 'not the shop / default combat loop');
assert.equal(resolveBgm({ audio: { bgm: { combat: { loop: '/shop.mp3' } } } }, 'unite').loop, '/shop.mp3');
assert.equal(resolveBgm(null, 'lobby'), null);
assert.equal(resolveBgm(manifest, null), null);
assert.equal(resolveBgm(manifest, 'nope'), null);