Simplify custom world result editing controls

This commit is contained in:
2026-04-08 19:07:46 +08:00
parent bd9fdcbe31
commit a02f7b6414
125 changed files with 8804 additions and 1462 deletions

View File

@@ -1,6 +1,8 @@
import { describe, expect, it } from 'vitest';
import { AFFINITY_BACKSTORY_CHAPTER_THRESHOLDS } from '../data/affinityLevels';
import { getCurrencyName } from '../data/economy';
import { WorldType } from '../types';
import { normalizeCustomWorldProfile } from './customWorld';
describe('normalizeCustomWorldProfile', () => {
@@ -224,4 +226,59 @@ describe('normalizeCustomWorldProfile', () => {
(connection) => connection.targetLandmarkId === profile.landmarks[0]?.id,
)).toBe(true);
});
it('compiles and preserves owned setting layers for runtime consumption', () => {
const profile = normalizeCustomWorldProfile(
{
name: '雾潮港',
summary: '被潮灾旧闻反复撕开的边港。',
tone: '潮湿、迷雾、压抑',
playerGoal: '查清港区失踪名单为何重复出现',
templateWorldType: WorldType.WUXIA,
ownedSettingLayers: {
ruleProfile: {
resourceLabels: {
hp: '潮命',
mp: '潮息',
maxHp: '潮命上限',
maxMp: '潮息上限',
damage: '潮势',
guard: '潮护',
range: '潮距',
cooldown: '回潮',
manaCost: '潮息消耗',
currency: '雾银',
},
economyProfile: {
initialCurrency: 188,
},
},
semanticAnchor: {
genreSignals: ['海岸悬疑'],
conflictForms: ['追查失踪'],
institutionTypes: ['港务'],
tabooTypes: ['回潮夜'],
carrierTypes: ['航图'],
forceSystemTypes: ['潮汐'],
atmosphereTags: ['迷雾'],
},
},
},
'玩家想要一个围绕迷雾港区与潮灾旧闻展开的世界。',
);
expect(profile.ownedSettingLayers?.ruleProfile.resourceLabels.currency).toBe(
'雾银',
);
expect(profile.ownedSettingLayers?.ruleProfile.economyProfile.initialCurrency).toBe(
188,
);
expect(getCurrencyName(WorldType.CUSTOM, profile)).toBe('雾银');
expect(
profile.ownedSettingLayers?.compatibilityProfile?.legacyTemplateWorldType,
).toBe(WorldType.WUXIA);
expect(
profile.ownedSettingLayers?.referenceProfile.creatureArchetypes.length,
).toBeGreaterThan(0);
});
});