feat: NPC 세금 처리 로직 및 관련 핸들러 추가, 대형 테스트 맵 수정

This commit is contained in:
2026-01-24 10:06:55 +00:00
parent cb04c930b8
commit 753abdaf47
7 changed files with 185 additions and 40 deletions
+33 -33
View File
@@ -7,7 +7,7 @@ export const LARGE_TEST_MAP: MapDefinition = {
{
id: 1,
name: '소성A',
level: 4,
level: 5,
region: 1,
position: { x: 10, y: 10 },
connections: [2, 3],
@@ -20,18 +20,18 @@ export const LARGE_TEST_MAP: MapDefinition = {
wall: 1000,
},
initial: {
population: 10000,
agriculture: 1000,
commerce: 1000,
security: 1000,
defence: 500,
wall: 500,
population: 6000,
agriculture: 600,
commerce: 600,
security: 600,
defence: 300,
wall: 300,
},
},
{
id: 2,
name: '중성B',
level: 5,
level: 6,
region: 1,
position: { x: 20, y: 10 },
connections: [1, 4],
@@ -44,18 +44,18 @@ export const LARGE_TEST_MAP: MapDefinition = {
wall: 1100,
},
initial: {
population: 12000,
agriculture: 1100,
commerce: 1100,
security: 1100,
defence: 550,
wall: 550,
population: 7200,
agriculture: 660,
commerce: 660,
security: 660,
defence: 330,
wall: 330,
},
},
{
id: 3,
name: '대성C',
level: 6,
level: 7,
region: 2,
position: { x: 10, y: 20 },
connections: [1, 5],
@@ -79,7 +79,7 @@ export const LARGE_TEST_MAP: MapDefinition = {
{
id: 4,
name: '특성D',
level: 7,
level: 8,
region: 2,
position: { x: 30, y: 10 },
connections: [2, 5],
@@ -103,7 +103,7 @@ export const LARGE_TEST_MAP: MapDefinition = {
{
id: 5,
name: '소성E',
level: 4,
level: 5,
region: 3,
position: { x: 20, y: 20 },
connections: [3, 4, 6],
@@ -116,18 +116,18 @@ export const LARGE_TEST_MAP: MapDefinition = {
wall: 1000,
},
initial: {
population: 10000,
agriculture: 1000,
commerce: 1000,
security: 1000,
defence: 500,
wall: 500,
population: 6000,
agriculture: 600,
commerce: 600,
security: 600,
defence: 300,
wall: 300,
},
},
{
id: 6,
name: '중성F',
level: 5,
level: 6,
region: 3,
position: { x: 30, y: 20 },
connections: [5, 7],
@@ -140,18 +140,18 @@ export const LARGE_TEST_MAP: MapDefinition = {
wall: 1100,
},
initial: {
population: 12000,
agriculture: 1100,
commerce: 1100,
security: 1100,
defence: 550,
wall: 550,
population: 7200,
agriculture: 660,
commerce: 660,
security: 660,
defence: 330,
wall: 330,
},
},
{
id: 7,
name: '대성G',
level: 6,
level: 7,
region: 4,
position: { x: 40, y: 20 },
connections: [6, 8],
@@ -175,7 +175,7 @@ export const LARGE_TEST_MAP: MapDefinition = {
{
id: 8,
name: '특성H',
level: 7,
level: 8,
region: 4,
position: { x: 50, y: 20 },
connections: [7, 9],
@@ -199,7 +199,7 @@ export const LARGE_TEST_MAP: MapDefinition = {
{
id: 9,
name: '소성I',
level: 4,
level: 5,
region: 5,
position: { x: 60, y: 20 },
connections: [8],
@@ -6,6 +6,8 @@ import { InMemoryReservedTurnStore } from '../src/turn/reservedTurnStore.js';
import { createReservedTurnHandler } from '../src/turn/reservedTurnHandler.js';
import { InMemoryTurnProcessor } from '../src/turn/inMemoryTurnProcessor.js';
import { createIncomeHandler } from '../src/turn/incomeHandler.js';
import { createNpcTaxHandler } from '../src/turn/npcTaxHandler.js';
import { composeCalendarHandlers } from '../src/turn/calendarHandlers.js';
import { LARGE_TEST_MAP, buildLargeTestCities } from './fixtures/largeTestMap.js';
const mockDate = new Date('0179-08-01T00:00:00Z');
@@ -108,7 +110,7 @@ describe('NPC 대형 시뮬레이션', () => {
generals.length + 1,
cityId,
{ leadership: 75, strength: 10, intelligence: 75 },
3
2
)
);
}
@@ -176,7 +178,7 @@ describe('NPC 대형 시뮬레이션', () => {
currentMonth: 8,
tickSeconds: 600,
lastTurnTime: mockDate,
meta: { seed: 1 },
meta: { seed: 1, initYear: 179, initMonth: 8 },
};
const schedule: TurnSchedule = {
@@ -207,10 +209,16 @@ describe('NPC 대형 시뮬레이션', () => {
nationTraits: new Map(),
});
const npcTaxHandler = createNpcTaxHandler({
getWorld: () => wrapper.world,
});
const calendarHandler = composeCalendarHandlers(incomeHandler, npcTaxHandler);
const world = new InMemoryTurnWorld(state, snapshot, {
schedule,
generalTurnHandler: handler,
calendarHandler: incomeHandler,
calendarHandler,
});
wrapper.world = world;
@@ -266,7 +274,7 @@ describe('NPC 대형 시뮬레이션', () => {
const generals = world.listGenerals();
for (const nation of nations) {
const nationGenerals = generals.filter((general) => general.nationId === nation.id);
expect(nationGenerals.length).toBe(targetCount);
expect(nationGenerals.length).toBeGreaterThanOrEqual(targetCount);
}
};