Rework story engine flow and reorganize project docs
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
70
src/services/storyEngine/factionTensionState.test.ts
Normal file
70
src/services/storyEngine/factionTensionState.test.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { type CustomWorldProfile,WorldType } from '../../types';
|
||||
import { buildFactionTensionState } from './factionTensionState';
|
||||
|
||||
describe('factionTensionState', () => {
|
||||
it('builds faction temperatures from active threads', () => {
|
||||
const profile = {
|
||||
id: 'world-1',
|
||||
settingText: '裂潮边城',
|
||||
name: '裂潮边城',
|
||||
subtitle: '旧案回响',
|
||||
summary: '一座在裂潮和旧案之间摇摇欲坠的边城。',
|
||||
tone: '紧张、克制、暗流涌动',
|
||||
playerGoal: '查清封桥旧令',
|
||||
templateWorldType: WorldType.WUXIA,
|
||||
majorFactions: ['巡边司'],
|
||||
coreConflicts: ['封桥旧案再起'],
|
||||
attributeSchema: {
|
||||
id: 'schema',
|
||||
worldId: 'world-1',
|
||||
schemaVersion: 1,
|
||||
generatedFrom: {
|
||||
worldType: WorldType.CUSTOM,
|
||||
worldName: '裂潮边城',
|
||||
settingSummary: '裂潮边城',
|
||||
tone: '紧张、克制、暗流涌动',
|
||||
conflictCore: '封桥旧案再起',
|
||||
},
|
||||
slots: [],
|
||||
},
|
||||
playableNpcs: [],
|
||||
storyNpcs: [],
|
||||
items: [],
|
||||
landmarks: [],
|
||||
themePack: null,
|
||||
storyGraph: {
|
||||
visibleThreads: [
|
||||
{
|
||||
id: 'thread-1',
|
||||
title: '巡边司的封桥旧案',
|
||||
visibility: 'visible',
|
||||
summary: '巡边司正在被封桥旧案拖住。',
|
||||
conflictType: '调查',
|
||||
stakes: '边城安稳',
|
||||
involvedFactionIds: ['巡边司'],
|
||||
involvedActorIds: [],
|
||||
relatedLocationIds: [],
|
||||
},
|
||||
],
|
||||
hiddenThreads: [],
|
||||
scars: [],
|
||||
motifs: [],
|
||||
},
|
||||
knowledgeFacts: null,
|
||||
threadContracts: null,
|
||||
} satisfies CustomWorldProfile;
|
||||
|
||||
const tensions = buildFactionTensionState(profile, {
|
||||
discoveredFactIds: [],
|
||||
inferredFactIds: [],
|
||||
activeThreadIds: ['thread-1'],
|
||||
resolvedScarIds: [],
|
||||
recentCarrierIds: [],
|
||||
});
|
||||
|
||||
expect(tensions[0]?.temperature).toBeGreaterThan(40);
|
||||
expect(tensions[0]?.pressureSummary).toContain('巡边司');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user