Ver Fonte

feat: 地质环境系统(7 种环境效果,随深度轮换)+ HUD 环境条;UI 细节修正

LiuYuYang há 1 semana atrás
pai
commit
cfa0b85477

+ 15 - 0
css/style.css

@@ -316,6 +316,7 @@ button:disabled { cursor: not-allowed; opacity: .45; }
 .guide .g { flex: 1; font-size: 12.5px; line-height: 1.6; color: #1c5c3a; }
 .guide .g b { color: #123f28; }
 .guide .x { border: 0; background: transparent; color: #1c5c3a; font-size: 16px; padding: 2px 6px; }
+.panel .guide { display: flex; flex-direction: row; align-items: center; }
 .pulse { animation: pulse 1.8s ease-in-out infinite; }
 @keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(47,174,107,.0); } 50% { box-shadow: 0 0 0 4px rgba(47,174,107,.18); } }
 
@@ -458,3 +459,17 @@ button:disabled { cursor: not-allowed; opacity: .45; }
 .ct-inline { padding: 0 18px 16px; }
 .ct-inline .foot-row { margin-top: 10px; }
 .modal .foot:empty { display: none; }
+
+/* 地质环境条 */
+.env-strip { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; background: rgba(18,26,43,.62); border: 1px solid rgba(255,255,255,.12); border-radius: 9px; padding: 6px 10px; color: #e6ecf5; font-size: 11px; backdrop-filter: blur(2px); }
+.env-strip b { font-size: 12px; white-space: nowrap; }
+.env-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
+.env-eff { white-space: nowrap; color: #b9c6d8; }
+.env-prog { flex: 0 0 64px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
+.env-prog i { display: block; height: 100%; }
+.env-left { color: #93a2b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+@media (max-width: 760px) { .env-strip { bottom: 8px; left: 8px; right: 8px; font-size: 10.5px; } .env-left { display: none; } }
+
+.hud { flex-wrap: wrap; right: 130px; }
+.hud .hud-meta { max-width: 46%; }
+@media (max-width: 600px) { .hud { right: 10px; } .hud .hud-meta { max-width: 60%; } }

+ 1 - 0
index.html

@@ -44,6 +44,7 @@
           <div class="hud-r" id="hud-r"></div>
           <div id="float-layer"></div>
           <div class="badge-magic" id="magic-badge" hidden></div>
+          <div class="env-strip" id="env-strip"></div>
         </div>
         <div class="rift-slot" id="rift-slot" hidden></div>
         <div class="actions" id="actions"></div>

+ 11 - 0
js/config.js

@@ -54,6 +54,17 @@ export function skipExpectation(pEff) {
 }
 export function timeMul(pEff) { return 1 + skipExpectation(pEff); }
 
+export const ENVS = [
+  { id: 'env0', name: '气态尘埃带', color: '#8B93A7', depth: 1.3, desc: '初入空洞边缘,尘屑拖慢世界树', eff: '慢:推进速度 ×0.85' },
+  { id: 'env1', name: '引力乱流', color: '#6C8EBF', depth: 1.5, desc: '混乱的引力让根系难以吸收本源,但勘探更有价值', eff: '本源产出 ×0.8' },
+  { id: 'env2', name: '规则回廊', color: '#C77DFF', depth: 2.2, desc: '残破的规则在此排列,跳关变得容易', eff: '每 10 秒跳关触发率 +20%' },
+  { id: 'env3', name: '星火苗床', color: '#FFB86B', depth: 2.0, desc: '在星尘中收集火种,等待点燃', eff: '火种子:攒 10 枚,一次性本源 ×2.5', fire: true },
+  { id: 'env4', name: '虚空潮汐', color: '#3B475C', depth: 2.6, desc: '虚空会吞掉暂存的本源——及时花掉,或尽快回溯', eff: '持有本源每秒流失 2%(侵蚀)', drain: 0.02 },
+  { id: 'env5', name: '金枝回廊', color: '#E3B341', depth: 2.2, desc: '金色树汁涌出,产出暴增但推进不变', eff: '本源产出 ×1.6' },
+  { id: 'env6', name: '镜像残响', color: '#9FE7D2', depth: 2.8, desc: '世界树的残影在前方替你开路', eff: '每层 30% 概率额外 +1 层(跳关加速)', echo: 0.3 },
+  { id: 'env7', name: '熵之温室', color: '#C08BFF', depth: 3.0, desc: '高熵环境加速一切,也加速敌人的侵蚀(危机间隔 ×0.7)', eff: '本源产出 ×1.4,推进速度 ×1.1', entropy: true },
+];
+
 // ── 本源产出(连续空间:产出 = 对已抵达层求和的“本源密度”) ──────────
 // 第 L 层的本源密度 β(L) = 1.05^(L−F) × P_root(R),F = 本轮起始层,R = 根须等级。
 // 新一轮产出/秒 = ∫_F^L β = P_root(R) × (1.05^L − 1)/(1.05·ln1.05)(GDD §6.5 式 9;GDD 符号 B(L) 即此值)。

+ 27 - 5
js/formulas.js

@@ -4,6 +4,25 @@ import * as C from './config.js';
 
 const nowSec = () => Date.now() / 1000;
 
+/** 当前所在的“地质环境”(按本轮深度 D 分段,每 18 层一换;循环取用) */
+export function envOf(layer, start) {
+  const D = Math.max(0, (layer || 0) - (start || 0));
+  return C.ENVS[Math.floor(D / 18) % C.ENVS.length];
+}
+/** 环境对产出 / 速度 / 跳关的影响 */
+export function envFactors(at) {
+  const id = at && at.id;
+  return {
+    prod: id === 'env1' ? 0.8 : id === 'env5' ? 1.6 : id === 'env7' ? 1.4 : 1,
+    speed: id === 'env0' ? 0.85 : id === 'env7' ? 1.1 : 1,
+    skipBonus: id === 'env2' ? 0.2 : 0,
+    echo: id === 'env6' ? 0.3 : 0,
+    drain: id === 'env4' ? 0.02 : 0,
+    fire: id === 'env3',
+    entropy: id === 'env7',
+  };
+}
+
 /** 本轮起始层 F */
 export function F0(state) { return C.earlyLayer(state.maxLayerRound || 0, C.PLANE_RULES[state.currentPlane || 0]); }
 
@@ -108,13 +127,16 @@ export function computeStats(state) {
   const rootP = C.rootProdMul(state.upgrades?.root || 0);
   const base = C.essenceBase(L, rootP);
   // 兜底:从“零层起步”(新存档 / 离线后回到初始轮回)时,至少给 本源产出 1/秒,避免 F=L 导致产出恒为 0
-  const prodRaw = (L - start < 1e-9 && L < 1) ? 1 : base * Mprod;
+  const env = envOf(L, start);
+  const ef = envFactors(env);
+  const prodRaw = (L - start < 1e-9 && L < 1) ? 1 : base * Mprod * ef.prod * ((state._fireBoost || 0) > now ? 2.5 : 1);
 
   const gm = marchBase(L, start);
   const Mspd = speedMulOf(state) * (crisisPenalty ? 1 - C.CRISIS.penalty : 1);
-  const layerSec = C.visitTime(L) * gm / Mspd;
-  const layersPerSec = Mspd / (C.visitTime(L) * gm);
-  const skipP = skipProbOf(state, sk);
+  const MspdEnv = Mspd * ef.speed;
+  const layerSec = C.visitTime(L) * gm / MspdEnv;
+  const layersPerSec = MspdEnv / (C.visitTime(L) * gm);
+  const skipP = Math.min(C.SKIP.cap - 1e-6, skipProbOf(state, sk) + ef.skipBonus + ((state._skipBoostUntil || 0) > now ? 0.2 : 0));
   const skipExp = C.skipExpectation(skipP);
   const timeMul = 1 + skipExp;
   const rebirthM = rebirthMOf(state, sk);
@@ -123,7 +145,7 @@ export function computeStats(state) {
     plane: p, rule, start, base, rootP, prodMul: Mprod, mults, frozen,
     prodRaw, prod: frozen ? 0 : prodRaw,
     creatureLv: sk.total, skills: sk, tier, explore,
-    gm, speedMul: Mspd, layerSec, layersPerSec, minutesPerLayer: (layerSec * timeMul) / 60,
+    env, envFactors: ef, gm, speedMul: MspdEnv, layerSec, layersPerSec, minutesPerLayer: (layerSec * timeMul) / 60,
     skipP, skipExp, timeMul,
     rebirthM, reward, rebirthCost: C.rebirthCost(state.maxLayerRound || 0),
     crisisBuff, crisisPenalty, crisisMult, narrate, narrSig, anchored: explore >= C.EXPLORE_FULL,

+ 8 - 2
js/state.js

@@ -178,6 +178,12 @@ export function tick(s, rift, dt) {
   s.layer += st.layersPerSec * dt;
   s.essence += st.prod * dt;
   s.maxLayerRound = Math.max(s.maxLayerRound, s.layer);
+  // 地质环境:火种子床攒 10 枚点火(本源 ×2.5 / 20 秒);虚空潮汐流失本源;熵之温室缩短危机间隔
+  if (st.envFactors) {
+    if (st.envFactors.fire) { s._fireAcc = (s._fireAcc || 0) + st.layersPerSec * dt; if (s._fireAcc >= 10) { s._fireAcc -= 10; s._fireBoost = now + 20; out.envEvent = 'fire'; } }
+    if (st.envFactors.drain > 0) s.essence *= Math.max(0, 1 - st.envFactors.drain * dt);
+    if (st.envFactors.echo > 0 && Math.random() < st.envFactors.echo * st.layersPerSec * dt) { s.layer += 1; s.maxLayerRound = Math.max(s.maxLayerRound, s.layer); out.envEvent = 'echo'; }
+  }
   // 连续空间的“逃逸进度”= 本轮回抵达的深度 = maxLayerRound(不回退);主世界层数最多推进到终点,溢出归零
   if (s.layer > C.TOTAL_LAYERS) s.layer = C.TOTAL_LAYERS;
 
@@ -216,11 +222,11 @@ export function tick(s, rift, dt) {
     s.magic.sigUntil = s.magic.sig > 0 ? (s.magic.sigUntil || now) + C.NARRATE_SEC : now;
   }
 
-  // 危机事件计时(UI 层弹窗;窗口内未响应 = 前沿逼近)
+  // 危机事件计时(UI 层弹窗;窗口内未响应 = 前沿逼近);熵之温室中事件更频繁
   const c = s.crisis;
   if (!c.active) {
     c.next -= dt;
-    if (c.next <= 0) { c.active = true; c.popUntil = dt + C.CRISIS.countdown; c.next = C.CRISIS.interval; out.crisis = true; }
+    if (c.next <= 0) { c.active = true; c.popUntil = dt + C.CRISIS.countdown; c.next = C.CRISIS.interval * (st.envFactors && st.envFactors.entropy ? 0.7 : 1); out.crisis = true; }
   } else {
     c.popUntil -= dt;
     if (c.popUntil <= 0) { c.active = false; out.crisisExpire = true; }

+ 16 - 3
js/ui.js

@@ -136,10 +136,23 @@ export class App {
     this.refreshGuide(st);
   }
 
+  renderEnv(st) {
+    const el = $('#env-strip');
+    if (!el) return;
+    const env = st.env;
+    if (!env) return;
+    const D = Math.max(0, (this.s.layer || 0) - st.start);
+    const prog = (D % 18) / 18;
+    const fire = st.envFactors && st.envFactors.fire ? ` · 火种 ${Math.floor(this.s._fireAcc || 0)}/10` : '';
+    const boost = (this.s._fireBoost || 0) > Date.now() / 1000 ? ' · 星火 ×2.5' : '';
+    const html = `<span class="env-dot" style="background:${env.color}"></span><b>${env.name}</b><span class="env-eff">${env.eff}</span><span class="env-prog"><i style="width:${(prog * 100).toFixed(0)}%;background:${env.color}"></i></span><span class="env-left">${env.desc}${fire}${boost}</span>`;
+    this.html('#env-strip', html);
+  }
+
   renderHud(st) {
     if (!this.hudBuilt) {
       this.hudBuilt = true;
-      $('#hud').innerHTML = '<div><div class="layer" id="hud-layer">0<small>层</small></div><div class="meta" id="hud-sub"></div></div><div class="meta" id="hud-meta"></div>';
+      $('#hud').innerHTML = '<div><div class="layer" id="hud-layer">0<small>层</small></div><div class="meta" id="hud-sub"></div></div><div class="meta hud-meta" id="hud-meta"></div>';
     }
     const lf = this.s.layer;
     this.html('#hud-layer', `${fmt(Math.floor(lf), { int: true })}<small>层</small>`);
@@ -425,7 +438,7 @@ export class App {
       const b = $('#' + id);
       if (!b) continue;
       b.classList.toggle('primary', !!s.autoOn);
-      b.classList.toggle('can', !s.autoOn && s.rebirths === 0 && s.playSec > 20);
+      b.classList.toggle('can', !s.autoOn && s.playSec > 20);
     }
     if (s.autoOn && this._autoCycleAt && performance.now() - this._autoCycleAt < 1200) this.toast(`禅定节奏:每 ${S.autoRebirthEvery(s)} 秒回溯一次`);
     if ($('#auto-sub')) this.setText('#auto-sub', s.autoOn ? `每 ${S.autoRebirthEvery(s)} 秒 · 已开启(点击关闭)` : '挂机时自动回溯');
@@ -437,7 +450,7 @@ export class App {
     if (sub) { const v = (s.riftCdSec || 0) > 0 ? `冷却 ${Math.ceil(s.riftCdSec)} 秒` : '时空裂缝 · 探索位面'; if (sub.textContent !== v) sub.textContent = v; }
     const b = $('#btn-rift'); if (b) b.disabled = (s.riftCdSec || 0) > 0;
     const sub2 = $('#btn-auto2 .s'); if (sub2) { const v = s.autoOn ? `开启 · 每 ${S.autoRebirthEvery(s)} 秒` : '挂机自动回溯'; if (sub2.textContent !== v) sub2.textContent = v; }
-    const a2 = $('#btn-auto2'); if (a2) { a2.classList.toggle('can', !s.autoOn && s.rebirths === 0 && s.playSec > 20); }
+    const a2 = $('#btn-auto2'); if (a2) { a2.classList.toggle('can', !s.autoOn && s.playSec > 20); }
     const cd = $('#plane-cd'); if (cd) { const v = s.planes.filter((p) => p.explore >= 100).length ? `锚定 ${s.planes.filter((p) => p.explore >= 100).length} 处采集中` : '未锚定'; if (cd.textContent !== v) cd.textContent = v; }
     this.refreshPermButtons();
   }

BIN
tests/shots/desktop-1-start.png


BIN
tests/shots/desktop-10-first-loop.png


BIN
tests/shots/desktop-2-progress.png


BIN
tests/shots/desktop-3-first-rebirth.png


BIN
tests/shots/desktop-4-rift-fight.png


BIN
tests/shots/desktop-5-rift-result.png


BIN
tests/shots/desktop-6-crisis.png


BIN
tests/shots/desktop-7-civilization.png


BIN
tests/shots/desktop-8-save.png


BIN
tests/shots/desktop-9-late.png


BIN
tests/shots/mobile-1-growth.png


BIN
tests/shots/mobile-2-march.png


BIN
tests/shots/mobile-3-rebirth.png


BIN
tests/shots/mobile-4-rift-build.png


BIN
tests/shots/mobile-5-rift-fight.png


BIN
tests/shots/mobile-6-rift-result.png