fix: match scenario 2601 monthly seed progression

This commit is contained in:
2026-08-03 18:56:23 +00:00
parent 2f17584075
commit 58b9a230a7
92 changed files with 3696 additions and 587 deletions
@@ -50,7 +50,7 @@ const buildCity = (id: number, nationId = 1, level = 4): City => ({
meta: {},
});
const buildNation = (level: number): Nation => ({
const buildNation = (level: number, patch: Partial<Nation> = {}): Nation => ({
id: 1,
name: '위',
color: '#000000',
@@ -62,6 +62,7 @@ const buildNation = (level: number): Nation => ({
level,
typeCode: 'che_중립',
meta: { marker: 1 },
...patch,
});
const buildGeneral = (id: number, patch: Partial<TurnGeneral> = {}): TurnGeneral => ({
@@ -113,6 +114,7 @@ const buildHarness = async (
itemModules?: ItemModule[];
configConst?: Record<string, unknown>;
additionalOccupiedCounts?: Map<string, number>;
neutralCityCount?: number;
} = {}
) => {
const state: TurnWorldState = {
@@ -143,8 +145,27 @@ const buildHarness = async (
defaults: { trust: 50, trade: 100, supplyState: 1, frontState: 0 },
},
generals: [buildGeneral(1), buildGeneral(2, { meta: { killturn: 850, belong: 30 } })],
cities: Array.from({ length: cityCount }, (_, index) => buildCity(index + 1)),
nations: [buildNation(nationLevel)],
cities: [
...Array.from({ length: cityCount }, (_, index) => buildCity(index + 1)),
...Array.from({ length: options.neutralCityCount ?? 0 }, (_, index) =>
buildCity(cityCount + index + 1, 0)
),
],
nations: [
...(options.neutralCityCount
? [
buildNation(0, {
id: 0,
name: '재야',
capitalCityId: null,
chiefGeneralId: null,
gold: 0,
rice: 0,
}),
]
: []),
buildNation(nationLevel),
],
troops: [],
diplomacy: [],
events: [event],
@@ -236,6 +257,15 @@ describe('UpdateNationLevel monthly action', () => {
expect(world.peekDirtyState().logs).toEqual([]);
});
it('never promotes the Core-only neutral nation sentinel from neutral cities', async () => {
const { world, handler } = await buildHarness(0, 0, { neutralCityCount: 21 });
await handler([], { year: 193, month: 2, startyear: 190, currentEventID: 1, turnTime: new Date() }, event);
expect(world.getNationById(0)).toMatchObject({ level: 0, gold: 0, rice: 0 });
expect(world.peekDirtyState().logs).toEqual([]);
});
it('sets both rename permissions only on promotion to emperor', async () => {
const { world, handler } = await buildHarness(6, 21);