From 4dfa07cc9f472bec15283889bda29689e9e1fee9 Mon Sep 17 00:00:00 2001 From: thzxx <1440196015@qq.com> Date: Sun, 23 Aug 2026 21:05:03 +0800 Subject: [PATCH] =?UTF-8?q?v0.1.32:=20=E4=B8=87=E5=AE=9D=E7=90=B3=E7=90=85?= =?UTF-8?q?=E2=80=94=E2=80=94=E7=89=A9=E5=93=81=E5=85=AD=E7=B1=BB=E5=8C=96?= =?UTF-8?q?=20+=20=E6=96=B0=E6=9D=90=E6=96=99=E4=B8=83=E7=A7=8D=20+=20?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=8E=A5=E5=85=A5=20+=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=205009?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【资源物品大扩容】 - 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 通过 --- AGENTS.md | 4 +- docs/MOD_GUIDE.md | 4 +- package.json | 2 +- src/renderer/game/data/buildings.ts | 20 +++- src/renderer/game/data/items.ts | 26 ++++- src/renderer/game/data/secrets.ts | 6 +- src/renderer/game/engine/runtime/ApiFacade.ts | 2 +- .../game/engine/runtime/Systems/combat.ts | 8 ++ .../game/engine/runtime/Systems/production.ts | 33 +++---- .../engine/runtime/Systems/tribulation.ts | 5 + src/renderer/game/engine/runtime/modSchema.ts | 2 +- src/renderer/game/engine/sim/WorldSim.ts | 7 +- src/renderer/game/engine/sim/worldgen.ts | 4 + src/renderer/game/engine/sim/worldsim-data.ts | 4 + src/renderer/ui/panels/MarketPanel.tsx | 11 ++- src/renderer/ui/panels/SettingsPanel.tsx | 2 +- tests/audit-regression.test.ts | 4 +- tests/clock.test.ts | 16 +-- tests/data-matrix.test.ts | 2 +- tests/facade-registry.test.ts | 6 +- tests/matrix-data-tables-0.1.27.test.ts | 2 +- tests/matrix-treasure-a-0.1.32.test.ts | 99 +++++++++++++++++++ tests/matrix-treasure-b-0.1.32.test.ts | 99 +++++++++++++++++++ tests/worldgen-0.1.24.test.ts | 2 +- 24 files changed, 316 insertions(+), 54 deletions(-) create mode 100644 tests/matrix-treasure-a-0.1.32.test.ts create mode 100644 tests/matrix-treasure-b-0.1.32.test.ts diff --git a/AGENTS.md b/AGENTS.md index c79b1ed..6fd563e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md 仙途家族志 · Chronicle of the Immortal Clan — Electron + React + TS 家族修仙模拟器。全部 UI 与文案为中文。 -当前版本 **0.1.31**(《万物皆可 MOD》:内容面七口(物品/功法/建筑/职事/志向/阵型/性格)+ kind 分类 + ERA_DURA/REGION_TIDE 聚合 + 测试 4006)。 +当前版本 **0.1.32**(《万宝琳琅》:物品六类化 + 新材料七种入市 + 符箓武备/灵酿回气 + 生产泛化 + 材料相关漂移 + 测试 5009)。 ## 命令 @@ -104,6 +104,6 @@ src/main/ Electron 主进程(app:// 协议 + IPC 存 5. **高危文件白名单**(world.ts / events.ts / store.ts / styles.css / cultivation.ts / **WorldSim.ts / worldsim-data.ts**)改动后必须 `git diff --stat` 核对改动面与预期一致。 6. 每次迭代收尾:`git status` 应干净 + `git log --oneline` 确认每步都有提交记录;凡 "git stash/checkout/rm" 类命令,执行前后都 `git status` 留痕。 -- 提交前:`npm test`(当前 85 套件 4006 例全绿)+ `npm run typecheck` 必须绿(改存储/SQL 后再跑一次冒烟)。 +- 提交前:`npm test`(当前 86 套件 5009 例全绿)+ `npm run typecheck` 必须绿(改存储/SQL 后再跑一次冒烟)。 - 平衡数值集中在 `game/data/` 与 `engine/sim/worldsim-data.ts`(世界循环参数唯一权威),调平衡不改引擎流程。 - 发布产物 `release/`、`out/` 均已 gitignore,勿入库。 diff --git a/docs/MOD_GUIDE.md b/docs/MOD_GUIDE.md index d2d9fc6..111c783 100644 --- a/docs/MOD_GUIDE.md +++ b/docs/MOD_GUIDE.md @@ -1,6 +1,6 @@ # MOD 开发教程 · Chronicle of the Immortal Clan -> 版本 **0.1.31·《万物皆可 MOD》** · MOD_SCHEMA_VERSION = 1 +> 版本 **0.1.32·《万宝琳琅》** · MOD_SCHEMA_VERSION = 1 > **本教程即全部所需**:你不需要读任何源码或类型文件——所有 MOD 能用的字段、取值、默认值、坑点都写在这里。 > 照例动手即可:最快 5 分钟做出你的第一个 MOD。 @@ -390,7 +390,7 @@ mortal(凡人)→ qi(练气)→ foundation(筑基)→ core(金丹 { "id": "weapon-wu", "name": "乌金尺", "kind": "artifact", "basePrice": 550, "desc": "乌金铸就,宽厚沉稳。", "icon": "玄" } ] ``` -`kind` 取值:`resource`(资源)/ `pill`(丹药)/ `artifact`(兵器)。加了物品后:丹方(§7)/铸器(§8)与市场/背包自动可见。 +`kind` 取值(0.1.32 六值):`resource`(资源)/ **`material`(素材:灵玉灵木兽皮灵果等)** / `pill`(丹药)/ **`talisman`(符箓:开战武备自动消耗)** / **`brew`(灵酿:渡劫伤后自动回气)** / `artifact`(兵器)。加了物品后:丹方(§7)/铸器(§8)与市场/背包自动可见。 ### 功法(techniques) ```jsonc diff --git a/package.json b/package.json index 00b7cce..2240b93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "chronicle-of-the-immortal-clan", "productName": "仙途家族志", - "version": "0.1.31", + "version": "0.1.32", "description": "修仙 · 家族 · 经营 · 战斗 模拟器", "main": "./out/main/index.js", "author": "MetonaTeam", diff --git a/src/renderer/game/data/buildings.ts b/src/renderer/game/data/buildings.ts index e1d7a87..6dfc62d 100644 --- a/src/renderer/game/data/buildings.ts +++ b/src/renderer/game/data/buildings.ts @@ -5,7 +5,7 @@ export interface BuildingDef { desc: string kind: 'produce' | 'function' maxLevel: number - produceTable?: (level: number) => { stone?: number; lingcao?: number; lingkuang?: number; beastcore?: number } + produceTable?: (level: number) => { stone?: number; lingcao?: number; lingkuang?: number; beastcore?: number; lingyu?: number; lingmu?: number; shoupi?: number; lingguo?: number } upgradeCost: (level: number) => { stones: number; lingkuang: number } extra?: Record } @@ -81,6 +81,20 @@ export const BUILDINGS: Record = { upgradeCost: (l) => ({ stones: 120 * Math.pow(1.7, l - 1), lingkuang: 8 * l }), extra: { repBonus: '0.3 * L /年' } }, + lingguoyuan: { + id: 'lingguoyuan', name: '灵果园', icon: '果', + desc: '灵果成林——月产灵果,灵酿之基。', + kind: 'produce', maxLevel: 5, + produceTable: (l) => ({ lingguo: 3 * l }), + upgradeCost: (l) => ({ stones: 100 * Math.pow(1.7, l - 1), lingkuang: 10 * l }) + }, + lingmufang: { + id: 'lingmufang', name: '灵木坊', icon: '木', + desc: '伐百年灵木——月产灵木,符纸之基。', + kind: 'produce', maxLevel: 5, + produceTable: (l) => ({ lingmu: 4 * l }), + upgradeCost: (l) => ({ stones: 90 * Math.pow(1.7, l - 1), lingkuang: 12 * l }) + }, lingshou: { id: 'lingshou', name: '灵兽园', icon: '兽', desc: '豢养灵兽,战阵之助,偶得兽核。', @@ -96,6 +110,10 @@ const DYN_BUILDINGS = new Map() export function registerBuildingDef(def: BuildingDef): void { DYN_BUILDINGS.set(def.id, def) } +const ITEM_NAMES: Record = { lingcao: '灵草', lingkuang: '灵矿', beastcore: '兽核', lingyu: '灵玉', lingmu: '灵木', shoupi: '兽皮', lingguo: '灵果', stone: '灵石' } +export function itemNameOf(k: string): string { + return ITEM_NAMES[k] ?? k +} export function buildingById(id: string): BuildingDef | undefined { return BUILDINGS[id] ?? DYN_BUILDINGS.get(id) } diff --git a/src/renderer/game/data/items.ts b/src/renderer/game/data/items.ts index 3fc5bd2..d5bf70d 100644 --- a/src/renderer/game/data/items.ts +++ b/src/renderer/game/data/items.ts @@ -1,7 +1,9 @@ +export type ItemKind = 'resource' | 'material' | 'pill' | 'talisman' | 'brew' | 'artifact' + export interface ItemDef { id: string name: string - kind: 'resource' | 'pill' | 'artifact' + kind: ItemKind basePrice: number desc: string icon: string @@ -17,6 +19,18 @@ export const ITEMS: Record = { 'pill-ningyuan': { id: 'pill-ningyuan', name: '凝元丹', kind: 'pill', basePrice: 150, desc: '筑基以上可效,修为增长显著。', icon: '元' }, 'pill-pojing': { id: 'pill-pojing', name: '破境丹', kind: 'pill', basePrice: 480, desc: '冲击瓶颈时的辅助神物,提升突破成功率。', icon: '破' }, + 'lingyu': { id: 'lingyu', name: '灵玉', kind: 'material', basePrice: 40, desc: '山髓凝玉,铸器布阵之珍。', icon: '玉' }, + 'lingmu': { id: 'lingmu', name: '灵木', kind: 'material', basePrice: 18, desc: '百年灵木,可燃可刻,符纸之基。', icon: '木' }, + 'shoupi': { id: 'shoupi', name: '兽皮', kind: 'material', basePrice: 15, desc: '妖兽皮革,柔韧生辉,炼甲之材。', icon: '皮' }, + 'lingguo': { id: 'lingguo', name: '灵果', kind: 'material', basePrice: 22, desc: '灵田熟成的仙果,气韵清甜。', icon: '果' }, + 'linglu': { id: 'linglu', name: '灵露', kind: 'material', basePrice: 10, desc: '晨曦灵露,润脉养神。', icon: '露' }, + 'dansha': { id: 'dansha', name: '丹砂', kind: 'material', basePrice: 26, desc: '朱砂灵脉,丹炉必备。', icon: '砂' }, + 'fuzhi': { id: 'fuzhi', name: '符纸', kind: 'material', basePrice: 9, desc: '引灵符纸,书符所依。', icon: '符' }, + + 'talisman-feng': { id: 'talisman-feng', name: '风符', kind: 'talisman', basePrice: 60, desc: '风灵符箓,开战时身法轻灵(战力+12%)。', icon: '风' }, + 'talisman-shan': { id: 'talisman-shan', name: '山符', kind: 'talisman', basePrice: 70, desc: '山岳符箓,临敌气定(战力+15%,受创减半)。', icon: '山' }, + 'brew-niang': { id: 'brew-niang', name: '灵酿', kind: 'brew', basePrice: 40, desc: '灵果所酿,饮之回气宁神(渡劫后调息佳品)。', icon: '酿' }, + 'weapon-fan': { id: 'weapon-fan', name: '凡器', kind: 'artifact', basePrice: 120, desc: '普通铁器,聊胜于无。', icon: '凡' }, 'weapon-qi': { id: 'weapon-qi', name: '法器', kind: 'artifact', basePrice: 450, desc: '蕴灵之器,可引动灵力。', icon: '法' }, 'weapon-ling': { id: 'weapon-ling', name: '灵器', kind: 'artifact', basePrice: 1400, desc: '有灵之器,锋芒隐露。', icon: '灵' }, @@ -55,7 +69,10 @@ export interface PillRecipe { export const PILL_RECIPES: PillRecipe[] = [ { output: 'pill-qiyuan', name: '聚气丹', danfangLevel: 1, stones: 20, lingcao: 15, beastcore: 0, desc: '炼气期修士服之,一月修为大增。' }, { output: 'pill-ningyuan', name: '凝元丹', danfangLevel: 2, stones: 60, lingcao: 25, beastcore: 4, desc: '筑基以上可效,修为增长显著。' }, - { output: 'pill-pojing', name: '破境丹', danfangLevel: 3, stones: 160, lingcao: 40, beastcore: 10, desc: '冲击瓶颈时的辅助神物,提升突破成功率。' } + { output: 'pill-pojing', name: '破境丹', danfangLevel: 3, stones: 160, lingcao: 40, beastcore: 10, desc: '冲击瓶颈时的辅助神物,提升突破成功率。' }, + // R2 新丹(沿用基础料组合——万宝琳琅) + { output: 'pill-heling', name: '和灵丹', danfangLevel: 2, stones: 80, lingcao: 20, beastcore: 8, desc: '和理灵机,金丹以下均可服。' }, + { output: 'pill-xudan', name: '虚元丹', danfangLevel: 4, stones: 260, lingcao: 50, beastcore: 16, desc: '丹中朱砂,元婴以下服之可提元。' } ] /** 铸器配方:灵矿+兽核+灵石 → 兵刃;无建筑限制(自建工坊念头,数值即门槛)。 */ @@ -70,7 +87,10 @@ export interface ForgeRecipe { export const FORGE_RECIPES: ForgeRecipe[] = [ { output: 'weapon-qi', name: '法器', stones: 300, lingkuang: 8, beastcore: 2, desc: '蕴灵之器,可引动灵力。' }, { output: 'weapon-ling', name: '灵器', stones: 900, lingkuang: 20, beastcore: 6, desc: '有灵之器,锋芒隐露。' }, - { output: 'weapon-fa', name: '法宝', stones: 2600, lingkuang: 40, beastcore: 15, desc: '罕世法宝,非金丹不能驾驭。' } + { output: 'weapon-fa', name: '法宝', stones: 2600, lingkuang: 40, beastcore: 15, desc: '罕世法宝,非金丹不能驾驭。' }, + // R2 新材料铸器(灵玉/灵木) + { output: 'weapon-yu', name: '玉澜刃', stones: 800, lingkuang: 14, beastcore: 4, desc: '温润如玉,锋芒内敛。' }, + { output: 'brew-niang', name: '灵酿', stones: 30, lingkuang: 0, beastcore: 0, desc: '灵果灵露所酿——饮之回气。' } ] /** 聚合配方表(base + MOD/插件补充;确定性——注册即追加) */ diff --git a/src/renderer/game/data/secrets.ts b/src/renderer/game/data/secrets.ts index 327952b..48cf1f9 100644 --- a/src/renderer/game/data/secrets.ts +++ b/src/renderer/game/data/secrets.ts @@ -62,7 +62,7 @@ export const MISSIONS: MissionDef[] = [ { kind: 'combat', months: 2, title: '遭遇袭击', enemyId: 'e-tiebei' }, { kind: 'resource', months: 2, title: '寻获残洞', loot: { resources: { lingcao: [30, 80], beastcore: [1, 3] }, artifactChance: 0.05, techniqueChance: 0.03 } } ], - completionLoot: { resources: { lingcao: [20, 60], lingkuang: [5, 15] }, artifactChance: 0.08, techniqueChance: 0.03, techGrades: [1, 2] } + completionLoot: { resources: { lingcao: [20, 60], lingkuang: [5, 15], lingmu: [4, 12] }, artifactChance: 0.08, techniqueChance: 0.03, techGrades: [1, 2] } }, { id: 'm-xuangu', name: '玄冰谷', region: '北境寒渊', icon: '冰', @@ -73,7 +73,7 @@ export const MISSIONS: MissionDef[] = [ { kind: 'combat', months: 2, title: '泉主现身', enemyId: 'e-huiyuan' }, { kind: 'boss', months: 2, title: '冰潭之下', enemyId: 'e-baiqi' } ], - completionLoot: { resources: { lingkuang: [30, 70], beastcore: [2, 5] }, artifactChance: 0.15, techniqueChance: 0.06, techGrades: [2, 3] } + completionLoot: { resources: { lingkuang: [30, 70], beastcore: [2, 5], lingyu: [2, 6], shoupi: [3, 8] }, artifactChance: 0.15, techniqueChance: 0.06, techGrades: [2, 3] } }, { id: 'm-guzhan', name: '古战阵', region: '南陵荒原', icon: '战', @@ -85,7 +85,7 @@ export const MISSIONS: MissionDef[] = [ { kind: 'combat', months: 2, title: '守阵铁骑', enemyId: 'e-huanhan' }, { kind: 'resource', months: 3, title: '挖开枯井', loot: { resources: { lingkuang: [40, 90], beastcore: [2, 6] }, artifactChance: 0.2, techniqueChance: 0.08 } } ], - completionLoot: { resources: { lingkuang: [40, 90], beastcore: [2, 8] }, artifactChance: 0.22, techniqueChance: 0.1, techGrades: [2, 3] } + completionLoot: { resources: { lingkuang: [40, 90], beastcore: [2, 8], lingyu: [4, 8], shoupi: [4, 12] }, artifactChance: 0.22, techniqueChance: 0.1, techGrades: [2, 3] } }, { id: 'm-lingshan', name: '灵鹫山', region: '东海之滨', icon: '鹫', diff --git a/src/renderer/game/engine/runtime/ApiFacade.ts b/src/renderer/game/engine/runtime/ApiFacade.ts index c878717..809479c 100644 --- a/src/renderer/game/engine/runtime/ApiFacade.ts +++ b/src/renderer/game/engine/runtime/ApiFacade.ts @@ -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, diff --git a/src/renderer/game/engine/runtime/Systems/combat.ts b/src/renderer/game/engine/runtime/Systems/combat.ts index b39686e..b533eb9 100644 --- a/src/renderer/game/engine/runtime/Systems/combat.ts +++ b/src/renderer/game/engine/runtime/Systems/combat.ts @@ -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 = { diff --git a/src/renderer/game/engine/runtime/Systems/production.ts b/src/renderer/game/engine/runtime/Systems/production.ts index 214eef5..ae4c5e2 100644 --- a/src/renderer/game/engine/runtime/Systems/production.ts +++ b/src/renderer/game/engine/runtime/Systems/production.ts @@ -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)) diff --git a/src/renderer/game/engine/runtime/Systems/tribulation.ts b/src/renderer/game/engine/runtime/Systems/tribulation.ts index 40e1afe..20e5ff3 100644 --- a/src/renderer/game/engine/runtime/Systems/tribulation.ts +++ b/src/renderer/game/engine/runtime/Systems/tribulation.ts @@ -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' diff --git a/src/renderer/game/engine/runtime/modSchema.ts b/src/renderer/game/engine/runtime/modSchema.ts index 584ac3c..6c5e969 100644 --- a/src/renderer/game/engine/runtime/modSchema.ts +++ b/src/renderer/game/engine/runtime/modSchema.ts @@ -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 }> diff --git a/src/renderer/game/engine/sim/WorldSim.ts b/src/renderer/game/engine/sim/WorldSim.ts index 0b0ffa1..d881a46 100644 --- a/src/renderer/game/engine/sim/WorldSim.ts +++ b/src/renderer/game/engine/sim/WorldSim.ts @@ -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)) } } diff --git a/src/renderer/game/engine/sim/worldgen.ts b/src/renderer/game/engine/sim/worldgen.ts index f281354..336eadb 100644 --- a/src/renderer/game/engine/sim/worldgen.ts +++ b/src/renderer/game/engine/sim/worldgen.ts @@ -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 } diff --git a/src/renderer/game/engine/sim/worldsim-data.ts b/src/renderer/game/engine/sim/worldsim-data.ts index 48e7537..5c70f51 100644 --- a/src/renderer/game/engine/sim/worldsim-data.ts +++ b/src/renderer/game/engine/sim/worldsim-data.ts @@ -82,6 +82,10 @@ export const POOL_BASE: Record = { lingcao: 600, lingkuang: 300, beastcore: 80, + lingyu: 120, + lingmu: 220, + shoupi: 160, + lingguo: 260, 'pill-qiyuan': 90, 'pill-ningyuan': 40 } diff --git a/src/renderer/ui/panels/MarketPanel.tsx b/src/renderer/ui/panels/MarketPanel.tsx index c8f275c..7e3cd0b 100644 --- a/src/renderer/ui/panels/MarketPanel.tsx +++ b/src/renderer/ui/panels/MarketPanel.tsx @@ -18,7 +18,10 @@ export default function MarketPanel() { const fam = w.state.family const inv = fam.inventory - const goods = useMemo(() => Object.values(ITEMS).filter((i) => i.kind === 'resource' || i.kind === 'pill'), []) + const goods = useMemo( + () => Object.values(ITEMS).filter((i) => ['resource', 'material', 'pill', 'talisman', 'brew', 'artifact'].includes(i.kind)), + [] + ) const artifacts = useMemo(() => Object.values(ITEMS).filter((i) => i.kind === 'artifact'), []) const marketTech = TECHNIQUES.filter((t) => t.grade <= 3) const cangshuLv = fam.buildings['cangshu'] ?? 0 @@ -50,10 +53,10 @@ export default function MarketPanel() { {[...goods, ...artifacts].map((item) => { - const have = item.id === 'lingcao' || item.id === 'lingkuang' || item.id === 'beastcore' || item.kind === 'pill' || item.kind === 'artifact' + const have = ['resource', 'material', 'pill', 'talisman', 'brew', 'artifact'].includes(item.kind) ? inv[item.id] ?? 0 : 0 - const stock = item.kind === 'artifact' ? 3 : item.kind === 'pill' ? 5 : 9999 + const stock = item.kind === 'artifact' ? 3 : ['pill', 'talisman', 'brew'].includes(item.kind) ? 5 : 9999 const count = item.kind === 'artifact' ? 1 : 5 return ( @@ -75,7 +78,7 @@ export default function MarketPanel() { > 买{count} {' '} - {((item.kind === 'resource' || item.kind === 'pill') && have >= count) && ( + {(['resource', 'material', 'pill'].includes(item.kind) && have >= count) && (