Stabilize early campaign objective QA

This commit is contained in:
2026-07-06 00:13:03 +09:00
parent aef9fb5d31
commit e254405752
4 changed files with 64 additions and 60 deletions

View File

@@ -81,7 +81,7 @@ const earlyCampaignBattles = [
no: 2,
id: 'second-battle-yellow-turban-pursuit',
selected: coreBrothers,
targets: ['pursuit-leader-han-seok'],
targets: ['pursuit-guard-a', 'pursuit-leader-han-seok'],
protected: ['liu-bei']
},
{
@@ -109,7 +109,7 @@ const earlyCampaignBattles = [
no: 6,
id: 'sixth-battle-jieqiao-relief',
selected: coreBrothers,
targets: ['jieqiao-leader-qu-yi'],
targets: ['jieqiao-guard-a', 'jieqiao-archer-c', 'jieqiao-leader-qu-yi'],
protected: ['liu-bei']
},
{
@@ -1211,11 +1211,15 @@ async function playBattleWithoutDebugVictory(page, battle) {
function canTakeAttack(unit, attack, threat = protectedIds.has(unit.id) ? incomingThreat(unit, unit) : 0) {
if (!protectedIds.has(unit.id)) {
const kill = attack.preview.damage >= attack.target.hp;
const hpRate = unit.hp / Math.max(1, unit.maxHp);
if (unit.hp <= Math.ceil(unit.maxHp * 0.35)) {
return kill && threat <= Math.floor(unit.hp * 0.4);
return kill && threat <= Math.floor(unit.hp * 0.35);
}
if (unit.hp <= Math.ceil(unit.maxHp * 0.55)) {
return kill || threat <= Math.floor(unit.hp * 0.5);
if (hpRate <= 0.55) {
return threat <= Math.floor(unit.hp * 0.55) && (kill || attack.preview.damage >= Math.ceil(attack.target.hp * 0.35));
}
if (hpRate <= 0.75) {
return threat <= Math.floor(unit.hp * (kill ? 0.75 : 0.45));
}
return true;
}
@@ -1260,7 +1264,7 @@ async function playBattleWithoutDebugVictory(page, battle) {
.map((tile) =>
withUnitAt(unit, tile, () => {
const attack = attackChoice(unit);
const needsThreatCheck = protectedIds.has(unit.id) || unit.hp <= Math.ceil(unit.maxHp * 0.55);
const needsThreatCheck = protectedIds.has(unit.id) || unit.hp <= Math.ceil(unit.maxHp * 0.75);
return attack ? { tile, attack, threat: needsThreatCheck ? incomingThreat(unit, tile) : 0 } : undefined;
})
)
@@ -1307,7 +1311,7 @@ async function playBattleWithoutDebugVictory(page, battle) {
const focus = attack?.target ?? focusTarget(unit);
const isProtected = protectedIds.has(unit.id);
const shouldPress = isProtected && shouldPressProtected(unit);
const needsThreatCheck = isProtected || unit.hp <= Math.ceil(unit.maxHp * 0.55);
const needsThreatCheck = isProtected || unit.hp <= Math.ceil(unit.maxHp * 0.75);
const threat = needsThreatCheck ? incomingThreat(unit, tile) : 0;
const canUseAttack = attack && (!isProtected || canTakeAttack(unit, attack, threat));
const approach = focus ? -distance(unit, focus) * (isProtected ? (shouldPress ? 42 : 5) : 36) : 0;