Add Xiapi outer siege chapter
This commit is contained in:
@@ -1179,6 +1179,84 @@ try {
|
||||
throw new Error(`Expected eleventh camp to expose Cao Cao refuge dialogue set and preserve full roster: ${JSON.stringify(eleventhCampState)}`);
|
||||
}
|
||||
|
||||
await page.mouse.click(1120, 38);
|
||||
await page.waitForTimeout(160);
|
||||
const eleventhCampSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (!eleventhCampSortieState?.sortieVisible || !eleventhCampSortieState.sortiePlan?.objectiveLine?.includes('하비 외곽전')) {
|
||||
throw new Error(`Expected eleventh camp sortie prep to target Xiapi outer siege: ${JSON.stringify(eleventhCampSortieState)}`);
|
||||
}
|
||||
assertSortieTacticalRoster(eleventhCampSortieState, ['liu-bei', 'guan-yu', 'zhang-fei', 'jian-yong', 'mi-zhu']);
|
||||
await page.mouse.click(1068, 646);
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
return activeScenes.includes('StoryScene');
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-xiapi-siege-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 18; i += 1) {
|
||||
const enteredTwelfthBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'twelfth-battle-xiapi-outer-siege';
|
||||
});
|
||||
if (enteredTwelfthBattle) {
|
||||
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 === 'twelfth-battle-xiapi-outer-siege' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-twelfth-battle.png', fullPage: true });
|
||||
|
||||
const twelfthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const twelfthEnemies = twelfthBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const twelfthAllies = twelfthBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const twelfthEnemyBehaviors = new Set(twelfthEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
twelfthBattleState.camera?.mapWidth !== 30 ||
|
||||
twelfthBattleState.camera?.mapHeight !== 24 ||
|
||||
twelfthBattleState.victoryConditionLabel !== '장료 격파' ||
|
||||
twelfthEnemies.length < 13 ||
|
||||
!twelfthEnemyBehaviors.has('aggressive') ||
|
||||
!twelfthEnemyBehaviors.has('guard') ||
|
||||
!twelfthEnemyBehaviors.has('hold') ||
|
||||
!twelfthEnemies.some((unit) => unit.id === 'xiapi-strategist-chen-gong') ||
|
||||
!twelfthAllies.some((unit) => unit.id === 'liu-bei') ||
|
||||
!twelfthAllies.some((unit) => unit.id === 'guan-yu') ||
|
||||
!twelfthAllies.some((unit) => unit.id === 'zhang-fei') ||
|
||||
!twelfthAllies.some((unit) => unit.id === 'jian-yong') ||
|
||||
!twelfthAllies.some((unit) => unit.id === 'mi-zhu')
|
||||
) {
|
||||
throw new Error(`Expected twelfth battle to use Xiapi siege map, mixed AI, and selected full sortie: ${JSON.stringify(twelfthBattleState)}`);
|
||||
}
|
||||
|
||||
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 twelfthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
twelfthCampState?.campBattleId !== 'twelfth-battle-xiapi-outer-siege' ||
|
||||
twelfthCampState.campTitle !== '하비 포위 군영' ||
|
||||
twelfthCampState.availableDialogueIds?.length !== 3 ||
|
||||
!twelfthCampState.availableDialogueIds.every((id) => id.endsWith('xiapi-outer')) ||
|
||||
!twelfthCampState.campaign?.roster?.some((unit) => unit.id === 'guan-yu') ||
|
||||
!twelfthCampState.campaign?.roster?.some((unit) => unit.id === 'jian-yong') ||
|
||||
!twelfthCampState.campaign?.roster?.some((unit) => unit.id === 'mi-zhu')
|
||||
) {
|
||||
throw new Error(`Expected twelfth camp to expose Xiapi siege dialogue set and preserve full roster: ${JSON.stringify(twelfthCampState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
@@ -1190,7 +1268,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-eleventh-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-twelfth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
} finally {
|
||||
await browser?.close();
|
||||
if (serverProcess && !serverProcess.killed) {
|
||||
|
||||
Reference in New Issue
Block a user