v0.1.33a: 物品闭环——符箓生效/幽灵物归位/灾年接入

【符箓闭环】talismanWarPrep 返回类型,开战消耗 1 张;风符全队×1.12/山符×1.15+受创减半(零 rng)
【符箓坊】建筑耗符纸×2+灵木×2/级,月造风符1枚;坊3级另出山符(消耗式零 rng)
【幽灵物品归位】and灵丹/虚元丹/玉澜刃补 ITEMS 定义(含 icon/价格/战力)+craftPill/forgeArtifact union 扩键+ARTIFACT_POWER 补玉澜刃 0.4
【灾年生效】farmFactor/mineFactor 从算而未用→真正乘入灵田/药园/矿场/灵果/木坊产量(旱灾×0.7等)
【金钟罩】0.1.33 基线重算(符箓/灾年/新丹受控变更),RAW+RES 共 18 值
【测试】+3(economy-loop-0.1.33 闭环矩阵) 全绿
This commit is contained in:
2026-08-23 21:31:19 +08:00
parent fa477fb3ef
commit bce50b6e2b
11 changed files with 127 additions and 31 deletions
@@ -59,11 +59,18 @@ const DRAW_DESC = [
'僵持半晌,天入暮色,双方收阵戒备而退。'
]
/** R4 符箓开战:家族武备库存有风符/山符时,开战消耗 1 张(全体战力 +6%) */
function talismanWarPrep(w: World): void {
/** 0.1.33 符箓开战(零 rng):消耗 1 张并返回其类型——风符全体战力+12%,山符+15%且受创减半 */
function talismanWarPrep(w: World): 'feng' | 'shan' | null {
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
if ((inv['talisman-feng'] ?? 0) > 0) {
inv['talisman-feng'] = inv['talisman-feng']! - 1
return 'feng'
}
if ((inv['talisman-shan'] ?? 0) > 0) {
inv['talisman-shan'] = inv['talisman-shan']! - 1
return 'shan'
}
return null
}
export function resolveEncounter(
@@ -80,8 +87,11 @@ export function resolveEncounter(
}
): EncounterResult {
const form = formationById(opts.formation)
const talisman = opts.kind === 'war' ? talismanWarPrep(w) : null
const talismMult = talisman === 'feng' ? 1.12 : talisman === 'shan' ? 1.15 : 1
let team = 0
for (const c of opts.team) team += combatPowerOf(w, c)
team *= talismMult
const enemy = Math.round(enemyPowerOf(opts.enemy, opts.risk) * form.def)
const jitter = w.rng.between(0.88, 1.12)
const teamFinal = Math.round(team * form.atk * jitter)
@@ -115,7 +125,7 @@ export function resolveEncounter(
loss.push(`${c.name} 陨落`)
w.chronicle('death', `${c.name} 战殁于${opts.enemy.name},一身所学俱付尘烟。`, c.id, true)
} else if (severity < 0.45) {
const woundAmt = Math.round((40 + w.rng.int(0, 25)) * form.retreatWound)
const woundAmt = Math.round((40 + w.rng.int(0, 25)) * form.retreatWound * (talisman === 'shan' ? 0.5 : 1))
c.health = Math.max(1, c.health - woundAmt)
c.state = 'wounded'
loss.push(`${c.name} 重伤`)
@@ -138,7 +148,7 @@ export function resolveEncounter(
lines.push(`此战缴获:${Object.entries(loot).map(([k, v]) => `${itemName(k)} ×${v}`).join('、')}`)
}
if (opts.kind === 'war') talismanWarPrep(w)
if (talisman) lines.push(`武备先声:${talisman === 'feng' ? '风符化翼' : '山符镇阵'},家士气为之振。`)
if (win && opts.kind === 'war') w.emitFx('blade', 'battle')
const result: EncounterResult = { win, draw, lines, loot, losses: loss }
const log: BattleLog = {
@@ -36,11 +36,12 @@ export function productionTick(w: World): void {
parts.push(`${def!.name}+${prod}${itemNameOf(k)}`)
}
}
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)
// 0.1.33 灾年真正生效(此前 farmFactor/mineFactor 算而未用——生产零体感)
produceAll('lingtian', lingtian, (1 + fielders * 0.05 + springMod) * farmFactor)
produceAll('yaoyuan', yaoyuan, farmFactor)
produceAll('lingkuang', lingkuang, mineFactor)
produceAll('lingguoyuan', fam.buildings['lingguoyuan'] ?? 0, farmFactor)
produceAll('lingmufang', fam.buildings['lingmufang'] ?? 0, farmFactor)
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))
@@ -51,6 +52,21 @@ export function productionTick(w: World): void {
inv.beastcore = (inv.beastcore ?? 0) + 1
parts.push('灵兽园+1兽核')
}
// 0.1.33 符箓坊(消耗式:符纸×2+灵木×2/级 → 风符;叁级追加山符)
const fuzhiLvl = lvl('fuzhifang')
if (fuzhiLvl > 0) {
const need = 2 * fuzhiLvl
if ((inv['fuzhi'] ?? 0) >= need && (inv['lingmu'] ?? 0) >= need) {
inv['fuzhi'] -= need
inv['lingmu'] -= need
inv['talisman-feng'] = (inv['talisman-feng'] ?? 0) + 1
parts.push(`符箓坊-符纸${need}灵木${need}+风符1`)
if (fuzhiLvl >= 3) {
inv['talisman-shan'] = (inv['talisman-shan'] ?? 0) + 1
parts.push('符箓坊+山符1')
}
}
}
void parts
+2 -2
View File
@@ -798,7 +798,7 @@ export class World {
return true
}
craftPill(kind: 'qiyuan' | 'ningyuan' | 'pojing'): boolean {
craftPill(kind: 'qiyuan' | 'ningyuan' | 'pojing' | 'heling' | 'xudan'): boolean {
const fam = this.state.family
const lvl = fam.buildings['danfang']
const r = pillRecipeByOutput(`pill-${kind}`)
@@ -825,7 +825,7 @@ export class World {
return false
}
forgeArtifact(kind: 'weapon-qi' | 'weapon-ling' | 'weapon-fa'): boolean {
forgeArtifact(kind: 'weapon-qi' | 'weapon-ling' | 'weapon-fa' | 'weapon-yu'): boolean {
const fam = this.state.family
const r = forgeRecipeByOutput(kind)
if (!r) return false