Expand first battle map and camera controls
This commit is contained in:
@@ -74,6 +74,33 @@ try {
|
||||
throw new Error(`Debug battle state was not available: ${JSON.stringify(result.battleState)}`);
|
||||
}
|
||||
|
||||
const cameraBeforeScroll = result.battleState.camera;
|
||||
if (
|
||||
!cameraBeforeScroll ||
|
||||
cameraBeforeScroll.mapWidth <= cameraBeforeScroll.visibleColumns ||
|
||||
cameraBeforeScroll.mapHeight <= cameraBeforeScroll.visibleRows
|
||||
) {
|
||||
throw new Error(`Expected a scrollable battle map: ${JSON.stringify(cameraBeforeScroll)}`);
|
||||
}
|
||||
|
||||
await page.mouse.move(768, 360);
|
||||
await page.waitForTimeout(520);
|
||||
const cameraAfterEdgeScroll = await page.evaluate(() => window.__HEROS_DEBUG__?.battle()?.camera);
|
||||
if (!cameraAfterEdgeScroll || cameraAfterEdgeScroll.x <= cameraBeforeScroll.x) {
|
||||
throw new Error(`Expected edge scrolling to move camera right: ${JSON.stringify({ cameraBeforeScroll, cameraAfterEdgeScroll })}`);
|
||||
}
|
||||
|
||||
await page.mouse.click(1138, 553);
|
||||
await page.waitForTimeout(160);
|
||||
const cameraAfterMiniMapClick = await page.evaluate(() => window.__HEROS_DEBUG__?.battle()?.camera);
|
||||
if (
|
||||
!cameraAfterMiniMapClick ||
|
||||
cameraAfterMiniMapClick.x < cameraAfterMiniMapClick.mapWidth - cameraAfterMiniMapClick.visibleColumns ||
|
||||
cameraAfterMiniMapClick.y !== 0
|
||||
) {
|
||||
throw new Error(`Expected minimap click to move camera to the northeast: ${JSON.stringify(cameraAfterMiniMapClick)}`);
|
||||
}
|
||||
|
||||
const readyUnits = result.battleState.units.filter((unit) => !unit.acted);
|
||||
if (!readyUnits.some((unit) => unit.animating && unit.animationKey?.includes('-idle-'))) {
|
||||
throw new Error(`Expected ready units to loop idle frames: ${JSON.stringify(readyUnits)}`);
|
||||
|
||||
Reference in New Issue
Block a user