Add Sishui vanguard campaign battle

This commit is contained in:
2026-06-22 23:57:49 +09:00
parent 421b95011e
commit fe93b70a56
9 changed files with 594 additions and 15 deletions

View File

@@ -574,6 +574,78 @@ try {
throw new Error(`Expected campaign save to persist fourth battle victory: ${JSON.stringify(campaignSaveAfterFourthBattle)}`);
}
await page.mouse.click(1120, 38);
await page.waitForTimeout(160);
const fourthCampSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
if (!fourthCampSortieState?.sortieVisible) {
throw new Error(`Expected fourth camp sortie preparation overlay: ${JSON.stringify(fourthCampSortieState)}`);
}
await page.mouse.click(938, 596);
await page.waitForFunction(() => {
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
return activeScenes.includes('StoryScene');
});
for (let i = 0; i < 26; i += 1) {
const isFifthBattleActive = await page.evaluate(() => {
const state = window.__HEROS_DEBUG__?.battle();
return state?.scene === 'BattleScene' && state?.battleId === 'fifth-battle-sishui-vanguard';
});
if (isFifthBattleActive) {
break;
}
await page.keyboard.press('Space');
await page.waitForTimeout(320);
}
await page.waitForFunction(() => {
const state = window.__HEROS_DEBUG__?.battle();
return state?.scene === 'BattleScene' && state?.battleId === 'fifth-battle-sishui-vanguard' && state?.battleOutcome === null && state?.phase === 'idle';
});
await page.screenshot({ path: 'dist/verification-fifth-battle.png', fullPage: true });
const fifthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
const fifthEnemies = fifthBattleState.units.filter((unit) => unit.faction === 'enemy');
const fifthEnemyBehaviors = new Set(fifthEnemies.map((unit) => unit.ai));
if (
fifthBattleState.camera?.mapWidth !== 24 ||
fifthBattleState.camera?.mapHeight !== 20 ||
fifthBattleState.victoryConditionLabel !== '호진 격파' ||
fifthEnemies.length < 10 ||
!fifthEnemyBehaviors.has('aggressive') ||
!fifthEnemyBehaviors.has('guard') ||
!fifthEnemyBehaviors.has('hold')
) {
throw new Error(`Expected fifth battle map, objective, and mixed enemy AI: ${JSON.stringify(fifthBattleState)}`);
}
await page.evaluate(() => window.__HEROS_DEBUG__?.forceBattleOutcome('victory'));
await page.waitForFunction(() => {
const state = window.__HEROS_DEBUG__?.battle();
return state?.battleOutcome === 'victory' && state?.phase === 'resolved' && state?.resultVisible === true;
});
await page.mouse.click(738, 642);
await page.waitForFunction(() => {
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
return activeScenes.includes('CampScene');
});
const campaignSaveAfterFifthBattle = await page.evaluate(() => {
const raw = window.localStorage.getItem('heros-web:campaign-state');
return raw ? JSON.parse(raw) : undefined;
});
if (
!campaignSaveAfterFifthBattle ||
campaignSaveAfterFifthBattle.step !== 'fifth-camp' ||
campaignSaveAfterFifthBattle.latestBattleId !== 'fifth-battle-sishui-vanguard' ||
!campaignSaveAfterFifthBattle.battleHistory?.['fifth-battle-sishui-vanguard']
) {
throw new Error(`Expected campaign save to persist fifth battle victory: ${JSON.stringify(campaignSaveAfterFifthBattle)}`);
}
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
await page.waitForFunction(() => {
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
@@ -585,7 +657,7 @@ try {
return activeScenes.includes('CampScene');
});
console.log(`Verified title-to-fourth-battle flow, result states, and debug API at ${targetUrl}`);
console.log(`Verified title-to-fifth-battle flow, result states, and debug API at ${targetUrl}`);
} finally {
await browser?.close();
if (serverProcess && !serverProcess.killed) {