|
"use strict"; |
|
|
|
function cookiePwn(interval) { |
|
return setInterval(function() { |
|
Game.ClickCookie(); |
|
if ((Game.elderWrath >= 3 || !(Game.cookieClicks % 4)) && (!Game.clickFrenzy || Game.timersEl.elderFrenzy.style.display !== "block")) { |
|
do { |
|
Game.goldenCookie.spawn(); |
|
} while (Game.elderWrath < 3 && Game.goldenCookie.wrath); |
|
Game.goldenCookie.click(); |
|
Game.seasonPopup.spawn(); |
|
Game.seasonPopup.click(); |
|
Game.Notes.splice(0, Game.Notes.length); |
|
Game.NotesById.splice(0, Game.NotesById.length); // Truncate the notes object array. Otherwise it grows forever. |
|
Game.frenzyPower < 1 && (Game.frenzy = 0); |
|
} |
|
}, interval); |
|
} |
|
|
|
// Game.ObjectsById.forEach(function(x) { x.buy(100); }) |
|
// pwnIntervals.push(setInterval(function() { Game.wrinklers.filter(function(x) { return x.close === 1; }).forEach(function(x) { x.hp = 0; }); }, 120000)) |
|
function wrinklerPwn(interval) { |
|
return setInterval(Game.CollectWrinklers, interval); |
|
} |
|
|
|
function buyAvailableUpgrades() { |
|
Game.UpgradesInStore.slice(0).sort(function(x, y) { return x.getPrice() - y.getPrice(); }).every(function(x) { |
|
var uid = Game.UpgradesById[x.id]; // Store button event handlers are currently bound to UpgradesById.buy() |
|
|
|
if (uid.getPrice() > Game.cookies) { |
|
console.log("Ran out of bling while trying to buy " + uid.name); |
|
return false; |
|
} else if (uid.pool !== "toggle") { // Bypass seasons and the elder covenanat / pledge |
|
uid.buy(); |
|
} |
|
|
|
return true; |
|
}); |
|
} |
|
|
|
if (typeof pwnIntervals === "undefined") { |
|
var pwnIntervals = new Array(); |
|
} else { |
|
while (pwnIntervals.length > 0) { |
|
clearInterval(pwnIntervals.pop()); |
|
} |
|
} |
|
|
|
pwnIntervals.push(cookiePwn(4), wrinklerPwn(5000)); |