| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- // 《世界树 · 逃离空洞》数值配置与纯公式(无副作用,可被测试直接 import)。
- // 所有常量与 GDD.md「数值表」逐节对应:修改时两边同步。
- // 署名:FmodeCode
- export const SAVE_KEY = 'worldtree_escape_save_v1';
- export const SAVE_VERSION = 1;
- export const GAME_SEC_PER_TICK = 0.1; // 逻辑 tick 固定步长(秒),存档秒数计算偏移不超过 0.1s
- // ── 主线:逃离室女座空洞(连续空间) ─────────────────────────
- // 主线进度 = K × 抵达层数 L。各章 = 一段连续空间,章内无结算弹窗。
- export const PROGRESS_PER_LAYER = 5; // 每层 = 主线进度 5 单位
- export const TOTAL_LAYERS = 1000; // 抵达第 1000 层 = 冲出空洞(主线进度 5000)
- export const MAINLINE_TARGET = PROGRESS_PER_LAYER * TOTAL_LAYERS;
- export const CHAPTERS = [
- { idx: 0, at: 0, short: '地球', title: '保护地球', desc: '空洞前沿已越过柯伊伯带,地球是最后一处有生命的声音。' },
- { idx: 1, at: 1000, short: '太阳系', title: '脱离太阳系', desc: '把整颗星球托进世界树的根系,太阳系成为空洞中的第一枚灯塔。' },
- { idx: 2, at: 2000, short: '旋臂', title: '脱离猎户旋臂', desc: '根系铺满旋臂,星云在树冠下重新聚合为航路。' },
- { idx: 3, at: 3000, short: '银河', title: '脱离银河系', desc: '银河的旋涡在身后合拢,世界树第一次长到了星系之外。' },
- { idx: 4, at: 4000, short: '本星系群', title: '脱离本星系群', desc: '本星系群的引力潮被抵消,空洞的边界第一次出现在视野里。' },
- { idx: 5, at: 5000, short: '空洞外', title: '冲出空洞', desc: '室女座空洞之外,还有一片未被规则侵蚀的星空。' },
- ];
- /** 当前主线进度对应的章序号(0..5) */
- export function chapterOf(progress) {
- let c = 0;
- for (const ch of CHAPTERS) if (progress >= ch.at) c = ch.idx;
- return c;
- }
- // ── 连续推进:层级 ↔ 进度(L = √(P/10),P = 10L²) ────────────
- export function layerFloat(progress) { return Math.sqrt(Math.max(0, progress) / 10); }
- export function layerLength(L) { return 20 * L + 10; } // 第 L 层 → L+1 层的长度
- export function layerStart(L) { return 10 * L * L; } // 第 L 层起点进度
- // ── 连续行军的核心时序 ─────────────────────────────────────
- // 单层用时 T(L) = 10L + 4 秒;层中匀速推进。
- // 跳关使「当前层剩余」耗时的期望 = T / (1 + E[k]),即时间维度乘区。
- export const MARCH = { visitBase: 4, visitPerLayer: 10 };
- export function visitTime(L) { return MARCH.visitBase + MARCH.visitPerLayer * L; }
- export const SKIP = { minK: 1, maxK: 4, factor: 0.5 };
- /** 跳关分布:P(k) = p·P₀(k),P₀(k) ∝ 0.5^(k−1),k ∈ [1,4],归一化和为 p */
- export function skipPlan(pEff) {
- const { minK: a, maxK: b } = SKIP;
- const w = [];
- let sum = 0;
- for (let k = a; k <= b; k++) { const x = Math.pow(SKIP.factor, k - a); w.push(x); sum += x; }
- const p = clamp01(pEff, 0.95);
- const ks = [], probs = [];
- for (let k = a; k <= b; k++) { ks.push(k); probs.push(p * w[k - a] / sum); }
- return { p, ks, probs };
- }
- /** 跳关期望 E[k] = p × Σ k·P₀(k) = p × (1+2·½+3·¼+4·⅛)/(1+½+¼+⅛) = p × 20/15 */
- export function skipExpectation(pEff) {
- const { ks, probs } = skipPlan(pEff);
- return ks.reduce((s, k, i) => s + k * probs[i], 0);
- }
- /** 时间维度乘区:1 + E[k] */
- export function timeMul(pEff) { return 1 + skipExpectation(pEff); }
- // ── 本源产出(指数基础 × 多乘区) ───────────────────────────
- export const ESSENCE_BASE = 1;
- export const ESSENCE_GROWTH = 1.05; // 每层基础产出 ×1.05
- export function essencePerLayer(layer) { return Math.pow(ESSENCE_GROWTH, layer); }
- // 侵蚀前沿:第 L 层本源的额外 ×1.15^L(「深度即财富」)
- export function erosionMult(layer) { return Math.pow(1.15, layer); }
- // ── 本轮升级(消耗本源)几何成本 C = base × ratio^level ───────
- export const COST = {
- root: { base: 10, ratio: 1.08, name: '根须', desc: '每级 本源产出 +8%(独立乘区)' },
- canopy: { base: 60, ratio: 1.12, name: '树冠', desc: '每级 跳关概率 +1.5%(上限 95%)' },
- seedbed: { base: 400, ratio: 1.10, name: '苗圃', desc: '每级 兵种技能效果 +25%(开局 ×2)' },
- };
- export function costOf(kind, level) { const c = COST[kind]; return c.base * Math.pow(c.ratio, level); }
- /** 批量购买最优(指数成本恰好可求和):能买 n 个的最大 n(n=∞ 返回 70) */
- export function maxAffordable(kind, level, essence) {
- const c = COST[kind];
- const first = c.base * Math.pow(c.ratio, level);
- if (essence < first) return 0;
- if (c.ratio === 1) return Math.floor(essence / first);
- const n = Math.floor(Math.log(essence * (c.ratio - 1) / first + 1) / Math.log(c.ratio));
- return Math.min(70, Math.max(0, n));
- }
- /** 第 level..level+n-1 级的合计成本 */
- export function batchCost(kind, level, n) {
- const c = COST[kind];
- const first = c.base * Math.pow(c.ratio, level);
- return Math.ceil(first * (Math.pow(c.ratio, n) - 1) / (c.ratio - 1));
- }
- /** 兵种升级成本 cost(L) = base × 1.15^(L−1) */
- export const LIFE_RATIO = 1.15;
- export function lifeCostOf(baseCost, level) { return baseCost * Math.pow(LIFE_RATIO, level - 1); }
- // ── 永久乘区(时间结晶) ───────────────────────────────
- export const PERM = {
- mindBase: 15, mindRatio: 1.2, mindPer: 0.15, // 心智树 h:成本 15×1.2^h,每级全局产出 ×(1+0.15h)
- relicBase: 4, relicCostMult: 2.5, relicPer: 0.25, // 遗物(有限 8 件):成本 4×2.5^i,每件 本源产出 ×1.25
- ascBase: 200, ascRatio: 3, ascPer: 0.25, // 升维(时间结晶):成本 200×3^a,每级 全局产出 ×(1+0.25a)
- };
- export function mindCost(level) { return Math.ceil(PERM.mindBase * Math.pow(PERM.mindRatio, level)); }
- export function mindMul(level) { return 1 + PERM.mindPer * level; }
- export function relicCost(nextIndex) { return Math.ceil(PERM.relicBase * Math.pow(PERM.relicCostMult, nextIndex)); }
- export function relicMul(count) { return Math.pow(1 + PERM.relicPer, count || 0); }
- export function ascCost(level) { return Math.ceil(PERM.ascBase * Math.pow(PERM.ascRatio, level)); }
- export function ascMul(level) { return 1 + PERM.ascPer * (level || 0); }
- // ── 转生结晶 ───────────────────────────────────────────
- // 单次炼化收益 R = 0.15 × (G+1) × M × (1+log10(1+maxL)) × C₂
- // G = Σ已锚定位面探索度/100(每锚定 +15%),M = 本源收益乘区(转生时快照),maxL = 本轮最深层
- // 重复炼化同轮回收益衰减 ÷2^已炼化次数(仍然保留「早转 vs 硬熬」)——见 state.js
- export const REBIRTH = {
- k: 0.15, planeBonus: 0.15, min: 1,
- inPlaneMul: 0.35, // 在里世界(时间冻结)中转生:收益 ×0.35(防止占着时空稳定器白拿)
- autoFrac: 0.5, // 自动转生冻结 50%
- };
- export function earlyLayer(minL) { return Math.floor(minL * 0.35); } // 新生世界树起始层 = 最深×35%
- export function rebirthReward({ maxLayer, planeSumPct = 0, incomeMul = 1, rebirthCount = 0, ruleMod = 1 }) {
- const g = 1 + REBIRTH.planeBonus * (planeSumPct / 100);
- const raw = REBIRTH.k * (g) * incomeMul * (1 + Math.log10(1 + Math.max(0, maxLayer))) * ruleMod;
- return Math.max(REBIRTH.min, Math.floor(raw));
- }
- /** 预计可炼化结晶(含重生次数衰减 / 里世界折减) */
- export function crystalGain(state, incomeMul) {
- const base = rebirthReward({
- maxLayer: state.round?.maxLayer || 0,
- planeSumPct: state.planeSumPct || 0,
- incomeMul,
- ruleMod: PLANE_REBIRTH_MOD[state.currentPlane] || 1,
- });
- const decay = Math.pow(0.5, state.round?.refines || 0);
- const inPlane = state.planeRun?.active ? REBIRTH.inPlaneMul : 1;
- return Math.max(1, Math.floor(base * decay * inPlane));
- }
- // ── 位面 ─────────────────────────────────────────────
- export const PLANES = [
- { id: 0, key: 'real', tier: '一阶', name: '现实位面', metric: '文明等级', essence: '认知本源', color: '#5FA8D3', accent: '#9BD1F5',
- lore: '一切规则最严密的地方。这里没有魔法,只有因果、工程与不肯放弃的人。',
- rule: '坚固因果:世界树生长与本源产出 ×1.00', bonus: '文明演进:文明事件链,科技节点驱动主线' },
- { id: 1, key: 'tech', tier: '二阶', name: '科技位面', metric: '自动化覆盖率', essence: '信息本源', color: '#6C5CE7', accent: '#B7A8FF',
- lore: '无人值守的城市里,机器替人类继续演算。自动化是这个世界唯一的信仰。',
- rule: '自动化闭环:兵种以自动速度生长,生产不依赖访视', bonus: '时间压缩:世界树推进 ×1.25' },
- { id: 2, key: 'magic', tier: '三阶', name: '魔幻位面', metric: '魔力浓度', essence: '精神本源', color: '#C77DFF', accent: '#F0B2FF',
- lore: '故事在这里是真实的燃料。只要还有人在讲述,世界就不会熄灭。',
- rule: '叙事即魔法:每次跳关发生,本源产出 ×1.3(乘法)', bonus: '故事共鸣:跳关概率 +10%' },
- { id: 3, key: 'xiuxian', tier: '四阶', name: '修仙位面', metric: '灵气浓度', essence: '道之本源', color: '#2DD4BF', accent: '#FFD27A',
- lore: '大道无情,天道有功。修士以百年为一步,而你有世界树。',
- rule: '大道预算:转生结晶 ×1.5', bonus: '道基:每次转生返还 50% 本源(更低回溯代价)' },
- ];
- /** 位面规则参数(规则即数值:改这里就是松绑) */
- export const PLANE_RULES = [
- { incomeMult: 1.00, marchMult: 1.00, autoLives: false, skipOnNarrate: 1.0, skipBonus: 0, rebirthMod: 1.0, rebirthKeep: 0, costMult: 1.00 },
- { incomeMult: 1.00, marchMult: 1.25, autoLives: true, skipOnNarrate: 1.0, skipBonus: 0, rebirthMod: 1.0, rebirthKeep: 0, costMult: 1.00 },
- { incomeMult: 1.00, marchMult: 1.00, autoLives: false, skipOnNarrate: 1.3, skipBonus: 0.10, rebirthMod: 1.0, rebirthKeep: 0, costMult: 1.00 },
- { incomeMult: 1.00, marchMult: 1.00, autoLives: false, skipOnNarrate: 1.0, skipBonus: 0, rebirthMod: 1.5, rebirthKeep: 0.5, costMult: 1.00 },
- ];
- export const PLANE_REBIRTH_MOD = PLANE_RULES.map((r) => r.rebirthMod);
- export const PLANE_UNLOCK_AT = [ // 前任位面锚定探索度达标即解锁下一阶通道
- { plane: 1, needSumPct: 50 },
- { plane: 2, needSumPct: 100 },
- { plane: 3, needSumPct: 150 },
- ];
- export const EXPLORE_FULL = 100;
- /** 探索度阶梯(按该位面探索度 x):取满足条件的最高一档 */
- export const EXPLORE_TIERS = [
- { at: 20, prod: 0.20, crystal: 1.00, label: '本源产出 +20%' },
- { at: 50, prod: 0.50, crystal: 1.00, label: '本源产出 +50%' },
- { at: 80, prod: 0.80, crystal: 1.15, label: '本源产出 +80%,炼化收益 +15%' },
- { at: 100, prod: 1.00, crystal: 1.30, label: '本源产出 +100%,炼化 +30%,锚定:后台自动采集', anchor: true },
- ];
- export function exploreTierOf(explore) {
- let t = { at: 0, prod: 0, crystal: 1, label: '' };
- for (const x of EXPLORE_TIERS) if (explore >= x.at) t = x;
- return t;
- }
- export function planeUnlocked(state, p) {
- if (p === 0) return true;
- const need = PLANE_UNLOCK_AT[p - 1]?.needSumPct ?? Infinity;
- return (state.planeSumPct || 0) >= need;
- }
- // ── 兵种(常驻推进跑道,持续生效) ──────────────────────────
- // eff: prod 本源产出(addition 进同一收益乘区);speed 推进速度;skip 跳关概率;crystal 炼化(addition)
- export const LIVES = [
- { id: 'sprout', race: '生命', name: '萌芽苔', cost: 25, eff: { kind: 'prod', per: 0.05 }, skill: '根系扎入跑道,产出越久越旺' },
- { id: 'firefly',race: '生命', name: '萤火虫', cost: 120, eff: { kind: 'speed', per: 0.04 }, skill: '沿根系迁徙,替世界树探路' },
- { id: 'rootwalker', race: '生命', name: '根行者', cost: 900, eff: { kind: 'skip', per: 0.008 }, skill: '在层间挖掘捷径' },
- { id: 'arbor', race: '星穹', name: '星穹古树', cost: 3000, eff: { kind: 'prod', per: 0.10 }, skill: '远古先民所化的庇护之树' },
- { id: 'cometmoth', race: '星穹', name: '彗星蛾', cost: 12000, eff: { kind: 'speed', per: 0.06 }, skill: '驮着树冠跨越星云' },
- { id: 'constsign', race: '星穹', name: '星座使', cost: 8e4, eff: { kind: 'crystal', per: 0.03 }, skill: '记录每次回溯的星象,提高炼化' },
- { id: 'voideye', race: '虚空', name: '虚空之眼', cost: 5e5, eff: { kind: 'skip', per: 0.015 }, skill: '直视空洞,看穿层层壁垒' },
- { id: 'entropymaw', race: '虚空', name: '熵噬之喉', cost: 4e6, eff: { kind: 'prod', per: 0.20 }, skill: '吞吐被侵蚀的本源' },
- { id: 'lightstrider', race: '虚空', name: '光行者', cost: 3e7, eff: { kind: 'speed', per: 0.10 }, skill: '以光速掠过每一层' },
- ];
- export const RACES = {
- 生命: { color: '#5FD68A', bond: '共生:已解锁 生命 兵种每 3 个 → 本源产出 ×1.25(递归)' },
- 星穹: { color: '#7FB2FF', bond: '观星:已解锁 星穹 兵种每 3 个 → 炼化收益 ×1.25(递归)' },
- 虚空: { color: '#C08BFF', bond: '凝视:已解锁 虚空 兵种每 3 个 → 跳关概率 +5%' },
- };
- export const RACE_BOND_STEP = 3;
- export const RACE_BOND_MULT = 1.25;
- export const RACE_SKIP_BONUS = 0.05;
- // ── 跳关标记:魔幻位面用 ───────────────────────────────
- export const NARRATE_STACK_CAP = 10;
- // ── 危机:侵蚀前沿 ─────────────────────────────────────
- export const CRISIS = {
- firstAt: 90, interval: 180, countdown: 120, // 首次 90s,此后每 180s 一次;响应窗口 120s
- nearEnd: 0.60, // 侵蚀推进到 60% 进度时,前沿逼近剧情
- penalty: 0.50, penaltySec: 60, // 未响应:本源产出 ×0.5,持续 60s
- reward: 0.30, rewardSec: 90, // 成功压制:本源产出 ×1.3,持续 90s
- skipOnRelieve: 5, // 「转移前沿」:立即跳 5 层
- };
- // ── 里世界肉鸽 ────────────────────────────────────────
- export const RIFT = {
- cdSec: 40, runSec: 150, energy: 20, energyPerStep: 1,
- rules: ['现实位面', '科技位面', '魔幻位面', '修仙位面'],
- trials: [
- { name: '规则裂隙', sub: '残缺的物理法则在此处断裂', need: '知识', needN: 4 },
- { name: '誓约回廊', sub: '誓约在此刻生效,也必须在此刻兑现', need: '誓约', needN: 4 },
- { name: '天问之秤', sub: '天平只称量信念的重量', need: '信念', needN: 4 },
- { name: '灰烬法庭', sub: '一切过错都将在此被审判', need: '裁决', needN: 5 },
- ],
- };
- export const RULE_IDS = ['knowledge', 'oath', 'belief', 'judge'];
- export const RULE_NAMES = { knowledge: '知识', oath: '誓约', belief: '信念', judge: '裁决' };
- export const RULE_COLORS = { knowledge: '#5FA8D3', oath: '#7FB2FF', belief: '#5FD68A', judge: '#F0C060' };
- export const RIFT_TEAM_SIZE = 4;
- /** 局内结算:探索度增量 = floor(√最高层 + 1) + ⌊结算分/10⌋;本源 = 探索度增量 × 当前本源秒产 ×8 */
- export const RIFT_ESSENCE_SECONDS = 8;
- export function riftExploreDelta(topFloor, score, cleared) {
- const base = Math.floor(Math.sqrt(Math.max(0, topFloor)) + 1) + Math.floor(Math.max(0, score) / 10);
- return Math.max(1, Math.round(base * (cleared ? 1.5 : 1)));
- }
- export function riftShard(score, cleared) { return Math.max(2, Math.floor(score * (cleared ? 0.6 : 0.4))); }
- // ── 挂机支线(锚定位面后台采集) ─────────────────────────
- export const ANCHOR_COLLECT_SEC = 60; // 每 60 秒采集一次
- export const ANCHOR_RATE = 0.02; // 每次 = 当前本源秒产 ×2%(0 秒开始,连点无效)
- // ── 离线 ────────────────────────────────────────────
- export const OFFLINE = { capSec: 8 * 3600, eff: 0.6 };
- // ── 事件节奏 ─────────────────────────────────────────
- export const EVENT = {
- civSec: 70, // 文明事件:平均每 70 秒(现实位面)
- crisisHintSec: 6, // 前沿逼近提示
- };
- // ── 小工具 ───────────────────────────────────────────
- function clamp01(v, hi) { return Math.max(0, Math.min(hi, Number(v) || 0)); }
|