v0.1.3: 深度审计修复(兼容/血缘/联姻/远征/数值)

- 旧档兼容:<0.1.1 存档缺 finance/yearStats/yearlyReports 字段加载归一化(防运行期崩溃)
- 血缘防护:同母异父兄妹也禁止婚配(指婚/媒人/联姻三路齐封)
- 联姻修正:一家一姻亲(allied 锁),再娶再嫁不再无限刷;男儿娶亲也子孙来归
- 和约语义:议和强推关系至 +30(真停战),不再打完一场还是仇雠
- 远征收队:任务完成/召回自动释放队员闲居;重伤者当月离队疗伤、不足定员提前撤队(修复人员永久困远征/卡状态)
- 数值:婴儿夭折率 2%→0.8%;劫掠队强度 0.9→0.78;事件负资源钳制不为负灵石
- UI:丹药按钮显示持有并禁点;点将模式支持取消重选;设置页移除摆设项
- 新增 audit 套件:8 项(含 600 月长跑耐力)总测试 38→46 全绿
This commit is contained in:
Hermes Agent
2026-08-23 08:34:13 +08:00
parent 839adc24a6
commit 4d52f472c7
14 changed files with 242 additions and 52 deletions
@@ -48,7 +48,7 @@ export function makePeace(w: World, npcId: string): boolean {
const npc = w.state.npcFamilies[npcId]
if (fam.stones < 200) return false
fam.stones -= 200
npc.relation = Math.max(npc.relation + 35, 0)
npc.relation = Math.max(npc.relation + 35, 30)
w.chronicle('diplomacy', `${npc.name}立下和约,两家罢兵互市。`, undefined, true)
w.log('good', `${npc.name}言和。`)
return true
@@ -58,16 +58,18 @@ export function marryNpcFamily(w: World, npcId: string): boolean {
const s = w.state
const fam = s.family
const npc = s.npcFamilies[npcId]
if (!npc || npc.relation < 25) return false
if (!npc || npc.relation < 25 || npc.allied) return false
const eligible = w
.aliveMembers()
.filter((c) => w.ageOf(c) >= 18 && w.ageOf(c) <= 42 && c.state !== 'expedition')
.filter((c) => w.ageOf(c) >= 16 && w.ageOf(c) <= 46 && c.state !== 'expedition')
.filter((c) => !c.spouseId)
if (eligible.length === 0) return false
const npcDef = npcById(npcId)
const candidate = w.rng.pick(eligible)
candidate.spouseHouse = npc.name
npc.relation += 20
npc.allied = true
npc.alliedSinceYear = s.year
fam.reputation += 4
w.chronicle('marriage', `${candidate.name}${npc.name}联姻,两家绸缪通好。`, candidate.id, true)
w.log('good', `${candidate.name}${npc.name}联姻成功!每年或降麟儿。`)
@@ -80,6 +82,7 @@ export function arrangeWedding(w: World, aId: string, bId: string): boolean {
if (!a.alive || !b.alive || a.spouseId || b.spouseId) return false
if (a.gender === b.gender) return false
if (a.fatherId === b.fatherId && a.fatherId) return false
if (a.motherId === b.motherId && a.motherId) return false
a.spouseId = b.id
b.spouseId = a.id
const aAge = w.ageOf(a)