From 45c238ab38bc3af1706dbd71ac0decc5290d5668 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sun, 28 Dec 2025 16:40:28 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20crewTypeId=20=EB=B0=8F=20defaultCrewTyp?= =?UTF-8?q?eId=20=EC=B6=94=EA=B0=80=EB=A1=9C=20=EC=8B=9C=EB=82=98=EB=A6=AC?= =?UTF-8?q?=EC=98=A4=20=EB=B6=80=ED=8A=B8=EC=8A=A4=ED=8A=B8=EB=9E=A9=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/logic/src/domain/entities.ts | 1 + packages/logic/src/world/bootstrap.ts | 13 +++++++++++++ packages/logic/src/world/types.ts | 2 ++ packages/logic/test/worldBootstrap.test.ts | 2 ++ 4 files changed, 18 insertions(+) diff --git a/packages/logic/src/domain/entities.ts b/packages/logic/src/domain/entities.ts index df279e1..e4a2e26 100644 --- a/packages/logic/src/domain/entities.ts +++ b/packages/logic/src/domain/entities.ts @@ -36,6 +36,7 @@ export interface General; } @@ -63,6 +64,7 @@ const DEFAULT_NEUTRAL_NATION_NAME = '재야'; const DEFAULT_NEUTRAL_NATION_COLOR = '#000000'; const DEFAULT_GENERAL_GOLD = 1000; const DEFAULT_GENERAL_RICE = 1000; +const DEFAULT_CREWTYPE_ID = 1100; const DEFAULT_CITY_TRUST = 50; const DEFAULT_CITY_TRADE = 100; const DEFAULT_CITY_SUPPLY_STATE = 1; @@ -233,6 +235,7 @@ const buildGeneralSeeds = ( cityByName: Map, nationNameToId: Map, warnings: ScenarioBootstrapWarning[], + defaultCrewTypeId: number, options?: ScenarioBootstrapOptions ): { seeds: GeneralSeed[]; @@ -310,12 +313,14 @@ const buildGeneralSeeds = ( picture: row.picture, npcType, text: row.text, + crewTypeId: defaultCrewTypeId, meta: seedMeta, }; seeds.push(seed); const generalMeta: Record = { npcType, + crewTypeId: defaultCrewTypeId, }; addTriggerMeta(generalMeta, 'affinity', row.affinity); addTriggerMeta(generalMeta, 'personality', row.personality ?? undefined); @@ -339,6 +344,7 @@ const buildGeneralSeeds = ( gold: defaultGold, rice: defaultRice, crew: 0, + crewTypeId: defaultCrewTypeId, train: 0, age, npcState: npcType, @@ -503,6 +509,10 @@ export const buildScenarioBootstrap = ( } const mapDefaults = resolveMapDefaults(map, options); + const defaultCrewTypeId = + unitSet?.defaultCrewTypeId ?? + options?.defaultCrewTypeId ?? + DEFAULT_CREWTYPE_ID; const seedCities: CitySeed[] = []; const domainCities: City[] = []; @@ -580,6 +590,7 @@ export const buildScenarioBootstrap = ( cityByName, nationNameToId, warnings, + defaultCrewTypeId, options ); allGeneralSeeds.push(...generalResult.seeds); @@ -595,6 +606,7 @@ export const buildScenarioBootstrap = ( cityByName, nationNameToId, warnings, + defaultCrewTypeId, options ); allGeneralSeeds.push(...generalExResult.seeds); @@ -610,6 +622,7 @@ export const buildScenarioBootstrap = ( cityByName, nationNameToId, warnings, + defaultCrewTypeId, options ); allGeneralSeeds.push(...generalNeutralResult.seeds); diff --git a/packages/logic/src/world/types.ts b/packages/logic/src/world/types.ts index 009d878..ae7670a 100644 --- a/packages/logic/src/world/types.ts +++ b/packages/logic/src/world/types.ts @@ -55,6 +55,7 @@ export interface MapDefinition { export interface UnitSetDefinition { id: string; name: string; + defaultCrewTypeId?: number; meta?: Record; } @@ -118,6 +119,7 @@ export interface GeneralSeed { picture: number | string | null; npcType: number; text: string | null; + crewTypeId: number; meta: Record; } diff --git a/packages/logic/test/worldBootstrap.test.ts b/packages/logic/test/worldBootstrap.test.ts index 31bd9ce..42e27f1 100644 --- a/packages/logic/test/worldBootstrap.test.ts +++ b/packages/logic/test/worldBootstrap.test.ts @@ -105,6 +105,7 @@ describe('scenario bootstrap', () => { const unitSet: UnitSetDefinition = { id: 'test-unit', name: 'test-unit', + defaultCrewTypeId: 1200, }; const result = buildScenarioBootstrap({ scenario, map, unitSet }); @@ -115,6 +116,7 @@ describe('scenario bootstrap', () => { expect(result.snapshot.cities[0]?.nationId).toBe(1); expect(result.seed.cities[0]?.nationId).toBe(1); expect(result.snapshot.generals[0]?.cityId).toBe(1); + expect(result.snapshot.generals[0]?.crewTypeId).toBe(1200); expect(result.seed.generals[0]?.npcType).toBe(2); expect(result.snapshot.scenarioMeta?.title).toBe('Test Scenario'); });