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:
50
src/services/storyEngine/setpieceDirector.ts
Normal file
50
src/services/storyEngine/setpieceDirector.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { ChapterState, GameState, JourneyBeat, SetpieceDirective } from '../../types';
|
||||
|
||||
export function evaluateSetpieceOpportunity(params: {
|
||||
state: GameState;
|
||||
chapterState: ChapterState | null | undefined;
|
||||
journeyBeat: JourneyBeat | null | undefined;
|
||||
}) {
|
||||
if (!params.chapterState) return false;
|
||||
return (
|
||||
params.chapterState.stage === 'climax'
|
||||
|| params.journeyBeat?.beatType === 'boss_prelude'
|
||||
|| params.state.currentScenePreset?.currentPressureLevel === 'extreme'
|
||||
);
|
||||
}
|
||||
|
||||
export function buildSetpieceDirective(params: {
|
||||
state: GameState;
|
||||
chapterState: ChapterState | null | undefined;
|
||||
journeyBeat: JourneyBeat | null | undefined;
|
||||
}) {
|
||||
if (!params.chapterState) return null;
|
||||
|
||||
const setpieceType: SetpieceDirective['setpieceType'] =
|
||||
params.chapterState.stage === 'aftermath'
|
||||
? 'aftermath'
|
||||
: params.chapterState.stage === 'climax'
|
||||
? 'climax'
|
||||
: params.journeyBeat?.beatType === 'boss_prelude'
|
||||
? 'boss_prelude'
|
||||
: 'showdown';
|
||||
|
||||
return {
|
||||
id: `setpiece:${params.chapterState.id}:${setpieceType}`,
|
||||
title:
|
||||
setpieceType === 'climax'
|
||||
? `${params.chapterState.title}·高潮`
|
||||
: setpieceType === 'aftermath'
|
||||
? `${params.chapterState.title}·余波`
|
||||
: `${params.chapterState.title}·对峙`,
|
||||
setpieceType,
|
||||
relatedThreadIds: params.chapterState.primaryThreadIds,
|
||||
sceneFocusId: params.state.currentScenePreset?.id ?? null,
|
||||
dramaticQuestion:
|
||||
setpieceType === 'climax'
|
||||
? '这一轮冲突会把谁的真相和代价一起推到台前?'
|
||||
: setpieceType === 'aftermath'
|
||||
? '高潮过后,谁会先承受余波?'
|
||||
: '这一步会把暗线逼到什么程度?',
|
||||
} satisfies SetpieceDirective;
|
||||
}
|
||||
Reference in New Issue
Block a user