Add Changsha veteran chapter
This commit is contained in:
@@ -1736,7 +1736,7 @@ try {
|
||||
if (
|
||||
progressTabState?.activeTab !== 'progress' ||
|
||||
progressTabState.campaignProgress?.completedKnown !== 17 ||
|
||||
progressTabState.campaignProgress?.totalKnown !== 25 ||
|
||||
progressTabState.campaignProgress?.totalKnown !== 26 ||
|
||||
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 !== 25 ||
|
||||
postBowangProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postBowangProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postBowangProgressState.campaignProgress?.latestBattleTitle !== '박망파 매복전' ||
|
||||
postBowangProgressState.campaignProgress?.nextBattleTitle !== '장판파 피난로'
|
||||
@@ -2026,7 +2026,7 @@ try {
|
||||
if (
|
||||
postChangbanProgressState?.activeTab !== 'progress' ||
|
||||
postChangbanProgressState.campaignProgress?.completedKnown !== 19 ||
|
||||
postChangbanProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postChangbanProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postChangbanProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postChangbanProgressState.campaignProgress?.latestBattleTitle !== '장판파 피난로' ||
|
||||
postChangbanProgressState.campaignProgress?.nextBattleTitle !== '강동 사절로'
|
||||
@@ -2164,7 +2164,7 @@ try {
|
||||
if (
|
||||
postJiangdongProgressState?.activeTab !== 'progress' ||
|
||||
postJiangdongProgressState.campaignProgress?.completedKnown !== 20 ||
|
||||
postJiangdongProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postJiangdongProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postJiangdongProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postJiangdongProgressState.campaignProgress?.latestBattleTitle !== '강동 사절로' ||
|
||||
postJiangdongProgressState.campaignProgress?.nextBattleTitle !== '적벽 전초전'
|
||||
@@ -2304,7 +2304,7 @@ try {
|
||||
if (
|
||||
postRedCliffsProgressState?.activeTab !== 'progress' ||
|
||||
postRedCliffsProgressState.campaignProgress?.completedKnown !== 21 ||
|
||||
postRedCliffsProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postRedCliffsProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postRedCliffsProgressState.campaignProgress?.activeChapter?.title !== '적벽대전' ||
|
||||
postRedCliffsProgressState.campaignProgress?.latestBattleTitle !== '적벽 전초전' ||
|
||||
postRedCliffsProgressState.campaignProgress?.nextBattleTitle !== '적벽 화공전'
|
||||
@@ -2444,7 +2444,7 @@ try {
|
||||
if (
|
||||
postFireAttackProgressState?.activeTab !== 'progress' ||
|
||||
postFireAttackProgressState.campaignProgress?.completedKnown !== 22 ||
|
||||
postFireAttackProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postFireAttackProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postFireAttackProgressState.campaignProgress?.activeChapter?.title !== '형주·익주 확보' ||
|
||||
postFireAttackProgressState.campaignProgress?.latestBattleTitle !== '적벽 화공전' ||
|
||||
postFireAttackProgressState.campaignProgress?.nextBattleTitle !== '형주 남부 진입전'
|
||||
@@ -2587,7 +2587,7 @@ try {
|
||||
if (
|
||||
postJingzhouProgressState?.activeTab !== 'progress' ||
|
||||
postJingzhouProgressState.campaignProgress?.completedKnown !== 23 ||
|
||||
postJingzhouProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postJingzhouProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postJingzhouProgressState.campaignProgress?.activeChapter?.title !== '형주·익주 확보' ||
|
||||
postJingzhouProgressState.campaignProgress?.latestBattleTitle !== '형주 남부 진입전' ||
|
||||
postJingzhouProgressState.campaignProgress?.nextBattleTitle !== '계양 설득전'
|
||||
@@ -2729,7 +2729,7 @@ try {
|
||||
if (
|
||||
postGuiyangProgressState?.activeTab !== 'progress' ||
|
||||
postGuiyangProgressState.campaignProgress?.completedKnown !== 24 ||
|
||||
postGuiyangProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postGuiyangProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postGuiyangProgressState.campaignProgress?.activeChapter?.title !== '형주·익주 확보' ||
|
||||
postGuiyangProgressState.campaignProgress?.latestBattleTitle !== '계양 설득전' ||
|
||||
postGuiyangProgressState.campaignProgress?.nextBattleTitle !== '무릉 산길 확보전'
|
||||
@@ -2872,15 +2872,164 @@ try {
|
||||
if (
|
||||
postWulingProgressState?.activeTab !== 'progress' ||
|
||||
postWulingProgressState.campaignProgress?.completedKnown !== 25 ||
|
||||
postWulingProgressState.campaignProgress?.totalKnown !== 25 ||
|
||||
postWulingProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postWulingProgressState.campaignProgress?.activeChapter?.title !== '형주·익주 확보' ||
|
||||
postWulingProgressState.campaignProgress?.latestBattleTitle !== '무릉 산길 확보전' ||
|
||||
postWulingProgressState.campaignProgress?.nextBattleTitle !== '준비 중'
|
||||
postWulingProgressState.campaignProgress?.nextBattleTitle !== '장사 노장 대면전'
|
||||
) {
|
||||
throw new Error(`Expected post-Wuling progress tab to complete the mountain-road battle and pause on Changsha preparation: ${JSON.stringify(postWulingProgressState?.campaignProgress)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-post-wuling-progress.png', fullPage: true });
|
||||
|
||||
await page.mouse.click(1120, 38);
|
||||
await page.waitForTimeout(180);
|
||||
const changshaSortieState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!changshaSortieState?.sortieVisible ||
|
||||
!changshaSortieState.sortiePlan?.objectiveLine?.includes('장사 노장 대면전') ||
|
||||
!changshaSortieState.sortieRoster?.some((unit) => unit.id === 'gong-zhi' && unit.recruited && unit.recommended) ||
|
||||
!changshaSortieState.sortieRoster?.some((unit) => unit.id === 'yi-ji' && unit.recruited && unit.recommended) ||
|
||||
!changshaSortieState.sortieRoster?.some((unit) => unit.id === 'zhuge-liang' && unit.recruited && unit.recommended) ||
|
||||
!changshaSortieState.sortieRoster?.some((unit) => unit.id === 'guan-yu' && unit.recommended) ||
|
||||
!changshaSortieState.sortieRoster?.some((unit) => unit.id === 'zhao-yun' && unit.recruited && unit.recommended) ||
|
||||
changshaSortieState.sortieRoster?.some((unit) => unit.id === 'huang-zhong') ||
|
||||
changshaSortieState.sortieRoster?.some((unit) => unit.id === 'wei-yan') ||
|
||||
changshaSortieState.sortieRoster?.length < 11 ||
|
||||
changshaSortieState.sortiePlan?.maxCount !== 6
|
||||
) {
|
||||
throw new Error(`Expected twenty-fifth camp sortie prep to target Changsha with Gong Zhi recommended and Huang Zhong/Wei Yan absent before victory: ${JSON.stringify(changshaSortieState)}`);
|
||||
}
|
||||
assertSortieTacticalRoster(changshaSortieState, [
|
||||
'liu-bei',
|
||||
'guan-yu',
|
||||
'zhang-fei',
|
||||
'jian-yong',
|
||||
'mi-zhu',
|
||||
'sun-qian',
|
||||
'zhao-yun',
|
||||
'zhuge-liang',
|
||||
'ma-liang',
|
||||
'yi-ji',
|
||||
'gong-zhi'
|
||||
]);
|
||||
|
||||
const changshaPriorityUnits = ['gong-zhi', 'yi-ji', 'zhuge-liang', 'guan-yu', 'zhao-yun'];
|
||||
for (const unitId of changshaPriorityUnits) {
|
||||
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' && !changshaPriorityUnits.includes(unit.id)
|
||||
);
|
||||
if (removable) {
|
||||
await clickSortieRosterUnit(page, removable.id);
|
||||
}
|
||||
await clickSortieRosterUnit(page, unitId);
|
||||
}
|
||||
}
|
||||
|
||||
const changshaSortieReadyState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
!changshaPriorityUnits.every((unitId) =>
|
||||
changshaSortieReadyState.sortieRoster?.some((unit) => unit.id === unitId && unit.selected)
|
||||
) ||
|
||||
changshaSortieReadyState.sortiePlan?.selectedCount !== 6 ||
|
||||
changshaSortieReadyState.sortiePlan?.recommendedSelectedCount < 6
|
||||
) {
|
||||
throw new Error(`Expected Changsha sortie to deploy Gong Zhi and the veteran-audience priority officers while preserving six-officer pressure: ${JSON.stringify(changshaSortieReadyState)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-changsha-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-changsha-story.png', fullPage: true });
|
||||
|
||||
for (let i = 0; i < 50; i += 1) {
|
||||
const enteredTwentySixthBattle = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return state?.scene === 'BattleScene' && state?.battleId === 'twenty-sixth-battle-changsha-veteran';
|
||||
});
|
||||
if (enteredTwentySixthBattle) {
|
||||
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 === 'twenty-sixth-battle-changsha-veteran' && state?.battleOutcome === null && state?.phase === 'idle';
|
||||
});
|
||||
await page.screenshot({ path: 'dist/verification-twenty-sixth-battle.png', fullPage: true });
|
||||
|
||||
const twentySixthBattleState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
const twentySixthEnemies = twentySixthBattleState.units.filter((unit) => unit.faction === 'enemy');
|
||||
const twentySixthAllies = twentySixthBattleState.units.filter((unit) => unit.faction === 'ally');
|
||||
const twentySixthEnemyBehaviors = new Set(twentySixthEnemies.map((unit) => unit.ai));
|
||||
if (
|
||||
twentySixthBattleState.camera?.mapWidth !== 52 ||
|
||||
twentySixthBattleState.camera?.mapHeight !== 34 ||
|
||||
twentySixthBattleState.victoryConditionLabel !== '한현 퇴각' ||
|
||||
twentySixthEnemies.length < 18 ||
|
||||
!twentySixthEnemyBehaviors.has('aggressive') ||
|
||||
!twentySixthEnemyBehaviors.has('guard') ||
|
||||
!twentySixthEnemyBehaviors.has('hold') ||
|
||||
!twentySixthEnemies.some((unit) => unit.id === 'changsha-leader-han-xuan') ||
|
||||
!twentySixthEnemies.some((unit) => unit.id === 'changsha-veteran-huang-zhong') ||
|
||||
!twentySixthEnemies.some((unit) => unit.id === 'changsha-officer-wei-yan') ||
|
||||
!twentySixthAllies.some((unit) => unit.id === 'gong-zhi') ||
|
||||
!twentySixthAllies.some((unit) => unit.id === 'yi-ji') ||
|
||||
twentySixthAllies.some((unit) => unit.id === 'huang-zhong') ||
|
||||
twentySixthAllies.some((unit) => unit.id === 'wei-yan')
|
||||
) {
|
||||
throw new Error(`Expected twenty-sixth battle to use Changsha map, Han Xuan objective, Huang Zhong/Wei Yan as enemy officers, mixed AI, and no Changsha recruits before victory: ${JSON.stringify(twentySixthBattleState)}`);
|
||||
}
|
||||
|
||||
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 twentySixthCampState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
twentySixthCampState?.campBattleId !== 'twenty-sixth-battle-changsha-veteran' ||
|
||||
twentySixthCampState.campTitle !== '장사 노장 대면 후 군영' ||
|
||||
twentySixthCampState.availableDialogueIds?.length !== 4 ||
|
||||
!twentySixthCampState.availableDialogueIds.every((id) => id.endsWith('changsha')) ||
|
||||
twentySixthCampState.availableVisitIds?.length !== 2 ||
|
||||
!twentySixthCampState.campaign?.roster?.some((unit) => unit.id === 'huang-zhong') ||
|
||||
!twentySixthCampState.campaign?.roster?.some((unit) => unit.id === 'wei-yan') ||
|
||||
!twentySixthCampState.sortieRoster?.some((unit) => unit.id === 'huang-zhong' && unit.recruited) ||
|
||||
!twentySixthCampState.sortieRoster?.some((unit) => unit.id === 'wei-yan' && unit.recruited) ||
|
||||
twentySixthCampState.rosterCollection?.total < 13
|
||||
) {
|
||||
throw new Error(`Expected twenty-sixth camp to recruit Huang Zhong and Wei Yan and expose Changsha dialogue/visit sets: ${JSON.stringify(twentySixthCampState)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-changsha-camp.png', fullPage: true });
|
||||
|
||||
await page.mouse.click(966, 38);
|
||||
await page.waitForTimeout(180);
|
||||
const postChangshaProgressState = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
if (
|
||||
postChangshaProgressState?.activeTab !== 'progress' ||
|
||||
postChangshaProgressState.campaignProgress?.completedKnown !== 26 ||
|
||||
postChangshaProgressState.campaignProgress?.totalKnown !== 26 ||
|
||||
postChangshaProgressState.campaignProgress?.activeChapter?.title !== '형주·익주 확보' ||
|
||||
postChangshaProgressState.campaignProgress?.latestBattleTitle !== '장사 노장 대면전' ||
|
||||
postChangshaProgressState.campaignProgress?.nextBattleTitle !== '준비 중'
|
||||
) {
|
||||
throw new Error(`Expected post-Changsha progress tab to complete the veteran-audience battle and pause on Yi Province preparation: ${JSON.stringify(postChangshaProgressState?.campaignProgress)}`);
|
||||
}
|
||||
await page.screenshot({ path: 'dist/verification-post-changsha-progress.png', fullPage: true });
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
@@ -2892,7 +3041,7 @@ try {
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
console.log(`Verified title-to-twenty-fifth-battle flow, recruited officer sortie selection, Ma Liang, Yi Ji, and Gong Zhi joins, result states, and debug API at ${targetUrl}`);
|
||||
console.log(`Verified title-to-twenty-sixth-battle flow, recruited officer sortie selection, Ma Liang, Yi Ji, Gong Zhi, Huang Zhong, and Wei Yan joins, result states, and debug API at ${targetUrl}`);
|
||||
} finally {
|
||||
await browser?.close();
|
||||
if (serverProcess && !serverProcess.killed) {
|
||||
|
||||
Reference in New Issue
Block a user