개인턴 입력기에 명령별 소요 턴 안내 표시
This commit is contained in:
@@ -825,7 +825,6 @@ const buildGroups = (
|
||||
entries: CommandEntry[],
|
||||
ctx: ConstraintContext,
|
||||
view: StateView,
|
||||
includeTurnDuration = false,
|
||||
env: CommandEnv,
|
||||
scope: 'general' | 'nation',
|
||||
currentYearMonth: number
|
||||
@@ -840,7 +839,8 @@ const buildGroups = (
|
||||
baseAvailability.status === 'blocked' || baseAvailability.status === 'unknown'
|
||||
? baseAvailability
|
||||
: (evaluateCooldown(entry.definition, scope, ctx, view, currentYearMonth) ?? baseAvailability);
|
||||
const turnDurationText = includeTurnDuration ? getTurnDurationText(entry.definition) : undefined;
|
||||
// 개인·국가 모두 실행 정의의 준비 턴과 마지막 실행 턴을 표시한다.
|
||||
const turnDurationText = getTurnDurationText(entry.definition);
|
||||
const costText = getCommandCostText(entry, ctx, view, env);
|
||||
const value: TurnCommandAvailability = {
|
||||
key: entry.definition.key,
|
||||
@@ -951,7 +951,6 @@ export const buildTurnCommandTable = async (options: {
|
||||
projectCommandGroups(generalEntries, generalGroups ?? REF_GENERAL_COMMAND_GROUPS),
|
||||
ctx,
|
||||
view,
|
||||
false,
|
||||
env,
|
||||
'general',
|
||||
currentYearMonth
|
||||
@@ -960,7 +959,6 @@ export const buildTurnCommandTable = async (options: {
|
||||
projectCommandGroups(nationEntries, nationGroups ?? REF_NATION_COMMAND_GROUPS),
|
||||
ctx,
|
||||
view,
|
||||
true,
|
||||
env,
|
||||
'nation',
|
||||
currentYearMonth
|
||||
|
||||
@@ -211,9 +211,18 @@ describe('buildTurnCommandTable', () => {
|
||||
che_의병모집: '3턴',
|
||||
che_피장파장: '2턴',
|
||||
});
|
||||
expect(table.general.flatMap(({ values }) => values)).not.toContainEqual(
|
||||
expect.objectContaining({ turnDurationText: expect.any(String) })
|
||||
);
|
||||
expect(
|
||||
Object.fromEntries(
|
||||
table.general
|
||||
.flatMap(({ values }) => values)
|
||||
.filter(({ turnDurationText }) => turnDurationText)
|
||||
.map(({ key, turnDurationText }) => [key, turnDurationText])
|
||||
)
|
||||
).toEqual({
|
||||
che_은퇴: '2턴',
|
||||
che_내정특기초기화: '2턴',
|
||||
che_전투특기초기화: '2턴',
|
||||
});
|
||||
const generalCosts = Object.fromEntries(
|
||||
table.general.flatMap(({ values }) => values.map(({ key, costText }) => [key, costText]))
|
||||
);
|
||||
@@ -245,7 +254,7 @@ describe('buildTurnCommandTable', () => {
|
||||
availableGeneralCommand: {
|
||||
개인: ['휴식'],
|
||||
내정: ['che_물자조달'],
|
||||
군사: ['cr_맹훈련'],
|
||||
군사: ['cr_맹훈련', 'che_전투태세'],
|
||||
},
|
||||
availableChiefCommand: {
|
||||
휴식: ['휴식'],
|
||||
@@ -264,7 +273,9 @@ describe('buildTurnCommandTable', () => {
|
||||
'휴식',
|
||||
'che_물자조달',
|
||||
'cr_맹훈련',
|
||||
'che_전투태세',
|
||||
]);
|
||||
expect(findCommand(table, 'che_전투태세')).toMatchObject({ turnDurationText: '4턴' });
|
||||
expect(
|
||||
Object.fromEntries(table.nation.flatMap(({ values }) => values.map(({ key, costText }) => [key, costText])))
|
||||
).toMatchObject({
|
||||
@@ -309,10 +320,12 @@ describe('buildTurnCommandTable', () => {
|
||||
});
|
||||
|
||||
expect(findCommand(table, 'che_내정특기초기화')).toMatchObject({
|
||||
turnDurationText: '2턴',
|
||||
possible: true,
|
||||
status: 'available',
|
||||
});
|
||||
expect(findCommand(table, 'che_전투특기초기화')).toMatchObject({
|
||||
turnDurationText: '2턴',
|
||||
possible: false,
|
||||
status: 'blocked',
|
||||
reason: '1턴 더 기다려야 합니다',
|
||||
|
||||
Reference in New Issue
Block a user