v0.1.18: 时代绘卷 + 特效入引擎(双主线完成,1002 测试破千)

【主线一:世界自演进深化《时代绘卷》】
- 世纪弧 era 状态机:盛世/平世/乱世/末法四态(ERA_CONF 全参数化)。
  灾年概率×0.5~1.6、世界供需×0.7~1.25、拍卖概率×0.6~1.3、tide 偏置 ±0.09;
  ERA_DURA 控制转换节奏(15~45年),转移时史官快讯+log。世界有大节律了
- NPC 景气仓廪:npcDyn.prosperity(8~100)月结余——买卖+0.5~0.8、断供-2、灾年-3;
  >75 景气 power+1、<30 衰闷 power-1;换代焕新(55~75)。NPC 在过日子
- 蝴蝶效应:互攻胜率 power 加权(强者恒强)、打残广播(败家邻望-8/胜家+4);
  玩家劫掠胜利/结盟直接写 NPC·NPC 关系网(-6/-3)——玩家行动推进世界历史
- 天下十年一鉴:每十年史官综述(灾/换代/行情/灵潮聚合,kind='annal')
- 灾年↔秘境:灾年灵脉恢复减半(末法感)
- WorldPanel 天下志:era 徽标(悬停描述)/史官十年鉴/群雄势衡柱状图/衰微标注

【主线二:特效系统并入引擎(架构升级)】
- WorldEventBus.onFx + Kernel 转发 + World.emitFx 语义发射(零 rng 消耗)
- 12 个语义发射点:突破/化神/渡劫/劫掠胜负/遭遇战/拍卖/大比/灾年起散/换代
  —— 取代 UI log 文本正则猜测(spark/blade 双源锁死)
- makeBus 桥接 FxGate(kind→gate.emit),gate 挡位/密度/reduced 逻辑保留在 UI

【测试】1002 全绿(40 套件):fxqueue-semantic 3 例 + era-world 5 例;
金钟罩 0.1.18 基线固化(era/prosperity/蝴蝶效应受控变更)
This commit is contained in:
2026-08-23 14:38:27 +08:00
parent ea9f5c9c5d
commit 2f62eecb08
20 changed files with 347 additions and 41 deletions
+1 -1
View File
@@ -210,7 +210,7 @@ export default function SettingsPanel() {
· <br />
·
</div>
<div className="dim2" style={{ marginTop: 8 }}> 0.1.17 · Chronicle of the Immortal Clan</div>
<div className="dim2" style={{ marginTop: 8 }}> 0.1.18 · Chronicle of the Immortal Clan</div>
</div>
</div>
)
+34 -1
View File
@@ -2,7 +2,7 @@ import { useGameStore } from '../store'
import { npcById } from '../../game/data/npcs'
import { MAJOR_NAMES } from '../../game/data/realms'
import type { WorldSimState } from '../../game/engine/sim/worldsim-data'
import { POOL_BASE, WORLDSIM } from '../../game/engine/sim/worldsim-data'
import { POOL_BASE, WORLDSIM, ERA_CONF } from '../../game/engine/sim/worldsim-data'
import { combatPowerOf } from '../../game/engine/runtime/Systems/combat'
import { sellItem, buyItem, marketPrice } from '../../game/engine/sim/Market'
import { useState } from 'react'
@@ -33,6 +33,10 @@ export default function WorldPanel() {
const allPowers = Object.entries(w.state.npcFamilies).map(([id, n]) => ({ id, name: n.name, power: n.power }))
const myRank = allPowers.filter((x) => x.power > myPower).length + 1
void myPower
const eraName = ws.era ? ERA_CONF[ws.era].name : '平世'
const eraDesc = ws.era ? ERA_CONF[ws.era].desc : ''
const annals = news.filter((r) => r.kind === 'annal').slice(0, 3)
const maxPower = Math.max(myPower, ...allPowers.map((x) => x.power)) || 1
return (
<div>
@@ -41,6 +45,9 @@ export default function WorldPanel() {
40
</div>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', marginBottom: 10 }}>
<span className="tag" style={{ borderColor: ws.era === 'shengshi' ? '#6a8a2e' : ws.era === 'luanshi' || ws.era === 'mofa' ? '#a33' : '#8a6d2f', color: ws.era === 'shengshi' ? '#b6d17a' : ws.era === 'luanshi' || ws.era === 'mofa' ? '#e8a08a' : undefined, cursor: 'help' }} title={eraDesc}>
{eraName}
</span>
<span className="tag gold-t"> {tideLabel}{Math.round(tide * 100)}%</span>
{calamity
? <span className="tag" style={{ borderColor: '#a33', color: '#e8a08a' }}>·{calamity}{calamityLeft}</span>
@@ -58,6 +65,32 @@ export default function WorldPanel() {
)
})}
</div>
{annals.length > 0 && (
<div style={{ marginBottom: 10 }}>
<h4 className="dim" style={{ margin: '4px 0 6px' }}></h4>
{annals.map((r, i) => (
<div key={i} className="ch-item" style={{ padding: '5px 8px' }}>
<span className="ch-month">{r.year}</span><span className="gold-t">{r.text}</span>
</div>
))}
</div>
)}
<div style={{ marginBottom: 12 }}>
<h4 className="dim" style={{ margin: '4px 0 6px' }}> vs </h4>
<div style={{ display: 'flex', gap: 10, alignItems: 'flex-end' }}>
{[{ name: '我族', power: myPower, me: true }, ...allPowers.map((x) => ({ ...x, me: false }))].map((x) => (
<div key={x.name} style={{ textAlign: 'center', flex: 1 }}>
<div className="dim2" style={{ fontSize: '0.72rem' }}>{x.name}</div>
<div className="dim" style={{ fontSize: '0.78rem' }}>{Math.round(x.power)}{x.power < 45 && !x.me ? '·衰' : ''}</div>
<div style={{
height: Math.max(6, (x.power / maxPower) * 90),
background: x.me ? 'linear-gradient(180deg,#c9a227,#8a5a20)' : x.power < 45 ? '#5a4444' : 'linear-gradient(180deg,#4a6a3a,#2e4a2e)',
borderRadius: '4px 4px 0 0', border: '1px solid rgba(180,140,80,0.4)'
}} />
</div>
))}
</div>
</div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
<div>
<h4 className="dim" style={{ margin: '4px 0 6px' }}></h4>
+5 -7
View File
@@ -441,16 +441,14 @@ function makeBus(st: GameStore): WorldEventBus {
else if (kind === 'bad') sBad()
else if (kind === 'war') sWar()
else if (kind === 'chronicle') sBell()
// 动效联动:突破/获宝→金砂,战事→刀光
if (kind === 'good' && /突破|获得|购得|落槌|渡劫功成/.test(text)) {
void import(/* @vite-ignore */ './fx').then((m) => m.ensureFx().emit('spark'))
}
if (kind === 'war') {
void import(/* @vite-ignore */ './fx').then((m) => m.ensureFx().emit('blade'))
}
// 动效时机由引擎语义发射('onFx' 桥接)——此处 log 只负责日志与音效
void text
const w = st.world
st.addLog({ id: logSeq++, kind, text, year: w?.state.year ?? 0, month: w?.state.month ?? 0 })
},
onFx: (em) => {
void import(/* @vite-ignore */ './fx').then((m) => m.ensureFx().emit(em.kind as never, em.source ? { src: em.source } : undefined))
},
onChronicle: (e, important) => {
st.addLog({ id: logSeq++, kind: 'chronicle', text: `${e.year}${e.month}${e.text}`, year: e.year, month: e.month })
if (important) st.onChronicle(e, important)