Sfoglia il codice sorgente

feat: 第 5 类事件——文明氛围小事件(叙事 + 小加成,低干预)

LiuYuYang 1 settimana fa
parent
commit
8745c0b1ab
5 ha cambiato i file con 36 aggiunte e 1 eliminazioni
  1. 2 0
      css/style.css
  2. 15 0
      js/config.js
  3. 1 1
      js/formulas.js
  4. 17 0
      js/state.js
  5. 1 0
      js/ui.js

+ 2 - 0
css/style.css

@@ -473,3 +473,5 @@ button:disabled { cursor: not-allowed; opacity: .45; }
 .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%; } }
+
+.feed .row.ambient { color: #6b4ea8; }

+ 15 - 0
js/config.js

@@ -289,3 +289,18 @@ export const EVENT = {
   civSec: 75,
   autoRebirthDefault: 120,   // 禅定默认每 120 秒回溯一次(但只在离最优回溯点足够近时执行)
 };
+
+// ── 文明氛围小事件(轻量被动事件:每 36~54 秒按当前章节播放一条叙事并给一点小 bonus) ──
+export const AMBIENT_EVENTS = [
+  { text: '无线电里传来断断续续的童谣,根须跟着节奏轻轻摇摆。', bonus: '本源 +6 秒产出' },
+  { text: '旧城区的路灯依次点亮,像一条向北的航标。', bonus: '推进速度 ×1.2(20 秒)' },
+  { text: '有人在树根下种了一株野花。它开出了不属于地球的颜色。', bonus: '探索度 +1(当前位面)' },
+  { text: '一台无人探测器传回最后一张星图:空洞的边缘比想象中更近。', bonus: '本源 +8 秒产出' },
+  { text: '孩子们用粉笔在地上画出世界树的根,一直画出了城市。', bonus: '跳关触发率 +10%(30 秒)' },
+  { text: '图书馆里最厚的书被翻开在第一页:一切都从一颗种子开始。', bonus: '本源产出 ×1.25(30 秒)' },
+  { text: '月面上亮起一排灯,像是在向地球招手。', bonus: '推进速度 ×1.3(20 秒)' },
+  { text: '一艘运输舰从旋臂边缘归来,货舱里装满了陌生的星尘。', bonus: '本源 +12 秒产出' },
+  { text: '星系中心的黑洞喷流改变了方向,像一支指向空洞之外的箭头。', bonus: '跳关触发率 +10%(30 秒)' },
+  { text: '本星系群的邻居发来了同样的回声:我们也在逃。', bonus: '本源产出 ×1.3(30 秒)' },
+];
+export const AMBIENT = { everyMin: 36, everyMax: 54 };

+ 1 - 1
js/formulas.js

@@ -133,7 +133,7 @@ export function computeStats(state) {
 
   const gm = marchBase(L, start);
   const Mspd = speedMulOf(state) * (crisisPenalty ? 1 - C.CRISIS.penalty : 1);
-  const MspdEnv = Mspd * ef.speed;
+  const MspdEnv = Mspd * ef.speed * (((state._spdBoostUntil || 0) > now) ? 1.2 : 1);   // 氛围事件:推进 ×1.2
   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));

+ 17 - 0
js/state.js

@@ -232,6 +232,22 @@ export function tick(s, rift, dt) {
     if (c.popUntil <= 0) { c.active = false; out.crisisExpire = true; }
   }
 
+  // 文明氛围小事件:按章节播放一条叙事,并给予一点小加成(低干预的“世界仍在呼吸”)
+  s.ambient = s.ambient || { t: 0, idx: 0 };
+  s.ambient.t = (s.ambient.t || 0) - dt;
+  if (s.ambient.t <= 0) {
+    s.ambient.t = C.AMBIENT.everyMin + Math.random() * (C.AMBIENT.everyMax - C.AMBIENT.everyMin);
+    const chIdx = Math.max(0, Math.min(5, C.chapterOf(Math.min(C.TOTAL_LAYERS, s.layer)) - 1));
+    const pool = C.AMBIENT_EVENTS.slice(chIdx * 2, chIdx * 2 + 2);
+    const ev = pool[Math.floor(Math.random() * pool.length)] || C.AMBIENT_EVENTS[0];
+    if (/本源 \+/.test(ev.bonus)) s.essence += st.prodRaw * (parseFloat(ev.bonus.match(/\+(\d+)/)[1]) || 6);
+    else if (ev.bonus.startsWith('推进速度')) s._spdBoostUntil = now + 20;
+    else if (ev.bonus.startsWith('跳关')) s._skipBoostUntil = now + 30;
+    else if (ev.bonus.startsWith('本源产出')) s.crisis.buffUntil = Math.max(s.crisis.buffUntil || 0, now + 30);
+    else if (ev.bonus.startsWith('探索度')) { s.planes[s.currentPlane].explore = Math.min(C.EXPLORE_FULL, s.planes[s.currentPlane].explore + 1); syncExplore(s); }
+    out.events.push({ type: 'ambient', text: ev.text, bonus: ev.bonus });
+  }
+
   // 文明事件(现实位面)
   if (s.currentPlane === 0 && s.civ.idx < CIV_EVENTS.length) {
     s.nextCivSec -= dt;
@@ -342,6 +358,7 @@ export function rebirth(s) {
   s.crisis = { next: C.CRISIS.firstAt, active: false, buffUntil: 0, penaltyUntil: 0 };
   s.magic = { sig: 0, sigUntil: 0 };
   s._skipAcc = 0; s._autoT = 0; s._lastFlash = undefined;
+  s.ambient = { t: 0, idx: 0 };   // 文明氛围小事件计时(回溯重置)
   s.chapterSeen = Math.min(5, C.chapterOf(Math.min(C.TOTAL_LAYERS, floor)));
   const evt = s.rebirths === 1
     ? { type: 'milestone', key: 'firstRebirth', ...MILESTONES.firstRebirth }

+ 1 - 0
js/ui.js

@@ -61,6 +61,7 @@ export class App {
       if (e.type === 'civ') this.pushDialog({ kind: 'civ', civIdx: e.civIdx });
       else if (e.type === 'milestone') this.pushDialog({ kind: 'milestone', data: e });
       else if (e.type === 'info') this.log(e.title + ':' + e.text, 'info');
+      else if (e.type === 'ambient') { this.log(e.text + '(' + e.bonus + ')', 'ambient'); this.toast('✦ ' + e.bonus, 'good'); }
     }
     if (out.crisis) this.pushDialog({ kind: 'crisis' });
     if (out.crisisExpire) { const t = S.crisisExpire(s); if (t) this.log(t, 'crisis'); this.toast(t, 'warn'); }