From 8b6867a9237c1bec18f956901f83edb8f7655c4e Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 20 Apr 2018 07:19:48 +0200 Subject: [PATCH] Fully manage dragon including auras Signed-off-by: Knut Ahlers --- autocookieclicker.user.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/autocookieclicker.user.js b/autocookieclicker.user.js index f5f3fcb..35702b6 100644 --- a/autocookieclicker.user.js +++ b/autocookieclicker.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Automate CookieClicker // @namespace https://luzifer.io/ -// @version 0.14.1 +// @version 0.15.0 // @description Automate everything! // @author Knut Ahlers // @source https://github.com/Luzifer/automate-cookie-clicker @@ -20,6 +20,10 @@ var blockingUpgrades = [ 333, // Milk selector 414, // Background selector ]; +var dragonAuras = [ + 10, // Golden cookies may trigger a Dragonflight. + 15, // All cookie production multiplied by 2. +]; var purchaseSteps = 50; function autoClick() { @@ -53,10 +57,7 @@ function executeAutoActions() { note('Purchased ' + product.find('.title:first').text() + ' for you.'); } - // Upgrade dragon if possible - if (Game.dragonLevels[Game.dragonLevel].cost()) { - Game.UpgradeDragon() - } + manageDragon(); } function controlAutoClicker() { @@ -102,6 +103,23 @@ function installHelper() { window.autoPurchase = window.setInterval(executeAutoActions, 500); } +function manageDragon() { + // Upgrade dragon if possible + if (Game.dragonLevels[Game.dragonLevel].cost()) { + Game.UpgradeDragon() + } + + // Select first dragon aura + if (Game.dragonAura != dragonAuras[0] && Game.dragonLevel >= dragonAuras[0] + 4 && Game.SelectingDragonAura != dragonAura[0]) { + Game.SetDragonAura(dragonAuras[0], 0); + } + + // Select second dragon aura + if (Game.dragonAura2 != dragonAuras[1] && Game.dragonLevel >= 22 && Game.SelectingDragonAura != dragonAura[1]) { + Game.SetDragonAura(dragonAuras[1], 1); + } +} + function note(msg, quick = true) { // Icon: img/icons.png 0-based indices Game.Notify("Auto-CookieClicker", msg, [12, 0], quick, true);