Add Xiaopei supply road battle
This commit is contained in:
@@ -869,22 +869,67 @@ try {
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-xuzhou-entrust-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 8; i += 1) {
|
||||
const returnedToCamp = await page.evaluate(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
return activeScenes.includes('CampScene');
|
||||
for (let i = 0; i < 10; i += 1) {
|
||||
const enteredEighthBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'eighth-battle-xiaopei-supply-road';
|
||||
});
|
||||
if (returnedToCamp) {
|
||||
if (enteredEighthBattle) {
|
||||
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 === 'eighth-battle-xiaopei-supply-road' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-eighth-battle.png', fullPage: true });
|
||||
|
||||
const eighthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const eighthEnemies = eighthBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const eighthAllies = eighthBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const eighthEnemyBehaviors = new Set(eighthEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
eighthBattleState.camera?.mapWidth !== 26 ||
|
||||
eighthBattleState.camera?.mapHeight !== 22 ||
|
||||
eighthBattleState.victoryConditionLabel !== '고순 격파' ||
|
||||
eighthEnemies.length < 11 ||
|
||||
!eighthEnemyBehaviors.has('aggressive') ||
|
||||
!eighthEnemyBehaviors.has('guard') ||
|
||||
!eighthEnemyBehaviors.has('hold') ||
|
||||
eighthAllies.some((unit) => unit.id === 'guan-yu') ||
|
||||
!eighthAllies.some((unit) => unit.id === 'liu-bei') ||
|
||||
!eighthAllies.some((unit) => unit.id === 'zhang-fei') ||
|
||||
!eighthAllies.some((unit) => unit.id === 'jian-yong')
|
||||
) {
|
||||
throw new Error(`Expected eighth battle to use expanded map, mixed AI, and selected recruit sortie: ${JSON.stringify(eighthBattleState)}`);
|
||||
}
|
||||
|
||||
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 eighthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
eighthCampState?.campBattleId !== 'eighth-battle-xiaopei-supply-road' ||
|
||||
eighthCampState.campTitle !== '소패 방위 군영' ||
|
||||
eighthCampState.availableDialogueIds?.length !== 3 ||
|
||||
!eighthCampState.availableDialogueIds.every((id) => id.endsWith('xiaopei')) ||
|
||||
!eighthCampState.campaign?.roster?.some((unit) => unit.id === 'jian-yong') ||
|
||||
!eighthCampState.campaign?.roster?.some((unit) => unit.id === 'mi-zhu')
|
||||
) {
|
||||
throw new Error(`Expected eighth camp to expose Xiaopei dialogue set and preserve recruits: ${JSON.stringify(eighthCampState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
@@ -896,7 +941,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-seventh-battle flow, sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-eighth-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