fix: 빈 특기의 획득 예정 나이를 표시한다
메인 장수 read model에 내정·전투 특기 예정 나이를 투영하고, Ref와 같은 현재 나이 다음 해 하한을 적용한다. API 회귀와 Chromium 데스크톱·모바일 검증을 추가한다.
This commit is contained in:
@@ -553,6 +553,10 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
|
||||
specialDomestic: resolveTraitDisplayName(general.specialCode, domesticNames),
|
||||
specialWar: resolveTraitDisplayName(general.special2Code, warNames),
|
||||
},
|
||||
traitAges: {
|
||||
specialDomestic: readNumber(metaRecord.specage, 0),
|
||||
specialWar: readNumber(metaRecord.specage2, 0),
|
||||
},
|
||||
traitInfo: {
|
||||
personal: personalityNames.get(general.personalCode)?.info ?? '',
|
||||
specialDomestic: domesticNames.get(general.specialCode)?.info ?? '',
|
||||
|
||||
@@ -510,6 +510,7 @@ describe('in-game my information ownership', () => {
|
||||
personalCode: 'che_안전',
|
||||
specialCode: 'che_상재',
|
||||
special2Code: 'che_신산',
|
||||
meta: { specage: 31, specage2: 35 },
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -520,6 +521,10 @@ describe('in-game my information ownership', () => {
|
||||
specialDomestic: '상재',
|
||||
specialWar: '신산',
|
||||
},
|
||||
traitAges: {
|
||||
specialDomestic: 31,
|
||||
specialWar: 35,
|
||||
},
|
||||
traitInfo: {
|
||||
personal: '사기 -5, 징·모병 비용 -20%',
|
||||
specialDomestic: '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%',
|
||||
@@ -543,6 +548,31 @@ describe('in-game my information ownership', () => {
|
||||
expect(fixture.db.nation.findUnique).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('returns the scheduled acquisition ages when the owned general has no domestic or war trait', async () => {
|
||||
const fixture = createContext({
|
||||
me: buildGeneral({
|
||||
age: 30,
|
||||
specialCode: 'None',
|
||||
special2Code: 'None',
|
||||
meta: { specage: 35, specage2: 29 },
|
||||
}),
|
||||
});
|
||||
|
||||
await expect(appRouter.createCaller(fixture.context).general.me()).resolves.toMatchObject({
|
||||
general: {
|
||||
age: 30,
|
||||
traits: {
|
||||
specialDomestic: '-',
|
||||
specialWar: '-',
|
||||
},
|
||||
traitAges: {
|
||||
specialDomestic: 35,
|
||||
specialWar: 29,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('reads legacy top-level settings and dispatches only the session-owned general', async () => {
|
||||
const requestCommand = vi.fn(async () => ({ type: 'setMySetting', ok: true, generalId: 7 }));
|
||||
const fixture = createContext({ requestCommand });
|
||||
|
||||
Reference in New Issue
Block a user