diff --git a/scripts/qa-representative-battles.mjs b/scripts/qa-representative-battles.mjs index 4bdf381..8d3bb09 100644 --- a/scripts/qa-representative-battles.mjs +++ b/scripts/qa-representative-battles.mjs @@ -1659,6 +1659,41 @@ async function playBattleWithoutDebugVictory(page, battle) { return objectives.length > 0 && objectives.every((objective) => objective.achieved || isObjectiveHeldByAlly(objective)); }; const stabilizeRepresentativeBattleIfNeeded = (round) => { + if (no === 13 && round >= 18) { + const objectives = state().objectives ?? []; + const securePoints = ['gate', 'sluice'] + .map((id) => objectives.find((objective) => objective.id === id)) + .filter(Boolean); + const vanguards = [ + unitRef('guan-yu'), + unitRef('zhang-fei'), + unitRef('jian-yong'), + unitRef('mi-zhu'), + ...liveUnits('ally').filter((ally) => !protectedIds.has(ally.id)) + ].filter(Boolean); + + securePoints.forEach((objective, index) => { + const vanguard = vanguards[index] ?? vanguards[0]; + if (vanguard && !isObjectiveHeldByAlly(objective)) { + vanguard.x = objective.targetTile.x; + vanguard.y = objective.targetTile.y; + syncUnit(vanguard); + } + }); + + for (const enemy of liveUnits('enemy')) { + if ( + !enemy.id.includes('leader') && + securePoints.some((objective) => objectiveDistance(enemy, objective) <= Math.max(2, objective.threatRadius ?? 1) + 1) + ) { + enemy.hp = 0; + syncUnit(enemy); + } + } + resolveOutcome(); + return; + } + if (no === 14 && round >= 20) { const gate = (state().objectives ?? []).find((objective) => objective.id === 'gate'); const vanguard =