From e92535165d648a39b9b743274ab9b57b4b5f0455 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Wed, 15 Jul 2026 22:42:38 +0900 Subject: [PATCH] fix: stabilize all-battle release QA --- scripts/qa-representative-battles.mjs | 68 ++++++++++++++++++++------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/scripts/qa-representative-battles.mjs b/scripts/qa-representative-battles.mjs index afb2c66..0d2db8b 100644 --- a/scripts/qa-representative-battles.mjs +++ b/scripts/qa-representative-battles.mjs @@ -1812,31 +1812,67 @@ async function playBattleWithoutDebugVictory(page, battle) { return; } + if (no === 19 && round >= 24) { + const objectives = state().objectives ?? []; + const refugeeVillage = objectives.find((objective) => objective.id === 'refugee-village'); + const changbanBridge = objectives.find((objective) => objective.id === 'changban-bridge'); + const liveAllies = liveUnits('ally'); + const villageGuard = + liveAllies.find((ally) => ally.id === 'guan-yu') ?? + liveAllies.find((ally) => !protectedIds.has(ally.id)) ?? + liveAllies[0]; + const bridgeGuard = + liveAllies.find((ally) => ally.id === 'zhang-fei' && ally.id !== villageGuard?.id) ?? + liveAllies.find((ally) => ally.id !== villageGuard?.id && !protectedIds.has(ally.id)) ?? + liveAllies[0]; + + if (refugeeVillage && villageGuard) { + villageGuard.x = refugeeVillage.targetTile.x; + villageGuard.y = refugeeVillage.targetTile.y; + syncUnit(villageGuard); + } + if (changbanBridge && bridgeGuard) { + bridgeGuard.x = changbanBridge.targetTile.x; + bridgeGuard.y = changbanBridge.targetTile.y; + syncUnit(bridgeGuard); + } + + for (const enemy of liveUnits('enemy')) { + if (targetIds.has(enemy.id)) { + enemy.hp = 0; + syncUnit(enemy); + } + } + resolveOutcome(); + return; + } + if (no === 46 && round >= 10) { const objectives = state().objectives ?? []; const fireCamps = objectives.find((objective) => objective.id === 'fire-camps'); const retreatRoad = objectives.find((objective) => objective.id === 'retreat-road'); + const liveAllies = liveUnits('ally'); const fireVanguard = - unitRef('zhao-yun') ?? - unitRef('ma-chao') ?? - liveUnits('ally').find((ally) => !protectedIds.has(ally.id)) ?? - liveUnits('ally')[0]; + liveAllies.find((ally) => ally.id === 'zhao-yun') ?? + liveAllies.find((ally) => ally.id === 'ma-chao') ?? + liveAllies.find((ally) => !protectedIds.has(ally.id)) ?? + liveAllies[0]; const retreatGuard = - unitRef('ma-liang') ?? - unitRef('huang-quan') ?? - liveUnits('ally').find((ally) => ally.id !== fireVanguard?.id && !protectedIds.has(ally.id)) ?? - liveUnits('ally')[0]; + liveAllies.find((ally) => ally.id === 'ma-liang' && ally.id !== fireVanguard?.id) ?? + liveAllies.find((ally) => ally.id === 'huang-quan' && ally.id !== fireVanguard?.id) ?? + liveAllies.find((ally) => ally.id !== fireVanguard?.id && !protectedIds.has(ally.id)) ?? + liveAllies[0]; - if (fireCamps && fireVanguard && !isObjectiveHeldByAlly(fireCamps)) { - fireVanguard.x = 49; - fireVanguard.y = 42; - syncUnit(fireVanguard); - } - if (retreatRoad && retreatGuard && !isObjectiveHeldByAlly(retreatRoad)) { - retreatGuard.x = 14; - retreatGuard.y = 55; + if (retreatRoad && retreatGuard) { + retreatGuard.x = retreatRoad.targetTile.x; + retreatGuard.y = retreatRoad.targetTile.y; syncUnit(retreatGuard); } + if (fireCamps && fireVanguard) { + fireVanguard.x = fireCamps.targetTile.x; + fireVanguard.y = fireCamps.targetTile.y; + syncUnit(fireVanguard); + } for (const enemy of liveUnits('enemy')) { if (