merge: 첫 모병 예약 후방 발령 교정을 반영한다

This commit is contained in:
2026-08-22 04:51:59 +00:00
3 changed files with 16 additions and 7 deletions
@@ -677,6 +677,14 @@ export class GeneralAI {
return this.reservedTurnProvider.getGeneralTurn(generalId, 0);
}
hasFirstReservedGeneralRecruitmentTurn(generalId: number): boolean {
const action = this.getFirstReservedGeneralTurn(generalId).action;
// Ref checks `instanceof che_징병`; che_모병 inherits che_징병 there.
// Core persists the concrete command key, so preserve that subtype
// relationship explicitly at the serialized reserved-turn boundary.
return action === 'che_징병' || action === 'che_모병';
}
resolveGeneralAiStats(general: TurnGeneral): ReturnType<typeof resolveLegacyAiStats> {
if (this.commandEnv.generalActionModules) {
return resolveLegacyAiStatsWithModules(
@@ -55,8 +55,7 @@ export const do부대유저장후방발령 = (ai: GeneralAI) => {
if (!isGeneralTurnBefore(general, troopLeader)) {
return false;
}
const reserved = ai.getFirstReservedGeneralTurn(general.id);
if (reserved.action !== 'che_징병') {
if (!ai.hasFirstReservedGeneralRecruitmentTurn(general.id)) {
return false;
}
return true;
@@ -1435,11 +1435,13 @@ describe('legacy NPC AI final-decision parity', () => {
return { result: do부대유저장후방발령(ai), rng };
};
expect(run({ reservedAction: 'che_징병', userTurnTick: 100, leaderTurnTick: 200 }).result).toMatchObject({
action: 'che_발령',
args: { destGeneralId: 2, destCityId: 3 },
});
expect(run({ reservedAction: 'che_모병', userTurnTick: 100, leaderTurnTick: 200 }).result).toBeNull();
for (const reservedAction of ['che_징병', 'che_모병']) {
expect(run({ reservedAction, userTurnTick: 100, leaderTurnTick: 200 }).result).toMatchObject({
action: 'che_발령',
args: { destGeneralId: 2, destCityId: 3 },
});
}
expect(run({ reservedAction: 'che_훈련', userTurnTick: 100, leaderTurnTick: 200 }).result).toBeNull();
expect(run({ reservedAction: 'che_징병', userTurnTick: 200, leaderTurnTick: 100 }).result).toBeNull();
expect(
run({ reservedAction: 'che_징병', userTurnTick: 100, leaderTurnTick: 200, recruitmentScore: 0 }).result