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
+3 -1
View File
@@ -1,5 +1,7 @@
import { z } from 'zod';
import { isAvailableNationTraitKey } from '@sammo-ts/logic';
import type { BattleSimRequestPayload } from './types.js';
const zBattleSimGeneral = z.object({
@@ -71,7 +73,7 @@ const zBattleSimCity = z.object({
});
const zBattleSimNation = z.object({
type: z.string().min(1),
type: z.string().refine(isAvailableNationTraitKey),
tech: z.number().min(0),
level: z.number().int().min(0),
capital: z.number().int().min(0),
@@ -1,4 +1,5 @@
import {
AVAILABLE_NATION_TRAIT_KEYS,
ITEM_KEYS,
EVENT_DOMESTIC_TRAIT_KEYS,
loadEventDomesticTraitModules,
@@ -6,7 +7,6 @@ import {
loadNationTraitModules,
loadPersonalityTraitModules,
loadWarTraitModules,
NATION_TRAIT_KEYS,
PERSONALITY_TRAIT_KEYS,
WAR_TRAIT_KEYS,
type ItemModule,
@@ -110,7 +110,7 @@ export const loadBattleSimTraitOptions = async (): Promise<{
}> => {
if (!cachedTraitOptions) {
cachedTraitOptions = Promise.all([
loadNationTraitModules([...NATION_TRAIT_KEYS]),
loadNationTraitModules([...AVAILABLE_NATION_TRAIT_KEYS]),
loadEventDomesticTraitModules([...EVENT_DOMESTIC_TRAIT_KEYS]),
loadWarTraitModules([...WAR_TRAIT_KEYS]),
loadPersonalityTraitModules([...PERSONALITY_TRAIT_KEYS]),