v0.1.35a: 缺陷歼灭——wonder 崩链/boss 卡队/patch 泄漏/拒单门/衰减/数值平衡 17 条
【高】wonder 全链修复(sendMission/settle/missionById wonders 回退+ExpeditionPanel 合并列表); boss 战败 releaseSquad(整队不再永困 expedition);patchUndo 按插件归属 Map+rollbackPatch(跨 MOD/跨世界不再泄漏) 【中】buyItem 拒单线>池底(0.35>0.25——断供真断供);warFatigue 年首×0.9 衰减(长局不永久冷降); MOD 功法注入 trackedTech 卸载摘除;patch 缺失键 warn;guard>1 钳制 Math.max(0,1-guard); transition 12 处逗号简写→每属性独立时长(0.1.33 动画实际恢复);t-shanling/t-zidian 越级下调;土系恒应(×1.02) 【低】断供计数封顶12/播报 month 修正/era 权重下界 0.05/新贵 id 碰撞 7 位/新字段 normalize 补/ go() 停时器/saveNow 并发锁 【金钟罩】0.1.35 基线重算(warFatigue衰减/池底分离/功法平衡受控变更) 61 例绿
This commit is contained in:
@@ -141,6 +141,10 @@ export function normalizeGameState(state: GameState): GameState {
|
||||
state.worldSim.secretQi = state.worldSim.secretQi ?? {}
|
||||
state.worldSim.newsFeed = state.worldSim.newsFeed ?? []
|
||||
if (typeof state.worldSim.tide !== 'number') state.worldSim.tide = 0.5
|
||||
if (typeof state.worldSim.warFatigue !== 'number') state.worldSim.warFatigue = 0
|
||||
if (!state.worldSim.shortage) state.worldSim.shortage = {}
|
||||
if (!state.worldSim.shortageWarned) state.worldSim.shortageWarned = {}
|
||||
if (!state.worldSim.wonders) state.worldSim.wonders = {}
|
||||
if (typeof state.worldSim.tideTicks !== 'number') state.worldSim.tideTicks = 0
|
||||
if (typeof state.worldSim.npcSuccessions !== 'number') state.worldSim.npcSuccessions = 0
|
||||
if (typeof state.worldSim.calamityLeft !== 'number') state.worldSim.calamityLeft = 0
|
||||
@@ -923,7 +927,7 @@ export class World {
|
||||
}
|
||||
|
||||
/** 0.1.34 MOD 数值 patch(mult 0.5~2 / add 实数——作用于数据包表项;卸载复原) */
|
||||
applyModPatch(entries: Array<{ target: 'technique' | 'item' | 'building'; id: string; mult?: number; add?: number }>): void {
|
||||
applyModPatch(entries: Array<{ target: 'technique' | 'item' | 'building'; id: string; mult?: number; add?: number }>, ownerId = 'mod'): void {
|
||||
const undo: Array<() => void> = []
|
||||
for (const p of entries) {
|
||||
if (p.target === 'technique') {
|
||||
@@ -933,7 +937,10 @@ export class World {
|
||||
const vals: Array<[keyof typeof t, number]> = []
|
||||
for (const key of ['expBonus', 'powerBonus', 'critChance', 'guardBonus', 'tribBonus', 'secretBonus'] as const) {
|
||||
const v = t[key]
|
||||
if (typeof v !== 'number') continue
|
||||
if (typeof v !== 'number') {
|
||||
this.log('info', `[patch] 功法 ${p.id} 无字段 ${key}(patch 跳过——需 MOD 定义该效果字段方可调整)。`)
|
||||
continue
|
||||
}
|
||||
vals.push([key as never, v])
|
||||
t[key as never] = Math.max(-5, Math.min(2, p.mult !== undefined ? v * p.mult : v + (p.add ?? 0)))
|
||||
}
|
||||
@@ -946,11 +953,29 @@ export class World {
|
||||
it.basePrice = Math.max(1, Math.round(it.basePrice * (p.mult ?? 1) + (p.add ?? 0)))
|
||||
}
|
||||
}
|
||||
this.patchUndo.push(...undo)
|
||||
this.patchUndos.set(ownerId, this.patchUndos.get(ownerId) ?? [])
|
||||
this.patchUndos.get(ownerId)!.push(...undo)
|
||||
}
|
||||
|
||||
/** 撤销栈(MOD 卸载时由 modManager uninstall 调用) */
|
||||
patchUndo: Array<() => void> = []
|
||||
/** 按插件撤销栈(0.1.35:逐个插件归属——卸载只弹本家,互不侵扰) */
|
||||
patchUndos: Map<string, Array<() => void>> = new Map()
|
||||
|
||||
/** 0.1.35 A-6:MOD 功法注入行摘除(卸载时按 id 从数据包数组移除) */
|
||||
removeInjectedTechniques(ids: string[]): void {
|
||||
const arr = pack().techniques
|
||||
for (const id of ids) {
|
||||
const idx = arr.findIndex((t) => t.id === id)
|
||||
if (idx >= 0) arr.splice(idx, 1)
|
||||
}
|
||||
}
|
||||
|
||||
rollbackPatch(ownerId: string): void {
|
||||
const stack = this.patchUndos.get(ownerId)
|
||||
if (stack) {
|
||||
stack.forEach((f) => f())
|
||||
this.patchUndos.delete(ownerId)
|
||||
}
|
||||
}
|
||||
|
||||
ancestralRite(): boolean {
|
||||
const fam = this.state.family
|
||||
|
||||
Reference in New Issue
Block a user