Add Yuan Shao refuge road chapter

This commit is contained in:
2026-06-23 04:23:14 +09:00
parent 09c1390ba5
commit 821cebde0e
11 changed files with 873 additions and 18 deletions

View File

@@ -1428,6 +1428,84 @@ try {
throw new Error(`Expected fourteenth camp to expose Cao break dialogue set and preserve Sun Qian in roster: ${JSON.stringify(fourteenthCampState)}`);
}
await page.mouse.click(1120, 38);
await page.waitForTimeout(160);
const fourteenthCampSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
if (
!fourteenthCampSortieState?.sortieVisible ||
!fourteenthCampSortieState.sortiePlan?.objectiveLine?.includes('원소 의탁로') ||
!fourteenthCampSortieState.sortieRoster?.some((unit) => unit.id === 'sun-qian' && unit.recruited)
) {
throw new Error(`Expected fourteenth camp sortie prep to target Yuan Shao refuge road with expanded roster: ${JSON.stringify(fourteenthCampSortieState)}`);
}
assertSortieTacticalRoster(fourteenthCampSortieState, ['liu-bei', 'guan-yu', 'zhang-fei', 'jian-yong', 'mi-zhu', 'sun-qian']);
await page.screenshot({ path: 'dist/verification-yuan-refuge-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-yuan-refuge-story.png', fullPage: true });
for (let i = 0; i < 18; i += 1) {
const enteredFifteenthBattle = await page.evaluate(() => {
const state = window.__HEROS_DEBUG__?.battle();
return state?.scene === 'BattleScene' && state?.battleId === 'fifteenth-battle-yuan-refuge-road';
});
if (enteredFifteenthBattle) {
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 === 'fifteenth-battle-yuan-refuge-road' && state?.battleOutcome === null && state?.phase === 'idle';
});
await page.screenshot({ path: 'dist/verification-fifteenth-battle.png', fullPage: true });
const fifteenthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
const fifteenthEnemies = fifteenthBattleState.units.filter((unit) => unit.faction === 'enemy');
const fifteenthAllies = fifteenthBattleState.units.filter((unit) => unit.faction === 'ally');
const fifteenthEnemyBehaviors = new Set(fifteenthEnemies.map((unit) => unit.ai));
if (
fifteenthBattleState.camera?.mapWidth !== 34 ||
fifteenthBattleState.camera?.mapHeight !== 24 ||
fifteenthBattleState.victoryConditionLabel !== '채양 격파' ||
fifteenthEnemies.length < 16 ||
!fifteenthEnemyBehaviors.has('aggressive') ||
!fifteenthEnemyBehaviors.has('guard') ||
!fifteenthEnemyBehaviors.has('hold') ||
!fifteenthEnemies.some((unit) => unit.id === 'yuan-refuge-leader-cai-yang') ||
!fifteenthAllies.some((unit) => unit.id === 'sun-qian')
) {
throw new Error(`Expected fifteenth battle to use Yuan refuge map, Cai Yang objective, mixed AI, and expanded sortie: ${JSON.stringify(fifteenthBattleState)}`);
}
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 fifteenthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
if (
fifteenthCampState?.campBattleId !== 'fifteenth-battle-yuan-refuge-road' ||
fifteenthCampState.campTitle !== '원소 의탁 후 군영' ||
fifteenthCampState.availableDialogueIds?.length !== 3 ||
!fifteenthCampState.availableDialogueIds.every((id) => id.endsWith('yuan-refuge')) ||
!fifteenthCampState.campaign?.roster?.some((unit) => unit.id === 'sun-qian')
) {
throw new Error(`Expected fifteenth camp to expose Yuan refuge dialogue set and preserve expanded roster: ${JSON.stringify(fifteenthCampState)}`);
}
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
await page.waitForFunction(() => {
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
@@ -1439,7 +1517,7 @@ try {
return activeScenes.includes('CampScene');
});
console.log(`Verified title-to-fourteenth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
console.log(`Verified title-to-fifteenth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
} finally {
await browser?.close();
if (serverProcess && !serverProcess.killed) {