Add Xuzhou gate night raid battle
This commit is contained in:
@@ -930,6 +930,89 @@ try {
|
||||
throw new Error(`Expected eighth camp to expose Xiaopei dialogue set and preserve recruits: ${JSON.stringify(eighthCampState)}`);
|
||||
}
|
||||
|
||||
await page.mouse.click(1120, 38);
|
||||
await page.waitForTimeout(160);
|
||||
const eighthCampSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (!eighthCampSortieState?.sortieVisible) {
|
||||
throw new Error(`Expected eighth camp sortie prep overlay: ${JSON.stringify(eighthCampSortieState)}`);
|
||||
}
|
||||
if (!eighthCampSortieState.selectedSortieUnitIds?.includes('mi-zhu')) {
|
||||
await page.mouse.click(256, 516);
|
||||
await page.waitForTimeout(120);
|
||||
}
|
||||
const eighthCampMiZhuSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (!eighthCampMiZhuSortieState.selectedSortieUnitIds?.includes('mi-zhu')) {
|
||||
throw new Error(`Expected Mi Zhu to be selectable for ninth battle sortie: ${JSON.stringify(eighthCampMiZhuSortieState)}`);
|
||||
}
|
||||
await page.mouse.click(938, 596);
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
return activeScenes.includes('StoryScene');
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-lubu-refuge-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 10; i += 1) {
|
||||
const enteredNinthBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'ninth-battle-xuzhou-gate-night-raid';
|
||||
});
|
||||
if (enteredNinthBattle) {
|
||||
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 === 'ninth-battle-xuzhou-gate-night-raid' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-ninth-battle.png', fullPage: true });
|
||||
|
||||
const ninthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const ninthEnemies = ninthBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const ninthAllies = ninthBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const ninthEnemyBehaviors = new Set(ninthEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
ninthBattleState.camera?.mapWidth !== 26 ||
|
||||
ninthBattleState.camera?.mapHeight !== 22 ||
|
||||
ninthBattleState.victoryConditionLabel !== '조표 격파' ||
|
||||
ninthEnemies.length < 10 ||
|
||||
!ninthEnemyBehaviors.has('aggressive') ||
|
||||
!ninthEnemyBehaviors.has('guard') ||
|
||||
!ninthEnemyBehaviors.has('hold') ||
|
||||
ninthAllies.some((unit) => unit.id === 'guan-yu') ||
|
||||
!ninthAllies.some((unit) => unit.id === 'liu-bei') ||
|
||||
!ninthAllies.some((unit) => unit.id === 'zhang-fei') ||
|
||||
!ninthAllies.some((unit) => unit.id === 'jian-yong') ||
|
||||
!ninthAllies.some((unit) => unit.id === 'mi-zhu')
|
||||
) {
|
||||
throw new Error(`Expected ninth battle to use gate map, mixed AI, and selected recruit sortie: ${JSON.stringify(ninthBattleState)}`);
|
||||
}
|
||||
|
||||
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 ninthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
ninthCampState?.campBattleId !== 'ninth-battle-xuzhou-gate-night-raid' ||
|
||||
ninthCampState.campTitle !== '서주 성문 군영' ||
|
||||
ninthCampState.availableDialogueIds?.length !== 3 ||
|
||||
!ninthCampState.availableDialogueIds.every((id) => id.endsWith('xuzhou-gate')) ||
|
||||
!ninthCampState.campaign?.roster?.some((unit) => unit.id === 'jian-yong') ||
|
||||
!ninthCampState.campaign?.roster?.some((unit) => unit.id === 'mi-zhu')
|
||||
) {
|
||||
throw new Error(`Expected ninth camp to expose Xuzhou gate dialogue set and preserve recruits: ${JSON.stringify(ninthCampState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
@@ -941,7 +1024,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-eighth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-ninth-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