feat: createNoopDaemonTransport 함수 추가 및 토너먼트 상태 처리 개선, 캘린더 핸들러 반환 타입 수정

This commit is contained in:
2026-01-24 11:36:01 +00:00
parent 01f26edbeb
commit 2ea8e11f50
4 changed files with 20 additions and 31 deletions
+2 -2
View File
@@ -2,10 +2,10 @@ import type { TurnCalendarHandler } from './inMemoryWorld.js';
export const composeCalendarHandlers = (
...handlers: Array<TurnCalendarHandler | null | undefined>
): TurnCalendarHandler | null => {
): TurnCalendarHandler | undefined => {
const resolved = handlers.filter(Boolean) as TurnCalendarHandler[];
if (resolved.length === 0) {
return null;
return undefined;
}
return {
onMonthChanged: (context) => {
@@ -10,6 +10,7 @@ import type {
ScenarioMeta,
Troop,
TurnCommandProfile,
TurnCommandEnv,
UnitSetDefinition,
} from '@sammo-ts/logic';
import {
@@ -353,32 +354,6 @@ const resolveDefinition = (
fallback: GeneralActionDefinition
): GeneralActionDefinition => definitions.get(actionKey) ?? fallback;
const resolveNpcTaxRate = (cities: City[]): number => {
if (cities.length === 0) {
return 15;
}
let pop = 0;
let all = 0;
for (const city of cities) {
const popRatio = city.populationMax > 0 ? city.population / city.populationMax : 0;
pop += popRatio;
all += calcCityDevRatio(city);
}
pop /= cities.length;
all /= cities.length;
const avg = (pop + all) / 2;
if (avg > 0.95) {
return 25;
}
if (avg > 0.7) {
return 20;
}
if (avg > 0.5) {
return 15;
}
return 10;
};
export const createReservedTurnHandler = async (options: {
reservedTurns: InMemoryReservedTurnStore;
scenarioConfig: ScenarioConfig;