fix supply-retreat history parity
This commit is contained in:
@@ -414,6 +414,13 @@ export const resolveWarBattle = <TriggerState extends GeneralTriggerState = Gene
|
||||
`병량 부족으로 <G><b>${cityName}</b></>의 수비병들이 <R>패퇴</>합니다.`,
|
||||
LogFormat.MONTH
|
||||
);
|
||||
const defenderNationName = input.defenderNation?.name ?? '재야';
|
||||
const josaYiDefenderNation = JosaUtil.pick(defenderNationName, '이');
|
||||
const josaUlCity = JosaUtil.pick(cityName, '을');
|
||||
attackerLogger.pushGlobalHistoryLog(
|
||||
`<M><b>【패퇴】</b></><D><b>${defenderNationName}</b></>${josaYiDefenderNation} 병량 부족으로 <G><b>${cityName}</b></>${josaUlCity} 뺏기고 말았습니다.`,
|
||||
LogFormat.YEAR_MONTH
|
||||
);
|
||||
|
||||
conquerCity = true;
|
||||
emitTrace('supply_retreat', defender);
|
||||
|
||||
@@ -417,5 +417,8 @@ describe('resolveWarBattle', () => {
|
||||
|
||||
expect(outcome.conquered).toBe(true);
|
||||
expect(outcome.reports.length).toBeGreaterThan(0);
|
||||
expect(outcome.logs.map((log) => log.text)).toContain(
|
||||
'<M><b>【패퇴】</b></><D><b>TestNation</b></>이 병량 부족으로 <G><b>TestCity</b></>를 뺏기고 말았습니다.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,6 +81,7 @@ integration('core ↔ legacy command-boundary differential', () => {
|
||||
'live sortie against multiple defending generals',
|
||||
'fixtures/turn-differential/live-sortie-multiple-defenders.json',
|
||||
],
|
||||
['live sortie supply retreat', 'fixtures/turn-differential/live-sortie-supply-retreat.json'],
|
||||
])(
|
||||
'%s matches command RNG and canonical state delta',
|
||||
async (_label, fixturePath) => {
|
||||
@@ -105,6 +106,13 @@ integration('core ↔ legacy command-boundary differential', () => {
|
||||
const afterCity = reference.after.cities.find((city) => city.id === 70);
|
||||
expect(Number(afterCity?.defence)).toBeLessThan(Number(beforeCity?.defence));
|
||||
}
|
||||
if (fixturePath.endsWith('live-sortie-supply-retreat.json')) {
|
||||
const retreatLogs = reference.after.logs.filter(
|
||||
(log) => (Number(log.id) || 0) > reference.before.watermarks.historyLogId
|
||||
);
|
||||
expect(retreatLogs.some((log) => String(log.text).includes('병량 부족'))).toBe(true);
|
||||
expect(reference.after.cities.find((city) => city.id === 70)?.nationId).toBe(1);
|
||||
}
|
||||
|
||||
expect(core.execution.outcome).toMatchObject({
|
||||
requestedAction: request.action,
|
||||
|
||||
Reference in New Issue
Block a user