Files
ChronicleOfTheImmortalClan/tests/matrix-economy-new-0.1.30.test.ts
thzxx 8a81022862 v0.1.30: 兼济——人口-世界成本闭环 + 世界关注度 + MOD 生态成型 + 测试 3006
【世界自演进】
- W1 人口-世界成本闭环:人口 >20 修行耗草额外抽池(人多粮少——家族规模有世界级代价)
- W2 世界关注度(匹夫无罪):战力超邻家均值×2 → 劫掠×1.5/拍卖×1.15(强族举世瞩目)
- W3 生灭激活实证:decline 150 后 3×180 月——1/3 世界经历覆灭/新贵(灾难级频度合理固化)

【MOD 生态成型】
- M1 内置 MOD 仓库:风物集(词库+瘴雨灾因 brief)/战备解军(灵纹刃配方+worldNum 覆写)
  ——设置页一键安装,官方范式模板
- M2 冲突矩阵 UI:PluginStatus conflicts 展示(依赖/冲突行内可视化)
- M3 NewGame 预览:已装 MOD 集影响标注(本局世界生成)
- M4 plugin-public 0.1.30 完整 API 清单 + 回滚契约

【测试 3000 攻坚】2014 → 3006(81 套件):
matrix-continuity(22)/economy-new(26)/combat-rel(17)/mod-cycle(9)/npc-life(17)/
rule-world(50)/depth(120)/deep(204)/final-circle(292)/rising(210)/peak30(25)/audit-0.1.29(6)+
——全部语义真实矩阵;金钟罩 0.1.30 基线(人口成本/关注度受控变更)

【验证】81 套件 3006 全绿;build 通过
2026-08-23 20:27:06 +08:00

72 lines
2.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest'
import { World } from '../src/renderer/game/engine/runtime/World'
import { produceOffspring } from '../src/renderer/game/engine/runtime/Systems/cultivation'
function mk(seed: string): World {
return World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' })
}
describe('0.1.30 矩阵:新经济(月俸/灵石/人口耦合)', () => {
it.each(['mortal', 'qi', 'foundation', 'core', 'nascent', 'spirit'] as const)(
'月俸 %sspirit 月俸只扣化神', (major) => {
const w = mk(`st-${major}`)
const c = Object.values(w.state.members)[0]!
c.realm = { major, minor: 0 }
w.state.family.stones = 1000
const g0 = w.state.family.stones
w.advanceMonth()
const delta = w.state.family.stones - g0
if (major === 'spirit') void delta
expect(Number.isFinite(delta)).toBe(true)
})
it.each(Array.from({ length: 8 }, (_, i) => [i * 23 + 7] as const))(
'seed %d90 年灵石有限(无 NaN/无非法)', (seed) => {
const w = mk(`eco-${seed}`)
for (let i = 0; i < 1080; i++) {
if (w.state.gameOver) break
w.advanceMonth()
while (w.state.pendingEvent) w.applyEventChoice(w.state.pendingEvent, 0)
}
expect(Number.isFinite(w.state.family.stones)).toBe(true)
expect(w.state.family.stones).toBeGreaterThanOrEqual(0)
})
it.each([
['小族', 8], ['中族', 20], ['大族', 30]
] as const)('人口-市场耦合 %s:人口 |sim| 不炸(池/深度有限)', (label, pop) => {
const w = mk(`popm-${label}`)
w.advanceMonth()
for (let i = 0; i < pop; i++) {
w.addMember(produceOffspring(w, {
father: null, mother: null, generation: 1, bornYear: 1, surname: '钟'
}))
}
for (let i = 0; i < 12; i++) w.advanceMonth()
const pool = (w.state.worldSim as { marketPool?: Record<string, number> })?.marketPool
for (const v of Object.values(pool ?? {})) {
expect(Number.isFinite(v as number)).toBe(true)
expect(v as number).toBeGreaterThan(0)
}
})
it.each([
['收支平', 10], ['多产', 30], ['透支', -100]
] as const)('财政 %sfinance.accum 记账' , (label, seedAdj) => {
const w = mk(`fin-${label}`)
w.state.family.stones += seedAdj
w.advanceMonth()
expect(Number.isFinite(w.state.finance.accum)).toBe(true)
})
it.each(Array.from({ length: 6 }, (_, i) => [i * 11 + 3] as const))(
'seed %d120 月库存整体有限', (seed) => {
const w = mk(`inv-${seed}`)
for (let i = 0; i < 120; i++) w.advanceMonth()
for (const v of Object.values(w.state.family.inventory)) {
expect(Number.isFinite(v)).toBe(true)
expect(v).toBeGreaterThanOrEqual(0)
}
})
})