In Cookie Clicker there are Golden cookies, and Wrath Golden Cookies.
Golden cookies are Clickable cookies that randomly appear, and when clicked they give Bonus cookies, or temporary boosts to clicking/Cookies Per second (i.e. Cps).
The Wrath Golden cookies can still give boosts and bonuses, but they have the chance of taking cookies or giving a reverse boost to Cps.
Wrath Golden Cookies happen as an effect of pushing the Grandmas too far.
Some "power-ups" require Golden cookies to stay on the screen and not be clicked right away, so I wanted a fast way to turn off the clicker.
I came up with a way to turn on and off the Golden/Wrath switches using a single command in the console, and they give a little more information as well.
// allows me to turn on and off the clicking of the Wrath Cookies
var wrathCookieSwitchOn = false;
var cookieSwitchOn = false;
var wrathSwitch = function() {
wrathCookieSwitchOn = !wrathCookieSwitchOn;
console.log("WrathCookieSwitchOn is set to " + wrathCookieSwitchOn);
}
var flipCookieSwitch = function(){
cookieSwitchOn = !cookieSwitchOn;
if (cookieSwitchOn) {
var SpecialCookieClicker =
setInterval(function() {
Game.shimmers.forEach(function(shimmer) {
(shimmer.type == "golden") && (shimmer.wrath == 0 || wrathCookieSwitchOn) ? shimmer.pop() : 0;
})
}, 500);
console.log("Golden Cookie Clicker is on and wrathCookieSwitchOn is set to " + wrathCookieSwitchOn);
} else {
clearInterval(SpecialCookieClicker);
console.log("Golden Cookie Clicker is Turned off");
}
};
flipCookieSwitch();
I was thinking about overloading the function so that I could flip the Wrath Switch as well, but I haven't decided how I want to do that yet.
Does the code make sense to you? Is there anything I could make better or more efficient?
Link to the Game itself, it is addicting and YOU HAVE BEEN WARNED
none of the scripts that I have posted here are considered cheating by the game