RubixYT1

incrementallity textwall v1.4.3 (V3 SUPPORTED!)

May 23rd, 2026 (edited)
64
1
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.26 KB | None | 1 0
  1. (async function IncrementalityGame() {
  2. /* ═══════════════════════════════════════════════
  3. INCREMENTALLITY v1.4.3D
  4. ═══════════════════════════════════════════════ */
  5.  
  6. await new Promise((res, rej) => {
  7. if (typeof Decimal !== "undefined") return res();
  8. const s = document.createElement("script");
  9. s.src = "https://cdn.jsdelivr.net/npm/break_eternity.js";
  10. s.onload = res;
  11. s.onerror = () => {
  12. const s2 = document.createElement("script");
  13. s2.src = "https://unpkg.com/break_eternity.js";
  14. s2.onload = res;
  15. s2.onerror = rej;
  16. document.head.appendChild(s2);
  17. };
  18. document.head.appendChild(s);
  19. });
  20.  
  21. const D = v => new Decimal(v);
  22.  
  23. const COOLDOWN = 5;
  24. const WIN_W = 62;
  25. const WIN_H = 28; // Increased height to 28
  26. const UPG_PER_PAGE = 3;
  27.  
  28. let running = false;
  29. let stopped = false;
  30. let instantMode = false;
  31. let points = D(0);
  32. let pointGain = D(1);
  33. let gx = 0, gy = 0;
  34. let selfSending = false;
  35. let currentPage = 1;
  36. let renderBusy = false;
  37.  
  38. // Mechanics flags
  39. let automationOn = false;
  40. let boosterOn = false;
  41. let fullAutoOn = false;
  42. let rbPointBoost = false;
  43. let rbDoubler = false;
  44. let rbX2Level = 0;
  45. let rbRaiserLevel = 0;
  46. let rbMaximizer = false;
  47. let breakerActive = false; // Breaker prestige upgrade (breaks hardcaps)
  48.  
  49. // Prestige Layers
  50. let rebirths = 0;
  51. let increments = D(0);
  52. let greaterGainMul = D(1);
  53.  
  54. // Anti-Inc Prestige Layer (CID 5)
  55. let antiInc = D(0);
  56. let autoIncActive = false;
  57.  
  58. // Quantum Layer (CID 1)
  59. let quantumPoints = D(0);
  60. let antiIncToPtsActive = false; // Q1 Upgrade
  61. let atomicizeUnlocked = false; // Q2 Upgrade
  62.  
  63. // Atomic Layer
  64. let proton = D(0); // CID 11
  65. let neutron = D(0); // CID 4 (unlocked at 100 Proton)
  66. let electron = D(0); // CID 8 (unlocked at 100 Neutron)
  67.  
  68. const timers = [];
  69. const rebirthPages = [];
  70.  
  71. // Global Rate Limiter for 600 char/s Instant Mode
  72. let lastWriteTime = performance.now();
  73. let writeTokens = 0;
  74. const MAX_TOKENS = 50; // Burst budget capacity
  75. const CHARS_PER_MS = 600 / 1000; // 0.6 characters per ms = 600 chars/sec
  76.  
  77. // Command Deduplication History
  78. const commandExecutionHistory = new Map();
  79.  
  80. /* ══════════════════════════════════════
  81. SOFTCAP & HARDCAP SYSTEM
  82. ══════════════════════════════════════ */
  83. const SOFTCAP_THRESHOLDS = {
  84. 1: { sc:50, sc2:500, sc3:5000, hc:50000 },
  85. 2: { sc:30, sc2:300, sc3:3000, hc:30000 },
  86. 3: { sc:40, sc2:400, sc3:4000, hc:40000 },
  87. 4: { sc:1, sc2:1, sc3:1, hc:1 },
  88. 5: { sc:20, sc2:200, sc3:2000, hc:20000 },
  89. 6: { sc:1, sc2:1, sc3:1, hc:1 },
  90. 7: { sc:25, sc2:250, sc3:2500, hc:25000 }
  91. };
  92.  
  93. const INC_SOFTCAPS = {
  94. sc: D("1e20"),
  95. sc2: D("1e40"),
  96. sc3: D("1e60"),
  97. hc: D("1e80")
  98. };
  99.  
  100. function getSoftcapLabel(upgId, level) {
  101. const t = SOFTCAP_THRESHOLDS[upgId];
  102. if (!t) return "";
  103. if (level >= t.hc && !breakerActive) return " [HARDCAP]";
  104. if (level >= t.sc3) return " [SC^3]";
  105. if (level >= t.sc2) return " [SC^2]";
  106. if (level >= t.sc) return " [SC]";
  107. return "";
  108. }
  109.  
  110. function getCostMultiplier(upgId, level) {
  111. const t = SOFTCAP_THRESHOLDS[upgId];
  112. if (!t) return 1;
  113. if (level >= t.sc3) return 8;
  114. if (level >= t.sc2) return 4;
  115. if (level >= t.sc) return 2;
  116. return 1;
  117. }
  118.  
  119. function isHardcapped(upgId, level) {
  120. if (breakerActive) return false; // Breaker breaks hardcap limit entirely
  121. const t = SOFTCAP_THRESHOLDS[upgId];
  122. if (!t) return false;
  123. return level >= t.hc;
  124. }
  125.  
  126. function applyIncSoftcap(raw) {
  127. raw = D(raw);
  128. if (raw.gte(INC_SOFTCAPS.hc)) return INC_SOFTCAPS.hc;
  129. if (raw.gte(INC_SOFTCAPS.sc3)) {
  130. const over = raw.div(INC_SOFTCAPS.sc3);
  131. return INC_SOFTCAPS.sc3.mul(over.pow(0.125));
  132. }
  133. if (raw.gte(INC_SOFTCAPS.sc2)) {
  134. const over = raw.div(INC_SOFTCAPS.sc2);
  135. return INC_SOFTCAPS.sc2.mul(over.pow(0.25));
  136. }
  137. if (raw.gte(INC_SOFTCAPS.sc)) {
  138. const over = raw.div(INC_SOFTCAPS.sc);
  139. return INC_SOFTCAPS.sc.mul(over.pow(0.5));
  140. }
  141. return raw;
  142. }
  143.  
  144. function getIncSoftcapLabel(raw) {
  145. raw = D(raw);
  146. if (raw.gte(INC_SOFTCAPS.hc)) return " [HC]";
  147. if (raw.gte(INC_SOFTCAPS.sc3)) return " [SC^3]";
  148. if (raw.gte(INC_SOFTCAPS.sc2)) return " [SC^2]";
  149. if (raw.gte(INC_SOFTCAPS.sc)) return " [SC]";
  150. return "";
  151. }
  152.  
  153. /* ══════════════════════════════════════
  154. UPGRADE DEFINITIONS
  155. ══════════════════════════════════════ */
  156. function defaultUpgrades() {
  157. return [
  158. { id:1, name:"Increase point gain", cost:D(10), level:0, scaling:1.5, maxBuy:-1 },
  159. { id:2, name:"Multiplication (x3)", cost:D(50), level:0, scaling:2.5, maxBuy:-1 },
  160. { id:3, name:"Cheaper stuff (/1.5)", cost:D(100), level:0, scaling:3, maxBuy:-1 },
  161. { id:4, name:"Automation [ONE-TIME]", cost:D(1000), level:0, scaling:1, maxBuy:1 },
  162. { id:5, name:"Exponentiation (^1.1)", cost:D(17500), level:0, scaling:3, maxBuy:-1 },
  163. { id:6, name:"Booster [ONE-TIME]", cost:D(1e5), level:0, scaling:1, maxBuy:1 },
  164. { id:7, name:"Greater Gain (+25%)", cost:D(1e7), level:0, scaling:4, maxBuy:-1 }
  165. ];
  166. }
  167.  
  168. function defaultRebirthUpgrades() {
  169. return [
  170. { id:"R1", name:"Point Booster [1x]", cost:D(10), level:0, scaling:1, maxBuy:1, desc:"Boost pts by Inc count" },
  171. { id:"R2", name:"Full Automation [1x]", cost:D(30), level:0, scaling:1, maxBuy:1, desc:"Auto 50 lvls every 10s" },
  172. { id:"R3", name:"Doubler [1x]", cost:D(100), level:0, scaling:1, maxBuy:1, desc:"Double rebirth Inc gain" },
  173. { id:"R4", name:"x2 Rebirth Gain", cost:D(50), level:0, scaling:2.5, maxBuy:-1, desc:"x2 Inc gain (stacks)" },
  174. { id:"R5", name:"Raiser (^1.4)", cost:D(150), level:0, scaling:2.0, maxBuy:30, desc:"^1.4 Point gain scaling" },
  175. { id:"R6", name:"Maximizer [ONE-TIME]", cost:D(500), level:0, scaling:1, maxBuy:1, desc:"+150 Lvls to R1-R5 free" }
  176. ];
  177. }
  178.  
  179. function defaultAntiIncUpgrades() {
  180. return [
  181. { id:"A1", name:"Auto-Inc Conversion", cost:D(1), level:0, maxBuy:1, desc:"Convert Pts to passive Inc" },
  182. { id:"A2", name:"Breaker [ONE-TIME]", cost:D(10), level:0, maxBuy:1, desc:"Breaks all normal upgrade hardcaps" }
  183. ];
  184. }
  185.  
  186. function defaultQuantumUpgrades() {
  187. return [
  188. { id:"Q1", name:"Anti Inc to Pts", cost:D(1), level:0, maxBuy:1, desc:"Boosts Anti-Inc gain by Pts" },
  189. { id:"Q2", name:"Atomicize", cost:D(10), level:0, maxBuy:1, desc:"Unlocks the Atomic Layer" }
  190. ];
  191. }
  192.  
  193. let upgrades = defaultUpgrades();
  194. let rebirthUpgrades = defaultRebirthUpgrades();
  195. let antiIncUpgrades = defaultAntiIncUpgrades();
  196. let quantumUpgrades = defaultQuantumUpgrades();
  197.  
  198. /* ══════════════════════════════════════
  199. HELPERS
  200. ══════════════════════════════════════ */
  201. const sleep = ms => new Promise(r => setTimeout(r, ms));
  202.  
  203. function formatNum(n) {
  204. n = D(n);
  205. if (n.isNan()) return "NaN";
  206. if (!n.isFinite()) return "Inf";
  207. if (n.eq(0)) return "0";
  208. if (n.lt(0)) return "-" + formatNum(n.neg());
  209. if (n.lt(1e4)) {
  210. const v = n.toNumber();
  211. if (Math.abs(v - Math.round(v)) < 0.005) return String(Math.round(v));
  212. return v.toFixed(2);
  213. }
  214. if (n.layer > 1) return n.toString();
  215. const exp = n.log10().floor();
  216. const man = n.div(Decimal.pow(10, exp));
  217. return man.toNumber().toFixed(2) + "e" + exp.toNumber();
  218. }
  219.  
  220. function roundCost(d) {
  221. d = D(d);
  222. if (d.lt(0.01)) return D(0.01);
  223. if (d.lt(1e13)) return D(Math.round(d.toNumber() * 100) / 100);
  224. return d.floor();
  225. }
  226.  
  227. function fit(s, ww) { return s.length >= ww ? s.slice(0, ww) : s.padEnd(ww); }
  228.  
  229. async function typeAt(str, color, x, y) {
  230. for (let i = 0; i < str.length; i++) {
  231. if (stopped) return;
  232.  
  233. if (instantMode) {
  234. while (true) {
  235. if (stopped) return;
  236. const now = performance.now();
  237. const elapsed = now - lastWriteTime;
  238. lastWriteTime = now;
  239. writeTokens = Math.min(MAX_TOKENS, writeTokens + elapsed * CHARS_PER_MS);
  240.  
  241. if (writeTokens >= 1) {
  242. writeTokens -= 1;
  243. writeCharAt(str[i], color, x + i, y);
  244. break;
  245. }
  246. await sleep(1);
  247. }
  248. } else {
  249. writeCharAt(str[i], color, x + i, y);
  250. await sleep(COOLDOWN);
  251. }
  252. }
  253. }
  254.  
  255. async function chatSend(msg) {
  256. selfSending = true;
  257. try { w.chat.send(msg); } catch (_) {}
  258. await sleep(150);
  259. selfSending = false;
  260. }
  261.  
  262. /* ══════════════════════════════════════
  263. FORMULAS & PRESTIGE
  264. ══════════════════════════════════════ */
  265. function calcIncrements(pts) {
  266. pts = D(pts);
  267. if (pts.lt(1e10)) return D(0);
  268. let logP = pts.max(1).log10();
  269. let earned = logP.pow(1.5).div(5).floor();
  270.  
  271. // Apply multipliers
  272. if (rbDoubler) earned = earned.mul(2);
  273. if (rbX2Level > 0) earned = earned.mul(D(2).pow(rbX2Level));
  274.  
  275. // Neutron boosts Rebirth Increments gain (Atomic Layer)
  276. if (neutron.gt(0)) {
  277. earned = earned.mul(neutron.max(1).pow(0.15).add(1));
  278. }
  279.  
  280. // Softcap calculations
  281. earned = applyIncSoftcap(earned);
  282. return earned;
  283. }
  284.  
  285. function calcRawIncrements(pts) {
  286. pts = D(pts);
  287. if (pts.lt(1e10)) return D(0);
  288. let logP = pts.max(1).log10();
  289. let earned = logP.pow(1.5).div(5).floor();
  290. if (rbDoubler) earned = earned.mul(2);
  291. if (rbX2Level > 0) earned = earned.mul(D(2).pow(rbX2Level));
  292. if (neutron.gt(0)) earned = earned.mul(neutron.max(1).pow(0.15).add(1));
  293. return earned;
  294. }
  295.  
  296. function calcAntiInc(inc) {
  297. inc = D(inc);
  298. if (inc.lt("1e20")) return D(0);
  299. let ratio = inc.div("1e20");
  300. let earned = ratio.log10().pow(1.2).floor();
  301.  
  302. // Q1 Upgrade: Boosts Anti-Inc by Pts
  303. if (antiIncToPtsActive) {
  304. earned = earned.mul(points.max(1).log10().add(1));
  305. }
  306.  
  307. // Electron boosts Anti-Inc gain (Atomic Layer)
  308. if (electron.gt(0)) {
  309. earned = earned.mul(electron.max(1).pow(0.2).add(1));
  310. }
  311.  
  312. return earned;
  313. }
  314.  
  315. function calcQuantumPoints(ai) {
  316. ai = D(ai);
  317. if (ai.lt(100)) return D(0);
  318. return ai.div(100).log10().max(0).pow(1.1).floor().add(1);
  319. }
  320.  
  321. /* ══════════════════════════════════════════════════════
  322. RAW CHAT EXTRACTION — ALL USERS, EXHAUSTIVE
  323. ══════════════════════════════════════════════════════ */
  324. const dedupSet = new Map();
  325.  
  326. function processRaw(text, source) {
  327. if (!text || stopped || !running) return;
  328. text = String(text).trim();
  329. if (!text || text.length > 600) return;
  330.  
  331. const key = text.toLowerCase() + "|" + Math.floor(Date.now() / 900);
  332. if (dedupSet.has(key)) return;
  333. dedupSet.set(key, true);
  334. setTimeout(() => dedupSet.delete(key), 2500);
  335.  
  336. console.log(`[RAW ${source || "?"}] ${text}`);
  337.  
  338. const tildaMatch = text.match(/^(.+?)\s*~\s*(.+)$/);
  339. if (tildaMatch) {
  340. const afterTilda = tildaMatch[2].trim();
  341. if (afterTilda.startsWith("/")) {
  342. console.log(`[CMD from tilda] ${afterTilda}`);
  343. handleCmd(afterTilda, tildaMatch[1].trim());
  344. return;
  345. }
  346. }
  347.  
  348. let user = "unknown";
  349. let msg = text;
  350. for (const pat of [
  351. /^([^:]{1,30}):\s*(.+)/,
  352. /^\[([^\]]{1,30})\]\s*(.+)/,
  353. /^<([^>]{1,30})>\s*(.+)/,
  354. /^(\S{1,30})\s*[»>]\s*(.+)/
  355. ]) {
  356. const m = text.match(pat);
  357. if (m) { user = m[1].trim(); msg = m[2].trim(); break; }
  358. }
  359.  
  360. if (!msg) return;
  361. console.log(`${user} ~ ${msg}`);
  362.  
  363. if (msg.startsWith("/")) handleCmd(msg, user);
  364. }
  365.  
  366. function extractField(d) {
  367. if (!d) return "";
  368. if (typeof d === "string") return d;
  369. return d.message || d.msg || d.text || d.content || d.body ||
  370. d.value || d.chat || d.line || d.raw ||
  371. (typeof d.data === "string" ? d.data : "") || "";
  372. }
  373.  
  374. function tryProcess(d, src) {
  375. if (!d) return;
  376. if (typeof d === "string") { processRaw(d, src); return; }
  377. const m = extractField(d);
  378. if (typeof m === "string" && m) processRaw(m, src);
  379. if (Array.isArray(d)) d.forEach(x => tryProcess(x, src));
  380. }
  381.  
  382. (function setupChat() {
  383. try {
  384. const real = w.chat.send.bind(w.chat);
  385. w.chat.send = function (m) {
  386. const r = real(m);
  387. if (!selfSending) processRaw(m, "send-hook");
  388. return r;
  389. };
  390. } catch (e) { console.warn("[Inc] hook-send:", e); }
  391.  
  392. try {
  393. if (typeof w.on === "function")
  394. for (const ev of ["chat","message","receive","msg","data","say","talk","text"])
  395. try { w.on(ev, (...a) => a.forEach(x => tryProcess(x, "w.on-" + ev))); } catch (_) {}
  396. } catch (_) {}
  397.  
  398. try {
  399. if (w.events) {
  400. const hookEm = em => {
  401. if (!em) return;
  402. if (typeof em.on === "function")
  403. for (const ev of ["chat","message","receive","msg","data"])
  404. try { em.on(ev, d => tryProcess(d, "events-" + ev)); } catch (_) {}
  405. };
  406. if (typeof w.events === "function") try { hookEm(w.events()); } catch (_) {}
  407. hookEm(w.events);
  408. }
  409. } catch (_) {}
  410.  
  411. try {
  412. if (w.chat) {
  413. if (typeof w.chat.on === "function")
  414. for (const ev of ["message","receive","msg","data","chat","text"])
  415. try { w.chat.on(ev, d => tryProcess(d, "chat.on-" + ev)); } catch (_) {}
  416. }
  417. } catch (_) {}
  418.  
  419. try {
  420. if (typeof w.on === "function")
  421. for (let code = 0; code <= 30; code++)
  422. try {
  423. w.on(code, (...a) => {
  424. for (const item of a) {
  425. if (!item) continue;
  426. const s = typeof item === "string" ? item : extractField(item);
  427. if (s && typeof s === "string") processRaw(s, `w.on(${code})`);
  428. }
  429. });
  430. } catch (_) {}
  431. } catch (_) {}
  432.  
  433. try {
  434. function hookWS(sock) {
  435. if (!sock || sock.__inc143) return;
  436. sock.__inc143 = true;
  437. sock.addEventListener("message", function (ev) {
  438. try {
  439. if (typeof ev.data === "string") {
  440. if (ev.data.length > 1 && ev.data.length < 500)
  441. processRaw(ev.data, "ws-raw");
  442. }
  443. } catch (_) {}
  444. });
  445. }
  446.  
  447. const socks = new Set();
  448. for (const k of ["socket","ws","conn","websocket","sock","wss","io"]) {
  449. try { if (w[k] instanceof WebSocket) socks.add(w[k]); } catch (_) {}
  450. }
  451. socks.forEach(hookWS);
  452.  
  453. const OrigWS = window.WebSocket;
  454. window.WebSocket = function (...a) {
  455. const s = new OrigWS(...a);
  456. setTimeout(() => hookWS(s), 50);
  457. return s;
  458. };
  459. window.WebSocket.prototype = OrigWS.prototype;
  460. } catch (e) { console.warn("[Inc] hook-ws:", e); }
  461.  
  462. // DOM Observers
  463. try {
  464. const obs = new Set();
  465. const sels = ["#chat","#chatbox",".chat-messages","#chat_messages","#chatlog",".chatlog"];
  466. function observeEl(el) {
  467. if (obs.has(el)) return; obs.add(el);
  468. new MutationObserver(muts => {
  469. for (const m of muts)
  470. for (const nd of m.addedNodes) {
  471. const t = (nd.textContent || "").trim();
  472. if (t) processRaw(t, "dom-obs");
  473. }
  474. }).observe(el, { childList: true, subtree: true });
  475. }
  476. sels.forEach(sel => { try { document.querySelectorAll(sel).forEach(observeEl); } catch (_) {} });
  477. } catch (_) {}
  478.  
  479. })();
  480.  
  481. /* ── Startup & Intro Animations ── */
  482. async function playIntro() {
  483. const str = "Incrementallity";
  484. const ver = "v1.4.3D";
  485.  
  486. // Slide down animation (CID 12 Style Cyan-blue)
  487. for (let offset = 0; offset < 5; offset++) {
  488. if (stopped) return;
  489. await typeAt(" ".repeat(WIN_W), "#000000", gx, gy + offset - 1);
  490. await typeAt(str.padStart(15 + Math.floor((WIN_W - 15) / 2)), "#06b6d4", gx, gy + offset);
  491. await sleep(100);
  492. }
  493. // Slide up animation
  494. for (let offset = 5; offset >= 1; offset--) {
  495. if (stopped) return;
  496. await typeAt(" ".repeat(WIN_W), "#000000", gx, gy + offset);
  497. await typeAt(str.padStart(15 + Math.floor((WIN_W - 15) / 2)), "#06b6d4", gx, gy + offset - 1);
  498. await sleep(100);
  499. }
  500. // Clear paths
  501. for (let i = 0; i < 6; i++) {
  502. await typeAt(" ".repeat(WIN_W), "#000000", gx, gy + i);
  503. }
  504. // Final Title render
  505. await typeAt(str.padStart(15 + Math.floor((WIN_W - 15) / 2)), "#06b6d4", gx, gy + 1);
  506.  
  507. // Type the version char-by-char with 0.15s delay
  508. const verPadding = Math.floor((WIN_W - ver.length) / 2);
  509. for (let i = 0; i < ver.length; i++) {
  510. if (stopped) return;
  511. writeCharAt(ver[i], "#a855f7", gx + verPadding + i, gy + 2);
  512. await sleep(150);
  513. }
  514. await sleep(1200);
  515.  
  516. // Clear everything to transition to the window
  517. for (let i = 0; i < 4; i++) {
  518. await typeAt(" ".repeat(WIN_W), "#000000", gx, gy + i);
  519. }
  520. }
  521.  
  522. /* ══════════════════════════════════════
  523. HUD PANEL
  524. ══════════════════════════════════════ */
  525. const shade = document.createElement("div");
  526. shade.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:999998";
  527.  
  528. const hud = document.createElement("div");
  529. hud.style.cssText = `
  530. position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  531. background:#0f172a;border:2px solid #f43f5e;border-radius:14px;
  532. padding:28px 34px;z-index:999999;color:#e2e8f0;
  533. font-family:'Courier New',monospace;
  534. box-shadow:0 0 50px rgba(244,63,94,.45);min-width:380px`;
  535.  
  536. hud.innerHTML = `
  537. <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px">
  538. <span style="font-size:17px;font-weight:700;color:#f43f5e">⚙ Generate the Game at</span>
  539. <button id="_ic_close" style="background:#f43f5e;color:#fff;border:none;border-radius:4px;
  540. padding:6px 18px;font-size:13px;cursor:pointer;font-family:monospace;font-weight:700">✕ Close</button>
  541. </div>
  542. <label style="font-size:12px;color:#94a3b8">X Coordinate</label>
  543. <input id="_ic_x" type="text" value="0" style="display:block;width:100%;padding:8px 10px;margin:4px 0 14px;
  544. background:#1e293b;border:1px solid #334155;border-radius:8px;color:#e2e8f0;font-family:monospace;font-size:14px;box-sizing:border-box">
  545. <label style="font-size:12px;color:#94a3b8">Y Coordinate</label>
  546. <input id="_ic_y" type="text" value="0" style="display:block;width:100%;padding:8px 10px;margin:4px 0 14px;
  547. background:#1e293b;border:1px solid #334155;border-radius:8px;color:#e2e8f0;font-family:monospace;font-size:14px;box-sizing:border-box">
  548.  
  549. <div style="margin: 15px 0 20px 0; display:flex; align-items:center;">
  550. <input type="checkbox" id="_ic_instant" style="margin-right:10px; cursor:pointer;">
  551. <label for="_ic_instant" style="font-size:13px; color:#94a3b8; cursor:pointer; user-select:none;">⚡ Instant Draw (600 cps)</label>
  552. </div>
  553.  
  554. <button id="_ic_go" style="width:100%;padding:13px;background:linear-gradient(135deg,#f43f5e,#e11d48);color:#fff;
  555. border:none;border-radius:10px;font-size:15px;font-weight:700;cursor:pointer;font-family:monospace;letter-spacing:1px">▶ SUBMIT</button>
  556. <p style="text-align:center;margin:16px 0 0;color:#475569;font-size:11px">Incrementallity v1.4.3D</p>`;
  557.  
  558. document.body.appendChild(shade);
  559. document.body.appendChild(hud);
  560. function closeHUD() { shade.remove(); hud.remove(); }
  561.  
  562. document.getElementById("_ic_close").onclick = () => { closeHUD(); stopped = true; timers.forEach(clearInterval); };
  563.  
  564. document.getElementById("_ic_go").onclick = async () => {
  565. if (running) return;
  566. running = true;
  567. gx = parseInt(document.getElementById("_ic_x").value) || 0;
  568. gy = -(parseInt(document.getElementById("_ic_y").value) || 0);
  569. instantMode = document.getElementById("_ic_instant").checked;
  570. closeHUD();
  571. await launch();
  572. };
  573.  
  574. /* ══════════════════════════════════════
  575. GAME LAUNCHER
  576. ══════════════════════════════════════ */
  577. async function launch() {
  578. await playIntro(); // Cinematic Intro Animations
  579. await typeAt("Load....", "#f43f5e", gx, gy);
  580. if (!instantMode) await sleep(3000);
  581. for (let i = 0; i < 8; i++) { writeCharAt(" ", "#000000", gx + i, gy); if (!instantMode) await sleep(COOLDOWN); }
  582. await drawWindow();
  583. await render();
  584. await sleep(100);
  585. await chatSend("/upg N | /rebirth | /page CMD for help");
  586. startTicks();
  587. }
  588.  
  589. async function drawWindow() {
  590. const inner = WIN_W - 2;
  591. await typeAt("╔" + "═".repeat(inner) + "╗", "#f43f5e", gx, gy);
  592. await typeAt("║" + " Incrementallity v1.4.3D ".padEnd(inner) + "║", "#fbbf24", gx, gy + 1);
  593. await typeAt("╠" + "═".repeat(inner) + "╣", "#f43f5e", gx, gy + 2);
  594. for (let r = 3; r < WIN_H - 1; r++)
  595. await typeAt("║" + " ".repeat(inner) + "║", "#f43f5e", gx, gy + r);
  596. await typeAt("╚" + "═".repeat(inner) + "╝", "#f43f5e", gx, gy + WIN_H - 1);
  597. }
  598.  
  599. /* ══════════════════════════════════════ */
  600. function startTicks() {
  601. // Main points generation tick
  602. timers.push(setInterval(() => {
  603. if (stopped) return;
  604. let gain = pointGain.mul(greaterGainMul);
  605. if (boosterOn) gain = gain.add(points.max(1).pow(0.05));
  606. if (rbPointBoost) gain = gain.mul(increments.max(1).pow(0.3).add(1));
  607.  
  608. // Proton boosts point gain (Atomic Layer)
  609. if (proton.gt(0)) {
  610. gain = gain.mul(proton.max(1).pow(0.1).add(1));
  611. }
  612.  
  613. // Raiser R5 multiplier
  614. if (rbRaiserLevel > 0) {
  615. gain = gain.pow(Decimal.pow(1.4, rbRaiserLevel));
  616. }
  617.  
  618. points = points.add(gain);
  619. }, 1000));
  620.  
  621. // Display updates
  622. timers.push(setInterval(async () => {
  623. if (renderBusy || stopped) return;
  624. renderBusy = true; await render(); renderBusy = false;
  625. }, 500));
  626.  
  627. // Auto upgrade 1-3 tick
  628. timers.push(setInterval(() => {
  629. if (stopped || !automationOn) return;
  630. for (const u of upgrades)
  631. if (u.id >= 1 && u.id <= 3 && (u.maxBuy === -1 || u.level < u.maxBuy) && !isHardcapped(u.id, u.level))
  632. if (points.gte(u.cost)) buyUpgrade(u, true);
  633. }, 1000));
  634.  
  635. // Full auto upgrade 1-7 tick
  636. timers.push(setInterval(() => {
  637. if (stopped || !fullAutoOn) return;
  638. for (let rep = 0; rep < 50; rep++)
  639. for (const u of upgrades)
  640. if ((u.maxBuy === -1 || u.level < u.maxBuy) && !isHardcapped(u.id, u.level) && points.gte(u.cost))
  641. buyUpgrade(u, true);
  642. }, 10000));
  643.  
  644. // Anti-Inc Auto conversion generation tick
  645. timers.push(setInterval(() => {
  646. if (stopped || !autoIncActive) return;
  647. const generatedInc = points.max(1).log10().pow(2).div(1000);
  648. if (generatedInc.gt(0)) {
  649. increments = increments.add(generatedInc);
  650. }
  651. }, 1000));
  652.  
  653. // Atomic elements generation tick
  654. timers.push(setInterval(() => {
  655. if (stopped) return;
  656.  
  657. // Proton generated by all layers (Points, Increments, Anti-Inc, QP)
  658. let pGain = points.max(1).log10()
  659. .add(increments.max(1).log10())
  660. .add(antiInc.max(1).log10())
  661. .add(quantumPoints.max(1).mul(10).log10())
  662. .div(10);
  663.  
  664. if (pGain.gt(0)) {
  665. proton = proton.add(pGain);
  666. }
  667.  
  668. // Neutron generated if Proton >= 100
  669. if (proton.gte(100)) {
  670. let nGain = proton.div(100).log10().max(0).add(1).div(10);
  671. neutron = neutron.add(nGain);
  672. }
  673.  
  674. // Electron generated if Neutron >= 100
  675. if (neutron.gte(100)) {
  676. let eGain = neutron.div(100).log10().max(0).add(1).div(10);
  677. electron = electron.add(eGain);
  678. }
  679. }, 1000));
  680. }
  681.  
  682. /* ══════════════════════════════════════
  683. RENDER
  684. ══════════════════════════════════════ */
  685. async function render() {
  686. const ix = gx + 2, iy = gy + 3, iw = WIN_W - 4;
  687.  
  688. // Dynamic theme changing via w.changeColor based on current page
  689. try {
  690. if (currentPage === "RU") w.changeColor(10); // Purple for Rebirth Upgrades
  691. else if (currentPage === "AI") w.changeColor(5); // Lime green for Anti-Inc
  692. else if (currentPage === "QU") w.changeColor(1); // Gold/Yellow for Quantum
  693. else if (currentPage === "AT") w.changeColor(11); // Blue/Cyan for Atomic Layer
  694. else w.changeColor(12); // Standard Cyan-Blue
  695. } catch (_) {}
  696.  
  697. // Points line
  698. let effGain = pointGain.mul(greaterGainMul);
  699. if (boosterOn) effGain = effGain.add(points.max(1).pow(0.05));
  700. if (rbPointBoost) effGain = effGain.mul(increments.max(1).pow(0.3).add(1));
  701. if (proton.gt(0)) effGain = effGain.mul(proton.max(1).pow(0.1).add(1));
  702. if (rbRaiserLevel > 0) effGain = effGain.pow(Decimal.pow(1.4, rbRaiserLevel));
  703. await typeAt(fit(`Pts: ${formatNum(points)} (+${formatNum(effGain)}/s)`, iw), "#34d399", ix, iy);
  704.  
  705. // Rebirth/Prestige line
  706. let iLine = `Inc: ${formatNum(increments)} | RB: ${rebirths}`;
  707. if (points.gte(1e10)) {
  708. const pend = calcIncrements(points);
  709. const raw = calcRawIncrements(points);
  710. const scl = getIncSoftcapLabel(raw);
  711. iLine += ` | Next: +${formatNum(pend)}${scl}`;
  712. }
  713. await typeAt(fit(iLine, iw), "#e879f9", ix, iy + 1);
  714.  
  715. // Anti-Inc line (CID 5 Styled)
  716. let aLine = `Anti-Inc: ${formatNum(antiInc)}`;
  717. if (increments.gte("1e20")) {
  718. const pendAnti = calcAntiInc(increments);
  719. aLine += ` | Next: +${formatNum(pendAnti)} (Requires 1e20 Inc)`;
  720. }
  721. await typeAt(fit(aLine, iw), "#84cc16", ix, iy + 2);
  722.  
  723. // Quantum line (CID 1 Styled)
  724. let qLine = `Quantum Points: ${formatNum(quantumPoints)}`;
  725. if (antiInc.gte(100)) {
  726. const pendQuantum = calcQuantumPoints(antiInc);
  727. qLine += ` | Next: +${formatNum(pendQuantum)} (Requires 100 Anti-Inc)`;
  728. }
  729. await typeAt(fit(qLine, iw), "#facc15", ix, iy + 3);
  730.  
  731. // State flags
  732. let flags = "";
  733. if (automationOn) flags += "[AUTO] ";
  734. if (fullAutoOn) flags += "[FULL-AUTO] ";
  735. if (boosterOn) flags += "[BOOST] ";
  736. if (rbPointBoost) flags += "[RB-BOOST] ";
  737. if (rbDoubler) flags += "[2x INC] ";
  738. if (breakerActive) flags += "[BREAKER] ";
  739. if (rbX2Level > 0) flags += `[x${D(2).pow(rbX2Level).toString()} RB] `;
  740. if (rbRaiserLevel > 0) flags += `[^1.4^${rbRaiserLevel} PT] `;
  741. if (autoIncActive) flags += "[INC-GEN] ";
  742. if (antiIncToPtsActive) flags += "[AI->PT] ";
  743. if (atomicizeUnlocked) flags += "[ATOM] ";
  744. await typeAt(fit(flags, iw), "#a78bfa", ix, iy + 4);
  745.  
  746. const showRbPage = typeof currentPage === "string" && currentPage.startsWith("B");
  747. const showRuPage = currentPage === "RU";
  748. const showCmdPage = currentPage === "CMD";
  749. const showAiPage = currentPage === "AI";
  750. const showQuPage = currentPage === "QU";
  751. const showAtPage = currentPage === "AT";
  752.  
  753. if (showCmdPage) {
  754. await typeAt(fit("──── Commands ────", iw), "#fbbf24", ix, iy + 6);
  755. const cmds = [
  756. "/upg N - Buy upgrade N",
  757. "/upg N max - Buy upgrade N to max",
  758. "/upg all - Buy all upgrades x1",
  759. "/upg all max - Buy all upgrades to max",
  760. "/page N - Go to upgrade page N",
  761. "/page RU - Rebirth upgrades page",
  762. "/page AI - Anti-Inc upgrades page",
  763. "/page QU - Quantum upgrades page",
  764. "/page AT - Atomic sub-stat page",
  765. "/page CMD - This commands page",
  766. "/rupg N - Buy rebirth upgrade N",
  767. "/aupg N - Buy Anti-Inc upgrade N",
  768. "/qupg N - Buy Quantum upgrade N",
  769. "/rebirth - Perform rebirth (1e100 pts)",
  770. "/antiinc - Perform Anti-Inc prestige (1e20 Inc)",
  771. "/quantum (qut) - Perform Quantum prestige (100 Anti-Inc)"
  772. ];
  773. for (let i = 0; i < cmds.length && i < 17; i++)
  774. await typeAt(fit(cmds[i], iw), "#94a3b8", ix, iy + 7 + i);
  775. for (let r = 7 + cmds.length; r <= 23; r++)
  776. await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  777. await typeAt(fit("Page CMD (Commands)", iw), "#fbbf24", ix, iy + 24);
  778.  
  779. } else if (showRbPage) {
  780. await typeAt(fit("──── Rebirth Bonuses ────", iw), "#e879f9", ix, iy + 6);
  781. const rbIdx = parseInt(String(currentPage).slice(1)) || 1;
  782. const rbData = rebirthPages[rbIdx - 1];
  783. if (rbData) {
  784. await typeAt(fit(`Rebirth #${rbIdx}`, iw), "#fbbf24", ix, iy + 7);
  785. await typeAt(fit(`Points at RB: ${formatNum(rbData.points)}`, iw), "#94a3b8", ix, iy + 8);
  786. await typeAt(fit(`Gain at RB: ${formatNum(rbData.gain)}`, iw), "#94a3b8", ix, iy + 9);
  787. await typeAt(fit(`Inc earned: ${formatNum(rbData.incEarned)}`, iw), "#94a3b8", ix, iy + 10);
  788. for (let r = 11; r <= 23; r++) await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  789. } else {
  790. await typeAt(fit("No data for this rebirth page.", iw), "#94a3b8", ix, iy + 7);
  791. for (let r = 8; r <= 23; r++) await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  792. }
  793. const totalRbP = Math.max(rebirthPages.length, 1);
  794. await typeAt(fit(`Page B${parseInt(String(currentPage).slice(1)) || 1}/${totalRbP}`, iw), "#fbbf24", ix, iy + 24);
  795.  
  796. } else if (showRuPage) {
  797. await typeAt(fit("──── Rebirth Upgrades ────", iw), "#e879f9", ix, iy + 6);
  798. for (let i = 0; i < rebirthUpgrades.length; i++) {
  799. const ru = rebirthUpgrades[i];
  800. const row = iy + 7 + i * 2;
  801. const maxed = ru.maxBuy !== -1 && ru.level >= ru.maxBuy;
  802. const tag = maxed ? " [BOUGHT/MAX]" : ru.maxBuy === 1 ? " [1x]" : ` Lv${ru.level}`;
  803. await typeAt(fit(`[${ru.id}] ${ru.name}${tag}`, iw), "#e879f9", ix, row);
  804. await typeAt(fit(` Cost: ${formatNum(ru.cost)} Inc | ${ru.desc}`, iw), "#94a3b8", ix, row + 1);
  805. }
  806. for (let r = 7 + rebirthUpgrades.length * 2; r <= 23; r++)
  807. await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  808. await typeAt(fit("Page RU (Rebirth Upgrades)", iw), "#fbbf24", ix, iy + 24);
  809.  
  810. } else if (showAiPage) {
  811. await typeAt(fit("──── Anti-Inc Upgrades ────", iw), "#84cc16", ix, iy + 6);
  812. for (let i = 0; i < antiIncUpgrades.length; i++) {
  813. const au = antiIncUpgrades[i];
  814. const row = iy + 7 + i * 2;
  815. const maxed = au.maxBuy !== -1 && au.level >= au.maxBuy;
  816. const tag = maxed ? " [BOUGHT]" : " [1x]";
  817. await typeAt(fit(`[${au.id}] ${au.name}${tag}`, iw), "#a8a29e", ix, row);
  818. await typeAt(fit(` Cost: ${formatNum(au.cost)} Anti-Inc | ${au.desc}`, iw), "#94a3b8", ix, row + 1);
  819. }
  820. for (let r = 7 + antiIncUpgrades.length * 2; r <= 23; r++)
  821. await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  822. await typeAt(fit("Page AI (Anti-Inc Upgrades)", iw), "#fbbf24", ix, iy + 24);
  823.  
  824. } else if (showQuPage) {
  825. await typeAt(fit("──── Quantum Upgrades ────", iw), "#facc15", ix, iy + 6);
  826. for (let i = 0; i < quantumUpgrades.length; i++) {
  827. const qu = quantumUpgrades[i];
  828. const row = iy + 7 + i * 2;
  829. const maxed = qu.maxBuy !== -1 && qu.level >= qu.maxBuy;
  830. const tag = maxed ? " [BOUGHT]" : " [1x]";
  831. await typeAt(fit(`[${qu.id}] ${qu.name}${tag}`, iw), "#fbbf24", ix, row);
  832. await typeAt(fit(` Cost: ${formatNum(qu.cost)} QP | ${qu.desc}`, iw), "#94a3b8", ix, row + 1);
  833. }
  834. for (let r = 7 + quantumUpgrades.length * 2; r <= 23; r++)
  835. await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  836. await typeAt(fit("Page QU (Quantum Upgrades)", iw), "#fbbf24", ix, iy + 24);
  837.  
  838. } else if (showAtPage) {
  839. // Atomic layer page (CID 11 Blue/Cyan, CID 4 Green, CID 8 Blue-Purple)
  840. await typeAt(fit("──── Atomic Layer Sub-stats ────", iw), "#06b6d4", ix, iy + 6);
  841.  
  842. await typeAt(fit(`Protons: ${formatNum(proton)}`, iw), "#38bdf8", ix, iy + 8);
  843. await typeAt(fit(" Formula: log10(all layers generation) / 10", iw), "#94a3b8", ix, iy + 9);
  844. await typeAt(fit(" Effect: Multiplies point gain", iw), "#06b6d4", ix, iy + 10);
  845.  
  846. // Neutron
  847. const neutronUnl = proton.gte(100);
  848. const nColor = neutronUnl ? "#4ade80" : "#ef4444";
  849. const nText = neutronUnl ? `Neutrons: ${formatNum(neutron)}` : "Neutrons: LOCKED (Needs 100 Proton)";
  850. await typeAt(fit(nText, iw), nColor, ix, iy + 12);
  851. await typeAt(fit(" Effect: Multiplies Rebirth Inc gain", iw), "#94a3b8", ix, iy + 13);
  852.  
  853. // Electron
  854. const electronUnl = neutron.gte(100);
  855. const eColor = electronUnl ? "#a78bfa" : "#ef4444";
  856. const eText = electronUnl ? `Electrons: ${formatNum(electron)}` : "Electrons: LOCKED (Needs 100 Neutron)";
  857. await typeAt(fit(eText, iw), eColor, ix, iy + 15);
  858. await typeAt(fit(" Effect: Multiplies Anti-Inc gain", iw), "#94a3b8", ix, iy + 16);
  859.  
  860. for (let r = 17; r <= 23; r++) await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  861. await typeAt(fit("Page AT (Atomic Stats)", iw), "#fbbf24", ix, iy + 24);
  862.  
  863. } else {
  864. const numPage = typeof currentPage === "number" ? currentPage : 1;
  865. const totalPages = Math.ceil(upgrades.length / UPG_PER_PAGE);
  866. const cp = Math.max(1, Math.min(numPage, totalPages));
  867. currentPage = cp;
  868. const start = (cp - 1) * UPG_PER_PAGE;
  869. const pageUpg = upgrades.slice(start, start + UPG_PER_PAGE);
  870.  
  871. await typeAt(fit("──── Upgrades ────", iw), "#fbbf24", ix, iy + 6);
  872.  
  873. const colors = { 1:"#38bdf8", 2:"#c084fc", 3:"#fb923c", 4:"#4ade80", 5:"#f472b6", 6:"#facc15", 7:"#22d3ee" };
  874.  
  875. for (let i = 0; i < UPG_PER_PAGE; i++) {
  876. const row = iy + 7 + i * 4;
  877. if (i < pageUpg.length) {
  878. const u = pageUpg[i];
  879. const oneTime = u.maxBuy === 1;
  880. const maxed = oneTime && u.level >= 1;
  881. const hc = isHardcapped(u.id, u.level);
  882. const scLabel = hc ? " [HARDCAP]" : maxed ? " [BOUGHT]" : oneTime ? " [1x]" : getSoftcapLabel(u.id, u.level);
  883. await typeAt(fit(`[${u.id}] ${u.name}${scLabel}`, iw), colors[u.id] || "#38bdf8", ix, row);
  884. await typeAt(fit(` Cost: ${formatNum(u.cost)} pts | Lvl ${u.level}`, iw), "#94a3b8", ix, row + 1);
  885. const scm = getCostMultiplier(u.id, u.level);
  886. const scInfo = scm > 1 ? `Cost x${scm}` : "";
  887. await typeAt(fit(` ${scInfo}`, iw), "#ef4444", ix, row + 2);
  888. await typeAt(fit("", iw), "#0f172a", ix, row + 3);
  889. } else {
  890. for (let j = 0; j < 4; j++) await typeAt(fit("", iw), "#0f172a", ix, row + j);
  891. }
  892. }
  893.  
  894. const usedRows = UPG_PER_PAGE * 4;
  895. for (let r = 7 + usedRows; r <= 23; r++)
  896. await typeAt(fit("", iw), "#0f172a", ix, iy + r);
  897.  
  898. await typeAt(fit(`Page ${cp}/${totalPages} | /page CMD for help`, iw), "#fbbf24", ix, iy + 24);
  899. }
  900.  
  901. const canRebirth = points.gte(D("1e100"));
  902. const canAntiInc = increments.gte("1e20");
  903. const canQuantum = antiInc.gte(100);
  904.  
  905. // Prompt alert priority rendering
  906. if (canQuantum) {
  907. try { w.changeColor(1); } catch (_) {}
  908. const pendQ = calcQuantumPoints(antiInc);
  909. await typeAt(fit(`⚡ QUANTUMIZE for ${formatNum(pendQ)} QP! /quantum ⚡`, iw), "#facc15", ix, iy + 25);
  910. try { w.changeColor(0); } catch (_) {}
  911. } else if (canAntiInc) {
  912. try { w.changeColor(5); } catch (_) {}
  913. const pendAnti = calcAntiInc(increments);
  914. await typeAt(fit(`⚡ PRESTIGE for ${formatNum(pendAnti)} Anti-Inc! /antiinc ⚡`, iw), "#84cc16", ix, iy + 25);
  915. try { w.changeColor(0); } catch (_) {}
  916. } else if (canRebirth) {
  917. try { w.changeColor(10); } catch (_) {}
  918. const pendInc = calcIncrements(points);
  919. await typeAt(fit(`★ REBIRTH for ${formatNum(pendInc)} Inc! /rebirth ★`, iw), "#ff00ff", ix, iy + 25);
  920. try { w.changeColor(0); } catch (_) {}
  921. } else {
  922. await typeAt(fit("", iw), "#0f172a", ix, iy + 25);
  923. }
  924. }
  925.  
  926. /* ══════════════════════════════════════
  927. BUY LOGIC
  928. ══════════════════════════════════════ */
  929. function buyUpgrade(u, silent) {
  930. if (u.maxBuy !== -1 && u.level >= u.maxBuy) return false;
  931. if (isHardcapped(u.id, u.level)) return false;
  932. if (!points.gte(u.cost)) return false;
  933. points = points.sub(u.cost);
  934. u.level++;
  935.  
  936. const scm = getCostMultiplier(u.id, u.level);
  937.  
  938. switch (u.id) {
  939. case 1: pointGain = pointGain.add(1); u.cost = roundCost(D(u.cost).mul(u.scaling * scm)); break;
  940. case 2: pointGain = pointGain.mul(3); u.cost = roundCost(D(u.cost).mul(u.scaling * scm)); break;
  941. case 3:
  942. u.cost = roundCost(D(u.cost).mul(u.scaling * scm));
  943. for (const upg of upgrades) upg.cost = roundCost(D(upg.cost).div(1.5));
  944. break;
  945. case 4: automationOn = true; break;
  946. case 5: pointGain = pointGain.pow(1.1); u.cost = roundCost(D(u.cost).mul(u.scaling * scm)); break;
  947. case 6: boosterOn = true; break;
  948. case 7:
  949. greaterGainMul = greaterGainMul.mul(1.25);
  950. pointGain = pointGain.mul(1.25);
  951. u.cost = roundCost(D(u.cost).mul(u.scaling * scm));
  952. break;
  953. }
  954. return true;
  955. }
  956.  
  957. function buyRebirthUpgrade(ru) {
  958. if (ru.maxBuy !== -1 && ru.level >= ru.maxBuy) return false;
  959. if (!increments.gte(ru.cost)) return false;
  960. increments = increments.sub(ru.cost);
  961. ru.level++;
  962. switch (ru.id) {
  963. case "R1": rbPointBoost = true; break;
  964. case "R2": fullAutoOn = true; break;
  965. case "R3": rbDoubler = true; break;
  966. case "R4":
  967. rbX2Level++;
  968. ru.cost = roundCost(D(ru.cost).mul(ru.scaling));
  969. break;
  970. case "R5":
  971. rbRaiserLevel++;
  972. ru.cost = roundCost(D(ru.cost).mul(ru.scaling));
  973. break;
  974. case "R6":
  975. rbMaximizer = true;
  976. for (const other of rebirthUpgrades) {
  977. if (other.id !== "R6") {
  978. other.level += 150;
  979. if (other.id === "R1") rbPointBoost = true;
  980. if (other.id === "R2") fullAutoOn = true;
  981. if (other.id === "R3") rbDoubler = true;
  982. if (other.id === "R4") rbX2Level += 150;
  983. if (other.id === "R5") rbRaiserLevel += 150;
  984. }
  985. }
  986. break;
  987. }
  988. return true;
  989. }
  990.  
  991. function buyAntiIncUpgrade(au) {
  992. if (au.maxBuy !== -1 && au.level >= au.maxBuy) return false;
  993. if (!antiInc.gte(au.cost)) return false;
  994. antiInc = antiInc.sub(au.cost);
  995. au.level++;
  996. switch (au.id) {
  997. case "A1": autoIncActive = true; break;
  998. case "A2": breakerActive = true; break;
  999. }
  1000. return true;
  1001. }
  1002.  
  1003. function buyQuantumUpgrade(qu) {
  1004. if (qu.maxBuy !== -1 && qu.level >= qu.maxBuy) return false;
  1005. if (!quantumPoints.gte(qu.cost)) return false;
  1006. quantumPoints = quantumPoints.sub(qu.cost);
  1007. qu.level++;
  1008. switch (qu.id) {
  1009. case "Q1": antiIncToPtsActive = true; break;
  1010. case "Q2": atomicizeUnlocked = true; break;
  1011. }
  1012. return true;
  1013. }
  1014.  
  1015. /* ══════════════════════════════════════
  1016. PRESTIGE LOGICS
  1017. ══════════════════════════════════════ */
  1018. function doRebirth() {
  1019. if (!points.gte(D("1e100"))) return false;
  1020. const earned = calcIncrements(points);
  1021.  
  1022. rebirthPages.push({ points: D(points), gain: D(pointGain), incEarned: D(earned), rb: rebirths + 1 });
  1023. increments = increments.add(earned);
  1024. rebirths++;
  1025.  
  1026. points = D(0); pointGain = D(1);
  1027. automationOn = false; boosterOn = false;
  1028. greaterGainMul = D(1);
  1029. upgrades = defaultUpgrades();
  1030. currentPage = 1;
  1031.  
  1032. rbPointBoost = false; fullAutoOn = false; rbDoubler = false;
  1033. for (const ru of rebirthUpgrades) {
  1034. if (ru.id === "R1" && ru.level >= 1) rbPointBoost = true;
  1035. if (ru.id === "R2" && ru.level >= 1) fullAutoOn = true;
  1036. if (ru.id === "R3" && ru.level >= 1) rbDoubler = true;
  1037. }
  1038. return true;
  1039. }
  1040.  
  1041. function doAntiIncPrestige() {
  1042. if (increments.lt("1e20")) return false;
  1043. const earned = calcAntiInc(increments);
  1044. antiInc = antiInc.add(earned);
  1045.  
  1046. points = D(0);
  1047. pointGain = D(1);
  1048. rebirths = 0;
  1049. increments = D(0);
  1050. greaterGainMul = D(1);
  1051.  
  1052. automationOn = false;
  1053. boosterOn = false;
  1054. fullAutoOn = false;
  1055. rbPointBoost = false;
  1056. rbDoubler = false;
  1057. rbX2Level = 0;
  1058. rbRaiserLevel = 0;
  1059. rbMaximizer = false;
  1060.  
  1061. upgrades = defaultUpgrades();
  1062. rebirthUpgrades = defaultRebirthUpgrades();
  1063. rebirthPages.length = 0;
  1064. currentPage = 1;
  1065.  
  1066. return true;
  1067. }
  1068.  
  1069. function doQuantumPrestige() {
  1070. if (antiInc.lt(100)) return false;
  1071. const earned = calcQuantumPoints(antiInc);
  1072. quantumPoints = quantumPoints.add(earned);
  1073.  
  1074. // Heavy wipe for Quantum layer
  1075. points = D(0);
  1076. pointGain = D(1);
  1077. rebirths = 0;
  1078. increments = D(0);
  1079. greaterGainMul = D(1);
  1080. antiInc = D(0);
  1081.  
  1082. automationOn = false;
  1083. boosterOn = false;
  1084. fullAutoOn = false;
  1085. rbPointBoost = false;
  1086. rbDoubler = false;
  1087. rbX2Level = 0;
  1088. rbRaiserLevel = 0;
  1089. rbMaximizer = false;
  1090. breakerActive = false;
  1091. autoIncActive = false;
  1092.  
  1093. upgrades = defaultUpgrades();
  1094. rebirthUpgrades = defaultRebirthUpgrades();
  1095. antiIncUpgrades = defaultAntiIncUpgrades();
  1096. rebirthPages.length = 0;
  1097. currentPage = 1;
  1098.  
  1099. return true;
  1100. }
  1101.  
  1102. /* ══════════════════════════════════════
  1103. COMMAND HANDLER
  1104. ══════════════════════════════════════ */
  1105. async function handleCmd(raw, user) {
  1106. if (!running || stopped) return;
  1107. const cmd = raw.toLowerCase().replace(/\s+/g, " ").trim();
  1108.  
  1109. // Check deduplication
  1110. const cmdKey = `${user.toLowerCase()}:${cmd}`;
  1111. const now = Date.now();
  1112. if (commandExecutionHistory.has(cmdKey)) {
  1113. const lastTime = commandExecutionHistory.get(cmdKey);
  1114. if (now - lastTime < 1000) return;
  1115. }
  1116. commandExecutionHistory.set(cmdKey, now);
  1117.  
  1118. if (commandExecutionHistory.size > 200) {
  1119. for (const [k, t] of commandExecutionHistory.entries()) {
  1120. if (now - t > 5000) commandExecutionHistory.delete(k);
  1121. }
  1122. }
  1123.  
  1124. if (cmd === "/rebirth") {
  1125. if (doRebirth()) {
  1126. const last = rebirthPages[rebirthPages.length - 1];
  1127. await chatSend(`✓ REBIRTH #${rebirths}! +${formatNum(last.incEarned)} Inc`);
  1128. } else await chatSend(`✗ Need 1e100 pts`);
  1129. return;
  1130. }
  1131.  
  1132. if (cmd === "/antiinc") {
  1133. if (doAntiIncPrestige()) {
  1134. await chatSend(`⚡ PRESTIGE SUCCESSFUL! Now at ${formatNum(antiInc)} Anti-Inc.`);
  1135. } else await chatSend(`✗ Need 1e20 Inc`);
  1136. return;
  1137. }
  1138.  
  1139. if (cmd === "/quantum" || cmd === "/qut") {
  1140. if (doQuantumPrestige()) {
  1141. await chatSend(`⚡ QUANTUM PRESTIGE SUCCESSFUL! Now at ${formatNum(quantumPoints)} QP.`);
  1142. } else await chatSend(`✗ Need 100 Anti-Inc`);
  1143. return;
  1144. }
  1145.  
  1146. if (cmd === "/page cmd") { currentPage = "CMD"; await chatSend("Commands page"); return; }
  1147. if (cmd === "/page ru") { currentPage = "RU"; await chatSend("Rebirth Upgrades"); return; }
  1148. if (cmd === "/page ai") { currentPage = "AI"; await chatSend("Anti-Inc Upgrades"); return; }
  1149. if (cmd === "/page qu") { currentPage = "QU"; await chatSend("Quantum Upgrades"); return; }
  1150. if (cmd === "/page at" || cmd === "/page atom") {
  1151. if (!atomicizeUnlocked) { await chatSend("✗ Atomic Layer locked. Buy 'Atomicize' in QU."); return; }
  1152. currentPage = "AT";
  1153. await chatSend("Atomic Layer Stats");
  1154. return;
  1155. }
  1156.  
  1157. const rbpm = cmd.match(/^\/page\s+b(\d+)$/i);
  1158. if (rbpm) {
  1159. const idx = parseInt(rbpm[1]);
  1160. if (idx >= 1 && idx <= Math.max(rebirthPages.length, 1)) { currentPage = "B" + idx; await chatSend(`Rebirth Page B${idx}`); }
  1161. return;
  1162. }
  1163.  
  1164. const pm = cmd.match(/^\/page\s+(\d+)$/);
  1165. if (pm) {
  1166. const p = parseInt(pm[1]);
  1167. const tot = Math.ceil(upgrades.length / UPG_PER_PAGE);
  1168. if (p >= 1 && p <= tot) { currentPage = p; await chatSend(`Page ${p}/${tot}`); }
  1169. return;
  1170. }
  1171.  
  1172. const umSingle = cmd.match(/^\/upg\s+(\d+)$/);
  1173. if (umSingle) {
  1174. const id = parseInt(umSingle[1]);
  1175. const u = upgrades.find(x => x.id === id);
  1176. if (!u) { await chatSend("Unknown #" + id); return; }
  1177. if (u.maxBuy !== -1 && u.level >= u.maxBuy) { await chatSend(`✗ [${u.id}] maxed`); return; }
  1178. if (isHardcapped(u.id, u.level)) { await chatSend(`✗ [${u.id}] HARDCAPPED`); return; }
  1179. if (buyUpgrade(u)) {
  1180. await chatSend(`✓ [${u.id}] Lvl ${u.level}`);
  1181. } else await chatSend(`✗ Need ${formatNum(u.cost)} pts`);
  1182. return;
  1183. }
  1184.  
  1185. const umMax = cmd.match(/^\/upg\s+(\d+)\s+max$/);
  1186. if (umMax) {
  1187. const id = parseInt(umMax[1]);
  1188. const u = upgrades.find(x => x.id === id);
  1189. if (!u) { await chatSend("Unknown #" + id); return; }
  1190. let n = 0;
  1191. while (points.gte(u.cost) && (u.maxBuy === -1 || u.level < u.maxBuy) && !isHardcapped(u.id, u.level) && n < 100000) {
  1192. buyUpgrade(u, true); n++;
  1193. }
  1194. if (n > 0) await chatSend(`✓ [${u.id}] bought x${n}`);
  1195. return;
  1196. }
  1197.  
  1198. if (cmd === "/upg all max") {
  1199. let total = 0, go = true;
  1200. while (go && total < 200000) {
  1201. go = false;
  1202. for (const u of upgrades)
  1203. if ((u.maxBuy === -1 || u.level < u.maxBuy) && !isHardcapped(u.id, u.level) && points.gte(u.cost)) {
  1204. buyUpgrade(u, true); total++; go = true;
  1205. }
  1206. }
  1207. if (total > 0) await chatSend(`✓ Bought ${total} upgrades max!`);
  1208. return;
  1209. }
  1210.  
  1211. if (cmd === "/upg all") {
  1212. let n = 0;
  1213. for (const u of upgrades)
  1214. if ((u.maxBuy === -1 || u.level < u.maxBuy) && !isHardcapped(u.id, u.level) && points.gte(u.cost)) {
  1215. buyUpgrade(u, true); n++;
  1216. }
  1217. if (n > 0) await chatSend(`✓ Bought ${n} upgrades!`);
  1218. return;
  1219. }
  1220.  
  1221. const rup = cmd.match(/^\/rupg\s+(\d+)$/);
  1222. if (rup) {
  1223. const rn = parseInt(rup[1]);
  1224. const ru = rebirthUpgrades.find(x => x.id === "R" + rn);
  1225. if (!ru) { await chatSend("Unknown R" + rn); return; }
  1226. if (ru.maxBuy !== -1 && ru.level >= ru.maxBuy) { await chatSend(`✗ [${ru.id}] maxed`); return; }
  1227. if (buyRebirthUpgrade(ru)) await chatSend(`✓ [${ru.id}] ${ru.name}`);
  1228. return;
  1229. }
  1230.  
  1231. const rupMax = cmd.match(/^\/rupg\s+(\d+)\s+max$/);
  1232. if (rupMax) {
  1233. const rn = parseInt(rupMax[1]);
  1234. const ru = rebirthUpgrades.find(x => x.id === "R" + rn);
  1235. if (!ru) { await chatSend("Unknown R" + rn); return; }
  1236. let n = 0;
  1237. while ((ru.maxBuy === -1 || ru.level < ru.maxBuy) && increments.gte(ru.cost) && n < 100000) {
  1238. buyRebirthUpgrade(ru); n++;
  1239. }
  1240. if (n > 0) await chatSend(`✓ [${ru.id}] bought x${n}`);
  1241. return;
  1242. }
  1243.  
  1244. const aup = cmd.match(/^\/aupg\s+(\d+)$/);
  1245. if (aup) {
  1246. const an = parseInt(aup[1]);
  1247. const au = antiIncUpgrades.find(x => x.id === "A" + an);
  1248. if (!au) { await chatSend("Unknown A" + an); return; }
  1249. if (au.maxBuy !== -1 && au.level >= au.maxBuy) { await chatSend(`✗ [${au.id}] maxed`); return; }
  1250. if (buyAntiIncUpgrade(au)) await chatSend(`✓ [${au.id}] ${au.name}`);
  1251. return;
  1252. }
  1253.  
  1254. const qup = cmd.match(/^\/qupg\s+(\d+)$/);
  1255. if (qup) {
  1256. const qn = parseInt(qup[1]);
  1257. const qu = quantumUpgrades.find(x => x.id === "Q" + qn);
  1258. if (!qu) { await chatSend("Unknown Q" + qn); return; }
  1259. if (qu.maxBuy !== -1 && qu.level >= qu.maxBuy) { await chatSend(`✗ [${qu.id}] maxed`); return; }
  1260. if (buyQuantumUpgrade(qu)) await chatSend(`✓ [${qu.id}] ${qu.name}`);
  1261. return;
  1262. }
  1263. }
  1264.  
  1265. /* ══════════════════════════════════════ */
  1266. window.quit = async function () {
  1267. stopped = true; timers.forEach(clearInterval); timers.length = 0;
  1268. if (running) {
  1269. for (let r = 0; r < WIN_H; r++)
  1270. for (let c = 0; c < WIN_W; c++) {
  1271. writeCharAt(" ", "#000000", gx + c, gy + r);
  1272. if (!instantMode) await sleep(COOLDOWN);
  1273. }
  1274. }
  1275. running = false;
  1276. try { shade.remove(); } catch (_) {} try { hud.remove(); } catch (_) {}
  1277. try { w.chat.send("Stopped"); } catch (_) {}
  1278. console.log("[Incrementallity] Game stopped.");
  1279. };
  1280.  
  1281. window.info = function () { console.log("incrementality is a game that i made."); };
  1282.  
  1283. })();
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment