初始仓库迁移
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-04 23:57:06 +08:00
parent 80986b790d
commit c49c64896a
18446 changed files with 532435 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
import { CustomWorldProfile, WorldTemplateType, WorldType } from '../types';
export type CustomWorldThemeMode = 'martial' | 'arcane' | 'machina' | 'tide' | 'rift';
export function detectCustomWorldThemeMode(
profile: Pick<CustomWorldProfile, 'settingText' | 'summary' | 'tone' | 'playerGoal' | 'templateWorldType'>,
): CustomWorldThemeMode {
const source = `${profile.settingText} ${profile.summary} ${profile.tone} ${profile.playerGoal}`;
if (/[齿]/u.test(source)) return 'machina';
if (/[]/u.test(source)) return 'tide';
if (/[线]/u.test(source)) return 'rift';
if (/[]/u.test(source)) return 'arcane';
if (/[]/u.test(source)) return 'martial';
return profile.templateWorldType === WorldType.XIANXIA ? 'arcane' : 'martial';
}
export function resolveCustomWorldAnchorWorldType(
profile: Pick<CustomWorldProfile, 'settingText' | 'summary' | 'tone' | 'playerGoal' | 'templateWorldType'>,
): WorldTemplateType {
const themeMode = detectCustomWorldThemeMode(profile);
return themeMode === 'arcane' || themeMode === 'rift' ? WorldType.XIANXIA : WorldType.WUXIA;
}