feat(0.1.16-P1): 资源闭环引擎(修为耗草/炼丹概率化/铸器/灵脉收益/NPC战力/灾变落效)+ C13C14
【A 经济闭环】 - 修为经济化:练气以上修行者月耗灵草(闭关2普通1),无草速修0.6~1.0衰减+缺草年告警 - 炼丹等级化:bonusOf 表达式引擎(白名单安全求值),craftChance 转正;丹方单源 PILL_RECIPES(聚气L1/凝元L2/破境L3)+ 失败折半退料 - 炼器筑宝:FORGE_RECIPES(法器/灵器/法宝,灵矿+兽核+灵石) - 秘境灵脉:secretQiOf→rollWarbooty 收益门槛(0.5~1.3折算);掉落按秘境 techGrades 过滤 - NPC 实力参战:raid 强度/风险随 npc.power 浮动(0.5~1.8) - 灾年落效:疫病/兽潮一次性袭击 + CALAMITY_FAMILY 月度减产乘子 【C 治理】 - C13 破境丹渡劫修正:大境界时药力→tribBoost 加成(+12%)入渡劫事件,不再跳过三选 - C14 存储防线:loadState 补 migrate;MigrationError(TOO_NEW/未知版本)提示升级 【UI 半批】 - 坊市新增 定制tab(丹方/铸器);ChroniclePanel 手写史书输入条;MemberModal 册立家主钮 - 年报摘要(要闻5条+辞世讣告);EventModal 选项收益预览 - 结盟引擎:setAlliance(relation≥40)/盟友岁差不降/年利15灵石
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** WorldSim —— 世界自进化引擎(game/engine/sim/WorldSim.ts) */
|
||||
import { World } from '../runtime/World'
|
||||
import { WorldSimState, NpcDynamics, WORLDSIM, CALAMITY_EFFECT, CalamityName, POOL_BASE } from './worldsim-data'
|
||||
import { WorldSimState, NpcDynamics, WORLDSIM, CALAMITY_EFFECT, CALAMITY_FAMILY, CalamityName, POOL_BASE } from './worldsim-data'
|
||||
import { pack } from '../../data/registry'
|
||||
import { ITEMS } from '../../data/items'
|
||||
import { npcById } from '../../data/npcs'
|
||||
@@ -44,6 +44,22 @@ export class WorldSim {
|
||||
s.calamityYear = this.w.state.year
|
||||
applyCalamityToMarket(s, cl as CalamityName)
|
||||
this.w.log('bad', `【天下灾年】${cl}——灵植减产,市价将行。`)
|
||||
// B7 灾年落家族(一次性体感效果)
|
||||
if (cl === '疫病') {
|
||||
for (const c of this.w.aliveMembers()) {
|
||||
if (this.w.rng.chance(0.6)) {
|
||||
const dmg = 8 + this.w.rng.int(0, 14)
|
||||
c.health = Math.max(1, c.health - dmg)
|
||||
if (c.health < 20) c.state = 'wounded'
|
||||
}
|
||||
}
|
||||
this.w.log('bad', `瘟疫蔓延,族中大半病倒——灵药告急!`)
|
||||
} else if (cl === '兽潮') {
|
||||
const st = this.w.state.family.stones
|
||||
this.w.state.family.stones -= Math.round(st * 0.04)
|
||||
inv(this.w)['beastcore'] = (inv(this.w)['beastcore'] ?? 0) + 2
|
||||
this.w.log('bad', `兽潮涌至,坊市稍有折损;猎得兽核数枚。`)
|
||||
}
|
||||
} else {
|
||||
s.calamity = undefined
|
||||
}
|
||||
@@ -147,6 +163,10 @@ function driftMarket(s: WorldSimState, noise: number): void {
|
||||
}
|
||||
}
|
||||
|
||||
function inv(w: World): Record<string, number> {
|
||||
return w.state.family.inventory
|
||||
}
|
||||
|
||||
function applyCalamityToMarket(s: WorldSimState, cl: CalamityName): void {
|
||||
const eff = CALAMITY_EFFECT[cl]
|
||||
for (const [id, pct] of Object.entries(eff) as [string, number][]) {
|
||||
|
||||
@@ -79,6 +79,16 @@ export const WORLDSIM = {
|
||||
|
||||
export type CalamityName = (typeof WORLDSIM.calamities)[number]
|
||||
|
||||
/** 灾因 → 家族实际生产乘量(1 = 正常) */
|
||||
export const CALAMITY_FAMILY: Record<CalamityName, Partial<Record<string, number>>> = {
|
||||
旱灾: { lingcao: 0.7 },
|
||||
涝灾: { lingcao: 0.8, lingkuang: 0.95 },
|
||||
蝗灾: { lingcao: 0.55 },
|
||||
疫病: {},
|
||||
兽潮: { beastcore: 1.4 },
|
||||
寒潮: { lingcao: 0.85, lingkuang: 0.75 }
|
||||
}
|
||||
|
||||
/** 灾因 → 资源方向 */
|
||||
export const CALAMITY_EFFECT: Record<CalamityName, Partial<Record<string, number>>> = {
|
||||
旱灾: { lingcao: -0.3 },
|
||||
|
||||
Reference in New Issue
Block a user