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
@@ -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'