merge: 최신 main을 비용 기반 갱신 점수에 통합

This commit is contained in:
2026-08-17 11:10:43 +00:00
68 changed files with 2128 additions and 306 deletions
@@ -19,6 +19,17 @@ export const NATION_TRAIT_KEYS = [
export type NationTraitKey = (typeof NATION_TRAIT_KEYS)[number];
// Ref GameConst::$availableNationType excludes the neutral storage/default trait.
// Founding, NPC founding, and the battle simulator must only expose this list.
export type AvailableNationTraitKey = Exclude<NationTraitKey, 'che_중립'>;
export const AVAILABLE_NATION_TRAIT_KEYS: readonly AvailableNationTraitKey[] = NATION_TRAIT_KEYS.filter(
(key): key is Exclude<NationTraitKey, 'che_중립'> => key !== 'che_중립'
);
export const isAvailableNationTraitKey = (value: string): value is AvailableNationTraitKey =>
AVAILABLE_NATION_TRAIT_KEYS.includes(value as AvailableNationTraitKey);
export type NationTraitModule = TraitModule;
export type NationTraitImporter = () => Promise<TraitModuleExport>;
@@ -1,4 +1,4 @@
import { NATION_TRAIT_KEYS } from '@sammo-ts/logic/actionModules/traits/nation/index.js';
import { isAvailableNationTraitKey } from '@sammo-ts/logic/actionModules/traits/nation/index.js';
import { getLegacyStringWidth } from '@sammo-ts/logic/troop/management.js';
import { z } from 'zod';
@@ -38,14 +38,12 @@ export const NATION_COLORS = [
'#A9A9A9',
] as const;
const SELECTABLE_NATION_TYPES = new Set<string>(NATION_TRAIT_KEYS.filter((key) => key !== 'che_중립'));
export const FOUNDING_ARGS_SCHEMA = z.object({
nationName: z
.string()
.min(1)
.refine((value) => getLegacyStringWidth(value) <= 18),
nationType: z.string().refine((value) => SELECTABLE_NATION_TYPES.has(value)),
nationType: z.string().refine(isAvailableNationTraitKey),
colorType: z
.number()
.int()
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest';
import {
AVAILABLE_NATION_TRAIT_KEYS,
isAvailableNationTraitKey,
NATION_TRAIT_KEYS,
} from '../src/actionModules/traits/nation/index.js';
describe('Ref-selectable nation traits', () => {
it('keeps the neutral storage trait valid internally but unavailable to user selection', () => {
expect(NATION_TRAIT_KEYS).toContain('che_중립');
expect(AVAILABLE_NATION_TRAIT_KEYS).toEqual([
'che_도적',
'che_명가',
'che_음양가',
'che_종횡가',
'che_불가',
'che_오두미도',
'che_태평도',
'che_도가',
'che_묵가',
'che_덕가',
'che_병가',
'che_유가',
'che_법가',
]);
expect(isAvailableNationTraitKey('che_중립')).toBe(false);
expect(isAvailableNationTraitKey('che_도적')).toBe(true);
});
});