fix: 선택 불가 국가 성향을 입력 목록에서 제외

Ref의 availableNationType 13개를 공용 목록으로 정의하고 건국, NPC/AI 건국, 전투 시뮬레이터 입력과 검증에 적용한다.
This commit is contained in:
2026-08-17 10:39:36 +00:00
parent bc356c0c84
commit 0b8add7f13
12 changed files with 171 additions and 25 deletions
@@ -13,7 +13,10 @@ import type { ConstraintContext } from '@sammo-ts/logic';
import { GAME_TICKS_PER_TURN, LiteHashDRBG, RandUtil } from '@sammo-ts/common';
import { simpleSerialize } from '@sammo-ts/logic/war/utils.js';
import { resolveStartYear, resolveTurnTermMinutes } from '@sammo-ts/logic/actions/turn/actionContextHelpers.js';
import { NATION_TRAIT_KEYS } from '@sammo-ts/logic/actionModules/traits/nation/index.js';
import {
AVAILABLE_NATION_TRAIT_KEYS,
isAvailableNationTraitKey,
} from '@sammo-ts/logic/actionModules/traits/nation/index.js';
import { GeneralActionPipeline } from '@sammo-ts/logic/actionModules/general.js';
import type { ReservedTurnEntry } from '../../reservedTurnStore.js';
@@ -348,8 +351,10 @@ export class GeneralAI {
chiefStatMin: this.scenarioConfig.stat.chiefMin,
npcMessageFreqByDay: readNumber(constValues.npcMessageFreqByDay, 0),
availableNationTypes: Array.isArray(constValues.availableNationType)
? constValues.availableNationType.filter((value) => typeof value === 'string')
: NATION_TRAIT_KEYS.filter((value) => value !== 'che_중립'),
? constValues.availableNationType.filter(
(value): value is string => typeof value === 'string' && isAvailableNationTraitKey(value)
)
: [...AVAILABLE_NATION_TRAIT_KEYS],
};
const generalPolicy = new AutorunGeneralPolicy(
@@ -3,7 +3,7 @@ import {
LogCategory,
LogFormat,
LogScope,
NATION_TRAIT_KEYS,
AVAILABLE_NATION_TRAIT_KEYS,
getCityDistance,
type City,
type MapDefinition,
@@ -54,7 +54,6 @@ const NATION_COLORS = [
'#FFFFFF',
'#A9A9A9',
] as const;
const AVAILABLE_NATION_TYPES = NATION_TRAIT_KEYS.filter((key) => key !== 'che_중립');
const NPC_TYPE = 6;
const NPC_PREFIX = 'ⓤ';
const STAT_TYPE_WEIGHTS = { : 1, : 1 } as const;
@@ -301,7 +300,7 @@ export const createRaiseNpcNationHandler = (options: {
const nationId = world.getNextNationId();
const color = rng.choice([...NATION_COLORS]);
const typeCode = rng.choice([...AVAILABLE_NATION_TYPES]);
const typeCode = rng.choice([...AVAILABLE_NATION_TRAIT_KEYS]);
const nation: Nation = {
id: nationId,
name: `${NPC_PREFIX}${city.name}`,