Files
ChronicleOfTheImmortalClan/tests/clock.test.ts
T
thzxx bce50b6e2b v0.1.33a: 物品闭环——符箓生效/幽灵物归位/灾年接入
【符箓闭环】talismanWarPrep 返回类型,开战消耗 1 张;风符全队×1.12/山符×1.15+受创减半(零 rng)
【符箓坊】建筑耗符纸×2+灵木×2/级,月造风符1枚;坊3级另出山符(消耗式零 rng)
【幽灵物品归位】and灵丹/虚元丹/玉澜刃补 ITEMS 定义(含 icon/价格/战力)+craftPill/forgeArtifact union 扩键+ARTIFACT_POWER 补玉澜刃 0.4
【灾年生效】farmFactor/mineFactor 从算而未用→真正乘入灵田/药园/矿场/灵果/木坊产量(旱灾×0.7等)
【金钟罩】0.1.33 基线重算(符箓/灾年/新丹受控变更),RAW+RES 共 18 值
【测试】+3(economy-loop-0.1.33 闭环矩阵) 全绿
2026-08-23 21:31:19 +08:00

57 lines
2.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { stateFingerprint, longRun } from './fingerprint.helper'
import { World } from '../src/renderer/game/engine/runtime/World'
/**
* 金钟罩:固定种子长跑 560 月的状态指纹。
* 任何改动(重构日程/调平衡/加系统)若改变了确定性序列或结果,此测试立刻报红。
* 更新规则:仅当**有意**变更序列逻辑时,三枚 seed 指纹同版更新并注明原因。
*/
// 0.1.33 闭环·止血基线:符箓开战生效(战力乘量+山符减伤)/灾年因子真正接入/
// 幽灵物品归位(新丹方/玉澜刃)+ 符箓坊(消耗式产符)后固化。
const GOLDEN: Record<string, Record<number, string>> = {
'bell-seed-1': { 560: '0a76a33f', 1200: 'c9407e76', 2160: '4bc550bd' },
'bell-seed-2': { 560: 'b1b4d35b', 1200: 'fcc6e262', 2160: '1af450b7' },
'bell-seed-3': { 560: '03184a16', 1200: 'c73bb4b1', 2160: 'fca9a59f' }
}
/** 第二金钟罩:自动 resolve 长跑("现实"世界——每 tick 处理待决事件;
* 锁事件闸/事件流全程,防"冻结世界"指纹漏锁)。 */
const GOLDEN_RESOLVED: Record<string, Record<number, string>> = {
'bell-seed-1': { 560: '4b0f1f81', 1200: '430d6281', 2160: 'ba0d3816' },
'bell-seed-2': { 560: '8865b178', 1200: 'bba0d797', 2160: '6205c6f1' },
'bell-seed-3': { 560: 'fa736e3c', 1200: '819b9def', 2160: 'a624ced8' }
}
const TIERS = [
[560, '47 年(4 个十年)'],
[1200, '100 年'],
[2160, '180 年']
] as const
describe('金钟罩 · 长跑确定性指纹(三档:47/100/180 年)', () => {
for (const [seed, tiers] of Object.entries(GOLDEN)) {
for (const [months, label] of TIERS) {
it(`${seed} ${label}指纹 === ${tiers[months]}`, () => {
const w = run(seed, months)
expect(stateFingerprint(w.state)).toBe(tiers[months])
})
}
}
it('同 seed 两次长跑指纹一致(无状态污染)', () => {
const a = stateFingerprint(longRun('bell-seed-1').state)
const b = stateFingerprint(longRun('bell-seed-1').state)
expect(a).toBe(b)
})
})
function run(seed: string, months: number): ReturnType<typeof longRun> {
const w = World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' })
for (let i = 0; i < months; i++) {
if (w.state.gameOver) break
w.advanceMonth()
}
return w
}