Add Liu Biao refuge chapter and Zhao Yun recruit
This commit is contained in:
@@ -1501,9 +1501,115 @@ try {
|
||||
fifteenthCampState.campTitle !== '원소 의탁 후 군영' ||
|
||||
fifteenthCampState.availableDialogueIds?.length !== 3 ||
|
||||
!fifteenthCampState.availableDialogueIds.every((id) => id.endsWith('yuan-refuge')) ||
|
||||
!fifteenthCampState.campaign?.roster?.some((unit) => unit.id === 'sun-qian')
|
||||
!fifteenthCampState.campaign?.roster?.some((unit) => unit.id === 'sun-qian') ||
|
||||
!fifteenthCampState.campaign?.roster?.some((unit) => unit.id === 'zhao-yun')
|
||||
) {
|
||||
throw new Error(`Expected fifteenth camp to expose Yuan refuge dialogue set and preserve expanded roster: ${JSON.stringify(fifteenthCampState)}`);
|
||||
throw new Error(`Expected fifteenth camp to expose Yuan refuge dialogue set, preserve expanded roster, and recruit Zhao Yun: ${JSON.stringify(fifteenthCampState)}`);
|
||||
}
|
||||
|
||||
await page.mouse.click(1120, 38);
|
||||
await page.waitForTimeout(160);
|
||||
const fifteenthCampSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!fifteenthCampSortieState?.sortieVisible ||
|
||||
!fifteenthCampSortieState.sortiePlan?.objectiveLine?.includes('유표 의탁로') ||
|
||||
!fifteenthCampSortieState.sortieRoster?.some((unit) => unit.id === 'zhao-yun' && unit.recruited && unit.recommended) ||
|
||||
fifteenthCampSortieState.sortieRoster?.length < 7 ||
|
||||
fifteenthCampSortieState.sortiePlan?.maxCount !== 6
|
||||
) {
|
||||
throw new Error(`Expected fifteenth camp sortie prep to target Liu Biao refuge road with Zhao Yun as a selectable recruit: ${JSON.stringify(fifteenthCampSortieState)}`);
|
||||
}
|
||||
assertSortieTacticalRoster(fifteenthCampSortieState, [
|
||||
'liu-bei',
|
||||
'guan-yu',
|
||||
'zhang-fei',
|
||||
'jian-yong',
|
||||
'mi-zhu',
|
||||
'sun-qian',
|
||||
'zhao-yun'
|
||||
]);
|
||||
if (fifteenthCampSortieState.sortieRoster?.some((unit) => unit.id === 'zhao-yun' && unit.selected)) {
|
||||
await clickSortieRosterUnit(page, 'zhao-yun');
|
||||
}
|
||||
const fifteenthCampBeforeSwapState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (fifteenthCampBeforeSwapState.sortieRoster?.some((unit) => unit.id === 'jian-yong' && unit.selected)) {
|
||||
await clickSortieRosterUnit(page, 'jian-yong');
|
||||
}
|
||||
await clickSortieRosterUnit(page, 'zhao-yun');
|
||||
const fifteenthCampZhaoYunSelectedState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!fifteenthCampZhaoYunSelectedState.sortieRoster?.some((unit) => unit.id === 'zhao-yun' && unit.selected) ||
|
||||
fifteenthCampZhaoYunSelectedState.sortieRoster?.some((unit) => unit.id === 'jian-yong' && unit.selected) ||
|
||||
fifteenthCampZhaoYunSelectedState.sortiePlan?.selectedCount !== 6
|
||||
) {
|
||||
throw new Error(`Expected Zhao Yun to replace Jian Yong in sixteenth battle sortie: ${JSON.stringify(fifteenthCampZhaoYunSelectedState)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-liu-biao-sortie.png', fullPage: true });
|
||||
|
||||
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-liu-biao-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 22; i += 1) {
|
||||
const enteredSixteenthBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'sixteenth-battle-liu-biao-refuge';
|
||||
});
|
||||
if (enteredSixteenthBattle) {
|
||||
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 === 'sixteenth-battle-liu-biao-refuge' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-sixteenth-battle.png', fullPage: true });
|
||||
|
||||
const sixteenthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const sixteenthEnemies = sixteenthBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const sixteenthAllies = sixteenthBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const sixteenthEnemyBehaviors = new Set(sixteenthEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
sixteenthBattleState.camera?.mapWidth !== 34 ||
|
||||
sixteenthBattleState.camera?.mapHeight !== 26 ||
|
||||
sixteenthBattleState.victoryConditionLabel !== '조인 격파' ||
|
||||
sixteenthEnemies.length < 18 ||
|
||||
!sixteenthEnemyBehaviors.has('aggressive') ||
|
||||
!sixteenthEnemyBehaviors.has('guard') ||
|
||||
!sixteenthEnemyBehaviors.has('hold') ||
|
||||
!sixteenthEnemies.some((unit) => unit.id === 'liu-biao-road-leader-cao-ren') ||
|
||||
!sixteenthAllies.some((unit) => unit.id === 'zhao-yun') ||
|
||||
sixteenthAllies.some((unit) => unit.id === 'jian-yong')
|
||||
) {
|
||||
throw new Error(`Expected sixteenth battle to use Liu Biao refuge map, Cao Ren objective, mixed AI, and selected Zhao Yun sortie: ${JSON.stringify(sixteenthBattleState)}`);
|
||||
}
|
||||
|
||||
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 sixteenthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
sixteenthCampState?.campBattleId !== 'sixteenth-battle-liu-biao-refuge' ||
|
||||
sixteenthCampState.campTitle !== '형주 의탁 후 군영' ||
|
||||
sixteenthCampState.availableDialogueIds?.length !== 3 ||
|
||||
!sixteenthCampState.availableDialogueIds.every((id) => id.endsWith('liu-biao-refuge')) ||
|
||||
!sixteenthCampState.campaign?.roster?.some((unit) => unit.id === 'zhao-yun')
|
||||
) {
|
||||
throw new Error(`Expected sixteenth camp to expose Liu Biao refuge dialogue set and preserve Zhao Yun in roster: ${JSON.stringify(sixteenthCampState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
@@ -1517,7 +1623,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-fifteenth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-sixteenth-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