feat: 사용자 군주 자율행동 업무를 개별 설정한다

NPC 군주의 기존 국가 운영은 유지하고 사용자 군주는 외교, 수뇌 임명, 재정 조정, 천도를 기본 비활성화한다.

내 정보 설정과 인증 API, 엔진 gate를 연결하고 자율행동 기간 및 국가턴 master를 함께 검증한다.
This commit is contained in:
2026-08-22 08:28:04 +00:00
parent 957445b0e0
commit 9c588dbd67
14 changed files with 309 additions and 28 deletions
@@ -468,4 +468,52 @@ describe('core monthly event actions at the real month boundary', () => {
expect(lowChiefBill).toBeTypeOf('number');
expect(highChiefBill).toBe(lowChiefBill);
});
it('keeps user-ruler finance unchanged by default and applies it only after opt-in', () => {
const config: TurnWorldSnapshot['scenarioConfig'] = {
stat: { total: 300, min: 10, max: 100, npcTotal: 150, npcMax: 50, npcMin: 10, chiefMin: 70 },
iconPath: '',
map: {},
const: { baseGold: 0, baseRice: 0 },
environment: { mapName: map.id, unitSet: 'default' },
};
const buildFinanceWorld = (settings: {
finance: number;
autorunLimit?: number;
nationTurn?: number;
}) => {
const chief = buildGeneral(1, 1, 3);
chief.npcState = 0;
chief.officerLevel = 12;
chief.meta = {
...chief.meta,
use_auto_nation_finance: settings.finance,
...(settings.autorunLimit === undefined ? {} : { autorun_limit: settings.autorunLimit }),
...(settings.nationTurn === undefined ? {} : { use_auto_nation_turn: settings.nationTurn }),
};
const subordinate = buildGeneral(2, 1, 3);
return buildWorld([], () => new Map(), {
currentMonth: 12,
generals: [chief, subordinate],
nations: [buildNation()],
cities: [buildCity()],
});
};
const options = { scenarioConfig: config, commandEnv: buildCommandEnv(config) };
const disabled = buildFinanceWorld({ finance: 0, autorunLimit: 19101 });
const outsideAutorun = buildFinanceWorld({ finance: 1 });
const masterDisabled = buildFinanceWorld({ finance: 1, autorunLimit: 19101, nationTurn: 0 });
const enabled = buildFinanceWorld({ finance: 1, autorunLimit: 19101, nationTurn: 1 });
expect(calculateNpcNationFinance(disabled, disabled.getNationById(1)!, 12, options)).toBeNull();
expect(
calculateNpcNationFinance(outsideAutorun, outsideAutorun.getNationById(1)!, 12, options)
).toBeNull();
expect(
calculateNpcNationFinance(masterDisabled, masterDisabled.getNationById(1)!, 12, options)
).toBeNull();
expect(calculateNpcNationFinance(enabled, enabled.getNationById(1)!, 12, options)).toEqual(
expect.objectContaining({ rate: expect.any(Number), bill: expect.any(Number) })
);
});
});