fix: 시나리오별 장비 매매 품목 범위를 보존
현재 시나리오 allItems를 API 선택지와 턴 실행 검증에 함께 적용한다. 빈 설정은 Ref 기본 장비 24종으로 복원하고 명시된 비급 시나리오는 기존 품목을 유지한다.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
loadActionModuleBundle,
|
||||
} from '@sammo-ts/logic';
|
||||
import { asRecord } from '@sammo-ts/common';
|
||||
import { resolveLegacyPurchasableItemKeys } from '@sammo-ts/logic/rewards/legacyUniqueItemPool.js';
|
||||
import { createRuntimeTrace } from './runtimeTrace.js';
|
||||
|
||||
// legacy GameConstBase 기본값
|
||||
@@ -146,6 +147,7 @@ export const buildCommandEnv = (config: ScenarioConfig, unitSet?: UnitSetDefinit
|
||||
['maxResourceActionAmount'],
|
||||
DEFAULT_MAX_RESOURCE_ACTION_AMOUNT
|
||||
),
|
||||
purchasableItemKeys: resolveLegacyPurchasableItemKeys(constValues),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import path from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { loadScenarioDefinitionById, resolveScenarioDefaultsPath } from '../src/scenario/scenarioLoader.js';
|
||||
import { buildCommandEnv } from '../src/turn/reservedTurnCommands.js';
|
||||
|
||||
type LoadedScenario = Awaited<ReturnType<typeof loadScenarioDefinitionById>>;
|
||||
|
||||
@@ -77,4 +78,18 @@ describe('tracked scenario resources', () => {
|
||||
expect(readItemSlot(moreEffectBlank, 'horse').che_명마_07_백마).toBe(4);
|
||||
expect(readItemSlot(composedAddon, 'horse').che_명마_07_백마).toBe(2);
|
||||
});
|
||||
|
||||
it('projects ordinary and explicit secret-item scenario pools into command execution', async () => {
|
||||
const [ordinaryBlank, secretScenario] = await Promise.all(
|
||||
[1, 2701].map((scenarioId) => loadScenarioDefinitionById(scenarioId))
|
||||
);
|
||||
const ordinaryKeys = buildCommandEnv(ordinaryBlank.config).purchasableItemKeys;
|
||||
const secretScenarioKeys = buildCommandEnv(secretScenario.config).purchasableItemKeys;
|
||||
|
||||
expect(ordinaryKeys?.size).toBe(24);
|
||||
expect(ordinaryKeys?.has('che_치료_환약')).toBe(true);
|
||||
expect([...ordinaryKeys!].filter((key) => key.startsWith('event_전투특기_'))).toEqual([]);
|
||||
expect([...secretScenarioKeys!].filter((key) => key.startsWith('event_전투특기_'))).toHaveLength(20);
|
||||
expect(secretScenarioKeys?.has('event_전투특기_격노')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user