v0.1.5: 人物志(志向/渡劫/列传/契合/回声)

- 志向系统:七向(求道/镇族/承宗/商略/兵略/耕读/云游)成年礼自动定志,
  量化加成入修炼/战力/坊市/灵田/添丁/声望,云游减修但际遇更频
- 大境界渡劫:炼气→筑基起,晋升改走劫难事件三选——硬渡/请护法(100灵石)/
  压制来年;护法失败或受牵连;渡劫成败与心性、气血挂勾,高阶有小陨落率
- 灵根本命契合:功法元素×主灵根,契合者修炼+6%/战力+4%,详情页「本命」徽章
- 人物列传:自动列传生成器(生平/修行脉络/历险/姻缘/子嗣/大比/墓志铭),
  成员详情小传分页 + 春秋原列传长卷
- 四邻回声:每两年一桩——友好赠礼/敌视暗桩/中立传闻三态动态事件
- 修复:回声事件 npcId 解析错误、事件优先级(惯例>传闻)
- 测试 176→197(志向加成/契合/渡劫三轨/压制通道/列传结构/回声三态)
This commit is contained in:
Hermes Agent
2026-08-23 09:08:16 +08:00
parent 8152b5c4bc
commit 5b40d9158c
17 changed files with 791 additions and 7 deletions
+78
View File
@@ -0,0 +1,78 @@
import { GameState } from '../types/domain'
import { TECHNIQUES } from '../data/techniques'
import { describeRealm } from '../data/realms'
import { aspirationById } from '../data/aspirations'
import { postById } from '../data/posts'
export interface BioLine {
at?: number
label: string
text: string
}
export function buildBiography(s: GameState, memberId: string): BioLine[] {
const c = s.members[memberId]
if (!c) return []
const lines: BioLine[] = []
const tech = TECHNIQUES.find((t) => t.id === c.techniqueId)
const asp = aspirationById(c.aspiration)
const post = postById(c.post)
lines.push({
label: '生平',
text: `${c.name},第${c.generation}代子孙${c.gender === 'male' ? '男' : '女'},生于${c.bornYear}${
c.deathYear ? `,殁于${c.deathYear}年(${c.deathCause ?? '寿终'}` : ',今尚在世'
}${post ? `曾居族中「${post.name}」之位。` : ''}${asp ? `平生志向:${asp.name}` : ''}${
tech ? `主修《${tech.name}》。` : ''
}`
})
// 突破脉络
const breaks = s.chronicle.filter((e) => e.category === 'breakthrough' && e.memberId === c.id)
const trials = s.chronicle.filter((e) => e.text.includes(c.name) && (e.category === 'battle' || e.category === 'exploration'))
for (const e of breaks) {
lines.push({ at: e.year, label: '修行', text: `${e.year}${e.month}月,${e.text.replace(new RegExp(`^${c.name}\\s*`), '')}`})
}
if (trials.length > 0) {
lines.push({ at: trials[0].year, label: '历险', text: `${trials[0].year}年·${trials[0].text}` })
}
// 婚育
const marriages = s.chronicle.filter((e) => e.category === 'marriage' && e.memberId === c.id)
for (const m of marriages) {
lines.push({ at: m.year, label: '姻缘', text: m.text })
}
if (c.children.length > 0) {
const kids = c.children.map((id) => s.members[id]?.name ?? '?').join('、')
lines.push({ label: '子嗣', text: `抚育子女${c.children.length}人:${kids}` })
}
// 大比
const tourneys = s.stats.tourneyHistory.filter((t) => true).slice(-1)
const hisTourney = tourneys.filter((t) => {
const battle = s.battles.find((b) => b.year === t.year && b.title.includes('大比'))
return battle?.lines.some((l) => l.includes(c.name))
})
if (hisTourney.length > 0) {
lines.push({ at: hisTourney[0].year, label: '大比', text: `${hisTourney[0].year}年,随队参加太虚大比,列第${hisTourney[0].rank}名。` })
}
// 墓碑铭文
if (!c.alive) {
const epitaph = EPITAPH[c.deathCause ?? '寿终'] ?? '一尘一土,终归青山。'
lines.push({ label: '墓志', text: `${c.name}之墓。${epitaph}` })
}
return lines
}
const EPITAPH: Record<string, string> = {
寿: '一尘一土,终归青山。子孙焚香,岁岁在此。',
'寿元将尽': '一尘一土,终归青山。子孙焚香,岁岁在此。',
: '稚子长眠,天地垂爱。家人悬灯,常照归路。',
'伤势不治': '壮士折戟,魂兮归来。家祠之下,与祖同列。',
'突破走火': '一念求道,九死未悔。灵前法灯,为君长明。',
'渡劫陨落': '雷霆战天,其志未竟。遗骨归山,英风尚在。',
'战殁': '马革裹尸,归葬桑梓。长剑挂壁,子孙相传。',
'云游飞升': '此去云深不知处,魂同列宿游太虚。'
}