fix: 전투 이펙트와 차등 하네스 호환성을 복원한다

Ref 기준의 판정 순서, 난수 소비, 아이템·특기 이펙트와 로그 형식을 맞춘다.

전체 전투 결과와 이벤트·상태·난수 trace를 엄격 비교하고 fixture 및 출병 예약 회귀를 보강한다.
This commit is contained in:
2026-08-24 03:37:56 +00:00
parent 32bab36320
commit 95cf68dffd
21 changed files with 1499 additions and 319 deletions
@@ -21,7 +21,7 @@ import { compileCrewTypeCatalog } from '../crewType/index.js';
import type { City, General, Nation } from '../domain/entities.js';
import { createInheritBuffModules } from '../inheritance/inheritBuff.js';
import { createItemActionModules, createItemModuleRegistry, ITEM_KEYS, loadItemModules } from '../items/index.js';
import { formatLogText, LogCategory, LogFormat, LogScope } from '../logging/index.js';
import { formatLogText, LogCategory, LogFormat, LogScope, type ActionLogger } from '../logging/index.js';
import {
createCrewTypeWarTriggerRegistry,
resolveDefenderOrder,
@@ -344,6 +344,10 @@ const resolveDefenderOrderPayload = (payload: BattleSimJobPayload): number[] =>
export interface BattleSimProcessorOptions {
trace?: (event: WarBattleTraceEvent) => void;
rngFactory?: (seed: string) => RandUtil;
/** Comparison-only logger instrumentation; production callers omit it. */
loggerFactory?: (options: { generalId?: number; nationId?: number }) => ActionLogger;
/** Comparison-only observation of the resolved pure battle outcome. */
onBattleResolved?: (outcome: WarBattleOutcome) => void;
}
export const processBattleSimJob = (
@@ -416,9 +420,12 @@ export const processBattleSimJob = (
})),
defenderCity,
defenderNation,
...(options.loggerFactory ? { loggerFactory: options.loggerFactory } : {}),
...(options.trace ? { trace: options.trace } : {}),
});
options.onBattleResolved?.(outcome);
lastBattle = outcome;
const attackerReport = outcome.reports.find(
(report: WarUnitReport) => report.type === 'general' && report.isAttacker