v0.1.20: 万世无谬(第二轮全量审计歼灭,1011 测试+双金钟罩)
【事件闸(机制重锤)】 - fire(w,id,priority):单闸+优先级——高优(raid/渡劫/大比)顶替被占者、被顶替入 eventQueue 下月兑现不丢失;普通被占返回 false 调用方冷却(raid 被吞也写 CD) - pending 唯一写入入口:渡劫/破境丹改走 fire(防覆盖丢弃);名宿传薪年锚 flag(防同年重复 12 次) - applyEventChoice 前置校验 pendingEvent===id(陈旧 Modal 二次结算防线) 【世界模型四修(真·活世界)】 - era 延续档:flow 权重和<1(留白=续任)——盛世能撑 30 年而非固定 25 - 潮汐供给符号修正:灵涨万物丰(原实现反了)+tide 双界 clamp - driftMarket 弱锚定:rebalance 0.1→0.025——供需/era/灾年真实撬动价格(原五池被锚死±5%) - 断供/池底单常量 poolFloorPct=0.35(消灭禁买暗雷带) 【知识防线(审计虫洞修复)】 - 指纹扩展:era/stance/prosperity/relationsWithOthers/calamityLeft/pendingEvent 全入 hash - 第二金钟罩 GOLDEN_RESOLVED:自动 resolve 长跑锁“现实”世界(原指纹锁的只是“事件流冻结”世界) 【性能与存储】 - 存档节流(疾12/常6/缓4,手动即时)+ saveChronicle O(N)→O(1) 单查增量写(2160 月档告别每 tick 数千 OPFS) - battles≤220/chronicle≤520 截断(stringify 线性膨胀止血);startNewGame/openState 停 timer 摘旧 bus 【杂项】actDirect 对齐 ACT_CATALOG 全 24 项;about 三版本统一 0.1.20;kernel.bus 死总线删;seed 改 RngHub.rollSeed;normalize 补 eraStartYear/overflux/distress;WorldPanel 买卖条件反转修复;音效与视效同闸 【测试】1011 全绿(42 套件):audit-0.1.20 9 例(事件闸/传薪/二次结算/era延续/潮汐符号/断供一致/弱锚定/指纹敏感)
This commit is contained in:
@@ -13,7 +13,7 @@ export class WorldSim {
|
||||
|
||||
private s(): WorldSimState {
|
||||
const w = this.w
|
||||
if (!w.state.worldSim) w.state.worldSim = initSim(w) as never
|
||||
if (!w.state.worldSim) w.state.worldSim = initSim(w)
|
||||
const ws = w.state.worldSim as WorldSimState
|
||||
if (!ws.secretQi || Object.keys(ws.secretQi).length === 0) {
|
||||
const defs = pack().missions
|
||||
@@ -30,7 +30,11 @@ export class WorldSim {
|
||||
s.tideTicks++
|
||||
const phase = (s.tideTicks % WORLDSIM.tideCycle) / WORLDSIM.tideCycle
|
||||
const sine = 0.5 + 0.5 * Math.sin(phase * Math.PI * 2)
|
||||
s.tide = Math.min(WORLDSIM.tideMax, WORLDSIM.tideMin + sine * (WORLDSIM.tideMax - WORLDSIM.tideMin) + ERA_CONF[s.era ?? 'pingshi'].tideBias)
|
||||
s.tide = clamp(
|
||||
WORLDSIM.tideMin + sine * (WORLDSIM.tideMax - WORLDSIM.tideMin) + ERA_CONF[s.era ?? 'pingshi'].tideBias,
|
||||
WORLDSIM.tideMin - 0.05,
|
||||
WORLDSIM.tideMax + 0.05
|
||||
)
|
||||
|
||||
// 秘境灵气(自动恢复 + 探索消耗由 missions 在探索时扣;灾年灵脉闭锁 0.5 恢复)
|
||||
const qiRecover = s.calamity ? WORLDSIM.secretRecover * 0.5 : s.tide > 0.85 ? WORLDSIM.secretRecoverHi : WORLDSIM.secretRecover
|
||||
@@ -47,6 +51,7 @@ export class WorldSim {
|
||||
const flow = ERA_CONF[curEra].flow
|
||||
const roll = rng.next()
|
||||
let acc = 0
|
||||
let moved = false
|
||||
for (const [next, wgt] of flow) {
|
||||
acc += wgt
|
||||
if (roll < acc) {
|
||||
@@ -58,9 +63,12 @@ export class WorldSim {
|
||||
year: this.w.state.year, month: 1, src: '天道',
|
||||
text: `世道更替:${conf.name}来临。${conf.desc}`, kind: 'calamity'
|
||||
})
|
||||
moved = true
|
||||
break
|
||||
}
|
||||
}
|
||||
void moved
|
||||
// roll 落在 flow 权重之外 → 延续本届(era 有厚度)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +120,12 @@ export class WorldSim {
|
||||
// ---- B. NPC 演化(换代 + 关系网 + 互攻;B7) ----
|
||||
evolveNpc(this.w, s, rng.next())
|
||||
|
||||
// ---- D1.5 盟友求援时效(18 月自清) ----
|
||||
if (s.distress) {
|
||||
const distAge = (this.w.state.year - s.distress.year) * 12 + (this.w.state.month - s.distress.month)
|
||||
if (distAge > 18 && !this.w.state.npcFamilies[s.distress.id]?.allied) s.distress = undefined
|
||||
}
|
||||
|
||||
// ---- D2. 天下十年一鉴(史官综述) ----
|
||||
if (this.w.state.month === 1 && this.w.state.year % 10 === 0) {
|
||||
s.newsFeed.push({ year: this.w.state.year, month: 1, src: '史官', text: decadeChronicle(s, this.w.state.year), kind: 'annal' })
|
||||
@@ -218,7 +232,8 @@ function empty(): WorldSimState {
|
||||
function worldBreath(w: World, s: WorldSimState): void {
|
||||
const tide = s.tide
|
||||
const era = ERA_CONF[s.era ?? 'pingshi']
|
||||
const span = 1 - (tide - 1) * WORLDSIM.tideSupplySpan
|
||||
// 潮汐供给:灵涨万物丰(tide>1 供给×1.3、灵衰×0.7)——0.1.19 符号反转修复
|
||||
const span = 1 + (tide - 1) * WORLDSIM.tideSupplySpan
|
||||
const supplySpan = Math.max(0.75, Math.min(1.35, span))
|
||||
const eraSupply = era.supplyMult
|
||||
const eraDemand = era.demandMult
|
||||
@@ -293,11 +308,11 @@ function driftMarket(s: WorldSimState, noise: number): void {
|
||||
const per = n; n += 0.13
|
||||
const base = poolBase(id)
|
||||
const cur = s.marketPool[id] ?? base
|
||||
// 向基准再平衡 + 噪声漂移(价格弹性)
|
||||
// 向基准再平衡(弱化锚定:让供需流与 era 真正撬动价格)+ 噪声漂移(价格弹性)
|
||||
const rebalance = (base - cur) * WORLDSIM.marketRebalance
|
||||
const drift = ((per % 1) - 0.5) * WORLDSIM.marketDriftRate * base
|
||||
|
||||
s.marketPool[id] = Math.max(base * 0.3, cur + rebalance + drift)
|
||||
s.marketPool[id] = Math.max(base * WORLDSIM.poolFloorPct, cur + rebalance + drift)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +509,7 @@ function decadeChronicle(s: WorldSimState, year: number): string {
|
||||
const from = year - 9
|
||||
const rows = s.newsFeed.filter((r) => r.year >= from && r.year < year)
|
||||
const calamities = rows.filter((r) => r.kind === 'calamity' && r.text.includes('灾')).length
|
||||
const successions = rows.filter((r) => r.kind === 'npc').length
|
||||
const successions = rows.filter((r) => r.kind === 'npc' && !r.text.includes('态度')).length
|
||||
const quotes = rows.filter((r) => r.kind === 'quote').length
|
||||
const era = ERA_CONF[s.era ?? 'pingshi'].name
|
||||
const tideAvg = s.tide
|
||||
|
||||
Reference in New Issue
Block a user