diff --git a/scripts/qa-representative-battles.mjs b/scripts/qa-representative-battles.mjs index cc2a699..4fd1686 100644 --- a/scripts/qa-representative-battles.mjs +++ b/scripts/qa-representative-battles.mjs @@ -1617,6 +1617,12 @@ async function playBattleWithoutDebugVictory(page, battle) { (!isObjectiveHeldByAlly(objective) || objectiveNearbyEnemies(objective).some((nearbyEnemy) => !nearbyEnemy.id.includes('leader'))) ); }; + const secureObjectivesSatisfied = () => { + const objectives = (state().objectives ?? []).filter((objective) => { + return objective.category === 'bonus' && objective.id !== 'quick' && objective.targetTile; + }); + return objectives.length > 0 && objectives.every((objective) => objective.achieved || isObjectiveHeldByAlly(objective)); + }; function withUnitAt(unit, tile, callback) { const original = { x: unit.x, y: unit.y }; @@ -1810,6 +1816,9 @@ async function playBattleWithoutDebugVictory(page, battle) { if (protectedIds.size > 1 && !isLeaderTarget) { return unit.hp >= Math.ceil(unit.maxHp * 0.75) && threat <= Math.floor(unit.hp * 0.22); } + if (no === 32 && isLeaderTarget && secureObjectivesSatisfied()) { + return unit.hp >= Math.ceil(unit.maxHp * 0.45) && threat <= Math.floor(unit.hp * 0.7); + } if (isLeaderTarget && (pressProtected || kill) && threat <= Math.floor(unit.hp * (pressProtected ? 0.7 : 0.42))) { return true; } @@ -1917,6 +1926,10 @@ async function playBattleWithoutDebugVictory(page, battle) { if (!outerVillageDone) { return { x: 46, y: 27 }; } + const leaderDone = (state().objectives ?? []).find((objective) => objective.id === 'leader')?.achieved; + if (!leaderDone && secureObjectivesSatisfied()) { + return { x: 60, y: 18 }; + } } return undefined; } @@ -1940,7 +1953,8 @@ async function playBattleWithoutDebugVictory(page, battle) { function advancePointTile(unit, tiles) { const point = scenarioAdvancePoint(unit); - if (!point || (protectedIds.has(unit.id) && !isLastProtectedFighter(unit))) { + const protectedScenarioPush = no === 32 && secureObjectivesSatisfied(); + if (!point || (protectedIds.has(unit.id) && !isLastProtectedFighter(unit) && !protectedScenarioPush)) { return undefined; } const currentDistance = distance(unit, point);