Prepare battle scenario progression foundations
This commit is contained in:
@@ -76,6 +76,10 @@ try {
|
||||
throw new Error(`Debug battle state was not available: ${JSON.stringify(result.battleState)}`);
|
||||
}
|
||||
|
||||
if (result.battleState.battleId !== 'first-battle-zhuo-commandery') {
|
||||
throw new Error(`Expected first battle scenario id: ${JSON.stringify(result.battleState)}`);
|
||||
}
|
||||
|
||||
const actionTexturesLoaded = await page.evaluate(() => {
|
||||
const textures = window.__HEROS_GAME__?.textures;
|
||||
return [
|
||||
@@ -170,12 +174,33 @@ try {
|
||||
if (
|
||||
!campaignSaveAfterDialogue ||
|
||||
campaignSaveAfterDialogue.step !== 'first-camp' ||
|
||||
campaignSaveAfterDialogue.latestBattleId !== 'first-battle-zhuo-commandery' ||
|
||||
!campaignSaveAfterDialogue.battleHistory?.['first-battle-zhuo-commandery'] ||
|
||||
!campaignSaveAfterDialogue.completedCampDialogues?.length ||
|
||||
Object.keys(campaignSaveAfterDialogue.inventory ?? {}).length === 0
|
||||
) {
|
||||
throw new Error(`Expected campaign save to persist camp progress: ${JSON.stringify(campaignSaveAfterDialogue)}`);
|
||||
}
|
||||
|
||||
const campaignSlotAfterDialogue = await page.evaluate(() => {
|
||||
const raw = window.localStorage.getItem('heros-web:campaign-state:slot-1');
|
||||
return raw ? JSON.parse(raw) : undefined;
|
||||
});
|
||||
if (!campaignSlotAfterDialogue || campaignSlotAfterDialogue.latestBattleId !== 'first-battle-zhuo-commandery') {
|
||||
throw new Error(`Expected campaign slot 1 to persist progress: ${JSON.stringify(campaignSlotAfterDialogue)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_GAME__?.scene.start('TitleScene'));
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
return activeScenes.includes('TitleScene');
|
||||
});
|
||||
await page.mouse.click(962, 310);
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
return activeScenes.includes('CampScene');
|
||||
});
|
||||
|
||||
await page.evaluate(() => window.__HEROS_DEBUG__?.goToBattle());
|
||||
await page.waitForFunction(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
|
||||
Reference in New Issue
Block a user