Advertisement
spotky

The Ascension Tree Auto

May 2nd, 2024
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Auto Game
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2024-05-02
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://ascensiontree.semenar.am/
  8. // @icon         https://www.google.com/s2/favicons?sz=64&domain=semenar.am
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. function autoTick() {
  15.   for (const layer of player.layers) autoLayer(layer);
  16. }
  17.  
  18. function isAllUpgradeBought(layer) {
  19.     return Object.values(layer.upgrades).every(upgrade => upgrade.bought)
  20. }
  21.  
  22. function autoLayer(layer) {
  23.   if (
  24.       layer.left_branch &&
  25.       layer.right_branch &&
  26.       isAllUpgradeBought(layer)
  27.   ) return;
  28.  
  29.   if (!layer.left_branch) layer.buyLeft();
  30.   if (!layer.right_branch) layer.buyRight();
  31.   const production = layer.calculateProduction(0);
  32.   if (
  33.     layer.canPrestige() &&
  34.     isAllUpgradeBought(layer.parent_layer) &&
  35.     (
  36.         layer.points.eq(0) ||
  37.         layer.prestigeGain().div(production.max(1)).gte(3) && Math.random() > 0.5 ||
  38.         production.eq(0)
  39.     )
  40.   ) {
  41.     layer.prestige();
  42.   }
  43.   for (const upgradeKey in layer.upgrades) {
  44.     const upgrade = layer.upgrades[upgradeKey];
  45.     if (!upgrade.canBuy() || upgrade.bought) continue;
  46.     upgrade.buy();
  47.   }
  48. }
  49.  
  50. setInterval(autoTick, 50);
  51. })();
Tags: auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement