v0.1.34a: 功法万象+世界自演化——流派效果/元素时节/悟位大成/战争疲劳/换代半衰/断供应急/新秘境
【功法】TechniqueDef 新增 critChance/guardBonus/tribBonus/secretBonus(optional 零漂); 6 部新功法(玄冰凝甲/紫电惊雷/丹鼎护道/风遁青冥/山灵镇岳/澜海听涛); 季节元素共鸣(春木夏火秋金冬水——修炼额外×1.04);演武场联动悟位积累;悟位2大成战斗效果倍增 【世界】warFatigue 互攻累积→世界温度冷降→乱世加速(打不动即荒年); NpcDyn 换代恩义清(关系网向零收敛×0.5);断供应急(连续3月池深<70%→广播+价×1.5); 新秘境灵机(年首几率·乱世×2·模板化生成 addMission 扩展口);addMission 公共口(secrets.ts) 【修复】shortage 广播模块级全局污染→世界状态化(多世界确定性恢复) 【测试】world 确定性恢复绿;金钟罩预期漂移(换代/共鸣/warFatigue)——0.1.34 基线待重算
This commit is contained in:
@@ -4,6 +4,7 @@ import { WorldSimState, NpcDynamics, WORLDSIM, ERA_CONF, makeWorldSimState, NpcS
|
||||
import { pack } from '../../data/registry'
|
||||
import { ITEMS } from '../../data/items'
|
||||
import { npcById, getNpcDefs, registerNpcDef, unregisterNpcDef } from '../../data/npcs'
|
||||
import { allMissions, addMission, WONDER_TEMPLATES, type MissionDef } from '../../data/secrets'
|
||||
import { MAJORS, MAJOR_ORDER } from '../../data/realms'
|
||||
|
||||
const MARKET_IDS = ['lingcao', 'lingkuang', 'beastcore', 'lingyu', 'lingmu', 'shoupi', 'lingguo', 'pill-qiyuan', 'pill-ningyuan']
|
||||
@@ -16,7 +17,7 @@ export class WorldSim {
|
||||
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
|
||||
const defs = allMissions()
|
||||
ws.secretQi = {}
|
||||
for (const m of defs) ws.secretQi[m.id] = 50
|
||||
}
|
||||
@@ -127,7 +128,25 @@ export class WorldSim {
|
||||
// ---- A. 资源循环市场(世界供给/需求 + NPC 上桌 + 再平衡) ----
|
||||
worldBreath(this.w, s) // A2+A3:常驻供给与需求(潮汐乘化)
|
||||
npcTrade(this.w, s, rng.next()) // A4:NPC 按 sells/buys 与池交易
|
||||
driftMarket(s, rng.next()) // 波动项(保留噪声弹性)
|
||||
driftMarket(s, rng.next(), this.w) // 波动项(保留噪声弹性)
|
||||
|
||||
// ---- B0. 新秘境灵机(0.1.34 万象归元:年首机率——乱世×2) ----
|
||||
if (this.w.state.month === 1) {
|
||||
const era2 = s.era === 'luanshi' ? 2 : 1
|
||||
if (rng.chance(worldNum('newSecretChance') * era2)) {
|
||||
const tpl = rng.pick(WONDER_TEMPLATES)
|
||||
const seedS = rng.int(1000, 9999)
|
||||
const def: MissionDef = {
|
||||
...tpl,
|
||||
id: `m-wonder-${seedS}`,
|
||||
name: `${tpl.icon}地灵诏——「${'古幽玄凌'}${rng.int(1, 9)}」`
|
||||
}
|
||||
addMission(def)
|
||||
s.secretQi[def.id] = Math.max(50, s.secretQi[def.id] ?? 50)
|
||||
s.newsFeed.push({ year: this.w.state.year, month: 1, src: '天机', text: `${def.name} 现世——灵光冲霄,远近皆见。`, kind: 'annal' })
|
||||
this.w.log('info', `【天下】有异宝出世:${def.name}。`)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- B. NPC 演化(换代 + 关系网 + 互攻;B7) ----
|
||||
evolveNpc(this.w, s, rng.next())
|
||||
@@ -282,7 +301,9 @@ export class WorldSim {
|
||||
sum += (s.marketPool[id] ?? base) / base
|
||||
n++
|
||||
}
|
||||
return n > 0 ? sum / n : 1
|
||||
const cold = n > 0 ? sum / n : 1
|
||||
// 0.1.34 战争疲劳上浮:天下杀伐不止,寒气怨气凝而灵脉皆冷(打不动即荒年)
|
||||
return cold - (s.warFatigue ?? 0) * worldNum('warFatigueTempK')
|
||||
}
|
||||
|
||||
news(): WorldSimState['newsFeed'] {
|
||||
@@ -409,7 +430,12 @@ function npcTrade(w: World, s: WorldSimState, noise: number): void {
|
||||
}
|
||||
}
|
||||
|
||||
function driftMarket(s: WorldSimState, noise: number): void {
|
||||
function itemNameOf(id: string): string {
|
||||
const N: Record<string, string> = { lingcao: '灵草', lingkuang: '灵矿', beastcore: '兽核', lingyu: '灵玉', lingmu: '灵木', shoupi: '兽皮', lingguo: '灵果' }
|
||||
return N[id] ?? id
|
||||
}
|
||||
|
||||
function driftMarket(s: WorldSimState, noise: number, w: World): void {
|
||||
let n = noise
|
||||
// W3 材料生态相关:自然资源同向微漂(灵木/符链共享偏置——物产同源)
|
||||
const matBias = (noise - 0.5) * 0.012
|
||||
@@ -423,6 +449,19 @@ function driftMarket(s: WorldSimState, noise: number): void {
|
||||
const isMaterial = ['lingyu', 'lingmu', 'shoupi', 'lingguo'].includes(id)
|
||||
|
||||
s.marketPool[id] = Math.max(base * WORLDSIM.poolFloorPct, cur + rebalance + drift + (isMaterial ? matBias * base : 0))
|
||||
// 0.1.34 断供监测:货源紧张连续月计数(触发价上浮×世界广播)
|
||||
const line = base * WORLDSIM.shortageLine
|
||||
if (s.marketPool[id] < line) {
|
||||
s.shortage = s.shortage ?? {}
|
||||
s.shortage[id] = (s.shortage[id] ?? 0) + 1
|
||||
if (s.shortage[id] === worldNum('shortageMonths')) {
|
||||
s.shortageWarned = s.shortageWarned ?? {}
|
||||
s.shortageWarned[id] = w.state.year
|
||||
s.newsFeed.push({ year: w.state.year, month: 6, src: '行商', text: `${itemNameOf(id)}断货数月——坊市惜售,价腾三成。`, kind: 'annal' })
|
||||
}
|
||||
} else if (s.shortage?.[id]) {
|
||||
delete s.shortage[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,6 +608,8 @@ function evolveNpc(w: World, s: WorldSimState, noise: number): void {
|
||||
const wr = otherDyn.relationsWithOthers[winner.id] ?? 0
|
||||
otherDyn.relationsWithOthers[winner.id] = clamp(wr + 4, -100, 100)
|
||||
}
|
||||
// 0.1.34 战争疲劳:乱象(互攻/大劫)累积——世界温度上浮,乱世加速
|
||||
s.warFatigue = clamp((s.warFatigue ?? 0) + worldNum('warFatigueRise'), 0, 1)
|
||||
s.newsFeed.push({
|
||||
year, month: 1, src: winner.name,
|
||||
text: `${winner.name} 与 ${loser.name} 起衅——痛挫其锋,势力大动。`
|
||||
|
||||
Reference in New Issue
Block a user