1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-11 15:43:32 +08:00
parent f19e482c8f
commit 0981d6ee1b
78 changed files with 1102 additions and 8510 deletions

View File

@@ -710,7 +710,7 @@ function buildNpcVisualPrompt(
.filter(Boolean)
.join('\n');
return buildMasterPrompt(mergedBrief || '江湖风格角色,服装完整,姿态自然。');
return buildMasterPrompt(mergedBrief || '自定义世界角色,服装完整,姿态自然。');
}
function buildImageSequencePrompt(

View File

@@ -1,17 +0,0 @@
import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { buildCurrentGameStoryAuditMarkdown } from '../src/services/storyEngine/storyAuditReport.ts';
const defaultOutputPath = resolve(
process.cwd(),
'docs/audits/text/CURRENT_GAME_STORY_SOURCE_REVIEW_2026-04-07.md',
);
const outputPath = process.argv[2]
? resolve(process.cwd(), process.argv[2])
: defaultOutputPath;
mkdirSync(dirname(outputPath), { recursive: true });
writeFileSync(outputPath, buildCurrentGameStoryAuditMarkdown(), 'utf8');
console.log(`[story-audit] wrote ${outputPath}`);

View File

@@ -1,4 +1,4 @@
import { buildCompanionState, PRESET_CHARACTERS, resolveEncounterRecruitCharacter } from '../src/data/characterPresets.ts';
import { buildCompanionState, ROLE_TEMPLATE_CHARACTERS, resolveEncounterRecruitCharacter } from '../src/data/characterPresets.ts';
import { activateRosterCompanion, benchActiveCompanion, recruitCompanionToParty } from '../src/data/companionRoster.ts';
import { getInventoryItemValue, getNpcPurchasePrice } from '../src/data/economy.ts';
import {
@@ -37,7 +37,7 @@ function assert(condition: unknown, message: string): asserts condition {
}
function createBaseState(worldType: WorldType, sceneId?: string): GameState {
const playerCharacter = PRESET_CHARACTERS[0];
const playerCharacter = ROLE_TEMPLATE_CHARACTERS[0];
const currentScenePreset = sceneId
? getScenePresetsByWorld(worldType).find(scene => scene.id === sceneId) ?? null
: getScenePresetsByWorld(worldType)[0] ?? null;
@@ -114,7 +114,7 @@ function smokeNpcStories() {
context: sceneWithNpc.npcs[0].role,
xMeters: 3.2,
};
const playerCharacter = PRESET_CHARACTERS[0];
const playerCharacter = ROLE_TEMPLATE_CHARACTERS[0];
const npcState = buildInitialNpcState(encounter, worldType);
const story = buildNpcEncounterStoryMoment({
encounter,
@@ -216,7 +216,7 @@ function smokeObserveAndCallOut() {
function smokeInventoryUseLoop() {
for (const worldType of [WorldType.WUXIA, WorldType.XIANXIA]) {
const playerCharacter = PRESET_CHARACTERS[0];
const playerCharacter = ROLE_TEMPLATE_CHARACTERS[0];
const inventory = buildInitialPlayerInventory(playerCharacter, worldType);
const usableItem = inventory.find(item => isInventoryItemUsable(item));
assert(usableItem, `[inventory] missing usable starter item for ${worldType}`);
@@ -231,7 +231,7 @@ function smokeInventoryUseLoop() {
}
function smokeEquipmentLoop() {
const playerCharacter = PRESET_CHARACTERS[0];
const playerCharacter = ROLE_TEMPLATE_CHARACTERS[0];
const starterLoadout = buildInitialEquipmentLoadout(playerCharacter);
const starterBonuses = getEquipmentBonuses(starterLoadout);
@@ -261,7 +261,7 @@ function smokeTradeEconomyLoop() {
};
const npcState = buildInitialNpcState(encounter, worldType);
const npcItem = npcState.inventory[0];
const playerItem = buildInitialPlayerInventory(PRESET_CHARACTERS[0], worldType)[0];
const playerItem = buildInitialPlayerInventory(ROLE_TEMPLATE_CHARACTERS[0], worldType)[0];
assert(npcItem, `[trade] missing npc item for ${worldType}`);
assert(playerItem, `[trade] missing player item for ${worldType}`);
@@ -326,9 +326,9 @@ function smokeEncounterTransitionLoop() {
}
function smokeRosterLoop() {
const playerCharacter = PRESET_CHARACTERS[0];
const reserveCharacter = PRESET_CHARACTERS[1];
const recruitCharacter = PRESET_CHARACTERS[2];
const playerCharacter = ROLE_TEMPLATE_CHARACTERS[0];
const reserveCharacter = ROLE_TEMPLATE_CHARACTERS[1];
const recruitCharacter = ROLE_TEMPLATE_CHARACTERS[2];
const activeCompanion = buildCompanionState('active-npc', playerCharacter, 68);
const reserveCompanion = buildCompanionState('reserve-npc', reserveCharacter, 62);
const recruitedCompanion = buildCompanionState('new-npc', recruitCharacter, 72);

View File

@@ -1,4 +1,4 @@
import { getCharacterHomeSceneId, getCharacterNpcSceneIds, PRESET_CHARACTERS } from '../src/data/characterPresets.ts';
import { getCharacterHomeSceneId, getCharacterNpcSceneIds, ROLE_TEMPLATE_CHARACTERS } from '../src/data/characterPresets.ts';
import { MONSTER_PRESETS_BY_WORLD } from '../src/data/hostileNpcPresets.ts';
import { getSceneHostileNpcPresetIds, getScenePresetsByWorld } from '../src/data/scenePresets.ts';
import { buildStateFunctionDefinitions } from '../src/data/stateFunctions.ts';
@@ -45,7 +45,7 @@ function validateScenes(errors: string[]) {
}
npcIds.add(npc.id);
if (npc.characterId && !PRESET_CHARACTERS.some(character => character.id === npc.characterId)) {
if (npc.characterId && !ROLE_TEMPLATE_CHARACTERS.some(character => character.id === npc.characterId)) {
addError(errors, `[scene] ${scene.id} npc "${npc.id}" references unknown character "${npc.characterId}"`);
}
});
@@ -57,7 +57,7 @@ function validateCharacters(errors: string[]) {
for (const worldType of [WorldType.WUXIA, WorldType.XIANXIA]) {
const sceneIdSet = new Set(getScenePresetsByWorld(worldType).map(scene => scene.id));
PRESET_CHARACTERS.forEach(character => {
ROLE_TEMPLATE_CHARACTERS.forEach(character => {
const homeSceneId = getCharacterHomeSceneId(worldType, character.id);
if (homeSceneId && !sceneIdSet.has(homeSceneId)) {
addError(errors, `[character] ${character.id} homeSceneId "${homeSceneId}" not found in ${worldType}`);
@@ -110,7 +110,7 @@ function main() {
const monsterCount = MONSTER_PRESETS_BY_WORLD[WorldType.WUXIA].length + MONSTER_PRESETS_BY_WORLD[WorldType.XIANXIA].length;
const functionCount = buildStateFunctionDefinitions().length;
console.log(`Content validation passed. scenes=${sceneCount} monsters=${monsterCount} characters=${PRESET_CHARACTERS.length} functions=${functionCount}`);
console.log(`Content validation passed. scenes=${sceneCount} monsters=${monsterCount} characters=${ROLE_TEMPLATE_CHARACTERS.length} functions=${functionCount}`);
}
main();

View File

@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
import { readdirSync } from 'node:fs';
import path from 'node:path';
import { PRESET_CHARACTERS } from '../src/data/characterPresets.ts';
import { ROLE_TEMPLATE_CHARACTERS } from '../src/data/characterPresets.ts';
import { MONSTER_PRESETS_BY_WORLD } from '../src/data/hostileNpcPresets.ts';
import { buildItemCatalogId } from '../src/data/itemCatalog.ts';
import { getScenePresetsByWorld } from '../src/data/scenePresets.ts';
@@ -34,7 +34,7 @@ function validateCharacterOverrides(errors: string[]) {
const overrides = readJsonFile<Record<string, unknown>>('src/data/characterOverrides.json');
if (!expectPlainObject(errors, 'characterOverrides', overrides)) return;
const characterIds = new Set(PRESET_CHARACTERS.map(character => character.id));
const characterIds = new Set(ROLE_TEMPLATE_CHARACTERS.map(character => character.id));
const sceneIds = new Set(
[WorldType.WUXIA, WorldType.XIANXIA].flatMap(worldType => getScenePresetsByWorld(worldType).map(scene => scene.id)),
);
@@ -142,7 +142,7 @@ function validateSceneNpcOverrides(errors: string[]) {
getScenePresetsByWorld(worldType).flatMap(scene => scene.npcs.map(npc => npc.id)),
),
);
const characterIds = new Set(PRESET_CHARACTERS.map(character => character.id));
const characterIds = new Set(ROLE_TEMPLATE_CHARACTERS.map(character => character.id));
Object.entries(overrides).forEach(([npcId, override]) => {
if (!npcIds.has(npcId)) {