fix: 첫 모병 예약도 후방 발령에 반영한다
Ref의 che_모병 extends che_징병 상속 의미를 예약턴 문자열 경계에서 복원하고 두 명령을 함께 회귀한다.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user