fix: 전투 시뮬레이터 기본 특기 계약 복원
Ref와 같이 시나리오 defaultSpecialDomestic을 공격자와 수비자 payload에 적용한다. 기본 5병종 5x5 고정 seed Ref 차등 회귀와 API·Chromium 회귀를 추가한다.
This commit is contained in:
@@ -31,6 +31,16 @@ const resolveNumber = (record: Record<string, unknown>, keys: string[], fallback
|
||||
return fallback;
|
||||
};
|
||||
|
||||
const resolveOptionalString = (record: Record<string, unknown>, keys: string[]): string | null => {
|
||||
for (const key of keys) {
|
||||
const value = record[key];
|
||||
if (typeof value === 'string' && value.trim().length > 0) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const resolveUnitSetName = (worldState: WorldStateRow, fallback: string): string => {
|
||||
const config = asRecord(worldState.config);
|
||||
const environment = asRecord(config.environment ?? config.map);
|
||||
@@ -88,6 +98,7 @@ export interface BattleSimEnvironment {
|
||||
config: WarEngineConfig;
|
||||
startYear: number;
|
||||
scenarioEffect: ScenarioEffectKey | null;
|
||||
defaultSpecialDomestic: string;
|
||||
}
|
||||
|
||||
export const buildBattleSimSeedBase = (request: Pick<BattleSimRequestPayload, 'seed'>): string | null =>
|
||||
@@ -133,6 +144,7 @@ export const buildBattleSimEnvironment = async (
|
||||
config,
|
||||
startYear: resolveStartYear(worldState),
|
||||
scenarioEffect: normalizeScenarioEffect(scenarioEnvironment.scenarioEffect),
|
||||
defaultSpecialDomestic: resolveOptionalString(constValues, ['defaultSpecialDomestic']) ?? 'None',
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ export const battleRouter = router({
|
||||
config: environment.config,
|
||||
unitSet: environment.unitSet,
|
||||
scenarioEffect: environment.scenarioEffect,
|
||||
defaultSpecialDomestic: environment.defaultSpecialDomestic,
|
||||
nationTypes: traits.nationTypes,
|
||||
eventDomesticTraits: traits.eventDomesticTraits,
|
||||
warTraits: traits.warTraits,
|
||||
|
||||
Reference in New Issue
Block a user