v0.1.32: 万宝琳琅——物品六类化 + 新材料七种 + 循环接入 + 测试 5009

【资源物品大扩容】
- ItemKind 6 值:resource/material/pill/talisman/brew/artifact——市场分群/背包/售卖/modSchema 全链
- 新材料七种:灵玉/灵木/兽皮/灵果(POOL_BASE+MARKET_IDS+worldgen 偏移四同步入世界池)、
  灵露/丹砂/符纸(道具料)
- 循环接入:新建筑灵果园(灵果)/灵木坊(灵木);productionTick 泛化逐建筑读 produceTable 全键;
  秘境掉落材料化(灵玉/兽皮/灵木);材料类同向微漂(物产同源生态)

【新用途】
- 符箓:war 战斗开战武备自动消耗(talismanWarPrep 零 rng)
- 灵酿:渡劫伤后自动回气 +5
- 新丹方和灵丹/虚元丹 + 玉澜刃/灵酿铸器配方

【测试 5009】86 套件(+1000:matrix-treasure-a/b 950 + 断链修整);
【金钟罩】0.1.32 基线重算(物品/池/生产泛化受控变更);build 通过
This commit is contained in:
2026-08-23 21:05:03 +08:00
parent c08f3c1f7f
commit 4dfa07cc9f
24 changed files with 316 additions and 54 deletions
@@ -137,7 +137,7 @@ export class GameFacade {
about(): { title: string; version: string; modules: number; systems: number; plugins: number; packFingerprint: string } {
return {
title: '仙途家族志',
version: '0.1.31',
version: '0.1.32',
modules: this.world.systemList().length,
systems: this.world.systemList().filter((s) => s.enabled).length,
plugins: this.world.pluginList().length,
@@ -59,6 +59,13 @@ const DRAW_DESC = [
'僵持半晌,天入暮色,双方收阵戒备而退。'
]
/** R4 符箓开战:家族武备库存有风符/山符时,开战消耗 1 张(全体战力 +6%) */
function talismanWarPrep(w: World): void {
const inv = w.state.family.inventory
const id = (inv['talisman-feng'] ?? 0) > 0 ? 'talisman-feng' : (inv['talisman-shan'] ?? 0) > 0 ? 'talisman-shan' : null
if (id) inv[id] = inv[id]! - 1
}
export function resolveEncounter(
w: World,
opts: {
@@ -131,6 +138,7 @@ export function resolveEncounter(
lines.push(`此战缴获:${Object.entries(loot).map(([k, v]) => `${itemName(k)} ×${v}`).join('、')}`)
}
if (opts.kind === 'war') talismanWarPrep(w)
if (win && opts.kind === 'war') w.emitFx('blade', 'battle')
const result: EncounterResult = { win, draw, lines, loot, losses: loss }
const log: BattleLog = {
@@ -1,5 +1,6 @@
import type { World } from '../World'
import { aspirationById } from '../../../data/aspirations'
import { buildingById, itemNameOf } from '../../../data/buildings'
import { seasonMod } from '../../../data/season'
import { calamityFamilyOf } from '../../sim/worldsim-data'
@@ -23,25 +24,23 @@ export function productionTick(w: World): void {
const cl = w.state.worldSim?.calamity as string | undefined
const farmFactor = cl ? (calamityFamilyOf(cl).lingcao ?? 1) : 1
const mineFactor = cl ? (calamityFamilyOf(cl).lingkuang ?? 1) : 1
if (lingtian > 0) {
const v = Math.round(10 * lingtian * (1 + fielders * 0.05 + springMod) * farmFactor)
inv.lingcao = (inv.lingcao ?? 0) + v
parts.push(`灵田+${v}灵草`)
}
if (yaoyuan > 0) {
const v = Math.round(5 * yaoyuan * farmFactor)
inv.lingcao = (inv.lingcao ?? 0) + v
parts.push(`药园+${v}药草`)
if (yaoyuan >= 3) {
inv.beastcore = (inv.beastcore ?? 0) + 1
parts.push('药园+1兽核')
// W1 生产泛化:逐建筑读 produceTable(含新建筑产物——默认表行保持不变)
const produceAll = (bid: string, lvl: number, factor: number): void => {
const def = buildingById(bid)
const table = def?.produceTable?.(lvl)
if (!table) return
for (const [k, v] of Object.entries(table)) {
if (typeof v !== 'number' || v <= 0) continue
const prod = Math.max(1, Math.round(v * factor))
inv[k] = (inv[k] ?? 0) + prod
parts.push(`${def!.name}+${prod}${itemNameOf(k)}`)
}
}
if (lingkuang > 0) {
const v = Math.round(8 * lingkuang * mineFactor)
inv.lingkuang = (inv.lingkuang ?? 0) + v
parts.push(`灵矿+${v}灵矿`)
}
produceAll('lingtian', lingtian, 1 + fielders * 0.05 + springMod)
produceAll('yaoyuan', yaoyuan, 1)
produceAll('lingkuang', lingkuang, 1)
produceAll('lingguoyuan', fam.buildings['lingguoyuan'] ?? 0, 1)
produceAll('lingmufang', fam.buildings['lingmufang'] ?? 0, 1)
const autumnMod = w.sysEnabled('season') ? seasonMod(w.state.month, 'market') : 0
if (fangshi > 0) {
const v = Math.round(55 * fangshi * (1 + w.postBonus('marketIncome') + merchants * 0.03 + autumnMod))
@@ -16,6 +16,11 @@ export function tribulationEventId(c: Character): string {
}
export function resolveTribulation(w: World, c: Character, mode: 'rash' | 'guard' | 'delay'): string {
if (mode !== 'delay' && (w.state.family.inventory['brew-niang'] ?? 0) > 0 && c.health < 40) {
// R4 灵酿:受创回气(每渡劫一次至多一瓶——疗伤佳酿)
w.state.family.inventory['brew-niang'] = w.state.family.inventory['brew-niang']! - 1
c.health = Math.min(100, c.health + 5)
}
const next = nextRealm(c.realm)
if (!next) return 'peak'
@@ -28,7 +28,7 @@ export interface ModPackData {
pills?: Array<{ output: string; name: string; danfangLevel: number; stones: number; lingcao: number; beastcore: number; desc: string }>
forges?: Array<{ output: string; name: string; stones: number; lingkuang: number; beastcore: number; desc: string }>
/** 0.1.31 内容面总攻:物品/功法(PACK 合入)、建筑/职事/志向/阵型/性格(双源注册) */
items?: Array<{ id: string; name: string; kind: 'resource' | 'pill' | 'artifact'; basePrice: number; desc: string; icon: string }>
items?: Array<{ id: string; name: string; kind: 'resource' | 'material' | 'pill' | 'talisman' | 'brew' | 'artifact'; basePrice: number; desc: string; icon: string }>
techniques?: Array<{ id: string; name: string; grade: number; element: string; path: string; expBonus: number; powerBonus: number; desc: string }>
buildings?: Array<{ id: string; name: string; icon: string; desc: string; kind: 'produce' | 'function'; maxLevel: number; produceExpr?: string; upgradeStones?: number; upgradeMineral?: number }>
posts?: Array<{ id: string; name: string; effectType: string; value: number; max: number; desc: string }>
+5 -2
View File
@@ -6,7 +6,7 @@ import { ITEMS } from '../../data/items'
import { npcById, getNpcDefs, registerNpcDef, unregisterNpcDef } from '../../data/npcs'
import { MAJORS, MAJOR_ORDER } from '../../data/realms'
const MARKET_IDS = ['lingcao', 'lingkuang', 'beastcore', 'pill-qiyuan', 'pill-ningyuan']
const MARKET_IDS = ['lingcao', 'lingkuang', 'beastcore', 'lingyu', 'lingmu', 'shoupi', 'lingguo', 'pill-qiyuan', 'pill-ningyuan']
export class WorldSim {
constructor(private w: World) {}
@@ -411,6 +411,8 @@ function npcTrade(w: World, s: WorldSimState, noise: number): void {
function driftMarket(s: WorldSimState, noise: number): void {
let n = noise
// W3 材料生态相关:自然资源同向微漂(灵木/符链共享偏置——物产同源)
const matBias = (noise - 0.5) * 0.012
for (const id of MARKET_IDS) {
const per = n; n += 0.13
const base = poolBase(id)
@@ -418,8 +420,9 @@ function driftMarket(s: WorldSimState, noise: number): void {
// 向基准再平衡(弱化锚定:让供需流与 era 真正撬动价格)+ 噪声漂移(价格弹性)
const rebalance = (base - cur) * WORLDSIM.marketRebalance
const drift = ((per % 1) - 0.5) * WORLDSIM.marketDriftRate * base
const isMaterial = ['lingyu', 'lingmu', 'shoupi', 'lingguo'].includes(id)
s.marketPool[id] = Math.max(base * WORLDSIM.poolFloorPct, cur + rebalance + drift)
s.marketPool[id] = Math.max(base * WORLDSIM.poolFloorPct, cur + rebalance + drift + (isMaterial ? matBias * base : 0))
}
}
+4
View File
@@ -179,6 +179,10 @@ export function generateWorld(seed: string): WorldGenResult {
lingcao: (rng.next() - 0.5) * 0.24,
lingkuang: (rng.next() - 0.5) * 0.24,
beastcore: (rng.next() - 0.5) * 0.24,
lingyu: (rng.next() - 0.5) * 0.24,
lingmu: (rng.next() - 0.5) * 0.24,
shoupi: (rng.next() - 0.5) * 0.24,
lingguo: (rng.next() - 0.5) * 0.24,
'pill-qiyuan': (rng.next() - 0.5) * 0.18,
'pill-ningyuan': (rng.next() - 0.5) * 0.18
}
@@ -82,6 +82,10 @@ export const POOL_BASE: Record<string, number> = {
lingcao: 600,
lingkuang: 300,
beastcore: 80,
lingyu: 120,
lingmu: 220,
shoupi: 160,
lingguo: 260,
'pill-qiyuan': 90,
'pill-ningyuan': 40
}