Make camp supplies usable
This commit is contained in:
@@ -203,6 +203,35 @@ try {
|
||||
throw new Error(`Expected CampScene report after victory: ${JSON.stringify(campState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => {
|
||||
const campScene = window.__HEROS_GAME__?.scene.getScene('CampScene');
|
||||
const liuBei = campScene?.campaign?.roster?.find((unit) => unit.id === 'liu-bei');
|
||||
if (!liuBei) {
|
||||
throw new Error('Expected Liu Bei in camp roster before supply verification.');
|
||||
}
|
||||
liuBei.hp = Math.max(1, liuBei.maxHp - 10);
|
||||
campScene.report?.units?.forEach((unit) => {
|
||||
if (unit.id === 'liu-bei') {
|
||||
unit.hp = liuBei.hp;
|
||||
}
|
||||
});
|
||||
campScene.render();
|
||||
});
|
||||
await page.mouse.click(918, 38);
|
||||
await page.waitForTimeout(160);
|
||||
await page.screenshot({ path: 'dist/verification-camp-supplies.png', fullPage: true });
|
||||
await page.mouse.click(1120, 245);
|
||||
await page.waitForTimeout(260);
|
||||
|
||||
const campStateAfterSupply = await page.evaluate(() => window.__HEROS_DEBUG__?.camp());
|
||||
const liuBeiAfterSupply = campStateAfterSupply?.campaign?.roster?.find((unit) => unit.id === 'liu-bei');
|
||||
if (!liuBeiAfterSupply || liuBeiAfterSupply.hp !== liuBeiAfterSupply.maxHp) {
|
||||
throw new Error(`Expected bean supply to recover Liu Bei: ${JSON.stringify(campStateAfterSupply)}`);
|
||||
}
|
||||
if ((campStateAfterSupply.campaign?.inventory?.['콩'] ?? 0) !== 0) {
|
||||
throw new Error(`Expected bean supply to be consumed: ${JSON.stringify(campStateAfterSupply.campaign?.inventory)}`);
|
||||
}
|
||||
|
||||
await page.mouse.click(830, 38);
|
||||
await page.waitForTimeout(120);
|
||||
await page.mouse.click(974, 482);
|
||||
|
||||
Reference in New Issue
Block a user