config.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. // 《世界树 · 逃离空洞》数值配置与纯公式(无副作用,可被测试直接 import)。
  2. // 所有常量与 GDD.md「数值表」逐节对应:修改时两边同步。
  3. // 署名:FmodeCode
  4. export const SAVE_KEY = 'worldtree_escape_save_v1';
  5. export const SAVE_VERSION = 1;
  6. // ── 主线:逃离室女座空洞(连续空间) ─────────────────────────
  7. // 逃逸进度 = 本轮回“抵达层数 / TOTAL_LAYERS”,连续流动;六章每 500 层一段,章内没有结算弹窗。
  8. // 每章 500 层。这个常数同时是“能量谷”的深度标尺:GM(L) 的线性段在 L/Gm 处平滑衔接(Gm = TOTAL×(ENV_STEP−1)/(GM_END−1) ≈ 1.71×TOTAL),
  9. // 调大 TOTAL 会让回跑段变得更“浅”,因此主曲线参数要跟着一起调(见 tests/balance-sim.mjs)。
  10. export const TOTAL_LAYERS = 2500;
  11. export const CHAPTERS = [
  12. { idx: 0, short: '地球', title: '保护地球', desc: '空洞前沿已越过柯伊伯带,地球是最后一处有生命的声音。' },
  13. { idx: 1, short: '太阳系', title: '脱离太阳系', desc: '把整颗星球托进世界树的根系,太阳系成为空洞中的第一枚灯塔。' },
  14. { idx: 2, short: '猎户旋臂', title: '脱离猎户旋臂', desc: '根系铺满旋臂,星云在树冠下重新聚合为航路。' },
  15. { idx: 3, short: '银河系', title: '脱离银河系', desc: '银河的旋涡在身后合拢,世界树第一次长到了星系之外。' },
  16. { idx: 4, short: '本星系群', title: '脱离本星系群', desc: '本星系群的引力潮被抵消,空洞的边界第一次出现在视野里。' },
  17. { idx: 5, short: '空洞外', title: '冲出空洞', desc: '室女座空洞之外,还有一片未被规则侵蚀的星空。' },
  18. ];
  19. for (const ch of CHAPTERS) ch.at = ch.idx * 500; // 每章 500 层
  20. /** 当前层数对应的章序号(0..5) */
  21. export function chapterOf(layer) {
  22. let c = 0;
  23. for (const ch of CHAPTERS) if (layer >= ch.at) c = ch.idx;
  24. return c;
  25. }
  26. // ── 连续推进时序 ─────────────────────────────────────
  27. // 单层基础推进时间 T(L) = 4 + 10L 秒(层中匀速),由推进速度乘区 M_spd 加速。
  28. export const MARCH = { visitBase: 4, visitPerLayer: 10 };
  29. export function visitTime(L) { return MARCH.visitBase + MARCH.visitPerLayer * L; }
  30. // ── 跳关(时间维度乘区) ─────────────────────────────
  31. // 触发率 p(封顶 45%):每次触发跳 k 层,P(k)/p ∝ 0.5^(k−1),k ∈ [1,4]。
  32. // 命中时 k 的分布 P(k|命中) ∝ 0.5^(k−1)(k=1..4,权重 8:4:2:1),命中期望 E[k|命中] = 26/15
  33. // E[k] = p × 26/15;时间乘区 = 1 + E[k];跳关后期望层耗时 = T / (1 + E[k])。
  34. export const SKIP = { minK: 1, maxK: 4, factor: 5.7, cap: 0.45 }; // 触发率封顶 45% → 时间乘区上限 1+16×0.45/15 = 1.48
  35. export function skipPlan(pEff) {
  36. const ps = Math.max(0, Math.min(SKIP.cap, Number(pEff) || 0));
  37. const ks = [], probs = [];
  38. let sum = 0;
  39. for (let k = SKIP.minK; k <= SKIP.maxK; k++) sum += Math.pow(0.5, k - SKIP.minK);
  40. for (let k = SKIP.minK; k <= SKIP.maxK; k++) { ks.push(k); probs.push(ps * Math.pow(0.5, k - SKIP.minK) / sum); }
  41. return { p: ps, ks, probs };
  42. }
  43. export function skipExpectation(pEff) {
  44. const { ks, probs } = skipPlan(pEff);
  45. // 显式循环(曾误用同名参数导致结果偏差)
  46. let e = 0;
  47. for (let i = 0; i < ks.length; i++) e += ks[i] * probs[i];
  48. return e;
  49. }
  50. export function timeMul(pEff) { return 1 + skipExpectation(pEff); }
  51. // 地质环境(按本轮深度每 18 层轮换;floor(D/18) mod 8 取用;extra 字段对应 formulas.envFactors)
  52. export const ENVS = [
  53. { id: 'env0', name: '气态尘埃带', color: '#8B93A7', depth: 1.3, desc: '初入空洞边缘,尘屑拖慢世界树', eff: '慢:推进速度 ×0.85' },
  54. { id: 'env1', name: '引力乱流', color: '#6C8EBF', depth: 1.5, desc: '混乱的引力让根系难以吸收本源,但勘探更有价值', eff: '本源产出 ×0.8' },
  55. { id: 'env2', name: '规则回廊', color: '#C77DFF', depth: 2.2, desc: '残破的规则在此排列,跳关变得容易', eff: '每 10 秒跳关触发率 +20%' },
  56. { id: 'env3', name: '星火苗床', color: '#FFB86B', depth: 2.0, desc: '在星尘中收集火种,等待点燃', eff: '火种子:攒 10 枚,一次性本源 ×2.5', fire: true },
  57. { id: 'env4', name: '虚空潮汐', color: '#3B475C', depth: 2.6, desc: '虚空会吞掉暂存的本源——及时花掉,或尽快回溯', eff: '持有本源每秒流失 2%(侵蚀)', drain: 0.02 },
  58. { id: 'env5', name: '金枝回廊', color: '#E3B341', depth: 2.2, desc: '金色树汁涌出,产出暴增但推进不变', eff: '本源产出 ×1.6' },
  59. { id: 'env6', name: '镜像残响', color: '#9FE7D2', depth: 2.8, desc: '世界树的残影在前方替你开路', eff: '每层 30% 概率额外 +1 层(跳关加速)', echo: 0.3 },
  60. { id: 'env7', name: '熵之温室', color: '#C08BFF', depth: 3.0, desc: '高熵环境加速一切,也加速敌人的侵蚀(危机间隔 ×0.7)', eff: '本源产出 ×1.4,推进速度 ×1.1', entropy: true },
  61. ];
  62. // ── 本源产出(连续空间:产出 = 对已抵达层求和的“本源密度”) ──────────
  63. // 第 L 层的本源密度 β(L) = 1.05^(L−F) × P_root(R),F = 本轮起始层,R = 根须等级。
  64. // 新一轮产出/秒 = ∫_F^L β = P_root(R) × (1.05^L − 1)/(1.05·ln1.05)(GDD §6.5 式 9;GDD 符号 B(L) 即此值)。
  65. export const ESSENCE_GROWTH = 1.05;
  66. export function essenceDensity(L, F) { return Math.pow(ESSENCE_GROWTH, Math.max(0, L - F)); }
  67. export const PROD_BASE_DIV = 1.05 * Math.log(1.05);
  68. export const PROD_DECAY = 0.0015; // 软上限:每层指数的衰减(有效增长率 = e^(ln1.05 − PROD_DECAY·L);L=1000 时每层仅 ×1.0006)
  69. /** 产出基线:∫_0^L e^{ln1.05·x − 0.5·DECAY·x²} dx 的数值近似(软上限:32 层内指数衰减 12.8%) */
  70. export const EARLY_BOOST = 2; // 低层起步加速:前 30 层的本源密度额外 ×2(避免“前 10 分钟几乎不动”)
  71. export function essenceBase(L, rootP) {
  72. if (L < 30) { // 低层直接解析式(软上限效果可忽略)
  73. const gl = Math.log(1.05);
  74. return rootP * EARLY_BOOST * (Math.exp(gl * L) - 1) / gl;
  75. }
  76. const g = Math.log(1.05);
  77. let acc = 0; const n = Math.max(1, Math.ceil(Math.max(0, L) / 2));
  78. const h = Math.max(0, L) / n;
  79. for (let i = 0; i < n; i++) { const x = (i + 0.5) * h; acc += Math.exp(g * x - 0.5 * PROD_DECAY * x * x) * h; }
  80. return rootP * acc;
  81. }
  82. /** 指数增长率 π:1.05^(L−F) = e^(π(L−F));π = ln1.05 / (1 − e^(−ln1.05(L−F)))(L=F 时 = 0.4879) */
  83. export function piOf(L, F) {
  84. const d = Math.exp(-Math.log(ESSENCE_GROWTH) * Math.max(0, (L || 0) - (F || 0)));
  85. return Math.log(ESSENCE_GROWTH) / Math.max(1e-9, 1 - Math.min(0.999, d));
  86. }
  87. // ── 本轮升级(消耗本源)几何成本 C = base × ratio^level ───────
  88. export const COST = {
  89. root: { base: 10, ratio: 1.4, per: 0.10, name: '根须', desc: '每级 本源产出 ×1.059、推进速度 ×1.10(价格 ×1.4/级)' },
  90. canopy: { base: 40, ratio: 2.2, per: 0.005, name: '树冠', desc: '每级 跳关触发率 +0.5%(封顶 60%);每级额外推进速度 ×1.08' },
  91. };
  92. export const UPGRADE_KINDS = ['root', 'canopy'];
  93. export const PURCHASE_CAP = 4; // 单次批量购买上限(每次点击最多升 4 级)
  94. export const ROOT_EXP = 0.6; // 根须产出层段压缩指数
  95. export const KAPPA = 3; // 本轮价格系数 κ:价格 ×(κ·(π − π₀))(GDD §6.5 式 3/4,与本源产出指数 π 挂钩)
  96. export const ETA = 10; // 等待系数:只有 价格 ≤ ETA × 当前产出/秒 的项才会被购买(GDD §7.2)
  97. export const LIFE_ETA = 10; // 兵种同用 ETA(保留独立常量便于单独调参)
  98. /** 本轮价格系数 κ(π):π 越接近 1(低层指数极高),价格越极端,避免“低层扫货”
  99. * 价格乘区 = e^{κ·max(0, π − π_ref)},π_ref = 0.15 */
  100. export const KEXP = 6;
  101. export const PI_REF = 0.15;
  102. export const PI_CLAMP = 0.6; // 低层(π 极高)时的价格钳制:最多 ×e^(κ·(0.6−π_ref)) ≈ ×15
  103. export function piPrice(pi) { return Math.pow(PI_BASE, Math.max(0, Math.min(PI_CLAMP, (pi || 0)) - PI_REF)); }
  104. export const PI_BASE = 2; // 钳制后每高出 π_ref 0.1,价格 ×2^(0.1·κ/ln2)…(见 GDD §5.6.1)
  105. /** 本轮升级的真实价格 = 基础几何成本 × Π(π):π 越大(产出指数越高),价格越贵,从而抵消 R2 */
  106. export function piCostMul(pi) { return piPrice(pi); }
  107. export function costOf(kind, level) { const c = COST[kind]; return c.base * Math.pow(c.ratio, level); }
  108. export function batchCost(kind, level, n) {
  109. const c = COST[kind];
  110. return Math.ceil(c.base * Math.pow(c.ratio, level) * (Math.pow(c.ratio, n) - 1) / (c.ratio - 1));
  111. }
  112. export function maxAffordable(kind, level, essence) {
  113. const c = COST[kind];
  114. const first = c.base * Math.pow(c.ratio, level);
  115. if (!(essence >= first)) return 0;
  116. const n = Math.floor(Math.log(essence * (c.ratio - 1) / first + 1) / Math.log(c.ratio));
  117. return Math.min(PURCHASE_CAP, Math.max(0, n));
  118. }
  119. export function rootProdMul(level) { return Math.pow(Math.pow(1 + COST.root.per, level || 0), ROOT_EXP); }
  120. export function rootSpeedMul(level) { return Math.pow(1 + COST.root.per, level || 0); }
  121. export function canopySkip(level) { return Math.min(SKIP.cap, COST.canopy.per * (level || 0)); }
  122. /** 树冠的速度乘区(跳关是时间乘区;速度部分单独给,保证跳关封顶后仍有成长) */
  123. export function canopySpeedMul(level) { return Math.pow(1.08, level || 0); }
  124. // 永久乘区(除世界树/遗物外的简单加乘)
  125. export function multCreature(totalLevel) { return Math.max(1e-6, 1 + 0.08 * Math.max(0, (totalLevel || 0) - 30)); }
  126. export function multRelic(count) { return Math.pow(1.25, count || 0); }
  127. export function multRebirth(count) { return Math.max(1e-6, 1 + 0.10 * (count || 0)); }
  128. export function multExploration(explore) { return Math.max(1e-6, 1 + 2 * Math.max(0, explore || 0) / 100); }
  129. // ── 兵种(常驻推进跑道,持续生效) ──────────────────────────
  130. // 等级 n:升级成本 cost × 1.15^(n−1);技能强度 = 1 + per × n。解锁:上一兵种 ≥3 级。
  131. export const LIVES = [
  132. { id: 'sprout', race: '生命', name: '萌芽苔', cost: 25, eff: { kind: 'prod', per: 0.05 }, skill: '根系扎入跑道,本源产出 +5%/级', icon: 'sprout' },
  133. { id: 'firefly', race: '生命', name: '萤火虫', cost: 120, eff: { kind: 'speed', per: 0.04 }, skill: '沿根系迁徙,推进速度 +4%/级', icon: 'firefly' },
  134. { id: 'rootwalker', race: '生命', name: '根行者', cost: 900, eff: { kind: 'skip', per: 0.008 }, skill: '在层间挖掘捷径,跳关 +0.8%/级', icon: 'root' },
  135. { id: 'arbor', race: '星穹', name: '星穹古树', cost: 3e3, eff: { kind: 'prod', per: 0.10 }, skill: '庇护之树,本源产出 +10%/级', icon: 'tree' },
  136. { id: 'cometmoth', race: '星穹', name: '彗星蛾', cost: 1.2e4, eff: { kind: 'speed', per: 0.06 }, skill: '驮着树冠跨越星云,推进速度 +6%/级', icon: 'moth' },
  137. { id: 'constsign', race: '星穹', name: '星座使', cost: 8e4, eff: { kind: 'crystal', per: 0.05 }, skill: '记录星象:炼化收益 +5%、跳关加成 +1%/级', icon: 'sign' },
  138. { id: 'voideye', race: '虚空', name: '虚空之眼', cost: 5e5, eff: { kind: 'skip', per: 0.015 }, skill: '看穿壁垒,跳关 +1.5%/级', icon: 'eye' },
  139. { id: 'entropymaw', race: '虚空', name: '熵噬之喉', cost: 4e6, eff: { kind: 'prod', per: 0.20 }, skill: '吞吐侵蚀的本源,产出 +20%/级', icon: 'maw' },
  140. { id: 'lightstrider', race: '虚空', name: '光行者', cost: 3e7, eff: { kind: 'awake', per: 0.15 }, skill: '以光速掠过每一层,推进速度 +15%/级(长期成长)', icon: 'strider' },
  141. ];
  142. export const PI0 = Math.log(1.05) / (1 - Math.exp(-Math.log(1.05) * 10)); // π₀(=0.114):本轮前 10 层的参考指数
  143. export const LIFE_RATIO = 1.10;
  144. /** 兵种基础成本(永久基线):25 × 3^(序号) */
  145. export function lifeBase(idx) { return 25 * Math.pow(3, idx || 0); }
  146. export function lifeCostOf(baseCost, n, pi) { return baseCost * Math.pow(LIFE_RATIO, n - 1) * Math.max(1, KAPPA * Math.max(0, (pi || 0) - PI0)); }
  147. /** 兵种第 n 级的收益/成本比(产出类、速度类各自按 1.0/0.5 权重,跳关另算) */
  148. export function lifeEff(life, level) {
  149. const k = life.eff.kind === 'prod' ? 1.0 : life.eff.kind === 'speed' ? 0.5 : life.eff.kind === 'crystal' ? 1.0 : 0.6;
  150. return (life.eff.per * k) / lifeCostOf(life.cost, level + 1);
  151. }
  152. export const RACES = {
  153. 生命: { color: '#5FD68A', need: 2, bond: '共生:同种族达到 2 个兵种,本源产出 ×1.3(每多 1 个 ×1.3)' },
  154. 星穹: { color: '#7FB2FF', need: 2, bond: '观星:同种族达到 2 个兵种,炼化收益 ×1.3(每多 1 个 ×1.3)' },
  155. 虚空: { color: '#C08BFF', need: 2, bond: '凝视:同种族达到 2 个兵种,跳关触发率 +5%(每人 +5%,最多 +10%)' },
  156. };
  157. export const RACE_BOND_STEP = 2;
  158. export const RACE_BOND_MULT = 1.3;
  159. export const RACE_SKIP_BONUS = 0.05;
  160. export function raceStacks(race, count) { return Math.max(0, count - (RACES[race].need - 1)); }
  161. // ── 永久乘区(时间结晶,跨轮回) ───────────────────────────
  162. // 世界树等级 D:成本 30 × 1.9^D;每级 本源产出 ×1.05、推进速度 ×1.08(几何乘区)
  163. // 世界树等级 D:成本 30×1.9^D × max(1, κ(π−π₀))^0.5(与本源产出指数挂钩的“规则税”);每级 产出 ×1.05、速度 ×1.08
  164. export const TREE = { costBase: 30, costRatio: 1.9, prodPer: 0.05, speedPer: 0.08 };
  165. export function treeCostPI(level, pi) { return Math.ceil(treeCost(level) * Math.sqrt(Math.max(1, KAPPA * Math.max(0, (pi || 0) - PI0)))); }
  166. export function treeCost(level) { return Math.ceil(TREE.costBase * Math.pow(TREE.costRatio, level || 0)); }
  167. export function treeProdMul(level) { return Math.pow(1 + TREE.prodPer, level || 0); }
  168. export function treeSpeedMul(level) { return Math.pow(1 + TREE.speedPer, level || 0); }
  169. /** 世界树下一级的产出/成本收益比 */
  170. export function treeEff(level) { return TREE.prodPer / (1 + TREE.prodPer * level) / treeCost(level); }
  171. // 遗物(8 件):成本 50 × 2.6^i,每件 本源产出 ×1.25
  172. export const PERM = { relicBase: 50, relicRatio: 2.6, relicPer: 0.25, relicCount: 8 };
  173. export function relicCost(idx) { return Math.ceil(PERM.relicBase * Math.pow(PERM.relicRatio, idx)); }
  174. export function relicEff(idx) { return Math.log(1 + PERM.relicPer) / relicCost(idx); }
  175. export function relicMul(count) { return Math.pow(1 + PERM.relicPer, count || 0); }
  176. // 自由轮回(首次逃逸后永久解锁):每完成一次完整的 1000 层轮回,自由轮回加成 +10%
  177. export const FREEDOM = { per: 0.1 };
  178. export function freedomMul(state) { return Math.max(1e-6, 1 + FREEDOM.per * (state.freeCycles || 0)); }
  179. /** 残响(被动):炼化乘区 ×(1+0.02×已回溯次数) */
  180. export function resonanceMul(state) { return Math.max(1e-6, 1 + 0.02 * (state.rebirths || 0)); }
  181. export const RELICS = [
  182. { id: 'seed', name: '初生之种', desc: '本源产出 ×1.25', icon: 'seed' },
  183. { id: 'star', name: '坠星残片', desc: '本源产出 ×1.25', icon: 'star' },
  184. { id: 'gear', name: '古齿轮', desc: '本源产出 ×1.25', icon: 'gear' },
  185. { id: 'rune', name: '符文页', desc: '本源产出 ×1.25', icon: 'rune' },
  186. { id: 'hour', name: '沙漏', desc: '本源产出 ×1.25', icon: 'hourglass' },
  187. { id: 'leaf', name: '金叶', desc: '本源产出 ×1.25', icon: 'leaf' },
  188. { id: 'orbit', name: '环轨道', desc: '本源产出 ×1.25', icon: 'orbit' },
  189. { id: 'void', name: '空洞切片', desc: '本源产出 ×1.25', icon: 'void' },
  190. ];
  191. // ── 转生(时间回溯) ─────────────────────────────────────
  192. // 单次收益 R = ⌊0.5 × T^1.6 × E × M × ruleMod⌋(保底 1,T = 本轮最深;指数 1.6 > 回溯的 1.0,深度的收益超线性)
  193. // E 计入见闻;同一轮回内重复回溯收益 ×0.5^n。
  194. // E = 1 + 所有位面探索度之和/100(见闻)
  195. // M = 炼化乘区 = 兵种炼化技能 × 星穹羁绊 × 探索阶梯 × 跳关加成(1+min(0.3,0.5p)) × 见闻 × 自由轮回 × 残响
  196. // 本轮回溯成本 C(T) = 1 + (T/40)²;效率 = R/C。同一轮回内再次炼化收益 ×0.5^n。
  197. export const REBIRTH = { k: 0.5, power: 1.6, exploreDiv: 100, min: 1, costDiv: 40, decay: 0.5, skipNoteCap: 0.3 };
  198. export function rebirthCost(T) { return 1 + Math.pow(Math.max(0, T) / REBIRTH.costDiv, 2); }
  199. export function rebirthReward({ maxLayer = 0, exploreSum = 0, incomeMul = 1, ruleMod = 1 }) {
  200. const T = Math.max(0, maxLayer);
  201. const E = 1 + exploreSum / REBIRTH.exploreDiv;
  202. return Math.max(REBIRTH.min, Math.floor(REBIRTH.k * Math.pow(T, REBIRTH.power) * E * incomeMul * ruleMod));
  203. }
  204. // 回溯起始层:F = ⌊L − 16√L⌋(向下对齐 2 的倍数,且不超过 L/2)+ 位面起始加成(修仙 +100)
  205. export const RETURN_K = 16; // 回冲深度系数:L=1000 → F≈936(16√1000≈506 → 偶层对齐 936)
  206. /** 终局后(自由轮回)的起点:TOTAL − 16√TOTAL */
  207. export function earlyAfterEscape(rule, depth) {
  208. const d = Math.max(0, depth || TOTAL_LAYERS);
  209. return Math.min(d, Math.floor((d - RETURN_K * Math.sqrt(d)) / 2) * 2) + ((rule && rule.startBonus) || 0);
  210. }
  211. export function earlyLayer(maxLayerRound, rule, alreadyEscaped) {
  212. // 终局后的自由轮回:从终点往回“回填”(F = 本轮最深 − 16√本轮最深),不再从 0 起飞
  213. if (alreadyEscaped) return earlyAfterEscape(rule, TOTAL_LAYERS);
  214. // 回冲段:F = ⌊L − 16√L⌋(L = 本轮最深,偶层对齐,且不超过 0.75L);浅层回合的前半段不必重走
  215. const L = Math.max(0, maxLayerRound);
  216. const back = Math.floor((L - RETURN_K * Math.sqrt(Math.max(0, L))) / 2) * 2; // 回填后的层数(可能为负)
  217. return Math.min(Math.max(0, back), Math.floor(L * 0.75) * 2) + ((rule && rule.startBonus) || 0);
  218. }
  219. // ── 危机:侵蚀前沿 ─────────────────────────────────────
  220. export const CRISIS = {
  221. firstAt: 90, interval: 180, countdown: 120, // 首次 90 秒,此后每 180 秒一次;响应窗口 120 秒
  222. penalty: 0.5, penaltySec: 60,
  223. reward: 0.3, rewardSec: 90,
  224. braceSec: 45, bracePer: 0.5,
  225. relaxSkip: 5, holdLayers: 5, expireLayers: 3,
  226. relieveCost: 0.25,
  227. };
  228. // ── 位面(4 阶,规则松绑梯度) ─────────────────────────────
  229. export const PLANES = [
  230. { id: 0, key: 'real', tier: '一阶', name: '现实位面', metric: '文明等级', essence: '认知本源', color: '#5FA8D3', accent: '#9BD1F5',
  231. lore: '一切规则最严密的地方。这里没有魔法,只有因果、工程与不肯放弃的人。',
  232. rule: '坚固因果:全参数基准 ×1.00', bonus: '文明演进:文明事件链驱动主线' },
  233. { id: 1, key: 'tech', tier: '二阶', name: '科技位面', metric: '自动化覆盖率', essence: '信息本源', color: '#6C5CE7', accent: '#B7A8FF',
  234. lore: '无人值守的城市里,机器替人类继续演算。自动化是这个世界唯一的信仰。',
  235. rule: '自动化闭环:每秒为已解锁兵种免费 +1 级(上限 5 级)', bonus: '时间压缩:推进速度 ×1.25;锚定采集 ×1.25' },
  236. { id: 2, key: 'magic', tier: '三阶', name: '魔幻位面', metric: '魔力浓度', essence: '精神本源', color: '#C77DFF', accent: '#F0B2FF',
  237. lore: '故事在这里是真实的燃料。只要还有人在讲述,世界就不会熄灭。',
  238. rule: '叙事即魔法:每次跳关本源产出 ×1.3,持续 12 秒(叠乘,最多 10 层)', bonus: '故事共鸣:跳关触发率 +10%' },
  239. { id: 3, key: 'xiuxian', tier: '四阶', name: '修仙位面', metric: '灵气浓度', essence: '道之本源', color: '#2DD4BF', accent: '#FFD27A',
  240. lore: '大道无情,天道有功。修士以百年为一步,而你有世界树。',
  241. rule: '大道预算:转生结晶 ×1.5', bonus: '道基:转生返还本轮 50% 本源、起始层 +100、兵种保留 ×2' },
  242. ];
  243. export const PLANE_RULES = [
  244. { prodMult: 1.0, speedMult: 1.0, autoLives: false, narrateBoost: 0, skipMult: 1.0, rebirthMod: 1.0, rebirthKeep: 0, startBonus: 0, costMult: 1.0 },
  245. { prodMult: 1.0, speedMult: 1.25, autoLives: true, narrateBoost: 0, skipMult: 1.0, rebirthMod: 1.0, rebirthKeep: 0, startBonus: 0, costMult: 1.0, autoCap: 5 },
  246. { prodMult: 1.0, speedMult: 1.0, autoLives: false, narrateBoost: 1.3, skipMult: 1.1, rebirthMod: 1.0, rebirthKeep: 0, startBonus: 0, costMult: 1.0 },
  247. { prodMult: 1.0, speedMult: 1.0, autoLives: false, narrateBoost: 0, skipMult: 1.0, rebirthMod: 1.5, rebirthKeep: 0.5, startBonus: 100, costMult: 1.0 },
  248. ];
  249. export const PLANE_REBIRTH_MOD = PLANE_RULES.map((r) => r.rebirthMod);
  250. export const NARRATE_STACK_CAP = 10;
  251. export const NARRATE_SEC = 12;
  252. // 解锁:现实位面锚定 → 二阶;二阶锚定 → 三阶;三阶锚定 → 四阶
  253. export const PLANE_UNLOCK_AT = [{ plane: 1, from: 0 }, { plane: 2, from: 1 }, { plane: 3, from: 2 }];
  254. export const EXPLORE_FULL = 100;
  255. export const EXPLORE_TIERS = [
  256. { at: 20, prod: 0.25, crystal: 1.0, label: '本源产出 +25%' },
  257. { at: 50, prod: 0.60, crystal: 1.0, label: '本源产出 +60%' },
  258. { at: 80, prod: 1.00, crystal: 1.15, label: '本源产出 +100%,炼化收益 +15%' },
  259. { at: 100, prod: 1.50, crystal: 1.30, label: '本源产出 +150%,炼化 +30%,位面锚定:后台自动采集', anchor: true },
  260. ];
  261. export function exploreTierOf(explore) {
  262. let t = { at: 0, prod: 0, crystal: 1, label: '未勘探' };
  263. for (const x of EXPLORE_TIERS) if (explore >= x.at) t = x;
  264. return t;
  265. }
  266. export function planeUnlocked(state, p) {
  267. if (p === 0) return true;
  268. const rule = PLANE_UNLOCK_AT.find((u) => u.plane === p);
  269. return !!rule && (state.planes?.[rule.from]?.explore || 0) >= EXPLORE_FULL;
  270. }
  271. // ── 里世界肉鸽 ────────────────────────────────────────
  272. export const LIFE_ECHO_CAP = 40; // 溯时回响:兵种等级先封顶 40,再按 20% 保留
  273. export const RIFT = { cooldownSec: 20, energy: 12 };
  274. export const RIFT_ENVS = [
  275. { name: '灰烬回廊', desc: '灾变后的城市废墟,路灯仍在为不存在的人亮着。', color: '#5FA8D3' },
  276. { name: '演算之海', desc: '无人的服务器阵列深处,数据像潮水一样涨落。', color: '#6C5CE7' },
  277. { name: '镜灰王庭', desc: '碎镜拼成的王座,每个倒影都在讲述不同的故事。', color: '#C77DFF' },
  278. { name: '九霄残山', desc: '漂浮的山峰残片,灵气稀薄如将灭的烛火。', color: '#2DD4BF' },
  279. ];
  280. export const RULE_IDS = ['knowledge', 'oath', 'belief', 'judge'];
  281. export const RULE_NAMES = { knowledge: '知识', oath: '誓约', belief: '信念', judge: '裁决' };
  282. export const RULE_COLORS = { knowledge: '#5FA8D3', oath: '#7FB2FF', belief: '#5FD68A', judge: '#F0C060' };
  283. // 探索度增量:通关 ⌊6 + 分/50⌋、失败 ⌊6 + 分/100⌋(失败也有价值,且随分数变好)
  284. // 探索度按阶缩放:阶越高,同样一局带回的探索越多(高阶位面难,但回报值得)
  285. export function riftExploreDelta(steps, score, cleared, plane = 0) {
  286. const sc = Math.max(0, score);
  287. const base = cleared ? 6 + sc / 50 : 6 + sc / 100;
  288. return Math.floor(base * (1 + 0.35 * plane));
  289. }
  290. // ── 挂机支线(锚定位面后台采集) ─────────────────────────
  291. export const ANCHOR_COLLECT_SEC = 60;
  292. export const ANCHOR_RATE = 0.02;
  293. // ── 离线 / 事件节奏 ──────────────────────────────────
  294. export const OFFLINE = { capSec: 8 * 3600, eff: 0.6 };
  295. export const EVENT = {
  296. lifeKeep: 0.2, // 溯时回响:转生后兵种等级保留 20%(上限 LIFE_ECHO_CAP;修仙 ×2)
  297. civSec: 75,
  298. autoRebirthDefault: 120, // 禅定默认每 120 秒回溯一次(但只在离最优回溯点足够近时执行)
  299. };
  300. // ── 文明氛围小事件(轻量被动事件:每 36~54 秒按当前章节播放一条叙事并给一点小 bonus) ──
  301. export const AMBIENT_EVENTS = [
  302. { text: '无线电里传来断断续续的童谣,根须跟着节奏轻轻摇摆。', bonus: '本源 +6 秒产出' },
  303. { text: '旧城区的路灯依次点亮,像一条向北的航标。', bonus: '推进速度 ×1.2(20 秒)' },
  304. { text: '有人在树根下种了一株野花。它开出了不属于地球的颜色。', bonus: '探索度 +1(当前位面)' },
  305. { text: '一台无人探测器传回最后一张星图:空洞的边缘比想象中更近。', bonus: '本源 +8 秒产出' },
  306. { text: '孩子们用粉笔在地上画出世界树的根,一直画出了城市。', bonus: '跳关触发率 +10%(30 秒)' },
  307. { text: '图书馆里最厚的书被翻开在第一页:一切都从一颗种子开始。', bonus: '本源产出 ×1.25(30 秒)' },
  308. { text: '月面上亮起一排灯,像是在向地球招手。', bonus: '推进速度 ×1.3(20 秒)' },
  309. { text: '一艘运输舰从旋臂边缘归来,货舱里装满了陌生的星尘。', bonus: '本源 +12 秒产出' },
  310. { text: '星系中心的黑洞喷流改变了方向,像一支指向空洞之外的箭头。', bonus: '跳关触发率 +10%(30 秒)' },
  311. { text: '本星系群的邻居发来了同样的回声:我们也在逃。', bonus: '本源产出 ×1.3(30 秒)' },
  312. ];
  313. export const AMBIENT = { everyMin: 36, everyMax: 54 };