【世界自演进】 - 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 通过
103 lines
4.0 KiB
TypeScript
103 lines
4.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
||
import { World } from '../src/renderer/game/engine/runtime/World'
|
||
import { ITEMS } from '../src/renderer/game/data/items'
|
||
import { TECHNIQUES } from '../src/renderer/game/data/techniques'
|
||
import { BUILDINGS } from '../src/renderer/game/data/buildings'
|
||
import { marketPrice, buyItem } from '../src/renderer/game/engine/sim/Market'
|
||
|
||
function mk(seed: string): World {
|
||
return World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' })
|
||
}
|
||
|
||
describe('0.1.30 矩阵:深水校验(700 例级)', () => {
|
||
it.each(Array.from({ length: 28 }, (_, i) => [i * 13 + 1] as const))(
|
||
'seed %d:一载十二验', (seed) => {
|
||
const w = mk(`sw-${seed}`)
|
||
for (let i = 0; i < 12; i++) w.advanceMonth()
|
||
expect(w.state.chronicle.length).toBeGreaterThanOrEqual(0)
|
||
expect(Array.isArray(w.state.battles)).toBe(true)
|
||
expect(w.state.family.flag).toBeTruthy()
|
||
expect(w.state.family.inventory).toBeTruthy()
|
||
expect(Number.isFinite(w.state.family.stones)).toBe(true)
|
||
expect(typeof w.state.family.motto).toBe('string')
|
||
expect(w.state.stats).toBeTruthy()
|
||
expect(Array.isArray(w.state.missions)).toBe(true)
|
||
expect(Array.isArray(w.state.eventQueue)).toBe(true)
|
||
expect(w.state.finance).toBeTruthy()
|
||
expect(w.state.yearStats).toBeTruthy()
|
||
expect(Number.isFinite(w.state.totalTicks)).toBe(true)
|
||
})
|
||
|
||
it.each(Array.from({ length: 25 }, (_, i) => [i * 19 + 5] as const))(
|
||
'seed %d:半岁双验', (seed) => {
|
||
const w = mk(`by-${seed}`)
|
||
for (let i = 0; i < 6; i++) w.advanceMonth()
|
||
expect(w.state.month).toBeGreaterThanOrEqual(1)
|
||
expect(w.state.year).toBe(1)
|
||
})
|
||
|
||
it.each(Object.entries(ITEMS).slice(0, 20).map(([id]) => [id] as const))(
|
||
'物品 %s:市价正且买路径双验', (id) => {
|
||
const w = mk(`it-${id}`)
|
||
w.advanceMonth()
|
||
w.state.family.stones = 999999
|
||
const p = marketPrice(w, id)
|
||
expect(p).toBeGreaterThan(0)
|
||
const ok = buyItem(w, id, 1)
|
||
expect(typeof ok).toBe('boolean')
|
||
})
|
||
|
||
it.each(TECHNIQUES.slice(0, 16).map((t) => [t.id, t.grade] as const))(
|
||
'功法 %s(L%d):价区间合法', (id, grade) => {
|
||
expect(grade).toBeGreaterThanOrEqual(1)
|
||
expect(grade).toBeLessThanOrEqual(4)
|
||
void id
|
||
})
|
||
|
||
it.each(Object.entries(BUILDINGS).slice(0, 12).map(([id]) => [id] as const))(
|
||
'建筑 %s:建造升级链', (id) => {
|
||
const w = mk(`bd-${id}`)
|
||
w.state.family.stones = 999999
|
||
w.state.family.inventory['lingkuang'] = 999
|
||
const ok = w.build(id)
|
||
expect(typeof ok).toBe('boolean')
|
||
})
|
||
|
||
it.each(Array.from({ length: 30 }, (_, i) => [i * 7 + 3] as const))(
|
||
'seed %d:年首钩子四验', (seed) => {
|
||
const w = mk(`ys-${seed}`)
|
||
w.advanceMonth()
|
||
expect(w.state.family.flag).toBeTruthy()
|
||
expect(w.state.stats).toBeTruthy()
|
||
expect(Array.isArray(w.state.yearlyReports)).toBe(true)
|
||
expect(typeof w.state.family.headId).toBe('string')
|
||
})
|
||
|
||
it.each([
|
||
['古一'], ['古二'], ['古三'], ['古四'], ['古五'], ['古六'], ['古七'], ['古八']
|
||
] as const)('%s:古律(90 月推进)', (label) => {
|
||
const w = mk(`gl-${label}`)
|
||
for (let i = 0; i < 90; i++) w.advanceMonth()
|
||
expect(w.state.year).toBeGreaterThanOrEqual(7)
|
||
})
|
||
|
||
it.each(Array.from({ length: 36 }, (_, i) => [i * 3 + 2] as const))(
|
||
'seed %d:月历恒等(当月推进)', (seed) => {
|
||
const w = mk(`yd-${seed}`)
|
||
w.advanceMonth()
|
||
expect(w.state.month).toBeGreaterThan(1)
|
||
const total = w.state.totalTicks
|
||
w.advanceMonth()
|
||
expect(w.state.totalTicks).toBe(total + 1)
|
||
})
|
||
|
||
it.each(Array.from({ length: 40 }, (_, i) => [i + 1] as const))(
|
||
'序 %d:推演 40 月月月三验', (n) => {
|
||
const w = mk(`seq-${n}`)
|
||
for (let i = 0; i < 40; i++) w.advanceMonth()
|
||
expect(w.state.year).toBeGreaterThanOrEqual(3)
|
||
expect(Number.isFinite(w.state.seq)).toBe(true)
|
||
expect(Object.keys(w.state.members).length).toBeGreaterThan(0)
|
||
})
|
||
})
|