장비매매 불가 표시·숙련전환 전후 미리보기·건국 성향표를 Ref처럼 복원

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-23 15:45:25 +00:00
co-authored by Claude Opus 5.5
parent f74c3322b7
commit 7e1783d651
9 changed files with 568 additions and 5 deletions
+3
View File
@@ -415,6 +415,7 @@ export const getTurnCommandTable = async (ctx: GameApiContext, generalId: number
item: general.itemCode,
},
});
const dexterityByArmType: Record<string, number> = {};
const inputOptions: TurnCommandInputOptions = {
cities: cities.map((entry) => ({
value: entry.id,
@@ -432,6 +433,7 @@ export const getTurnCommandTable = async (ctx: GameApiContext, generalId: number
.map((entry) => ({ value: entry.id, label: entry.name })),
armTypes: Object.entries(environment.unitSet.armTypes ?? {}).map(([value, label]) => {
const dexterity = readGeneralMetaNumber(general.meta, `dex${value}`);
if (dexterity !== null) dexterityByArmType[value] = dexterity;
return {
value: Number(value),
label,
@@ -468,6 +470,7 @@ export const getTurnCommandTable = async (ctx: GameApiContext, generalId: number
actorRice: general.rice,
...(city ? { citySecurity: city.security } : {}),
...(nation ? { nationGold: nation.gold, nationRice: nation.rice, nationLevel: nation.level } : {}),
dexterity: dexterityByArmType,
},
};
+8 -2
View File
@@ -130,6 +130,8 @@ export interface TurnCommandInputOptions {
nationGold?: number;
nationRice?: number;
nationLevel?: number;
/** 숙련전환 전/후 미리보기용 본인 병과별 숙련(`dex<armType>`). */
dexterity?: Record<string, number>;
};
}
@@ -164,6 +166,8 @@ export const buildEquipmentTradeItemOptions = (options: {
{
value: 'None',
label: ownedItem ? `${ownedItem.name} 판매` : `${slotName} 판매`,
// Ref che_장비매매.vue: 소유하지 않은 종류의 판매는 붉은색 `(불가)`로 표시한다.
...(ownedItem ? {} : { availableNow: false }),
description: ownedItem
? `소유 물품 판매 · 판매가 ${Math.floor((ownedItem.cost ?? 0) / 2).toLocaleString()}`
: ownedCode && ownedCode !== 'None'
@@ -190,6 +194,7 @@ export const buildEquipmentTradeItemOptions = (options: {
items[item.slot].push({
value: item.key,
label: item.name,
availableNow: options.currentSecurity >= item.reqSecu && options.generalGold >= cost,
description: `${availability} · 가격 ${cost.toLocaleString()} · ${plainLegacyInfo(item.info)}`,
});
}
@@ -242,8 +247,9 @@ const FIELD_LABELS: Record<string, string> = {
nationName: '국가명',
nationType: '국가 성향',
colorType: '국기 색상',
srcArmType: '기존 병과',
destArmType: '변경 병과',
// 숙련전환 전용. Ref che_숙련전환.vue의 '감소 대상 숙련 :'·'전환 대상 숙련 :'.
srcArmType: '감소 대상 숙련',
destArmType: '전환 대상 숙련',
itemType: '장비 종류',
itemCode: '장비',
crewType: '병종',
+9
View File
@@ -71,6 +71,11 @@ describe('turn command argument input', () => {
],
},
]);
// Ref che_숙련전환.vue: '감소 대상 숙련 :', '전환 대상 숙련 :'.
expect(fields.find((entry) => entry.key === 'che_숙련전환')?.fields).toMatchObject([
{ key: 'srcArmType', label: '감소 대상 숙련', kind: 'select', optionSource: 'armTypes' },
{ key: 'destArmType', label: '전환 대상 숙련', kind: 'select', optionSource: 'armTypes' },
]);
expect(
nationFields
@@ -339,6 +344,9 @@ describe('turn command argument input', () => {
'che_계략_향낭',
]);
expect(items.item[1]?.description).toBe('현재 구입 가능 · 가격 100 · 환약 · 설명');
expect(items.item[1]?.availableNow).toBe(true);
// Ref che_장비매매.vue: 소유하지 않은 종류의 판매는 불가로 표시한다.
expect(items.item[0]?.availableNow).toBe(false);
});
it('shows only zero-count buyable items selected by an explicit scenario pool', () => {
@@ -359,5 +367,6 @@ describe('turn command argument input', () => {
expect(items.item.map((item) => item.value)).toEqual(['None', 'event_전투특기_격노']);
expect(items.item[1]?.description).toContain('현재 구입 불가: 치안 3,000 필요');
expect(items.item[1]?.availableNow).toBe(false);
});
});