Files
ChronicleOfTheImmortalClan/tests/matrix-data-tables-0.1.27.test.ts
thzxx 4dfa07cc9f v0.1.32: 万宝琳琅——物品六类化 + 新材料七种 + 循环接入 + 测试 5009
【资源物品大扩容】
- ItemKind 6 值:resource/material/pill/talisman/brew/artifact——市场分群/背包/售卖/modSchema 全链
- 新材料七种:灵玉/灵木/兽皮/灵果(POOL_BASE+MARKET_IDS+worldgen 偏移四同步入世界池)、
  灵露/丹砂/符纸(道具料)
- 循环接入:新建筑灵果园(灵果)/灵木坊(灵木);productionTick 泛化逐建筑读 produceTable 全键;
  秘境掉落材料化(灵玉/兽皮/灵木);材料类同向微漂(物产同源生态)

【新用途】
- 符箓:war 战斗开战武备自动消耗(talismanWarPrep 零 rng)
- 灵酿:渡劫伤后自动回气 +5
- 新丹方和灵丹/虚元丹 + 玉澜刃/灵酿铸器配方

【测试 5009】86 套件(+1000:matrix-treasure-a/b 950 + 断链修整);
【金钟罩】0.1.32 基线重算(物品/池/生产泛化受控变更);build 通过
2026-08-23 21:05:03 +08:00

110 lines
4.1 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 { ITEMS } from '../src/renderer/game/data/items'
import { TECHNIQUES } from '../src/renderer/game/data/techniques'
import { BUILDINGS } from '../src/renderer/game/data/buildings'
import { POSTS } from '../src/renderer/game/data/posts'
import { TRAITS } from '../src/renderer/game/data/traits'
import { ASPIRATIONS } from '../src/renderer/game/data/aspirations'
import { FORMATIONS } from '../src/renderer/game/data/formations'
import { SEASON } from '../src/renderer/game/data/season'
import { ROOT_GRADES } from '../src/renderer/game/data/elements'
import { MAJORS } from '../src/renderer/game/data/realms'
describe('矩阵:物品表全量', () => {
it.each(Object.values(ITEMS))('%s:三件套字段合法', (item) => {
expect(item.id.length).toBeGreaterThan(0)
expect(['resource', 'material', 'pill', 'talisman', 'brew', 'artifact']).toContain(item.kind)
expect(item.basePrice).toBeGreaterThan(0)
expect(item.icon.length).toBeGreaterThan(0)
expect(item.name.length).toBeGreaterThan(0)
})
it.each(Object.values(ITEMS))('%s:描述非空', (item) => {
expect(item.desc.length).toBeGreaterThan(2)
})
})
describe('矩阵:功法表全量', () => {
it.each(TECHNIQUES)('%s:五元组合法', (t) => {
expect(t.grade).toBeGreaterThanOrEqual(1)
expect(t.grade).toBeLessThanOrEqual(4)
expect(t.expBonus).toBeGreaterThan(0)
expect(t.powerBonus).toBeGreaterThan(0)
expect(['木', '金', '水', '火', '土', '雷']).toContain(t.element)
expect(t.path.length).toBeGreaterThan(0)
})
})
describe('矩阵:建筑表全量', () => {
it.each(Object.values(BUILDINGS))('%s:配置合法', (b) => {
expect(['produce', 'function']).toContain(b.kind)
expect(b.maxLevel).toBeGreaterThanOrEqual(1)
expect(b.maxLevel).toBeLessThanOrEqual(6)
expect(b.desc.length).toBeGreaterThan(0)
expect(b.icon.length).toBeGreaterThan(0)
const cost1 = b.upgradeCost(1)
expect(cost1.stones).toBeGreaterThan(0)
expect(cost1.lingkuang).toBeGreaterThanOrEqual(0)
})
})
describe('矩阵:职事表全量', () => {
it.each(Object.values(POSTS))('%s:效果与上限合法', (p) => {
expect(p.max).toBeGreaterThan(0)
expect(p.desc.length).toBeGreaterThan(0)
expect(p.effect).toBeTruthy()
})
})
describe('矩阵:性格表全量', () => {
it.each(Object.values(TRAITS))('%s:特质元组合法', (t) => {
expect(t.name.length).toBeGreaterThan(0)
expect(t.desc.length).toBeGreaterThan(2)
void t
})
})
describe('矩阵:志向表全量', () => {
it.each(Object.values(ASPIRATIONS))('%s:效果形状合法', (a) => {
expect(a.name.length).toBeGreaterThan(0)
expect(a.effect).toBeTruthy()
})
})
describe('矩阵:阵型表全量', () => {
it.each(Object.entries(FORMATIONS).map(([id, f]) => ({ id, f })))('%s:攻防系数正', ({ id, f }) => {
expect(f.atk).toBeGreaterThan(0.5)
expect(f.def).toBeGreaterThan(0.5)
expect(f.retreatWound).toBeGreaterThanOrEqual(0)
expect(f.name.length).toBeGreaterThan(0)
})
})
describe('矩阵:灵根表全量', () => {
it.each(Object.entries(ROOT_GRADES).map(([id, g]) => ({ id, g })))('%sexpBonus 正', ({ id, g }) => {
expect(g.expBonus).toBeGreaterThan(0)
expect(id.length).toBeGreaterThan(0)
})
})
describe('矩阵:境界表全量', () => {
it.each(Object.entries(MAJORS).map(([id, m]) => ({ id, m })))('%s:寿命与层数合法', ({ id, m }) => {
expect(m.lifespan).toBeGreaterThan(0)
expect(m.minorLayers).toBeGreaterThanOrEqual(0)
expect(typeof m.name).toBe('string')
expect(id.length).toBeGreaterThan(0)
})
})
describe('矩阵:季节表全量', () => {
it.each(Object.entries(SEASON).map(([id, s]) => ({ id, s })))('%s:四乘子区间合法', ({ id, s }) => {
expect(['spring', 'summer', 'autumn', 'winter']).toContain(id)
expect(s.field).toBeGreaterThanOrEqual(-0.3)
expect(s.field).toBeLessThanOrEqual(0.3)
expect(s.cult).toBeGreaterThanOrEqual(-0.3)
expect(s.cult).toBeLessThanOrEqual(0.3)
expect(s.market).toBeGreaterThanOrEqual(-0.3)
expect(s.market).toBeLessThanOrEqual(0.3)
})
})