0.1.37 天人感应·因果织锦:功德系统+飞升试炼+世界奇观+MOD扩展口

This commit is contained in:
2026-09-10 23:37:57 +08:00
parent 2984d05647
commit 87cd71ad21
24 changed files with 1062 additions and 43 deletions
+12 -5
View File
@@ -24,7 +24,7 @@ import { registerFormationDef } from '../../data/formations'
import { registerTraitDef } from '../../data/traits'
import { addPillRecipe, addForgeRecipe } from '../../data/items'
import { WorldGenPools } from '../sim/worldgen'
import { addCalamity as addCalamityImpl } from '../sim/worldsim-data'
import { addCalamity as addCalamityImpl, addWonderType as addWonderTypeImpl } from '../sim/worldsim-data'
import { fire } from './Systems/events'
import { createWorldState, findInheritor } from './creation'
import { SYSTEM_DEFS, SystemDef } from './capabilities'
@@ -96,6 +96,8 @@ export function normalizeGameState(state: GameState): GameState {
if (typeof c.techniqueProgress !== 'number') c.techniqueProgress = 0
if (typeof c.health !== 'number') c.health = 100
}
// 0.1.37 karma 兜底(旧档/测试注入缺失时归零)
if (typeof state.family.karma !== 'number') state.family.karma = 0
return state
}
@@ -166,6 +168,7 @@ export class World {
addForgeRecipe: (r) => addForgeRecipe(r),
addWorldGenPool: (part, source) => WorldGenPools.add(part, source ?? 'ctx'),
addCalamity: (name, opts) => addCalamityImpl(name, opts),
addWonderType: (def) => addWonderTypeImpl(def),
packExtend: (key, additions) => PACK.extend(key as never, additions),
mergeAddPack: (key, items) => PACK.mergeAdd(key as never, items),
addBuildingDef: (def) => registerBuildingDef(def),
@@ -549,7 +552,8 @@ export class World {
}
fam.stones -= cost
target.relation = Math.min(100, target.relation + 8)
this.log('info', `开仓济世(灵石${cost}),${target.name} 感念恩义,关系+8。`)
fam.karma += 8
this.log('info', `开仓济世(灵石${cost}),${target.name} 感念恩义,关系+8。功德+8。`)
void ws
return true
}
@@ -566,8 +570,9 @@ export class World {
npc.power = Math.min(900, npc.power + 15)
npc.relation = Math.min(100, npc.relation + 8)
fam.reputation += 3
fam.karma += 5
ws.distress = undefined
this.log('good', `驰援${npc.name}——敌锋既退,盟谊愈坚(声望+3)。`)
this.log('good', `驰援${npc.name}——敌锋既退,盟谊愈坚(声望+3,功德+5)。`)
this.chronicle('diplomacy', `${npc.name}重整武备,同盟益固。`, undefined, true)
return true
}
@@ -584,7 +589,8 @@ export class World {
if (rel < -30) dyns[a].relationsWithOthers[b] = -25
}
fam.reputation += 2
this.log('info', `调停${this.state.npcFamilies[npcA]?.name ?? npcA}${this.state.npcFamilies[npcB]?.name ?? npcB}——干戈化玉帛,声望+2。`)
fam.karma += 3
this.log('info', `调停${this.state.npcFamilies[npcA]?.name ?? npcA}${this.state.npcFamilies[npcB]?.name ?? npcB}——干戈化玉帛,声望+2,功德+3。`)
return true
}
@@ -948,7 +954,8 @@ export class World {
if (this.state.year - last < 1) return false
fam.flag[`tauntCD-${npcId}`] = this.state.year
npc.relation = Math.max(-100, npc.relation - 20)
this.log('bad', `指桑骂槐,${npc.name}记恨于心。`)
fam.karma -= 4
this.log('bad', `指桑骂槐,${npc.name}记恨于心。(功德-4`)
return true
}