Add Jiangdong envoy sortie chapter
This commit is contained in:
@@ -1736,7 +1736,7 @@ try {
|
||||
if (
|
||||
progressTabState?.activeTab !== 'progress' ||
|
||||
progressTabState.campaignProgress?.completedKnown !== 17 ||
|
||||
progressTabState.campaignProgress?.totalKnown !== 19 ||
|
||||
progressTabState.campaignProgress?.totalKnown !== 20 ||
|
||||
progressTabState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
progressTabState.campaignProgress?.latestBattleTitle !== '융중 방문로' ||
|
||||
progressTabState.campaignProgress?.nextBattleTitle !== '박망파 매복전'
|
||||
@@ -1888,7 +1888,7 @@ try {
|
||||
if (
|
||||
postBowangProgressState?.activeTab !== 'progress' ||
|
||||
postBowangProgressState.campaignProgress?.completedKnown !== 18 ||
|
||||
postBowangProgressState.campaignProgress?.totalKnown !== 19 ||
|
||||
postBowangProgressState.campaignProgress?.totalKnown !== 20 ||
|
||||
postBowangProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postBowangProgressState.campaignProgress?.latestBattleTitle !== '박망파 매복전' ||
|
||||
postBowangProgressState.campaignProgress?.nextBattleTitle !== '장판파 피난로'
|
||||
@@ -2025,15 +2025,153 @@ try {
|
||||
const postChangbanProgressState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
postChangbanProgressState?.activeTab !== 'progress' ||
|
||||
postChangbanProgressState.campaignProgress?.completedKnown !== postChangbanProgressState.campaignProgress?.totalKnown ||
|
||||
postChangbanProgressState.campaignProgress?.completedKnown !== 19 ||
|
||||
postChangbanProgressState.campaignProgress?.totalKnown !== 20 ||
|
||||
postChangbanProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postChangbanProgressState.campaignProgress?.latestBattleTitle !== '장판파 피난로' ||
|
||||
postChangbanProgressState.campaignProgress?.nextBattleTitle !== '준비 중'
|
||||
postChangbanProgressState.campaignProgress?.nextBattleTitle !== '강동 사절로'
|
||||
) {
|
||||
throw new Error(`Expected post-Changban progress tab to keep Red Cliffs active while Jiangdong envoy is pending: ${JSON.stringify(postChangbanProgressState?.campaignProgress)}`);
|
||||
throw new Error(`Expected post-Changban progress tab to point toward Jiangdong envoy route: ${JSON.stringify(postChangbanProgressState?.campaignProgress)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-post-changban-progress.png', fullPage: true });
|
||||
|
||||
await page.mouse.click(1120, 38);
|
||||
await page.waitForTimeout(180);
|
||||
const jiangdongSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!jiangdongSortieState?.sortieVisible ||
|
||||
!jiangdongSortieState.sortiePlan?.objectiveLine?.includes('강동 사절로') ||
|
||||
!jiangdongSortieState.sortieRoster?.some((unit) => unit.id === 'zhuge-liang' && unit.recruited && unit.recommended) ||
|
||||
!jiangdongSortieState.sortieRoster?.some((unit) => unit.id === 'sun-qian' && unit.recruited && unit.recommended) ||
|
||||
!jiangdongSortieState.sortieRoster?.some((unit) => unit.id === 'zhao-yun' && unit.recruited && unit.recommended) ||
|
||||
jiangdongSortieState.sortieRoster?.length < 8 ||
|
||||
jiangdongSortieState.sortiePlan?.maxCount !== 6
|
||||
) {
|
||||
throw new Error(`Expected nineteenth camp sortie prep to target Jiangdong envoy with Zhuge Liang, Sun Qian, and Zhao Yun recommendations: ${JSON.stringify(jiangdongSortieState)}`);
|
||||
}
|
||||
assertSortieTacticalRoster(jiangdongSortieState, [
|
||||
'liu-bei',
|
||||
'guan-yu',
|
||||
'zhang-fei',
|
||||
'jian-yong',
|
||||
'mi-zhu',
|
||||
'sun-qian',
|
||||
'zhao-yun',
|
||||
'zhuge-liang'
|
||||
]);
|
||||
|
||||
const jiangdongPriorityUnits = ['zhuge-liang', 'sun-qian', 'zhao-yun'];
|
||||
for (const unitId of jiangdongPriorityUnits) {
|
||||
const currentSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (!currentSortieState.sortieRoster?.some((unit) => unit.id === unitId && unit.selected)) {
|
||||
const removable = currentSortieState.sortieRoster?.find(
|
||||
(unit) => unit.selected && unit.id !== 'liu-bei' && !jiangdongPriorityUnits.includes(unit.id)
|
||||
);
|
||||
if (removable) {
|
||||
await clickSortieRosterUnit(page, removable.id);
|
||||
}
|
||||
await clickSortieRosterUnit(page, unitId);
|
||||
}
|
||||
}
|
||||
|
||||
const jiangdongSortieReadyState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!jiangdongPriorityUnits.every((unitId) =>
|
||||
jiangdongSortieReadyState.sortieRoster?.some((unit) => unit.id === unitId && unit.selected)
|
||||
) ||
|
||||
jiangdongSortieReadyState.sortiePlan?.selectedCount !== 6 ||
|
||||
jiangdongSortieReadyState.sortiePlan?.recommendedSelectedCount < 5
|
||||
) {
|
||||
throw new Error(`Expected Jiangdong envoy sortie to deploy priority officers while preserving six-officer pressure: ${JSON.stringify(jiangdongSortieReadyState)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-jiangdong-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-jiangdong-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 32; i += 1) {
|
||||
const enteredTwentiethBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'twentieth-battle-jiangdong-envoy';
|
||||
});
|
||||
if (enteredTwentiethBattle) {
|
||||
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 === 'twentieth-battle-jiangdong-envoy' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-twentieth-battle.png', fullPage: true });
|
||||
|
||||
const twentiethBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const twentiethEnemies = twentiethBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const twentiethAllies = twentiethBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const twentiethEnemyBehaviors = new Set(twentiethEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
twentiethBattleState.camera?.mapWidth !== 40 ||
|
||||
twentiethBattleState.camera?.mapHeight !== 28 ||
|
||||
twentiethBattleState.victoryConditionLabel !== '문빙 퇴각' ||
|
||||
twentiethEnemies.length < 17 ||
|
||||
!twentiethEnemyBehaviors.has('aggressive') ||
|
||||
!twentiethEnemyBehaviors.has('guard') ||
|
||||
!twentiethEnemyBehaviors.has('hold') ||
|
||||
!twentiethEnemies.some((unit) => unit.id === 'envoy-road-leader-wen-pin') ||
|
||||
!twentiethAllies.some((unit) => unit.id === 'sun-qian') ||
|
||||
!twentiethAllies.some((unit) => unit.id === 'zhuge-liang')
|
||||
) {
|
||||
throw new Error(`Expected twentieth battle to use Jiangdong envoy map, Wen Pin objective, mixed AI, Sun Qian, and Zhuge Liang: ${JSON.stringify(twentiethBattleState)}`);
|
||||
}
|
||||
|
||||
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 twentiethCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
twentiethCampState?.campBattleId !== 'twentieth-battle-jiangdong-envoy' ||
|
||||
twentiethCampState.campTitle !== '강동 사절 준비 군영' ||
|
||||
twentiethCampState.availableDialogueIds?.length !== 3 ||
|
||||
!twentiethCampState.availableDialogueIds.every((id) => id.endsWith('jiangdong-envoy')) ||
|
||||
twentiethCampState.availableVisitIds?.length !== 2 ||
|
||||
!twentiethCampState.report?.bonds?.some((bond) => bond.id === 'sun-qian__zhuge-liang') ||
|
||||
!twentiethCampState.report?.bonds?.some((bond) => bond.id === 'zhao-yun__zhuge-liang') ||
|
||||
twentiethCampState.rosterCollection?.total < 8 ||
|
||||
twentiethCampState.rosterCollection?.reserveTrainingCount < 2 ||
|
||||
twentiethCampState.rosterCollection?.reserveTrainingExp < 12
|
||||
) {
|
||||
throw new Error(`Expected twentieth camp to expose Jiangdong dialogue/visit sets, envoy bonds, and reserve growth: ${JSON.stringify(twentiethCampState)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-jiangdong-camp.png', fullPage: true });
|
||||
|
||||
await page.mouse.click(966, 38);
|
||||
await page.waitForTimeout(180);
|
||||
const postJiangdongProgressState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
postJiangdongProgressState?.activeTab !== 'progress' ||
|
||||
postJiangdongProgressState.campaignProgress?.completedKnown !== postJiangdongProgressState.campaignProgress?.totalKnown ||
|
||||
postJiangdongProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postJiangdongProgressState.campaignProgress?.latestBattleTitle !== '강동 사절로' ||
|
||||
postJiangdongProgressState.campaignProgress?.nextBattleTitle !== '준비 중'
|
||||
) {
|
||||
throw new Error(`Expected post-Jiangdong progress tab to keep Red Cliffs active while first Red Cliffs battle is pending: ${JSON.stringify(postJiangdongProgressState?.campaignProgress)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-post-jiangdong-progress.png', fullPage: true });
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
@@ -2045,7 +2183,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-nineteenth-battle flow, recruit sortie selection, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-twentieth-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