feat: add tactical command officer cut-ins
This commit is contained in:
@@ -2613,17 +2613,88 @@ async function activateSortieOrderCommand(page, role) {
|
||||
await page.mouse.click(rolePoint.x, rolePoint.y);
|
||||
await page.waitForFunction(
|
||||
(expectedRole) => {
|
||||
const order = window.__HEROS_DEBUG__?.battle()?.sortieOperationOrder;
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
const order = state?.sortieOperationOrder;
|
||||
return (
|
||||
order?.commandPanelOpen === false &&
|
||||
order?.live?.commandUsed === true &&
|
||||
order?.live?.command?.role === expectedRole
|
||||
order?.live?.command?.role === expectedRole &&
|
||||
state?.tacticalInitiative?.cutIn?.active === true
|
||||
);
|
||||
},
|
||||
role,
|
||||
{ timeout: 30000 }
|
||||
);
|
||||
return page.evaluate(() => window.__HEROS_DEBUG__?.battle()?.sortieOperationOrder);
|
||||
await page.waitForTimeout(180);
|
||||
|
||||
const activeCutInProbe = await page.evaluate(() => {
|
||||
const scene = window.__HEROS_GAME__?.scene.getScene('BattleScene');
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return {
|
||||
cutIn: state?.tacticalInitiative?.cutIn ?? null,
|
||||
command: state?.sortieOperationOrder?.live?.command ?? null,
|
||||
sceneBounds: scene
|
||||
? { x: 0, y: 0, width: scene.scale.width, height: scene.scale.height }
|
||||
: null
|
||||
};
|
||||
});
|
||||
assert(
|
||||
activeCutInProbe.cutIn?.active === true &&
|
||||
activeCutInProbe.cutIn.count === 1 &&
|
||||
activeCutInProbe.cutIn.last?.source === 'sortie-order' &&
|
||||
activeCutInProbe.cutIn.last?.role === role &&
|
||||
typeof activeCutInProbe.cutIn.last?.actorId === 'string' &&
|
||||
activeCutInProbe.cutIn.last.actorId.length > 0 &&
|
||||
activeCutInProbe.cutIn.last.actorId === activeCutInProbe.command?.actorId &&
|
||||
activeCutInProbe.cutIn.last?.label === '\uC7AC\uC815\uBE44' &&
|
||||
isFiniteBounds(activeCutInProbe.cutIn.bounds) &&
|
||||
isFiniteBounds(activeCutInProbe.cutIn.last?.bounds) &&
|
||||
isFiniteBounds(activeCutInProbe.sceneBounds) &&
|
||||
boundsInside(activeCutInProbe.cutIn.bounds, activeCutInProbe.sceneBounds) &&
|
||||
boundsInside(activeCutInProbe.cutIn.last.bounds, activeCutInProbe.sceneBounds),
|
||||
`Expected the selected order command to show one bounded in-scene cut-in with its source, role, actor, and label: ${JSON.stringify(activeCutInProbe)}`
|
||||
);
|
||||
await page.screenshot({ path: `${screenshotDir}/rc-first-battle-order-command-cutin.png`, fullPage: true });
|
||||
await assertCanvasPainted(page, 'first battle order command cut-in');
|
||||
|
||||
await page.waitForFunction(
|
||||
(expectedRole) => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
const order = state?.sortieOperationOrder;
|
||||
const cutIn = state?.tacticalInitiative?.cutIn;
|
||||
return (
|
||||
cutIn?.active === false &&
|
||||
cutIn.count === 1 &&
|
||||
cutIn.last?.source === 'sortie-order' &&
|
||||
cutIn.last?.role === expectedRole &&
|
||||
order?.live?.command?.role === expectedRole &&
|
||||
order.live.command.effectPending === false &&
|
||||
order.live.command.effectValue > 0
|
||||
);
|
||||
},
|
||||
role,
|
||||
{ timeout: 30000 }
|
||||
);
|
||||
const settledProbe = await page.evaluate(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
return {
|
||||
order: state?.sortieOperationOrder ?? null,
|
||||
cutIn: state?.tacticalInitiative?.cutIn ?? null
|
||||
};
|
||||
});
|
||||
assert(
|
||||
settledProbe.cutIn?.active === false &&
|
||||
settledProbe.cutIn.count === 1 &&
|
||||
settledProbe.cutIn.last?.source === 'sortie-order' &&
|
||||
settledProbe.cutIn.last?.role === role &&
|
||||
settledProbe.cutIn.last?.actorId === settledProbe.order?.live?.command?.actorId &&
|
||||
settledProbe.cutIn.last?.label === '\uC7AC\uC815\uBE44' &&
|
||||
isFiniteBounds(settledProbe.cutIn.last?.bounds) &&
|
||||
settledProbe.order?.live?.command?.effectPending === false &&
|
||||
settledProbe.order?.live?.command?.effectValue > 0,
|
||||
`Expected the cut-in to finish once while retaining its last payload before resolving the support effect: ${JSON.stringify(settledProbe)}`
|
||||
);
|
||||
return settledProbe.order;
|
||||
}
|
||||
|
||||
async function readBattleOrderCommandControlPoint(page, control, role) {
|
||||
|
||||
Reference in New Issue
Block a user