1
This commit is contained in:
@@ -1103,7 +1103,11 @@ export function createStoryNpcEncounterActions({
|
||||
return `${contextText}${hostilityText} 要么现在转身逃开,要么就拔刀。`;
|
||||
};
|
||||
|
||||
const buildHostileNpcEscapeOption = (character: Character): StoryOption => {
|
||||
const buildHostileNpcEscapeOption = (
|
||||
character: Character,
|
||||
actionText = '逃跑',
|
||||
runtimePayload?: StoryOption['runtimePayload'],
|
||||
): StoryOption => {
|
||||
const functionContext = gameState.worldType
|
||||
? {
|
||||
worldType: gameState.worldType,
|
||||
@@ -1125,16 +1129,20 @@ export function createStoryNpcEncounterActions({
|
||||
if (resolvedOption) {
|
||||
return {
|
||||
...resolvedOption,
|
||||
actionText: '逃跑',
|
||||
text: '逃跑',
|
||||
actionText,
|
||||
text: actionText,
|
||||
detailText: '',
|
||||
runtimePayload: {
|
||||
...(resolvedOption.runtimePayload ?? {}),
|
||||
...(runtimePayload ?? {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
functionId: 'battle_escape_breakout',
|
||||
actionText: '逃跑',
|
||||
text: '逃跑',
|
||||
actionText,
|
||||
text: actionText,
|
||||
detailText: '',
|
||||
visuals: {
|
||||
playerAnimation: AnimationState.RUN,
|
||||
@@ -1144,9 +1152,61 @@ export function createStoryNpcEncounterActions({
|
||||
scrollWorld: true,
|
||||
monsterChanges: [],
|
||||
},
|
||||
runtimePayload,
|
||||
};
|
||||
};
|
||||
|
||||
const buildHostileNpcEscapeOptions = (character: Character): StoryOption[] => {
|
||||
const currentScene = gameState.currentScenePreset;
|
||||
const worldType = gameState.worldType;
|
||||
const options: StoryOption[] = [];
|
||||
const seenSceneIds = new Set<string>();
|
||||
|
||||
if (worldType && currentScene) {
|
||||
for (const connection of currentScene.connections ?? []) {
|
||||
if (!connection.sceneId || seenSceneIds.has(connection.sceneId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seenSceneIds.add(connection.sceneId);
|
||||
const targetScene = getScenePresetById(worldType, connection.sceneId);
|
||||
const targetSceneName =
|
||||
targetScene?.name ??
|
||||
connection.summary?.trim() ??
|
||||
connection.sceneId;
|
||||
|
||||
options.push(
|
||||
buildHostileNpcEscapeOption(
|
||||
character,
|
||||
`逃往${targetSceneName}`,
|
||||
{
|
||||
targetSceneId: connection.sceneId,
|
||||
escapeTargetSceneId: connection.sceneId,
|
||||
escapeEntry: 'from_left',
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
options.push(
|
||||
buildHostileNpcEscapeOption(
|
||||
character,
|
||||
'逃回当前场景起点',
|
||||
{
|
||||
targetSceneId: currentScene.id,
|
||||
escapeTargetSceneId: currentScene.id,
|
||||
escapeReturnToSceneStart: true,
|
||||
escapeEntry: 'from_left',
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return options.length > 0
|
||||
? options
|
||||
: [buildHostileNpcEscapeOption(character)];
|
||||
};
|
||||
|
||||
const buildHostileNpcFightOption = (encounter: Encounter): StoryOption => ({
|
||||
functionId: NPC_FIGHT_FUNCTION.id,
|
||||
actionText: '与他对战',
|
||||
@@ -1177,8 +1237,8 @@ export function createStoryNpcEncounterActions({
|
||||
return {
|
||||
text: declarationText,
|
||||
options: [
|
||||
buildHostileNpcEscapeOption(character),
|
||||
buildHostileNpcFightOption(encounter),
|
||||
...buildHostileNpcEscapeOptions(character),
|
||||
],
|
||||
displayMode: 'dialogue',
|
||||
dialogue: [
|
||||
@@ -1220,7 +1280,7 @@ export function createStoryNpcEncounterActions({
|
||||
actionText: '战斗',
|
||||
text: '战斗',
|
||||
},
|
||||
buildHostileNpcEscapeOption(character),
|
||||
...buildHostileNpcEscapeOptions(character),
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user