Improve combat UX and story assets
This commit is contained in:
@@ -189,6 +189,93 @@ try {
|
||||
throw new Error(`Expected enemy threat markers from map menu: ${JSON.stringify(threatState)}`);
|
||||
}
|
||||
|
||||
const visibleEnemyScreen = await page.evaluate(() => {
|
||||
const scene = window.__HEROS_GAME__?.scene.getScene('BattleScene');
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
const enemy = state?.units?.find((unit) => unit.faction === 'enemy' && unit.hp > 0);
|
||||
|
||||
if (!scene || !enemy) {
|
||||
throw new Error('Expected enemy and battle scene for enemy threat click test.');
|
||||
}
|
||||
|
||||
scene.centerCameraOnTile(enemy.x, enemy.y);
|
||||
return {
|
||||
x: scene.tileCenterX(enemy.x),
|
||||
y: scene.tileCenterY(enemy.y)
|
||||
};
|
||||
});
|
||||
await page.waitForTimeout(120);
|
||||
await page.mouse.click(visibleEnemyScreen.x, visibleEnemyScreen.y);
|
||||
await page.waitForTimeout(180);
|
||||
|
||||
const clickedEnemyThreatState = await page.evaluate(() => window.__HEROS_DEBUG__?.battle());
|
||||
if (
|
||||
!clickedEnemyThreatState?.enemyMoveMarkerCount ||
|
||||
clickedEnemyThreatState.enemyMoveMarkerCount <= 0 ||
|
||||
!clickedEnemyThreatState.threatMarkerCount ||
|
||||
clickedEnemyThreatState.threatMarkerCount <= 0
|
||||
) {
|
||||
throw new Error(`Expected clicked enemy movement and attack markers: ${JSON.stringify(clickedEnemyThreatState)}`);
|
||||
}
|
||||
|
||||
const combatMechanicsProbe = clickedEnemyThreatState.combatMechanicsProbe;
|
||||
if (
|
||||
!combatMechanicsProbe ||
|
||||
combatMechanicsProbe.adjacentBondDamageBonus <= 0 ||
|
||||
combatMechanicsProbe.sameTargetBondDamageBonus <= 0 ||
|
||||
combatMechanicsProbe.farBondDamageBonus !== 0 ||
|
||||
combatMechanicsProbe.counterDamage >= combatMechanicsProbe.normalDamage
|
||||
) {
|
||||
throw new Error(`Expected positional bond bonuses and reduced counter damage: ${JSON.stringify(combatMechanicsProbe)}`);
|
||||
}
|
||||
|
||||
const moveWaitTurnPromptState = await page.evaluate(() => {
|
||||
const scene = window.__HEROS_GAME__?.scene.getScene('BattleScene');
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
const lastAlly = state?.units?.find((unit) => unit.id === 'zhang-fei');
|
||||
|
||||
if (!scene || !state || !lastAlly) {
|
||||
throw new Error('Expected Zhang Fei and battle scene for move-wait turn prompt test.');
|
||||
}
|
||||
|
||||
scene.hideTurnEndPrompt();
|
||||
scene.clearMarkers();
|
||||
scene.hideCommandMenu();
|
||||
scene.actedUnitIds = new Set(state.units.filter((unit) => unit.faction === 'ally' && unit.hp > 0 && unit.id !== lastAlly.id).map((unit) => unit.id));
|
||||
scene.phase = 'idle';
|
||||
scene.selectedUnit = undefined;
|
||||
scene.pendingMove = undefined;
|
||||
|
||||
const liveLastAlly = scene.debugUnitById(lastAlly.id);
|
||||
if (!liveLastAlly) {
|
||||
throw new Error('Expected live Zhang Fei unit for move-wait turn prompt test.');
|
||||
}
|
||||
|
||||
scene.selectUnit(liveLastAlly);
|
||||
scene.moveSelectedUnit(liveLastAlly.x, liveLastAlly.y);
|
||||
scene.completeUnitAction(liveLastAlly, 'wait');
|
||||
return window.__HEROS_DEBUG__?.battle();
|
||||
});
|
||||
if (!moveWaitTurnPromptState?.turnPromptVisible || moveWaitTurnPromptState.phase !== 'idle') {
|
||||
throw new Error(`Expected move-wait completion to show turn-end prompt: ${JSON.stringify(moveWaitTurnPromptState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => {
|
||||
const scene = window.__HEROS_GAME__?.scene.getScene('BattleScene');
|
||||
if (!scene) {
|
||||
return;
|
||||
}
|
||||
scene.actedUnitIds.clear();
|
||||
scene.selectedUnit = undefined;
|
||||
scene.pendingMove = undefined;
|
||||
scene.targetingAction = undefined;
|
||||
scene.selectedUsable = undefined;
|
||||
scene.phase = 'idle';
|
||||
scene.clearMarkers();
|
||||
scene.hideCommandMenu();
|
||||
scene.hideTurnEndPrompt();
|
||||
});
|
||||
|
||||
await page.mouse.click(260, 300, { button: 'right' });
|
||||
await page.waitForTimeout(120);
|
||||
await page.mouse.click(182, 230);
|
||||
@@ -407,12 +494,15 @@ try {
|
||||
if (
|
||||
secondBattleState.camera?.mapWidth !== 24 ||
|
||||
secondBattleState.camera?.mapHeight !== 20 ||
|
||||
secondBattleState.mapTextureKey !== 'battle-map-second' ||
|
||||
!secondBattleState.mapTextureReady ||
|
||||
!secondBattleState.mapBackgroundReady ||
|
||||
secondEnemies.length < 10 ||
|
||||
!secondEnemyBehaviors.has('aggressive') ||
|
||||
!secondEnemyBehaviors.has('guard') ||
|
||||
!secondEnemyBehaviors.has('hold')
|
||||
) {
|
||||
throw new Error(`Expected expanded second battle map and mixed enemy AI: ${JSON.stringify(secondBattleState)}`);
|
||||
throw new Error(`Expected loaded expanded second battle map and mixed enemy AI: ${JSON.stringify(secondBattleState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_DEBUG__?.forceBattleOutcome('victory'));
|
||||
@@ -1830,12 +1920,11 @@ try {
|
||||
!eighteenthEnemyBehaviors.has('hold') ||
|
||||
!eighteenthEnemies.some((unit) => unit.id === 'bowang-leader-xiahou-dun') ||
|
||||
!eighteenthAllies.some((unit) => unit.id === 'zhuge-liang') ||
|
||||
!treasureLabels.has('자웅일대검 공명') ||
|
||||
(!treasureLabels.has('청룡언월도 무력 우위') && !treasureLabels.has('청룡언월도 대도')) ||
|
||||
!treasureLabels.has('장팔사모 치명') ||
|
||||
!treasureLabels.has('백우선 책략')
|
||||
) {
|
||||
throw new Error(`Expected eighteenth battle to use Bowang map, Xiahou Dun objective, mixed AI, deployed Zhuge Liang, and treasure equipment effects: ${JSON.stringify(eighteenthBattleState)}`);
|
||||
throw new Error(`Expected eighteenth battle to use Bowang map, Xiahou Dun objective, mixed AI, deployed Zhuge Liang, and non-positional treasure equipment effects: ${JSON.stringify(eighteenthBattleState)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_DEBUG__?.forceBattleOutcome('victory'));
|
||||
|
||||
Reference in New Issue
Block a user