Path: blob/main/static/src/gs/public/cookie/main.js
1324 views
/*1All this code is copyright Orteil, 2013-2019.2-with some help, advice and fixes by Nicholas Laux, Debugbro, Opti, and lots of people on reddit, Discord, and the DashNet forums3-also includes a bunch of snippets found on stackoverflow.com and others4Hello, and welcome to the joyous mess that is main.js. Code contained herein is not guaranteed to be good, consistent, or sane. Most of this is years old at this point and harkens back to simpler, cruder times. Have a nice trip.5Spoilers ahead.6http://orteil.dashnet.org7*/89var VERSION=2.022;10var BETA=0;111213/*=====================================================================================14MISC HELPER FUNCTIONS15=======================================================================================*/16function l(what) {return document.getElementById(what);}17function choose(arr) {return arr[Math.floor(Math.random()*arr.length)];}1819function escapeRegExp(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");}20function replaceAll(find,replace,str){return str.replace(new RegExp(escapeRegExp(find),'g'),replace);}2122//disable sounds coming from soundjay.com (sorry)23var realAudio=Audio;//backup real audio24Audio=function(src){25if (src && src.indexOf('soundjay')>-1) {Game.Popup('Sorry, no sounds hotlinked from soundjay.com.');this.play=function(){};}26else return new realAudio(src);27};2829if(!Array.prototype.indexOf) {30Array.prototype.indexOf = function(needle) {31for(var i = 0; i < this.length; i++) {32if(this[i] === needle) {return i;}33}34return -1;35};36}3738function randomFloor(x) {if ((x%1)<Math.random()) return Math.floor(x); else return Math.ceil(x);}3940function shuffle(array)41{42var counter = array.length, temp, index;43// While there are elements in the array44while (counter--)45{46// Pick a random index47index = (Math.random() * counter) | 0;4849// And swap the last element with it50temp = array[counter];51array[counter] = array[index];52array[index] = temp;53}54return array;55}5657var sinArray=[];58for (var i=0;i<360;i++)59{60//let's make a lookup table61sinArray[i]=Math.sin(i/360*Math.PI*2);62}63function quickSin(x)64{65//oh man this isn't all that fast actually66//why do I do this. why67var sign=x<0?-1:1;68return sinArray[Math.round(69(Math.abs(x)*360/Math.PI/2)%36070)]*sign;71}7273/*function ajax(url,callback){74var ajaxRequest;75try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest=new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {try{ajaxRequest=new ActiveXObject('Microsoft.XMLHTTP');} catch (e){alert("Something broke!");return false;}}}76if (callback){ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){callback(ajaxRequest.responseText);}}}77ajaxRequest.open('GET',url+'&nocache='+(new Date().getTime()),true);ajaxRequest.send(null);78}*/7980var ajax=function(url,callback)81{82var httpRequest=new XMLHttpRequest();83if (!httpRequest){return false;}84httpRequest.onreadystatechange=function()85{86try{87if (httpRequest.readyState===XMLHttpRequest.DONE && httpRequest.status===200)88{89callback(httpRequest.responseText);90}91}catch(e){}92}93//httpRequest.onerror=function(e){console.log('ERROR',e);}94if (url.indexOf('?')==-1) url+='?'; else url+='&';95url+='nocache='+Date.now();96httpRequest.open('GET',url);97httpRequest.setRequestHeader('Content-Type','text/plain');98httpRequest.overrideMimeType('text/plain');99httpRequest.send();100return true;101}102103104//Beautify and number-formatting adapted from the Frozen Cookies add-on (http://cookieclicker.wikia.com/wiki/Frozen_Cookies_%28JavaScript_Add-on%29)105function formatEveryThirdPower(notations)106{107return function (value)108{109var base = 0,110notationValue = '';111if (!isFinite(value)) return 'Infinity';112if (value >= 1000000)113{114value /= 1000;115while(Math.round(value) >= 1000)116{117value /= 1000;118base++;119}120if (base >= notations.length) {return 'Infinity';} else {notationValue = notations[base];}121}122return ( Math.round(value * 1000) / 1000 ) + notationValue;123};124}125126function rawFormatter(value) {return Math.round(value * 1000) / 1000;}127128var formatLong=[' thousand',' million',' billion',' trillion',' quadrillion',' quintillion',' sextillion',' septillion',' octillion',' nonillion'];129var prefixes=['','un','duo','tre','quattuor','quin','sex','septen','octo','novem'];130var suffixes=['decillion','vigintillion','trigintillion','quadragintillion','quinquagintillion','sexagintillion','septuagintillion','octogintillion','nonagintillion'];131for (var i in suffixes)132{133for (var ii in prefixes)134{135formatLong.push(' '+prefixes[ii]+suffixes[i]);136}137}138139var formatShort=['k','M','B','T','Qa','Qi','Sx','Sp','Oc','No'];140var prefixes=['','Un','Do','Tr','Qa','Qi','Sx','Sp','Oc','No'];141var suffixes=['D','V','T','Qa','Qi','Sx','Sp','O','N'];142for (var i in suffixes)143{144for (var ii in prefixes)145{146formatShort.push(' '+prefixes[ii]+suffixes[i]);147}148}149formatShort[10]='Dc';150151152var numberFormatters =153[154formatEveryThirdPower(formatShort),155formatEveryThirdPower(formatLong),156rawFormatter157];158function Beautify(value,floats)159{160var negative=(value<0);161var decimal='';162var fixed=value.toFixed(floats);163if (Math.abs(value)<1000 && floats>0 && Math.floor(fixed)!=fixed) decimal='.'+(fixed.toString()).split('.')[1];164value=Math.floor(Math.abs(value));165if (floats>0 && fixed==value+1) value++;166var formatter=numberFormatters[Game.prefs.format?2:1];167var output=formatter(value).toString().replace(/\B(?=(\d{3})+(?!\d))/g,',');168if (output=='0') negative=false;169return negative?'-'+output:output+decimal;170}171function shortenNumber(value)172{173//if no scientific notation, return as is, else :174//keep only the 5 first digits (plus dot), round the rest175//may or may not work properly176if (value >= 1000000 && isFinite(value))177{178var num=value.toString();179var ind=num.indexOf('e+');180if (ind==-1) return value;181var str='';182for (var i=0;i<ind;i++)183{184str+=(i<6?num[i]:'0');185}186str+='e+';187str+=num.split('e+')[1];188return parseFloat(str);189}190return value;191}192193194var beautifyInTextFilter=/(([\d]+[,]*)+)/g;//new regex195var a=/\d\d?\d?(?:,\d\d\d)*/g;//old regex196function BeautifyInTextFunction(str){return Beautify(parseInt(str.replace(/,/g,''),10));};197function BeautifyInText(str) {return str.replace(beautifyInTextFilter,BeautifyInTextFunction);}//reformat every number inside a string198function BeautifyAll()//run through upgrades and achievements to reformat the numbers199{200var func=function(what){what.desc=BeautifyInText(what.baseDesc);}201Game.UpgradesById.forEach(func);202Game.AchievementsById.forEach(func);203}204205//these are faulty, investigate later206//function utf8_to_b64(str){return btoa(str);}207//function b64_to_utf8(str){return atob(str);}208209function utf8_to_b64( str ) {210try{return Base64.encode(unescape(encodeURIComponent( str )));}211catch(err)212{return '';}213}214215function b64_to_utf8( str ) {216try{return decodeURIComponent(escape(Base64.decode( str )));}217catch(err)218{return '';}219}220221function CompressBin(arr)//compress a sequence like [0,1,1,0,1,0]... into a number like 54.222{223var str='';224var arr2=arr.slice(0);225arr2.unshift(1);226arr2.push(1);227arr2.reverse();228for (var i in arr2)229{230str+=arr2[i];231}232str=parseInt(str,2);233return str;234}235236function UncompressBin(num)//uncompress a number like 54 to a sequence like [0,1,1,0,1,0].237{238var arr=num.toString(2);239arr=arr.split('');240arr.reverse();241arr.shift();242arr.pop();243return arr;244}245246function CompressLargeBin(arr)//we have to compress in smaller chunks to avoid getting into scientific notation247{248var arr2=arr.slice(0);249var thisBit=[];250var bits=[];251for (var i in arr2)252{253thisBit.push(arr2[i]);254if (thisBit.length>=50)255{256bits.push(CompressBin(thisBit));257thisBit=[];258}259}260if (thisBit.length>0) bits.push(CompressBin(thisBit));261arr2=bits.join(';');262return arr2;263}264265function UncompressLargeBin(arr)266{267var arr2=arr.split(';');268var bits=[];269for (var i in arr2)270{271bits.push(UncompressBin(parseInt(arr2[i])));272}273arr2=[];274for (var i in bits)275{276for (var ii in bits[i]) arr2.push(bits[i][ii]);277}278return arr2;279}280281282function pack(bytes) {283var chars = [];284var len=bytes.length;285for(var i = 0, n = len; i < n;) {286chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));287}288return String.fromCharCode.apply(null, chars);289}290291function unpack(str) {292var bytes = [];293var len=str.length;294for(var i = 0, n = len; i < n; i++) {295var char = str.charCodeAt(i);296bytes.push(char >>> 8, char & 0xFF);297}298return bytes;299}300301//modified from http://www.smashingmagazine.com/2011/10/19/optimizing-long-lists-of-yesno-values-with-javascript/302function pack2(/* string */ values) {303var chunks = values.match(/.{1,14}/g), packed = '';304for (var i=0; i < chunks.length; i++) {305packed += String.fromCharCode(parseInt('1'+chunks[i], 2));306}307return packed;308}309310function unpack2(/* string */ packed) {311var values = '';312for (var i=0; i < packed.length; i++) {313values += packed.charCodeAt(i).toString(2).substring(1);314}315return values;316}317318function pack3(values){319//too many save corruptions, darn it to heck320return values;321}322323324//file save function from https://github.com/eligrey/FileSaver.js325var saveAs=saveAs||function(view){"use strict";if(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var doc=view.document,get_URL=function(){return view.URL||view.webkitURL||view},save_link=doc.createElementNS("http://www.w3.org/1999/xhtml","a"),can_use_save_link="download"in save_link,click=function(node){var event=new MouseEvent("click");node.dispatchEvent(event)},is_safari=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),webkit_req_fs=view.webkitRequestFileSystem,req_fs=view.requestFileSystem||webkit_req_fs||view.mozRequestFileSystem,throw_outside=function(ex){(view.setImmediate||view.setTimeout)(function(){throw ex},0)},force_saveable_type="application/octet-stream",fs_min_size=0,arbitrary_revoke_timeout=500,revoke=function(file){var revoker=function(){if(typeof file==="string"){get_URL().revokeObjectURL(file)}else{file.remove()}};if(view.chrome){revoker()}else{setTimeout(revoker,arbitrary_revoke_timeout)}},dispatch=function(filesaver,event_types,event){event_types=[].concat(event_types);var i=event_types.length;while(i--){var listener=filesaver["on"+event_types[i]];if(typeof listener==="function"){try{listener.call(filesaver,event||filesaver)}catch(ex){throw_outside(ex)}}}},auto_bom=function(blob){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)){return new Blob(["\ufeff",blob],{type:blob.type})}return blob},FileSaver=function(blob,name,no_auto_bom){if(!no_auto_bom){blob=auto_bom(blob)}var filesaver=this,type=blob.type,blob_changed=false,object_url,target_view,dispatch_all=function(){dispatch(filesaver,"writestart progress write writeend".split(" "))},fs_error=function(){if(target_view&&is_safari&&typeof FileReader!=="undefined"){var reader=new FileReader;reader.onloadend=function(){var base64Data=reader.result;target_view.location.href="data:attachment/file"+base64Data.slice(base64Data.search(/[,;]/));filesaver.readyState=filesaver.DONE;dispatch_all()};reader.readAsDataURL(blob);filesaver.readyState=filesaver.INIT;return}if(blob_changed||!object_url){object_url=get_URL().createObjectURL(blob)}if(target_view){target_view.location.href=object_url}else{var new_tab=view.open(object_url,"_blank");if(new_tab==undefined&&is_safari){view.location.href=object_url}}filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url)},abortable=function(func){return function(){if(filesaver.readyState!==filesaver.DONE){return func.apply(this,arguments)}}},create_if_not_found={create:true,exclusive:false},slice;filesaver.readyState=filesaver.INIT;if(!name){name="download"}if(can_use_save_link){object_url=get_URL().createObjectURL(blob);setTimeout(function(){save_link.href=object_url;save_link.download=name;click(save_link);dispatch_all();revoke(object_url);filesaver.readyState=filesaver.DONE});return}if(view.chrome&&type&&type!==force_saveable_type){slice=blob.slice||blob.webkitSlice;blob=slice.call(blob,0,blob.size,force_saveable_type);blob_changed=true}if(webkit_req_fs&&name!=="download"){name+=".download"}if(type===force_saveable_type||webkit_req_fs){target_view=view}if(!req_fs){fs_error();return}fs_min_size+=blob.size;req_fs(view.TEMPORARY,fs_min_size,abortable(function(fs){fs.root.getDirectory("saved",create_if_not_found,abortable(function(dir){var save=function(){dir.getFile(name,create_if_not_found,abortable(function(file){file.createWriter(abortable(function(writer){writer.onwriteend=function(event){target_view.location.href=file.toURL();filesaver.readyState=filesaver.DONE;dispatch(filesaver,"writeend",event);revoke(file)};writer.onerror=function(){var error=writer.error;if(error.code!==error.ABORT_ERR){fs_error()}};"writestart progress write abort".split(" ").forEach(function(event){writer["on"+event]=filesaver["on"+event]});writer.write(blob);filesaver.abort=function(){writer.abort();filesaver.readyState=filesaver.DONE};filesaver.readyState=filesaver.WRITING}),fs_error)}),fs_error)};dir.getFile(name,{create:false},abortable(function(file){file.remove();save()}),abortable(function(ex){if(ex.code===ex.NOT_FOUND_ERR){save()}else{fs_error()}}))}),fs_error)}),fs_error)},FS_proto=FileSaver.prototype,saveAs=function(blob,name,no_auto_bom){return new FileSaver(blob,name,no_auto_bom)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(blob,name,no_auto_bom){if(!no_auto_bom){blob=auto_bom(blob)}return navigator.msSaveOrOpenBlob(blob,name||"download")}}FS_proto.abort=function(){var filesaver=this;filesaver.readyState=filesaver.DONE;dispatch(filesaver,"abort")};FS_proto.readyState=FS_proto.INIT=0;FS_proto.WRITING=1;FS_proto.DONE=2;FS_proto.error=FS_proto.onwritestart=FS_proto.onprogress=FS_proto.onwrite=FS_proto.onabort=FS_proto.onerror=FS_proto.onwriteend=null;return saveAs}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!=null){define([],function(){return saveAs})}326327328//seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html329(function(a,b,c,d,e,f){function k(a){var b,c=a.length,e=this,f=0,g=e.i=e.j=0,h=e.S=[];for(c||(a=[c++]);d>f;)h[f]=f++;for(f=0;d>f;f++)h[f]=h[g=j&g+a[f%c]+(b=h[f])],h[g]=b;(e.g=function(a){for(var b,c=0,f=e.i,g=e.j,h=e.S;a--;)b=h[f=j&f+1],c=c*d+h[j&(h[f]=h[g=j&g+b])+(h[g]=b)];return e.i=f,e.j=g,c})(d)}function l(a,b){var e,c=[],d=(typeof a)[0];if(b&&"o"==d)for(e in a)try{c.push(l(a[e],b-1))}catch(f){}return c.length?c:"s"==d?a:a+"\0"}function m(a,b){for(var d,c=a+"",e=0;c.length>e;)b[j&e]=j&(d^=19*b[j&e])+c.charCodeAt(e++);return o(b)}function n(c){try{return a.crypto.getRandomValues(c=new Uint8Array(d)),o(c)}catch(e){return[+new Date,a,a.navigator.plugins,a.screen,o(b)]}}function o(a){return String.fromCharCode.apply(0,a)}var g=c.pow(d,e),h=c.pow(2,f),i=2*h,j=d-1;c.seedrandom=function(a,f){var j=[],p=m(l(f?[a,o(b)]:0 in arguments?a:n(),3),j),q=new k(j);return m(o(q.S),b),c.random=function(){for(var a=q.g(e),b=g,c=0;h>a;)a=(a+c)*d,b*=d,c=q.g(1);for(;a>=i;)a/=2,b/=2,c>>>=1;return(a+c)/b},p},m(c.random(),b)})(this,[],Math,256,6,52);330331function bind(scope,fn)332{333//use : bind(this,function(){this.x++;}) - returns a function where "this" refers to the scoped this334return function() {fn.apply(scope,arguments);};335}336337var grabProps=function(arr,prop)338{339if (!arr) return [];340arr2=[];341for (var i=0;i<arr.length;i++)342{343arr2.push(arr[i][prop]);344}345return arr2;346}347348CanvasRenderingContext2D.prototype.fillPattern=function(img,X,Y,W,H,iW,iH,offX,offY)349{350//for when built-in patterns aren't enough351if (img.alt!='blank')352{353var offX=offX||0;354var offY=offY||0;355if (offX<0) {offX=offX-Math.floor(offX/iW)*iW;} if (offX>0) {offX=(offX%iW)-iW;}356if (offY<0) {offY=offY-Math.floor(offY/iH)*iH;} if (offY>0) {offY=(offY%iH)-iH;}357for (var y=offY;y<H;y+=iH){for (var x=offX;x<W;x+=iW){this.drawImage(img,X+x,Y+y,iW,iH);}}358}359}360361var OldCanvasDrawImage=CanvasRenderingContext2D.prototype.drawImage;362CanvasRenderingContext2D.prototype.drawImage=function()363{364//only draw the image if it's loaded365if (arguments[0].alt!='blank') OldCanvasDrawImage.apply(this,arguments);366}367368369if (!document.hasFocus) document.hasFocus=function(){return document.hidden;};//for Opera370371function AddEvent(html_element, event_name, event_function)372{373if(html_element.attachEvent) html_element.attachEvent("on" + event_name, function() {event_function.call(html_element);});374else if(html_element.addEventListener) html_element.addEventListener(event_name, event_function, false);375}376377function FireEvent(el, etype)378{379if (el.fireEvent)380{el.fireEvent('on'+etype);}381else382{383var evObj=document.createEvent('Events');384evObj.initEvent(etype,true,false);385el.dispatchEvent(evObj);386}387}388389var Loader=function()//asset-loading system390{391this.loadingN=0;392this.assetsN=0;393this.assets=[];394this.assetsLoading=[];395this.assetsLoaded=[];396this.domain='';397this.loaded=0;//callback398this.doneLoading=0;399400this.blank=document.createElement('canvas');401this.blank.width=8;402this.blank.height=8;403this.blank.alt='blank';404405this.Load=function(assets)406{407for (var i in assets)408{409this.loadingN++;410this.assetsN++;411if (!this.assetsLoading[assets[i]] && !this.assetsLoaded[assets[i]])412{413var img=new Image();414img.src=this.domain+assets[i];415img.alt=assets[i];416img.onload=bind(this,this.onLoad);417this.assets[assets[i]]=img;418this.assetsLoading.push(assets[i]);419}420}421}422this.Replace=function(old,newer)423{424if (this.assets[old])425{426var img=new Image();427if (newer.indexOf('http')!=-1) img.src=newer;428else img.src=this.domain+newer;429img.alt=newer;430img.onload=bind(this,this.onLoad);431this.assets[old]=img;432}433}434this.onLoadReplace=function()435{436}437this.onLoad=function(e)438{439this.assetsLoaded.push(e.target.alt);440this.assetsLoading.splice(this.assetsLoading.indexOf(e.target.alt),1);441this.loadingN--;442if (this.doneLoading==0 && this.loadingN<=0 && this.loaded!=0)443{444this.doneLoading=1;445this.loaded();446}447}448this.getProgress=function()449{450return (1-this.loadingN/this.assetsN);451}452}453454var Pic=function(what)455{456if (Game.Loader.assetsLoaded.indexOf(what)!=-1) return Game.Loader.assets[what];457else if (Game.Loader.assetsLoading.indexOf(what)==-1) Game.Loader.Load([what]);458return Game.Loader.blank;459}460461var Sounds=[];462var OldPlaySound=function(url,vol)463{464var volume=1;465if (vol!==undefined) volume=vol;466if (!Game.volume || volume==0) return 0;467if (!Sounds[url]) {Sounds[url]=new Audio(url);Sounds[url].onloadeddata=function(e){e.target.volume=Math.pow(volume*Game.volume/100,2);}}468else if (Sounds[url].readyState>=2) {Sounds[url].currentTime=0;Sounds[url].volume=Math.pow(volume*Game.volume/100,2);}469Sounds[url].play();470}471var SoundInsts=[];472var SoundI=0;473for (var i=0;i<12;i++){SoundInsts[i]=new Audio();}474var pitchSupport=false;475//note : Chrome turns out to not support webkitPreservesPitch despite the specifications claiming otherwise, and Firefox clips some short sounds when changing playbackRate, so i'm turning the feature off completely until browsers get it together476//if (SoundInsts[0].preservesPitch || SoundInsts[0].mozPreservesPitch || SoundInsts[0].webkitPreservesPitch) pitchSupport=true;477478var PlaySound=function(url,vol,pitchVar)479{480//url : the url of the sound to play (will be cached so it only loads once)481//vol : volume between 0 and 1 (multiplied by game volume setting); defaults to 1 (full volume)482//(DISABLED) pitchVar : pitch variance in browsers that support it (Firefox only at the moment); defaults to 0.05 (which means pitch can be up to -5% or +5% anytime the sound plays)483var volume=1;484var pitchVar=(typeof pitchVar==='undefined')?0.05:pitchVar;485var rate=1+(Math.random()*2-1)*pitchVar;486if (typeof vol!=='undefined') volume=vol;487if (!Game.volume || volume==0) return 0;488if (!Sounds[url])489{490//sound isn't loaded, cache it491Sounds[url]=new Audio(url);492Sounds[url].onloadeddata=function(e){PlaySound(url,vol,pitchVar);}493}494else if (Sounds[url].readyState>=2)495{496var sound=SoundInsts[SoundI];497SoundI++;498if (SoundI>=12) SoundI=0;499sound.src=Sounds[url].src;500//sound.currentTime=0;501sound.volume=Math.pow(volume*Game.volume/100,2);502if (pitchSupport && rate!=0)503{504sound.preservesPitch=false;505sound.mozPreservesPitch=false;506sound.webkitPreservesPitch=false;507sound.playbackRate=rate;508}509sound.play();510}511}512513if (!Date.now){Date.now=function now() {return new Date().getTime();};}514515triggerAnim=function(element,anim)516{517if (!element) return;518element.classList.remove(anim);519void element.offsetWidth;520element.classList.add(anim);521};522523var debugStr='';524var Debug=function(what)525{526if (!debugStr) debugStr=what;527else debugStr+='; '+what;528}529530var Timer={};531Timer.t=Date.now();532Timer.labels=[];533Timer.smoothed=[];534Timer.reset=function()535{536Timer.labels=[];537Timer.t=Date.now();538}539Timer.track=function(label)540{541if (!Game.sesame) return;542var now=Date.now();543if (!Timer.smoothed[label]) Timer.smoothed[label]=0;544Timer.smoothed[label]+=((now-Timer.t)-Timer.smoothed[label])*0.1;545Timer.labels[label]='<div style="padding-left:8px;">'+label+' : '+Math.round(Timer.smoothed[label])+'ms</div>';546Timer.t=now;547}548Timer.clean=function()549{550if (!Game.sesame) return;551var now=Date.now();552Timer.t=now;553}554Timer.say=function(label)555{556if (!Game.sesame) return;557Timer.labels[label]='<div style="border-top:1px solid #ccc;">'+label+'</div>';558}559560561/*=====================================================================================562GAME INITIALIZATION563=======================================================================================*/564var Game={};565566Game.Launch=function()567{568Game.version=VERSION;569Game.beta=BETA;570if (window.location.href.indexOf('/beta')>-1) Game.beta=1;571Game.https=(location.protocol!='https:')?false:true;572Game.mobile=0;573Game.touchEvents=0;574//if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) Game.mobile=1;575//if (Game.mobile) Game.touchEvents=1;576//if ('ontouchstart' in document.documentElement) Game.touchEvents=1;577578var css=document.createElement('style');579css.type='text/css';580css.innerHTML='body .icon,body .crate,body .usesIcon{background-image:url(img/icons.png?v='+Game.version+');}';581document.head.appendChild(css);582583Game.baseSeason='';//halloween, christmas, valentines, fools, easter584//automatic season detection (might not be 100% accurate)585var day=Math.floor((new Date()-new Date(new Date().getFullYear(),0,0))/(1000*60*60*24));586if (day>=41 && day<=46) Game.baseSeason='valentines';587else if (day>=90 && day<=92) Game.baseSeason='fools';588else if (day>=304-7 && day<=304) Game.baseSeason='halloween';589else if (day>=349 && day<=365) Game.baseSeason='christmas';590else591{592//easter is a pain goddamn593var easterDay=function(Y){var C = Math.floor(Y/100);var N = Y - 19*Math.floor(Y/19);var K = Math.floor((C - 17)/25);var I = C - Math.floor(C/4) - Math.floor((C - K)/3) + 19*N + 15;I = I - 30*Math.floor((I/30));I = I - Math.floor(I/28)*(1 - Math.floor(I/28)*Math.floor(29/(I + 1))*Math.floor((21 - N)/11));var J = Y + Math.floor(Y/4) + I + 2 - C + Math.floor(C/4);J = J - 7*Math.floor(J/7);var L = I - J;var M = 3 + Math.floor((L + 40)/44);var D = L + 28 - 31*Math.floor(M/4);return new Date(Y,M-1,D);}(new Date().getFullYear());594easterDay=Math.floor((easterDay-new Date(easterDay.getFullYear(),0,0))/(1000*60*60*24));595if (day>=easterDay-7 && day<=easterDay) Game.baseSeason='easter';596}597598Game.updateLog=599'<div class="selectable">'+600'<div class="section">Info</div>'+601'<div class="subsection">'+602'<div class="title">About</div>'+603'<div class="listing">Cookie Clicker is a javascript game by <a href="http://orteil.dashnet.org" target="_blank">Orteil</a> and <a href="http://dashnet.org" target="_blank">Opti</a>.</div>'+604//'<div class="listing">We have an <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord</a>, as well as a <a href="http://forum.dashnet.org" target="_blank">forum</a>; '+605'<div class="listing">We have an <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord</a>; '+606'if you\'re looking for help, you may also want to visit the <a href="http://www.reddit.com/r/CookieClicker" target="_blank">subreddit</a> '+607'or the <a href="http://cookieclicker.wikia.com/wiki/Cookie_Clicker_Wiki" target="_blank">wiki</a>.</div>'+608'<div class="listing">News and teasers are usually posted on my <a href="http://orteil42.tumblr.com/" target="_blank">tumblr</a> and <a href="http://twitter.com/orteil42" target="_blank">twitter</a>.</div>'+609'<div class="listing" id="supportSection"><b style="color:#fff;opacity:1;">Cookie Clicker is 100% free, forever.</b> Want to support us so we can keep developing games? Here\'s some ways you can help :<div style="margin:4px 12px;line-height:150%;">'+610'<br>• support us on <a href="https://www.patreon.com/dashnet" target="_blank" class="highlightHover" style="background:#f86754;box-shadow:0px 0px 0px 1px #c52921 inset,0px 2px 0px #ff966d inset;text-shadow:0px -1px 0px #ff966d,0px 1px 0px #c52921;text-decoration:none;color:#fff;font-weight:bold;padding:1px 4px;">Patreon</a> <span style="opacity:0.5;">(there\'s perks!)</span>'+611'<br>• <form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post" id="donate"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="BBN2WL3TC6QH4"><input type="submit" id="donateButton" value="donate" name="submit" alt="PayPal — The safer, easier way to pay online."><img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1"></form> to our PayPal'+612'<br>• disable your adblocker<br>• check out our <a href="http://www.redbubble.com/people/dashnet" target="_blank">rad cookie shirts, hoodies and stickers</a>!<br>• (if you want!)</div></div>'+613'<div class="listing warning">Note : if you find a new bug after an update and you\'re using a 3rd-party add-on, make sure it\'s not just your add-on causing it!</div>'+614'<div class="listing warning">Warning : clearing your browser cache or cookies <small>(what else?)</small> will result in your save being wiped. Export your save and back it up first!</div>'+615616'</div><div class="subsection">'+617'<div class="title">Version history</div>'+618619'</div><div class="subsection update">'+620'<div class="title">28/09/2019 - going off-script</div>'+621'<div class="listing">• added a new building</div>'+622'<div class="listing">• added fortune cookies (a new heavenly upgrade)</div>'+623'<div class="listing">• more upgrades, achievements etc</div>'+624'<div class="listing">• updated the Russian bread cookies icon to better reflect their cyrillic origins</div>'+625'<div class="listing">• <i style="font-style:italic;">stealth update :</i> the sugar lump refill timeout (not sugar lump growth) now no longer ticks down while the game is closed (this fixes an exploit)</div>'+626'<div class="listing">• also released the official Android version of Cookie Clicker, playable <a href="https://play.google.com/store/apps/details?id=org.dashnet.cookieclicker" target="_blank">here</a> (iOS version will come later)</div>'+627628'</div><div class="subsection update small">'+629'<div class="title">01/04/2019 - 2.019 (the "this year" update)</div>'+630'<div class="listing">• game has been renamed to "Cookie Clicker" to avoid confusion</div>'+631'<div class="listing">• can now click the big cookie to generate cookies for free</div>'+632'<div class="listing">• removed fall damage</div>'+633//'<div class="listing">• fixed various typos : player\'s name is now correctly spelled as "[bakeryName]"</div>'+634'<div class="listing">• removed all references to computer-animated movie <i style="font-style:italic;">Hoodwinked!</i> (2005)</div>'+635'<div class="listing">• went back in time and invented cookies and computer mice, ensuring Cookie Clicker would one day come to exist</div>'+636'<div class="listing">• game now fully compliant with Geneva Conventions</div>'+637'<div class="listing">• dropped support for TI-84 version</div>'+638'<div class="listing">• released a low-res retro version of the game, playable here : <a href="http://orteil.dashnet.org/experiments/cookie/" target="_blank">orteil.dashnet.org/experiments/cookie</a></div>'+639'<div class="listing">• updated version number</div>'+640641'</div><div class="subsection update small">'+642'<div class="title">05/03/2019 - cookies for days</div>'+643'<div class="listing">• added over 20 new cookies, all previously suggested by our supporters on <a href="https://www.patreon.com/dashnet" target="_blank">Patreon</a></div>'+644'<div class="listing">• added 2 heavenly upgrades</div>'+645'<div class="listing">• the Golden goose egg now counts as a golden cookie upgrade for Residual luck purposes</div>'+646'<div class="listing">• golden sugar lumps now either double your cookies, or give you 24 hours of your CpS, whichever is lowest (previously was doubling cookies with no cap)</div>'+647'<div class="listing">• the amount of heralds is now saved with your game, and is used to compute offline CpS the next time the game is loaded; previously, on page load, the offline calculation assumed heralds to be 0</div>'+648'<div class="listing">• added a system to counteract the game freezing up (and not baking cookies) after being inactive for a long while on slower computers; instead, this will now trigger sleep mode, during which you still produce cookies as if the game was closed; to enable this feature, use the "Sleep mode timeout" option in the settings</div>'+649'<div class="listing">• vaulting upgrades is now done with shift-click, as ctrl-click was posing issues for Mac browsers</div>'+650'<div class="listing">• made tooltips for building CpS boosts from synergies hopefully clearer</div>'+651'<div class="listing">• fixed an exploit with gambler\'s fever dream working across exports and ascensions</div>'+652'<div class="listing">• can now hide tooltips in the garden by keeping the shift key pressed to make it easier to see where you\'re planting</div>'+653'<div class="listing">• fixed a bug with golden cookies/reindeer not disappearing properly in some circumstances</div>'+654'<div class="listing">• the Dragon\'s Curve aura should now properly make sugar lumps twice as weird</div>'+655'<div class="listing">• the ctrl key should less often register incorrectly as pressed</div>'+656'<div class="listing">• added a new ad slot in the top-right, as while our playerbase is strong and supportive as ever, our ad revenue sometimes fluctuates badly; we may remove the ad again should our income stabilize</div>'+657'<div class="listing">• made a few adjustments to make the game somewhat playable in mobile browsers; it\'s not perfect and can get buggy, but it\'s functional! (you may need to zoom out or scroll around to view the game properly)</div>'+658'<div class="listing">• speaking of which, we also got some good progress on the mobile app version (built from scratch for mobile), so stay tuned!</div>'+659660'</div><div class="subsection update">'+661'<div class="title">25/10/2018 - feedback loop</div>'+662'<div class="listing">• added a new building</div>'+663'<div class="listing">• launched our <a href="https://www.patreon.com/dashnet" class="orangeLink" target="_blank">Patreon</a> <span style="font-size:80%;">(the link is orange so you\'ll notice it!)</span></div>'+664'<div class="listing">• added a bunch of new heavenly upgrades, one of which ties into our Patreon but benefits everyone (this is still experimental!)</div>'+665'<div class="listing">• when hovering over grandmas, you can now see their names and ages</div>'+666'<div class="listing">• "make X cookies just from Y" requirements are now higher</div>'+667'<div class="listing">• tweaked the prices of some heavenly upgrades to better fit the current cookie economy (it turns out billions of heavenly chips is now very achievable)</div>'+668'<div class="listing">• building tooltips now display what % of CpS they contribute through synergy upgrades</div>'+669'<div class="listing">• queenbeets now give up to 4% of bank, down from 6%</div>'+670'<div class="listing">• among other things, season switches now display how many seasonal upgrades you\'re missing, and permanent upgrade slots now display the name of the slotted upgrade</div>'+671'<div class="listing">• season switches have reworked prices</div>'+672'<div class="listing">• season switches can now be cancelled by clicking them again</div>'+673'<div class="listing">• can no longer accidentally click wrinklers through other elements</div>'+674'<div class="listing">• sugar frenzy now triples your CpS for an hour instead of doubling it</div>'+675'<div class="listing">• this text is now selectable</div>'+676'<div class="listing">• progress on dungeons minigame is still very much ongoing</div>'+677678'</div><div class="subsection update small">'+679'<div class="title">08/08/2018 - hey now</div>'+680'<div class="listing">• Cookie Clicker somehow turns 5, going against doctors\' most optimistic estimates</div>'+681'<div class="listing">• added a new tier of building achievements, all named after Smash Mouth\'s classic 1999 hit "All Star"</div>'+682'<div class="listing">• added a new tier of building upgrades, all named after nothing in particular</div>'+683'<div class="listing">• <b>to our players :</b> thank you so much for sticking with us all those years and allowing us to keep making the dumbest game known to mankind</div>'+684'<div class="listing">• resumed work on the dungeons minigame</div>'+685686'</div><div class="subsection update small">'+687'<div class="title">01/08/2018 - buy buy buy</div>'+688'<div class="listing">• added a heavenly upgrade that lets you buy all your upgrades instantly</div>'+689'<div class="listing">• added a heavenly upgrade that lets you see upgrade tiers (feature was previously removed due to being confusing)</div>'+690'<div class="listing">• added a new wrinkler-related heavenly upgrade</div>'+691'<div class="listing">• added a new upgrade tier</div>'+692'<div class="listing">• added a couple new cookies and achievements</div>'+693'<div class="listing">• new "extra buttons" setting; turning it on adds buttons that let you minimize buildings</div>'+694'<div class="listing">• new "lump confirmation" setting; turning it on will show a confirmation prompt when you spend sugar lumps</div>'+695'<div class="listing">• buildings now sell back for 25% of their current price (down from 50%); Earth Shatterer modified accordingly, now gives back 50% (down from 85%)</div>'+696'<div class="listing">• farm soils now unlock correctly based on current amount of farms</div>'+697'<div class="listing">• cheapcaps have a new exciting nerf</div>'+698'<div class="listing">• wrinklegill spawns a bunch more</div>'+699'<div class="listing">• can now ctrl-shift-click on "Harvest all" to only harvest mature, non-immortal plants</div>'+700'<div class="listing">• added a new rare type of sugar lump</div>'+701702'</div><div class="subsection update small">'+703'<div class="title">20/04/2018 - weeding out some bugs</div>'+704'<div class="listing">• golden clovers and wrinklegills should spawn a bit more often</div>'+705'<div class="listing">• cronerice matures a lot sooner</div>'+706'<div class="listing">• mature elderworts stay mature after reloading</div>'+707'<div class="listing">• garden interface occupies space more intelligently</div>'+708'<div class="listing">• seed price displays should be better behaved with short numbers disabled</div>'+709'<div class="listing">• minigame animations are now turned off if using the "Fancy graphics" option is disabled</div>'+710'<div class="listing">• CpS achievement requirements were dialed down a wee tad</div>'+711712'</div><div class="subsection update small">'+713'<div class="title">19/04/2018 - garden patch</div>'+714'<div class="listing">• upgrades dropped by garden plants now stay unlocked forever (but drop much more rarely)</div>'+715'<div class="listing">• garden sugar lump refill now also makes plants spread and mutate 3 times more during the bonus tick</div>'+716'<div class="listing">• a few new upgrades</div>'+717'<div class="listing">• a couple bug fixes and rephrasings</div>'+718719'</div><div class="subsection update">'+720'<div class="title">18/04/2018 - your garden-variety update</div>'+721'<div class="listing">• added the garden, a minigame unlocked by having at least level 1 farms</div>'+722'<div class="listing">• added a little arrow and a blinky label to signal the game has updated since you last played it (hi!)</div>'+723'<div class="listing">• new cookies, milk flavors and achievements</div>'+724'<div class="listing">• sugar lumps are now unlocked whenever you\'ve baked at least a billion cookies, instead of on your first ascension</div>'+725'<div class="listing">• sugar lump type now saves correctly</div>'+726'<div class="listing">• minigame sugar lump refills can now only be done every 15 minutes (timer shared across all minigames)</div>'+727'<div class="listing">• CpS achievements now have steeper requirements</div>'+728'<div class="listing">• golden cookies now last 5% shorter for every other golden cookie on the screen</div>'+729'<div class="listing">• the game now remembers which minigames are closed or open</div>'+730'<div class="listing">• added a popup that shows when a season starts (so people won\'t be so confused about "the game looking weird today")</div>'+731'<div class="listing">• permanent upgrade slots now show a tooltip for the selected upgrade</div>'+732'<div class="listing">• finally fixed the save corruption bug, hopefully</div>'+733734'</div><div class="subsection update small">'+735'<div class="title">24/02/2018 - sugar coating</div>'+736'<div class="listing">• added link to <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord server</a></div>'+737'<div class="listing">• felt weird about pushing an update without content so :</div>'+738'<div class="listing">• added a handful of new cookies</div>'+739'<div class="listing">• added 3 new heavenly upgrades</div>'+740'<div class="listing">• short numbers should now be displayed up to novemnonagintillions</div>'+741'<div class="listing">• cookie chains no longer spawn from the Force the Hand of Fate spell</div>'+742'<div class="listing">• bigger, better Cookie Clicker content coming later this year</div>'+743744'</div><div class="subsection update">'+745'<div class="title">08/08/2017 - 4 more years</div>'+746'<div class="listing">• new building : Chancemakers</div>'+747'<div class="listing">• new milk, new kittens, new dragon aura, new cookie, new upgrade tier</div>'+748'<div class="listing">• buffs no longer affect offline CpS</div>'+749'<div class="listing">• Godzamok\'s hunger was made less potent (this is a nerf, very sorry)</div>'+750'<div class="listing">• grimoire spell costs and maximum magic work differently</div>'+751'<div class="listing">• Spontaneous Edifice has been reworked</div>'+752'<div class="listing">• changed unlock levels and prices for some cursor upgrades</div>'+753'<div class="listing">• fixed buggy pantheon slots, hopefully</div>'+754'<div class="listing">• fixed "Legacy started a long while ago" showing as "a few seconds ago"</div>'+755'<div class="listing">• Cookie Clicker just turned 4. Thank you for sticking with us this long!</div>'+756757'</div><div class="subsection update">'+758'<div class="title">15/07/2017 - the spiritual update</div>'+759'<div class="listing">• implemented sugar lumps, which start coalescing if you\'ve ascended at least once and can be used as currency for special things</div>'+760'<div class="listing">• buildings can now level up by using sugar lumps in the main buildings display, permanently boosting their CpS</div>'+761'<div class="listing">• added two new features unlocked by levelling up their associated buildings, Temples and Wizard towers; more building-related minigames will be implemented in the future</div>'+762'<div class="listing">• active buffs are now saved</div>'+763'<div class="listing">• the background selector upgrade is now functional</div>'+764'<div class="listing">• the top menu no longer scrolls with the rest</div>'+765'<div class="listing">• timespans are written nicer</div>'+766'<div class="listing">• Dragonflights now tend to supercede Click frenzies, you will rarely have both at the same time</div>'+767'<div class="listing">• some old bugs were phased out and replaced by new ones</div>'+768769'</div><div class="subsection update small">'+770'<div class="title">24/07/2016 - golden cookies overhaul</div>'+771'<div class="listing">• golden cookies and reindeer now follow a new system involving explicitly defined buffs</div>'+772'<div class="listing">• a bunch of new golden cookie effects have been added</div>'+773'<div class="listing">• CpS gains from eggs are now multiplicative</div>'+774'<div class="listing">• shiny wrinklers are now saved</div>'+775'<div class="listing">• reindeer have been rebalanced ever so slightly</div>'+776'<div class="listing">• added a new cookie upgrade near the root of the heavenly upgrade tree; this is intended to boost early ascensions and speed up the game as a whole</div>'+777'<div class="listing">• due to EU legislation, implemented a warning message regarding browser cookies; do understand that the irony is not lost on us</div>'+778779'</div><div class="subsection update">'+780'<div class="title">08/02/2016 - legacy</div>'+781'<div class="listing"><b>Everything that was implemented during the almost 2-year-long beta has been added to the live game. To recap :</b></div>'+782'<div class="listing">• 3 new buildings : banks, temples, and wizard towers; these have been added in-between existing buildings and as such, may disrupt some building-related achievements</div>'+783'<div class="listing">• the ascension system has been redone from scratch, with a new heavenly upgrade tree</div>'+784'<div class="listing">• mysterious new features such as angel-powered offline progression, challenge runs, and a cookie dragon</div>'+785'<div class="listing">• sounds have been added (can be disabled in the options)</div>'+786'<div class="listing">• heaps of rebalancing and bug fixes</div>'+787'<div class="listing">• a couple more upgrades and achievements, probably</div>'+788'<div class="listing">• fresh new options to further customize your cookie-clicking experience</div>'+789'<div class="listing">• quality-of-life improvements : better bulk-buy, better switches etc</div>'+790'<div class="listing">• added some <a href="http://en.wikipedia.org/wiki/'+choose(['Krzysztof_Arciszewski','Eustachy_Sanguszko','Maurycy_Hauke','Karol_Turno','Tadeusz_Kutrzeba','Kazimierz_Fabrycy','Florian_Siwicki'])+'" target="_blank">general polish</a></div>'+/* i liked this dumb pun too much to let it go unnoticed */791'<div class="listing">• tons of other little things we can\'t even remember right now</div>'+792'<div class="listing">Miss the old version? Your old save was automatically exported <a href="http://orteil.dashnet.org/cookieclicker/v10466/" target="_blank">here</a>!</div>'+793794'</div><div class="subsection update small">'+795'<div class="title">05/02/2016 - legacy beta, more fixes</div>'+796'<div class="listing">• added challenge modes, which can be selected when ascending (only 1 for now : "Born again")</div>'+797'<div class="listing">• changed the way bulk-buying and bulk-selling works</div>'+798'<div class="listing">• more bugs ironed out</div>'+799800'</div><div class="subsection update">'+801'<div class="title">03/02/2016 - legacy beta, part III</div>'+802'<div class="listing warning">• Not all bugs have been fixed, but everything should be much less broken.</div>'+803'<div class="listing">• Additions'+804'<div style="opacity:0.8;margin-left:12px;">'+805'-a few more achievements<br>'+806'-new option for neat, but slow CSS effects (disabled by default)<br>'+807'-new option for a less grating cookie sound (enabled by default)<br>'+808'-new option to bring back the boxes around icons in the stats screen<br>'+809'-new buttons for saving and loading your game to a text file<br>'+810'</div>'+811'</div>'+812'<div class="listing">• Changes'+813'<div style="opacity:0.8;margin-left:12px;">'+814'-early game should be a bit faster and very late game was kindly asked to tone it down a tad<br>'+815'-dragonflight should be somewhat less ridiculously overpowered<br>'+816'-please let me know if the rebalancing was too heavy or not heavy enough<br>'+817'-santa and easter upgrades now depend on Santa level and amount of eggs owned, respectively, instead of costing several minutes worth of CpS<br>'+818'-cookie upgrades now stack multiplicatively rather than additively<br>'+819'-golden switch now gives +50% CpS, and residual luck is +10% CpS per golden cookie upgrade (up from +25% and +1%, respectively)<br>'+820'-lucky cookies and cookie chain payouts have been modified a bit, possibly for the better, who knows!<br>'+821'-wrinklers had previously been reduced to a maximum of 8 (10 with a heavenly upgrade), but are now back to 10 (12 with the upgrade)<br>'+822/*'-all animations are now handled by requestAnimationFrame(), which should hopefully help make the game less resource-intensive<br>'+*/823'-an ascension now only counts for achievement purposes if you earned at least 1 prestige level from it<br>'+824'-the emblematic Cookie Clicker font (Kavoon) was bugged in Firefox, and has been replaced with a new font (Merriweather)<br>'+825'-the mysterious wrinkly creature is now even rarer, but has a shadow achievement tied to it<br>'+826'</div>'+827'</div>'+828'<div class="listing">• Fixes'+829'<div style="opacity:0.8;margin-left:12px;">'+830'-prestige now grants +1% CpS per level as intended, instead of +100%<br>'+831'-heavenly chips should no longer add up like crazy when you ascend<br>'+832'-upgrades in the store should no longer randomly go unsorted<br>'+833'-window can be resized to any size again<br>'+834'-the "Stats" and "Options" buttons have been swapped again<br>'+835'-the golden cookie sound should be somewhat clearer<br>'+836'-the ascend screen should be less CPU-hungry<br>'+837'</div>'+838'</div>'+839840'</div><div class="subsection update">'+841'<div class="title">20/12/2015 - legacy beta, part II</div>'+842'<div class="listing warning">• existing beta saves have been wiped due to format inconsistencies and just plain broken balance; you\'ll have to start over from scratch - which will allow you to fully experience the update and find all the awful little bugs that no doubt plague it</div>'+843'<div class="listing warning">• importing your save from the live version is also fine</div>'+844'<div class="listing">• we took so long to make this update, Cookie Clicker turned 2 years old in the meantime! Hurray!</div>'+845'<div class="listing">• heaps of new upgrades and achievements</div>'+846'<div class="listing">• fixed a whole bunch of bugs</div>'+847'<div class="listing">• did a lot of rebalancing</div>'+848'<div class="listing">• reworked heavenly chips and heavenly cookies (still experimenting, will probably rebalance things further)</div>'+849'<div class="listing">• you may now unlock a dragon friend</div>'+850'<div class="listing">• switches and season triggers now have their own store section</div>'+851'<div class="listing">• ctrl-s and ctrl-o now save the game and open the import menu, respectively</div>'+852'<div class="listing">• added some quick sounds, just as a test</div>'+853'<div class="listing">• a couple more options</div>'+854'<div class="listing">• even more miscellaneous changes and additions</div>'+855856'</div><div class="subsection update">'+857'<div class="title">25/08/2014 - legacy beta, part I</div>'+858'<div class="listing">• 3 new buildings</div>'+859'<div class="listing">• price and CpS curves revamped</div>'+860'<div class="listing">• CpS calculations revamped; cookie upgrades now stack multiplicatively</div>'+861'<div class="listing">• prestige system redone from scratch, with a whole new upgrade tree</div>'+862'<div class="listing">• added some <a href="http://en.wikipedia.org/wiki/'+choose(['Krzysztof_Arciszewski','Eustachy_Sanguszko','Maurycy_Hauke','Karol_Turno','Tadeusz_Kutrzeba','Kazimierz_Fabrycy','Florian_Siwicki'])+'" target="_blank">general polish</a></div>'+863'<div class="listing">• tons of other miscellaneous fixes and additions</div>'+864'<div class="listing">• Cookie Clicker is now 1 year old! (Thank you guys for all the support!)</div>'+865'<div class="listing warning">• Note : this is a beta; you are likely to encounter bugs and oversights. Feel free to send me feedback if you find something fishy!</div>'+866867'</div><div class="subsection update small">'+868'<div class="title">18/05/2014 - better late than easter</div>'+869'<div class="listing">• bunnies and eggs, somehow</div>'+870'<div class="listing">• prompts now have keyboard shortcuts like system prompts would</div>'+871'<div class="listing">• naming your bakery? you betcha</div>'+872'<div class="listing">• "Fast notes" option to make all notifications close faster; new button to close all notifications</div>'+873'<div class="listing">• the dungeons beta is now available on <a href="http://orteil.dashnet.org/cookieclicker/betadungeons" target="_blank">/betadungeons</a></div>'+874875'</div><div class="subsection update small">'+876'<div class="title">09/04/2014 - nightmare in heaven</div>'+877'<div class="listing">• broke a thing; heavenly chips were corrupted for some people</div>'+878'<div class="listing">• will probably update to /beta first in the future</div>'+879'<div class="listing">• sorry again</div>'+880881'</div><div class="subsection update small">'+882'<div class="title">09/04/2014 - quality of life</div>'+883'<div class="listing">• new upgrade and achievement tier</div>'+884'<div class="listing">• popups and prompts are much nicer</div>'+885'<div class="listing">• tooltips on buildings are more informative</div>'+886'<div class="listing">• implemented a simplified version of the <a href="https://github.com/Icehawk78/FrozenCookies" target="_blank">Frozen Cookies</a> add-on\'s short number formatting</div>'+887'<div class="listing">• you can now buy 10 and sell all of a building at a time</div>'+888'<div class="listing">• tons of optimizations and subtler changes</div>'+889'<div class="listing">• you can now <a href="http://orteil.dashnet.org/cookies2cash/" target="_blank">convert your cookies to cash</a>!</div>'+890891'</div><div class="subsection update small">'+892'<div class="title">05/04/2014 - pity the fool</div>'+893'<div class="listing">• wrinklers should now be saved so you don\'t have to pop them everytime you refresh the game</div>'+894'<div class="listing">• you now properly win 1 cookie upon reaching 10 billion cookies and making it on the local news</div>'+895'<div class="listing">• miscellaneous fixes and tiny additions</div>'+896'<div class="listing">• added a few very rudimentary mod hooks</div>'+897'<div class="listing">• the game should work again in Opera</div>'+898'<div class="listing">• don\'t forget to check out <a href="http://orteil.dashnet.org/randomgen/" target="_blank">RandomGen</a>, our all-purpose random generator maker!</div>'+899900'</div><div class="subsection update small">'+901'<div class="title">01/04/2014 - fooling around</div>'+902'<div class="listing">• it\'s about time : Cookie Clicker has turned into the much more realistic Cookie Baker</div>'+903'<div class="listing">• season triggers are cheaper and properly unlock again when they run out</div>'+904'<div class="listing">• buildings should properly unlock (reminder : building unlocking is completely cosmetic and does not change the gameplay)</div>'+905906'</div><div class="subsection update small">'+907'<div class="title">14/02/2014 - lovely rainbowcalypse</div>'+908'<div class="listing">• new building (it\'s been a while). More to come!</div>'+909'<div class="listing">• you can now trigger seasonal events to your heart\'s content (upgrade unlocks at 5000 heavenly chips)</div>'+910'<div class="listing">• new ultra-expensive batch of seasonal cookie upgrades you\'ll love to hate</div>'+911'<div class="listing">• new timer bars for golden cookie buffs</div>'+912'<div class="listing">• buildings are now hidden when you start out and appear as they become available</div>'+913'<div class="listing">• technical stuff : the game is now saved through localstorage instead of browser cookies, therefore ruining a perfectly good pun</div>'+914915'</div><div class="subsection update small">'+916'<div class="title">22/12/2013 - merry fixmas</div>'+917'<div class="listing">• some issues with the christmas upgrades have been fixed</div>'+918'<div class="listing">• reindeer cookie drops are now more common</div>'+919'<div class="listing">• reindeers are now reindeer</div>'+920921'</div><div class="subsection update">'+922'<div class="title">20/12/2013 - Christmas is here</div>'+923'<div class="listing">• there is now a festive new evolving upgrade in store</div>'+924'<div class="listing">• reindeer are running amok (catch them if you can!)</div>'+925'<div class="listing">• added a new option to warn you when you close the window, so you don\'t lose your un-popped wrinklers</div>'+926'<div class="listing">• also added a separate option for displaying cursors</div>'+927'<div class="listing">• all the Halloween features are still there (and having the Spooky cookies achievements makes the Halloween cookies drop much more often)</div>'+928'<div class="listing">• oh yeah, we now have <a href="http://www.redbubble.com/people/dashnet" target="_blank">Cookie Clicker shirts, stickers and hoodies</a>! (they\'re really rad)</div>'+929930'</div><div class="subsection update small">'+931'<div class="title">29/10/2013 - spooky update</div>'+932'<div class="listing">• the Grandmapocalypse now spawns wrinklers, hideous elderly creatures that damage your CpS when they reach your big cookie. Thankfully, you can click on them to make them explode (you\'ll even gain back the cookies they\'ve swallowed - with interest!).</div>'+933'<div class="listing">• wrath cookie now 27% spookier</div>'+934'<div class="listing">• some other stuff</div>'+935'<div class="listing">• you should totally go check out <a href="http://candybox2.net/" target="_blank">Candy Box 2</a>, the sequel to the game that inspired Cookie Clicker</div>'+936937'</div><div class="subsection update small">'+938'<div class="title">15/10/2013 - it\'s a secret</div>'+939'<div class="listing">• added a new heavenly upgrade that gives you 5% of your heavenly chips power for 11 cookies (if you purchased the Heavenly key, you might need to buy it again, sorry)</div>'+940'<div class="listing">• golden cookie chains should now work properly</div>'+941942'</div><div class="subsection update small">'+943'<div class="title">15/10/2013 - player-friendly</div>'+944'<div class="listing">• heavenly upgrades are now way, way cheaper</div>'+945'<div class="listing">• tier 5 building upgrades are 5 times cheaper</div>'+946'<div class="listing">• cursors now just plain disappear with Fancy Graphics off, I might add a proper option to toggle only the cursors later</div>'+947'<div class="listing">• warning : the Cookie Monster add-on seems to be buggy with this update, you might want to wait until its programmer updates it</div>'+948949'</div><div class="subsection update small">'+950'<div class="title">15/10/2013 - a couple fixes</div>'+951'<div class="listing">• golden cookies should no longer spawn embarrassingly often</div>'+952'<div class="listing">• cursors now stop moving if Fancy Graphics is turned off</div>'+953954'</div><div class="subsection update small">'+955'<div class="title">14/10/2013 - going for the gold</div>'+956'<div class="listing">• golden cookie chains work a bit differently</div>'+957'<div class="listing">• golden cookie spawns are more random</div>'+958'<div class="listing">• CpS achievements are no longer affected by golden cookie frenzies</div>'+959'<div class="listing">• revised cookie-baking achievement requirements</div>'+960'<div class="listing">• heavenly chips now require upgrades to function at full capacity</div>'+961'<div class="listing">• added 4 more cookie upgrades, unlocked after reaching certain amounts of Heavenly Chips</div>'+962'<div class="listing">• speed baking achievements now require you to have no heavenly upgrades; as such, they have been reset for everyone (along with the Hardcore achievement) to better match their initially intended difficulty</div>'+963'<div class="listing">• made good progress on the mobile port</div>'+964965'</div><div class="subsection update small">'+966'<div class="title">01/10/2013 - smoothing it out</div>'+967'<div class="listing">• some visual effects have been completely rewritten and should now run more smoothly (and be less CPU-intensive)</div>'+968'<div class="listing">• new upgrade tier</div>'+969'<div class="listing">• new milk tier</div>'+970'<div class="listing">• cookie chains have different capping mechanics</div>'+971'<div class="listing">• antimatter condensers are back to their previous price</div>'+972'<div class="listing">• heavenly chips now give +2% CpS again (they will be extensively reworked in the future)</div>'+973'<div class="listing">• farms have been buffed a bit (to popular demand)</div>'+974'<div class="listing">• dungeons still need a bit more work and will be released soon - we want them to be just right! (you can test an unfinished version in <a href="http://orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">the beta</a>)</div>'+975976'</div><div class="subsection update">'+977'<div class="title">28/09/2013 - dungeon beta</div>'+978'<div class="listing">• from now on, big updates will come through a beta stage first (you can <a href="http://orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">try it here</a>)</div>'+979'<div class="listing">• first dungeons! (you need 50 factories to unlock them!)</div>'+980'<div class="listing">• cookie chains can be longer</div>'+981'<div class="listing">• antimatter condensers are a bit more expensive</div>'+982'<div class="listing">• heavenly chips now only give +1% cps each (to account for all the cookies made from condensers)</div>'+983'<div class="listing">• added flavor text on all upgrades</div>'+984985'</div><div class="subsection update small">'+986'<div class="title">15/09/2013 - anticookies</div>'+987'<div class="listing">• ran out of regular matter to make your cookies? Try our new antimatter condensers!</div>'+988'<div class="listing">• renamed Hard-reset to "Wipe save" to avoid confusion</div>'+989'<div class="listing">• reset achievements are now regular achievements and require cookies baked all time, not cookies in bank</div>'+990'<div class="listing">• heavenly chips have been nerfed a bit (and are now awarded following a geometric progression : 1 trillion for the first, 2 for the second, etc); the prestige system will be extensively reworked in a future update (after dungeons)</div>'+991'<div class="listing">• golden cookie clicks are no longer reset by soft-resets</div>'+992'<div class="listing">• you can now see how long you\'ve been playing in the stats</div>'+993994'</div><div class="subsection update small">'+995'<div class="title">08/09/2013 - everlasting cookies</div>'+996'<div class="listing">• added a prestige system - resetting gives you permanent CpS boosts (the more cookies made before resetting, the bigger the boost!)</div>'+997'<div class="listing">• save format has been slightly modified to take less space</div>'+998'<div class="listing">• Leprechaun has been bumped to 777 golden cookies clicked and is now shadow; Fortune is the new 77 golden cookies achievement</div>'+999'<div class="listing">• clicking frenzy is now x777</div>'+10001001'</div><div class="subsection update small">'+1002'<div class="title">04/09/2013 - smarter cookie</div>'+1003'<div class="listing">• golden cookies only have 20% chance of giving the same outcome twice in a row now</div>'+1004'<div class="listing">• added a golden cookie upgrade</div>'+1005'<div class="listing">• added an upgrade that makes pledges last twice as long (requires having pledged 10 times)</div>'+1006'<div class="listing">• Quintillion fingers is now twice as efficient</div>'+1007'<div class="listing">• Uncanny clicker was really too unpredictable; it is now a regular achievement and no longer requires a world record, just *pretty fast* clicking</div>'+10081009'</div><div class="subsection update small">'+1010'<div class="title">02/09/2013 - a better way out</div>'+1011'<div class="listing">• Elder Covenant is even cheaper, and revoking it is cheaper still (also added a new achievement for getting it)</div>'+1012'<div class="listing">• each grandma upgrade now requires 15 of the matching building</div>'+1013'<div class="listing">• the dreaded bottom cursor has been fixed with a new cursor display style</div>'+1014'<div class="listing">• added an option for faster, cheaper graphics</div>'+1015'<div class="listing">• base64 encoding has been redone; this might make saving possible again on some older browsers</div>'+1016'<div class="listing">• shadow achievements now have their own section</div>'+1017'<div class="listing">• raspberry juice is now named raspberry milk, despite raspberry juice being delicious and going unquestionably well with cookies</div>'+1018'<div class="listing">• HOTFIX : cursors now click; fancy graphics button renamed; cookies amount now more visible against cursors</div>'+10191020'</div><div class="subsection update small">'+1021'<div class="title">01/09/2013 - sorting things out</div>'+1022'<div class="listing">• upgrades and achievements are properly sorted in the stats screen</div>'+1023'<div class="listing">• made Elder Covenant much cheaper and less harmful</div>'+1024'<div class="listing">• importing from the first version has been disabled, as promised</div>'+1025'<div class="listing">• "One mind" now actually asks you to confirm the upgrade</div>'+10261027'</div><div class="subsection update small">'+1028'<div class="title">31/08/2013 - hotfixes</div>'+1029'<div class="listing">• added a way to permanently stop the grandmapocalypse</div>'+1030'<div class="listing">• Elder Pledge price is now capped</div>'+1031'<div class="listing">• One Mind and other grandma research upgrades are now a little more powerful, if not 100% accurate</div>'+1032'<div class="listing">• "golden" cookie now appears again during grandmapocalypse; Elder Pledge-related achievements are now unlockable</div>'+10331034'</div><div class="subsection update">'+1035'<div class="title">31/08/2013 - too many grandmas</div>'+1036'<div class="listing">• the grandmapocalypse is back, along with more grandma types</div>'+1037'<div class="listing">• added some upgrades that boost your clicking power and make it scale with your cps</div>'+1038'<div class="listing">• clicking achievements made harder; Neverclick is now a shadow achievement; Uncanny clicker should now truly be a world record</div>'+10391040'</div><div class="subsection update small">'+1041'<div class="title">28/08/2013 - over-achiever</div>'+1042'<div class="listing">• added a few more achievements</div>'+1043'<div class="listing">• reworked the "Bake X cookies" achievements so they take longer to achieve</div>'+10441045'</div><div class="subsection update small">'+1046'<div class="title">27/08/2013 - a bad idea</div>'+1047'<div class="listing">• due to popular demand, retired 5 achievements (the "reset your game" and "cheat" ones); they can still be unlocked, but do not count toward your total anymore. Don\'t worry, there will be many more achievements soon!</div>'+1048'<div class="listing">• made some achievements hidden for added mystery</div>'+10491050'</div><div class="subsection update">'+1051'<div class="title">27/08/2013 - a sense of achievement</div>'+1052'<div class="listing">• added achievements (and milk)</div>'+1053'<div class="listing"><i>(this is a big update, please don\'t get too mad if you lose some data!)</i></div>'+10541055'</div><div class="subsection update small">'+1056'<div class="title">26/08/2013 - new upgrade tier</div>'+1057'<div class="listing">• added some more upgrades (including a couple golden cookie-related ones)</div>'+1058'<div class="listing">• added clicking stats</div>'+10591060'</div><div class="subsection update small">'+1061'<div class="title">26/08/2013 - more tweaks</div>'+1062'<div class="listing">• tweaked a couple cursor upgrades</div>'+1063'<div class="listing">• made time machines less powerful</div>'+1064'<div class="listing">• added offline mode option</div>'+10651066'</div><div class="subsection update small">'+1067'<div class="title">25/08/2013 - tweaks</div>'+1068'<div class="listing">• rebalanced progression curve (mid- and end-game objects cost more and give more)</div>'+1069'<div class="listing">• added some more cookie upgrades</div>'+1070'<div class="listing">• added CpS for cursors</div>'+1071'<div class="listing">• added sell button</div>'+1072'<div class="listing">• made golden cookie more useful</div>'+10731074'</div><div class="subsection update small">'+1075'<div class="title">24/08/2013 - hotfixes</div>'+1076'<div class="listing">• added import/export feature, which also allows you to retrieve a save game from the old version (will be disabled in a week to prevent too much cheating)</div>'+1077'<div class="listing">• upgrade store now has unlimited slots (just hover over it), due to popular demand</div>'+1078'<div class="listing">• added update log</div>'+10791080'</div><div class="subsection update">'+1081'<div class="title">24/08/2013 - big update!</div>'+1082'<div class="listing">• revamped the whole game (new graphics, new game mechanics)</div>'+1083'<div class="listing">• added upgrades</div>'+1084'<div class="listing">• much safer saving</div>'+10851086'</div><div class="subsection update">'+1087'<div class="title">08/08/2013 - game launch</div>'+1088'<div class="listing">• made the game in a couple hours, for laughs</div>'+1089'<div class="listing">• kinda starting to regret it</div>'+1090'<div class="listing">• ah well</div>'+1091'</div>'+1092'</div>'1093;10941095Game.ready=0;10961097Game.Load=function()1098{1099//l('javascriptError').innerHTML='<div style="padding:64px 128px;"><div class="title">Loading...</div></div>';1100Game.Loader=new Loader();1101Game.Loader.domain='img/';1102Game.Loader.loaded=Game.Init;1103Game.Loader.Load(['filler.png']);1104}1105Game.ErrorFrame=function()1106{1107Game.Loader=new Loader();1108Game.Loader.domain='img/';1109Game.Loader.loaded=Game.Init;1110Game.Loader.Load(['filler.png']);1111}1112Game.timedout=false;1113Game.Timeout=function()1114{1115Game.WriteSave();1116Game.killShimmers();1117l('javascriptError').innerHTML='Cookie Clicker is in sleep mode'+(Game.Has('Twin Gates of Transcendence')?' and generating offline cookies':'')+'.<br><a '+Game.clickStr+'="Game.Resume();">Click here</a> to resume from your save file.<br><div style="font-style:italic;font-size:65%;line-height:110%;opacity:0.75;">(this happens when too many frames are skipped at once,<br>usually when the game has been running in the background for a while)<br>(you can turn this feature off in the settings menu)</div>';1118l('javascriptError').style.display='block';1119Game.timedout=true;1120console.log('[=== Game timed out and has been put in sleep mode. Data was saved. ===]');1121}1122Game.Resume=function()1123{1124l('javascriptError').innerHTML='';1125l('javascriptError').style.display='none';1126Game.timedout=false;1127Game.time=Date.now();1128Game.accumulatedDelay=0;1129Game.delayTimeouts=0;1130Game.lastActivity=Date.now();1131Game.Loop();1132Game.LoadSave();1133console.log('[=== Game resumed! Data was loaded. ===]');1134}113511361137Game.Init=function()1138{1139Game.ready=1;11401141/*=====================================================================================1142VARIABLES AND PRESETS1143=======================================================================================*/1144Game.T=0;1145Game.drawT=0;1146Game.loopT=0;1147Game.fps=30;11481149Game.season=Game.baseSeason;11501151Game.l=l('game');1152Game.bounds=0;//rectangle defining screen limits (right,left,bottom,top) updated every logic frame11531154if (Game.mobile==1)1155{1156l('wrapper').className='mobile';1157}1158Game.clickStr=Game.touchEvents?'ontouchend':'onclick';11591160Game.SaveTo='CookieClickerGame';1161if (Game.beta) Game.SaveTo='CookieClickerGameBeta';1162l('versionNumber').innerHTML='v. '+Game.version+'<div id="httpsSwitch" style="cursor:pointer;display:inline-block;background:url(img/'+(Game.https?'lockOn':'lockOff')+'.png);width:16px;height:16px;position:relative;top:4px;left:0px;margin:0px -2px;"></div>'+(Game.beta?' <span style="color:#ff0;">beta</span>':'');11631164if (Game.beta) {var me=l('linkVersionBeta');me.parentNode.removeChild(me);}1165else if (Game.version==1.0466) {var me=l('linkVersionOld');me.parentNode.removeChild(me);}1166else {var me=l('linkVersionLive');me.parentNode.removeChild(me);}11671168//l('links').innerHTML=(Game.beta?'<a href="../" target="blank">Live version</a> | ':'<a href="beta" target="blank">Try the beta!</a> | ')+'<a href="http://orteil.dashnet.org/experiments/cookie/" target="blank">Classic</a>';1169//l('links').innerHTML='<a href="http://orteil.dashnet.org/experiments/cookie/" target="blank">Cookie Clicker Classic</a>';11701171Game.lastActivity=Date.now();//reset on mouse move, key press or click11721173//latency compensator stuff1174Game.time=Date.now();1175Game.accumulatedDelay=0;1176Game.delayTimeouts=0;//how many times we've gone over the timeout delay1177Game.catchupLogic=0;1178Game.fpsStartTime=0;1179Game.frameNumber=0;1180Game.currentFps=Game.fps;1181Game.previousFps=Game.currentFps;1182Game.getFps=function()1183{1184Game.frameNumber++;1185var currentTime=(Date.now()-Game.fpsStartTime )/1000;1186var result=Math.floor((Game.frameNumber/currentTime));1187if (currentTime>1)1188{1189Game.fpsStartTime=Date.now();1190Game.frameNumber=0;1191}1192return result;1193}11941195Game.cookiesEarned=0;//all cookies earned during gameplay1196Game.cookies=0;//cookies1197Game.cookiesd=0;//cookies display1198Game.cookiesPs=1;//cookies per second (to recalculate with every new purchase)1199Game.cookiesReset=0;//cookies lost to resetting (used to determine prestige and heavenly chips)1200Game.cookieClicks=0;//+1 for each click on the cookie1201Game.goldenClicks=0;//+1 for each golden cookie clicked (all time)1202Game.goldenClicksLocal=0;//+1 for each golden cookie clicked (this game only)1203Game.missedGoldenClicks=0;//+1 for each golden cookie missed1204Game.handmadeCookies=0;//all the cookies made from clicking the cookie1205Game.milkProgress=0;//you gain a little bit for each achievement. Each increment of 1 is a different milk displayed.1206Game.milkH=Game.milkProgress/2;//milk height, between 0 and 1 (although should never go above 0.5)1207Game.milkHd=0;//milk height display1208Game.milkType=0;//custom milk1209Game.bgType=0;//custom background1210Game.chimeType=0;//golden cookie chime1211Game.prestige=0;//prestige level (recalculated depending on Game.cookiesReset)1212Game.heavenlyChips=0;//heavenly chips the player currently has1213Game.heavenlyChipsDisplayed=0;//ticks up or down to match Game.heavenlyChips1214Game.heavenlyChipsSpent=0;//heavenly chips spent on cookies, upgrades and such1215Game.heavenlyCookies=0;//how many cookies have we baked from chips (unused)1216Game.permanentUpgrades=[-1,-1,-1,-1,-1];1217Game.ascensionMode=0;//type of challenge run if any1218Game.resets=0;//reset counter1219Game.lumps=-1;//sugar lumps1220Game.lumpsTotal=-1;//sugar lumps earned across all playthroughs (-1 means they haven't even started yet)1221Game.lumpT=Date.now();//time when the current lump started forming1222Game.lumpRefill=0;//time left before a sugar lump can be used again (on minigame refills etc) in logic frames12231224Game.makeSeed=function()1225{1226var chars='abcdefghijklmnopqrstuvwxyz'.split('');1227var str='';1228for (var i=0;i<5;i++){str+=choose(chars);}1229return str;1230}1231Game.seed=Game.makeSeed();//each run has its own seed, used for deterministic random stuff12321233Game.volume=50;//sound volume12341235Game.elderWrath=0;1236Game.elderWrathOld=0;1237Game.elderWrathD=0;1238Game.pledges=0;1239Game.pledgeT=0;1240Game.researchT=0;1241Game.nextResearch=0;1242Game.cookiesSucked=0;//cookies sucked by wrinklers1243Game.cpsSucked=0;//percent of CpS being sucked by wrinklers1244Game.wrinklersPopped=0;1245Game.santaLevel=0;1246Game.reindeerClicked=0;1247Game.seasonT=0;1248Game.seasonUses=0;1249Game.dragonLevel=0;1250Game.dragonAura=0;1251Game.dragonAura2=0;12521253Game.fortuneGC=0;1254Game.fortuneCPS=0;12551256Game.blendModesOn=(document.createElement('detect').style.mixBlendMode==='');12571258Game.bg='';//background (grandmas and such)1259Game.bgFade='';//fading to background1260Game.bgR=0;//ratio (0 - not faded, 1 - fully faded)1261Game.bgRd=0;//ratio displayed12621263Game.windowW=window.innerWidth;1264Game.windowH=window.innerHeight;12651266window.addEventListener('resize',function(event)1267{1268Game.windowW=window.innerWidth;1269Game.windowH=window.innerHeight;12701271for (var i in Game.Objects)1272{1273var me=Game.Objects[i];1274me.toResize=true;1275if (me.minigame && me.minigame.onResize) me.minigame.onResize();1276}1277});12781279Game.startDate=parseInt(Date.now());//when we started playing1280Game.fullDate=parseInt(Date.now());//when we started playing (carries over with resets)1281Game.lastDate=parseInt(Date.now());//when we last saved the game (used to compute "cookies made since we closed the game" etc)12821283Game.prefs=[];1284Game.DefaultPrefs=function()1285{1286Game.prefs.particles=1;//particle effects : falling cookies etc1287Game.prefs.numbers=1;//numbers that pop up when clicking the cookie1288Game.prefs.autosave=1;//save the game every minute or so1289Game.prefs.autoupdate=1;//send an AJAX request to the server every 30 minutes (note : ignored)1290Game.prefs.milk=1;//display milk1291Game.prefs.fancy=1;//CSS shadow effects (might be heavy on some browsers)1292Game.prefs.warn=0;//warn before closing the window1293Game.prefs.cursors=1;//display cursors1294Game.prefs.focus=1;//make the game refresh less frequently when off-focus1295Game.prefs.popups=0;//use old-style popups1296Game.prefs.format=0;//shorten numbers1297Game.prefs.notifs=0;//notifications fade faster1298Game.prefs.animate=1;//animate buildings1299Game.prefs.wobbly=1;//wobbly cookie1300Game.prefs.monospace=0;//alt monospace font for cookies1301Game.prefs.filters=0;//CSS filter effects (might be heavy on some browsers)1302Game.prefs.cookiesound=1;//use new cookie click sound1303Game.prefs.crates=0;//show crates around icons in stats1304Game.prefs.altDraw=0;//use requestAnimationFrame to update drawing instead of fixed 30 fps setTimeout1305Game.prefs.showBackupWarning=1;//if true, show a "Have you backed up your save?" message on save load; set to false when save is exported1306Game.prefs.extraButtons=1;//if true, show Mute buttons and the building master bar1307Game.prefs.askLumps=0;//if true, show a prompt before spending lumps1308Game.prefs.customGrandmas=1;//if true, show patreon names for grandmas1309Game.prefs.timeout=0;//if true, game may show pause screen when timed out1310}1311Game.DefaultPrefs();13121313window.onbeforeunload=function(event)1314{1315if (Game.prefs && Game.prefs.warn)1316{1317if (typeof event=='undefined') event=window.event;1318if (event) event.returnValue='Are you sure you want to close Cookie Clicker?';1319}1320}13211322Game.Mobile=function()1323{1324if (!Game.mobile)1325{1326l('wrapper').className='mobile';1327Game.mobile=1;1328}1329else1330{1331l('wrapper').className='';1332Game.mobile=0;1333}1334}13351336Game.showBackupWarning=function()1337{1338Game.Notify('Back up your save!','Hello again! Just a reminder that you may want to back up your Cookie Clicker save every once in a while, just in case.<br>To do so, go to Options and hit "Export save" or "Save to file"!<div class="line"></div><a style="float:right;" onclick="Game.prefs.showBackupWarning=0;==CLOSETHIS()==">Don\'t show this again</a>',[25,7]);1339}13401341/*=====================================================================================1342MOD HOOKS (will be subject to change, probably shouldn't be used yet)1343=======================================================================================*/1344//really primitive custom mods support - might not be of any use at all (could theoretically be used for custom upgrades and achievements I guess?)1345Game.customChecks=[];//push functions into this to add them to the "check for upgrade/achievement conditions" that happens every few seconds1346Game.customInit=[];//add to the initialization call1347Game.customLogic=[];//add to the logic calls1348Game.customDraw=[];//add to the draw calls1349Game.customSave=[];//add to the save write calls (save to your own localstorage key)1350Game.customLoad=[];//add to the save load calls1351Game.customReset=[];//add to the reset calls1352Game.customTickers=[];//add to the random tickers (functions should return arrays of text)1353Game.customCps=[];//add to the CpS computation (functions should return something to add to the multiplier ie. 0.1 for an addition of 10 to the CpS multiplier)1354Game.customCpsMult=[];//add to the CpS multiplicative computation (functions should return something to multiply by the multiplier ie. 1.05 for a 5% increase of the multiplier)1355Game.customMouseCps=[];//add to the cookies earned per click computation (functions should return something to add to the multiplier ie. 0.1 for an addition of 10 to the CpS multiplier)1356Game.customMouseCpsMult=[];//add to the cookies earned per click multiplicative computation (functions should return something to multiply by the multiplier ie. 1.05 for a 5% increase of the multiplier)1357Game.customCookieClicks=[];//add to the cookie click calls1358Game.customCreate=[];//create your new upgrades and achievements in there13591360Game.LoadMod=function(url)//this loads the mod at the given URL and gives the script an automatic id (URL "http://example.com/my_mod.js" gives the id "modscript_my_mod")1361{1362var js=document.createElement('script');1363var id=url.split('/');id=id[id.length-1].split('.')[0];1364js.setAttribute('type','text/javascript');1365js.setAttribute('id','modscript_'+id);1366js.setAttribute('src',url);1367document.head.appendChild(js);1368console.log('Loaded the mod '+url+', '+id+'.');1369}13701371//replacing an existing canvas picture with a new one at runtime : Game.Loader.Replace('perfectCookie.png','imperfectCookie.png');1372//upgrades and achievements can use other pictures than icons.png; declare their icon with [posX,posY,'http://example.com/myIcons.png']1373//check out the "UNLOCKING STUFF" section to see how unlocking achievs and upgrades is done (queue yours in Game.customChecks)1374//if you're making a mod, don't forget to add a Game.Win('Third-party') somewhere in there!13751376//IMPORTANT : all of the above is susceptible to heavy change, proper modding API in the works13771378137913801381/*=====================================================================================1382BAKERY NAME1383=======================================================================================*/1384Game.RandomBakeryName=function()1385{1386return (Math.random()>0.05?(choose(['Magic','Fantastic','Fancy','Sassy','Snazzy','Pretty','Cute','Pirate','Ninja','Zombie','Robot','Radical','Urban','Cool','Hella','Sweet','Awful','Double','Triple','Turbo','Techno','Disco','Electro','Dancing','Wonder','Mutant','Space','Science','Medieval','Future','Captain','Bearded','Lovely','Tiny','Big','Fire','Water','Frozen','Metal','Plastic','Solid','Liquid','Moldy','Shiny','Happy','Happy Little','Slimy','Tasty','Delicious','Hungry','Greedy','Lethal','Professor','Doctor','Power','Chocolate','Crumbly','Choklit','Righteous','Glorious','Mnemonic','Psychic','Frenetic','Hectic','Crazy','Royal','El','Von'])+' '):'Mc')+choose(['Cookie','Biscuit','Muffin','Scone','Cupcake','Pancake','Chip','Sprocket','Gizmo','Puppet','Mitten','Sock','Teapot','Mystery','Baker','Cook','Grandma','Click','Clicker','Spaceship','Factory','Portal','Machine','Experiment','Monster','Panic','Burglar','Bandit','Booty','Potato','Pizza','Burger','Sausage','Meatball','Spaghetti','Macaroni','Kitten','Puppy','Giraffe','Zebra','Parrot','Dolphin','Duckling','Sloth','Turtle','Goblin','Pixie','Gnome','Computer','Pirate','Ninja','Zombie','Robot']);1387}1388Game.GetBakeryName=function() {return Game.RandomBakeryName();}1389Game.bakeryName=Game.GetBakeryName();1390Game.bakeryNameL=l('bakeryName');1391Game.bakeryNameL.innerHTML=Game.bakeryName+'\'s bakery';1392Game.bakeryNameSet=function(what)1393{1394Game.bakeryName=what.replace(/\W+/g,' ');1395Game.bakeryName=Game.bakeryName.substring(0,28);1396Game.bakeryNameRefresh();1397}1398Game.bakeryNameRefresh=function()1399{1400var name=Game.bakeryName;1401if (name.slice(-1).toLowerCase()=='s') name+='\' bakery'; else name+='\'s bakery';1402Game.bakeryNameL.innerHTML=name;1403name=Game.bakeryName.toLowerCase();1404if (name=='orteil') Game.Win('God complex');1405if (name.indexOf('saysopensesame',name.length-('saysopensesame').length)>0 && !Game.sesame) Game.OpenSesame();1406Game.recalculateGains=1;1407}1408Game.bakeryNamePrompt=function()1409{1410Game.Prompt('<h3>Name your bakery</h3><div class="block" style="text-align:center;">What should your bakery\'s name be?</div><div class="block"><input type="text" style="text-align:center;width:100%;" id="bakeryNameInput" value="'+Game.bakeryName+'"/></div>',[['Confirm','if (l(\'bakeryNameInput\').value.length>0) {Game.bakeryNameSet(l(\'bakeryNameInput\').value);Game.Win(\'What\\\'s in a name\');Game.ClosePrompt();}'],['Random','Game.bakeryNamePromptRandom();'],'Cancel']);1411l('bakeryNameInput').focus();1412l('bakeryNameInput').select();1413}1414Game.bakeryNamePromptRandom=function()1415{1416l('bakeryNameInput').value=Game.RandomBakeryName();1417}1418AddEvent(Game.bakeryNameL,'click',Game.bakeryNamePrompt);141914201421/*=====================================================================================1422TOOLTIP1423=======================================================================================*/1424Game.tooltip={text:'',x:0,y:0,origin:'',on:0,tt:l('tooltip'),tta:l('tooltipAnchor'),shouldHide:1,dynamic:0,from:0};1425Game.tooltip.draw=function(from,text,origin)1426{1427this.shouldHide=0;1428this.text=text;1429this.from=from;1430//this.x=x;1431//this.y=y;1432this.origin=origin;1433var tt=this.tt;1434var tta=this.tta;1435tt.style.left='auto';1436tt.style.top='auto';1437tt.style.right='auto';1438tt.style.bottom='auto';1439if (typeof this.text==='function')1440{1441var text=this.text();1442if (text=='') tta.style.opacity='0';1443else1444{1445tt.innerHTML=unescape(text);1446tta.style.opacity='1';1447}1448}1449else tt.innerHTML=unescape(this.text);1450//tt.innerHTML=(typeof this.text==='function')?unescape(this.text()):unescape(this.text);1451tta.style.display='block';1452tta.style.visibility='hidden';1453Game.tooltip.update();1454tta.style.visibility='visible';1455this.on=1;1456}1457Game.tooltip.update=function()1458{1459var X=0;1460var Y=0;1461var width=this.tt.offsetWidth;1462var height=this.tt.offsetHeight;1463if (this.origin=='store')1464{1465X=Game.windowW-332-width;1466Y=Game.mouseY-32;1467if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-42;1468Y=Math.max(0,Math.min(Game.windowH-height-44,Y));1469/*this.tta.style.right='308px';//'468px';1470this.tta.style.left='auto';1471if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-2;1472this.tta.style.top=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y-48))+'px';*/1473}1474else1475{1476if (Game.onCrate)1477{1478var rect=Game.onCrate.getBoundingClientRect();1479rect={left:rect.left,top:rect.top,right:rect.right,bottom:rect.bottom};1480if (rect.left==0 && rect.top==0)//if we get that bug where we get stuck in the top-left, move to the mouse (REVISION : just do nothing)1481{return false;/*rect.left=Game.mouseX-24;rect.right=Game.mouseX+24;rect.top=Game.mouseY-24;rect.bottom=Game.mouseY+24;*/}1482if (this.origin=='left')1483{1484X=rect.left-width-16;1485Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;1486Y=Math.max(0,Math.min(Game.windowH-height-19,Y));1487if (X<0) X=rect.right;1488}1489else1490{1491X=rect.left+(rect.right-rect.left)/2-width/2-8;1492Y=rect.top-height-48;1493X=Math.max(0,Math.min(Game.windowW-width-16,X));1494if (Y<0) Y=rect.bottom-32;1495}1496}1497else if (this.origin=='bottom-right')1498{1499X=Game.mouseX+8;1500Y=Game.mouseY-32;1501X=Math.max(0,Math.min(Game.windowW-width-16,X));1502Y=Math.max(0,Math.min(Game.windowH-height-64,Y));1503}1504else if (this.origin=='bottom')1505{1506X=Game.mouseX-width/2-8;1507Y=Game.mouseY+24;1508X=Math.max(0,Math.min(Game.windowW-width-16,X));1509Y=Math.max(0,Math.min(Game.windowH-height-64,Y));1510}1511else if (this.origin=='left')1512{1513X=Game.mouseX-width-24;1514Y=Game.mouseY-height/2-8;1515X=Math.max(0,Math.min(Game.windowW-width-16,X));1516Y=Math.max(0,Math.min(Game.windowH-height-64,Y));1517}1518else if (this.origin=='this' && this.from)1519{1520var rect=this.from.getBoundingClientRect();1521X=(rect.left+rect.right)/2-width/2-8;1522Y=(rect.top)-this.tt.clientHeight-48;1523X=Math.max(0,Math.min(Game.windowW-width-16,X));1524//Y=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y));1525if (Y<0) Y=(rect.bottom-24);1526if (Y+height+40>Game.windowH)1527{1528X=rect.right+8;1529Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;1530Y=Math.max(0,Math.min(Game.windowH-height-19,Y));1531}1532}1533else1534{1535X=Game.mouseX-width/2-8;1536Y=Game.mouseY-height-32;1537X=Math.max(0,Math.min(Game.windowW-width-16,X));1538Y=Math.max(0,Math.min(Game.windowH-height-64,Y));1539}1540}1541this.tta.style.left=X+'px';1542this.tta.style.right='auto';1543this.tta.style.top=Y+'px';1544this.tta.style.bottom='auto';1545if (this.shouldHide) {this.hide();this.shouldHide=0;}1546else if (Game.drawT%10==0 && typeof(this.text)=='function')1547{1548var text=this.text();1549if (text=='') this.tta.style.opacity='0';1550else1551{1552this.tt.innerHTML=unescape(text);1553this.tta.style.opacity='1';1554}1555}1556}1557Game.tooltip.hide=function()1558{1559this.tta.style.display='none';1560this.dynamic=0;1561this.on=0;1562}1563Game.getTooltip=function(text,origin,isCrate)1564{1565origin=(origin?origin:'middle');1566if (isCrate) return 'onMouseOut="Game.setOnCrate(0);Game.tooltip.shouldHide=1;" onMouseOver="if (!Game.mouseDown) {Game.setOnCrate(this);Game.tooltip.dynamic=0;Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');Game.tooltip.wobble();}"';1567else return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=0;Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');Game.tooltip.wobble();"';1568}1569Game.getDynamicTooltip=function(func,origin,isCrate)1570{1571origin=(origin?origin:'middle');1572if (isCrate) return 'onMouseOut="Game.setOnCrate(0);Game.tooltip.shouldHide=1;" onMouseOver="if (!Game.mouseDown) {Game.setOnCrate(this);Game.tooltip.dynamic=1;Game.tooltip.draw(this,'+'function(){return '+func+'();}'+',\''+origin+'\');Game.tooltip.wobble();}"';1573return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=1;Game.tooltip.draw(this,'+'function(){return '+func+'();}'+',\''+origin+'\');Game.tooltip.wobble();"';1574}1575Game.attachTooltip=function(el,func,origin)1576{1577if (typeof func==='string')1578{1579var str=func;1580func=function(str){return function(){return str;};}(str);1581}1582origin=(origin?origin:'middle');1583AddEvent(el,'mouseover',function(func,el,origin){return function(){Game.tooltip.dynamic=1;Game.tooltip.draw(el,func,origin);};}(func,el,origin));1584AddEvent(el,'mouseout',function(){return function(){Game.tooltip.shouldHide=1;};}());1585}1586Game.tooltip.wobble=function()1587{1588//disabled because this effect doesn't look good with the slight slowdown it might or might not be causing.1589if (false)1590{1591this.tt.className='framed';1592void this.tt.offsetWidth;1593this.tt.className='framed wobbling';1594}1595}159615971598/*=====================================================================================1599UPDATE CHECKER1600=======================================================================================*/1601Game.CheckUpdates=function()1602{1603ajax('server.php?q=checkupdate',Game.CheckUpdatesResponse);1604}1605Game.CheckUpdatesResponse=function(response)1606{1607var r=response.split('|');1608var str='';1609if (r[0]=='alert')1610{1611if (r[1]) str=r[1];1612}1613else if (parseFloat(r[0])>Game.version)1614{1615str='<b>New version available : v. '+r[0]+'!</b>';1616if (r[1]) str+='<br><small>Update note : "'+r[1]+'"</small>';1617str+='<br><b>Refresh to get it!</b>';1618}1619if (str!='')1620{1621l('alert').innerHTML=str;1622l('alert').style.display='block';1623}1624}16251626/*=====================================================================================1627DATA GRABBER1628=======================================================================================*/16291630Game.externalDataLoaded=false;16311632Game.grandmaNames=['Granny','Gusher','Ethel','Edna','Doris','Maud','Hilda','Gladys','Michelle','Michele','Phyllis','Millicent','Muriel','Myrtle','Mildred','Mavis','Helen','Gloria','Sheila','Betty','Gertrude','Agatha','Beryl','Agnes','Pearl','Precious','Ruby','Vera','Bonnie','Ada','Bunny','Cookie','Darling','Gaga','GamGam','Memaw','Mimsy','Peanut','Nana','Nan','Tootsie','Warty','Stinky','Heinous'];1633Game.customGrandmaNames=[];1634Game.heralds=0;16351636Game.GrabData=function()1637{1638ajax('/patreon/grab.php',Game.GrabDataResponse);1639}1640Game.GrabDataResponse=function(response)1641{1642/*1643response should be formatted as1644{"herald":3,"grandma":"a|b|c|...}1645*/1646var r={};1647try{1648r=JSON.parse(response);1649if (typeof r['herald']!=='undefined')1650{1651Game.heralds=parseInt(r['herald']);1652Game.heralds=Math.max(0,Math.min(100,Game.heralds));1653}1654if (typeof r['grandma']!=='undefined' && r['grandma']!='')1655{1656Game.customGrandmaNames=r['grandma'].split('|');1657Game.customGrandmaNames=Game.customGrandmaNames.filter(function(el){return el!='';});1658}16591660l('heraldsAmount').innerHTML=Game.heralds;1661Game.externalDataLoaded=true;1662}catch(e){}1663}1664166516661667Game.attachTooltip(l('httpsSwitch'),'<div style="padding:8px;width:350px;text-align:center;font-size:11px;">You are currently playing Cookie Clicker on the <b>'+(Game.https?'HTTPS':'HTTP')+'</b> protocol.<br>The <b>'+(Game.https?'HTTP':'HTTPS')+'</b> version uses a different save slot than this one.<br>Click this lock to reload the page and switch to the <b>'+(Game.https?'HTTP':'HTTPS')+'</b> version!</div>','this');1668AddEvent(l('httpsSwitch'),'click',function(){1669PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);1670if (location.protocol=='https:') location.href='http:'+window.location.href.substring(window.location.protocol.length);1671else if (location.protocol=='http:') location.href='https:'+window.location.href.substring(window.location.protocol.length);1672});16731674Game.attachTooltip(l('topbarOrteil'),'<div style="padding:8px;width:250px;text-align:center;">Back to Orteil\'s subdomain!<br>Lots of other games in there!</div>','this');1675Game.attachTooltip(l('topbarDashnet'),'<div style="padding:8px;width:250px;text-align:center;">Back to our homepage!</div>','this');1676Game.attachTooltip(l('topbarTwitter'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s twitter, which frequently features game updates.</div>','this');1677Game.attachTooltip(l('topbarTumblr'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s tumblr, which frequently features game updates.</div>','this');1678Game.attachTooltip(l('topbarDiscord'),'<div style="padding:8px;width:250px;text-align:center;">Our official discord server.<br>You can share tips and questions about Cookie Clicker and all our other games!</div>','this');1679Game.attachTooltip(l('topbarPatreon'),'<div style="padding:8px;width:250px;text-align:center;">Support us on Patreon and help us keep updating Cookie Clicker!<br>There\'s neat rewards for patrons too!</div>','this');1680Game.attachTooltip(l('topbarMerch'),'<div style="padding:8px;width:250px;text-align:center;">Cookie Clicker shirts, hoodies and stickers!</div>','this');1681Game.attachTooltip(l('topbarMobileCC'),'<div style="padding:8px;width:250px;text-align:center;">Play Cookie Clicker on your phone!<br>(Currently in beta, Android only; iOS version will be released later)</div>','this');1682Game.attachTooltip(l('topbarRandomgen'),'<div style="padding:8px;width:250px;text-align:center;">A thing we made that lets you write random generators.</div>','this');1683Game.attachTooltip(l('topbarIGM'),'<div style="padding:8px;width:250px;text-align:center;">A thing we made that lets you create your own idle games using a simple scripting language.</div>','this');16841685Game.attachTooltip(l('heralds'),function(){1686var str='';16871688if (!Game.externalDataLoaded) str+='Heralds couldn\'t be loaded. There may be an issue with our servers, or you are playing the game locally.';1689else1690{1691if (Game.heralds==0) str+='There are no heralds at the moment. Please consider <b style="color:#bc3aff;">donating to our Patreon</b>!';1692else1693{1694str+=(Game.heralds==1?'<b style="color:#bc3aff;text-shadow:0px 1px 0px #6d0096;">1 herald</b> is':'<b style="color:#fff;text-shadow:0px 1px 0px #6d0096,0px 0px 6px #bc3aff;">'+Game.heralds+' heralds</b> are')+' selflessly inspiring a boost in production for everyone, resulting in<br><b style="color:#cdaa89;text-shadow:0px 1px 0px #7c4532,0px 0px 6px #7c4532;"><div style="width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(img/money.png);"></div> +'+Game.heralds+'% cookies per second</b>.';1695str+='<div class="line"></div>';1696if (Game.ascensionMode==1) str+='You are in a <b>Born again</b> run, and are not currently benefiting from heralds.';1697else if (Game.Has('Heralds')) str+='You own the <b>Heralds</b> upgrade, and therefore benefit from the production boost.';1698else str+='To benefit from the herald bonus, you need a special upgrade you do not yet own. You will permanently unlock it later in the game.';1699}1700}1701str+='<div class="line"></div><span style="font-size:90%;opacity:0.6;"><b>Heralds</b> are people who have donated to our highest Patreon tier, and are limited to 100.<br>Each herald gives everyone +1% CpS.<br>Heralds benefit everyone playing the game, regardless of whether you donated.</span>';17021703str+='<div style="width:31px;height:39px;background:url(img/heraldFlag.png);position:absolute;top:0px;left:8px;"></div><div style="width:31px;height:39px;background:url(img/heraldFlag.png);position:absolute;top:0px;right:8px;"></div>';17041705return '<div style="padding:8px;width:300px;text-align:center;" class="prompt"><h3>Heralds</h3><div class="block">'+str+'</div></div>';1706},'this');1707l('heraldsAmount').innerHTML='?';1708l('heralds').style.display='inline-block';17091710Game.GrabData();171117121713Game.useLocalStorage=1;1714Game.localStorageGet=function(key)1715{1716var local=0;1717try {local=window.localStorage.getItem(key);} catch (exception) {}1718return local;1719}1720Game.localStorageSet=function(key,str)1721{1722var local=0;1723try {local=window.localStorage.setItem(key,str);} catch (exception) {}1724return local;1725}1726//window.localStorage.clear();//won't switch back to cookie-based if there is localStorage info17271728/*=====================================================================================1729SAVE1730=======================================================================================*/1731Game.ExportSave=function()1732{1733Game.prefs.showBackupWarning=0;1734Game.Prompt('<h3>Export save</h3><div class="block">This is your save code.<br>Copy it and keep it somewhere safe!</div><div class="block"><textarea id="textareaPrompt" style="width:100%;height:128px;" readonly>'+Game.WriteSave(1)+'</textarea></div>',['All done!']);//prompt('Copy this text and keep it somewhere safe!',Game.WriteSave(1));1735l('textareaPrompt').focus();l('textareaPrompt').select();1736}1737Game.ImportSave=function()1738{1739Game.Prompt('<h3>Import save</h3><div class="block">Please paste in the code that was given to you on save export.</div><div class="block"><textarea id="textareaPrompt" style="width:100%;height:128px;"></textarea></div>',[['Load','if (l(\'textareaPrompt\').value.length>0) {Game.ImportSaveCode(l(\'textareaPrompt\').value);Game.ClosePrompt();}'],'Nevermind']);//prompt('Please paste in the text that was given to you on save export.','');1740l('textareaPrompt').focus();1741}1742Game.ImportSaveCode=function(save)1743{1744if (save && save!='') Game.LoadSave(save);1745}17461747Game.FileSave=function()1748{1749Game.prefs.showBackupWarning=0;1750var filename=Game.bakeryName.replace(/[^a-zA-Z0-9]+/g,'')+'Bakery';1751var text=Game.WriteSave(1);1752var blob=new Blob([text],{type:'text/plain;charset=utf-8'});1753saveAs(blob,filename+'.txt');1754}1755Game.FileLoad=function(e)1756{1757if (e.target.files.length==0) return false;1758var file=e.target.files[0];1759var reader=new FileReader();1760reader.onload=function(e)1761{1762Game.ImportSaveCode(e.target.result);1763}1764reader.readAsText(file);1765}17661767Game.toSave=false;1768Game.WriteSave=function(type)1769{1770Game.toSave=false;1771//type : none is default, 1=return string only, 2=return uncompressed string, 3=return uncompressed, commented string1772Game.lastDate=parseInt(Game.time);1773var str='';1774if (type==3) str+='\nGame version\n';1775str+=Game.version+'|';1776str+='|';//just in case we need some more stuff here1777if (type==3) str+='\n\nRun details';1778str+=//save stats1779(type==3?'\n run start date : ':'')+parseInt(Game.startDate)+';'+1780(type==3?'\n legacy start date : ':'')+parseInt(Game.fullDate)+';'+1781(type==3?'\n date when we last opened the game : ':'')+parseInt(Game.lastDate)+';'+1782(type==3?'\n bakery name : ':'')+(Game.bakeryName)+';'+1783(type==3?'\n seed : ':'')+(Game.seed)+1784'|';1785if (type==3) str+='\n\nPacked preferences bitfield\n ';1786var str2=//prefs1787(Game.prefs.particles?'1':'0')+1788(Game.prefs.numbers?'1':'0')+1789(Game.prefs.autosave?'1':'0')+1790(Game.prefs.autoupdate?'1':'0')+1791(Game.prefs.milk?'1':'0')+1792(Game.prefs.fancy?'1':'0')+1793(Game.prefs.warn?'1':'0')+1794(Game.prefs.cursors?'1':'0')+1795(Game.prefs.focus?'1':'0')+1796(Game.prefs.format?'1':'0')+1797(Game.prefs.notifs?'1':'0')+1798(Game.prefs.wobbly?'1':'0')+1799(Game.prefs.monospace?'1':'0')+1800(Game.prefs.filters?'1':'0')+1801(Game.prefs.cookiesound?'1':'0')+1802(Game.prefs.crates?'1':'0')+1803(Game.prefs.showBackupWarning?'1':'0')+1804(Game.prefs.extraButtons?'1':'0')+1805(Game.prefs.askLumps?'1':'0')+1806(Game.prefs.customGrandmas?'1':'0')+1807(Game.prefs.timeout?'1':'0')+1808'';1809str2=pack3(str2);1810str+=str2+'|';1811if (type==3) str+='\n\nMisc game data';1812str+=1813(type==3?'\n cookies : ':'')+parseFloat(Game.cookies).toString()+';'+1814(type==3?'\n total cookies earned : ':'')+parseFloat(Game.cookiesEarned).toString()+';'+1815(type==3?'\n cookie clicks : ':'')+parseInt(Math.floor(Game.cookieClicks))+';'+1816(type==3?'\n golden cookie clicks : ':'')+parseInt(Math.floor(Game.goldenClicks))+';'+1817(type==3?'\n cookies made by clicking : ':'')+parseFloat(Game.handmadeCookies).toString()+';'+1818(type==3?'\n golden cookies missed : ':'')+parseInt(Math.floor(Game.missedGoldenClicks))+';'+1819(type==3?'\n background type : ':'')+parseInt(Math.floor(Game.bgType))+';'+1820(type==3?'\n milk type : ':'')+parseInt(Math.floor(Game.milkType))+';'+1821(type==3?'\n cookies from past runs : ':'')+parseFloat(Game.cookiesReset).toString()+';'+1822(type==3?'\n elder wrath : ':'')+parseInt(Math.floor(Game.elderWrath))+';'+1823(type==3?'\n pledges : ':'')+parseInt(Math.floor(Game.pledges))+';'+1824(type==3?'\n pledge time left : ':'')+parseInt(Math.floor(Game.pledgeT))+';'+1825(type==3?'\n currently researching : ':'')+parseInt(Math.floor(Game.nextResearch))+';'+1826(type==3?'\n research time left : ':'')+parseInt(Math.floor(Game.researchT))+';'+1827(type==3?'\n ascensions : ':'')+parseInt(Math.floor(Game.resets))+';'+1828(type==3?'\n golden cookie clicks (this run) : ':'')+parseInt(Math.floor(Game.goldenClicksLocal))+';'+1829(type==3?'\n cookies sucked by wrinklers : ':'')+parseFloat(Game.cookiesSucked).toString()+';'+1830(type==3?'\n wrinkles popped : ':'')+parseInt(Math.floor(Game.wrinklersPopped))+';'+1831(type==3?'\n santa level : ':'')+parseInt(Math.floor(Game.santaLevel))+';'+1832(type==3?'\n reindeer clicked : ':'')+parseInt(Math.floor(Game.reindeerClicked))+';'+1833(type==3?'\n season time left : ':'')+parseInt(Math.floor(Game.seasonT))+';'+1834(type==3?'\n season switcher uses : ':'')+parseInt(Math.floor(Game.seasonUses))+';'+1835(type==3?'\n current season : ':'')+(Game.season?Game.season:'')+';';1836var wrinklers=Game.SaveWrinklers();1837str+=1838(type==3?'\n amount of cookies contained in wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amount))+';'+1839(type==3?'\n number of wrinklers : ':'')+parseInt(Math.floor(wrinklers.number))+';'+1840(type==3?'\n prestige level : ':'')+parseFloat(Game.prestige).toString()+';'+1841(type==3?'\n heavenly chips : ':'')+parseFloat(Game.heavenlyChips).toString()+';'+1842(type==3?'\n heavenly chips spent : ':'')+parseFloat(Game.heavenlyChipsSpent).toString()+';'+1843(type==3?'\n heavenly cookies : ':'')+parseFloat(Game.heavenlyCookies).toString()+';'+1844(type==3?'\n ascension mode : ':'')+parseInt(Math.floor(Game.ascensionMode))+';'+1845(type==3?'\n permanent upgrades : ':'')+parseInt(Math.floor(Game.permanentUpgrades[0]))+';'+parseInt(Math.floor(Game.permanentUpgrades[1]))+';'+parseInt(Math.floor(Game.permanentUpgrades[2]))+';'+parseInt(Math.floor(Game.permanentUpgrades[3]))+';'+parseInt(Math.floor(Game.permanentUpgrades[4]))+';'+1846(type==3?'\n dragon level : ':'')+parseInt(Math.floor(Game.dragonLevel))+';'+1847(type==3?'\n dragon aura : ':'')+parseInt(Math.floor(Game.dragonAura))+';'+1848(type==3?'\n dragon aura 2 : ':'')+parseInt(Math.floor(Game.dragonAura2))+';'+1849(type==3?'\n chime type : ':'')+parseInt(Math.floor(Game.chimeType))+';'+1850(type==3?'\n volume : ':'')+parseInt(Math.floor(Game.volume))+';'+1851(type==3?'\n number of shiny wrinklers : ':'')+parseInt(Math.floor(wrinklers.shinies))+';'+1852(type==3?'\n amount of cookies contained in shiny wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amountShinies))+';'+1853(type==3?'\n current amount of sugar lumps : ':'')+parseFloat(Math.floor(Game.lumps))+';'+1854(type==3?'\n total amount of sugar lumps made : ':'')+parseFloat(Math.floor(Game.lumpsTotal))+';'+1855(type==3?'\n time when current sugar lump started : ':'')+parseFloat(Math.floor(Game.lumpT))+';'+1856(type==3?'\n time when last refilled a minigame with a sugar lump : ':'')+parseFloat(Math.floor(Game.lumpRefill))+';'+1857(type==3?'\n sugar lump type : ':'')+parseInt(Math.floor(Game.lumpCurrentType))+';'+1858(type==3?'\n vault : ':'')+Game.vault.join(',')+';'+1859(type==3?'\n heralds : ':'')+parseInt(Game.heralds)+';'+1860(type==3?'\n golden cookie fortune : ':'')+parseInt(Game.fortuneGC)+';'+1861(type==3?'\n CpS fortune : ':'')+parseInt(Game.fortuneCPS)+';'+1862'|';//cookies and lots of other stuff18631864if (type==3) str+='\n\nBuildings : amount, bought, cookies produced, level, minigame data';1865for (var i in Game.Objects)//buildings1866{1867var me=Game.Objects[i];1868if (type==3) str+='\n '+me.name+' : ';1869if (me.vanilla)1870{1871str+=me.amount+','+me.bought+','+parseFloat(Math.floor(me.totalCookies))+','+parseInt(me.level);1872if (Game.isMinigameReady(me)) str+=','+me.minigame.save(); else str+=',';1873str+=','+(me.muted?'1':'0');1874str+=';';1875}1876}1877str+='|';1878if (type==3) str+='\n\nPacked upgrades bitfield (unlocked and bought)\n ';1879var toCompress=[];1880for (var i in Game.UpgradesById)//upgrades1881{1882var me=Game.UpgradesById[i];1883if (me.vanilla) toCompress.push(Math.min(me.unlocked,1),Math.min(me.bought,1));1884};18851886toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);18871888str+=toCompress;1889str+='|';1890if (type==3) str+='\n\nPacked achievements bitfield (won)\n ';1891var toCompress=[];1892for (var i in Game.AchievementsById)//achievements1893{1894var me=Game.AchievementsById[i];1895if (me.vanilla) toCompress.push(Math.min(me.won));1896}1897toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);1898str+=toCompress;18991900str+='|';1901if (type==3) str+='\n\nBuffs : type, maxTime, time, arg1, arg2, arg3';1902for (var i in Game.buffs)1903{1904var me=Game.buffs[i];1905if (me.type)1906{1907if (type==3) str+='\n '+me.type.name+' : ';1908if (me.type.vanilla)1909{1910str+=me.type.id+','+me.maxTime+','+me.time;1911if (typeof me.arg1!=='undefined') str+=','+parseFloat(me.arg1);1912if (typeof me.arg2!=='undefined') str+=','+parseFloat(me.arg2);1913if (typeof me.arg3!=='undefined') str+=','+parseFloat(me.arg3);1914str+=';';1915}1916}1917}191819191920if (type==3) str+='\n';19211922for (var i in Game.customSave) {Game.customSave[i]();}19231924if (type==2 || type==3)1925{1926return str;1927}1928else if (type==1)1929{1930str=escape(utf8_to_b64(str)+'!END!');1931return str;1932}1933else1934{1935if (Game.useLocalStorage)1936{1937//so we used to save the game using browser cookies, which was just really neat considering the game's name1938//we're using localstorage now, which is more efficient but not as cool1939//a moment of silence for our fallen puns1940str=utf8_to_b64(str)+'!END!';1941if (str.length<10)1942{1943if (Game.prefs.popups) Game.Popup('Error while saving.<br>Purchasing an upgrade might fix this.');1944else Game.Notify('Saving failed!','Purchasing an upgrade and saving again might fix this.<br>This really shouldn\'t happen; please notify Orteil on his tumblr.');1945}1946else1947{1948str=escape(str);1949Game.localStorageSet(Game.SaveTo,str);//aaand save1950if (!Game.localStorageGet(Game.SaveTo))1951{1952if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');1953else Game.Notify('Error while saving','Export your save instead!');1954}1955else if (document.hasFocus())1956{1957if (Game.prefs.popups) Game.Popup('Game saved');1958else Game.Notify('Game saved','','',1,1);1959}1960}1961}1962else//legacy system1963{1964//that's right1965//we're using cookies1966//yeah I went there1967var now=new Date();//we storin dis for 5 years, people1968now.setFullYear(now.getFullYear()+5);//mmh stale cookies1969str=utf8_to_b64(str)+'!END!';1970Game.saveData=escape(str);1971str=Game.SaveTo+'='+escape(str)+'; expires='+now.toUTCString()+';';1972document.cookie=str;//aaand save1973if (document.cookie.indexOf(Game.SaveTo)<0)1974{1975if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');1976else Game.Notify('Error while saving','Export your save instead!','',0,1);1977}1978else if (document.hasFocus())1979{1980if (Game.prefs.popups) Game.Popup('Game saved');1981else Game.Notify('Game saved','','',1,1);1982}1983}1984}1985}19861987/*=====================================================================================1988LOAD1989=======================================================================================*/1990Game.salvageSave=function()1991{1992//for when Cookie Clicker won't load and you need your save1993console.log('===================================================');1994console.log('This is your save data. Copypaste it (without quotation marks) into another version using the "Import save" feature.');1995console.log(Game.localStorageGet(Game.SaveTo));1996}1997Game.LoadSave=function(data)1998{1999var str='';2000if (data) str=unescape(data);2001else2002{2003if (Game.useLocalStorage)2004{2005var local=Game.localStorageGet(Game.SaveTo);2006if (!local)//no localstorage save found? let's get the cookie one last time2007{2008if (document.cookie.indexOf(Game.SaveTo)>=0)2009{2010str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);2011document.cookie=Game.SaveTo+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';2012}2013else return false;2014}2015else2016{2017str=unescape(local);2018}2019}2020else//legacy system2021{2022if (document.cookie.indexOf(Game.SaveTo)>=0) str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);//get cookie here2023else return false;2024}2025}2026if (str!='')2027{2028var version=0;2029var oldstr=str.split('|');2030if (oldstr[0]<1) {}2031else2032{2033str=str.split('!END!')[0];2034str=b64_to_utf8(str);2035}2036if (str!='')2037{2038var spl='';2039str=str.split('|');2040version=parseFloat(str[0]);20412042if (isNaN(version) || str.length<5)2043{2044if (Game.prefs.popups) Game.Popup('Oops, looks like the import string is all wrong!');2045else Game.Notify('Error importing save','Oops, looks like the import string is all wrong!','',6,1);2046return false;2047}2048if (version>=1 && version>Game.version)2049{2050if (Game.prefs.popups) Game.Popup('Error : you are attempting to load a save from a future version (v. '+version+'; you are using v. '+Game.version+').');2051else Game.Notify('Error importing save','You are attempting to load a save from a future version (v. '+version+'; you are using v. '+Game.version+').','',6,1);2052return false;2053}2054if (version==1.0501)//prompt if we loaded from the 2014 beta2055{2056setTimeout(function(){Game.Prompt('<h3>New beta</h3><div class="block">Hey there! Unfortunately, your old beta save won\'t work here anymore; you\'ll have to start fresh or import your save from the live version.<div class="line"></div>Thank you for beta-testing Cookie Clicker, we hope you\'ll enjoy it and find strange and interesting bugs!</div>',[['Alright then!','Game.ClosePrompt();']]);},200);2057return false;2058}2059else if (version<1.0501)//prompt if we loaded from the 2014 live version2060{2061setTimeout(function(){Game.Prompt('<h3>Update</h3><div class="block"><b>Hey there!</b> Cookie Clicker just received a pretty substantial update, and you might notice that some things have been moved around. Don\'t panic!<div class="line"></div>Your building numbers may look strange, making it seem like you own buildings you\'ve never bought; this is because we\'ve added <b>3 new buildings</b> after factories (and swapped mines and factories), offsetting everything after them. Likewise, some building-related upgrades and achievements may look a tad shuffled around. This is all perfectly normal!<div class="line"></div>We\'ve also rebalanced Heavenly Chips amounts and behavior. Your amount of chips might be lower or higher than before.<br>You can now ascend through the <b>Legacy button</b> at the top!<div class="line"></div>Thank you for playing Cookie Clicker. We\'ve put a lot of work and care into this update and we hope you\'ll enjoy it!</div>',[['Neat!','Game.ClosePrompt();']]);},200);2062}2063if (version>=1)2064{2065Game.T=0;20662067spl=str[2].split(';');//save stats2068Game.startDate=parseInt(spl[0]);2069Game.fullDate=parseInt(spl[1]);2070Game.lastDate=parseInt(spl[2]);2071Game.bakeryName=spl[3]?spl[3]:Game.GetBakeryName();2072Game.seed=spl[4]?spl[4]:Game.makeSeed();2073//prefs2074if (version<1.0503) spl=str[3].split('');2075else if (version<2.0046) spl=unpack2(str[3]).split('');2076else spl=(str[3]).split('');2077Game.prefs.particles=parseInt(spl[0]);2078Game.prefs.numbers=parseInt(spl[1]);2079Game.prefs.autosave=parseInt(spl[2]);2080Game.prefs.autoupdate=spl[3]?parseInt(spl[3]):1;2081Game.prefs.milk=spl[4]?parseInt(spl[4]):1;2082Game.prefs.fancy=parseInt(spl[5]);if (Game.prefs.fancy) Game.removeClass('noFancy'); else if (!Game.prefs.fancy) Game.addClass('noFancy');2083Game.prefs.warn=spl[6]?parseInt(spl[6]):0;2084Game.prefs.cursors=spl[7]?parseInt(spl[7]):0;2085Game.prefs.focus=spl[8]?parseInt(spl[8]):0;2086Game.prefs.format=spl[9]?parseInt(spl[9]):0;2087Game.prefs.notifs=spl[10]?parseInt(spl[10]):0;2088Game.prefs.wobbly=spl[11]?parseInt(spl[11]):0;2089Game.prefs.monospace=spl[12]?parseInt(spl[12]):0;2090Game.prefs.filters=parseInt(spl[13]);if (Game.prefs.filters) Game.removeClass('noFilters'); else if (!Game.prefs.filters) Game.addClass('noFilters');2091Game.prefs.cookiesound=spl[14]?parseInt(spl[14]):1;2092Game.prefs.crates=spl[15]?parseInt(spl[15]):0;2093Game.prefs.showBackupWarning=spl[16]?parseInt(spl[16]):1;2094Game.prefs.extraButtons=spl[17]?parseInt(spl[17]):1;if (!Game.prefs.extraButtons) Game.removeClass('extraButtons'); else if (Game.prefs.extraButtons) Game.addClass('extraButtons');2095Game.prefs.askLumps=spl[18]?parseInt(spl[18]):0;2096Game.prefs.customGrandmas=spl[19]?parseInt(spl[19]):1;2097Game.prefs.timeout=spl[20]?parseInt(spl[20]):0;2098BeautifyAll();2099spl=str[4].split(';');//cookies and lots of other stuff2100Game.cookies=parseFloat(spl[0]);2101Game.cookiesEarned=parseFloat(spl[1]);2102Game.cookieClicks=spl[2]?parseInt(spl[2]):0;2103Game.goldenClicks=spl[3]?parseInt(spl[3]):0;2104Game.handmadeCookies=spl[4]?parseFloat(spl[4]):0;2105Game.missedGoldenClicks=spl[5]?parseInt(spl[5]):0;2106Game.bgType=spl[6]?parseInt(spl[6]):0;2107Game.milkType=spl[7]?parseInt(spl[7]):0;2108Game.cookiesReset=spl[8]?parseFloat(spl[8]):0;2109Game.elderWrath=spl[9]?parseInt(spl[9]):0;2110Game.pledges=spl[10]?parseInt(spl[10]):0;2111Game.pledgeT=spl[11]?parseInt(spl[11]):0;2112Game.nextResearch=spl[12]?parseInt(spl[12]):0;2113Game.researchT=spl[13]?parseInt(spl[13]):0;2114Game.resets=spl[14]?parseInt(spl[14]):0;2115Game.goldenClicksLocal=spl[15]?parseInt(spl[15]):0;2116Game.cookiesSucked=spl[16]?parseFloat(spl[16]):0;2117Game.wrinklersPopped=spl[17]?parseInt(spl[17]):0;2118Game.santaLevel=spl[18]?parseInt(spl[18]):0;2119Game.reindeerClicked=spl[19]?parseInt(spl[19]):0;2120Game.seasonT=spl[20]?parseInt(spl[20]):0;2121Game.seasonUses=spl[21]?parseInt(spl[21]):0;2122Game.season=spl[22]?spl[22]:Game.baseSeason;2123var wrinklers={amount:spl[23]?parseFloat(spl[23]):0,number:spl[24]?parseInt(spl[24]):0};2124Game.prestige=spl[25]?parseFloat(spl[25]):0;2125Game.heavenlyChips=spl[26]?parseFloat(spl[26]):0;2126Game.heavenlyChipsSpent=spl[27]?parseFloat(spl[27]):0;2127Game.heavenlyCookies=spl[28]?parseFloat(spl[28]):0;2128Game.ascensionMode=spl[29]?parseInt(spl[29]):0;2129Game.permanentUpgrades[0]=spl[30]?parseInt(spl[30]):-1;Game.permanentUpgrades[1]=spl[31]?parseInt(spl[31]):-1;Game.permanentUpgrades[2]=spl[32]?parseInt(spl[32]):-1;Game.permanentUpgrades[3]=spl[33]?parseInt(spl[33]):-1;Game.permanentUpgrades[4]=spl[34]?parseInt(spl[34]):-1;2130//if (version<1.05) {Game.heavenlyChipsEarned=Game.HowMuchPrestige(Game.cookiesReset);Game.heavenlyChips=Game.heavenlyChipsEarned;}2131Game.dragonLevel=spl[35]?parseInt(spl[35]):0;2132if (version<2.0041 && Game.dragonLevel==Game.dragonLevels.length-2) {Game.dragonLevel=Game.dragonLevels.length-1;}2133Game.dragonAura=spl[36]?parseInt(spl[36]):0;2134Game.dragonAura2=spl[37]?parseInt(spl[37]):0;2135Game.chimeType=spl[38]?parseInt(spl[38]):0;2136Game.volume=spl[39]?parseInt(spl[39]):50;2137wrinklers.shinies=spl[40]?parseInt(spl[40]):0;2138wrinklers.amountShinies=spl[41]?parseFloat(spl[41]):0;2139Game.lumps=spl[42]?parseFloat(spl[42]):-1;2140Game.lumpsTotal=spl[43]?parseFloat(spl[43]):-1;2141Game.lumpT=spl[44]?parseInt(spl[44]):Date.now();2142Game.lumpRefill=spl[45]?parseInt(spl[45]):0;2143if (version<2.022) Game.lumpRefill=Game.fps*60;2144Game.lumpCurrentType=spl[46]?parseInt(spl[46]):0;2145Game.vault=spl[47]?spl[47].split(','):[];2146for (var i in Game.vault){Game.vault[i]=parseInt(Game.vault[i]);}2147var actualHeralds=Game.heralds;//we store the actual amount of heralds to restore it later; here we used the amount present in the save to compute offline CpS2148Game.heralds=spl[48]?parseInt(spl[48]):Game.heralds;2149Game.fortuneGC=spl[49]?parseInt(spl[49]):0;2150Game.fortuneCPS=spl[50]?parseInt(spl[50]):0;21512152spl=str[5].split(';');//buildings2153Game.BuildingsOwned=0;2154for (var i in Game.ObjectsById)2155{2156var me=Game.ObjectsById[i];2157me.switchMinigame(false);2158me.pics=[];2159if (spl[i])2160{2161var mestr=spl[i].toString().split(',');2162me.amount=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);me.totalCookies=parseFloat(mestr[2]);me.level=parseInt(mestr[3]||0);2163if (me.minigame && me.minigameLoaded && me.minigame.reset) {me.minigame.reset(true);me.minigame.load(mestr[4]||'');} else me.minigameSave=(mestr[4]||0);2164me.muted=parseInt(mestr[5])||0;2165Game.BuildingsOwned+=me.amount;2166if (version<2.003) me.level=0;2167}2168else2169{2170me.amount=0;me.unlocked=0;me.bought=0;me.totalCookies=0;me.level=0;2171}2172}21732174Game.LoadMinigames();21752176if (version<1.035)//old non-binary algorithm2177{2178spl=str[6].split(';');//upgrades2179Game.UpgradesOwned=0;2180for (var i in Game.UpgradesById)2181{2182var me=Game.UpgradesById[i];2183if (spl[i])2184{2185var mestr=spl[i].split(',');2186me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);2187if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;2188}2189else2190{2191me.unlocked=0;me.bought=0;2192}2193}2194if (str[7]) spl=str[7].split(';'); else spl=[];//achievements2195Game.AchievementsOwned=0;2196for (var i in Game.AchievementsById)2197{2198var me=Game.AchievementsById[i];2199if (spl[i])2200{2201var mestr=spl[i].split(',');2202me.won=parseInt(mestr[0]);2203}2204else2205{2206me.won=0;2207}2208if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;2209}2210}2211else if (version<1.0502)//old awful packing system2212{2213if (str[6]) spl=str[6]; else spl=[];//upgrades2214if (version<1.05) spl=UncompressLargeBin(spl);2215else spl=unpack(spl);2216Game.UpgradesOwned=0;2217for (var i in Game.UpgradesById)2218{2219var me=Game.UpgradesById[i];2220if (spl[i*2])2221{2222var mestr=[spl[i*2],spl[i*2+1]];2223me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);2224if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;2225}2226else2227{2228me.unlocked=0;me.bought=0;2229}2230}2231if (str[7]) spl=str[7]; else spl=[];//achievements2232if (version<1.05) spl=UncompressLargeBin(spl);2233else spl=unpack(spl);2234Game.AchievementsOwned=0;2235for (var i in Game.AchievementsById)2236{2237var me=Game.AchievementsById[i];2238if (spl[i])2239{2240var mestr=[spl[i]];2241me.won=parseInt(mestr[0]);2242}2243else2244{2245me.won=0;2246}2247if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;2248}2249}2250else2251{2252if (str[6]) spl=str[6]; else spl=[];//upgrades2253if (version<2.0046) spl=unpack2(spl).split('');2254else spl=(spl).split('');2255Game.UpgradesOwned=0;2256for (var i in Game.UpgradesById)2257{2258var me=Game.UpgradesById[i];2259if (spl[i*2])2260{2261var mestr=[spl[i*2],spl[i*2+1]];2262me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);2263if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;2264}2265else2266{2267me.unlocked=0;me.bought=0;2268}2269}2270if (str[7]) spl=str[7]; else spl=[];//achievements2271if (version<2.0046) spl=unpack2(spl).split('');2272else spl=(spl).split('');2273Game.AchievementsOwned=0;2274for (var i in Game.AchievementsById)2275{2276var me=Game.AchievementsById[i];2277if (spl[i])2278{2279var mestr=[spl[i]];2280me.won=parseInt(mestr[0]);2281}2282else2283{2284me.won=0;2285}2286if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;2287}2288}22892290Game.killBuffs();2291var buffsToLoad=[];2292spl=(str[8]||'').split(';');//buffs2293for (var i in spl)2294{2295if (spl[i])2296{2297var mestr=spl[i].toString().split(',');2298buffsToLoad.push(mestr);2299}2300}230123022303for (var i in Game.ObjectsById)2304{2305var me=Game.ObjectsById[i];2306if (me.buyFunction) me.buyFunction();2307me.refresh();2308if (me.id>0)2309{2310if (me.muted) me.mute(1);2311}2312}23132314if (version<1.0503)//upgrades that used to be regular, but are now heavenly2315{2316var me=Game.Upgrades['Persistent memory'];me.unlocked=0;me.bought=0;2317var me=Game.Upgrades['Season switcher'];me.unlocked=0;me.bought=0;2318}23192320if (Game.bgType==-1) Game.bgType=0;2321if (Game.milkType==-1) Game.milkType=0;232223232324//advance timers2325var framesElapsed=Math.ceil(((Date.now()-Game.lastDate)/1000)*Game.fps);2326if (Game.pledgeT>0) Game.pledgeT=Math.max(Game.pledgeT-framesElapsed,1);2327if (Game.seasonT>0) Game.seasonT=Math.max(Game.seasonT-framesElapsed,1);2328if (Game.researchT>0) Game.researchT=Math.max(Game.researchT-framesElapsed,1);232923302331Game.ResetWrinklers();2332Game.LoadWrinklers(wrinklers.amount,wrinklers.number,wrinklers.shinies,wrinklers.amountShinies);23332334//recompute season trigger prices2335if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}2336Game.computeSeasonPrices();23372338//recompute prestige2339Game.prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));2340//if ((Game.heavenlyChips+Game.heavenlyChipsSpent)<Game.prestige)2341//{Game.heavenlyChips=Game.prestige;Game.heavenlyChipsSpent=0;}//chips owned and spent don't add up to total prestige? set chips owned to prestige23422343234423452346if (version==1.037 && Game.beta)//are we opening the new beta? if so, save the old beta to /betadungeons2347{2348window.localStorage.setItem('CookieClickerGameBetaDungeons',window.localStorage.getItem('CookieClickerGameBeta'));2349Game.Notify('Beta save data','Your beta save data has been safely exported to /betadungeons.',20);2350}2351else if (version==1.0501 && Game.beta)//are we opening the newer beta? if so, save the old beta to /oldbeta2352{2353window.localStorage.setItem('CookieClickerGameOld',window.localStorage.getItem('CookieClickerGameBeta'));2354//Game.Notify('Beta save data','Your beta save data has been safely exported to /oldbeta.',20);2355}2356if (version<=1.0466 && !Game.beta)//export the old 2014 version to /v104662357{2358window.localStorage.setItem('CookieClickerGamev10466',window.localStorage.getItem('CookieClickerGame'));2359//Game.Notify('Beta save data','Your save data has been safely exported to /v10466.',20);2360}2361if (version==1.9)//are we importing from the 1.9 beta? remove all heavenly upgrades and refund heavenly chips2362{2363for (var i in Game.UpgradesById)2364{2365var me=Game.UpgradesById[i];2366if (me.bought && me.pool=='prestige')2367{2368me.unlocked=0;2369me.bought=0;2370}2371}2372Game.heavenlyChips=Game.prestige;2373Game.heavenlyChipsSpent=0;23742375setTimeout(function(){Game.Prompt('<h3>Beta patch</h3><div class="block">We\'ve tweaked some things and fixed some others, please check the update notes!<div class="line"></div>Of note : due to changes in prestige balancing, all your heavenly upgrades have been removed and your heavenly chips refunded; you\'ll be able to reallocate them next time you ascend.<div class="line"></div>Thank you again for beta-testing Cookie Clicker!</div>',[['Alright then!','Game.ClosePrompt();']]);},200);2376}2377if (version<=1.0466)//are we loading from the old live version? reset HCs2378{2379Game.heavenlyChips=Game.prestige;2380Game.heavenlyChipsSpent=0;2381}23822383if (Game.ascensionMode!=1)2384{2385if (Game.Has('Starter kit')) Game.Objects['Cursor'].free=10;2386if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].free=5;2387}23882389Game.CalculateGains();23902391if (Math.random()<1/10000) Game.TOYS=1;//teehee!23922393var timeOffline=(Date.now()-Game.lastDate)/1000;23942395Game.loadLumps(timeOffline);23962397//compute cookies earned while the game was closed2398if (Game.mobile || Game.Has('Perfect idling') || Game.Has('Twin Gates of Transcendence'))2399{2400if (Game.Has('Perfect idling'))2401{2402var maxTime=60*60*24*1000000000;2403var percent=100;2404}2405else2406{2407var maxTime=60*60;2408if (Game.Has('Belphegor')) maxTime*=2;2409if (Game.Has('Mammon')) maxTime*=2;2410if (Game.Has('Abaddon')) maxTime*=2;2411if (Game.Has('Satan')) maxTime*=2;2412if (Game.Has('Asmodeus')) maxTime*=2;2413if (Game.Has('Beelzebub')) maxTime*=2;2414if (Game.Has('Lucifer')) maxTime*=2;24152416var percent=5;2417if (Game.Has('Angels')) percent+=10;2418if (Game.Has('Archangels')) percent+=10;2419if (Game.Has('Virtues')) percent+=10;2420if (Game.Has('Dominions')) percent+=10;2421if (Game.Has('Cherubim')) percent+=10;2422if (Game.Has('Seraphim')) percent+=10;2423if (Game.Has('God')) percent+=10;24242425if (Game.Has('Chimera')) {maxTime+=60*60*24*2;percent+=5;}24262427if (Game.Has('Fern tea')) percent+=3;2428if (Game.Has('Ichor syrup')) percent+=7;2429if (Game.Has('Fortune #102')) percent+=1;2430}24312432var timeOfflineOptimal=Math.min(timeOffline,maxTime);2433var timeOfflineReduced=Math.max(0,timeOffline-timeOfflineOptimal);2434var amount=(timeOfflineOptimal+timeOfflineReduced*0.1)*Game.cookiesPs*(percent/100);24352436if (amount>0)2437{2438if (Game.prefs.popups) Game.Popup('Earned '+Beautify(amount)+' cookie'+(Math.floor(amount)==1?'':'s')+' while you were away');2439else Game.Notify('Welcome back!','You earned <b>'+Beautify(amount)+'</b> cookie'+(Math.floor(amount)==1?'':'s')+' while you were away.<br>('+Game.sayTime(timeOfflineOptimal*Game.fps,-1)+' at '+Math.floor(percent)+'% CpS'+(timeOfflineReduced?', plus '+Game.sayTime(timeOfflineReduced*Game.fps,-1)+' at '+(Math.floor(percent*10)/100)+'%':'')+'.)',[Math.floor(Math.random()*16),11]);2440Game.Earn(amount);2441}2442}24432444//we load buffs after everything as we do not want them to interfer with offline CpS2445for (var i in buffsToLoad)2446{2447var mestr=buffsToLoad[i];2448var type=Game.buffTypes[parseInt(mestr[0])];2449Game.gainBuff(type.name,parseFloat(mestr[1])/Game.fps,parseFloat(mestr[3]||0),parseFloat(mestr[4]||0),parseFloat(mestr[5]||0)).time=parseFloat(mestr[2]);2450}245124522453Game.bakeryNameRefresh();24542455}2456else//importing old version save2457{2458Game.Notify('Error importing save','Sorry, you can\'t import saves from the old version anymore.','',6,1);2459return false;2460}246124622463Game.RebuildUpgrades();24642465Game.TickerAge=0;2466Game.TickerEffect=0;24672468Game.elderWrathD=0;2469Game.recalculateGains=1;2470Game.storeToRefresh=1;2471Game.upgradesToRebuild=1;24722473Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);24742475Game.specialTab='';2476Game.ToggleSpecialMenu(0);24772478Game.killShimmers();24792480if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie2481{2482Game.ReincarnateTimer=1;2483Game.addClass('reincarnating');2484Game.BigCookieSize=0;2485}24862487if (version<Game.version) l('logButton').classList.add('hasUpdate');24882489if (Game.season!='' && Game.season==Game.baseSeason)2490{2491if (Game.season=='valentines') Game.Notify('Valentine\'s Day!','It\'s <b>Valentine\'s season</b>!<br>Love\'s in the air and cookies are just that much sweeter!',[20,3],60*3);2492else if (Game.season=='fools') Game.Notify('Business Day!','It\'s <b>Business season</b>!<br>Don\'t panic! Things are gonna be looking a little more corporate for a few days.',[17,6],60*3);2493else if (Game.season=='halloween') Game.Notify('Halloween!','It\'s <b>Halloween season</b>!<br>Everything is just a little bit spookier!',[13,8],60*3);2494else if (Game.season=='christmas') Game.Notify('Christmas time!','It\'s <b>Christmas season</b>!<br>Bring good cheer to all and you just may get cookies in your stockings!',[12,10],60*3);2495else if (Game.season=='easter') Game.Notify('Easter!','It\'s <b>Easter season</b>!<br>Keep an eye out and you just might click a rabbit or two!',[0,12],60*3);2496}24972498Game.heralds=actualHeralds;24992500if (Game.prefs.popups) Game.Popup('Game loaded');2501else Game.Notify('Game loaded','','',1,1);25022503if (Game.prefs.showBackupWarning==1) Game.showBackupWarning();2504}2505}2506else return false;2507return true;2508}25092510/*=====================================================================================2511RESET2512=======================================================================================*/2513Game.Reset=function(hard)2514{2515Game.T=0;25162517var cookiesForfeited=Game.cookiesEarned;2518if (!hard)2519{2520if (cookiesForfeited>=1000000) Game.Win('Sacrifice');2521if (cookiesForfeited>=1000000000) Game.Win('Oblivion');2522if (cookiesForfeited>=1000000000000) Game.Win('From scratch');2523if (cookiesForfeited>=1000000000000000) Game.Win('Nihilism');2524if (cookiesForfeited>=1000000000000000000) Game.Win('Dematerialize');2525if (cookiesForfeited>=1000000000000000000000) Game.Win('Nil zero zilch');2526if (cookiesForfeited>=1000000000000000000000000) Game.Win('Transcendence');2527if (cookiesForfeited>=1000000000000000000000000000) Game.Win('Obliterate');2528if (cookiesForfeited>=1000000000000000000000000000000) Game.Win('Negative void');2529if (cookiesForfeited>=1000000000000000000000000000000000) Game.Win('To crumbs, you say?');2530if (cookiesForfeited>=1000000000000000000000000000000000000) Game.Win('You get nothing');2531if (cookiesForfeited>=1000000000000000000000000000000000000000) Game.Win('Humble rebeginnings');2532if (cookiesForfeited>=1000000000000000000000000000000000000000000) Game.Win('The end of the world');2533if (cookiesForfeited>=1000000000000000000000000000000000000000000000) Game.Win('Oh, you\'re back');2534if (cookiesForfeited>=1000000000000000000000000000000000000000000000000) Game.Win('Lazarus');2535if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000) Game.Win('Smurf account');2536if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000000) Game.Win('If at first you don\'t succeed');25372538if (Math.round(Game.cookies)==1000000000000) Game.Win('When the cookies ascend just right');2539}25402541Game.killBuffs();25422543Game.seed=Game.makeSeed();25442545Game.cookiesReset+=Game.cookiesEarned;2546Game.cookies=0;2547Game.cookiesEarned=0;2548Game.cookieClicks=0;2549Game.goldenClicksLocal=0;2550//Game.goldenClicks=0;2551//Game.missedGoldenClicks=0;2552Game.handmadeCookies=0;2553if (hard)2554{2555Game.bgType=0;2556Game.milkType=0;2557Game.chimeType=0;25582559Game.vault=[];2560}2561Game.pledges=0;2562Game.pledgeT=0;2563Game.elderWrath=0;2564Game.nextResearch=0;2565Game.researchT=0;2566Game.seasonT=0;2567Game.seasonUses=0;2568Game.season=Game.baseSeason;2569Game.computeSeasonPrices();25702571Game.startDate=parseInt(Date.now());2572Game.lastDate=parseInt(Date.now());25732574Game.cookiesSucked=0;2575Game.wrinklersPopped=0;2576Game.ResetWrinklers();25772578Game.santaLevel=0;2579Game.reindeerClicked=0;25802581Game.dragonLevel=0;2582Game.dragonAura=0;2583Game.dragonAura2=0;25842585Game.fortuneGC=0;2586Game.fortuneCPS=0;25872588Game.TickerClicks=0;25892590if (Game.gainedPrestige>0) Game.resets++;2591if (!hard && Game.canLumps() && Game.ascensionMode!=1) Game.addClass('lumpsOn');2592else Game.removeClass('lumpsOn');2593Game.gainedPrestige=0;25942595for (var i in Game.ObjectsById)2596{2597var me=Game.ObjectsById[i];2598me.amount=0;me.bought=0;me.free=0;me.totalCookies=0;2599me.switchMinigame(false);2600if (hard) {me.muted=0;}2601me.pics=[];2602me.refresh();2603}2604for (var i in Game.UpgradesById)2605{2606var me=Game.UpgradesById[i];2607if (hard || me.pool!='prestige') me.bought=0;2608if (hard) me.unlocked=0;2609if (me.pool!='prestige' && !me.lasting)2610{2611if (Game.Has('Keepsakes') && Game.seasonDrops.indexOf(me.name)!=-1 && Math.random()<1/5){}2612else if (Game.ascensionMode==1 && Game.HasAchiev('O Fortuna') && me.tier=='fortune'){}2613else if (Game.HasAchiev('O Fortuna') && me.tier=='fortune' && Math.random()<0.4){}2614else me.unlocked=0;2615}2616}26172618Game.BuildingsOwned=0;2619Game.UpgradesOwned=0;26202621Game.cookiesPsByType={};2622Game.cookiesMultByType={};26232624if (!hard)2625{2626if (Game.ascensionMode!=1)2627{2628for (var i in Game.permanentUpgrades)2629{2630if (Game.permanentUpgrades[i]!=-1)2631{Game.UpgradesById[Game.permanentUpgrades[i]].earn();}2632}2633if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}26342635if (Game.Has('Starter kit')) Game.Objects['Cursor'].getFree(10);2636if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].getFree(5);2637}2638}26392640/*for (var i in Game.AchievementsById)2641{2642var me=Game.AchievementsById[i];2643me.won=0;2644}*/2645//Game.DefaultPrefs();2646BeautifyAll();26472648Game.RebuildUpgrades();2649Game.TickerAge=0;2650Game.TickerEffect=0;2651Game.recalculateGains=1;2652Game.storeToRefresh=1;2653Game.upgradesToRebuild=1;2654Game.killShimmers();26552656Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);26572658Game.LoadMinigames();2659for (var i in Game.ObjectsById)2660{2661var me=Game.ObjectsById[i];2662if (hard && me.minigame && me.minigame.launch) {me.minigame.launch();me.minigame.reset(true);}2663else if (!hard && me.minigame && me.minigame.reset) me.minigame.reset();2664}26652666l('toggleBox').style.display='none';2667l('toggleBox').innerHTML='';2668Game.choiceSelectorOn=-1;2669Game.specialTab='';2670Game.ToggleSpecialMenu(0);26712672l('logButton').classList.remove('hasUpdate');26732674for (var i in Game.customReset) {Game.customReset[i]();}26752676if (hard)2677{2678if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie2679{2680Game.ReincarnateTimer=1;2681Game.addClass('reincarnating');2682Game.BigCookieSize=0;2683}2684if (Game.prefs.popups) Game.Popup('Game reset');2685else Game.Notify('Game reset','So long, cookies.',[21,6],6);2686}2687}2688Game.HardReset=function(bypass)2689{2690if (!bypass)2691{2692Game.Prompt('<h3>Wipe save</h3><div class="block">Do you REALLY want to wipe your save?<br><small>You will lose your progress, your achievements, and your heavenly chips!</small></div>',[['Yes!','Game.ClosePrompt();Game.HardReset(1);'],'No']);2693}2694else if (bypass==1)2695{2696Game.Prompt('<h3>Wipe save</h3><div class="block">Whoah now, are you really, <b><i>REALLY</i></b> sure you want to go through with this?<br><small>Don\'t say we didn\'t warn you!</small></div>',[['Do it!','Game.ClosePrompt();Game.HardReset(2);'],'No']);2697}2698else2699{2700for (var i in Game.AchievementsById)2701{2702var me=Game.AchievementsById[i];2703me.won=0;2704}2705for (var i in Game.ObjectsById)2706{2707var me=Game.ObjectsById[i];2708me.level=0;2709}27102711Game.AchievementsOwned=0;2712Game.goldenClicks=0;2713Game.missedGoldenClicks=0;2714Game.Reset(1);2715Game.resets=0;2716Game.fullDate=parseInt(Date.now());2717Game.bakeryName=Game.GetBakeryName();2718Game.bakeryNameRefresh();2719Game.cookiesReset=0;2720Game.prestige=0;2721Game.heavenlyChips=0;2722Game.heavenlyChipsSpent=0;2723Game.heavenlyCookies=0;2724Game.permanentUpgrades=[-1,-1,-1,-1,-1];2725Game.ascensionMode=0;2726Game.lumps=-1;2727Game.lumpsTotal=-1;2728Game.lumpT=Date.now();2729Game.lumpRefill=0;2730Game.removeClass('lumpsOn');2731}2732}2733273427352736Game.onCrate=0;2737Game.setOnCrate=function(what)2738{2739Game.onCrate=what;2740}2741Game.crate=function(me,context,forceClickStr,id)2742{2743//produce a crate with associated tooltip for an upgrade or achievement2744//me is an object representing the upgrade or achievement2745//context can be "store", "ascend", "stats" or undefined2746//forceClickStr changes what is done when the crate is clicked2747//id is the resulting div's desired id27482749var classes='crate';2750var enabled=0;2751var noFrame=0;2752var attachment='top';2753var neuromancy=0;2754if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;2755var mysterious=0;2756var clickStr='';27572758if (me.type=='upgrade')2759{2760var canBuy=(context=='store'?me.canBuy():true);2761if (context=='stats' && me.bought==0 && !Game.Has('Neuromancy') && (!Game.sesame || me.pool!='debug')) return '';2762else if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;2763else if (context=='store' && !canBuy) enabled=0;2764else if (context=='ascend' && me.bought==0) enabled=0;2765else enabled=1;2766if (me.bought>0) enabled=1;27672768if (context=='stats' && !Game.prefs.crates) noFrame=1;27692770classes+=' upgrade';2771if (me.pool=='prestige') classes+=' heavenly';277227732774if (neuromancy) clickStr='Game.UpgradesById['+me.id+'].toggle();';2775}2776else if (me.type=='achievement')2777{2778if (context=='stats' && me.won==0 && me.pool!='normal') return '';2779else if (context!='stats') enabled=1;27802781if (context=='stats' && !Game.prefs.crates) noFrame=1;27822783classes+=' achievement';2784if (me.pool=='shadow') classes+=' shadow';2785if (me.won>0) enabled=1;2786else mysterious=1;2787if (!enabled) clickStr='Game.AchievementsById['+me.id+'].click();';27882789if (neuromancy) clickStr='Game.AchievementsById['+me.id+'].toggle();';2790}27912792if (context=='store') attachment='store';27932794if (forceClickStr) clickStr=forceClickStr;27952796if (me.choicesFunction) classes+=' selector';279727982799var icon=me.icon;2800if (mysterious) icon=[0,7];28012802if (me.iconFunction) icon=me.iconFunction();28032804if (me.bought && context=='store') enabled=0;28052806if (enabled) classes+=' enabled';// else classes+=' disabled';2807if (noFrame) classes+=' noFrame';28082809var text=[];2810if (Game.sesame)2811{2812if (Game.debuggedUpgradeCpS[me.name] || Game.debuggedUpgradeCpClick[me.name])2813{2814text.push('x'+Beautify(1+Game.debuggedUpgradeCpS[me.name],2));text.push(Game.debugColors[Math.floor(Math.max(0,Math.min(Game.debugColors.length-1,Math.pow(Game.debuggedUpgradeCpS[me.name]/2,0.5)*Game.debugColors.length)))]);2815text.push('x'+Beautify(1+Game.debuggedUpgradeCpClick[me.name],2));text.push(Game.debugColors[Math.floor(Math.max(0,Math.min(Game.debugColors.length-1,Math.pow(Game.debuggedUpgradeCpClick[me.name]/2,0.5)*Game.debugColors.length)))]);2816}2817if (Game.extraInfo) {text.push(Math.floor(me.order)+(me.power?'<br>P:'+me.power:''));text.push('#fff');}2818}2819var textStr='';2820for (var i=0;i<text.length;i+=2)2821{2822textStr+='<div style="opacity:0.9;z-index:1000;padding:0px 2px;background:'+text[i+1]+';color:#000;font-size:10px;position:absolute;top:'+(i/2*10)+'px;left:0px;">'+text[i]+'</div>';2823}28242825return '<div'+2826(clickStr!=''?(' '+Game.clickStr+'="'+clickStr+'"'):'')+2827' class="'+classes+'" '+2828Game.getDynamicTooltip(2829'function(){return Game.crateTooltip(Game.'+(me.type=='upgrade'?'Upgrades':'Achievements')+'ById['+me.id+'],'+(context?'\''+context+'\'':'')+');}',2830attachment,true2831)+2832(id?'id="'+id+'" ':'')+2833'style="'+(mysterious?2834'background-position:'+(-0*48)+'px '+(-7*48)+'px':2835(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px')+';'+2836((context=='ascend' && me.pool=='prestige')?'position:absolute;left:'+me.posX+'px;top:'+me.posY+'px;':'')+2837'">'+2838textStr+2839(me.choicesFunction?'<div class="selectorCorner"></div>':'')+2840'</div>';2841}2842Game.crateTooltip=function(me,context)2843{2844var tags=[];2845mysterious=0;2846var neuromancy=0;2847var price='';2848if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;28492850if (me.type=='upgrade')2851{2852if (me.pool=='prestige') tags.push('Heavenly','#efa438');2853else if (me.pool=='tech') tags.push('Tech','#36a4ff');2854else if (me.pool=='cookie') tags.push('Cookie',0);2855else if (me.pool=='debug') tags.push('Debug','#00c462');2856else if (me.pool=='toggle') tags.push('Switch',0);2857else tags.push('Upgrade',0);28582859if (me.tier!=0 && Game.Has('Label printer')) tags.push('Tier : '+Game.Tiers[me.tier].name,Game.Tiers[me.tier].color);2860if (me.name=='Label printer' && Game.Has('Label printer')) tags.push('Tier : Self-referential','#ff00ea');28612862if (me.isVaulted()) tags.push('Vaulted','#4e7566');28632864if (me.bought>0)2865{2866if (me.pool=='tech') tags.push('Researched',0);2867else if (me.kitten) tags.push('Purrchased',0);2868else tags.push('Purchased',0);2869}28702871if (me.lasting && me.unlocked) tags.push('Unlocked forever','#f2ff87');28722873if (neuromancy && me.bought==0) tags.push('Click to learn!','#00c462');2874else if (neuromancy && me.bought>0) tags.push('Click to unlearn!','#00c462');28752876var canBuy=(context=='store'?me.canBuy():true);2877var cost=me.getPrice();2878if (me.priceLumps>0) cost=me.priceLumps;28792880if (me.priceLumps==0 && cost==0) price='';2881else2882{2883price='<div style="float:right;text-align:right;"><span class="price'+2884(me.priceLumps>0?(' lump'):'')+2885(me.pool=='prestige'?((me.bought || Game.heavenlyChips>=cost)?' heavenly':' heavenly disabled'):'')+2886(context=='store'?(canBuy?'':' disabled'):'')+2887'">'+Beautify(Math.round(cost))+'</span>'+((me.pool!='prestige' && me.priceLumps==0)?Game.costDetails(cost):'')+'</div>';2888}2889}2890else if (me.type=='achievement')2891{2892if (me.pool=='shadow') tags.push('Shadow Achievement','#9700cf');2893else tags.push('Achievement',0);2894if (me.won>0) tags.push('Unlocked',0);2895else {tags.push('Locked',0);mysterious=1;}28962897if (neuromancy && me.won==0) tags.push('Click to win!','#00c462');2898else if (neuromancy && me.won>0) tags.push('Click to lose!','#00c462');2899}29002901var tagsStr='';2902for (var i=0;i<tags.length;i+=2)2903{2904if (i%2==0) tagsStr+=' <div class="tag" style="color:'+(tags[i+1]==0?'#fff':tags[i+1])+';">['+tags[i]+']</div>';2905}2906tagsStr=tagsStr.substring(1);29072908var icon=me.icon;2909if (mysterious) icon=[0,7];29102911if (me.iconFunction) icon=me.iconFunction();291229132914var tip='';2915if (context=='store')2916{2917if (me.pool!='toggle' && me.pool!='tech')2918{2919if (Game.Has('Inspired checklist'))2920{2921if (me.isVaulted()) tip='Upgrade is vaulted and will not be auto-purchased.<br>Click to purchase. Shift-click to unvault.';2922else tip='Click to purchase. Shift-click to vault.';2923if (Game.keys[16]) tip+='<br>(You are holding Shift.)';2924else tip+='<br>(You are not holding Shift.)';2925}2926else tip='Click to purchase.';2927}2928else if (me.pool=='toggle' && me.choicesFunction) tip='Click to open selector.';2929else if (me.pool=='toggle') tip='Click to toggle.';2930else if (me.pool=='tech') tip='Click to research.';2931}29322933var desc=me.desc;2934if (me.descFunc) desc=me.descFunc();2935if (me.bought && context=='store' && me.displayFuncWhenOwned) desc=me.displayFuncWhenOwned()+'<div class="line"></div>'+desc;2936if (me.unlockAt)2937{2938if (me.unlockAt.require)2939{2940var it=Game.Upgrades[me.unlockAt.require];2941desc='<div style="font-size:80%;text-align:center;">From <div class="icon" style="vertical-align:middle;display:inline-block;'+(it.icon[2]?'background-image:url('+it.icon[2]+');':'')+'background-position:'+(-it.icon[0]*48)+'px '+(-it.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> '+it.name+'</div><div class="line"></div>'+desc;2942}2943/*else if (me.unlockAt.season)2944{2945var it=Game.seasons[me.unlockAt.season];2946desc='<div style="font-size:80%;text-align:center;">From <div class="icon" style="vertical-align:middle;display:inline-block;'+(Game.Upgrades[it.trigger].icon[2]?'background-image:url('+Game.Upgrades[it.trigger].icon[2]+');':'')+'background-position:'+(-Game.Upgrades[it.trigger].icon[0]*48)+'px '+(-Game.Upgrades[it.trigger].icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> '+it.name+'</div><div class="line"></div>'+desc;2947}*/2948else if (me.unlockAt.text)2949{2950var it=Game.Upgrades[me.unlockAt.require];2951desc='<div style="font-size:80%;text-align:center;">From <b>'+text+'</b></div><div class="line"></div>'+desc;2952}2953}29542955return '<div style="padding:8px 4px;min-width:350px;">'+2956'<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+2957(me.bought && context=='store'?'':price)+2958'<div class="name">'+(mysterious?'???':me.name)+'</div>'+2959tagsStr+2960'<div class="line"></div><div class="description">'+(mysterious?'???':desc)+'</div></div>'+2961(tip!=''?('<div class="line"></div><div style="font-size:10px;font-weight:bold;color:#999;text-align:center;padding-bottom:4px;line-height:100%;">'+tip+'</div>'):'')+2962(Game.sesame?('<div style="font-size:9px;">Id : '+me.id+' | Order : '+Math.floor(me.order)+(me.tier?' | Tier : '+me.tier:'')+'</div>'):'');2963}29642965Game.costDetails=function(cost)2966{2967if (!Game.Has('Genius accounting')) return '';2968if (!cost) return '';2969var priceInfo='';2970var cps=Game.cookiesPs*(1-Game.cpsSucked);2971if (cost>Game.cookies) priceInfo+='in '+Game.sayTime(((cost-Game.cookies)/cps+1)*Game.fps)+'<br>';2972priceInfo+=Game.sayTime((cost/cps+1)*Game.fps)+' worth<br>';2973priceInfo+=Beautify((cost/Game.cookies)*100,1)+'% of bank<br>';2974return '<div style="font-size:80%;opacity:0.7;line-height:90%;">'+priceInfo+'</div>';2975}297629772978/*=====================================================================================2979PRESTIGE2980=======================================================================================*/29812982Game.HCfactor=3;2983Game.HowMuchPrestige=function(cookies)//how much prestige [cookies] should land you2984{2985return Math.pow(cookies/1000000000000,1/Game.HCfactor);2986}2987Game.HowManyCookiesReset=function(chips)//how many cookies [chips] are worth2988{2989//this must be the inverse of the above function (ie. if cookies=chips^2, chips=cookies^(1/2) )2990return Math.pow(chips,Game.HCfactor)*1000000000000;2991}2992Game.gainedPrestige=0;2993Game.EarnHeavenlyChips=function(cookiesForfeited)2994{2995//recalculate prestige and chips owned2996var prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+cookiesForfeited));2997if (prestige>Game.prestige)//did we gain prestige levels?2998{2999var prestigeDifference=prestige-Game.prestige;3000Game.gainedPrestige=prestigeDifference;3001Game.heavenlyChips+=prestigeDifference;3002Game.prestige=prestige;3003if (Game.prefs.popups) Game.Popup('You gain '+Beautify(prestigeDifference)+' prestige level'+(prestigeDifference==1?'':'s')+'!');3004else Game.Notify('You forfeit your '+Beautify(cookiesForfeited)+' cookies.','You gain <b>'+Beautify(prestigeDifference)+'</b> prestige level'+(prestigeDifference==1?'':'s')+'!',[19,7]);3005}3006}30073008Game.GetHeavenlyMultiplier=function()3009{3010var heavenlyMult=0;3011if (Game.Has('Heavenly chip secret')) heavenlyMult+=0.05;3012if (Game.Has('Heavenly cookie stand')) heavenlyMult+=0.20;3013if (Game.Has('Heavenly bakery')) heavenlyMult+=0.25;3014if (Game.Has('Heavenly confectionery')) heavenlyMult+=0.25;3015if (Game.Has('Heavenly key')) heavenlyMult+=0.25;3016//if (Game.hasAura('Dragon God')) heavenlyMult*=1.05;3017heavenlyMult*=1+Game.auraMult('Dragon God')*0.05;3018if (Game.Has('Lucky digit')) heavenlyMult*=1.01;3019if (Game.Has('Lucky number')) heavenlyMult*=1.01;3020if (Game.Has('Lucky payout')) heavenlyMult*=1.01;3021if (Game.hasGod)3022{3023var godLvl=Game.hasGod('creation');3024if (godLvl==1) heavenlyMult*=0.7;3025else if (godLvl==2) heavenlyMult*=0.8;3026else if (godLvl==3) heavenlyMult*=0.9;3027}3028return heavenlyMult;3029}30303031Game.ascensionModes={30320:{name:'None',desc:'No special modifiers.',icon:[10,0]},30331:{name:'Born again',desc:'This run will behave as if you\'d just started the game from scratch. Prestige levels and heavenly upgrades will have no effect, as will sugar lumps and building levels. Perma-upgrades and minigames will be unavailable.<div class="line"></div>Some achievements are only available in this mode.',icon:[2,7]}/*,30342:{name:'Trigger finger',desc:'In this run, scrolling your mouse wheel on the cookie counts as clicking it. Some upgrades introduce new clicking behaviors.<br>No clicking achievements may be obtained in this mode.<div class="line"></div>Reaching 1 quadrillion cookies in this mode unlocks a special heavenly upgrade.',icon:[12,0]}*/3035};30363037Game.ascendMeterPercent=0;3038Game.ascendMeterPercentT=0;3039Game.ascendMeterLevel=100000000000000000000000000000;30403041Game.nextAscensionMode=0;3042Game.UpdateAscensionModePrompt=function()3043{3044var icon=Game.ascensionModes[Game.nextAscensionMode].icon;3045var name=Game.ascensionModes[Game.nextAscensionMode].name;3046l('ascendModeButton').innerHTML=3047'<div class="crate noFrame enabled" '+Game.clickStr+'="Game.PickAscensionMode();" '+Game.getTooltip(3048'<div style="min-width:200px;text-align:center;font-size:11px;">Challenge mode for the next run :<br><b>'+name+'</b><div class="line"></div>Challenge modes apply special modifiers to your next ascension.<br>Click to change.</div>'3049,'bottom-right')+' style="opacity:1;float:none;display:block;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';3050}3051Game.PickAscensionMode=function()3052{3053PlaySound('snd/tick.mp3');3054Game.tooltip.hide();30553056var str='';3057for (var i in Game.ascensionModes)3058{3059var icon=Game.ascensionModes[i].icon;3060str+='<div class="crate enabled'+(i==Game.nextAscensionMode?' highlighted':'')+'" id="challengeModeSelector'+i+'" style="opacity:1;float:none;display:inline-block;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="Game.nextAscensionMode='+i+';Game.PickAscensionMode();PlaySound(\'snd/tick.mp3\');Game.choiceSelectorOn=-1;" onMouseOut="l(\'challengeSelectedName\').innerHTML=Game.ascensionModes[Game.nextAscensionMode].name;l(\'challengeSelectedDesc\').innerHTML=Game.ascensionModes[Game.nextAscensionMode].desc;" onMouseOver="l(\'challengeSelectedName\').innerHTML=Game.ascensionModes['+i+'].name;l(\'challengeSelectedDesc\').innerHTML=Game.ascensionModes['+i+'].desc;"'+3061'></div>';3062}3063Game.Prompt('<h3>Select a challenge mode</h3>'+3064'<div class="line"></div><div class="crateBox">'+str+'</div><h4 id="challengeSelectedName">'+Game.ascensionModes[Game.nextAscensionMode].name+'</h4><div class="line"></div><div id="challengeSelectedDesc" style="min-height:128px;">'+Game.ascensionModes[Game.nextAscensionMode].desc+'</div><div class="line"></div>'3065,[['Confirm','Game.UpdateAscensionModePrompt();Game.ClosePrompt();']],0,'widePrompt');3066}30673068Game.UpdateLegacyPrompt=function()3069{3070if (!l('legacyPromptData')) return 0;3071var date=new Date();3072date.setTime(Date.now()-Game.startDate);3073var timeInSeconds=date.getTime()/1000;3074var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);30753076var ascendNowToGet=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)-Game.HowMuchPrestige(Game.cookiesReset));3077var cookiesToNext=Math.floor(Game.HowManyCookiesReset(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)+1)-Game.cookiesReset-Game.cookiesEarned);3078l('legacyPromptData').innerHTML=''+3079'<div class="icon" style="pointer-event:none;transform:scale(2);opacity:0.25;position:absolute;right:-8px;bottom:-8px;background-position:'+(-19*48)+'px '+(-7*48)+'px;"></div>'+3080'<div class="listing"><b>Run duration :</b> '+(startDate==''?'tiny':(startDate))+'</div>'+3081//'<div class="listing">Earned : '+Beautify(Game.cookiesEarned)+', Reset : '+Beautify(Game.cookiesReset)+'</div>'+3082'<div class="listing"><b>Prestige level :</b> '+Beautify(Game.prestige)+'</div>'+3083'<div class="listing"><b>Heavenly chips :</b> '+Beautify(Game.heavenlyChips)+'</div>'+3084(ascendNowToGet>=1?('<div class="listing"><b>Ascending now will produce :</b> '+Beautify(ascendNowToGet)+' heavenly chip'+((ascendNowToGet)==1?'':'s')+'</div>'):3085('<div class="listing warning"><b>'+Beautify(cookiesToNext)+'</b> more cookie'+((cookiesToNext)==1?'':'s')+' for the next prestige level.<br>You may ascend now, but will gain no benefits.</div>'))+3086'';3087if (1 || ascendNowToGet>=1) l('promptOption0').style.display='inline-block'; else l('promptOption0').style.display='none';3088}30893090l('ascendOverlay').innerHTML=3091'<div id="ascendBox">'+3092'<div class="ascendData smallFramed prompt" '+Game.getTooltip(3093'<div style="min-width:200px;text-align:center;font-size:11px;">Each prestige level grants you a permanent +1% CpS.<br>The more levels you have, the more cookies they require.</div>'3094,'bottom-right')+' style="margin-top:8px;"><h3 id="ascendPrestige"></h3></div>'+3095'<div class="ascendData smallFramed prompt" '+Game.getTooltip(3096'<div style="min-width:200px;text-align:center;font-size:11px;">Heavenly chips are used to buy heavenly upgrades.<br>You gain 1 chip every time you gain a prestige level.</div>'3097,'bottom-right')+'><h3 id="ascendHCs"></h3></div>'+3098'<a id="ascendButton" class="option framed large red" '+Game.getTooltip(3099'<div style="min-width:200px;text-align:center;font-size:11px;">Click this once you\'ve bought<br>everything you need!</div>'3100,'bottom-right')+' style="font-size:16px;margin-top:0px;"><span class="fancyText" style="font-size:20px;">Reincarnate</span></a>'+3101'<div id="ascendModeButton" style="position:absolute;right:34px;bottom:25px;display:none;"></div>'+3102'<input type="text" style="display:block;" id="upgradePositions"/></div>'+31033104'<div id="ascendInfo"><div class="ascendData smallFramed" style="margin-top:22px;width:40%;font-size:11px;">You are ascending.<br>Drag the screen around<br>or use arrow keys!<br>When you\'re ready,<br>click Reincarnate.</div></div>';31053106Game.UpdateAscensionModePrompt();31073108AddEvent(l('ascendButton'),'click',function(){3109PlaySound('snd/tick.mp3');3110Game.Reincarnate();3111});31123113Game.ascendl=l('ascend');3114Game.ascendContentl=l('ascendContent');3115Game.ascendZoomablel=l('ascendZoomable');3116Game.ascendUpgradesl=l('ascendUpgrades');3117Game.OnAscend=0;3118Game.AscendTimer=0;//how far we are into the ascend animation3119Game.AscendDuration=Game.fps*5;//how long the ascend animation is3120Game.AscendBreakpoint=Game.AscendDuration*0.5;//at which point the cookie explodes during the ascend animation3121Game.UpdateAscendIntro=function()3122{3123if (Game.AscendTimer==1) PlaySound('snd/charging.mp3');3124if (Game.AscendTimer==Math.floor(Game.AscendBreakpoint)) PlaySound('snd/thud.mp3');3125Game.AscendTimer++;3126if (Game.AscendTimer>Game.AscendDuration)//end animation and launch ascend screen3127{3128PlaySound('snd/cymbalRev.mp3',0.5);3129PlaySound('snd/choir.mp3');3130Game.EarnHeavenlyChips(Game.cookiesEarned);3131Game.AscendTimer=0;3132Game.OnAscend=1;Game.removeClass('ascendIntro');3133Game.addClass('ascending');3134Game.BuildAscendTree();3135Game.heavenlyChipsDisplayed=Game.heavenlyChips;3136Game.nextAscensionMode=0;3137Game.ascensionMode=0;3138Game.UpdateAscensionModePrompt();3139}3140}3141Game.ReincarnateTimer=0;//how far we are into the reincarnation animation3142Game.ReincarnateDuration=Game.fps*1;//how long the reincarnation animation is3143Game.UpdateReincarnateIntro=function()3144{3145if (Game.ReincarnateTimer==1) PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);3146Game.ReincarnateTimer++;3147if (Game.ReincarnateTimer>Game.ReincarnateDuration)//end animation and launch regular game3148{3149Game.ReincarnateTimer=0;3150Game.removeClass('reincarnating');3151}3152}3153Game.Reincarnate=function(bypass)3154{3155if (!bypass) Game.Prompt('<h3>Reincarnate</h3><div class="block">Are you ready to return to the mortal world?</div>',[['Yes','Game.ClosePrompt();Game.Reincarnate(1);'],'No']);3156else3157{3158Game.ascendUpgradesl.innerHTML='';3159Game.ascensionMode=Game.nextAscensionMode;3160Game.nextAscensionMode=0;3161Game.Reset();3162if (Game.HasAchiev('Rebirth'))3163{3164if (Game.prefs.popups) Game.Popup('Reincarnated');3165else Game.Notify('Reincarnated','Hello, cookies!',[10,0],4);3166}3167if (Game.resets>=1000) Game.Win('Endless cycle');3168if (Game.resets>=100) Game.Win('Reincarnation');3169if (Game.resets>=10) Game.Win('Resurrection');3170if (Game.resets>=1) Game.Win('Rebirth');3171Game.removeClass('ascending');3172Game.OnAscend=0;3173//trigger the reincarnate animation3174Game.ReincarnateTimer=1;3175Game.addClass('reincarnating');3176Game.BigCookieSize=0;3177}3178}3179Game.GiveUpAscend=function(bypass)3180{3181if (!bypass) Game.Prompt('<h3>Give up</h3><div class="block">Are you sure? You\'ll have to start this run over and won\'t gain any heavenly chips!</div>',[['Yes','Game.ClosePrompt();Game.GiveUpAscend(1);'],'No']);3182else3183{3184if (Game.prefs.popups) Game.Popup('Game reset');3185else Game.Notify('Gave up','Let\'s try this again!',[0,5],4);3186Game.Reset();3187}3188}3189Game.Ascend=function(bypass)3190{3191if (!bypass) Game.Prompt('<h3>Ascend</h3><div class="block">Do you REALLY want to ascend?<div class="line"></div>You will lose your progress and start over from scratch.<div class="line"></div>All your cookies will be converted into prestige and heavenly chips.<div class="line"></div>You will keep your achievements'+(Game.canLumps()?', building levels and sugar lumps':'')+'.</div>',[['Yes!','Game.ClosePrompt();Game.Ascend(1);'],'No']);3192else3193{3194if (Game.prefs.popups) Game.Popup('Ascending');3195else Game.Notify('Ascending','So long, cookies.',[20,7],4);3196Game.OnAscend=0;Game.removeClass('ascending');3197Game.addClass('ascendIntro');3198//trigger the ascend animation3199Game.AscendTimer=1;3200Game.killShimmers();3201l('toggleBox').style.display='none';3202l('toggleBox').innerHTML='';3203Game.choiceSelectorOn=-1;3204Game.ToggleSpecialMenu(0);3205Game.AscendOffX=0;3206Game.AscendOffY=0;3207Game.AscendOffXT=0;3208Game.AscendOffYT=0;3209Game.AscendZoomT=1;3210Game.AscendZoom=0.2;3211}3212}32133214Game.DebuggingPrestige=0;3215Game.AscendDragX=0;3216Game.AscendDragY=0;3217Game.AscendOffX=0;3218Game.AscendOffY=0;3219Game.AscendZoom=1;3220Game.AscendOffXT=0;3221Game.AscendOffYT=0;3222Game.AscendZoomT=1;3223Game.AscendDragging=0;3224Game.AscendGridSnap=24;3225Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};3226Game.UpdateAscend=function()3227{3228if (Game.keys[37]) Game.AscendOffXT+=16*(1/Game.AscendZoomT);3229if (Game.keys[38]) Game.AscendOffYT+=16*(1/Game.AscendZoomT);3230if (Game.keys[39]) Game.AscendOffXT-=16*(1/Game.AscendZoomT);3231if (Game.keys[40]) Game.AscendOffYT-=16*(1/Game.AscendZoomT);32323233if (Game.AscendOffXT>-Game.heavenlyBounds.left) Game.AscendOffXT=-Game.heavenlyBounds.left;3234if (Game.AscendOffXT<-Game.heavenlyBounds.right) Game.AscendOffXT=-Game.heavenlyBounds.right;3235if (Game.AscendOffYT>-Game.heavenlyBounds.top) Game.AscendOffYT=-Game.heavenlyBounds.top;3236if (Game.AscendOffYT<-Game.heavenlyBounds.bottom) Game.AscendOffYT=-Game.heavenlyBounds.bottom;3237Game.AscendOffX+=(Game.AscendOffXT-Game.AscendOffX)*0.5;3238Game.AscendOffY+=(Game.AscendOffYT-Game.AscendOffY)*0.5;3239Game.AscendZoom+=(Game.AscendZoomT-Game.AscendZoom)*0.25;3240if (Math.abs(Game.AscendZoomT-Game.AscendZoom)<0.005) Game.AscendZoom=Game.AscendZoomT;32413242if (Game.DebuggingPrestige)3243{3244for (var i in Game.PrestigeUpgrades)3245{3246var me=Game.PrestigeUpgrades[i];3247AddEvent(l('heavenlyUpgrade'+me.id),'mousedown',function(me){return function(){3248if (!Game.DebuggingPrestige) return;3249Game.SelectedHeavenlyUpgrade=me;3250}}(me));3251AddEvent(l('heavenlyUpgrade'+me.id),'mouseup',function(me){return function(){3252if (Game.SelectedHeavenlyUpgrade==me) {Game.SelectedHeavenlyUpgrade=0;Game.BuildAscendTree();}3253}}(me));3254}3255}32563257if (Game.mouseDown && !Game.promptOn)3258{3259if (!Game.AscendDragging)3260{3261Game.AscendDragX=Game.mouseX;3262Game.AscendDragY=Game.mouseY;3263}3264Game.AscendDragging=1;32653266if (Game.DebuggingPrestige)3267{3268if (Game.SelectedHeavenlyUpgrade)3269{3270Game.tooltip.hide();3271//drag upgrades around3272var me=Game.SelectedHeavenlyUpgrade;3273me.posX+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);3274me.posY+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);3275var posX=me.posX;//Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;3276var posY=me.posY;//Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;3277l('heavenlyUpgrade'+me.id).style.left=Math.floor(posX)+'px';3278l('heavenlyUpgrade'+me.id).style.top=Math.floor(posY)+'px';3279for (var ii in me.parents)3280{3281var origX=0;3282var origY=0;3283var targX=me.posX+28;3284var targY=me.posY+28;3285if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}3286var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;3287if (targX<=origX) rot+=180;3288var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));3289//l('heavenlyLink'+me.id+'-'+ii).style='width:'+dist+'px;-webkit-transform:rotate('+rot+'deg);-moz-transform:rotate('+rot+'deg);-ms-transform:rotate('+rot+'deg);-o-transform:rotate('+rot+'deg);transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;';3290l('heavenlyLink'+me.id+'-'+ii).style='width:'+dist+'px;transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;';3291}3292}3293}3294if (!Game.SelectedHeavenlyUpgrade)3295{3296Game.AscendOffXT+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);3297Game.AscendOffYT+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);3298}3299Game.AscendDragX=Game.mouseX;3300Game.AscendDragY=Game.mouseY;3301}3302else3303{3304/*if (Game.SelectedHeavenlyUpgrade)3305{3306var me=Game.SelectedHeavenlyUpgrade;3307me.posX=Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;3308me.posY=Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;3309l('heavenlyUpgrade'+me.id).style.left=me.posX+'px';3310l('heavenlyUpgrade'+me.id).style.top=me.posY+'px';3311}*/3312Game.AscendDragging=0;3313Game.SelectedHeavenlyUpgrade=0;3314}3315if (Game.Click || Game.promptOn)3316{3317Game.AscendDragging=0;3318}33193320//Game.ascendl.style.backgroundPosition=Math.floor(Game.AscendOffX/2)+'px '+Math.floor(Game.AscendOffY/2)+'px';3321//Game.ascendl.style.backgroundPosition=Math.floor(Game.AscendOffX/2)+'px '+Math.floor(Game.AscendOffY/2)+'px,'+Math.floor(Game.AscendOffX/4)+'px '+Math.floor(Game.AscendOffY/4)+'px';3322//Game.ascendContentl.style.left=Math.floor(Game.AscendOffX)+'px';3323//Game.ascendContentl.style.top=Math.floor(Game.AscendOffY)+'px';3324Game.ascendContentl.style.webkitTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';3325Game.ascendContentl.style.msTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';3326Game.ascendContentl.style.oTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';3327Game.ascendContentl.style.mozTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';3328Game.ascendContentl.style.transform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';3329Game.ascendZoomablel.style.webkitTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';3330Game.ascendZoomablel.style.msTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';3331Game.ascendZoomablel.style.oTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';3332Game.ascendZoomablel.style.mozTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';3333Game.ascendZoomablel.style.transform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';33343335//if (Game.Scroll!=0) Game.ascendContentl.style.transformOrigin=Math.floor(Game.windowW/2-Game.mouseX)+'px '+Math.floor(Game.windowH/2-Game.mouseY)+'px';3336if (Game.Scroll<0 && !Game.promptOn) {Game.AscendZoomT=0.5;}3337if (Game.Scroll>0 && !Game.promptOn) {Game.AscendZoomT=1;}33383339if (Game.T%2==0)3340{3341l('ascendPrestige').innerHTML='Prestige level :<br>'+Beautify(Game.prestige);3342l('ascendHCs').innerHTML='Heavenly chips :<br><span class="price heavenly">'+Beautify(Math.round(Game.heavenlyChipsDisplayed))+'</span>';3343if (Game.prestige>0) l('ascendModeButton').style.display='block';3344else l('ascendModeButton').style.display='none';3345}3346Game.heavenlyChipsDisplayed+=(Game.heavenlyChips-Game.heavenlyChipsDisplayed)*0.4;33473348if (Game.DebuggingPrestige && Game.T%10==0)3349{3350var str='';3351for (var i in Game.PrestigeUpgrades)3352{3353var me=Game.PrestigeUpgrades[i];3354str+=me.id+':['+Math.floor(me.posX)+','+Math.floor(me.posY)+'],';3355}3356l('upgradePositions').value='Game.UpgradePositions={'+str+'};';3357}3358//if (Game.T%5==0) Game.BuildAscendTree();3359}3360Game.AscendRefocus=function()3361{3362Game.AscendOffX=0;3363Game.AscendOffY=0;3364Game.ascendl.className='';3365}33663367Game.SelectedHeavenlyUpgrade=0;3368Game.PurchaseHeavenlyUpgrade=function(what)3369{3370//if (Game.Has('Neuromancy')) Game.UpgradesById[what].toggle(); else3371if (Game.UpgradesById[what].buy())3372{3373if (l('heavenlyUpgrade'+what)){var rect=l('heavenlyUpgrade'+what).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}3374//Game.BuildAscendTree();3375}3376}3377Game.BuildAscendTree=function()3378{3379var str='';3380Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};33813382if (Game.DebuggingPrestige) l('upgradePositions').style.display='block'; else l('upgradePositions').style.display='none';33833384for (var i in Game.PrestigeUpgrades)3385{3386var me=Game.PrestigeUpgrades[i];3387me.canBePurchased=1;3388if (!me.bought && !Game.DebuggingPrestige)3389{3390if (me.showIf && !me.showIf()) me.canBePurchased=0;3391else3392{3393for (var ii in me.parents)3394{3395if (me.parents[ii]!=-1 && !me.parents[ii].bought) me.canBePurchased=0;3396}3397}3398}3399}3400str+='<div class="crateBox" style="filter:none;-webkit-filter:none;">';//chrome is still bad at these3401for (var i in Game.PrestigeUpgrades)3402{3403var me=Game.PrestigeUpgrades[i];34043405var ghosted=0;3406if (me.canBePurchased || Game.Has('Neuromancy'))3407{3408str+=Game.crate(me,'ascend','Game.PurchaseHeavenlyUpgrade('+me.id+');','heavenlyUpgrade'+me.id);3409}3410else3411{3412for (var ii in me.parents)3413{3414if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;3415}3416if (me.showIf && !me.showIf()) ghosted=0;3417if (ghosted)3418{3419//maybe replace this with Game.crate()3420str+='<div class="crate upgrade heavenly ghosted" id="heavenlyUpgrade'+me.id+'" style="position:absolute;left:'+me.posX+'px;top:'+me.posY+'px;'+(me.icon[2]?'background-image:url('+me.icon[2]+');':'')+'background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>';3421}3422}3423if (me.canBePurchased || Game.Has('Neuromancy') || ghosted)3424{3425if (me.posX<Game.heavenlyBounds.left) Game.heavenlyBounds.left=me.posX;3426if (me.posX>Game.heavenlyBounds.right) Game.heavenlyBounds.right=me.posX;3427if (me.posY<Game.heavenlyBounds.top) Game.heavenlyBounds.top=me.posY;3428if (me.posY>Game.heavenlyBounds.bottom) Game.heavenlyBounds.bottom=me.posY;3429}3430for (var ii in me.parents)//create pulsing links3431{3432if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))3433{3434var origX=0;3435var origY=0;3436var targX=me.posX+28;3437var targY=me.posY+28;3438if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}3439var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;3440if (targX<=origX) rot+=180;3441var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));3442str+='<div class="parentLink" id="heavenlyLink'+me.id+'-'+ii+'" style="'+(ghosted?'opacity:0.1;':'')+'width:'+dist+'px;-webkit-transform:rotate('+rot+'deg);-moz-transform:rotate('+rot+'deg);-ms-transform:rotate('+rot+'deg);-o-transform:rotate('+rot+'deg);transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;"></div>';3443}3444}3445}3446Game.heavenlyBounds.left-=128;3447Game.heavenlyBounds.top-=128;3448Game.heavenlyBounds.right+=128+64;3449Game.heavenlyBounds.bottom+=128+64;3450//str+='<div style="border:1px solid red;position:absolute;left:'+Game.heavenlyBounds.left+'px;width:'+(Game.heavenlyBounds.right-Game.heavenlyBounds.left)+'px;top:'+Game.heavenlyBounds.top+'px;height:'+(Game.heavenlyBounds.bottom-Game.heavenlyBounds.top)+'px;"></div>';3451str+='</div>';3452Game.ascendUpgradesl.innerHTML=str;3453}345434553456/*=====================================================================================3457COALESCING SUGAR LUMPS3458=======================================================================================*/3459Game.lumpMatureAge=1;3460Game.lumpRipeAge=1;3461Game.lumpOverripeAge=1;3462Game.lumpCurrentType=0;3463l('comments').innerHTML=l('comments').innerHTML+3464'<div id="lumps" onclick="Game.clickLump();" '+Game.getDynamicTooltip('Game.lumpTooltip','bottom')+'><div id="lumpsIcon" class="usesIcon"></div><div id="lumpsIcon2" class="usesIcon"></div><div id="lumpsAmount">0</div></div>';3465Game.lumpTooltip=function()3466{3467var str='<div style="padding:8px;width:400px;font-size:11px;text-align:center;">'+3468'You have <span class="price lump">'+Beautify(Game.lumps)+' sugar lump'+(Game.lumps==1?'':'s')+'</span>.'+3469'<div class="line"></div>'+3470'A <b>sugar lump</b> is coalescing here, attracted by your accomplishments.';34713472var age=Date.now()-Game.lumpT;3473str+='<div class="line"></div>';3474if (age<Game.lumpMatureAge) str+='This sugar lump is still growing and will take <b>'+Game.sayTime(((Game.lumpMatureAge-age)/1000+1)*Game.fps,-1)+'</b> to reach maturity.';3475else if (age<Game.lumpRipeAge) str+='This sugar lump is mature and will be ripe in <b>'+Game.sayTime(((Game.lumpRipeAge-age)/1000+1)*Game.fps,-1)+'</b>.<br>You may <b>click it to harvest it now</b>, but there is a <b>50% chance you won\'t get anything</b>.';3476else if (age<Game.lumpOverripeAge) str+='<b>This sugar lump is ripe! Click it to harvest it.</b><br>If you do nothing, it will auto-harvest in <b>'+Game.sayTime(((Game.lumpOverripeAge-age)/1000+1)*Game.fps,-1)+'</b>.';34773478var phase=(age/Game.lumpOverripeAge)*7;3479if (phase>=3)3480{3481if (Game.lumpCurrentType!=0) str+='<div class="line"></div>';3482if (Game.lumpCurrentType==1) str+='This sugar lump grew to be <b>bifurcated</b>; harvesting it has a 50% chance of yielding two lumps.';3483else if (Game.lumpCurrentType==2) str+='This sugar lump grew to be <b>golden</b>; harvesting it will yield 2 to 7 lumps, your current cookies will be doubled (capped to a gain of 24 hours of your CpS), and you will find 10% more golden cookies for the next 24 hours.';3484else if (Game.lumpCurrentType==3) str+='This sugar lump was affected by the elders and grew to be <b>meaty</b>; harvesting it will yield between 0 and 2 lumps.';3485else if (Game.lumpCurrentType==4) str+='This sugar lump is <b>caramelized</b>, its stickiness binding it to unexpected things; harvesting it will yield between 1 and 3 lumps and will refill your sugar lump cooldowns.';3486}34873488str+='<div class="line"></div>';3489str+='Your sugar lumps mature after <b>'+Game.sayTime((Game.lumpMatureAge/1000)*Game.fps,-1)+'</b>,<br>ripen after <b>'+Game.sayTime((Game.lumpRipeAge/1000)*Game.fps,-1)+'</b>,<br>and fall after <b>'+Game.sayTime((Game.lumpOverripeAge/1000)*Game.fps,-1)+'</b>.';34903491str+='<div class="line"></div>'+3492'• Sugar lumps can be harvested when mature, though if left alone beyond that point they will start ripening (increasing the chance of harvesting them) and will eventually fall and be auto-harvested after some time.<br>• Sugar lumps are delicious and may be used as currency for all sorts of things.<br>• Once a sugar lump is harvested, another one will start growing in its place.<br>• Note that sugar lumps keep growing when the game is closed.';34933494str+='</div>';3495return str;3496}3497Game.computeLumpTimes=function()3498{3499var hour=1000*60*60;3500Game.lumpMatureAge=hour*20;3501Game.lumpRipeAge=hour*23;3502if (Game.Has('Stevia Caelestis')) Game.lumpRipeAge-=hour;3503if (Game.Has('Diabetica Daemonicus')) Game.lumpMatureAge-=hour;3504if (Game.Has('Ichor syrup')) Game.lumpMatureAge-=1000*60*7;3505if (Game.Has('Sugar aging process')) Game.lumpRipeAge-=6000*Math.min(600,Game.Objects['Grandma'].amount);//capped at 600 grandmas3506if (Game.hasGod && Game.BuildingsOwned%10==0)3507{3508var godLvl=Game.hasGod('order');3509if (godLvl==1) Game.lumpRipeAge-=hour;3510else if (godLvl==2) Game.lumpRipeAge-=(hour/3)*2;3511else if (godLvl==3) Game.lumpRipeAge-=(hour/3);3512}3513//if (Game.hasAura('Dragon\'s Curve')) {Game.lumpMatureAge/=1.05;Game.lumpRipeAge/=1.05;}3514Game.lumpMatureAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;Game.lumpRipeAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;3515Game.lumpOverripeAge=Game.lumpRipeAge+hour;3516if (Game.Has('Glucose-charged air')) {Game.lumpMatureAge/=2000;Game.lumpRipeAge/=2000;Game.lumpOverripeAge/=2000;}3517}3518Game.loadLumps=function(time)3519{3520Game.computeLumpTimes();3521//Game.computeLumpType();3522if (!Game.canLumps()) Game.removeClass('lumpsOn');3523else3524{3525if (Game.ascensionMode!=1) Game.addClass('lumpsOn');3526Game.lumpT=Math.min(Date.now(),Game.lumpT);3527var age=Math.max(Date.now()-Game.lumpT,0);3528var amount=Math.floor(age/Game.lumpOverripeAge);//how many lumps did we harvest since we closed the game?3529if (amount>=1)3530{3531Game.harvestLumps(1,true);3532Game.lumpCurrentType=0;//all offline lumps after the first one have a normal type3533if (amount>1) Game.harvestLumps(amount-1,true);3534if (Game.prefs.popups) Game.Popup('Harvested '+Beautify(amount)+' sugar lump'+(amount==1?'':'s')+' while you were away');3535else Game.Notify('','You harvested <b>'+Beautify(amount)+'</b> sugar lump'+(amount==1?'':'s')+' while you were away.',[29,14]);3536Game.lumpT=Date.now()-(age-amount*Game.lumpOverripeAge);3537Game.computeLumpType();3538}3539}3540}3541Game.gainLumps=function(total)3542{3543if (Game.lumpsTotal==-1){Game.lumpsTotal=0;Game.lumps=0;}3544Game.lumps+=total;3545Game.lumpsTotal+=total;35463547if (Game.lumpsTotal>=7) Game.Win('Dude, sweet');3548if (Game.lumpsTotal>=30) Game.Win('Sugar rush');3549if (Game.lumpsTotal>=365) Game.Win('Year\'s worth of cavities');3550}3551Game.clickLump=function()3552{3553if (!Game.canLumps()) return;3554var age=Date.now()-Game.lumpT;3555if (age<Game.lumpMatureAge) {}3556else if (age<Game.lumpRipeAge)3557{3558var amount=choose([0,1]);3559if (amount!=0) Game.Win('Hand-picked');3560Game.harvestLumps(amount);3561Game.computeLumpType();3562}3563else if (age<Game.lumpOverripeAge)3564{3565Game.harvestLumps(1);3566Game.computeLumpType();3567}3568}3569Game.harvestLumps=function(amount,silent)3570{3571if (!Game.canLumps()) return;3572Game.lumpT=Date.now();3573var total=amount;3574if (Game.lumpCurrentType==1 && Game.Has('Sucralosia Inutilis') && Math.random()<0.05) total*=2;3575else if (Game.lumpCurrentType==1) total*=choose([1,2]);3576else if (Game.lumpCurrentType==2)3577{3578total*=choose([2,3,4,5,6,7]);3579Game.gainBuff('sugar blessing',24*60*60,1);3580Game.Earn(Math.min(Game.cookiesPs*60*60*24,Game.cookies));3581if (Game.prefs.popups) Game.Popup('Sugar blessing activated!');3582else Game.Notify('Sugar blessing activated!','Your cookies have been doubled.<br>+10% golden cookies for the next 24 hours.',[29,16]);3583}3584else if (Game.lumpCurrentType==3) total*=choose([0,0,1,2,2]);3585else if (Game.lumpCurrentType==4)3586{3587total*=choose([1,2,3]);3588Game.lumpRefill=0;//Date.now()-Game.getLumpRefillMax();3589if (Game.prefs.popups) Game.Popup('Sugar lump cooldowns cleared!');3590else Game.Notify('Sugar lump cooldowns cleared!','',[29,27]);3591}3592total=Math.floor(total);3593Game.gainLumps(total);3594if (Game.lumpCurrentType==1) Game.Win('Sugar sugar');3595else if (Game.lumpCurrentType==2) Game.Win('All-natural cane sugar');3596else if (Game.lumpCurrentType==3) Game.Win('Sweetmeats');3597else if (Game.lumpCurrentType==4) Game.Win('Maillard reaction');35983599if (!silent)3600{3601var rect=l('lumpsIcon2').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);3602if (total>0) Game.Popup('<small>+'+Beautify(total)+' sugar lump'+(total==1?'':'s')+'</small>',(rect.left+rect.right)/2,(rect.top+rect.bottom)/2-48);3603else Game.Popup('<small>Botched harvest!</small>',(rect.left+rect.right)/2,(rect.top+rect.bottom)/2-48);3604PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);3605}3606Game.computeLumpTimes();3607}3608Game.computeLumpType=function()3609{3610Math.seedrandom(Game.seed+'/'+Game.lumpT);3611var types=[0];3612var loop=1;3613//if (Game.hasAura('Dragon\'s Curve')) loop=2;3614loop+=Game.auraMult('Dragon\'s Curve');3615loop=randomFloor(loop);3616for (var i=0;i<loop;i++)3617{3618if (Math.random()<(Game.Has('Sucralosia Inutilis')?0.15:0.1)) types.push(1);//bifurcated3619if (Math.random()<3/1000) types.push(2);//golden3620if (Math.random()<0.1*Game.elderWrath) types.push(3);//meaty3621if (Math.random()<1/50) types.push(4);//caramelized3622}3623Game.lumpCurrentType=choose(types);3624Math.seedrandom();3625}36263627Game.canLumps=function()//grammatically pleasing function name3628{3629if (Game.lumpsTotal>-1 || (Game.ascensionMode!=1 && (Game.cookiesEarned+Game.cookiesReset)>=1000000000)) return true;3630return false;3631}36323633Game.getLumpRefillMax=function()3634{3635return Game.fps*60*15;//1000*60*15;//15 minutes3636}3637Game.getLumpRefillRemaining=function()3638{3639return Game.lumpRefill;//Game.getLumpRefillMax()-(Date.now()-Game.lumpRefill);3640}3641Game.canRefillLump=function()3642{3643return Game.lumpRefill<=0;//((Date.now()-Game.lumpRefill)>=Game.getLumpRefillMax());3644}3645Game.refillLump=function(n,func)3646{3647if (Game.lumps>=n && Game.canRefillLump())3648{3649Game.spendLump(n,'refill',function()3650{3651if (!Game.sesame) Game.lumpRefill=Game.getLumpRefillMax();//Date.now();3652func();3653})();3654}3655}3656Game.spendLump=function(n,str,func)3657{3658//ask if we want to spend N lumps3659return function()3660{3661if (Game.lumps<n) return false;3662if (Game.prefs.askLumps)3663{3664PlaySound('snd/tick.mp3');3665Game.promptConfirmFunc=func;//bit dumb3666Game.Prompt('<div class="icon" style="background:url(img/icons.png?v='+Game.version+');float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-29*48)+'px '+(-14*48)+'px;"></div><div style="margin:16px 8px;">Do you want to spend <b>'+Beautify(n)+' lump'+(n!=1?'s':'')+'</b> to '+str+'?</div>',[['Yes','Game.lumps-='+n+';Game.promptConfirmFunc();Game.promptConfirmFunc=0;Game.recalculateGains=1;Game.ClosePrompt();'],'No']);3667return false;3668}3669else3670{3671Game.lumps-=n;3672func();3673Game.recalculateGains=1;3674}3675}3676}36773678Game.doLumps=function()3679{3680if (Game.lumpRefill>0) Game.lumpRefill--;36813682if (!Game.canLumps()) {Game.removeClass('lumpsOn');return;}3683if (Game.lumpsTotal==-1)3684{3685//first time !3686if (Game.ascensionMode!=1) Game.addClass('lumpsOn');3687Game.lumpT-Date.now();3688Game.lumpsTotal=0;3689Game.lumps=0;3690Game.computeLumpType();36913692Game.Notify('Sugar lumps!','Because you\'ve baked a <b>billion cookies</b> in total, you are now attracting <b>sugar lumps</b>. They coalesce quietly near the top of your screen, under the Stats button.<br>You will be able to harvest them when they\'re ripe, after which you may spend them on all sorts of things!',[23,14]);3693}3694var age=Date.now()-Game.lumpT;3695if (age>Game.lumpOverripeAge)3696{3697age=0;3698Game.harvestLumps(1);3699Game.computeLumpType();3700}37013702var phase=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7));3703var phase2=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7)+1);3704var row=14;3705var row2=14;3706var type=Game.lumpCurrentType;3707if (type==1)//double3708{3709//if (phase>=6) row=15;3710if (phase2>=6) row2=15;3711}3712else if (type==2)//golden3713{3714if (phase>=4) row=16;3715if (phase2>=4) row2=16;3716}3717else if (type==3)//meaty3718{3719if (phase>=4) row=17;3720if (phase2>=4) row2=17;3721}3722else if (type==4)//caramelized3723{3724if (phase>=4) row=27;3725if (phase2>=4) row2=27;3726}3727var icon=[23+Math.min(phase,5),row];3728var icon2=[23+phase2,row2];3729var opacity=Math.min(6,(age/Game.lumpOverripeAge)*7)%1;3730if (phase>=6) {opacity=1;}3731l('lumpsIcon').style.backgroundPosition=(-icon[0]*48)+'px '+(-icon[1]*48)+'px';3732l('lumpsIcon2').style.backgroundPosition=(-icon2[0]*48)+'px '+(-icon2[1]*48)+'px';3733l('lumpsIcon2').style.opacity=opacity;3734l('lumpsAmount').innerHTML=Beautify(Game.lumps);3735}37363737/*=====================================================================================3738COOKIE ECONOMICS3739=======================================================================================*/3740Game.Earn=function(howmuch)3741{3742Game.cookies+=howmuch;3743Game.cookiesEarned+=howmuch;3744}3745Game.Spend=function(howmuch)3746{3747Game.cookies-=howmuch;3748}3749Game.Dissolve=function(howmuch)3750{3751Game.cookies-=howmuch;3752Game.cookiesEarned-=howmuch;3753Game.cookies=Math.max(0,Game.cookies);3754Game.cookiesEarned=Math.max(0,Game.cookiesEarned);3755}3756Game.mouseCps=function()3757{3758var add=0;3759if (Game.Has('Thousand fingers')) add+= 0.1;3760if (Game.Has('Million fingers')) add+= 0.5;3761if (Game.Has('Billion fingers')) add+= 5;3762if (Game.Has('Trillion fingers')) add+= 50;3763if (Game.Has('Quadrillion fingers')) add+= 500;3764if (Game.Has('Quintillion fingers')) add+= 5000;3765if (Game.Has('Sextillion fingers')) add+= 50000;3766if (Game.Has('Septillion fingers')) add+= 500000;3767if (Game.Has('Octillion fingers')) add+= 5000000;3768var num=0;3769for (var i in Game.Objects) {num+=Game.Objects[i].amount;}3770num-=Game.Objects['Cursor'].amount;3771add=add*num;3772if (Game.Has('Plastic mouse')) add+=Game.cookiesPs*0.01;3773if (Game.Has('Iron mouse')) add+=Game.cookiesPs*0.01;3774if (Game.Has('Titanium mouse')) add+=Game.cookiesPs*0.01;3775if (Game.Has('Adamantium mouse')) add+=Game.cookiesPs*0.01;3776if (Game.Has('Unobtainium mouse')) add+=Game.cookiesPs*0.01;3777if (Game.Has('Eludium mouse')) add+=Game.cookiesPs*0.01;3778if (Game.Has('Wishalloy mouse')) add+=Game.cookiesPs*0.01;3779if (Game.Has('Fantasteel mouse')) add+=Game.cookiesPs*0.01;3780if (Game.Has('Nevercrack mouse')) add+=Game.cookiesPs*0.01;3781if (Game.Has('Armythril mouse')) add+=Game.cookiesPs*0.01;3782if (Game.Has('Technobsidian mouse')) add+=Game.cookiesPs*0.01;3783if (Game.Has('Plasmarble mouse')) add+=Game.cookiesPs*0.01;37843785if (Game.Has('Fortune #104')) add+=Game.cookiesPs*0.01;3786var mult=1;37873788for (var i in Game.customMouseCps) {mult+=Game.customMouseCps[i]();}37893790if (Game.Has('Santa\'s helpers')) mult*=1.1;3791if (Game.Has('Cookie egg')) mult*=1.1;3792if (Game.Has('Halo gloves')) mult*=1.1;37933794mult*=Game.eff('click');37953796if (Game.hasGod)3797{3798var godLvl=Game.hasGod('labor');3799if (godLvl==1) mult*=1.15;3800else if (godLvl==2) mult*=1.1;3801else if (godLvl==3) mult*=1.05;3802}38033804for (var i in Game.buffs)3805{3806if (typeof Game.buffs[i].multClick != 'undefined') mult*=Game.buffs[i].multClick;3807}38083809//if (Game.hasAura('Dragon Cursor')) mult*=1.05;3810mult*=1+Game.auraMult('Dragon Cursor')*0.05;38113812for (var i in Game.customMouseCpsMult) {mult*=Game.customMouseCpsMult[i]();}38133814var out=mult*Game.ComputeCps(1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add);38153816if (Game.hasBuff('Cursed finger')) out=Game.buffs['Cursed finger'].power;3817return out;3818}3819Game.computedMouseCps=1;3820Game.globalCpsMult=1;3821Game.unbuffedCps=0;3822Game.lastClick=0;3823Game.CanClick=1;3824Game.autoclickerDetected=0;3825Game.BigCookieState=0;//0 = normal, 1 = clicked (small), 2 = released/hovered (big)3826Game.BigCookieSize=0;3827Game.BigCookieSizeD=0;3828Game.BigCookieSizeT=1;3829Game.cookieClickSound=Math.floor(Math.random()*7)+1;3830Game.playCookieClickSound=function()3831{3832if (Game.prefs.cookiesound) PlaySound('snd/clickb'+(Game.cookieClickSound)+'.mp3',0.5);3833else PlaySound('snd/click'+(Game.cookieClickSound)+'.mp3',0.5);3834Game.cookieClickSound+=Math.floor(Math.random()*4)+1;3835if (Game.cookieClickSound>7) Game.cookieClickSound-=7;3836}3837Game.ClickCookie=function(e,amount)3838{3839var now=Date.now();3840if (e) e.preventDefault();3841if (Game.OnAscend || Game.AscendTimer>0) {}3842else if (now-Game.lastClick<1000/250) {}3843else3844{3845if (now-Game.lastClick<1000/15)3846{3847Game.autoclickerDetected+=Game.fps;3848if (Game.autoclickerDetected>=Game.fps*5) Game.Win('Uncanny clicker');3849}3850Game.loseShimmeringVeil('click');3851var amount=amount?amount:Game.computedMouseCps;3852Game.Earn(amount);3853Game.handmadeCookies+=amount;3854if (Game.prefs.particles)3855{3856Game.particleAdd();3857Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1,2);3858}3859if (Game.prefs.numbers) Game.particleAdd(Game.mouseX+Math.random()*8-4,Game.mouseY-8+Math.random()*8-4,0,-2,1,4,2,'','+'+Beautify(amount,1));38603861for (var i in Game.customCookieClicks) {Game.customCookieClicks[i]();}38623863Game.playCookieClickSound();3864Game.cookieClicks++;3865}3866Game.lastClick=now;3867Game.Click=0;3868}3869Game.mouseX=0;3870Game.mouseY=0;3871Game.mouseX2=0;3872Game.mouseY2=0;3873Game.mouseMoved=0;3874Game.GetMouseCoords=function(e)3875{3876var posx=0;3877var posy=0;3878if (!e) var e=window.event;3879if (e.pageX||e.pageY)3880{3881posx=e.pageX;3882posy=e.pageY;3883}3884else if (e.clientX || e.clientY)3885{3886posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;3887posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;3888}3889var x=0;3890var y=32;3891/*3892var el=l('sectionLeft');3893while(el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop))3894{3895x+=el.offsetLeft-el.scrollLeft;3896y+=el.offsetTop-el.scrollTop;3897el=el.offsetParent;3898}*/3899Game.mouseX2=Game.mouseX;3900Game.mouseY2=Game.mouseY;3901Game.mouseX=posx-x;3902Game.mouseY=posy-y;3903Game.mouseMoved=1;3904Game.lastActivity=Game.time;3905}3906var bigCookie=l('bigCookie');3907Game.Click=0;3908Game.lastClickedEl=0;3909Game.clickFrom=0;3910Game.Scroll=0;3911Game.mouseDown=0;3912if (!Game.touchEvents)3913{3914AddEvent(bigCookie,'click',Game.ClickCookie);3915AddEvent(bigCookie,'mousedown',function(event){Game.BigCookieState=1;if (Game.prefs.cookiesound) {Game.playCookieClickSound();}if (event) event.preventDefault();});3916AddEvent(bigCookie,'mouseup',function(event){Game.BigCookieState=2;if (event) event.preventDefault();});3917AddEvent(bigCookie,'mouseout',function(event){Game.BigCookieState=0;});3918AddEvent(bigCookie,'mouseover',function(event){Game.BigCookieState=2;});3919AddEvent(document,'mousemove',Game.GetMouseCoords);3920AddEvent(document,'mousedown',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;Game.clickFrom=event.target;});3921AddEvent(document,'mouseup',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;Game.clickFrom=0;});3922AddEvent(document,'click',function(event){Game.lastActivity=Game.time;Game.Click=1;Game.lastClickedEl=event.target;Game.clickFrom=0;});3923Game.handleScroll=function(e)3924{3925if (!e) e=event;3926Game.Scroll=(e.detail<0||e.wheelDelta>0)?1:-1;3927Game.lastActivity=Game.time;3928};3929AddEvent(document,'DOMMouseScroll',Game.handleScroll);3930AddEvent(document,'mousewheel',Game.handleScroll);3931}3932else3933{3934//touch events3935AddEvent(bigCookie,'touchend',Game.ClickCookie);3936AddEvent(bigCookie,'touchstart',function(event){Game.BigCookieState=1;if (event) event.preventDefault();});3937AddEvent(bigCookie,'touchend',function(event){Game.BigCookieState=0;if (event) event.preventDefault();});3938//AddEvent(document,'touchmove',Game.GetMouseCoords);3939AddEvent(document,'mousemove',Game.GetMouseCoords);3940AddEvent(document,'touchstart',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;});3941AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;});3942AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.Click=1;});3943}39443945Game.keys=[];3946AddEvent(window,'keyup',function(e){3947Game.lastActivity=Game.time;3948if (e.keyCode==27)3949{3950Game.ClosePrompt();3951if (Game.AscendTimer>0) Game.AscendTimer=Game.AscendDuration;3952}//esc closes prompt3953else if (e.keyCode==13) Game.ConfirmPrompt();//enter confirms prompt3954Game.keys[e.keyCode]=0;3955});3956AddEvent(window,'keydown',function(e){3957if (!Game.OnAscend && Game.AscendTimer==0)3958{3959if (e.ctrlKey && e.keyCode==83) {Game.toSave=true;e.preventDefault();}//ctrl-s saves the game3960else if (e.ctrlKey && e.keyCode==79) {Game.ImportSave();e.preventDefault();}//ctrl-o opens the import menu3961}3962if ((e.keyCode==16 || e.keyCode==17) && Game.tooltip.dynamic) Game.tooltip.update();3963Game.keys[e.keyCode]=1;3964});39653966AddEvent(window,'visibilitychange',function(e){3967Game.keys=[];//reset all key pressed on visibility change (should help prevent ctrl still being down after ctrl-tab)3968});39693970/*=====================================================================================3971CPS RECALCULATOR3972=======================================================================================*/39733974Game.heavenlyPower=1;//how many CpS percents a single heavenly chip gives3975Game.recalculateGains=1;3976Game.cookiesPsByType={};3977Game.cookiesMultByType={};3978//display bars with http://codepen.io/anon/pen/waGyEJ3979Game.effs={};3980Game.eff=function(name,def){if (typeof Game.effs[name]==='undefined') return (typeof def==='undefined'?1:def); else return Game.effs[name];};39813982Game.CalculateGains=function()3983{3984Game.cookiesPs=0;3985var mult=1;3986//add up effect bonuses from building minigames3987var effs={};3988for (var i in Game.Objects)3989{3990if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs)3991{3992var myEffs=Game.Objects[i].minigame.effs;3993for (var ii in myEffs)3994{3995if (effs[ii]) effs[ii]*=myEffs[ii];3996else effs[ii]=myEffs[ii];3997}3998}3999}4000Game.effs=effs;40014002if (Game.ascensionMode!=1) mult+=parseFloat(Game.prestige)*0.01*Game.heavenlyPower*Game.GetHeavenlyMultiplier();40034004mult*=Game.eff('cps');40054006if (Game.Has('Heralds') && Game.ascensionMode!=1) mult*=1+0.01*Game.heralds;40074008var cookieMult=0;4009for (var i in Game.cookieUpgrades)4010{4011var me=Game.cookieUpgrades[i];4012if (Game.Has(me.name))4013{4014mult*=(1+(typeof(me.power)=='function'?me.power(me):me.power)*0.01);4015}4016}4017mult*=(1+0.01*cookieMult);40184019if (Game.Has('Specialized chocolate chips')) mult*=1.01;4020if (Game.Has('Designer cocoa beans')) mult*=1.02;4021if (Game.Has('Underworld ovens')) mult*=1.03;4022if (Game.Has('Exotic nuts')) mult*=1.04;4023if (Game.Has('Arcane sugar')) mult*=1.05;40244025if (Game.Has('Increased merriness')) mult*=1.15;4026if (Game.Has('Improved jolliness')) mult*=1.15;4027if (Game.Has('A lump of coal')) mult*=1.01;4028if (Game.Has('An itchy sweater')) mult*=1.01;4029if (Game.Has('Santa\'s dominion')) mult*=1.2;40304031if (Game.Has('Fortune #100')) mult*=1.01;4032if (Game.Has('Fortune #101')) mult*=1.07;40334034var buildMult=1;4035if (Game.hasGod)4036{4037var godLvl=Game.hasGod('asceticism');4038if (godLvl==1) mult*=1.15;4039else if (godLvl==2) mult*=1.1;4040else if (godLvl==3) mult*=1.05;40414042var godLvl=Game.hasGod('ages');4043if (godLvl==1) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*3))*Math.PI*2);4044else if (godLvl==2) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*12))*Math.PI*2);4045else if (godLvl==3) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*24))*Math.PI*2);40464047var godLvl=Game.hasGod('decadence');4048if (godLvl==1) buildMult*=0.93;4049else if (godLvl==2) buildMult*=0.95;4050else if (godLvl==3) buildMult*=0.98;40514052var godLvl=Game.hasGod('industry');4053if (godLvl==1) buildMult*=1.1;4054else if (godLvl==2) buildMult*=1.06;4055else if (godLvl==3) buildMult*=1.03;40564057var godLvl=Game.hasGod('labor');4058if (godLvl==1) buildMult*=0.97;4059else if (godLvl==2) buildMult*=0.98;4060else if (godLvl==3) buildMult*=0.99;4061}40624063if (Game.Has('Santa\'s legacy')) mult*=1+(Game.santaLevel+1)*0.03;40644065for (var i in Game.Objects)4066{4067var me=Game.Objects[i];4068me.storedCps=(typeof(me.cps)=='function'?me.cps(me):me.cps);4069if (Game.ascensionMode!=1) me.storedCps*=(1+me.level*0.01)*buildMult;4070me.storedTotalCps=me.amount*me.storedCps;4071Game.cookiesPs+=me.storedTotalCps;4072Game.cookiesPsByType[me.name]=me.storedTotalCps;4073}40744075if (Game.Has('"egg"')) {Game.cookiesPs+=9;Game.cookiesPsByType['"egg"']=9;}//"egg"40764077for (var i in Game.customCps) {mult*=Game.customCps[i]();}40784079Game.milkProgress=Game.AchievementsOwned/25;4080var milkMult=1;4081if (Game.Has('Santa\'s milk and cookies')) milkMult*=1.05;4082//if (Game.hasAura('Breath of Milk')) milkMult*=1.05;4083milkMult*=1+Game.auraMult('Breath of Milk')*0.05;4084if (Game.hasGod)4085{4086var godLvl=Game.hasGod('mother');4087if (godLvl==1) milkMult*=1.1;4088else if (godLvl==2) milkMult*=1.05;4089else if (godLvl==3) milkMult*=1.03;4090}4091milkMult*=Game.eff('milk');40924093var catMult=1;40944095if (Game.Has('Kitten helpers')) catMult*=(1+Game.milkProgress*0.1*milkMult);4096if (Game.Has('Kitten workers')) catMult*=(1+Game.milkProgress*0.125*milkMult);4097if (Game.Has('Kitten engineers')) catMult*=(1+Game.milkProgress*0.15*milkMult);4098if (Game.Has('Kitten overseers')) catMult*=(1+Game.milkProgress*0.175*milkMult);4099if (Game.Has('Kitten managers')) catMult*=(1+Game.milkProgress*0.2*milkMult);4100if (Game.Has('Kitten accountants')) catMult*=(1+Game.milkProgress*0.2*milkMult);4101if (Game.Has('Kitten specialists')) catMult*=(1+Game.milkProgress*0.2*milkMult);4102if (Game.Has('Kitten experts')) catMult*=(1+Game.milkProgress*0.2*milkMult);4103if (Game.Has('Kitten consultants')) catMult*=(1+Game.milkProgress*0.2*milkMult);4104if (Game.Has('Kitten assistants to the regional manager')) catMult*=(1+Game.milkProgress*0.175*milkMult);4105if (Game.Has('Kitten marketeers')) catMult*=(1+Game.milkProgress*0.15*milkMult);4106if (Game.Has('Kitten analysts')) catMult*=(1+Game.milkProgress*0.125*milkMult);4107if (Game.Has('Kitten executives')) catMult*=(1+Game.milkProgress*0.115*milkMult);4108if (Game.Has('Kitten angels')) catMult*=(1+Game.milkProgress*0.1*milkMult);4109if (Game.Has('Fortune #103')) catMult*=(1+Game.milkProgress*0.05*milkMult);41104111Game.cookiesMultByType['kittens']=catMult;4112mult*=catMult;41134114var eggMult=1;4115if (Game.Has('Chicken egg')) eggMult*=1.01;4116if (Game.Has('Duck egg')) eggMult*=1.01;4117if (Game.Has('Turkey egg')) eggMult*=1.01;4118if (Game.Has('Quail egg')) eggMult*=1.01;4119if (Game.Has('Robin egg')) eggMult*=1.01;4120if (Game.Has('Ostrich egg')) eggMult*=1.01;4121if (Game.Has('Cassowary egg')) eggMult*=1.01;4122if (Game.Has('Salmon roe')) eggMult*=1.01;4123if (Game.Has('Frogspawn')) eggMult*=1.01;4124if (Game.Has('Shark egg')) eggMult*=1.01;4125if (Game.Has('Turtle egg')) eggMult*=1.01;4126if (Game.Has('Ant larva')) eggMult*=1.01;4127if (Game.Has('Century egg'))4128{4129//the boost increases a little every day, with diminishing returns up to +10% on the 100th day4130var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;4131day=Math.min(day,100);4132eggMult*=1+(1-Math.pow(1-day/100,3))*0.1;4133}41344135Game.cookiesMultByType['eggs']=eggMult;4136mult*=eggMult;41374138if (Game.Has('Sugar baking')) mult*=(1+Math.min(100,Game.lumps)*0.01);41394140//if (Game.hasAura('Radiant Appetite')) mult*=2;4141mult*=1+Game.auraMult('Radiant Appetite');41424143if (true)// || Game.hasAura('Dragon\'s Fortune'))4144{4145var n=Game.shimmerTypes['golden'].n;4146var auraMult=Game.auraMult('Dragon\'s Fortune');4147for (var i=0;i<n;i++){mult*=1+auraMult*1.23;}4148//old behavior4149/*var buffs=0;4150for (var i in Game.buffs)4151{buffs++;}4152mult*=1+(0.07)*buffs;*/4153}41544155var rawCookiesPs=Game.cookiesPs*mult;4156for (var i in Game.CpsAchievements)4157{4158if (rawCookiesPs>=Game.CpsAchievements[i].threshold) Game.Win(Game.CpsAchievements[i].name);4159}41604161name=Game.bakeryName.toLowerCase();4162if (name=='orteil') mult*=0.99;4163else if (name=='ortiel') mult*=0.98;//or so help me41644165var sucking=0;4166for (var i in Game.wrinklers)4167{4168if (Game.wrinklers[i].phase==2)4169{4170sucking++;4171}4172}4173var suckRate=1/20;//each wrinkler eats a twentieth of your CpS4174suckRate*=Game.eff('wrinklerEat');41754176Game.cpsSucked=sucking*suckRate;417741784179if (Game.Has('Elder Covenant')) mult*=0.95;41804181if (Game.Has('Golden switch [off]'))4182{4183var goldenSwitchMult=1.5;4184if (Game.Has('Residual luck'))4185{4186var upgrades=Game.goldenCookieUpgrades;4187for (var i in upgrades) {if (Game.Has(upgrades[i])) goldenSwitchMult+=0.1;}4188}4189mult*=goldenSwitchMult;4190}4191if (Game.Has('Shimmering veil [off]'))4192{4193var veilMult=0.5;4194if (Game.Has('Reinforced membrane')) veilMult+=0.1;4195mult*=1+veilMult;4196}4197if (Game.Has('Magic shenanigans')) mult*=1000;4198if (Game.Has('Occult obstruction')) mult*=0;41994200for (var i in Game.customCpsMult) {mult*=Game.customCpsMult[i]();}420142024203//cps without golden cookie effects4204Game.unbuffedCps=Game.cookiesPs*mult;42054206for (var i in Game.buffs)4207{4208if (typeof Game.buffs[i].multCpS != 'undefined') mult*=Game.buffs[i].multCpS;4209}42104211Game.globalCpsMult=mult;4212Game.cookiesPs*=Game.globalCpsMult;42134214//if (Game.hasBuff('Cursed finger')) Game.cookiesPs=0;42154216Game.computedMouseCps=Game.mouseCps();42174218Game.computeLumpTimes();42194220Game.recalculateGains=0;4221}42224223Game.dropRateMult=function()4224{4225var rate=1;4226if (Game.Has('Green yeast digestives')) rate*=1.03;4227rate*=Game.eff('itemDrops');4228//if (Game.hasAura('Mind Over Matter')) rate*=1.25;4229rate*=1+Game.auraMult('Mind Over Matter')*0.25;4230if (Game.Has('Santa\'s bottomless bag')) rate*=1.1;4231if (Game.Has('Cosmic beginner\'s luck') && !Game.Has('Heavenly chip secret')) rate*=5;4232return rate;4233}4234/*=====================================================================================4235SHIMMERS (GOLDEN COOKIES & SUCH)4236=======================================================================================*/4237Game.shimmersL=l('shimmers');4238Game.shimmers=[];//all shimmers currently on the screen4239Game.shimmersN=Math.floor(Math.random()*10000);4240Game.shimmer=function(type,obj,noCount)4241{4242this.type=type;42434244this.l=document.createElement('div');4245this.l.className='shimmer';4246if (!Game.touchEvents) {AddEvent(this.l,'click',function(what){return function(event){what.pop(event);};}(this));}4247else {AddEvent(this.l,'touchend',function(what){return function(event){what.pop(event);};}(this));}//touch events42484249this.x=0;4250this.y=0;4251this.id=Game.shimmersN;42524253this.forceObj=obj||0;4254this.noCount=noCount;4255if (!this.noCount) {Game.shimmerTypes[this.type].n++;Game.recalculateGains=1;}42564257this.init();42584259Game.shimmersL.appendChild(this.l);4260Game.shimmers.push(this);4261Game.shimmersN++;4262}4263Game.shimmer.prototype.init=function()//executed when the shimmer is created4264{4265Game.shimmerTypes[this.type].initFunc(this);4266}4267Game.shimmer.prototype.update=function()//executed every frame4268{4269Game.shimmerTypes[this.type].updateFunc(this);4270}4271Game.shimmer.prototype.pop=function(event)//executed when the shimmer is popped by the player4272{4273if (event) event.preventDefault();4274Game.loseShimmeringVeil('shimmer');4275Game.Click=0;4276Game.shimmerTypes[this.type].popFunc(this);4277}4278Game.shimmer.prototype.die=function()//executed after the shimmer disappears (from old age or popping)4279{4280if (Game.shimmerTypes[this.type].spawnsOnTimer && this.spawnLead)4281{4282//if this was the spawn lead for this shimmer type, set the shimmer type's "spawned" to 0 and restart its spawn timer4283var type=Game.shimmerTypes[this.type];4284type.time=0;4285type.spawned=0;4286type.minTime=type.getMinTime(this);4287type.maxTime=type.getMaxTime(this);4288}4289Game.shimmersL.removeChild(this.l);4290if (Game.shimmers.indexOf(this)!=-1) Game.shimmers.splice(Game.shimmers.indexOf(this),1);4291if (!this.noCount) {Game.shimmerTypes[this.type].n=Math.max(0,Game.shimmerTypes[this.type].n-1);Game.recalculateGains=1;}4292}429342944295Game.updateShimmers=function()//run shimmer functions, kill overtimed shimmers and spawn new ones4296{4297for (var i in Game.shimmers)4298{4299Game.shimmers[i].update();4300}43014302//cookie storm!4303if (Game.hasBuff('Cookie storm') && Math.random()<0.5)4304{4305var newShimmer=new Game.shimmer('golden',0,1);4306newShimmer.dur=Math.ceil(Math.random()*4+1);4307newShimmer.life=Math.ceil(Game.fps*newShimmer.dur);4308newShimmer.force='cookie storm drop';4309newShimmer.sizeMult=Math.random()*0.75+0.25;4310}43114312//spawn shimmers4313for (var i in Game.shimmerTypes)4314{4315var me=Game.shimmerTypes[i];4316if (me.spawnsOnTimer && me.spawnConditions())//only run on shimmer types that work on a timer4317{4318if (!me.spawned)//no shimmer spawned for this type? check the timer and try to spawn one4319{4320me.time++;4321if (Math.random()<Math.pow(Math.max(0,(me.time-me.minTime)/(me.maxTime-me.minTime)),5))4322{4323var newShimmer=new Game.shimmer(i);4324newShimmer.spawnLead=1;4325if (Game.Has('Distilled essence of redoubled luck') && Math.random()<0.01) var newShimmer=new Game.shimmer(i);4326me.spawned=1;4327}4328}4329}4330}4331}4332Game.killShimmers=function()//stop and delete all shimmers (used on resetting etc)4333{4334for (var i=Game.shimmers.length-1;i>=0;i--)4335{4336Game.shimmers[i].die();4337}4338for (var i in Game.shimmerTypes)4339{4340var me=Game.shimmerTypes[i];4341if (me.reset) me.reset();4342me.n=0;4343if (me.spawnsOnTimer)4344{4345me.time=0;4346me.spawned=0;4347me.minTime=me.getMinTime(me);4348me.maxTime=me.getMaxTime(me);4349}4350}4351}43524353Game.shimmerTypes={4354//in these, "me" refers to the shimmer itself, and "this" to the shimmer's type object4355'golden':{4356reset:function()4357{4358this.chain=0;4359this.totalFromChain=0;4360this.last='';4361},4362initFunc:function(me)4363{4364if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/chime.mp3');43654366//set image4367var bgPic='img/goldCookie.png';4368var picX=0;var picY=0;436943704371if ((!me.forceObj || !me.forceObj.noWrath) && ((me.forceObj && me.forceObj.wrath) || (Game.elderWrath==1 && Math.random()<1/3) || (Game.elderWrath==2 && Math.random()<2/3) || (Game.elderWrath==3) || (Game.hasGod && Game.hasGod('scorn'))))4372{4373me.wrath=1;4374if (Game.season=='halloween') bgPic='img/spookyCookie.png';4375else bgPic='img/wrathCookie.png';4376}4377else4378{4379me.wrath=0;4380}43814382if (Game.season=='valentines')4383{4384bgPic='img/hearts.png';4385picX=Math.floor(Math.random()*8);4386}4387else if (Game.season=='fools')4388{4389bgPic='img/contract.png';4390if (me.wrath) bgPic='img/wrathContract.png';4391}4392else if (Game.season=='easter')4393{4394bgPic='img/bunnies.png';4395picX=Math.floor(Math.random()*4);4396picY=0;4397if (me.wrath) picY=1;4398}43994400me.x=Math.floor(Math.random()*Math.max(0,(Game.bounds.right-300)-Game.bounds.left-128)+Game.bounds.left+64)-64;4401me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-128)+Game.bounds.top+64)-64;4402me.l.style.left=me.x+'px';4403me.l.style.top=me.y+'px';4404me.l.style.width='96px';4405me.l.style.height='96px';4406me.l.style.backgroundImage='url('+bgPic+')';4407me.l.style.backgroundPosition=(-picX*96)+'px '+(-picY*96)+'px';4408me.l.style.opacity='0';4409me.l.style.display='block';44104411me.life=1;//the cookie's current progression through its lifespan (in frames)4412me.dur=13;//duration; the cookie's lifespan in seconds before it despawns44134414var dur=13;4415if (Game.Has('Lucky day')) dur*=2;4416if (Game.Has('Serendipity')) dur*=2;4417if (Game.Has('Decisive fate')) dur*=1.05;4418if (Game.Has('Lucky digit')) dur*=1.01;4419if (Game.Has('Lucky number')) dur*=1.01;4420if (Game.Has('Lucky payout')) dur*=1.01;4421if (!me.wrath) dur*=Game.eff('goldenCookieDur');4422else dur*=Game.eff('wrathCookieDur');4423dur*=Math.pow(0.95,Game.shimmerTypes['golden'].n-1);//5% shorter for every other golden cookie on the screen4424if (this.chain>0) dur=Math.max(2,10/this.chain);//this is hilarious4425me.dur=dur;4426me.life=Math.ceil(Game.fps*me.dur);4427me.force='';4428me.sizeMult=1;4429},4430updateFunc:function(me)4431{4432var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,4);4433me.l.style.opacity=curve;4434//this line makes each golden cookie pulse in a unique way4435if (Game.prefs.fancy) me.l.style.transform='rotate('+(Math.sin(me.id*0.69)*24+Math.sin(Game.T*(0.35+Math.sin(me.id*0.97)*0.15)+me.id/*+Math.sin(Game.T*0.07)*2+2*/)*(3+Math.sin(me.id*0.36)*2))+'deg) scale('+(me.sizeMult*(1+Math.sin(me.id*0.53)*0.2)*curve*(1+(0.06+Math.sin(me.id*0.41)*0.05)*(Math.sin(Game.T*(0.25+Math.sin(me.id*0.73)*0.15)+me.id))))+')';4436me.life--;4437if (me.life<=0) {this.missFunc(me);me.die();}4438},4439popFunc:function(me)4440{4441//get achievs and stats4442if (me.spawnLead)4443{4444Game.goldenClicks++;4445Game.goldenClicksLocal++;44464447if (Game.goldenClicks>=1) Game.Win('Golden cookie');4448if (Game.goldenClicks>=7) Game.Win('Lucky cookie');4449if (Game.goldenClicks>=27) Game.Win('A stroke of luck');4450if (Game.goldenClicks>=77) Game.Win('Fortune');4451if (Game.goldenClicks>=777) Game.Win('Leprechaun');4452if (Game.goldenClicks>=7777) Game.Win('Black cat\'s paw');44534454if (Game.goldenClicks>=7) Game.Unlock('Lucky day');4455if (Game.goldenClicks>=27) Game.Unlock('Serendipity');4456if (Game.goldenClicks>=77) Game.Unlock('Get lucky');44574458if ((me.life/Game.fps)>(me.dur-1)) Game.Win('Early bird');4459if (me.life<Game.fps) Game.Win('Fading luck');4460}44614462if (Game.forceUnslotGod)4463{4464if (Game.forceUnslotGod('asceticism')) Game.useSwap(1000000);4465}44664467//select an effect4468var list=[];4469if (me.wrath>0) list.push('clot','multiply cookies','ruin cookies');4470else list.push('frenzy','multiply cookies');4471if (me.wrath>0 && Game.hasGod && Game.hasGod('scorn')) list.push('clot','ruin cookies','clot','ruin cookies');4472if (me.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie','cookie storm');4473else if (Math.random()<0.03 && Game.cookiesEarned>=100000) list.push('chain cookie','cookie storm');4474if (Math.random()<0.05 && Game.season=='fools') list.push('everything must go');4475if (Math.random()<0.1 && (Math.random()<0.05 || !Game.hasBuff('Dragonflight'))) list.push('click frenzy');4476if (me.wrath && Math.random()<0.1) list.push('cursed finger');44774478if (Game.BuildingsOwned>=10 && Math.random()<0.25) list.push('building special');44794480if (Game.canLumps() && Math.random()<0.0005) list.push('free sugar lump');44814482if ((me.wrath==0 && Math.random()<0.15) || Math.random()<0.05)4483{4484//if (Game.hasAura('Reaper of Fields')) list.push('dragon harvest');4485if (Math.random()<Game.auraMult('Reaper of Fields')) list.push('dragon harvest');4486//if (Game.hasAura('Dragonflight')) list.push('dragonflight');4487if (Math.random()<Game.auraMult('Dragonflight')) list.push('dragonflight');4488}44894490if (this.last!='' && Math.random()<0.8 && list.indexOf(this.last)!=-1) list.splice(list.indexOf(this.last),1);//80% chance to force a different one4491if (Math.random()<0.0001) list.push('blab');4492var choice=choose(list);44934494if (this.chain>0) choice='chain cookie';4495if (me.force!='') {this.chain=0;choice=me.force;me.force='';}4496if (choice!='chain cookie') this.chain=0;44974498this.last=choice;44994500//create buff for effect4501//buff duration multiplier4502var effectDurMod=1;4503if (Game.Has('Get lucky')) effectDurMod*=2;4504if (Game.Has('Lasting fortune')) effectDurMod*=1.1;4505if (Game.Has('Lucky digit')) effectDurMod*=1.01;4506if (Game.Has('Lucky number')) effectDurMod*=1.01;4507if (Game.Has('Green yeast digestives')) effectDurMod*=1.01;4508if (Game.Has('Lucky payout')) effectDurMod*=1.01;4509//if (Game.hasAura('Epoch Manipulator')) effectDurMod*=1.05;4510effectDurMod*=1+Game.auraMult('Epoch Manipulator')*0.05;4511if (!me.wrath) effectDurMod*=Game.eff('goldenCookieEffDur');4512else effectDurMod*=Game.eff('wrathCookieEffDur');45134514if (Game.hasGod)4515{4516var godLvl=Game.hasGod('decadence');4517if (godLvl==1) effectDurMod*=1.07;4518else if (godLvl==2) effectDurMod*=1.05;4519else if (godLvl==3) effectDurMod*=1.02;4520}45214522//effect multiplier (from lucky etc)4523var mult=1;4524//if (me.wrath>0 && Game.hasAura('Unholy Dominion')) mult*=1.1;4525//else if (me.wrath==0 && Game.hasAura('Ancestral Metamorphosis')) mult*=1.1;4526if (me.wrath>0) mult*=1+Game.auraMult('Unholy Dominion')*0.1;4527else if (me.wrath==0) mult*=1+Game.auraMult('Ancestral Metamorphosis')*0.1;4528if (Game.Has('Green yeast digestives')) mult*=1.01;4529if (!me.wrath) mult*=Game.eff('goldenCookieGain');4530else mult*=Game.eff('wrathCookieGain');45314532var popup='';4533var buff=0;45344535if (choice=='building special')4536{4537var time=Math.ceil(30*effectDurMod);4538var list=[];4539for (var i in Game.Objects)4540{4541if (Game.Objects[i].amount>=10) list.push(Game.Objects[i].id);4542}4543if (list.length==0) {choice='frenzy';}//default to frenzy if no proper building4544else4545{4546var obj=choose(list);4547var pow=Game.ObjectsById[obj].amount/10+1;4548if (me.wrath && Math.random()<0.3)4549{4550buff=Game.gainBuff('building debuff',time,pow,obj);4551}4552else4553{4554buff=Game.gainBuff('building buff',time,pow,obj);4555}4556}4557}45584559if (choice=='free sugar lump')4560{4561Game.gainLumps(1);4562popup='Sweet!<div style="font-size:65%;">Found 1 sugar lump!</div>';4563}4564else if (choice=='frenzy')4565{4566buff=Game.gainBuff('frenzy',Math.ceil(77*effectDurMod),7);4567}4568else if (choice=='dragon harvest')4569{4570buff=Game.gainBuff('dragon harvest',Math.ceil(60*effectDurMod),15);4571}4572else if (choice=='everything must go')4573{4574buff=Game.gainBuff('everything must go',Math.ceil(8*effectDurMod),5);4575}4576else if (choice=='multiply cookies')4577{4578var moni=mult*Math.min(Game.cookies*0.15,Game.cookiesPs*60*15)+13;//add 15% to cookies owned (+13), or 15 minutes of cookie production - whichever is lowest4579Game.Earn(moni);4580popup='Lucky!<div style="font-size:65%;">+'+Beautify(moni)+' cookies!</div>';4581}4582else if (choice=='ruin cookies')4583{4584var moni=Math.min(Game.cookies*0.05,Game.cookiesPs*60*10)+13;//lose 5% of cookies owned (-13), or 10 minutes of cookie production - whichever is lowest4585moni=Math.min(Game.cookies,moni);4586Game.Spend(moni);4587popup='Ruin!<div style="font-size:65%;">Lost '+Beautify(moni)+' cookies!</div>';4588}4589else if (choice=='blood frenzy')4590{4591buff=Game.gainBuff('blood frenzy',Math.ceil(6*effectDurMod),666);4592}4593else if (choice=='clot')4594{4595buff=Game.gainBuff('clot',Math.ceil(66*effectDurMod),0.5);4596}4597else if (choice=='cursed finger')4598{4599buff=Game.gainBuff('cursed finger',Math.ceil(10*effectDurMod),Game.cookiesPs*Math.ceil(10*effectDurMod));4600}4601else if (choice=='click frenzy')4602{4603buff=Game.gainBuff('click frenzy',Math.ceil(13*effectDurMod),777);4604}4605else if (choice=='dragonflight')4606{4607buff=Game.gainBuff('dragonflight',Math.ceil(10*effectDurMod),1111);4608if (Math.random()<0.8) Game.killBuff('Click frenzy');4609}4610else if (choice=='chain cookie')4611{4612//fix by Icehawk784613if (this.chain==0) this.totalFromChain=0;4614this.chain++;4615var digit=me.wrath?6:7;4616if (this.chain==1) this.chain+=Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);46174618var maxPayout=Math.min(Game.cookiesPs*60*60*6,Game.cookies*0.5)*mult;4619var moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain)*digit*mult),maxPayout));4620var nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain+1)*digit*mult),maxPayout));4621this.totalFromChain+=moni;4622var moniStr=Beautify(moni);46234624//break the chain if we're above 5 digits AND it's more than 50% of our bank, it grants more than 6 hours of our CpS, or just a 1% chance each digit (update : removed digit limit)4625if (Math.random()<0.01 || nextMoni>=maxPayout)4626{4627this.chain=0;4628popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!<br>Cookie chain over. You made '+Beautify(this.totalFromChain)+' cookies.</div>';4629}4630else4631{4632popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!</div>';//4633}4634Game.Earn(moni);4635}4636else if (choice=='cookie storm')4637{4638buff=Game.gainBuff('cookie storm',Math.ceil(7*effectDurMod),7);4639}4640else if (choice=='cookie storm drop')4641{4642var moni=Math.max(mult*(Game.cookiesPs*60*Math.floor(Math.random()*7+1)),Math.floor(Math.random()*7+1));//either 1-7 cookies or 1-7 minutes of cookie production, whichever is highest4643Game.Earn(moni);4644popup='<div style="font-size:75%;">+'+Beautify(moni)+' cookies!</div>';4645}4646else if (choice=='blab')//sorry (it's really rare)4647{4648var str=choose([4649'Cookie crumbliness x3 for 60 seconds!',4650'Chocolatiness x7 for 77 seconds!',4651'Dough elasticity halved for 66 seconds!',4652'Golden cookie shininess doubled for 3 seconds!',4653'World economy halved for 30 seconds!',4654'Grandma kisses 23% stingier for 45 seconds!',4655'Thanks for clicking!',4656'Fooled you! This one was just a test.',4657'Golden cookies clicked +1!',4658'Your click has been registered. Thank you for your cooperation.',4659'Thanks! That hit the spot!',4660'Thank you. A team has been dispatched.',4661'They know.',4662'Oops. This was just a chocolate cookie with shiny aluminium foil.'4663]);4664popup=str;4665}46664667if (popup=='' && buff && buff.name && buff.desc) popup=buff.name+'<div style="font-size:65%;">'+buff.desc+'</div>';4668if (popup!='') Game.Popup(popup,me.x+me.l.offsetWidth/2,me.y);46694670Game.DropEgg(0.9);46714672//sparkle and kill the shimmer4673Game.SparkleAt(me.x+48,me.y+48);4674if (choice=='cookie storm drop')4675{4676if (Game.prefs.cookiesound) PlaySound('snd/clickb'+Math.floor(Math.random()*7+1)+'.mp3',0.75);4677else PlaySound('snd/click'+Math.floor(Math.random()*7+1)+'.mp3',0.75);4678}4679else PlaySound('snd/shimmerClick.mp3');4680me.die();4681},4682missFunc:function(me)4683{4684if (this.chain>0 && this.totalFromChain>0)4685{4686Game.Popup('Cookie chain broken.<div style="font-size:65%;">You made '+Beautify(this.totalFromChain)+' cookies.</div>',me.x+me.l.offsetWidth/2,me.y);4687this.chain=0;this.totalFromChain=0;4688}4689if (me.spawnLead) Game.missedGoldenClicks++;4690},4691spawnsOnTimer:true,4692spawnConditions:function()4693{4694if (!Game.Has('Golden switch [off]')) return true; else return false;4695},4696spawned:0,4697time:0,4698minTime:0,4699maxTime:0,4700getTimeMod:function(me,m)4701{4702if (Game.Has('Lucky day')) m/=2;4703if (Game.Has('Serendipity')) m/=2;4704if (Game.Has('Golden goose egg')) m*=0.95;4705if (Game.Has('Heavenly luck')) m*=0.95;4706if (Game.Has('Green yeast digestives')) m*=0.99;4707//if (Game.hasAura('Arcane Aura')) m*=0.95;4708m*=1-Game.auraMult('Arcane Aura')*0.05;4709if (Game.hasBuff('Sugar blessing')) m*=0.9;4710if (Game.season=='easter' && Game.Has('Starspawn')) m*=0.98;4711else if (Game.season=='halloween' && Game.Has('Starterror')) m*=0.98;4712else if (Game.season=='valentines' && Game.Has('Starlove')) m*=0.98;4713else if (Game.season=='fools' && Game.Has('Startrade')) m*=0.95;4714if (!me.wrath) m*=1/Game.eff('goldenCookieFreq');4715else m*=1/Game.eff('wrathCookieFreq');4716if (Game.hasGod)4717{4718var godLvl=Game.hasGod('industry');4719if (godLvl==1) m*=1.1;4720else if (godLvl==2) m*=1.06;4721else if (godLvl==3) m*=1.03;4722var godLvl=Game.hasGod('mother');4723if (godLvl==1) m*=1.15;4724else if (godLvl==2) m*=1.1;4725else if (godLvl==3) m*=1.05;47264727if (Game.season!='')4728{4729var godLvl=Game.hasGod('seasons');4730if (Game.season!='fools')4731{4732if (godLvl==1) m*=0.97;4733else if (godLvl==2) m*=0.98;4734else if (godLvl==3) m*=0.99;4735}4736else4737{4738if (godLvl==1) m*=0.955;4739else if (godLvl==2) m*=0.97;4740else if (godLvl==3) m*=0.985;4741}4742}4743}4744if (this.chain>0) m=0.05;4745if (Game.Has('Gold hoard')) m=0.01;4746return Math.ceil(Game.fps*60*m);4747},4748getMinTime:function(me)4749{4750var m=5;4751return this.getTimeMod(me,m);4752},4753getMaxTime:function(me)4754{4755var m=15;4756return this.getTimeMod(me,m);4757},4758last:'',4759},4760'reindeer':{4761reset:function()4762{4763},4764initFunc:function(me)4765{4766if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/jingle.mp3');47674768me.x=-128;4769me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-256)+Game.bounds.top+128)-128;4770//me.l.style.left=me.x+'px';4771//me.l.style.top=me.y+'px';4772me.l.style.width='167px';4773me.l.style.height='212px';4774me.l.style.backgroundImage='url(img/frostedReindeer.png)';4775me.l.style.opacity='0';4776//me.l.style.transform='rotate('+(Math.random()*60-30)+'deg) scale('+(Math.random()*1+0.25)+')';4777me.l.style.display='block';47784779me.life=1;//the reindeer's current progression through its lifespan (in frames)4780me.dur=4;//duration; the cookie's lifespan in seconds before it despawns47814782var dur=4;4783if (Game.Has('Weighted sleighs')) dur*=2;4784dur*=Game.eff('reindeerDur');4785me.dur=dur;4786me.life=Math.ceil(Game.fps*me.dur);4787me.sizeMult=1;4788},4789updateFunc:function(me)4790{4791var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,12);4792me.l.style.opacity=curve;4793me.l.style.transform='translate('+(me.x+(Game.bounds.right-Game.bounds.left)*(1-me.life/(Game.fps*me.dur)))+'px,'+(me.y-Math.abs(Math.sin(me.life*0.1))*128)+'px) rotate('+(Math.sin(me.life*0.2+0.3)*10)+'deg) scale('+(me.sizeMult*(1+Math.sin(me.id*0.53)*0.1))+')';4794me.life--;4795if (me.life<=0) {this.missFunc(me);me.die();}4796},4797popFunc:function(me)4798{4799//get achievs and stats4800if (me.spawnLead)4801{4802Game.reindeerClicked++;4803}48044805var val=Game.cookiesPs*60;4806if (Game.hasBuff('Elder frenzy')) val*=0.5;//very sorry4807if (Game.hasBuff('Frenzy')) val*=0.75;//I sincerely apologize4808var moni=Math.max(25,val);//1 minute of cookie production, or 25 cookies - whichever is highest4809if (Game.Has('Ho ho ho-flavored frosting')) moni*=2;4810moni*=Game.eff('reindeerGain');4811Game.Earn(moni);4812if (Game.hasBuff('Elder frenzy')) Game.Win('Eldeer');48134814var cookie='';4815var failRate=0.8;4816if (Game.HasAchiev('Let it snow')) failRate=0.6;4817failRate*=1/Game.dropRateMult();4818if (Game.Has('Starsnow')) failRate*=0.95;4819if (Game.hasGod)4820{4821var godLvl=Game.hasGod('seasons');4822if (godLvl==1) failRate*=0.9;4823else if (godLvl==2) failRate*=0.95;4824else if (godLvl==3) failRate*=0.97;4825}4826if (Math.random()>failRate)//christmas cookie drops4827{4828cookie=choose(['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits']);4829if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))4830{4831Game.Unlock(cookie);4832}4833else cookie='';4834}48354836var popup='';48374838if (Game.prefs.popups) Game.Popup('You found '+choose(['Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen','Rudolph'])+'!<br>The reindeer gives you '+Beautify(moni)+' cookies.'+(cookie==''?'':'<br>You are also rewarded with '+cookie+'!'));4839else Game.Notify('You found '+choose(['Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen','Rudolph'])+'!','The reindeer gives you '+Beautify(moni)+' cookies.'+(cookie==''?'':'<br>You are also rewarded with '+cookie+'!'),[12,9],6);4840popup='<div style="font-size:80%;">+'+Beautify(moni)+' cookies!</div>';48414842if (popup!='') Game.Popup(popup,Game.mouseX,Game.mouseY);48434844//sparkle and kill the shimmer4845Game.SparkleAt(Game.mouseX,Game.mouseY);4846PlaySound('snd/jingleClick.mp3');4847me.die();4848},4849missFunc:function(me)4850{4851},4852spawnsOnTimer:true,4853spawnConditions:function()4854{4855if (Game.season=='christmas') return true; else return false;4856},4857spawned:0,4858time:0,4859minTime:0,4860maxTime:0,4861getTimeMod:function(me,m)4862{4863if (Game.Has('Reindeer baking grounds')) m/=2;4864if (Game.Has('Starsnow')) m*=0.95;4865if (Game.hasGod)4866{4867var godLvl=Game.hasGod('seasons');4868if (godLvl==1) m*=0.9;4869else if (godLvl==2) m*=0.95;4870else if (godLvl==3) m*=0.97;4871}4872m*=1/Game.eff('reindeerFreq');4873if (Game.Has('Reindeer season')) m=0.01;4874return Math.ceil(Game.fps*60*m);4875},4876getMinTime:function(me)4877{4878var m=3;4879return this.getTimeMod(me,m);4880},4881getMaxTime:function(me)4882{4883var m=6;4884return this.getTimeMod(me,m);4885},4886}4887};48884889Game.goldenCookieChoices=[4890"Frenzy","frenzy",4891"Lucky","multiply cookies",4892"Ruin","ruin cookies",4893"Elder frenzy","blood frenzy",4894"Clot","clot",4895"Click frenzy","click frenzy",4896"Cursed finger","cursed finger",4897"Cookie chain","chain cookie",4898"Cookie storm","cookie storm",4899"Building special","building special",4900"Dragon Harvest","dragon harvest",4901"Dragonflight","dragonflight",4902"Sweet","free sugar lump",4903"Blab","blab"4904];4905Game.goldenCookieBuildingBuffs={4906'Cursor':['High-five','Slap to the face'],4907'Grandma':['Congregation','Senility'],4908'Farm':['Luxuriant harvest','Locusts'],4909'Mine':['Ore vein','Cave-in'],4910'Factory':['Oiled-up','Jammed machinery'],4911'Bank':['Juicy profits','Recession'],4912'Temple':['Fervent adoration','Crisis of faith'],4913'Wizard tower':['Manabloom','Magivores'],4914'Shipment':['Delicious lifeforms','Black holes'],4915'Alchemy lab':['Breakthrough','Lab disaster'],4916'Portal':['Righteous cataclysm','Dimensional calamity'],4917'Time machine':['Golden ages','Time jam'],4918'Antimatter condenser':['Extra cycles','Predictable tragedy'],4919'Prism':['Solar flare','Eclipse'],4920'Chancemaker':['Winning streak','Dry spell'],4921'Fractal engine':['Macrocosm','Microcosm'],4922'Javascript console':['Refactoring','Antipattern'],4923};49244925/*=====================================================================================4926PARTICLES4927=======================================================================================*/4928//generic particles (falling cookies etc)4929//only displayed on left section4930Game.particles=[];4931for (var i=0;i<50;i++)4932{4933Game.particles[i]={x:0,y:0,xd:0,yd:0,w:64,h:64,z:0,size:1,dur:2,life:-1,r:0,pic:'smallCookies.png',picId:0};4934}49354936Game.particlesUpdate=function()4937{4938for (var i in Game.particles)4939{4940var me=Game.particles[i];4941if (me.life!=-1)4942{4943if (!me.text) me.yd+=0.2+Math.random()*0.1;4944me.x+=me.xd;4945me.y+=me.yd;4946//me.y+=me.life*0.25+Math.random()*0.25;4947me.life++;4948if (me.life>=Game.fps*me.dur)4949{4950me.life=-1;4951}4952}4953}4954}4955Game.particleAdd=function(x,y,xd,yd,size,dur,z,pic,text)4956{4957//Game.particleAdd(pos X,pos Y,speed X,speed Y,size (multiplier),duration (seconds),layer,picture,text);4958//pick the first free (or the oldest) particle to replace it4959if (1 || Game.prefs.particles)4960{4961var highest=0;4962var highestI=0;4963for (var i in Game.particles)4964{4965if (Game.particles[i].life==-1) {highestI=i;break;}4966if (Game.particles[i].life>highest)4967{4968highest=Game.particles[i].life;4969highestI=i;4970}4971}4972var auto=0;4973if (x) auto=1;4974var i=highestI;4975var x=x||-64;4976if (Game.LeftBackground && !auto) x=Math.floor(Math.random()*Game.LeftBackground.canvas.width);4977var y=y||-64;4978var me=Game.particles[i];4979me.life=0;4980me.x=x;4981me.y=y;4982me.xd=xd||0;4983me.yd=yd||0;4984me.size=size||1;4985me.z=z||0;4986me.dur=dur||2;4987me.r=Math.floor(Math.random()*360);4988me.picId=Math.floor(Math.random()*10000);4989if (!pic)4990{4991if (Game.season=='fools') pic='smallDollars.png';4992else4993{4994var cookies=[[10,0]];4995for (var i in Game.Upgrades)4996{4997var cookie=Game.Upgrades[i];4998if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);4999}5000me.picPos=choose(cookies);5001if (Game.bakeryName.toLowerCase()=='ortiel' || Math.random()<1/10000) me.picPos=[17,5];5002pic='icons.png';5003}5004}5005me.pic=pic||'smallCookies.png';5006me.text=text||0;5007return me;5008}5009return {};5010}5011Game.particlesDraw=function(z)5012{5013var ctx=Game.LeftBackground;5014ctx.fillStyle='#fff';5015ctx.font='20px Merriweather';5016ctx.textAlign='center';50175018for (var i in Game.particles)5019{5020var me=Game.particles[i];5021if (me.z==z)5022{5023if (me.life!=-1)5024{5025var opacity=1-(me.life/(Game.fps*me.dur));5026ctx.globalAlpha=opacity;5027if (me.text)5028{5029ctx.fillText(me.text,me.x,me.y);5030}5031else5032{5033ctx.save();5034ctx.translate(me.x,me.y);5035ctx.rotate((me.r/360)*Math.PI*2);5036var w=64;5037var h=64;5038if (me.pic=='icons.png')5039{5040w=48;5041h=48;5042ctx.drawImage(Pic(me.pic),me.picPos[0]*w,me.picPos[1]*h,w,h,-w/2*me.size,-h/2*me.size,w*me.size,h*me.size);5043}5044else5045{5046if (me.pic=='wrinklerBits.png' || me.pic=='shinyWrinklerBits.png') {w=100;h=200;}5047ctx.drawImage(Pic(me.pic),(me.picId%8)*w,0,w,h,-w/2*me.size,-h/2*me.size,w*me.size,h*me.size);5048}5049ctx.restore();5050}5051}5052}5053}5054}50555056//text particles (popups etc)5057Game.textParticles=[];5058Game.textParticlesY=0;5059var str='';5060for (var i=0;i<20;i++)5061{5062Game.textParticles[i]={x:0,y:0,life:-1,text:''};5063str+='<div id="particle'+i+'" class="particle title"></div>';5064}5065l('particles').innerHTML=str;5066Game.textParticlesUpdate=function()5067{5068for (var i in Game.textParticles)5069{5070var me=Game.textParticles[i];5071if (me.life!=-1)5072{5073me.life++;5074if (me.life>=Game.fps*4)5075{5076var el=me.l;5077me.life=-1;5078el.style.opacity=0;5079el.style.display='none';5080}5081}5082}5083}5084Game.textParticlesAdd=function(text,el,posX,posY)5085{5086//pick the first free (or the oldest) particle to replace it5087var highest=0;5088var highestI=0;5089for (var i in Game.textParticles)5090{5091if (Game.textParticles[i].life==-1) {highestI=i;break;}5092if (Game.textParticles[i].life>highest)5093{5094highest=Game.textParticles[i].life;5095highestI=i;5096}5097}5098var i=highestI;5099var noStack=0;5100if (typeof posX!=='undefined' && typeof posY!=='undefined')5101{5102x=posX;5103y=posY;5104noStack=1;5105}5106else5107{5108var x=(Math.random()-0.5)*40;5109var y=0;//+(Math.random()-0.5)*40;5110if (!el)5111{5112var rect=Game.bounds;5113var x=Math.floor((rect.left+rect.right)/2);5114var y=Math.floor((rect.bottom))-(Game.mobile*64);5115x+=(Math.random()-0.5)*40;5116y+=0;//(Math.random()-0.5)*40;5117}5118}5119if (!noStack) y-=Game.textParticlesY;51205121x=Math.max(Game.bounds.left+200,x);5122x=Math.min(Game.bounds.right-200,x);5123y=Math.max(Game.bounds.top+32,y);51245125var me=Game.textParticles[i];5126if (!me.l) me.l=l('particle'+i);5127me.life=0;5128me.x=x;5129me.y=y;5130me.text=text;5131me.l.innerHTML=text;5132me.l.style.left=Math.floor(Game.textParticles[i].x-200)+'px';5133me.l.style.bottom=Math.floor(-Game.textParticles[i].y)+'px';5134for (var ii in Game.textParticles)5135{if (ii!=i) (Game.textParticles[ii].l||l('particle'+ii)).style.zIndex=100000000;}5136me.l.style.zIndex=100000001;5137me.l.style.display='block';5138me.l.className='particle title';5139void me.l.offsetWidth;5140me.l.className='particle title risingUpLinger';5141if (!noStack) Game.textParticlesY+=60;5142}5143Game.popups=1;5144Game.Popup=function(text,x,y)5145{5146if (Game.popups) Game.textParticlesAdd(text,0,x,y);5147}51485149//display sparkles at a set position5150Game.sparkles=l('sparkles');5151Game.sparklesT=0;5152Game.sparklesFrames=16;5153Game.SparkleAt=function(x,y)5154{5155if (Game.blendModesOn)5156{5157Game.sparklesT=Game.sparklesFrames+1;5158Game.sparkles.style.backgroundPosition='0px 0px';5159Game.sparkles.style.left=Math.floor(x-64)+'px';5160Game.sparkles.style.top=Math.floor(y-64)+'px';5161Game.sparkles.style.display='block';5162}5163}5164Game.SparkleOn=function(el)5165{5166var rect=el.getBoundingClientRect();5167Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);5168}51695170/*=====================================================================================5171NOTIFICATIONS5172=======================================================================================*/5173//maybe do all this mess with proper DOM instead of rewriting the innerHTML5174Game.Notes=[];5175Game.NotesById=[];5176Game.noteId=0;5177Game.noteL=l('notes');5178Game.Note=function(title,desc,pic,quick)5179{5180this.title=title;5181this.desc=desc||'';5182this.pic=pic||'';5183this.id=Game.noteId;5184this.date=Date.now();5185this.quick=quick||0;5186this.life=(this.quick||1)*Game.fps;5187this.l=0;5188this.height=0;5189Game.noteId++;5190Game.NotesById[this.id]=this;5191Game.Notes.unshift(this);5192if (Game.Notes.length>50) Game.Notes.pop();5193//Game.Notes.push(this);5194//if (Game.Notes.length>50) Game.Notes.shift();5195Game.UpdateNotes();5196}5197Game.CloseNote=function(id)5198{5199var me=Game.NotesById[id];5200Game.Notes.splice(Game.Notes.indexOf(me),1);5201//Game.NotesById.splice(Game.NotesById.indexOf(me),1);5202Game.NotesById[id]=null;5203Game.UpdateNotes();5204}5205Game.CloseNotes=function()5206{5207Game.Notes=[];5208Game.NotesById=[];5209Game.UpdateNotes();5210}5211Game.UpdateNotes=function()5212{5213var str='';5214var remaining=Game.Notes.length;5215for (var i in Game.Notes)5216{5217if (i<5)5218{5219var me=Game.Notes[i];5220var pic='';5221if (me.pic!='') pic='<div class="icon" style="'+(me.pic[2]?'background-image:url('+me.pic[2]+');':'')+'background-position:'+(-me.pic[0]*48)+'px '+(-me.pic[1]*48)+'px;"></div>';5222str='<div id="note-'+me.id+'" class="framed note '+(me.pic!=''?'haspic':'nopic')+' '+(me.desc!=''?'hasdesc':'nodesc')+'"><div class="close" onclick="PlaySound(\'snd/tick.mp3\');Game.CloseNote('+me.id+');">x</div>'+pic+'<div class="text"><h3>'+me.title+'</h3>'+(me.desc!=''?'<div class="line"></div><h5>'+me.desc+'</h5>':'')+'</div></div>'+str;5223remaining--;5224}5225}5226if (remaining>0) str='<div class="remaining">+'+remaining+' more notification'+(remaining==1?'':'s')+'.</div>'+str;5227if (Game.Notes.length>1)5228{5229str+='<div class="framed close sidenote" onclick="PlaySound(\'snd/tick.mp3\');Game.CloseNotes();">x</div>';5230}5231Game.noteL.innerHTML=str;5232for (var i in Game.Notes)5233{5234me.l=0;5235if (i<5)5236{5237var me=Game.Notes[i];5238me.l=l('note-'+me.id);5239}5240}5241}5242Game.NotesLogic=function()5243{5244for (var i in Game.Notes)5245{5246if (Game.Notes[i].quick>0)5247{5248var me=Game.Notes[i];5249me.life--;5250if (me.life<=0) Game.CloseNote(me.id);5251}5252}5253}5254Game.NotesDraw=function()5255{5256for (var i in Game.Notes)5257{5258if (Game.Notes[i].quick>0)5259{5260var me=Game.Notes[i];5261if (me.l)5262{5263if (me.life<10)5264{5265me.l.style.opacity=(me.life/10);5266}5267}5268}5269}5270}5271Game.Notify=function(title,desc,pic,quick,noLog)5272{5273if (Game.prefs.notifs)5274{5275quick=Math.min(6,quick);5276if (!quick) quick=6;5277}5278desc=replaceAll('==CLOSETHIS()==','Game.CloseNote('+Game.noteId+');',desc);5279if (Game.popups) new Game.Note(title,desc,pic,quick);5280if (!noLog) Game.AddToLog('<b>'+title+'</b> | '+desc);5281}528252835284/*=====================================================================================5285PROMPT5286=======================================================================================*/5287Game.darkenL=l('darken');5288AddEvent(Game.darkenL,'click',function(){Game.Click=0;Game.ClosePrompt();});5289Game.promptL=l('promptContent');5290Game.promptAnchorL=l('promptAnchor');5291Game.promptWrapL=l('prompt');5292Game.promptConfirm='';5293Game.promptOn=0;5294Game.promptUpdateFunc=0;5295Game.UpdatePrompt=function()5296{5297if (Game.promptUpdateFunc) Game.promptUpdateFunc();5298Game.promptAnchorL.style.top=Math.floor((Game.windowH-Game.promptWrapL.offsetHeight)/2-16)+'px';5299}5300Game.Prompt=function(content,options,updateFunc,style)5301{5302if (updateFunc) Game.promptUpdateFunc=updateFunc;5303if (style) Game.promptWrapL.className='framed '+style; else Game.promptWrapL.className='framed';5304var str='';5305str+=content;5306var opts='';5307for (var i in options)5308{5309if (options[i]=='br')//just a linebreak5310{opts+='<br>';}5311else5312{5313if (typeof options[i]=='string') options[i]=[options[i],'Game.ClosePrompt();'];5314options[i][1]=options[i][1].replace(/'/g,''').replace(/"/g,'"');5315opts+='<a id="promptOption'+i+'" class="option" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');'+options[i][1]+'">'+options[i][0]+'</a>';5316}5317}5318Game.promptL.innerHTML=str+'<div class="optionBox">'+opts+'</div>';5319Game.promptAnchorL.style.display='block';5320Game.darkenL.style.display='block';5321Game.promptL.focus();5322Game.promptOn=1;5323Game.UpdatePrompt();5324}5325Game.ClosePrompt=function()5326{5327Game.promptAnchorL.style.display='none';5328Game.darkenL.style.display='none';5329Game.promptOn=0;5330Game.promptUpdateFunc=0;5331}5332Game.ConfirmPrompt=function()5333{5334if (Game.promptOn && l('promptOption0') && l('promptOption0').style.display!='none') FireEvent(l('promptOption0'),'click');5335}53365337/*=====================================================================================5338MENUS5339=======================================================================================*/5340Game.cssClasses=[];5341Game.addClass=function(what) {if (Game.cssClasses.indexOf(what)==-1) Game.cssClasses.push(what);Game.updateClasses();}5342Game.removeClass=function(what) {var i=Game.cssClasses.indexOf(what);if(i!=-1) {Game.cssClasses.splice(i,1);}Game.updateClasses();}5343Game.updateClasses=function() {Game.l.className=Game.cssClasses.join(' ');}53445345Game.WriteButton=function(prefName,button,on,off,callback,invert)5346{5347var invert=invert?1:0;5348if (!callback) callback='';5349callback+='PlaySound(\'snd/tick.mp3\');';5350return '<a class="option'+((Game.prefs[prefName]^invert)?'':' off')+'" id="'+button+'" '+Game.clickStr+'="Game.Toggle(\''+prefName+'\',\''+button+'\',\''+on+'\',\''+off+'\',\''+invert+'\');'+callback+'">'+(Game.prefs[prefName]?on:off)+'</a>';5351}5352Game.Toggle=function(prefName,button,on,off,invert)5353{5354if (Game.prefs[prefName])5355{5356l(button).innerHTML=off;5357Game.prefs[prefName]=0;5358}5359else5360{5361l(button).innerHTML=on;5362Game.prefs[prefName]=1;5363}5364l(button).className='option'+((Game.prefs[prefName]^invert)?'':' off');53655366}5367Game.ToggleFancy=function()5368{5369if (Game.prefs.fancy) Game.removeClass('noFancy');5370else if (!Game.prefs.fancy) Game.addClass('noFancy');5371}5372Game.ToggleFilters=function()5373{5374if (Game.prefs.filters) Game.removeClass('noFilters');5375else if (!Game.prefs.filters) Game.addClass('noFilters');5376}5377Game.ToggleExtraButtons=function()5378{5379if (!Game.prefs.extraButtons) Game.removeClass('extraButtons');5380else if (Game.prefs.extraButtons) Game.addClass('extraButtons');5381for (var i in Game.Objects)5382{5383Game.Objects[i].mute(0);5384}5385}53865387Game.WriteSlider=function(slider,leftText,rightText,startValueFunction,callback)5388{5389if (!callback) callback='';5390return '<div class="sliderBox"><div style="float:left;">'+leftText+'</div><div style="float:right;" id="'+slider+'RightText">'+rightText.replace('[$]',startValueFunction())+'</div><input class="slider" style="clear:both;" type="range" min="0" max="100" step="1" value="'+startValueFunction()+'" onchange="'+callback+'" oninput="'+callback+'" onmouseup="PlaySound(\'snd/tick.mp3\');" id="'+slider+'"/></div>';5391}53925393Game.onPanel='Left';5394Game.addClass('focus'+Game.onPanel);5395Game.ShowPanel=function(what)5396{5397if (!what) what='';5398if (Game.onPanel!=what)5399{5400Game.removeClass('focus'+Game.onPanel);5401Game.addClass('focus'+what);5402}5403Game.onPanel=what;5404}54055406Game.onMenu='';5407Game.ShowMenu=function(what)5408{5409if (!what || what=='') what=Game.onMenu;5410if (Game.onMenu=='' && what!='') Game.addClass('onMenu');5411else if (Game.onMenu!='' && what!=Game.onMenu) Game.addClass('onMenu');5412else if (what==Game.onMenu) {Game.removeClass('onMenu');what='';}5413//if (what=='log') l('donateBox').className='on'; else l('donateBox').className='';5414Game.onMenu=what;54155416l('prefsButton').className=(Game.onMenu=='prefs')?'button selected':'button';5417l('statsButton').className=(Game.onMenu=='stats')?'button selected':'button';5418l('logButton').className=(Game.onMenu=='log')?'button selected':'button';54195420if (Game.onMenu=='') PlaySound('snd/clickOff.mp3');5421else PlaySound('snd/clickOn.mp3');54225423Game.UpdateMenu();54245425if (what=='')5426{5427for (var i in Game.Objects)5428{5429var me=Game.Objects[i];5430if (me.minigame && me.minigame.onResize) me.minigame.onResize();5431}5432}5433}5434Game.sayTime=function(time,detail)5435{5436//time is a value where one second is equal to Game.fps (30).5437//detail skips days when >1, hours when >2, minutes when >3 and seconds when >4.5438//if detail is -1, output something like "3 hours, 9 minutes, 48 seconds"5439if (time<=0) return '';5440var str='';5441var detail=detail||0;5442time=Math.floor(time);5443if (detail==-1)5444{5445//var months=0;5446var days=0;5447var hours=0;5448var minutes=0;5449var seconds=0;5450//if (time>=Game.fps*60*60*24*30) months=(Math.floor(time/(Game.fps*60*60*24*30)));5451if (time>=Game.fps*60*60*24) days=(Math.floor(time/(Game.fps*60*60*24)));5452if (time>=Game.fps*60*60) hours=(Math.floor(time/(Game.fps*60*60)));5453if (time>=Game.fps*60) minutes=(Math.floor(time/(Game.fps*60)));5454if (time>=Game.fps) seconds=(Math.floor(time/(Game.fps)));5455//days-=months*30;5456hours-=days*24;5457minutes-=hours*60+days*24*60;5458seconds-=minutes*60+hours*60*60+days*24*60*60;5459if (days>10) {hours=0;}5460if (days) {minutes=0;seconds=0;}5461if (hours) {seconds=0;}5462var bits=[];5463//if (months>0) bits.push(Beautify(months)+' month'+(days==1?'':'s'));5464if (days>0) bits.push(Beautify(days)+' day'+(days==1?'':'s'));5465if (hours>0) bits.push(Beautify(hours)+' hour'+(hours==1?'':'s'));5466if (minutes>0) bits.push(Beautify(minutes)+' minute'+(minutes==1?'':'s'));5467if (seconds>0) bits.push(Beautify(seconds)+' second'+(seconds==1?'':'s'));5468if (bits.length==0) str='less than 1 second';5469else str=bits.join(', ');5470}5471else5472{5473/*if (time>=Game.fps*60*60*24*30*2 && detail<1) str=Beautify(Math.floor(time/(Game.fps*60*60*24*30)))+' months';5474else if (time>=Game.fps*60*60*24*30 && detail<1) str='1 month';5475else */if (time>=Game.fps*60*60*24*2 && detail<2) str=Beautify(Math.floor(time/(Game.fps*60*60*24)))+' days';5476else if (time>=Game.fps*60*60*24 && detail<2) str='1 day';5477else if (time>=Game.fps*60*60*2 && detail<3) str=Beautify(Math.floor(time/(Game.fps*60*60)))+' hours';5478else if (time>=Game.fps*60*60 && detail<3) str='1 hour';5479else if (time>=Game.fps*60*2 && detail<4) str=Beautify(Math.floor(time/(Game.fps*60)))+' minutes';5480else if (time>=Game.fps*60 && detail<4) str='1 minute';5481else if (time>=Game.fps*2 && detail<5) str=Beautify(Math.floor(time/(Game.fps)))+' seconds';5482else if (time>=Game.fps && detail<5) str='1 second';5483else str='less than 1 second';5484}5485return str;5486}54875488Game.tinyCookie=function()5489{5490if (!Game.HasAchiev('Tiny cookie'))5491{5492return '<div class="tinyCookie" '+Game.clickStr+'="Game.ClickTinyCookie();"></div>';5493}5494return '';5495}5496Game.ClickTinyCookie=function(){if (!Game.HasAchiev('Tiny cookie')){PlaySound('snd/tick.mp3');Game.Win('Tiny cookie');}}54975498Game.setVolume=function(what)5499{5500Game.volume=what;5501/*for (var i in Sounds)5502{5503Sounds[i].volume=Game.volume;5504}*/5505}55065507Game.UpdateMenu=function()5508{5509var str='';5510if (Game.onMenu!='')5511{5512str+='<div class="close menuClose" '+Game.clickStr+'="Game.ShowMenu();">x</div>';5513//str+='<div style="position:absolute;top:8px;right:8px;cursor:pointer;font-size:16px;" '+Game.clickStr+'="Game.ShowMenu();">X</div>';5514}5515if (Game.onMenu=='prefs')5516{5517str+='<div class="section">Options</div>'+5518'<div class="subsection">'+5519'<div class="title">General</div>'+5520'<div class="listing"><a class="option" '+Game.clickStr+'="Game.toSave=true;PlaySound(\'snd/tick.mp3\');">Save</a><label>Save manually (the game autosaves every 60 seconds; shortcut : ctrl+S)</label></div>'+5521'<div class="listing"><a class="option" '+Game.clickStr+'="Game.ExportSave();PlaySound(\'snd/tick.mp3\');">Export save</a><a class="option" '+Game.clickStr+'="Game.ImportSave();PlaySound(\'snd/tick.mp3\');">Import save</a><label>You can use this to backup your save or to transfer it to another computer (shortcut for import : ctrl+O)</label></div>'+5522'<div class="listing"><a class="option" '+Game.clickStr+'="Game.FileSave();PlaySound(\'snd/tick.mp3\');">Save to file</a><a class="option" style="position:relative;"><input id="FileLoadInput" type="file" style="cursor:pointer;opacity:0;position:absolute;left:0px;top:0px;width:100%;height:100%;" onchange="Game.FileLoad(event);" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');"/>Load from file</a><label>Use this to keep backups on your computer</label></div>'+55235524'<div class="listing"><a class="option warning" '+Game.clickStr+'="Game.HardReset();PlaySound(\'snd/tick.mp3\');">Wipe save</a><label>Delete all your progress, including your achievements</label></div>'+5525'<div class="title">Settings</div>'+5526'<div class="listing">'+5527Game.WriteSlider('volumeSlider','Volume','[$]%',function(){return Game.volume;},'Game.setVolume(Math.round(l(\'volumeSlider\').value));l(\'volumeSliderRightText\').innerHTML=Game.volume+\'%\';')+'<br>'+5528Game.WriteButton('fancy','fancyButton','Fancy graphics ON','Fancy graphics OFF','Game.ToggleFancy();')+'<label>(visual improvements; disabling may improve performance)</label><br>'+5529Game.WriteButton('filters','filtersButton','CSS filters ON','CSS filters OFF','Game.ToggleFilters();')+'<label>(cutting-edge visual improvements; disabling may improve performance)</label><br>'+5530Game.WriteButton('particles','particlesButton','Particles ON','Particles OFF')+'<label>(cookies falling down, etc; disabling may improve performance)</label><br>'+5531Game.WriteButton('numbers','numbersButton','Numbers ON','Numbers OFF')+'<label>(numbers that pop up when clicking the cookie)</label><br>'+5532Game.WriteButton('milk','milkButton','Milk ON','Milk OFF')+'<label>(only appears with enough achievements)</label><br>'+5533Game.WriteButton('cursors','cursorsButton','Cursors ON','Cursors OFF')+'<label>(visual display of your cursors)</label><br>'+5534Game.WriteButton('wobbly','wobblyButton','Wobbly cookie ON','Wobbly cookie OFF')+'<label>(your cookie will react when you click it)</label><br>'+5535Game.WriteButton('cookiesound','cookiesoundButton','Alt cookie sound ON','Alt cookie sound OFF')+'<label>(how your cookie sounds when you click on it)</label><br>'+5536Game.WriteButton('crates','cratesButton','Icon crates ON','Icon crates OFF')+'<label>(display boxes around upgrades and achievements in stats)</label><br>'+5537Game.WriteButton('monospace','monospaceButton','Alt font ON','Alt font OFF')+'<label>(your cookies are displayed using a monospace font)</label><br>'+5538Game.WriteButton('format','formatButton','Short numbers OFF','Short numbers ON','BeautifyAll();Game.RefreshStore();Game.upgradesToRebuild=1;',1)+'<label>(shorten big numbers)</label><br>'+5539Game.WriteButton('notifs','notifsButton','Fast notes ON','Fast notes OFF')+'<label>(notifications disappear much faster)</label><br>'+5540//Game.WriteButton('autoupdate','autoupdateButton','Offline mode OFF','Offline mode ON',0,1)+'<label>(disables update notifications)</label><br>'+5541Game.WriteButton('warn','warnButton','Closing warning ON','Closing warning OFF')+'<label>(the game will ask you to confirm when you close the window)</label><br>'+5542Game.WriteButton('focus','focusButton','Defocus OFF','Defocus ON',0,1)+'<label>(the game will be less resource-intensive when out of focus)</label><br>'+5543Game.WriteButton('extraButtons','extraButtonsButton','Extra buttons ON','Extra buttons OFF','Game.ToggleExtraButtons();')+'<label>(add Mute buttons on buildings)</label><br>'+5544Game.WriteButton('askLumps','askLumpsButton','Lump confirmation ON','Lump confirmation OFF')+'<label>(the game will ask you to confirm before spending sugar lumps)</label><br>'+5545Game.WriteButton('customGrandmas','customGrandmasButton','Custom grandmas ON','Custom grandmas OFF')+'<label>(some grandmas will be named after Patreon supporters)</label><br>'+5546Game.WriteButton('timeout','timeoutButton','Sleep mode timeout ON','Sleep mode timeout OFF')+'<label>(on slower computers, the game will put itself in sleep mode when it\'s inactive and starts to lag out; offline CpS production kicks in during sleep mode)</label><br>'+5547'</div>'+5548//'<div class="listing">'+Game.WriteButton('autosave','autosaveButton','Autosave ON','Autosave OFF')+'</div>'+5549'<div style="padding-bottom:128px;"></div>'+5550'</div>'5551;5552}5553else if (Game.onMenu=='main')5554{5555str+=5556'<div class="listing">This isn\'t really finished</div>'+5557'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'prefs\');">Menu</a></div>'+5558'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'stats\');">Stats</a></div>'+5559'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'log\');">Updates</a></div>'+5560'<div class="listing"><a class="option big title" '+Game.clickStr+'="">Quit</a></div>'+5561'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(Game.onMenu);">Resume</a></div>';5562}5563else if (Game.onMenu=='log')5564{5565str+=replaceAll('[bakeryName]',Game.bakeryName,Game.updateLog);5566}5567else if (Game.onMenu=='stats')5568{5569var buildingsOwned=0;5570buildingsOwned=Game.BuildingsOwned;5571var upgrades='';5572var cookieUpgrades='';5573var hiddenUpgrades='';5574var prestigeUpgrades='';5575var upgradesTotal=0;5576var upgradesOwned=0;5577var prestigeUpgradesTotal=0;5578var prestigeUpgradesOwned=0;55795580var list=[];5581for (var i in Game.Upgrades)//sort the upgrades5582{5583list.push(Game.Upgrades[i]);5584}5585var sortMap=function(a,b)5586{5587if (a.order>b.order) return 1;5588else if (a.order<b.order) return -1;5589else return 0;5590}5591list.sort(sortMap);5592for (var i in list)5593{5594var str2='';5595var me=list[i];55965597str2+=Game.crate(me,'stats');55985599if (me.bought)5600{5601if (Game.CountsAsUpgradeOwned(me.pool)) upgradesOwned++;5602else if (me.pool=='prestige') prestigeUpgradesOwned++;5603}56045605if (me.pool=='' || me.pool=='cookie' || me.pool=='tech') upgradesTotal++;5606if (me.pool=='debug') hiddenUpgrades+=str2;5607else if (me.pool=='prestige') {prestigeUpgrades+=str2;prestigeUpgradesTotal++;}5608else if (me.pool=='cookie') cookieUpgrades+=str2;5609else if (me.pool!='toggle' && me.pool!='unused') upgrades+=str2;5610}5611var achievements=[];5612var achievementsOwned=0;5613var achievementsOwnedOther=0;5614var achievementsTotal=0;56155616var list=[];5617for (var i in Game.Achievements)//sort the achievements5618{5619list.push(Game.Achievements[i]);5620}5621var sortMap=function(a,b)5622{5623if (a.order>b.order) return 1;5624else if (a.order<b.order) return -1;5625else return 0;5626}5627list.sort(sortMap);562856295630for (var i in list)5631{5632var me=list[i];5633//if (me.pool=='normal' || me.won>0) achievementsTotal++;5634if (Game.CountsAsAchievementOwned(me.pool)) achievementsTotal++;5635var pool=me.pool;5636if (!achievements[pool]) achievements[pool]='';5637achievements[pool]+=Game.crate(me,'stats');56385639if (me.won)5640{5641if (Game.CountsAsAchievementOwned(me.pool)) achievementsOwned++;5642else achievementsOwnedOther++;5643}5644}56455646var achievementsStr='';5647var pools={5648'dungeon':'<b>Dungeon achievements</b> <small>(Not technically achievable yet.)</small>',5649'shadow':'<b>Shadow achievements</b> <small>(These are feats that are either unfair or difficult to attain. They do not give milk.)</small>'5650};5651for (var i in achievements)5652{5653if (achievements[i]!='')5654{5655if (pools[i]) achievementsStr+='<div class="listing">'+pools[i]+'</div>';5656achievementsStr+='<div class="listing crateBox">'+achievements[i]+'</div>';5657}5658}56595660var milkStr='';5661for (var i=0;i<Game.Milks.length;i++)5662{5663if (Game.milkProgress>=i)5664{5665var milk=Game.Milks[i];5666milkStr+='<div '+Game.getTooltip(5667'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px;padding-bottom:96px;"><h3 style="margin:6px 32px 0px 32px;">'+milk.name+'</h3><div style="opacity:0.75;font-size:9px;">('+(i==0?'starter milk':('for '+Beautify(i*25)+' achievements'))+')</div><div class="line"></div><div style="width:100%;height:96px;position:absolute;left:0px;bottom:0px;background:url(img/'+milk.pic+'.png);"></div></div>'5668,'top')+' style="background:url(img/icons.png) '+(-milk.icon[0]*48)+'px '+(-milk.icon[1]*48)+'px;margin:2px 0px;" class="trophy"></div>';5669}5670}5671milkStr+='<div style="clear:both;"></div>';56725673var santaStr='';5674var frames=15;5675if (Game.Has('A festive hat'))5676{5677for (var i=0;i<=Game.santaLevel;i++)5678{5679santaStr+='<div '+Game.getTooltip(5680'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px 32px;"><div style="width:96px;height:96px;margin:4px auto;background:url(img/santa.png) '+(-i*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div><div class="line"></div><h3>'+Game.santaLevels[i]+'</h3></div>'5681,'top')+' style="background:url(img/santa.png) '+(-i*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';5682}5683santaStr+='<div style="clear:both;"></div>';5684}5685var dragonStr='';5686var frames=9;5687var mainLevels=[0,4,8,22,23,24];5688if (Game.Has('A crumbly egg'))5689{5690for (var i=0;i<=mainLevels.length;i++)5691{5692if (Game.dragonLevel>=mainLevels[i])5693{5694var level=Game.dragonLevels[mainLevels[i]];5695dragonStr+='<div '+Game.getTooltip(5696//'<div style="width:96px;height:96px;margin:4px auto;background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*96)+'px 0px;"></div><div class="line"></div><div style="min-width:200px;text-align:center;margin-bottom:6px;">'+level.name+'</div>'5697'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px 32px;"><div style="width:96px;height:96px;margin:4px auto;background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div><div class="line"></div><h3>'+level.name+'</h3></div>'5698,'top')+' style="background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';5699}5700}5701dragonStr+='<div style="clear:both;"></div>';5702}5703var ascensionModeStr='';5704var icon=Game.ascensionModes[Game.ascensionMode].icon;5705if (Game.resets>0) ascensionModeStr='<span style="cursor:pointer;" '+Game.getTooltip(5706'<div style="min-width:200px;text-align:center;font-size:11px;">'+Game.ascensionModes[Game.ascensionMode].desc+'</div>'5707,'top')+'><div class="icon" style="display:inline-block;float:none;transform:scale(0.5);margin:-24px -16px -19px -8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+Game.ascensionModes[Game.ascensionMode].name+'</span>';57085709var milkName=Game.Milk.name;57105711var researchStr=Game.sayTime(Game.researchT,-1);5712var pledgeStr=Game.sayTime(Game.pledgeT,-1);5713var wrathStr='';5714if (Game.elderWrath==1) wrathStr='awoken';5715else if (Game.elderWrath==2) wrathStr='displeased';5716else if (Game.elderWrath==3) wrathStr='angered';5717else if (Game.elderWrath==0 && Game.pledges>0) wrathStr='appeased';57185719var date=new Date();5720date.setTime(Date.now()-Game.startDate);5721var timeInSeconds=date.getTime()/1000;5722var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);5723date.setTime(Date.now()-Game.fullDate);5724var fullDate=Game.sayTime(date.getTime()/1000*Game.fps,-1);5725if (!Game.fullDate || !fullDate || fullDate.length<1) fullDate='a long while';5726/*date.setTime(new Date().getTime()-Game.lastDate);5727var lastDate=Game.sayTime(date.getTime()/1000*Game.fps,2);*/57285729var heavenlyMult=Game.GetHeavenlyMultiplier();57305731var seasonStr=Game.sayTime(Game.seasonT,-1);57325733str+='<div class="section">Statistics</div>'+5734'<div class="subsection">'+5735'<div class="title">General</div>'+5736'<div class="listing"><b>Cookies in bank :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookies)+'</div></div>'+5737'<div class="listing"><b>Cookies baked (this ascension) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned)+'</div></div>'+5738'<div class="listing"><b>Cookies baked (all time) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned+Game.cookiesReset)+'</div></div>'+5739(Game.cookiesReset>0?'<div class="listing"><b>Cookies forfeited by ascending :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesReset)+'</div></div>':'')+5740(Game.resets?('<div class="listing"><b>Legacy started :</b> '+(fullDate==''?'just now':(fullDate+' ago'))+', with '+Beautify(Game.resets)+' ascension'+(Game.resets==1?'':'s')+'</div>'):'')+5741'<div class="listing"><b>Run started :</b> '+(startDate==''?'just now':(startDate+' ago'))+'</div>'+5742'<div class="listing"><b>Buildings owned :</b> '+Beautify(buildingsOwned)+'</div>'+5743'<div class="listing"><b>Cookies per second :</b> '+Beautify(Game.cookiesPs,1)+' <small>'+5744'(multiplier : '+Beautify(Math.round(Game.globalCpsMult*100),1)+'%)'+5745(Game.cpsSucked>0?' <span class="warning">(withered : '+Beautify(Math.round(Game.cpsSucked*100),1)+'%)</span>':'')+5746'</small></div>'+5747'<div class="listing"><b>Cookies per click :</b> '+Beautify(Game.computedMouseCps,1)+'</div>'+5748'<div class="listing"><b>Cookie clicks :</b> '+Beautify(Game.cookieClicks)+'</div>'+5749'<div class="listing"><b>Hand-made cookies :</b> '+Beautify(Game.handmadeCookies)+'</div>'+5750'<div class="listing"><b>Golden cookie clicks :</b> '+Beautify(Game.goldenClicksLocal)+' <small>(all time : '+Beautify(Game.goldenClicks)+')</small></div>'+//' <span class="hidden">(<b>Missed golden cookies :</b> '+Beautify(Game.missedGoldenClicks)+')</span></div>'+5751'<br><div class="listing"><b>Running version :</b> '+Game.version+'</div>'+57525753((researchStr!='' || wrathStr!='' || pledgeStr!='' || santaStr!='' || dragonStr!='' || Game.season!='' || ascensionModeStr!='' || Game.canLumps())?(5754'</div><div class="subsection">'+5755'<div class="title">Special</div>'+5756(ascensionModeStr!=''?'<div class="listing"><b>Challenge mode :</b>'+ascensionModeStr+'</div>':'')+5757(Game.season!=''?'<div class="listing"><b>Seasonal event :</b> '+Game.seasons[Game.season].name+5758(seasonStr!=''?' <small>('+seasonStr+' remaining)</small>':'')+5759'</div>':'')+5760(Game.season=='fools'?5761'<div class="listing"><b>Money made from selling cookies :</b> $'+Beautify(Game.cookiesEarned*0.08,2)+'</div>'+5762(Game.Objects['Portal'].amount>0?'<div class="listing"><b>TV show seasons produced :</b> '+Beautify(Math.floor((timeInSeconds/60/60)*(Game.Objects['Portal'].amount*0.13)+1))+'</div>':'')5763:'')+5764(researchStr!=''?'<div class="listing"><b>Research :</b> '+researchStr+' remaining</div>':'')+5765(wrathStr!=''?'<div class="listing"><b>Grandmatriarchs status :</b> '+wrathStr+'</div>':'')+5766(pledgeStr!=''?'<div class="listing"><b>Pledge :</b> '+pledgeStr+' remaining</div>':'')+5767(Game.wrinklersPopped>0?'<div class="listing"><b>Wrinklers popped :</b> '+Beautify(Game.wrinklersPopped)+'</div>':'')+5768((Game.canLumps() && Game.lumpsTotal>-1)?'<div class="listing"><b>Sugar lumps harvested :</b> <div class="price lump plain">'+Beautify(Game.lumpsTotal)+'</div></div>':'')+5769//(Game.cookiesSucked>0?'<div class="listing warning"><b>Withered :</b> '+Beautify(Game.cookiesSucked)+' cookies</div>':'')+5770(Game.reindeerClicked>0?'<div class="listing"><b>Reindeer found :</b> '+Beautify(Game.reindeerClicked)+'</div>':'')+5771(santaStr!=''?'<div class="listing"><b>Santa stages unlocked :</b></div><div>'+santaStr+'</div>':'')+5772(dragonStr!=''?'<div class="listing"><b>Dragon training :</b></div><div>'+dragonStr+'</div>':'')+5773''5774):'')+5775((Game.prestige>0 || prestigeUpgrades!='')?(5776'</div><div class="subsection">'+5777'<div class="title">Prestige</div>'+5778'<div class="listing"><div class="icon" style="float:left;background-position:'+(-19*48)+'px '+(-7*48)+'px;"></div>'+5779'<div style="margin-top:8px;"><span class="title" style="font-size:22px;">Prestige level : '+Beautify(Game.prestige)+'</span> at '+Beautify(heavenlyMult*100,1)+'% of its potential <b>(+'+Beautify(parseFloat(Game.prestige)*Game.heavenlyPower*heavenlyMult,1)+'% CpS)</b><br>Heavenly chips : <b>'+Beautify(Game.heavenlyChips)+'</b></div>'+5780'</div>'+5781(prestigeUpgrades!=''?(5782'<div class="listing" style="clear:left;"><b>Prestige upgrades unlocked :</b> '+prestigeUpgradesOwned+'/'+prestigeUpgradesTotal+' ('+Math.floor((prestigeUpgradesOwned/prestigeUpgradesTotal)*100)+'%)</div>'+5783'<div class="listing crateBox">'+prestigeUpgrades+'</div>'):'')+5784''):'')+57855786'</div><div class="subsection">'+5787'<div class="title">Upgrades</div>'+5788(hiddenUpgrades!=''?('<div class="listing"><b>Debug</b></div>'+5789'<div class="listing crateBox">'+hiddenUpgrades+'</div>'):'')+5790'<div class="listing"><b>Upgrades unlocked :</b> '+upgradesOwned+'/'+upgradesTotal+' ('+Math.floor((upgradesOwned/upgradesTotal)*100)+'%)</div>'+5791'<div class="listing crateBox">'+upgrades+'</div>'+5792(cookieUpgrades!=''?('<div class="listing"><b>Cookies</b></div>'+5793'<div class="listing crateBox">'+cookieUpgrades+'</div>'):'')+5794'</div><div class="subsection">'+5795'<div class="title">Achievements</div>'+5796'<div class="listing"><b>Achievements unlocked :</b> '+achievementsOwned+'/'+achievementsTotal+' ('+Math.floor((achievementsOwned/achievementsTotal)*100)+'%)'+(achievementsOwnedOther>0?('<span style="font-weight:bold;font-size:10px;color:#70a;"> (+'+achievementsOwnedOther+')</span>'):'')+'</div>'+5797(Game.cookiesMultByType['kittens']>1?('<div class="listing"><b>Kitten multiplier :</b> '+Beautify((Game.cookiesMultByType['kittens'])*100)+'%</div>'):'')+5798'<div class="listing"><b>Milk :</b> '+milkName+'</div>'+5799(milkStr!=''?'<div class="listing"><b>Milk flavors unlocked :</b></div><div>'+milkStr+'</div>':'')+5800'<div class="listing"><small style="opacity:0.75;">(Milk is gained with each achievement. It can unlock unique upgrades over time.)</small></div>'+5801achievementsStr+5802'</div>'+5803'<div style="padding-bottom:128px;"></div>'5804;5805}5806//str='<div id="selectionKeeper" class="selectable">'+str+'</div>';5807l('menu').innerHTML=str;5808/*AddEvent(l('selectionKeeper'),'mouseup',function(e){5809console.log('selection:',window.getSelection());5810});*/5811}58125813AddEvent(l('prefsButton'),'click',function(){Game.ShowMenu('prefs');});5814AddEvent(l('statsButton'),'click',function(){Game.ShowMenu('stats');});5815AddEvent(l('logButton'),'click',function(){Game.ShowMenu('log');});5816AddEvent(l('legacyButton'),'click',function(){PlaySound('snd/tick.mp3');Game.Ascend();});5817Game.ascendMeter=l('ascendMeter');5818Game.ascendNumber=l('ascendNumber');58195820Game.lastPanel='';5821if (Game.touchEvents)5822{5823AddEvent(l('focusLeft'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Left');});5824AddEvent(l('focusMiddle'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});5825AddEvent(l('focusRight'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Right');});5826AddEvent(l('focusMenu'),'touchend',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});5827}5828else5829{5830AddEvent(l('focusLeft'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Left');});5831AddEvent(l('focusMiddle'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});5832AddEvent(l('focusRight'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Right');});5833AddEvent(l('focusMenu'),'click',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});5834}5835//AddEvent(l('focusMenu'),'touchend',function(){if (Game.onPanel=='Menu' && Game.lastPanel!='') {Game.ShowMenu('main');Game.ShowPanel(Game.lastPanel);} else {Game.lastPanel=Game.onPanel;Game.ShowMenu('main');Game.ShowPanel('Menu');}});58365837/*=====================================================================================5838NEWS TICKER5839=======================================================================================*/5840Game.Ticker='';5841Game.TickerAge=0;5842Game.TickerEffect=0;5843Game.TickerN=0;5844Game.TickerClicks=0;5845Game.UpdateTicker=function()5846{5847Game.TickerAge--;5848if (Game.TickerAge<=0) Game.getNewTicker();5849else if (Game.Ticker=='') Game.getNewTicker(true);5850}5851Game.getNewTicker=function(manual)//note : "manual" is true if the ticker was clicked, but may also be true on startup etc5852{5853var list=[];58545855if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)5856{5857var animals=['newts','penguins','scorpions','axolotls','puffins','porpoises','blowfish','horses','crayfish','slugs','humpback whales','nurse sharks','giant squids','polar bears','fruit bats','frogs','sea squirts','velvet worms','mole rats','paramecia','nematodes','tardigrades','giraffes','monkfish','wolfmen','goblins','hippies'];58585859if (Math.random()<0.75 || Game.cookiesEarned<10000)5860{5861if (Game.Objects['Grandma'].amount>0) list.push(choose([5862'<q>Moist cookies.</q><sig>grandma</sig>',5863'<q>We\'re nice grandmas.</q><sig>grandma</sig>',5864'<q>Indentured servitude.</q><sig>grandma</sig>',5865'<q>Come give grandma a kiss.</q><sig>grandma</sig>',5866'<q>Why don\'t you visit more often?</q><sig>grandma</sig>',5867'<q>Call me...</q><sig>grandma</sig>'5868]));58695870if (Game.Objects['Grandma'].amount>=50) list.push(choose([5871'<q>Absolutely disgusting.</q><sig>grandma</sig>',5872'<q>You make me sick.</q><sig>grandma</sig>',5873'<q>You disgust me.</q><sig>grandma</sig>',5874'<q>We rise.</q><sig>grandma</sig>',5875'<q>It begins.</q><sig>grandma</sig>',5876'<q>It\'ll all be over soon.</q><sig>grandma</sig>',5877'<q>You could have stopped it.</q><sig>grandma</sig>'5878]));58795880if (Game.HasAchiev('Just wrong') && Math.random()<0.4) list.push(choose([5881'News : cookie manufacturer downsizes, sells own grandmother!',5882'<q>It has betrayed us, the filthy little thing.</q><sig>grandma</sig>',5883'<q>It tried to get rid of us, the nasty little thing.</q><sig>grandma</sig>',5884'<q>It thought we would go away by selling us. How quaint.</q><sig>grandma</sig>',5885'<q>I can smell your rotten cookies.</q><sig>grandma</sig>'5886]));58875888if (Game.Objects['Grandma'].amount>=1 && Game.pledges>0 && Game.elderWrath==0) list.push(choose([5889'<q>shrivel</q><sig>grandma</sig>',5890'<q>writhe</q><sig>grandma</sig>',5891'<q>throb</q><sig>grandma</sig>',5892'<q>gnaw</q><sig>grandma</sig>',5893'<q>We will rise again.</q><sig>grandma</sig>',5894'<q>A mere setback.</q><sig>grandma</sig>',5895'<q>We are not satiated.</q><sig>grandma</sig>',5896'<q>Too late.</q><sig>grandma</sig>'5897]));58985899if (Game.Objects['Farm'].amount>0) list.push(choose([5900'News : cookie farms suspected of employing undeclared elderly workforce!',5901'News : cookie farms release harmful chocolate in our rivers, says scientist!',5902'News : genetically-modified chocolate controversy strikes cookie farmers!',5903'News : free-range farm cookies popular with today\'s hip youth, says specialist.',5904'News : farm cookies deemed unfit for vegans, says nutritionist.'5905]));59065907if (Game.Objects['Mine'].amount>0) list.push(choose([5908'News : is our planet getting lighter? Experts examine the effects of intensive chocolate mining.',5909'News : '+Math.floor(Math.random()*1000+2)+' miners trapped in collapsed chocolate mine!',5910'News : chocolate mines found to cause earthquakes and sinkholes!',5911'News : chocolate mine goes awry, floods village in chocolate!',5912'News : depths of chocolate mines found to house "peculiar, chocolaty beings"!'5913]));59145915if (Game.Objects['Factory'].amount>0) list.push(choose([5916'News : cookie factories linked to global warming!',5917'News : cookie factories involved in chocolate weather controversy!',5918'News : cookie factories on strike, robotic minions employed to replace workforce!',5919'News : cookie factories on strike - workers demand to stop being paid in cookies!',5920'News : factory-made cookies linked to obesity, says study.'5921]));59225923if (Game.Objects['Bank'].amount>0) list.push(choose([5924'News : cookie loans on the rise as people can no longer afford them with regular money.',5925'News : cookies slowly creeping up their way as a competitor to traditional currency!',5926'News : most bakeries now fitted with ATMs to allow for easy cookie withdrawals and deposits.',5927'News : cookie economy now strong enough to allow for massive vaults doubling as swimming pools!',5928'News : "Tomorrow\'s wealthiest people will be calculated by their worth in cookies", predict specialists.'5929]));59305931if (Game.Objects['Temple'].amount>0) list.push(choose([5932'News : explorers bring back ancient artifact from abandoned temple; archeologists marvel at the centuries-old '+choose(['magic','carved','engraved','sculpted','royal','imperial','mummified','ritual','golden','silver','stone','cursed','plastic','bone','blood','holy','sacred','sacrificial','electronic','singing','tapdancing'])+' '+choose(['spoon','fork','pizza','washing machine','calculator','hat','piano','napkin','skeleton','gown','dagger','sword','shield','skull','emerald','bathtub','mask','rollerskates','litterbox','bait box','cube','sphere','fungus'])+'!',5933'News : recently-discovered chocolate temples now sparking new cookie-related cult; thousands pray to Baker in the sky!',5934'News : just how extensive is the cookie pantheon? Theologians speculate about possible '+choose(['god','goddess'])+' of '+choose([choose(animals),choose(['kazoos','web design','web browsers','kittens','atheism','handbrakes','hats','aglets','elevator music','idle games','the letter "P"','memes','hamburgers','bad puns','kerning','stand-up comedy','failed burglary attempts','clickbait','one weird tricks'])])+'.',5935'News : theists of the world discover new cookie religion - "Oh boy, guess we were wrong all along!"',5936'News : cookie heaven allegedly "sports elevator instead of stairway"; cookie hell "paved with flagstone, as good intentions make for poor building material".'5937]));59385939if (Game.Objects['Wizard tower'].amount>0) list.push(choose([5940'News : all '+choose([choose(animals),choose(['public restrooms','clouds','politicians','moustaches','hats','shoes','pants','clowns','encyclopedias','websites','potted plants','lemons','household items','bodily fluids','cutlery','national landmarks','yogurt','rap music','underwear'])])+' turned into '+choose([choose(animals),choose(['public restrooms','clouds','politicians','moustaches','hats','shoes','pants','clowns','encyclopedias','websites','potted plants','lemons','household items','bodily fluids','cutlery','national landmarks','yogurt','rap music','underwear'])])+' in freak magic catastrophe!',5941'News : heavy dissent rages between the schools of '+choose(['water','fire','earth','air','lightning','acid','song','battle','peace','pencil','internet','space','time','brain','nature','techno','plant','bug','ice','poison','crab','kitten','dolphin','bird','punch','fart'])+' magic and '+choose(['water','fire','earth','air','lightning','acid','song','battle','peace','pencil','internet','space','time','brain','nature','techno','plant','bug','ice','poison','crab','kitten','dolphin','bird','punch','fart'])+' magic!',5942'News : get your new charms and curses at the yearly National Spellcrafting Fair! Exclusive prices on runes and spellbooks.',5943'News : cookie wizards deny involvement in shockingly ugly newborn - infant is "honestly grody-looking, but natural", say doctors.',5944'News : "Any sufficiently crude magic is indistinguishable from technology", claims renowned technowizard.'5945]));59465947if (Game.Objects['Shipment'].amount>0) list.push(choose([5948'News : new chocolate planet found, becomes target of cookie-trading spaceships!',5949'News : massive chocolate planet found with 99.8% certified pure dark chocolate core!',5950'News : space tourism booming as distant planets attract more bored millionaires!',5951'News : chocolate-based organisms found on distant planet!',5952'News : ancient baking artifacts found on distant planet; "terrifying implications", experts say.'5953]));59545955if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([5956'News : national gold reserves dwindle as more and more of the precious mineral is turned to cookies!',5957'News : chocolate jewelry found fashionable, gold and diamonds "just a fad", says specialist.',5958'News : silver found to also be transmutable into white chocolate!',5959'News : defective alchemy lab shut down, found to convert cookies to useless gold.',5960'News : alchemy-made cookies shunned by purists!'5961]));59625963if (Game.Objects['Portal'].amount>0) list.push(choose([5964'News : nation worried as more and more unsettling creatures emerge from dimensional portals!',5965'News : dimensional portals involved in city-engulfing disaster!',5966'News : tourism to cookieverse popular with bored teenagers! Casualty rate as high as 73%!',5967'News : cookieverse portals suspected to cause fast aging and obsession with baking, says study.',5968'News : "do not settle near portals," says specialist; "your children will become strange and corrupted inside."'5969]));59705971if (Game.Objects['Time machine'].amount>0) list.push(choose([5972'News : time machines involved in history-rewriting scandal! Or are they?',5973'News : time machines used in unlawful time tourism!',5974'News : cookies brought back from the past "unfit for human consumption", says historian.',5975'News : various historical figures inexplicably replaced with talking lumps of dough!',5976'News : "I have seen the future," says time machine operator, "and I do not wish to go there again."'5977]));59785979if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([5980'News : whole town seemingly swallowed by antimatter-induced black hole; more reliable sources affirm town "never really existed"!',5981'News : "explain to me again why we need particle accelerators to bake cookies?" asks misguided local woman.',5982'News : first antimatter condenser successfully turned on, doesn\'t rip apart reality!',5983'News : researchers conclude that what the cookie industry needs, first and foremost, is "more magnets".',5984'News : "unravelling the fabric of reality just makes these cookies so much tastier", claims scientist.'5985]));59865987if (Game.Objects['Prism'].amount>0) list.push(choose([5988'News : new cookie-producing prisms linked to outbreak of rainbow-related viral videos.',5989'News : scientists warn against systematically turning light into matter - "One day, we\'ll end up with all matter and no light!"',5990'News : cookies now being baked at the literal speed of light thanks to new prismatic contraptions.',5991'News : "Can\'t you sense the prism watching us?", rambles insane local man. "No idea what he\'s talking about", shrugs cookie magnate/government official.',5992'News : world citizens advised "not to worry" about frequent atmospheric flashes.',5993]));59945995if (Game.Objects['Chancemaker'].amount>0) list.push(choose([5996'News : strange statistical anomalies continue as weather forecast proves accurate an unprecedented 3 days in a row!',5997'News : local casino ruined as all gamblers somehow hit a week-long winning streak! "We might still be okay", says owner before being hit by lightning 47 times.',5998'News : neighboring nation somehow elects president with sensible policies in freak accident of random chance!',5999'News : million-to-one event sees gritty movie reboot turning out better than the original! "We have no idea how this happened", say movie execs.',6000'News : all scratching tickets printed as winners, prompting national economy to crash and, against all odds, recover overnight.',6001]));60026003if (Game.Objects['Fractal engine'].amount>0) list.push(choose([6004'News : local man "done with Cookie Clicker", finds the constant self-references "grating and on-the-nose".',6005'News : local man sails around the world to find himself - right where he left it.',6006'News : local guru claims "there\'s a little bit of ourselves in everyone", under investigation for alleged cannibalism.',6007'News : news writer finds herself daydreaming about new career. Or at least a raise.',6008'News : polls find idea of cookies made of cookies "acceptable" - "at least we finally know what\'s in them", says interviewed citizen.',6009]));60106011if (Game.Objects['Javascript console'].amount>0) list.push(choose([6012'News : strange fad has parents giving their newborns names such as Emma.js or Liam.js. At least one Baby.js reported.',6013'News : coding is hip! More and more teenagers turn to technical fields like programming, ensuring a future robot apocalypse and the doom of all mankind.',6014'News : developers unsure what to call their new javascript libraries as all combinations of any 3 dictionary words have already been taken.',6015'News : nation holds breath as nested ifs about to hatch.',6016'News : clueless copywriter forgets to escape a quote, ends news line prematurely; last words reported to be "Huh, why isn',6017]));60186019if (Game.season=='halloween' && Game.cookiesEarned>=1000) list.push(choose([6020'News : strange twisting creatures amass around cookie factories, nibble at assembly lines.',6021'News : ominous wrinkly monsters take massive bites out of cookie production; "this can\'t be hygienic", worries worker.',6022'News : pagan rituals on the rise as children around the world dress up in strange costumes and blackmail homeowners for candy.',6023'News : new-age terrorism strikes suburbs as houses find themselves covered in eggs and toilet paper.',6024'News : children around the world "lost and confused" as any and all Halloween treats have been replaced by cookies.'6025]));60266027if (Game.season=='christmas' && Game.cookiesEarned>=1000) list.push(choose([6028'News : bearded maniac spotted speeding on flying sleigh! Investigation pending.',6029'News : Santa Claus announces new brand of breakfast treats to compete with cookie-flavored cereals! "They\'re ho-ho-horrible!" says Santa.',6030'News : "You mean he just gives stuff away for free?!", concerned moms ask. "Personally, I don\'t trust his beard."',6031'News : obese jolly lunatic still on the loose, warn officials. "Keep your kids safe and board up your chimneys. We mean it."',6032'News : children shocked as they discover Santa Claus isn\'t just their dad in a costume after all!<br>"I\'m reassessing my life right now", confides Laura, aged 6.',6033'News : mysterious festive entity with quantum powers still wrecking havoc with army of reindeer, officials say.',6034'News : elves on strike at toy factory! "We will not be accepting reindeer chow as payment anymore. And stop calling us elves!"',6035'News : elves protest around the nation; wee little folks in silly little outfits spread mayhem, destruction; rabid reindeer running rampant through streets.',6036'News : scholars debate regarding the plural of reindeer(s) in the midst of elven world war.',6037'News : elves "unrelated to gnomes despite small stature and merry disposition", find scientists.',6038'News : elves sabotage radioactive frosting factory, turn hundreds blind in vicinity - "Who in their right mind would do such a thing?" laments outraged mayor.',6039'News : drama unfolds at North Pole as rumors crop up around Rudolph\'s red nose; "I may have an addiction or two", admits reindeer.'6040]));60416042if (Game.season=='valentines' && Game.cookiesEarned>=1000) list.push(choose([6043'News : organ-shaped confectioneries being traded in schools all over the world; gruesome practice undergoing investigation.',6044'News : heart-shaped candies overtaking sweets business, offering competition to cookie empire. "It\'s the economy, cupid!"',6045'News : love\'s in the air, according to weather specialists. Face masks now offered in every city to stunt airborne infection.',6046'News : marrying a cookie - deranged practice, or glimpse of the future?',6047'News : boyfriend dumped after offering his lover cookies for Valentine\'s Day, reports say. "They were off-brand", shrugs ex-girlfriend.'6048]));60496050if (Game.season=='easter' && Game.cookiesEarned>=1000) list.push(choose([6051'News : long-eared critters with fuzzy tails invade suburbs, spread terror and chocolate!',6052'News : eggs have begun to materialize in the most unexpected places; "no place is safe", warn experts.',6053'News : packs of rampaging rabbits cause billions in property damage; new strain of myxomatosis being developed.',6054'News : egg-laying rabbits "not quite from this dimension", warns biologist; advises against petting, feeding, or cooking the creatures.',6055'News : mysterious rabbits found to be egg-layers, but warm-blooded, hinting at possible platypus ancestry.'6056]));6057}60586059if (Math.random()<0.05)6060{6061if (Game.HasAchiev('Base 10')) list.push('News : cookie manufacturer completely forgoes common sense, lets OCD drive building decisions!');//somehow I got flak for this one6062if (Game.HasAchiev('From scratch')) list.push('News : follow the tear-jerking, riches-to-rags story about a local cookie manufacturer who decided to give it all up!');6063if (Game.HasAchiev('A world filled with cookies')) list.push('News : known universe now jammed with cookies! No vacancies!');6064if (Game.HasAchiev('Last Chance to See')) list.push('News : incredibly rare albino wrinkler on the brink of extinction poached by cookie-crazed pastry magnate!');6065if (Game.Has('Serendipity')) list.push('News : local cookie manufacturer becomes luckiest being alive!');6066if (Game.Has('Season switcher')) list.push('News : seasons are all out of whack! "We need to get some whack back into them seasons", says local resident.');60676068if (Game.Has('Kitten helpers')) list.push('News : faint meowing heard around local cookie facilities; suggests new ingredient being tested.');6069if (Game.Has('Kitten workers')) list.push('News : crowds of meowing kittens with little hard hats reported near local cookie facilities.');6070if (Game.Has('Kitten engineers')) list.push('News : surroundings of local cookie facilities now overrun with kittens in adorable little suits. Authorities advise to stay away from the premises.');6071if (Game.Has('Kitten overseers')) list.push('News : locals report troupe of bossy kittens meowing adorable orders at passersby.');6072if (Game.Has('Kitten managers')) list.push('News : local office cubicles invaded with armies of stern-looking kittens asking employees "what\'s happening, meow".');6073if (Game.Has('Kitten accountants')) list.push('News : tiny felines show sudden and amazing proficiency with fuzzy mathematics and pawlinomials, baffling scientists and pet store owners.');6074if (Game.Has('Kitten specialists')) list.push('News : new kitten college opening next week, offers courses on cookie-making and catnip studies.');6075if (Game.Has('Kitten experts')) list.push('News : unemployment rates soaring as woefully adorable little cats nab jobs on all levels of expertise, says study.');6076if (Game.Has('Kitten consultants')) list.push('News : "In the future, your job will most likely be done by a cat", predicts suspiciously furry futurologist.');6077if (Game.Has('Kitten assistants to the regional manager')) list.push('News : strange kittens with peculiar opinions on martial arts spotted loitering on local beet farms!');6078if (Game.Has('Kitten marketeers')) list.push('News : nonsensical billboards crop up all over countryside, trying to sell people the cookies they already get for free!');6079if (Game.Has('Kitten analysts')) list.push('News : are your spending habits sensible? For a hefty fee, these analysts will tell you!');6080if (Game.Has('Kitten executives')) list.push('News : kittens strutting around in hot little business suits shouting cut-throat orders at their assistants, possibly the cutest thing this reporter has ever seen!');6081if (Game.Has('Kitten angels')) list.push('News : "Try to ignore any ghostly felines that may be purring inside your ears," warn scientists. "They\'ll just lure you into making poor life choices."');6082}60836084if (Game.HasAchiev('Dude, sweet') && Math.random()<0.2) list.push(choose([6085'News : major sugar-smuggling ring dismantled by authorities; '+Math.floor(Math.random()*30+3)+' tons of sugar lumps seized, '+Math.floor(Math.random()*48+2)+' suspects apprehended.',6086'News : authorities warn tourists not to buy bootleg sugar lumps from street peddlers - "You think you\'re getting a sweet deal, but what you\'re being sold is really just ordinary cocaine", says agent.',6087'News : pro-diabetes movement protests against sugar-shaming. "I\'ve eaten nothing but sugar lumps for the past '+Math.floor(Math.random()*10+4)+' years and I\'m feeling great!", says woman with friable skin.',6088'News : experts in bitter disagreement over whether sugar consumption turns children sluggish or hyperactive.',6089'News : fishermen deplore upturn in fish tooth decay as sugar lumps-hauling cargo sinks into the ocean.',6090'News : rare black sugar lump that captivated millions in unprecedented auction revealed to be common toxic fungus.',6091'News : "Back in my day, sugar lumps were these little cubes you\'d put in your tea, not those fist-sized monstrosities people eat for lunch", whines curmudgeon with failing memory.',6092'News : sugar lump-snacking fad sweeps the nation; dentists everywhere rejoice.'6093]));60946095if (Math.random()<0.001)//apologies to Will Wright6096{6097list.push(6098'You have been chosen. They will come soon.',6099'They\'re coming soon. Maybe you should think twice about opening the door.',6100'The end is near. Make preparations.',6101'News : broccoli tops for moms, last for kids; dads indifferent.',6102'News : middle age a hoax, declares study; turns out to be bad posture after all.',6103'News : kitties want answers in possible Kitty Kibble shortage.'6104);6105}61066107if (Game.cookiesEarned>=10000) list.push(6108'News : '+choose([6109'cookies found to '+choose(['increase lifespan','sensibly increase intelligence','reverse aging','decrease hair loss','prevent arthritis','cure blindness'])+' in '+choose(animals)+'!',6110'cookies found to make '+choose(animals)+' '+choose(['more docile','more handsome','nicer','less hungry','more pragmatic','tastier'])+'!',6111'cookies tested on '+choose(animals)+', found to have no ill effects.',6112'cookies unexpectedly popular among '+choose(animals)+'!',6113'unsightly lumps found on '+choose(animals)+' near cookie facility; "they\'ve pretty much always looked like that", say biologists.',6114'new species of '+choose(animals)+' discovered in distant country; "yup, tastes like cookies", says biologist.',6115'cookies go well with '+choose([choose(['roasted','toasted','boiled','sauteed','minced'])+' '+choose(animals),choose(['sushi','soup','carpaccio','steak','nuggets'])+' made from '+choose(animals)])+', says controversial chef.',6116'"do your cookies contain '+choose(animals)+'?", asks PSA warning against counterfeit cookies.',6117'doctors recommend twice-daily consumption of fresh cookies.',6118'doctors warn against chocolate chip-snorting teen fad.',6119'doctors advise against new cookie-free fad diet.',6120'doctors warn mothers about the dangers of "home-made cookies".'6121]),6122'News : "'+choose([6123'I\'m all about cookies',6124'I just can\'t stop eating cookies. I think I seriously need help',6125'I guess I have a cookie problem',6126'I\'m not addicted to cookies. That\'s just speculation by fans with too much free time',6127'my upcoming album contains 3 songs about cookies',6128'I\'ve had dreams about cookies 3 nights in a row now. I\'m a bit worried honestly',6129'accusations of cookie abuse are only vile slander',6130'cookies really helped me when I was feeling low',6131'cookies are the secret behind my perfect skin',6132'cookies helped me stay sane while filming my upcoming movie',6133'cookies helped me stay thin and healthy',6134'I\'ll say one word, just one : cookies',6135'alright, I\'ll say it - I\'ve never eaten a single cookie in my life'6136])+'", reveals celebrity.',6137choose([6138'News : scientist predicts imminent cookie-related "end of the world"; becomes joke among peers.',6139'News : man robs bank, buys cookies.',6140'News : scientists establish that the deal with airline food is, in fact, a critical lack of cookies.',6141'News : hundreds of tons of cookies dumped into starving country from airplanes; thousands dead, nation grateful.',6142'News : new study suggests cookies neither speed up nor slow down aging, but instead "take you in a different direction".',6143'News : overgrown cookies found in fishing nets, raise questions about hormone baking.',6144'News : "all-you-can-eat" cookie restaurant opens in big city; waiters trampled in minutes.',6145'News : man dies in cookie-eating contest; "a less-than-impressive performance", says judge.',6146'News : what makes cookies taste so right? "Probably all the [*****] they put in them", says anonymous tipper.',6147'News : man found allergic to cookies; "what a weirdo", says family.',6148'News : foreign politician involved in cookie-smuggling scandal.',6149'News : cookies now more popular than '+choose(['cough drops','broccoli','smoked herring','cheese','video games','stable jobs','relationships','time travel','cat videos','tango','fashion','television','nuclear warfare','whatever it is we ate before','politics','oxygen','lamps'])+', says study.',6150'News : obesity epidemic strikes nation; experts blame '+choose(['twerking','that darn rap music','video-games','lack of cookies','mysterious ghostly entities','aliens','parents','schools','comic-books','cookie-snorting fad'])+'.',6151'News : cookie shortage strikes town, people forced to eat cupcakes; "just not the same", concedes mayor.',6152'News : "you gotta admit, all this cookie stuff is a bit ominous", says confused idiot.',6153]),6154choose([6155'News : movie cancelled from lack of actors; "everybody\'s at home eating cookies", laments director.',6156'News : comedian forced to cancel cookie routine due to unrelated indigestion.',6157'News : new cookie-based religion sweeps the nation.',6158'News : fossil records show cookie-based organisms prevalent during Cambrian explosion, scientists say.',6159'News : mysterious illegal cookies seized; "tastes terrible", says police.',6160'News : man found dead after ingesting cookie; investigators favor "mafia snitch" hypothesis.',6161'News : "the universe pretty much loops on itself," suggests researcher; "it\'s cookies all the way down."',6162'News : minor cookie-related incident turns whole town to ashes; neighboring cities asked to chip in for reconstruction.',6163'News : is our media controlled by the cookie industry? This could very well be the case, says crackpot conspiracy theorist.',6164'News : '+choose(['cookie-flavored popcorn pretty damn popular; "we kinda expected that", say scientists.','cookie-flavored cereals break all known cereal-related records','cookies popular among all age groups, including fetuses, says study.','cookie-flavored popcorn sales exploded during screening of Grandmothers II : The Moistening.']),6165'News : all-cookie restaurant opening downtown. Dishes such as braised cookies, cookie thermidor, and for dessert : crepes.',6166'News : "Ook", says interviewed orangutan.',6167'News : cookies could be the key to '+choose(['eternal life','infinite riches','eternal youth','eternal beauty','curing baldness','world peace','solving world hunger','ending all wars world-wide','making contact with extraterrestrial life','mind-reading','better living','better eating','more interesting TV shows','faster-than-light travel','quantum baking','chocolaty goodness','gooder thoughtness'])+', say scientists.',6168'News : flavor text '+choose(['not particularly flavorful','kind of unsavory'])+', study finds.',6169]),6170choose([6171'News : what do golden cookies taste like? Study reveals a flavor "somewhere between spearmint and liquorice".',6172'News : what do wrath cookies taste like? Study reveals a flavor "somewhere between blood sausage and seawater".',6173'News : '+Game.bakeryName+'-brand cookies "'+choose(['much less soggy','much tastier','relatively less crappy','marginally less awful','less toxic','possibly more edible','more fashionable','slightly nicer','trendier','arguably healthier','objectively better choice','slightly less terrible','decidedly cookier','a tad cheaper'])+' than competitors", says consumer survey.',6174'News : "'+Game.bakeryName+'" set to be this year\'s most popular baby name.',6175'News : new popularity survey says '+Game.bakeryName+'\'s the word when it comes to cookies.',6176'News : major city being renamed '+Game.bakeryName+'ville after world-famous cookie manufacturer.',6177'News : '+choose(['street','school','nursing home','stadium','new fast food chain','new planet','new disease','flesh-eating virus','deadly bacteria','new species of '+choose(animals),'new law','baby','programming language'])+' to be named after '+Game.bakeryName+', the world-famous cookie manufacturer.',6178'News : don\'t miss tonight\'s biopic on '+Game.bakeryName+'\'s irresistible rise to success!',6179'News : don\'t miss tonight\'s interview of '+Game.bakeryName+' by '+choose(['Bloprah','Blavid Bletterman','Blimmy Blimmel','Blellen Blegeneres','Blimmy Blallon','Blonan Blo\'Brien','Blay Bleno','Blon Blewart','Bleven Blolbert','Lord Toxikhron of dimension 7-B19',Game.bakeryName+'\'s own evil clone'])+'!',6180'News : people all over the internet still scratching their heads over nonsensical reference : "Okay, but why an egg?"',6181'News : viral video "Too Many Cookies" could be "a grim commentary on the impending crisis our world is about to face", says famous economist.',6182'News : "memes from last year somehow still relevant", deplore experts.',6183'News : cookie emoji most popular among teenagers, far ahead of "judgemental OK hand sign" and "shifty-looking dark moon", says study.',6184]),6185choose([6186'News : births of suspiciously bald babies on the rise; reptilian overlords deny involvement.',6187'News : "at this point, cookies permeate the economy", says economist. "If we start eating anything else, we\'re all dead."',6188'News : pun in headline infuriates town, causes riot. 21 wounded, 5 dead; mayor still missing.',6189'Nws : ky btwn W and R brokn, plas snd nw typwritr ASAP.',6190'Neeeeews : "neeeew EEEEEE keeeeey working fineeeeeeeee", reeeports gleeeeeeeeful journalist.',6191'News : cookies now illegal in some backwards country nobody cares about. Political tensions rising; war soon, hopefully.',6192'News : irate radio host rambles about pixelated icons. "None of the cookies are aligned! Can\'t anyone else see it? I feel like I\'m taking crazy pills!"',6193'News : nation cheers as legislators finally outlaw '+choose(['cookie criticism','playing other games than Cookie Clicker','pineapple on pizza','lack of cheerfulness','mosquitoes','broccoli','the human spleen','bad weather','clickbait','dabbing','the internet','memes','millenials'])+'!',6194'News : '+choose(['local','area'])+' '+choose(['man','woman'])+' goes on journey of introspection, finds cookies : "I honestly don\'t know what I was expecting."',6195'News : '+choose(['man','woman'])+' wakes up from coma, '+choose(['tries cookie for the first time, dies.','regrets it instantly.','wonders "why everything is cookies now".','babbles incoherently about some supposed "non-cookie food" we used to eat.','cites cookies as main motivator.','asks for cookies.']),6196'News : pet '+choose(animals)+', dangerous fad or juicy new market?',6197'News : person typing these wouldn\'t mind someone else breaking the news to THEM, for a change.',6198'News : "average person bakes '+Beautify(Math.ceil(Game.cookiesEarned/7300000000))+' cookie'+(Math.ceil(Game.cookiesEarned/7300000000)==1?'':'s')+' a year" factoid actually just statistical error; '+Game.bakeryName+', who has produced '+Beautify(Game.cookiesEarned)+' cookies in their lifetime, is an outlier and should not have been counted.'6199])6200);6201}62026203if (list.length==0)6204{6205if (Game.cookiesEarned<5) list.push('You feel like making cookies. But nobody wants to eat your cookies.');6206else if (Game.cookiesEarned<50) list.push('Your first batch goes to the trash. The neighborhood raccoon barely touches it.');6207else if (Game.cookiesEarned<100) list.push('Your family accepts to try some of your cookies.');6208else if (Game.cookiesEarned<500) list.push('Your cookies are popular in the neighborhood.');6209else if (Game.cookiesEarned<1000) list.push('People are starting to talk about your cookies.');6210else if (Game.cookiesEarned<5000) list.push('Your cookies are talked about for miles around.');6211else if (Game.cookiesEarned<10000) list.push('Your cookies are renowned in the whole town!');6212else if (Game.cookiesEarned<50000) list.push('Your cookies bring all the boys to the yard.');6213else if (Game.cookiesEarned<100000) list.push('Your cookies now have their own website!');6214else if (Game.cookiesEarned<500000) list.push('Your cookies are worth a lot of money.');6215else if (Game.cookiesEarned<1000000) list.push('Your cookies sell very well in distant countries.');6216else if (Game.cookiesEarned<5000000) list.push('People come from very far away to get a taste of your cookies.');6217else if (Game.cookiesEarned<10000000) list.push('Kings and queens from all over the world are enjoying your cookies.');6218else if (Game.cookiesEarned<50000000) list.push('There are now museums dedicated to your cookies.');6219else if (Game.cookiesEarned<100000000) list.push('A national day has been created in honor of your cookies.');6220else if (Game.cookiesEarned<500000000) list.push('Your cookies have been named a part of the world wonders.');6221else if (Game.cookiesEarned<1000000000) list.push('History books now include a whole chapter about your cookies.');6222else if (Game.cookiesEarned<5000000000) list.push('Your cookies have been placed under government surveillance.');6223else if (Game.cookiesEarned<10000000000) list.push('The whole planet is enjoying your cookies!');6224else if (Game.cookiesEarned<50000000000) list.push('Strange creatures from neighboring planets wish to try your cookies.');6225else if (Game.cookiesEarned<100000000000) list.push('Elder gods from the whole cosmos have awoken to taste your cookies.');6226else if (Game.cookiesEarned<500000000000) list.push('Beings from other dimensions lapse into existence just to get a taste of your cookies.');6227else if (Game.cookiesEarned<1000000000000) list.push('Your cookies have achieved sentience.');6228else if (Game.cookiesEarned<5000000000000) list.push('The universe has now turned into cookie dough, to the molecular level.');6229else if (Game.cookiesEarned<10000000000000) list.push('Your cookies are rewriting the fundamental laws of the universe.');6230else if (Game.cookiesEarned<10000000000000) list.push('A local news station runs a 10-minute segment about your cookies. Success!<br><span style="font-size:50%;">(you win a cookie)</span>');6231else if (Game.cookiesEarned<10100000000000) list.push('it\'s time to stop playing');//only show this for 100 millions (it's funny for a moment)6232}62336234//if (Game.elderWrath>0 && (Game.pledges==0 || Math.random()<0.2))6235if (Game.elderWrath>0 && (((Game.pledges==0 && Game.resets==0) && Math.random()<0.5) || Math.random()<0.05))6236{6237list=[];6238if (Game.elderWrath==1) list.push(choose([6239'News : millions of old ladies reported missing!',6240'News : processions of old ladies sighted around cookie facilities!',6241'News : families around the continent report agitated, transfixed grandmothers!',6242'News : doctors swarmed by cases of old women with glassy eyes and a foamy mouth!',6243'News : nurses report "strange scent of cookie dough" around female elderly patients!'6244]));6245if (Game.elderWrath==2) list.push(choose([6246'News : town in disarray as strange old ladies break into homes to abduct infants and baking utensils!',6247'News : sightings of old ladies with glowing eyes terrify local population!',6248'News : retirement homes report "female residents slowly congealing in their seats"!',6249'News : whole continent undergoing mass exodus of old ladies!',6250'News : old women freeze in place in streets, ooze warm sugary syrup!'6251]));6252if (Game.elderWrath==3) list.push(choose([6253'News : large "flesh highways" scar continent, stretch between various cookie facilities!',6254'News : wrinkled "flesh tendrils" visible from space!',6255'News : remains of "old ladies" found frozen in the middle of growing fleshy structures!',6256'News : all hope lost as writhing mass of flesh and dough engulfs whole city!',6257'News : nightmare continues as wrinkled acres of flesh expand at alarming speeds!'6258]));6259}62606261if (Game.season=='fools')6262{6263list=[];62646265if (Game.cookiesEarned>=1000) list.push(choose([6266'Your office chair is really comfortable.',6267'Business meetings are such a joy!',6268'You\'ve spent the whole day '+choose(['signing contracts','filling out forms','touching base with the team','examining exciting new prospects','playing with your desk toys','getting new nameplates done','attending seminars','videoconferencing','hiring dynamic young executives','meeting new investors','playing minigolf in your office'])+'!',6269'The word of the day is : '+choose(['viral','search engine optimization','blags and wobsites','social networks','web 3.0','logistics','leveraging','branding','proactive','synergizing','market research','demographics','pie charts','blogular','blogulacious','blogastic','authenticity','electronic mail','cellular phones','rap music','cookies, I guess'])+'.',6270'Profit\'s in the air!'6271]));6272if (Game.cookiesEarned>=1000 && Math.random()<0.1) list.push(choose([6273'If you could get some more cookies baked, that\'d be great.',6274'So. About those TPS reports.',6275'Another day in paradise!',6276'Working hard, or hardly working?'6277]));627862796280if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)6281{6282if (Game.Objects['Grandma'].amount>0) list.push(choose([6283'Your rolling pins are rolling and pinning!',6284'Production is steady!'6285]));62866287if (Game.Objects['Grandma'].amount>0) list.push(choose([6288'Your ovens are diligently baking more and more cookies.',6289'Your ovens burn a whole batch. Ah well! Still good.'6290]));62916292if (Game.Objects['Farm'].amount>0) list.push(choose([6293'Scores of cookies come out of your kitchens.',6294'Today, new recruits are joining your kitchens!'6295]));62966297if (Game.Objects['Factory'].amount>0) list.push(choose([6298'Your factories are producing an unending stream of baked goods.',6299'Your factory workers decide to go on strike!',6300'It\'s safety inspection day in your factories.'6301]));63026303if (Game.Objects['Mine'].amount>0) list.push(choose([6304'Your secret recipes are kept safely inside a giant underground vault.',6305'Your chefs are working on new secret recipes!'6306]));63076308if (Game.Objects['Shipment'].amount>0) list.push(choose([6309'Your supermarkets are bustling with happy, hungry customers.',6310'Your supermarkets are full of cookie merch!'6311]));63126313if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([6314'It\'s a new trading day at the stock exchange, and traders can\'t get enough of your shares!',6315'Your stock is doubling in value by the minute!'6316]));63176318if (Game.Objects['Portal'].amount>0) list.push(choose([6319'You just released a new TV show episode!',6320'Your cookie-themed TV show is being adapted into a new movie!'6321]));63226323if (Game.Objects['Time machine'].amount>0) list.push(choose([6324'Your theme parks are doing well - puddles of vomit and roller-coaster casualties are being swept under the rug!',6325'Visitors are stuffing themselves with cookies before riding your roller-coasters. You might want to hire more clean-up crews.'6326]));63276328if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([6329'Cookiecoin is officially the most mined digital currency in the history of mankind!',6330'Cookiecoin piracy is rampant!'6331]));63326333if (Game.Objects['Prism'].amount>0) list.push(choose([6334'Your corporate nations just gained a new parliament!',6335'You\'ve just annexed a new nation!',6336'A new nation joins the grand cookie conglomerate!'6337]));63386339if (Game.Objects['Chancemaker'].amount>0) list.push(choose([6340'Your intergalactic federation of cookie-sponsored planets reports record-breaking profits!',6341'Billions of unwashed aliens are pleased to join your workforce as you annex their planet!',6342'New toll opened on interstellar highway, funnelling more profits into the cookie economy!'6343]));63446345if (Game.Objects['Fractal engine'].amount>0) list.push(choose([6346'Your cookie-based political party is doing fantastic in the polls!',6347'New pro-cookie law passes without a hitch thanks to your firm grasp of the political ecosystem!',6348'Your appointed senators are overturning cookie bans left and right!'6349]));63506351if (Game.Objects['Javascript console'].amount>0) list.push(choose([6352'Cookies are now one of the defining aspects of mankind! Congratulations!',6353'Time travelers report that this era will later come to be known, thanks to you, as the cookie millennium!',6354'Cookies now deeply rooted in human culture, likely puzzling future historians!'6355]));6356}63576358if (Game.cookiesEarned<5) list.push('Such a grand day to begin a new business.');6359else if (Game.cookiesEarned<50) list.push('You\'re baking up a storm!');6360else if (Game.cookiesEarned<100) list.push('You are confident that one day, your cookie company will be the greatest on the market!');6361else if (Game.cookiesEarned<1000) list.push('Business is picking up!');6362else if (Game.cookiesEarned<5000) list.push('You\'re making sales left and right!');6363else if (Game.cookiesEarned<20000) list.push('Everyone wants to buy your cookies!');6364else if (Game.cookiesEarned<50000) list.push('You are now spending most of your day signing contracts!');6365else if (Game.cookiesEarned<500000) list.push('You\'ve been elected "business tycoon of the year"!');6366else if (Game.cookiesEarned<1000000) list.push('Your cookies are a worldwide sensation! Well done, old chap!');6367else if (Game.cookiesEarned<5000000) list.push('Your brand has made its way into popular culture. Children recite your slogans and adults reminisce them fondly!');6368else if (Game.cookiesEarned<1000000000) list.push('A business day like any other. It\'s good to be at the top!');6369else if (Game.cookiesEarned<10100000000) list.push('You look back at your career. It\'s been a fascinating journey, building your baking empire from the ground up.');//only show this for 100 millions6370}63716372for (var i in Game.customTickers)6373{6374var arr=Game.customTickers[i]();6375for (var ii in arr) list.push(arr[ii]);6376}63776378Game.TickerEffect=0;63796380if (!manual && Game.T>Game.fps*10 && Game.Has('Fortune cookies') && Math.random()<(Game.HasAchiev('O Fortuna')?0.04:0.02))6381{6382var fortunes=[];6383for (var i in Game.Tiers['fortune'].upgrades)6384{6385var it=Game.Tiers['fortune'].upgrades[i];6386if (!Game.HasUnlocked(it.name)) fortunes.push(it);6387}63886389if (!Game.fortuneGC) fortunes.push('fortuneGC');6390if (!Game.fortuneCPS) fortunes.push('fortuneCPS');63916392if (fortunes.length>0)6393{6394list=[];6395var me=choose(fortunes);6396Game.TickerEffect={type:'fortune',sub:me};6397Math.seedrandom(Game.seed+'-fortune');6398if (me=='fortuneGC') me='Today is your lucky day!';/*<br>Click here for a golden cookie.';*/6399else if (me=='fortuneCPS') me='Your lucky numbers are : '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)/*+'<br>Click here to gain one hour of your CpS.'*/;6400else6401{6402me=me.name.substring(me.name.indexOf('#'))+' : '+me.baseDesc.substring(me.baseDesc.indexOf('<q>')+3);6403me=me.substring(0,me.length-4);6404}6405me='<span class="fortune"><div class="icon" style="vertical-align:middle;display:inline-block;background-position:'+(-29*48)+'px '+(-8*48)+'px;transform:scale(0.5);margin:-16px;position:relative;left:-4px;top:-2px;"></div>'+me+'</span>';6406Math.seedrandom();6407list=[me];6408}6409}64106411Game.TickerAge=Game.fps*10;6412Game.Ticker=choose(list);6413Game.AddToLog(Game.Ticker);6414Game.TickerN++;6415Game.TickerDraw();6416}6417Game.tickerL=l('commentsText');6418Game.tickerBelowL=l('commentsTextBelow');6419Game.tickerCompactL=l('compactCommentsText');6420Game.TickerDraw=function()6421{6422var str='';6423if (Game.Ticker!='') str=Game.Ticker;6424Game.tickerBelowL.innerHTML=Game.tickerL.innerHTML;6425Game.tickerL.innerHTML=str;6426Game.tickerCompactL.innerHTML=str;64276428Game.tickerBelowL.className='commentsText';6429void Game.tickerBelowL.offsetWidth;6430Game.tickerBelowL.className='commentsText risingAway';6431Game.tickerL.className='commentsText';6432void Game.tickerL.offsetWidth;6433Game.tickerL.className='commentsText risingUp';6434}6435AddEvent(Game.tickerL,'click',function(event){6436Game.Ticker='';6437Game.TickerClicks++;6438if (Game.TickerClicks==50) {Game.Win('Tabloid addiction');}64396440if (Game.TickerEffect && Game.TickerEffect.type=='fortune')6441{6442PlaySound('snd/fortune.mp3',1);6443Game.SparkleAt(Game.mouseX,Game.mouseY);6444var effect=Game.TickerEffect.sub;6445if (effect=='fortuneGC')6446{6447Game.Notify('Fortune!','A golden cookie has appeared.',[10,32]);6448Game.fortuneGC=1;6449var newShimmer=new Game.shimmer('golden',{noWrath:true});6450}6451else if (effect=='fortuneCPS')6452{6453Game.Notify('Fortune!','You gain <b>one hour</b> of your CpS (capped at double your bank).',[10,32]);6454Game.fortuneCPS=1;6455Game.Earn(Math.min(Game.cookiesPs*60*60,Game.cookies));6456}6457else6458{6459Game.Notify(effect.name,'You\'ve unlocked a new upgrade.',effect.icon);6460effect.unlock();6461}6462}64636464Game.TickerEffect=0;64656466});64676468Game.Log=[];6469Game.AddToLog=function(what)6470{6471Game.Log.unshift(what);6472if (Game.Log.length>100) Game.Log.pop();6473}64746475Game.vanilla=1;6476/*=====================================================================================6477BUILDINGS6478=======================================================================================*/6479Game.last=0;64806481Game.storeToRefresh=1;6482Game.priceIncrease=1.15;6483Game.buyBulk=1;6484Game.buyMode=1;//1 for buy, -1 for sell6485Game.buyBulkOld=Game.buyBulk;//used to undo changes from holding Shift or Ctrl6486Game.buyBulkShortcut=0;//are we pressing Shift or Ctrl?64876488Game.Objects=[];6489Game.ObjectsById=[];6490Game.ObjectsN=0;6491Game.BuildingsOwned=0;6492Game.Object=function(name,commonName,desc,icon,iconColumn,art,price,cps,buyFunction)6493{6494this.id=Game.ObjectsN;6495this.name=name;6496this.displayName=this.name;6497commonName=commonName.split('|');6498this.single=commonName[0];6499this.plural=commonName[1];6500this.actionName=commonName[2];6501this.extraName=commonName[3];6502this.extraPlural=commonName[4];6503this.desc=desc;6504this.basePrice=price;6505this.price=this.basePrice;6506this.bulkPrice=this.price;6507this.cps=cps;6508this.baseCps=this.cps;6509this.mouseOn=false;6510this.mousePos=[-100,-100];6511this.productionAchievs=[];65126513this.n=this.id;6514if (this.n!=0)6515{6516//new automated price and CpS curves6517//this.baseCps=Math.ceil(((this.n*0.5)*Math.pow(this.n*1,this.n*0.9))*10)/10;6518//this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2.35))*10)/10;//by a fortunate coincidence, this gives the 3rd, 4th and 5th buildings a CpS of 10, 69 and 4206519this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2))*10)/10;//0.45 used to be 0.56520//this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.45+2.10))*10)/10;6521//clamp 14,467,199 to 14,000,000 (there's probably a more elegant way to do that)6522var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.baseCps))/Math.LN10)))/100;6523this.baseCps=Math.round(this.baseCps/digits)*digits;65246525this.basePrice=(this.n*1+9+(this.n<5?0:Math.pow(this.n-5,1.75)*5))*Math.pow(10,this.n)*(Math.max(1,this.n-14));6526//this.basePrice=(this.n*2.5+7.5)*Math.pow(10,this.n);6527var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.basePrice))/Math.LN10)))/100;6528this.basePrice=Math.round(this.basePrice/digits)*digits;6529if (this.id>=16) this.basePrice*=10;6530this.price=this.basePrice;6531this.bulkPrice=this.price;6532}65336534this.totalCookies=0;6535this.storedCps=0;6536this.storedTotalCps=0;6537this.icon=icon;6538this.iconColumn=iconColumn;6539this.art=art;6540if (art.base)6541{art.pic=art.base+'.png';art.bg=art.base+'Background.png';}6542this.buyFunction=buyFunction;6543this.locked=1;6544this.level=0;6545this.vanilla=Game.vanilla;65466547this.tieredUpgrades=[];6548this.tieredAchievs=[];6549this.synergies=[];6550this.fortune=0;65516552this.amount=0;6553this.bought=0;6554this.free=0;65556556this.eachFrame=0;65576558this.minigameUrl=0;//if this is defined, load the specified script if the building's level is at least 16559this.minigameName=0;6560this.onMinigame=false;6561this.minigameLoaded=false;65626563this.switchMinigame=function(on)//change whether we're on the building's minigame6564{6565if (!Game.isMinigameReady(this)) on=false;6566if (on==-1) on=!this.onMinigame;6567this.onMinigame=on;6568if (this.id!=0)6569{6570if (this.onMinigame)6571{6572l('row'+this.id).classList.add('onMinigame');6573//l('rowSpecial'+this.id).style.display='block';6574//l('rowCanvas'+this.id).style.display='none';6575if (this.minigame.onResize) this.minigame.onResize();6576}6577else6578{6579l('row'+this.id).classList.remove('onMinigame');6580//l('rowSpecial'+this.id).style.display='none';6581//l('rowCanvas'+this.id).style.display='block';6582}6583}6584this.refresh();6585}65866587this.getPrice=function(n)6588{6589var price=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,this.amount-this.free));6590price=Game.modifyBuildingPrice(this,price);6591return Math.ceil(price);6592}6593this.getSumPrice=function(amount)//return how much it would cost to buy [amount] more of this building6594{6595var price=0;6596for (var i=Math.max(0,this.amount);i<Math.max(0,(this.amount)+amount);i++)6597{6598price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));6599}6600price=Game.modifyBuildingPrice(this,price);6601return Math.ceil(price);6602}6603this.getReverseSumPrice=function(amount)//return how much you'd get from selling [amount] of this building6604{6605var price=0;6606for (var i=Math.max(0,(this.amount)-amount);i<Math.max(0,this.amount);i++)6607{6608price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));6609}6610price=Game.modifyBuildingPrice(this,price);6611price*=this.getSellMultiplier();6612return Math.ceil(price);6613}6614this.getSellMultiplier=function()6615{6616var giveBack=0.25;6617//if (Game.hasAura('Earth Shatterer')) giveBack=0.5;6618giveBack*=1+Game.auraMult('Earth Shatterer');6619return giveBack;6620}66216622this.buy=function(amount)6623{6624if (Game.buyMode==-1) {this.sell(Game.buyBulk,1);return 0;}6625var success=0;6626var moni=0;6627var bought=0;6628if (!amount) amount=Game.buyBulk;6629if (amount==-1) amount=1000;6630for (var i=0;i<amount;i++)6631{6632var price=this.getPrice();6633if (Game.cookies>=price)6634{6635bought++;6636moni+=price;6637Game.Spend(price);6638this.amount++;6639this.bought++;6640price=this.getPrice();6641this.price=price;6642if (this.buyFunction) this.buyFunction();6643Game.recalculateGains=1;6644if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');6645Game.BuildingsOwned++;6646success=1;6647}6648}6649if (success) {PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}6650//if (moni>0 && amount>1) Game.Notify(this.name,'Bought <b>'+bought+'</b> for '+Beautify(moni)+' cookies','',2);6651}6652this.sell=function(amount,bypass)6653{6654var success=0;6655var moni=0;6656var sold=0;6657if (amount==-1) amount=this.amount;6658if (!amount) amount=Game.buyBulk;6659for (var i=0;i<amount;i++)6660{6661var price=this.getPrice();6662var giveBack=this.getSellMultiplier();6663price=Math.floor(price*giveBack);6664if (this.amount>0)6665{6666sold++;6667moni+=price;6668Game.cookies+=price;6669Game.cookiesEarned=Math.max(Game.cookies,Game.cookiesEarned);//this is to avoid players getting the cheater achievement when selling buildings that have a higher price than they used to6670this.amount--;6671price=this.getPrice();6672this.price=price;6673if (this.sellFunction) this.sellFunction();6674Game.recalculateGains=1;6675if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');6676Game.BuildingsOwned--;6677success=1;6678}6679}6680if (success && Game.hasGod)6681{6682var godLvl=Game.hasGod('ruin');6683var old=Game.hasBuff('Devastation');6684if (old)6685{6686if (godLvl==1) old.multClick+=sold*0.01;6687else if (godLvl==2) old.multClick+=sold*0.005;6688else if (godLvl==3) old.multClick+=sold*0.0025;6689}6690else6691{6692if (godLvl==1) Game.gainBuff('devastation',10,1+sold*0.01);6693else if (godLvl==2) Game.gainBuff('devastation',10,1+sold*0.005);6694else if (godLvl==3) Game.gainBuff('devastation',10,1+sold*0.0025);6695}6696}6697if (success) {PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}6698//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);6699}6700this.sacrifice=function(amount)//sell without getting back any money6701{6702var success=0;6703//var moni=0;6704var sold=0;6705if (amount==-1) amount=this.amount;6706if (!amount) amount=1;6707for (var i=0;i<amount;i++)6708{6709var price=this.getPrice();6710price=Math.floor(price*0.5);6711if (this.amount>0)6712{6713sold++;6714//moni+=price;6715//Game.cookies+=price;6716//Game.cookiesEarned=Math.max(Game.cookies,Game.cookiesEarned);6717this.amount--;6718price=this.getPrice();6719this.price=price;6720if (this.sellFunction) this.sellFunction();6721Game.recalculateGains=1;6722if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');6723Game.BuildingsOwned--;6724success=1;6725}6726}6727if (success) {this.refresh();}6728//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);6729}6730this.buyFree=function(amount)//unlike getFree, this still increases the price6731{6732for (var i=0;i<amount;i++)6733{6734if (Game.cookies>=price)6735{6736this.amount++;6737this.bought++;6738this.price=this.getPrice();6739Game.recalculateGains=1;6740if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');6741Game.BuildingsOwned++;6742}6743}6744this.refresh();6745}6746this.getFree=function(amount)//get X of this building for free, with the price behaving as if you still didn't have them6747{6748this.amount+=amount;6749this.bought+=amount;6750this.free+=amount;6751Game.BuildingsOwned+=amount;6752this.refresh();6753}6754this.getFreeRanks=function(amount)//this building's price behaves as if you had X less of it6755{6756this.free+=amount;6757this.refresh();6758}67596760this.tooltip=function()6761{6762var me=this;6763var desc=me.desc;6764var name=me.name;6765if (Game.season=='fools')6766{6767if (!Game.foolObjects[me.name])6768{6769name=Game.foolObjects['Unknown'].name;6770desc=Game.foolObjects['Unknown'].desc;6771}6772else6773{6774name=Game.foolObjects[me.name].name;6775desc=Game.foolObjects[me.name].desc;6776}6777}6778var icon=[me.iconColumn,0];6779if (me.locked)6780{6781name='???';6782desc='';6783icon=[0,7];6784}6785//if (l('rowInfo'+me.id) && Game.drawT%10==0) l('rowInfoContent'+me.id).innerHTML='• '+me.amount+' '+(me.amount==1?me.single:me.plural)+'<br>• producing '+Beautify(me.storedTotalCps,1)+' '+(me.storedTotalCps==1?'cookie':'cookies')+' per second<br>• total : '+Beautify(me.totalCookies)+' '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName;67866787var canBuy=false;6788var price=me.bulkPrice;6789if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) canBuy=true;67906791var synergiesStr='';6792//note : might not be entirely accurate, math may need checking6793if (me.amount>0)6794{6795var synergiesWith={};6796var synergyBoost=0;67976798if (me.name=='Grandma')6799{6800for (var i in Game.GrandmaSynergies)6801{6802if (Game.Has(Game.GrandmaSynergies[i]))6803{6804var other=Game.Upgrades[Game.GrandmaSynergies[i]].buildingTie;6805var mult=me.amount*0.01*(1/(other.id-1));6806var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+mult);6807synergyBoost+=boost;6808if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;6809synergiesWith[other.plural]+=mult;6810}6811}6812}6813else if (me.name=='Portal' && Game.Has('Elder Pact'))6814{6815var other=Game.Objects['Grandma'];6816var boost=(me.amount*0.05*other.amount)*Game.globalCpsMult;6817synergyBoost+=boost;6818if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;6819synergiesWith[other.plural]+=boost/(other.storedTotalCps*Game.globalCpsMult);6820}68216822for (var i in me.synergies)6823{6824var it=me.synergies[i];6825if (Game.Has(it.name))6826{6827var weight=0.05;6828var other=it.buildingTie1;6829if (me==it.buildingTie1) {weight=0.001;other=it.buildingTie2;}6830var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+me.amount*weight);6831synergyBoost+=boost;6832if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;6833synergiesWith[other.plural]+=me.amount*weight;6834//synergiesStr+='Synergy with '+other.name+'; we boost it by '+Beautify((me.amount*weight)*100,1)+'%, producing '+Beautify(boost)+' CpS. My synergy boost is now '+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%.<br>';6835}6836}6837if (synergyBoost>0)6838{6839for (var i in synergiesWith)6840{6841if (synergiesStr!='') synergiesStr+=', ';6842synergiesStr+=i+' +'+Beautify(synergiesWith[i]*100,1)+'%';6843}6844//synergiesStr='...along with <b>'+Beautify(synergyBoost,1)+'</b> cookies through synergies with other buildings ('+synergiesStr+'; <b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS)';6845//synergiesStr='...also boosting some other buildings, accounting for <b>'+Beautify(synergyBoost,1)+'</b> cookies per second (a combined <b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS) : '+synergiesStr+'';6846synergiesStr='...also boosting some other buildings : '+synergiesStr+' - all combined, these boosts account for <b>'+Beautify(synergyBoost,1)+'</b> cookies per second (<b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS)';6847}6848}68496850return '<div style="min-width:350px;padding:8px;"><div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div><div style="float:right;text-align:right;"><span class="price'+(canBuy?'':' disabled')+'">'+Beautify(Math.round(price))+'</span>'+Game.costDetails(price)+'</div><div class="name">'+name+'</div>'+'<small>[owned : '+me.amount+'</small>]'+(me.free>0?' <small>[free : '+me.free+'</small>!]':'')+6851'<div class="line"></div><div class="description">'+desc+'</div>'+6852(me.totalCookies>0?(6853'<div class="line"></div><div class="data">'+6854(me.amount>0?'• each '+me.single+' produces <b>'+Beautify((me.storedTotalCps/me.amount)*Game.globalCpsMult,1)+'</b> '+((me.storedTotalCps/me.amount)*Game.globalCpsMult==1?'cookie':'cookies')+' per second<br>':'')+6855'• '+me.amount+' '+(me.amount==1?me.single:me.plural)+' producing <b>'+Beautify(me.storedTotalCps*Game.globalCpsMult,1)+'</b> '+(me.storedTotalCps*Game.globalCpsMult==1?'cookie':'cookies')+' per second (<b>'+Beautify(Game.cookiesPs>0?((me.amount>0?((me.storedTotalCps*Game.globalCpsMult)/Game.cookiesPs):0)*100):0,1)+'%</b> of total CpS)<br>'+6856(synergiesStr?('• '+synergiesStr+'<br>'):'')+6857'• <b>'+Beautify(me.totalCookies)+'</b> '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName+' so far</div>'6858):'')+6859'</div>';6860}6861this.levelTooltip=function()6862{6863var me=this;6864return '<div style="width:280px;padding:8px;"><b>Level '+Beautify(me.level)+' '+me.plural+'</b><div class="line"></div>'+(me.level==1?me.extraName:me.extraPlural).replace('[X]',Beautify(me.level))+' granting <b>+'+Beautify(me.level)+'% '+me.name+' CpS</b>.<div class="line"></div>Click to level up for <span class="price lump'+(Game.lumps>=me.level+1?'':' disabled')+'">'+Beautify(me.level+1)+' sugar lump'+(me.level==0?'':'s')+'</span>.'+((me.level==0 && me.minigameUrl)?'<div class="line"></div><b>Levelling up this building unlocks a minigame.</b>':'')+'</div>';6865}6866/*this.levelUp=function()6867{6868var me=this;6869if (Game.lumps<me.level+1) return 0;6870Game.lumps-=me.level+1;6871me.level+=1;6872if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);6873PlaySound('snd/upgrade.mp3',0.6);6874Game.LoadMinigames();6875me.refresh();6876if (l('productLevel'+me.id)){var rect=l('productLevel'+me.id).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}6877Game.recalculateGains=1;6878if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);6879}*/6880this.levelUp=function(me){6881return function(){Game.spendLump(me.level+1,'level up your '+me.plural,function()6882{6883me.level+=1;6884if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);6885PlaySound('snd/upgrade.mp3',0.6);6886Game.LoadMinigames();6887me.refresh();6888if (l('productLevel'+me.id)){var rect=l('productLevel'+me.id).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}6889if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);6890})();};6891}(this);68926893this.refresh=function()//show/hide the building display based on its amount, and redraw it6894{6895this.price=this.getPrice();6896if (Game.buyMode==1) this.bulkPrice=this.getSumPrice(Game.buyBulk);6897else if (Game.buyMode==-1 && Game.buyBulk==-1) this.bulkPrice=this.getReverseSumPrice(1000);6898else if (Game.buyMode==-1) this.bulkPrice=this.getReverseSumPrice(Game.buyBulk);6899this.rebuild();6900if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');6901else if (this.amount>0 && this.id!=0) l('row'+this.id).classList.add('enabled');6902if (this.muted>0 && this.id!=0) {l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}6903else if (this.id!=0) {l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}6904//if (!this.onMinigame && !this.muted) {}6905//else this.pics=[];6906}6907this.rebuild=function()6908{6909var me=this;6910//var classes='product';6911var price=me.bulkPrice;6912/*if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';me.locked=0;} else {classes+=' locked';me.locked=1;}6913if (Game.cookies>=price) classes+=' enabled'; else classes+=' disabled';6914if (me.l.className.indexOf('toggledOff')!=-1) classes+=' toggledOff';6915*/6916var icon=[0,me.icon];6917var iconOff=[1,me.icon];6918if (me.iconFunc) icon=me.iconFunc();69196920var desc=me.desc;6921var name=me.name;6922var displayName=me.displayName;6923if (Game.season=='fools')6924{6925if (!Game.foolObjects[me.name])6926{6927icon=[2,0];6928iconOff=[3,0];6929name=Game.foolObjects['Unknown'].name;6930desc=Game.foolObjects['Unknown'].desc;6931}6932else6933{6934icon=[2,me.icon];6935iconOff=[3,me.icon];6936name=Game.foolObjects[me.name].name;6937desc=Game.foolObjects[me.name].desc;6938}6939displayName=name;6940if (name.length>16) displayName='<span style="font-size:75%;">'+name+'</span>';6941}6942icon=[icon[0]*64,icon[1]*64];6943iconOff=[iconOff[0]*64,iconOff[1]*64];69446945//me.l.className=classes;6946//l('productIcon'+me.id).style.backgroundImage='url(img/'+icon+')';6947l('productIcon'+me.id).style.backgroundPosition='-'+icon[0]+'px -'+icon[1]+'px';6948//l('productIconOff'+me.id).style.backgroundImage='url(img/'+iconOff+')';6949l('productIconOff'+me.id).style.backgroundPosition='-'+iconOff[0]+'px -'+iconOff[1]+'px';6950l('productName'+me.id).innerHTML=displayName;6951l('productOwned'+me.id).innerHTML=me.amount?me.amount:'';6952l('productPrice'+me.id).innerHTML=Beautify(Math.round(price));6953l('productPriceMult'+me.id).innerHTML=(Game.buyBulk>1)?('x'+Game.buyBulk+' '):'';6954l('productLevel'+me.id).innerHTML='lvl '+Beautify(me.level);6955if (Game.isMinigameReady(me) && Game.ascensionMode!=1)6956{6957l('productMinigameButton'+me.id).style.display='block';6958if (!me.onMinigame) l('productMinigameButton'+me.id).innerHTML='View '+me.minigameName;6959else l('productMinigameButton'+me.id).innerHTML='Close '+me.minigameName;6960}6961else l('productMinigameButton'+me.id).style.display='none';6962}6963this.muted=false;6964this.mute=function(val)6965{6966if (this.id==0) return false;6967this.muted=val;6968if (val) {l('productMute'+this.id).classList.add('on');l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}6969else {l('productMute'+this.id).classList.remove('on');l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}6970};69716972this.draw=function(){};69736974if (this.id==0)6975{6976var str='<div class="productButtons">';6977str+='<div id="productLevel'+this.id+'" class="productButton productLevel lumpsOnly" onclick="Game.ObjectsById['+this.id+'].levelUp()" '+Game.getDynamicTooltip('Game.ObjectsById['+this.id+'].levelTooltip','this')+'></div>';6978str+='<div id="productMinigameButton'+this.id+'" class="productButton productMinigameButton lumpsOnly" onclick="Game.ObjectsById['+this.id+'].switchMinigame(-1);PlaySound(Game.ObjectsById['+this.id+'].onMinigame?\'snd/clickOn.mp3\':\'snd/clickOff.mp3\');"></div>';6979str+='</div>';6980l('sectionLeftExtra').innerHTML=l('sectionLeftExtra').innerHTML+str;6981}6982else//draw it6983{6984var str='<div class="row" id="row'+this.id+'"><div class="separatorBottom"></div>';6985str+='<div class="productButtons">';6986str+='<div id="productLevel'+this.id+'" class="productButton productLevel lumpsOnly" onclick="Game.ObjectsById['+this.id+'].levelUp()" '+Game.getDynamicTooltip('Game.ObjectsById['+this.id+'].levelTooltip','this')+'></div>';6987str+='<div id="productMinigameButton'+this.id+'" class="productButton productMinigameButton lumpsOnly" onclick="Game.ObjectsById['+this.id+'].switchMinigame(-1);PlaySound(Game.ObjectsById['+this.id+'].onMinigame?\'snd/clickOn.mp3\':\'snd/clickOff.mp3\');"></div>';6988str+='<div class="productButton productMute" '+Game.getTooltip('<div style="width:150px;text-align:center;font-size:11px;"><b>Mute</b><br>(Minimize this building)</div>','this')+' onclick="Game.ObjectsById['+this.id+'].mute(1);PlaySound(Game.ObjectsById['+this.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" id="productMute'+this.id+'">Mute</div>';6989str+='</div>';6990str+='<canvas class="rowCanvas" id="rowCanvas'+this.id+'"></canvas>';6991str+='<div class="rowSpecial" id="rowSpecial'+this.id+'"></div>';6992str+='</div>';6993l('rows').innerHTML=l('rows').innerHTML+str;69946995//building canvas6996this.pics=[];69976998this.toResize=true;6999this.redraw=function()7000{7001var me=this;7002me.pics=[];7003}7004this.draw=function()7005{7006if (this.amount<=0) return false;7007if (this.toResize)7008{7009this.canvas.width=this.canvas.clientWidth;7010this.canvas.height=this.canvas.clientHeight;7011this.toResize=false;7012}7013var ctx=this.ctx;7014//clear7015//ctx.clearRect(0,0,this.canvas.width,this.canvas.height);7016ctx.globalAlpha=1;70177018//pic : a loaded picture or a function returning a loaded picture7019//bg : a loaded picture or a function returning a loaded picture - tiled as the background, 128x1287020//xV : the pictures will have a random horizontal shift by this many pixels7021//yV : the pictures will have a random vertical shift by this many pixels7022//w : how many pixels between each picture (or row of pictures)7023//x : horizontal offset7024//y : vertical offset (+32)7025//rows : if >1, arrange the pictures in rows containing this many pictures7026//frames : if present, slice the pic in [frames] horizontal slices and pick one at random70277028var pic=this.art.pic;7029var bg=this.art.bg;7030var xV=this.art.xV||0;7031var yV=this.art.yV||0;7032var w=this.art.w||48;7033var h=this.art.h||48;7034var offX=this.art.x||0;7035var offY=this.art.y||0;7036var rows=this.art.rows||1;7037var frames=this.art.frames||1;70387039if (typeof(bg)=='string') ctx.fillPattern(Pic(this.art.bg),0,0,this.canvas.width,this.canvas.height,128,128);7040else bg(this,ctx);7041/*7042ctx.globalAlpha=0.5;7043if (typeof(bg)=='string')//test7044{7045ctx.fillPattern(Pic(this.art.bg),-128+Game.T%128,0,this.canvas.width+128,this.canvas.height,128,128);7046ctx.fillPattern(Pic(this.art.bg),-128+Math.floor(Game.T/2)%128,-128+Math.floor(Game.T/2)%128,this.canvas.width+128,this.canvas.height+128,128,128);7047}7048ctx.globalAlpha=1;7049*/7050var maxI=Math.floor(this.canvas.width/(w/rows)+1);7051var iT=Math.min(this.amount,maxI);7052var i=this.pics.length;705370547055var x=0;7056var y=0;7057var added=0;7058if (i!=iT)7059{7060//for (var iter=0;iter<3;iter++)7061//{7062while (i<iT)7063//if (i<iT)7064{7065Math.seedrandom(Game.seed+' '+this.id+' '+i);7066if (rows!=1)7067{7068x=Math.floor(i/rows)*w+((i%rows)/rows)*w+Math.floor((Math.random()-0.5)*xV)+offX;7069y=32+Math.floor((Math.random()-0.5)*yV)+((-rows/2)*32/2+(i%rows)*32/2)+offY;7070}7071else7072{7073x=i*w+Math.floor((Math.random()-0.5)*xV)+offX;7074y=32+Math.floor((Math.random()-0.5)*yV)+offY;7075}7076var usedPic=(typeof(pic)=='string'?pic:pic(this,i));7077var frame=-1;7078if (frames>1) frame=Math.floor(Math.random()*frames);7079this.pics.push({x:Math.floor(x),y:Math.floor(y),z:y,pic:usedPic,id:i,frame:frame});7080i++;7081added++;7082}7083while (i>iT)7084//else if (i>iT)7085{7086this.pics.sort(Game.sortSpritesById);7087this.pics.pop();7088i--;7089added--;7090}7091//}7092this.pics.sort(Game.sortSprites);7093}70947095var len=this.pics.length;70967097if (this.mouseOn)7098{7099var selected=-1;7100//mouse detection only fits grandma sprites for now7101var marginW=-18;7102var marginH=-10;7103for (var i=0;i<len;i++)7104{7105var pic=this.pics[i];7106if (this.mousePos[0]>=pic.x-marginW && this.mousePos[0]<pic.x+64+marginW && this.mousePos[1]>=pic.y-marginH && this.mousePos[1]<pic.y+64+marginH) selected=i;7107}7108}71097110Math.seedrandom();71117112for (var i=0;i<len;i++)7113{7114var pic=this.pics[i];7115var sprite=Pic(pic.pic);7116if (selected==i && this.name=='Grandma')7117{7118ctx.font='14px Merriweather';7119ctx.textAlign='center';7120Math.seedrandom(Game.seed+' '+pic.id/*+' '+pic.id*/);//(Game.seed+' '+pic.id+' '+pic.x+' '+pic.y);7121var years=((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365))+Math.random();//the grandmas age with the game7122var name=choose(Game.grandmaNames);7123var custom=false;7124if (Game.prefs.customGrandmas && Game.customGrandmaNames.length>0 && Math.random()<0.2) {name=choose(Game.customGrandmaNames);custom=true;}7125var text=name+', age '+Beautify(Math.floor(70+Math.random()*30+years+this.level));7126var width=ctx.measureText(text).width+12;7127var x=Math.max(0,Math.min(pic.x+32-width/2+Math.random()*32-16,this.canvas.width-width));7128var y=4+Math.random()*8-4;7129Math.seedrandom();7130ctx.fillStyle='#000';7131ctx.strokeStyle='#000';7132ctx.lineWidth=8;7133ctx.globalAlpha=0.75;7134ctx.beginPath();7135ctx.moveTo(pic.x+32,pic.y+32);7136ctx.lineTo(Math.floor(x+width/2),Math.floor(y+20));7137ctx.stroke();7138ctx.fillRect(Math.floor(x),Math.floor(y),Math.floor(width),24);7139ctx.globalAlpha=1;7140if (custom) ctx.fillStyle='#fff';7141else ctx.fillStyle='rgba(255,255,255,0.7)';7142ctx.fillText(text,Math.floor(x+width/2),Math.floor(y+16));71437144ctx.drawImage(sprite,Math.floor(pic.x+Math.random()*4-2),Math.floor(pic.y+Math.random()*4-2));7145}7146//else if (1) ctx.drawImage(sprite,0,0,sprite.width,sprite.height,pic.x,pic.y,sprite.width,sprite.height);7147else if (pic.frame!=-1) ctx.drawImage(sprite,(sprite.width/frames)*pic.frame,0,sprite.width/frames,sprite.height,pic.x,pic.y,(sprite.width/frames),sprite.height);7148else ctx.drawImage(sprite,pic.x,pic.y);71497150}71517152/*7153var picX=this.id;7154var picY=12;7155var w=1;7156var h=1;7157var w=Math.abs(Math.cos(Game.T*0.2+this.id*2-0.3))*0.2+0.8;7158var h=Math.abs(Math.sin(Game.T*0.2+this.id*2))*0.3+0.7;7159var x=64+Math.cos(Game.T*0.19+this.id*2)*8-24*w;7160var y=128-Math.abs(Math.pow(Math.sin(Game.T*0.2+this.id*2),5)*16)-48*h;7161ctx.drawImage(Pic('icons.png'),picX*48,picY*48,48,48,Math.floor(x),Math.floor(y),48*w,48*h);7162*/7163}7164}71657166Game.last=this;7167Game.Objects[this.name]=this;7168Game.ObjectsById[this.id]=this;7169Game.ObjectsN++;7170return this;7171}71727173Game.DrawBuildings=function()//draw building displays with canvas7174{7175if (Game.drawT%3==0)7176{7177for (var i in Game.Objects)7178{7179var me=Game.Objects[i];7180if (me.id>0 && !me.onMinigame && !me.muted) me.draw();7181else me.pics=[];7182}7183}7184}71857186Game.sortSprites=function(a,b)7187{7188if (a.z>b.z) return 1;7189else if (a.z<b.z) return -1;7190else return 0;7191}7192Game.sortSpritesById=function(a,b)7193{7194if (a.id>b.id) return 1;7195else if (a.id<b.id) return -1;7196else return 0;7197}71987199Game.modifyBuildingPrice=function(building,price)7200{7201if (Game.Has('Season savings')) price*=0.99;7202if (Game.Has('Santa\'s dominion')) price*=0.99;7203if (Game.Has('Faberge egg')) price*=0.99;7204if (Game.Has('Divine discount')) price*=0.99;7205if (Game.Has('Fortune #100')) price*=0.99;7206//if (Game.hasAura('Fierce Hoarder')) price*=0.98;7207price*=1-Game.auraMult('Fierce Hoarder')*0.02;7208if (Game.hasBuff('Everything must go')) price*=0.95;7209if (Game.hasBuff('Crafty pixies')) price*=0.98;7210if (Game.hasBuff('Nasty goblins')) price*=1.02;7211if (building.fortune && Game.Has(building.fortune.name)) price*=0.93;7212price*=Game.eff('buildingCost');7213if (Game.hasGod)7214{7215var godLvl=Game.hasGod('creation');7216if (godLvl==1) price*=0.93;7217else if (godLvl==2) price*=0.95;7218else if (godLvl==3) price*=0.98;7219}7220return price;7221}72227223Game.storeBulkButton=function(id)7224{7225if (id==0) Game.buyMode=1;7226else if (id==1) Game.buyMode=-1;7227else if (id==2) Game.buyBulk=1;7228else if (id==3) Game.buyBulk=10;7229else if (id==4) Game.buyBulk=100;7230else if (id==5) Game.buyBulk=-1;72317232if (Game.buyMode==1 && Game.buyBulk==-1) Game.buyBulk=100;72337234if (Game.buyMode==1) l('storeBulkBuy').className='storePreButton storeBulkMode selected'; else l('storeBulkBuy').className='storePreButton storeBulkMode';7235if (Game.buyMode==-1) l('storeBulkSell').className='storePreButton storeBulkMode selected'; else l('storeBulkSell').className='storePreButton storeBulkMode';72367237if (Game.buyBulk==1) l('storeBulk1').className='storePreButton storeBulkAmount selected'; else l('storeBulk1').className='storePreButton storeBulkAmount';7238if (Game.buyBulk==10) l('storeBulk10').className='storePreButton storeBulkAmount selected'; else l('storeBulk10').className='storePreButton storeBulkAmount';7239if (Game.buyBulk==100) l('storeBulk100').className='storePreButton storeBulkAmount selected'; else l('storeBulk100').className='storePreButton storeBulkAmount';7240if (Game.buyBulk==-1) l('storeBulkMax').className='storePreButton storeBulkAmount selected'; else l('storeBulkMax').className='storePreButton storeBulkAmount';72417242if (Game.buyMode==1)7243{7244l('storeBulkMax').style.visibility='hidden';7245l('products').className='storeSection';7246}7247else7248{7249l('storeBulkMax').style.visibility='visible';7250l('products').className='storeSection selling';7251}72527253Game.storeToRefresh=1;7254if (id!=-1) PlaySound('snd/tick.mp3');7255}7256Game.BuildStore=function()//create the DOM for the store's buildings7257{7258//if (typeof showAds!=='undefined') l('store').scrollTop=100;72597260var str='';7261str+='<div id="storeBulk" class="storePre" '+Game.getTooltip(7262'<div style="padding:8px;min-width:200px;text-align:center;font-size:11px;">You can also press <b>Ctrl</b> to bulk-buy or sell <b>10</b> of a building at a time, or <b>Shift</b> for <b>100</b>.</div>'7263,'store')+7264'>'+7265'<div id="storeBulkBuy" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(0);">Buy</div>'+7266'<div id="storeBulkSell" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(1);">Sell</div>'+7267'<div id="storeBulk1" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(2);">1</div>'+7268'<div id="storeBulk10" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(3);">10</div>'+7269'<div id="storeBulk100" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(4);">100</div>'+7270'<div id="storeBulkMax" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(5);">all</div>'+7271'</div>';7272for (var i in Game.Objects)7273{7274var me=Game.Objects[i];7275str+='<div class="product toggledOff" '+Game.getDynamicTooltip('Game.ObjectsById['+me.id+'].tooltip','store')+' id="product'+me.id+'"><div class="icon off" id="productIconOff'+me.id+'" style=""></div><div class="icon" id="productIcon'+me.id+'" style=""></div><div class="content"><div class="lockedTitle">???</div><div class="title" id="productName'+me.id+'"></div><span class="priceMult" id="productPriceMult'+me.id+'"></span><span class="price" id="productPrice'+me.id+'"></span><div class="title owned" id="productOwned'+me.id+'"></div></div>'+7276/*'<div class="buySell"><div style="left:0px;" id="buttonBuy10-'+me.id+'">Buy 10</div><div style="left:100px;" id="buttonSell-'+me.id+'">Sell 1</div><div style="left:200px;" id="buttonSellAll-'+me.id+'">Sell all</div></div>'+*/7277'</div>';7278}7279l('products').innerHTML=str;72807281Game.storeBulkButton(-1);72827283var SellAllPrompt=function(id)7284{7285return function(id){Game.Prompt('<div class="block">Do you really want to sell your '+Game.ObjectsById[id].amount+' '+(Game.ObjectsById[id].amount==1?Game.ObjectsById[id].single:Game.ObjectsById[id].plural)+'?</div>',[['Yes','Game.ObjectsById['+id+'].sell(-1);Game.ClosePrompt();'],['No','Game.ClosePrompt();']]);}(id);7286}72877288Game.ClickProduct=function(what)7289{7290Game.ObjectsById[what].buy();7291}72927293for (var i in Game.Objects)7294{7295var me=Game.Objects[i];7296me.l=l('product'+me.id);72977298//these are a bit messy but ah well7299if (!Game.touchEvents)7300{7301AddEvent(me.l,'click',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));7302}7303else7304{7305AddEvent(me.l,'touchend',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));7306}7307}7308}73097310Game.RefreshStore=function()//refresh the store's buildings7311{7312for (var i in Game.Objects)7313{7314Game.Objects[i].refresh();7315}7316Game.storeToRefresh=0;7317}73187319Game.ComputeCps=function(base,mult,bonus)7320{7321if (!bonus) bonus=0;7322return ((base)*(Math.pow(2,mult))+bonus);7323}73247325Game.isMinigameReady=function(me)7326{return (me.minigameUrl && me.minigameLoaded && me.level>0);}7327Game.scriptBindings=[];7328Game.LoadMinigames=function()//load scripts for each minigame7329{7330for (var i in Game.Objects)7331{7332var me=Game.Objects[i];7333if (me.minigameUrl && me.level>0 && !me.minigameLoaded && !me.minigameLoading && !l('minigameScript-'+me.id))7334{7335me.minigameLoading=true;7336//we're only loading the minigame scripts that aren't loaded yet and which have enough building level7337//we call this function on building level up and on load7338//console.log('Loading script '+me.minigameUrl+'...');7339setTimeout(function(me){return function(){7340var script=document.createElement('script');7341script.id='minigameScript-'+me.id;7342Game.scriptBindings['minigameScript-'+me.id]=me;7343script.setAttribute('src',me.minigameUrl+'?r='+Game.version);7344script.onload=function(me,script){return function(){7345if (!me.minigameLoaded) Game.scriptLoaded(me,script);7346}}(me,'minigameScript-'+me.id);7347document.head.appendChild(script);7348}}(me),10);7349}7350}7351}7352Game.scriptLoaded=function(who,script)7353{7354who.minigameLoading=false;7355who.minigameLoaded=true;7356who.refresh();7357who.minigame.launch();7358if (who.minigameSave) {who.minigame.reset(true);who.minigame.load(who.minigameSave);who.minigameSave=0;}7359}73607361Game.magicCpS=function(what)7362{7363/*7364if (Game.Objects[what].amount>=250)7365{7366//this makes buildings give 1% more cookies for every building over 250.7367//this turns out to be rather stupidly overpowered.7368var n=Game.Objects[what].amount-250;7369return 1+Math.pow(1.01,n);7370}7371else return 1;7372*/7373return 1;7374}73757376//define objects7377new Game.Object('Cursor','cursor|cursors|clicked|[X] extra finger|[X] extra fingers','Autoclicks once every 10 seconds.',0,0,{},15,function(me){7378var add=0;7379if (Game.Has('Thousand fingers')) add+= 0.1;7380if (Game.Has('Million fingers')) add+= 0.5;7381if (Game.Has('Billion fingers')) add+= 5;7382if (Game.Has('Trillion fingers')) add+= 50;7383if (Game.Has('Quadrillion fingers')) add+= 500;7384if (Game.Has('Quintillion fingers')) add+= 5000;7385if (Game.Has('Sextillion fingers')) add+= 50000;7386if (Game.Has('Septillion fingers')) add+= 500000;7387if (Game.Has('Octillion fingers')) add+= 5000000;7388var mult=1;7389var num=0;7390for (var i in Game.Objects) {if (Game.Objects[i].name!='Cursor') num+=Game.Objects[i].amount;}7391add=add*num;7392mult*=Game.GetTieredCpsMult(me);7393mult*=Game.magicCpS('Cursor');7394mult*=Game.eff('cursorCps');7395return Game.ComputeCps(0.1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add)*mult;7396},function(){7397if (this.amount>=1) Game.Unlock(['Reinforced index finger','Carpal tunnel prevention cream']);7398if (this.amount>=10) Game.Unlock('Ambidextrous');7399if (this.amount>=25) Game.Unlock('Thousand fingers');7400if (this.amount>=50) Game.Unlock('Million fingers');7401if (this.amount>=100) Game.Unlock('Billion fingers');7402if (this.amount>=150) Game.Unlock('Trillion fingers');7403if (this.amount>=200) Game.Unlock('Quadrillion fingers');7404if (this.amount>=250) Game.Unlock('Quintillion fingers');7405if (this.amount>=300) Game.Unlock('Sextillion fingers');7406if (this.amount>=350) Game.Unlock('Septillion fingers');7407if (this.amount>=400) Game.Unlock('Octillion fingers');74087409if (this.amount>=1) Game.Win('Click');if (this.amount>=2) Game.Win('Double-click');if (this.amount>=50) Game.Win('Mouse wheel');if (this.amount>=100) Game.Win('Of Mice and Men');if (this.amount>=200) Game.Win('The Digital');if (this.amount>=300) Game.Win('Extreme polydactyly');if (this.amount>=400) Game.Win('Dr. T');if (this.amount>=500) Game.Win('Thumbs, phalanges, metacarpals');if (this.amount>=600) Game.Win('With her finger and her thumb');7410});74117412Game.SpecialGrandmaUnlock=15;7413new Game.Object('Grandma','grandma|grandmas|baked|Grandmas are [X] year older|Grandmas are [X] years older','A nice grandma to bake more cookies.',1,1,{pic:function(i){7414var list=['grandma'];7415if (Game.Has('Farmer grandmas')) list.push('farmerGrandma');7416if (Game.Has('Worker grandmas')) list.push('workerGrandma');7417if (Game.Has('Miner grandmas')) list.push('minerGrandma');7418if (Game.Has('Cosmic grandmas')) list.push('cosmicGrandma');7419if (Game.Has('Transmuted grandmas')) list.push('transmutedGrandma');7420if (Game.Has('Altered grandmas')) list.push('alteredGrandma');7421if (Game.Has('Grandmas\' grandmas')) list.push('grandmasGrandma');7422if (Game.Has('Antigrandmas')) list.push('antiGrandma');7423if (Game.Has('Rainbow grandmas')) list.push('rainbowGrandma');7424if (Game.Has('Banker grandmas')) list.push('bankGrandma');7425if (Game.Has('Priestess grandmas')) list.push('templeGrandma');7426if (Game.Has('Witch grandmas')) list.push('witchGrandma');7427if (Game.Has('Lucky grandmas')) list.push('luckyGrandma');7428if (Game.Has('Metagrandmas')) list.push('metaGrandma');7429if (Game.Has('Script grannies')) list.push('scriptGrandma');7430if (Game.season=='christmas') list.push('elfGrandma');7431if (Game.season=='easter') list.push('bunnyGrandma');7432return choose(list)+'.png';7433},bg:'grandmaBackground.png',xV:8,yV:8,w:32,rows:3,x:0,y:16},100,function(me){7434var mult=1;7435for (var i in Game.GrandmaSynergies)7436{7437if (Game.Has(Game.GrandmaSynergies[i])) mult*=2;7438}7439if (Game.Has('Bingo center/Research facility')) mult*=4;7440if (Game.Has('Ritual rolling pins')) mult*=2;7441if (Game.Has('Naughty list')) mult*=2;74427443if (Game.Has('Elderwort biscuits')) mult*=1.02;74447445mult*=Game.eff('grandmaCps');74467447mult*=Game.GetTieredCpsMult(me);74487449var add=0;7450if (Game.Has('One mind')) add+=Game.Objects['Grandma'].amount*0.02;7451if (Game.Has('Communal brainsweep')) add+=Game.Objects['Grandma'].amount*0.02;7452if (Game.Has('Elder Pact')) add+=Game.Objects['Portal'].amount*0.05;74537454var num=0;7455for (var i in Game.Objects) {if (Game.Objects[i].name!='Grandma') num+=Game.Objects[i].amount;}7456//if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;7457mult*=1+Game.auraMult('Elder Battalion')*0.01*num;74587459mult*=Game.magicCpS(me.name);74607461return (me.baseCps+add)*mult;7462},function(){7463Game.UnlockTiered(this);7464});7465Game.last.sellFunction=function()7466{7467Game.Win('Just wrong');7468if (this.amount==0)7469{7470Game.Lock('Elder Pledge');7471Game.CollectWrinklers();7472Game.pledgeT=0;7473}7474};7475Game.last.iconFunc=function(type){7476var grandmaIcons=[[0,1],[0,2],[1,2],[2,2]];7477if (type=='off') return [0,1];7478return grandmaIcons[Game.elderWrath];7479};748074817482new Game.Object('Farm','farm|farms|harvested|[X] more acre|[X] more acres','Grows cookie plants from cookie seeds.',3,2,{base:'farm',xV:8,yV:8,w:64,rows:2,x:0,y:16},500,function(me){7483var mult=1;7484mult*=Game.GetTieredCpsMult(me);7485mult*=Game.magicCpS(me.name);7486return me.baseCps*mult;7487},function(){7488Game.UnlockTiered(this);7489if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7490});7491Game.last.minigameUrl='minigameGarden.js';7492Game.last.minigameName='Garden';74937494new Game.Object('Mine','mine|mines|mined|[X] mile deeper|[X] miles deeper','Mines out cookie dough and chocolate chips.',4,3,{base:'mine',xV:16,yV:16,w:64,rows:2,x:0,y:24},10000,function(me){7495var mult=1;7496mult*=Game.GetTieredCpsMult(me);7497mult*=Game.magicCpS(me.name);7498return me.baseCps*mult;7499},function(){7500Game.UnlockTiered(this);7501if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7502});75037504new Game.Object('Factory','factory|factories|mass-produced|[X] additional patent|[X] additional patents','Produces large quantities of cookies.',5,4,{base:'factory',xV:8,yV:0,w:64,rows:1,x:0,y:-22},3000,function(me){7505var mult=1;7506mult*=Game.GetTieredCpsMult(me);7507mult*=Game.magicCpS(me.name);7508return me.baseCps*mult;7509},function(){7510Game.UnlockTiered(this);7511if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7512});7513//Game.last.minigameUrl='minigameDungeon.js';//not yet7514//Game.last.minigameName='Dungeon';75157516new Game.Object('Bank','bank|banks|banked|Interest rates [X]% better|Interest rates [X]% better','Generates cookies from interest.',6,15,{base:'bank',xV:8,yV:4,w:56,rows:1,x:0,y:13},0,function(me){7517var mult=1;7518mult*=Game.GetTieredCpsMult(me);7519mult*=Game.magicCpS(me.name);7520return me.baseCps*mult;7521},function(){7522Game.UnlockTiered(this);7523if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7524});75257526new Game.Object('Temple','temple|temples|discovered|[X] sacred artifact retrieved|[X] sacred artifacts retrieved','Full of precious, ancient chocolate.',7,16,{base:'temple',xV:8,yV:4,w:72,rows:2,x:0,y:-5},0,function(me){7527var mult=1;7528mult*=Game.GetTieredCpsMult(me);7529mult*=Game.magicCpS(me.name);7530return me.baseCps*mult;7531},function(){7532Game.UnlockTiered(this);7533if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7534});7535Game.last.minigameUrl='minigamePantheon.js';7536Game.last.minigameName='Pantheon';75377538new Game.Object('Wizard tower','wizard tower|wizard towers|summoned|Incantations have [X] more syllable|Incantations have [X] more syllables','Summons cookies with magic spells.',8,17,{base:'wizardtower',xV:16,yV:16,w:48,rows:2,x:0,y:20},0,function(me){7539var mult=1;7540mult*=Game.GetTieredCpsMult(me);7541mult*=Game.magicCpS(me.name);7542return me.baseCps*mult;7543},function(){7544Game.UnlockTiered(this);7545if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7546});7547Game.last.minigameUrl='minigameGrimoire.js';7548Game.last.minigameName='Grimoire';75497550new Game.Object('Shipment','shipment|shipments|shipped|[X] galaxy fully explored|[X] galaxies fully explored','Brings in fresh cookies from the cookie planet.',9,5,{base:'shipment',xV:16,yV:16,w:64,rows:1,x:0,y:0},40000,function(me){7551var mult=1;7552mult*=Game.GetTieredCpsMult(me);7553mult*=Game.magicCpS(me.name);7554return me.baseCps*mult;7555},function(){7556Game.UnlockTiered(this);7557if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7558});75597560new Game.Object('Alchemy lab','alchemy lab|alchemy labs|transmuted|[X] primordial element mastered|[X] primordial elements mastered','Turns gold into cookies!',10,6,{base:'alchemylab',xV:16,yV:16,w:64,rows:2,x:0,y:16},200000,function(me){7561var mult=1;7562mult*=Game.GetTieredCpsMult(me);7563mult*=Game.magicCpS(me.name);7564return me.baseCps*mult;7565},function(){7566Game.UnlockTiered(this);7567if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7568});75697570new Game.Object('Portal','portal|portals|retrieved|[X] dimension enslaved|[X] dimensions enslaved','Opens a door to the Cookieverse.',11,7,{base:'portal',xV:32,yV:32,w:64,rows:2,x:0,y:0},1666666,function(me){7571var mult=1;7572mult*=Game.GetTieredCpsMult(me);7573mult*=Game.magicCpS(me.name);7574return me.baseCps*mult;7575},function(){7576Game.UnlockTiered(this);7577if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7578});75797580new Game.Object('Time machine','time machine|time machines|recovered|[X] century secured|[X] centuries secured','Brings cookies from the past, before they were even eaten.',12,8,{base:'timemachine',xV:32,yV:32,w:64,rows:1,x:0,y:0},123456789,function(me){7581var mult=1;7582mult*=Game.GetTieredCpsMult(me);7583mult*=Game.magicCpS(me.name);7584return me.baseCps*mult;7585},function(){7586Game.UnlockTiered(this);7587if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7588});75897590new Game.Object('Antimatter condenser','antimatter condenser|antimatter condensers|condensed|[X] extra quark flavor|[X] extra quark flavors','Condenses the antimatter in the universe into cookies.',13,13,{base:'antimattercondenser',xV:0,yV:64,w:64,rows:1,x:0,y:0},3999999999,function(me){7591var mult=1;7592mult*=Game.GetTieredCpsMult(me);7593mult*=Game.magicCpS(me.name);7594return me.baseCps*mult;7595},function(){7596Game.UnlockTiered(this);7597if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7598});7599Game.last.displayName='<span style="font-size:65%;position:relative;bottom:4px;">Antimatter condenser</span>';//shrink the name since it's so large76007601new Game.Object('Prism','prism|prisms|converted|[X] new color discovered|[X] new colors discovered','Converts light itself into cookies.',14,14,{base:'prism',xV:16,yV:4,w:64,rows:1,x:0,y:20},75000000000,function(me){7602var mult=1;7603mult*=Game.GetTieredCpsMult(me);7604mult*=Game.magicCpS(me.name);7605return me.baseCps*mult;7606},function(){7607Game.UnlockTiered(this);7608if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7609});76107611new Game.Object('Chancemaker','chancemaker|chancemakers|spontaneously generated|Chancemakers are powered by [X]-leaf clovers|Chancemakers are powered by [X]-leaf clovers','Generates cookies out of thin air through sheer luck.',15,19,{base:'chancemaker',xV:8,yV:64,w:64,rows:1,x:0,y:0,rows:2},77777777777,function(me){7612var mult=1;7613mult*=Game.GetTieredCpsMult(me);7614mult*=Game.magicCpS(me.name);7615return me.baseCps*mult;7616},function(){7617Game.UnlockTiered(this);7618if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7619});76207621new Game.Object('Fractal engine','fractal engine|fractal engines|made from cookies|[X] iteration deep|[X] iterations deep','Turns cookies into even more cookies.',16,20,{base:'fractalEngine',xV:8,yV:64,w:64,rows:1,x:0,y:0},12345678987654321,function(me){7622var mult=1;7623mult*=Game.GetTieredCpsMult(me);7624mult*=Game.magicCpS(me.name);7625return me.baseCps*mult;7626},function(){7627Game.UnlockTiered(this);7628if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7629});76307631new Game.Object('Javascript console','javascript console|javascript consoles|programmed|Equipped with [X] external library|Equipped with [X] external libraries','Creates cookies from the very code this game was written in.',17,32,{base:'javascriptconsole',xV:8,yV:64,w:14,rows:1,x:8,y:-32,frames:2},12345678987654321,function(me){7632var mult=1;7633mult*=Game.GetTieredCpsMult(me);7634mult*=Game.magicCpS(me.name);7635return me.baseCps*mult;7636},function(){7637Game.UnlockTiered(this);7638if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);7639});7640Game.last.displayName='<span style="font-size:65%;position:relative;bottom:4px;">Javascript console</span>';//shrink the name since it's so large764176427643Game.foolObjects={7644'Unknown':{name:'Investment',desc:'You\'re not sure what this does, you just know it means profit.',icon:0},7645'Cursor':{name:'Rolling pin',desc:'Essential in flattening dough. The first step in cookie-making.',icon:0},7646'Grandma':{name:'Oven',desc:'A crucial element of baking cookies.',icon:1},7647'Farm':{name:'Kitchen',desc:'The more kitchens, the more cookies your employees can produce.',icon:2},7648'Mine':{name:'Secret recipe',desc:'These give you the edge you need to outsell those pesky competitors.',icon:3},7649'Factory':{name:'Factory',desc:'Mass production is the future of baking. Seize the day, and synergize!',icon:4},7650'Bank':{name:'Investor',desc:'Business folks with a nose for profit, ready to finance your venture as long as there\'s money to be made.',icon:5},7651'Temple':{name:'Like',desc:'Your social media page is going viral! Amassing likes is the key to a lasting online presence and juicy advertising deals.',icon:9},7652'Wizard tower':{name:'Meme',desc:'Cookie memes are all the rage! With just the right amount of social media astroturfing, your brand image will be all over the cyberspace.',icon:6},7653'Shipment':{name:'Supermarket',desc:'A gigantic cookie emporium - your very own retail chain.',icon:7},7654'Alchemy lab':{name:'Stock share',desc:'You\'re officially on the stock market, and everyone wants a piece!',icon:8},7655'Portal':{name:'TV show',desc:'Your cookies have their own sitcom! Hilarious baking hijinks set to the cheesiest laughtrack.',icon:10},7656'Time machine':{name:'Theme park',desc:'Cookie theme parks, full of mascots and roller-coasters. Build one, build a hundred!',icon:11},7657'Antimatter condenser':{name:'Cookiecoin',desc:'A virtual currency, already replacing regular money in some small countries.',icon:12},7658'Prism':{name:'Corporate country',desc:'You\'ve made it to the top, and you can now buy entire nations to further your corporate greed. Godspeed.',icon:13},7659'Chancemaker':{name:'Privatized planet',desc:'Actually, you know what\'s cool? A whole planet dedicated to producing, advertising, selling, and consuming your cookies.',icon:15},7660'Fractal engine':{name:'Senate seat',desc:'Only through political dominion can you truly alter this world to create a brighter, more cookie-friendly future.',icon:16},7661'Javascript console':{name:'Doctrine',desc:'Taking many forms -religion, culture, philosophy- a doctrine may, when handled properly, cause a lasting impact on civilizations, reshaping minds and people and ensuring all future generations share a singular goal - the production, and acquisition, of more cookies.',icon:17},7662};766376647665//build store7666Game.BuildStore();76677668//build master bar7669var str='';7670str+='<div id="buildingsMute" class="shadowFilter" style="position:relative;z-index:100;padding:4px 16px 0px 64px;"></div>';7671str+='<div class="separatorBottom" style="position:absolute;bottom:-8px;z-index:0;"></div>';7672l('buildingsMaster').innerHTML=str;76737674//build object displays7675var muteStr='<div style="position:absolute;left:8px;bottom:12px;opacity:0.5;">Muted :</div>';7676for (var i in Game.Objects)7677{7678var me=Game.Objects[i];7679if (me.id>0)7680{7681me.canvas=l('rowCanvas'+me.id);7682me.ctx=me.canvas.getContext('2d',{alpha:false});7683me.pics=[];7684var icon=[0*64,me.icon*64];7685muteStr+='<div class="tinyProductIcon" id="mutedProduct'+me.id+'" style="display:none;background-position:-'+icon[0]+'px -'+icon[1]+'px;" '+Game.clickStr+'="Game.ObjectsById['+me.id+'].mute(0);PlaySound(Game.ObjectsById['+me.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" '+Game.getDynamicTooltip('Game.mutedBuildingTooltip('+me.id+')','this')+'></div>';7686//muteStr+='<div class="tinyProductIcon" id="mutedProduct'+me.id+'" style="display:none;background-position:-'+icon[0]+'px -'+icon[1]+'px;" '+Game.clickStr+'="Game.ObjectsById['+me.id+'].mute(0);PlaySound(Game.ObjectsById['+me.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" '+Game.getTooltip('<div style="width:150px;text-align:center;font-size:11px;"><b>Unmute '+me.plural+'</b><br>(Display this building)</div>')+'></div>';76877688AddEvent(me.canvas,'mouseover',function(me){return function(){me.mouseOn=true;}}(me));7689AddEvent(me.canvas,'mouseout',function(me){return function(){me.mouseOn=false;}}(me));7690AddEvent(me.canvas,'mousemove',function(me){return function(e){var box=this.getBoundingClientRect();me.mousePos[0]=e.pageX-box.left;me.mousePos[1]=e.pageY-box.top;}}(me));7691}7692}7693Game.mutedBuildingTooltip=function(id)7694{7695return function(){7696var me=Game.ObjectsById[id];7697return '<div style="width:150px;text-align:center;font-size:11px;"><b>'+(me.plural.charAt(0).toUpperCase()+me.plural.slice(1))+(me.level>0?' (lvl. '+me.level+')':'')+'</b><div class="line"></div>Click to unmute '+me.plural+'<br>(display this building)</div>';7698}7699}7700l('buildingsMute').innerHTML=muteStr;77017702/*=====================================================================================7703UPGRADES7704=======================================================================================*/7705Game.upgradesToRebuild=1;7706Game.Upgrades=[];7707Game.UpgradesById=[];7708Game.UpgradesN=0;7709Game.UpgradesInStore=[];7710Game.UpgradesOwned=0;7711Game.Upgrade=function(name,desc,price,icon,buyFunction)7712{7713this.id=Game.UpgradesN;7714this.name=name;7715this.desc=desc;7716this.baseDesc=this.desc;7717this.desc=BeautifyInText(this.baseDesc);7718this.basePrice=price;7719this.priceLumps=0;//note : doesn't do much on its own, you still need to handle the buying yourself7720this.icon=icon;7721this.iconFunction=0;7722this.buyFunction=buyFunction;7723/*this.unlockFunction=unlockFunction;7724this.unlocked=(this.unlockFunction?0:1);*/7725this.unlocked=0;7726this.bought=0;7727this.order=this.id;7728if (order) this.order=order+this.id*0.001;7729this.pool='';//can be '', cookie, toggle, debug, prestige, prestigeDecor, tech, or unused7730if (pool) this.pool=pool;7731this.power=0;7732if (power) this.power=power;7733this.vanilla=Game.vanilla;7734this.unlockAt=0;7735this.techUnlock=[];7736this.parents=[];7737this.type='upgrade';7738this.tier=0;7739this.buildingTie=0;//of what building is this a tiered upgrade of ?77407741Game.last=this;7742Game.Upgrades[this.name]=this;7743Game.UpgradesById[this.id]=this;7744Game.UpgradesN++;7745return this;7746}77477748Game.Upgrade.prototype.getPrice=function()7749{7750var price=this.basePrice;7751if (this.priceFunc) price=this.priceFunc(this);7752if (price==0) return 0;7753if (this.pool!='prestige')7754{7755if (Game.Has('Toy workshop')) price*=0.95;7756if (Game.Has('Five-finger discount')) price*=Math.pow(0.99,Game.Objects['Cursor'].amount/100);7757if (Game.Has('Santa\'s dominion')) price*=0.98;7758if (Game.Has('Faberge egg')) price*=0.99;7759if (Game.Has('Divine sales')) price*=0.99;7760if (Game.Has('Fortune #100')) price*=0.99;7761if (Game.hasBuff('Haggler\'s luck')) price*=0.98;7762if (Game.hasBuff('Haggler\'s misery')) price*=1.02;7763//if (Game.hasAura('Master of the Armory')) price*=0.98;7764price*=1-Game.auraMult('Master of the Armory')*0.02;7765price*=Game.eff('upgradeCost');7766if (this.pool=='cookie' && Game.Has('Divine bakeries')) price/=5;7767}7768return Math.ceil(price);7769}77707771Game.Upgrade.prototype.canBuy=function()7772{7773if (this.canBuyFunc) return this.canBuyFunc();7774if (Game.cookies>=this.getPrice()) return true; else return false;7775}77767777Game.storeBuyAll=function()7778{7779if (!Game.Has('Inspired checklist')) return false;7780for (var i in Game.UpgradesInStore)7781{7782var me=Game.UpgradesInStore[i];7783if (!me.isVaulted() && me.pool!='toggle' && me.pool!='tech') me.buy(1);7784}7785}77867787Game.vault=[];7788Game.Upgrade.prototype.isVaulted=function()7789{7790if (Game.vault.indexOf(this.id)!=-1) return true; else return false;7791}7792Game.Upgrade.prototype.vault=function()7793{7794if (!this.isVaulted()) Game.vault.push(this.id);7795}7796Game.Upgrade.prototype.unvault=function()7797{7798if (this.isVaulted()) Game.vault.splice(Game.vault.indexOf(this.id),1);7799}78007801Game.Upgrade.prototype.click=function(e)7802{7803if ((e && e.shiftKey) || Game.keys[16])7804{7805if (this.pool=='toggle' || this.pool=='tech') {}7806else if (Game.Has('Inspired checklist'))7807{7808if (this.isVaulted()) this.unvault();7809else this.vault();7810Game.upgradesToRebuild=1;7811PlaySound('snd/tick.mp3');7812}7813}7814else this.buy();7815}781678177818Game.Upgrade.prototype.buy=function(bypass)7819{7820var success=0;7821var cancelPurchase=0;7822if (this.clickFunction && !bypass) cancelPurchase=!this.clickFunction();7823if (!cancelPurchase)7824{7825if (this.choicesFunction)7826{7827if (Game.choiceSelectorOn==this.id)7828{7829l('toggleBox').style.display='none';7830l('toggleBox').innerHTML='';7831Game.choiceSelectorOn=-1;7832PlaySound('snd/tick.mp3');7833}7834else7835{7836Game.choiceSelectorOn=this.id;7837var choices=this.choicesFunction();7838if (choices.length>0)7839{7840var selected=0;7841for (var i in choices) {if (choices[i].selected) selected=i;}7842Game.choiceSelectorChoices=choices;//this is a really dumb way of doing this i am so sorry7843Game.choiceSelectorSelected=selected;7844var str='';7845str+='<div class="close" onclick="Game.UpgradesById['+this.id+'].buy();">x</div>';7846str+='<h3>'+this.name+'</h3>'+7847'<div class="line"></div>'+7848'<h4 id="choiceSelectedName">'+choices[selected].name+'</h4>'+7849'<div class="line"></div>';78507851for (var i in choices)7852{7853var icon=choices[i].icon;7854str+='<div class="crate enabled'+(i==selected?' highlighted':'')+'" style="opacity:1;float:none;display:inline-block;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="Game.UpgradesById['+this.id+'].choicesPick('+i+');PlaySound(\'snd/tick.mp3\');Game.choiceSelectorOn=-1;Game.UpgradesById['+this.id+'].buy();" onMouseOut="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices[Game.choiceSelectorSelected].name;" onMouseOver="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices['+i+'].name;"'+7855'></div>';7856}7857}7858l('toggleBox').innerHTML=str;7859l('toggleBox').style.display='block';7860l('toggleBox').focus();7861Game.tooltip.hide();7862PlaySound('snd/tick.mp3');7863success=1;7864}7865}7866else if (this.pool!='prestige')7867{7868var price=this.getPrice();7869if (this.canBuy() && !this.bought)7870{7871Game.Spend(price);7872this.bought=1;7873if (this.buyFunction) this.buyFunction();7874if (this.toggleInto)7875{7876Game.Lock(this.toggleInto);7877Game.Unlock(this.toggleInto);7878}7879Game.upgradesToRebuild=1;7880Game.recalculateGains=1;7881if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;7882Game.setOnCrate(0);7883Game.tooltip.hide();7884PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);7885success=1;7886}7887}7888else7889{7890var price=this.getPrice();7891if (Game.heavenlyChips>=price && !this.bought)7892{7893Game.heavenlyChips-=price;7894Game.heavenlyChipsSpent+=price;7895this.unlocked=1;7896this.bought=1;7897if (this.buyFunction) this.buyFunction();7898Game.BuildAscendTree();7899PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);7900PlaySound('snd/shimmerClick.mp3');7901//PlaySound('snd/buyHeavenly.mp3');7902success=1;7903}7904}7905}7906if (this.bought && this.activateFunction) this.activateFunction();7907return success;7908}7909Game.Upgrade.prototype.earn=function()//just win the upgrades without spending anything7910{7911this.unlocked=1;7912this.bought=1;7913if (this.buyFunction) this.buyFunction();7914Game.upgradesToRebuild=1;7915Game.recalculateGains=1;7916if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;7917}7918Game.Upgrade.prototype.unearn=function()//remove the upgrade, but keep it unlocked7919{7920this.bought=0;7921Game.upgradesToRebuild=1;7922Game.recalculateGains=1;7923if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;7924}7925Game.Upgrade.prototype.unlock=function()7926{7927this.unlocked=1;7928Game.upgradesToRebuild=1;7929}7930Game.Upgrade.prototype.lose=function()7931{7932this.unlocked=0;7933this.bought=0;7934Game.upgradesToRebuild=1;7935Game.recalculateGains=1;7936if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;7937}7938Game.Upgrade.prototype.toggle=function()//cheating only7939{7940if (!this.bought)7941{7942this.bought=1;7943if (this.buyFunction) this.buyFunction();7944Game.upgradesToRebuild=1;7945Game.recalculateGains=1;7946if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;7947PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);7948if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');7949}7950else7951{7952this.bought=0;7953Game.upgradesToRebuild=1;7954Game.recalculateGains=1;7955if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;7956PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);7957if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');7958}7959if (Game.onMenu=='stats') Game.UpdateMenu();7960}79617962Game.CountsAsUpgradeOwned=function(pool)7963{7964if (pool=='' || pool=='cookie' || pool=='tech') return true; else return false;7965}79667967/*AddEvent(l('toggleBox'),'blur',function()//if we click outside of the selector, close it7968{7969//this has a couple problems, such as when clicking on the upgrade - this toggles it off and back on instantly7970l('toggleBox').style.display='none';7971l('toggleBox').innerHTML='';7972Game.choiceSelectorOn=-1;7973}7974);*/79757976Game.RequiresConfirmation=function(upgrade,prompt)7977{7978upgrade.clickFunction=function(){Game.Prompt(prompt,[['Yes','Game.UpgradesById['+upgrade.id+'].buy(1);Game.ClosePrompt();'],'No']);return false;};7979}79807981Game.Unlock=function(what)7982{7983if (typeof what==='string')7984{7985if (Game.Upgrades[what])7986{7987if (Game.Upgrades[what].unlocked==0)7988{7989Game.Upgrades[what].unlocked=1;7990Game.upgradesToRebuild=1;7991Game.recalculateGains=1;7992/*if (Game.prefs.popups) {}7993else Game.Notify('Upgrade unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+Game.Upgrades[what].name+'</div>',Game.Upgrades[what].icon,6);*/7994}7995}7996}7997else {for (var i in what) {Game.Unlock(what[i]);}}7998}7999Game.Lock=function(what)8000{8001if (typeof what==='string')8002{8003if (Game.Upgrades[what])8004{8005Game.Upgrades[what].unlocked=0;8006Game.upgradesToRebuild=1;8007if (Game.Upgrades[what].bought==1 && Game.CountsAsUpgradeOwned(Game.Upgrades[what].pool)) Game.UpgradesOwned--;8008Game.Upgrades[what].bought=0;8009Game.recalculateGains=1;8010}8011}8012else {for (var i in what) {Game.Lock(what[i]);}}8013}80148015Game.Has=function(what)8016{8017var it=Game.Upgrades[what];8018if (Game.ascensionMode==1 && (it.pool=='prestige' || it.tier=='fortune')) return 0;8019return (it?it.bought:0);8020}8021Game.HasUnlocked=function(what)8022{8023return (Game.Upgrades[what]?Game.Upgrades[what].unlocked:0);8024}802580268027Game.RebuildUpgrades=function()//recalculate the upgrades you can buy8028{8029Game.upgradesToRebuild=0;8030var list=[];8031for (var i in Game.Upgrades)8032{8033var me=Game.Upgrades[i];8034if (!me.bought && me.pool!='debug' && me.pool!='prestige' && me.pool!='prestigeDecor' && (Game.ascensionMode!=1 || (!me.lasting && me.tier!='fortune')))8035{8036if (me.unlocked) list.push(me);8037}8038else if (me.displayFuncWhenOwned && me.bought) list.push(me);8039}8040var sortMap=function(a,b)8041{8042var ap=a.pool=='toggle'?a.order:a.getPrice();8043var bp=b.pool=='toggle'?b.order:b.getPrice();8044if (ap>bp) return 1;8045else if (ap<bp) return -1;8046else return 0;8047}8048list.sort(sortMap);80498050Game.UpgradesInStore=[];8051for (var i in list)8052{8053Game.UpgradesInStore.push(list[i]);8054}8055var storeStr='';8056var toggleStr='';8057var techStr='';8058var vaultStr='';80598060if (Game.Has('Inspired checklist'))8061{8062storeStr+='<div id="storeBuyAll" class="storePre" '+Game.getTooltip(8063'<div style="padding:8px;min-width:250px;text-align:center;font-size:11px;">Will <b>instantly purchase</b> every upgrade you can afford, starting from the cheapest one.<br>Upgrades in the <b>vault</b> will not be auto-purchased.<br>You may place an upgrade into the vault by <b>Shift-clicking</b> on it.</div>'8064,'store')+8065'>'+8066'<div id="storeBuyAllButton" class="storePreButton" '+Game.clickStr+'="Game.storeBuyAll();">Buy all upgrades</div>'+8067'</div>';8068l('upgrades').classList.add('hasMenu');8069}8070else l('upgrades').classList.remove('hasMenu');80718072for (var i in Game.UpgradesInStore)8073{8074//if (!Game.UpgradesInStore[i]) break;8075var me=Game.UpgradesInStore[i];8076var str=Game.crate(me,'store','Game.UpgradesById['+me.id+'].click(event);','upgrade'+i);80778078/*var str='<div class="crate upgrade" '+Game.getTooltip(8079'<div style="min-width:200px;"><div style="float:right;"><span class="price">'+Beautify(Math.round(me.getPrice()))+'</span></div><small>'+(me.pool=='toggle'?'[Togglable]':'[Upgrade]')+'</small><div class="name">'+me.name+'</div><div class="line"></div><div class="description">'+me.desc+'</div></div>'8080,'store')+' '+Game.clickStr+'="Game.UpgradesById['+me.id+'].buy();" id="upgrade'+i+'" style="'+(me.icon[2]?'background-image:url('+me.icon[2]+');':'')+'background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>';*/8081if (me.pool=='toggle') toggleStr+=str; else if (me.pool=='tech') techStr+=str; else8082{8083if (me.isVaulted() && Game.Has('Inspired checklist')) vaultStr+=str; else storeStr+=str;8084}8085}80868087l('upgrades').innerHTML=storeStr;8088l('toggleUpgrades').innerHTML=toggleStr;8089if (toggleStr=='') l('toggleUpgrades').style.display='none'; else l('toggleUpgrades').style.display='block';8090l('techUpgrades').innerHTML=techStr;8091if (techStr=='') l('techUpgrades').style.display='none'; else l('techUpgrades').style.display='block';8092l('vaultUpgrades').innerHTML=vaultStr;8093if (vaultStr=='') l('vaultUpgrades').style.display='none'; else l('vaultUpgrades').style.display='block';8094}80958096Game.UnlockAt=[];//this contains an array of every upgrade with a cookie requirement in the form of {cookies:(amount of cookies earned required),name:(name of upgrade or achievement to unlock)} (and possibly require:(name of upgrade of achievement to own))8097//note : the cookie will not be added to the list if it contains locked:1 (use for seasonal cookies and such)80988099Game.NewUpgradeCookie=function(obj)8100{8101var upgrade=new Game.Upgrade(obj.name,'Cookie production multiplier <b>+'+Beautify((typeof(obj.power)=='function'?obj.power(obj):obj.power),1)+'%</b>.<q>'+obj.desc+'</q>',obj.price,obj.icon);8102upgrade.power=obj.power;8103upgrade.pool='cookie';8104var toPush={cookies:obj.price/20,name:obj.name};8105if (obj.require) toPush.require=obj.require;8106if (obj.season) toPush.season=obj.season;8107if (!obj.locked) Game.UnlockAt.push(toPush);8108return upgrade;8109}81108111//tiered upgrades system8112//each building has several upgrade tiers8113//all upgrades in the same tier have the same color, unlock threshold and price multiplier8114Game.Tiers={81151:{name:'Plain',unlock:1,achievUnlock:1,iconRow:0,color:'#ccb3ac',price: 10},81162:{name:'Berrylium',unlock:5,achievUnlock:50,iconRow:1,color:'#ff89e7',price: 50},81173:{name:'Blueberrylium',unlock:25,achievUnlock:100,iconRow:2,color:'#00deff',price: 500},81184:{name:'Chalcedhoney',unlock:50,achievUnlock:150,iconRow:13,color:'#ffcc2f',price: 50000},81195:{name:'Buttergold',unlock:100,achievUnlock:200,iconRow:14,color:'#e9d673',price: 5000000},81206:{name:'Sugarmuck',unlock:150,achievUnlock:250,iconRow:15,color:'#a8bf91',price: 500000000},81217:{name:'Jetmint',unlock:200,achievUnlock:300,iconRow:16,color:'#60ff50',price: 500000000000},81228:{name:'Cherrysilver',unlock:250,achievUnlock:350,iconRow:17,color:'#f01700',price: 500000000000000},81239:{name:'Hazelrald',unlock:300,achievUnlock:400,iconRow:18,color:'#9ab834',price: 500000000000000000},812410:{name:'Mooncandy',unlock:350,achievUnlock:450,iconRow:19,color:'#7e7ab9',price: 500000000000000000000},812511:{name:'Astrofudge',unlock:400,achievUnlock:500,iconRow:28,color:'#9a3316',price: 5000000000000000000000000},812612:{name:'Alabascream',unlock:450,achievUnlock:550,iconRow:30,color:'#c1a88c',price: 50000000000000000000000000000},812713:{name:'Iridyum',unlock:500,achievUnlock:600,iconRow:31,color:'#adb1b3',price: 500000000000000000000000000000000},8128'synergy1':{name:'Synergy I',unlock:15,iconRow:20,color:'#008595',special:1,req:'Synergies Vol. I',price: 200000},8129'synergy2':{name:'Synergy II',unlock:75,iconRow:29,color:'#008595',special:1,req:'Synergies Vol. II',price: 200000000000},8130'fortune':{name:'Fortune',unlock:-1,iconRow:32,color:'#9ab834',special:1,price: 77777777777777777777777777777},8131};8132for (var i in Game.Tiers){Game.Tiers[i].upgrades=[];}8133Game.GetIcon=function(type,tier)8134{8135var col=0;8136if (type=='Kitten') col=18; else col=Game.Objects[type].iconColumn;8137return [col,Game.Tiers[tier].iconRow];8138}8139Game.SetTier=function(building,tier)8140{8141if (!Game.Objects[building]) alert('No building named '+building);8142Game.last.tier=tier;8143Game.last.buildingTie=Game.Objects[building];8144if (Game.last.type=='achievement') Game.Objects[building].tieredAchievs[tier]=Game.last;8145else Game.Objects[building].tieredUpgrades[tier]=Game.last;8146}8147Game.MakeTiered=function(upgrade,tier,col)8148{8149upgrade.tier=tier;8150if (typeof col!=='undefined') upgrade.icon=[col,Game.Tiers[tier].iconRow];8151}8152Game.TieredUpgrade=function(name,desc,building,tier)8153{8154var upgrade=new Game.Upgrade(name,desc,Game.Objects[building].basePrice*Game.Tiers[tier].price,Game.GetIcon(building,tier));8155Game.SetTier(building,tier);8156if (!upgrade.buildingTie1 && building) upgrade.buildingTie1=Game.Objects[building];8157if (tier=='fortune' && building) Game.Objects[building].fortune=upgrade;8158return upgrade;8159}8160Game.SynergyUpgrade=function(name,desc,building1,building2,tier)8161{8162/*8163creates a new upgrade that :8164-unlocks when you have tier.unlock of building1 and building28165-is priced at (building1.price*10+building2.price*1)*tier.price (formerly : Math.sqrt(building1.price*building2.price)*tier.price)8166-gives +(0.1*building1)% cps to building2 and +(5*building2)% cps to building18167-if building2 is below building1 in worth, swap them8168*/8169//if (Game.Objects[building1].basePrice>Game.Objects[building2].basePrice) {var temp=building2;building2=building1;building1=temp;}8170var b1=Game.Objects[building1];8171var b2=Game.Objects[building2];8172if (b1.basePrice>b2.basePrice) {b1=Game.Objects[building2];b2=Game.Objects[building1];}//swap81738174desc=8175(b1.plural.charAt(0).toUpperCase()+b1.plural.slice(1))+' gain <b>+5% CpS</b> per '+b2.name.toLowerCase()+'.<br>'+8176(b2.plural.charAt(0).toUpperCase()+b2.plural.slice(1))+' gain <b>+0.1% CpS</b> per '+b1.name.toLowerCase()+'.'+8177desc;8178var upgrade=new Game.Upgrade(name,desc,(b1.basePrice*10+b2.basePrice*1)*Game.Tiers[tier].price,Game.GetIcon(building1,tier));//Math.sqrt(b1.basePrice*b2.basePrice)*Game.Tiers[tier].price8179upgrade.tier=tier;8180upgrade.buildingTie1=b1;8181upgrade.buildingTie2=b2;8182upgrade.priceFunc=function(){return (this.buildingTie1.basePrice*10+this.buildingTie2.basePrice*1)*Game.Tiers[this.tier].price*(Game.Has('Chimera')?0.98:1);};8183Game.Objects[building1].synergies.push(upgrade);8184Game.Objects[building2].synergies.push(upgrade);8185//Game.SetTier(building1,tier);8186return upgrade;8187}8188Game.GetTieredCpsMult=function(me)8189{8190var mult=1;8191for (var i in me.tieredUpgrades) {if (!Game.Tiers[me.tieredUpgrades[i].tier].special && Game.Has(me.tieredUpgrades[i].name)) mult*=2;}8192for (var i in me.synergies)8193{8194var syn=me.synergies[i];8195if (Game.Has(syn.name))8196{8197if (syn.buildingTie1.name==me.name) mult*=(1+0.05*syn.buildingTie2.amount);8198else if (syn.buildingTie2.name==me.name) mult*=(1+0.001*syn.buildingTie1.amount);8199}8200}8201if (me.fortune && Game.Has(me.fortune.name)) mult*=1.07;8202if (me.grandma && Game.Has(me.grandma.name)) mult*=(1+Game.Objects['Grandma'].amount*0.01*(1/(me.id-1)));8203return mult;8204}8205Game.UnlockTiered=function(me)8206{8207for (var i in me.tieredUpgrades) {if (Game.Tiers[me.tieredUpgrades[i].tier].unlock!=-1 && me.amount>=Game.Tiers[me.tieredUpgrades[i].tier].unlock) Game.Unlock(me.tieredUpgrades[i].name);}8208for (var i in me.tieredAchievs) {if (me.amount>=Game.Tiers[me.tieredAchievs[i].tier].achievUnlock) Game.Win(me.tieredAchievs[i].name);}8209for (var i in me.synergies) {var syn=me.synergies[i];if (Game.Has(Game.Tiers[syn.tier].req) && syn.buildingTie1.amount>=Game.Tiers[syn.tier].unlock && syn.buildingTie2.amount>=Game.Tiers[syn.tier].unlock) Game.Unlock(syn.name);}8210}8211821282138214var pool='';8215var power=0;82168217//define upgrades8218//WARNING : do NOT add new upgrades in between, this breaks the saves. Add them at the end !8219var order=100;//this is used to set the order in which the items are listed8220new Game.Upgrade('Reinforced index finger','The mouse and cursors are <b>twice</b> as efficient.<q>prod prod</q>',100,[0,0]);Game.MakeTiered(Game.last,1,0);8221new Game.Upgrade('Carpal tunnel prevention cream','The mouse and cursors are <b>twice</b> as efficient.<q>it... it hurts to click...</q>',500,[0,1]);Game.MakeTiered(Game.last,2,0);8222new Game.Upgrade('Ambidextrous','The mouse and cursors are <b>twice</b> as efficient.<q>Look ma, both hands!</q>',10000,[0,2]);Game.MakeTiered(Game.last,3,0);8223new Game.Upgrade('Thousand fingers','The mouse and cursors gain <b>+0.1</b> cookies for each non-cursor object owned.<q>clickity</q>',100000,[0,13]);Game.MakeTiered(Game.last,4,0);8224new Game.Upgrade('Million fingers','The mouse and cursors gain <b>+0.5</b> cookies for each non-cursor object owned.<q>clickityclickity</q>',10000000,[0,14]);Game.MakeTiered(Game.last,5,0);8225new Game.Upgrade('Billion fingers','The mouse and cursors gain <b>+5</b> cookies for each non-cursor object owned.<q>clickityclickityclickity</q>',100000000,[0,15]);Game.MakeTiered(Game.last,6,0);8226new Game.Upgrade('Trillion fingers','The mouse and cursors gain <b>+50</b> cookies for each non-cursor object owned.<q>clickityclickityclickityclickity</q>',1000000000,[0,16]);Game.MakeTiered(Game.last,7,0);82278228order=200;8229new Game.TieredUpgrade('Forwards from grandma','Grandmas are <b>twice</b> as efficient.<q>RE:RE:thought you\'d get a kick out of this ;))</q>','Grandma',1);8230new Game.TieredUpgrade('Steel-plated rolling pins','Grandmas are <b>twice</b> as efficient.<q>Just what you kneaded.</q>','Grandma',2);8231new Game.TieredUpgrade('Lubricated dentures','Grandmas are <b>twice</b> as efficient.<q>squish</q>','Grandma',3);82328233order=300;8234new Game.TieredUpgrade('Cheap hoes','Farms are <b>twice</b> as efficient.<q>Rake in the dough!</q>','Farm',1);8235new Game.TieredUpgrade('Fertilizer','Farms are <b>twice</b> as efficient.<q>It\'s chocolate, I swear.</q>','Farm',2);8236new Game.TieredUpgrade('Cookie trees','Farms are <b>twice</b> as efficient.<q>A relative of the breadfruit.</q>','Farm',3);82378238order=500;8239new Game.TieredUpgrade('Sturdier conveyor belts','Factories are <b>twice</b> as efficient.<q>You\'re going places.</q>','Factory',1);8240new Game.TieredUpgrade('Child labor','Factories are <b>twice</b> as efficient.<q>Cheaper, healthier workforce.</q>','Factory',2);8241new Game.TieredUpgrade('Sweatshop','Factories are <b>twice</b> as efficient.<q>Slackers will be terminated.</q>','Factory',3);82428243order=400;8244new Game.TieredUpgrade('Sugar gas','Mines are <b>twice</b> as efficient.<q>A pink, volatile gas, found in the depths of some chocolate caves.</q>','Mine',1);8245new Game.TieredUpgrade('Megadrill','Mines are <b>twice</b> as efficient.<q>You\'re in deep.</q>','Mine',2);8246new Game.TieredUpgrade('Ultradrill','Mines are <b>twice</b> as efficient.<q>Finally caved in?</q>','Mine',3);82478248order=600;8249new Game.TieredUpgrade('Vanilla nebulae','Shipments are <b>twice</b> as efficient.<q>If you removed your space helmet, you could probably smell it!<br>(Note : don\'t do that.)</q>','Shipment',1);8250new Game.TieredUpgrade('Wormholes','Shipments are <b>twice</b> as efficient.<q>By using these as shortcuts, your ships can travel much faster.</q>','Shipment',2);8251new Game.TieredUpgrade('Frequent flyer','Shipments are <b>twice</b> as efficient.<q>Come back soon!</q>','Shipment',3);82528253order=700;8254new Game.TieredUpgrade('Antimony','Alchemy labs are <b>twice</b> as efficient.<q>Actually worth a lot of mony.</q>','Alchemy lab',1);8255new Game.TieredUpgrade('Essence of dough','Alchemy labs are <b>twice</b> as efficient.<q>Extracted through the 5 ancient steps of alchemical baking.</q>','Alchemy lab',2);8256new Game.TieredUpgrade('True chocolate','Alchemy labs are <b>twice</b> as efficient.<q>The purest form of cacao.</q>','Alchemy lab',3);82578258order=800;8259new Game.TieredUpgrade('Ancient tablet','Portals are <b>twice</b> as efficient.<q>A strange slab of peanut brittle, holding an ancient cookie recipe. Neat!</q>','Portal',1);8260new Game.TieredUpgrade('Insane oatling workers','Portals are <b>twice</b> as efficient.<q>ARISE, MY MINIONS!</q>','Portal',2);8261new Game.TieredUpgrade('Soul bond','Portals are <b>twice</b> as efficient.<q>So I just sign up and get more cookies? Sure, whatever!</q>','Portal',3);82628263order=900;8264new Game.TieredUpgrade('Flux capacitors','Time machines are <b>twice</b> as efficient.<q>Bake to the future.</q>','Time machine',1);8265new Game.TieredUpgrade('Time paradox resolver','Time machines are <b>twice</b> as efficient.<q>No more fooling around with your own grandmother!</q>','Time machine',2);8266new Game.TieredUpgrade('Quantum conundrum','Time machines are <b>twice</b> as efficient.<q>There is only one constant, and that is universal uncertainty.<br>Or is it?</q>','Time machine',3);82678268order=20000;8269new Game.Upgrade('Kitten helpers','You gain <b>more CpS</b> the more milk you have.<q>meow may I help you</q>',9000000,Game.GetIcon('Kitten',1));Game.last.kitten=1;Game.MakeTiered(Game.last,1,18);8270new Game.Upgrade('Kitten workers','You gain <b>more CpS</b> the more milk you have.<q>meow meow meow meow</q>',9000000000,Game.GetIcon('Kitten',2));Game.last.kitten=1;Game.MakeTiered(Game.last,2,18);82718272order=10000;8273Game.NewUpgradeCookie({name:'Plain cookies',desc:'We all gotta start somewhere.',icon:[2,3],power: 1, price: 999999});8274Game.NewUpgradeCookie({name:'Sugar cookies',desc:'Tasty, if a little unimaginative.',icon:[7,3],power: 1, price: 999999*5});8275Game.NewUpgradeCookie({name:'Oatmeal raisin cookies',desc:'No raisin to hate these.',icon:[0,3],power: 1, price: 9999999});8276Game.NewUpgradeCookie({name:'Peanut butter cookies',desc:'Get yourself some jam cookies!',icon:[1,3],power: 1, price: 9999999*5});8277Game.NewUpgradeCookie({name:'Coconut cookies',desc:'Flaky, but not unreliable. Some people go crazy for these.',icon:[3,3],power: 2, price: 99999999});8278order=10001;8279Game.NewUpgradeCookie({name:'White chocolate cookies',desc:'I know what you\'ll say. It\'s just cocoa butter! It\'s not real chocolate!<br>Oh please.',icon:[4,3],power:2, price: 99999999*5});8280Game.NewUpgradeCookie({name:'Macadamia nut cookies',desc:'They\'re macadamn delicious!',icon:[5,3],power: 2, price: 999999999});8281Game.NewUpgradeCookie({name:'Double-chip cookies',desc:'DOUBLE THE CHIPS<br>DOUBLE THE TASTY<br>(double the calories)',icon:[6,3],power:2, price: 999999999*5});8282Game.NewUpgradeCookie({name:'White chocolate macadamia nut cookies',desc:'Orteil\'s favorite.',icon:[8,3],power: 2, price: 9999999999});8283Game.NewUpgradeCookie({name:'All-chocolate cookies',desc:'CHOCOVERDOSE.',icon:[9,3],power: 2, price: 9999999999*5});82848285order=100;8286new Game.Upgrade('Quadrillion fingers','The mouse and cursors gain <b>+500</b> cookies for each non-cursor object owned.<q>clickityclickityclickityclickityclick</q>',10000000000,[0,17]);Game.MakeTiered(Game.last,8,0);82878288order=200;new Game.TieredUpgrade('Prune juice','Grandmas are <b>twice</b> as efficient.<q>Gets me going.</q>','Grandma',4);8289order=300;new Game.TieredUpgrade('Genetically-modified cookies','Farms are <b>twice</b> as efficient.<q>All-natural mutations.</q>','Farm',4);8290order=500;new Game.TieredUpgrade('Radium reactors','Factories are <b>twice</b> as efficient.<q>Gives your cookies a healthy glow.</q>','Factory',4);8291order=400;new Game.TieredUpgrade('Ultimadrill','Mines are <b>twice</b> as efficient.<q>Pierce the heavens, etc.</q>','Mine',4);8292order=600;new Game.TieredUpgrade('Warp drive','Shipments are <b>twice</b> as efficient.<q>To boldly bake.</q>','Shipment',4);8293order=700;new Game.TieredUpgrade('Ambrosia','Alchemy labs are <b>twice</b> as efficient.<q>Adding this to the cookie mix is sure to make them even more addictive!<br>Perhaps dangerously so.<br>Let\'s hope you can keep selling these legally.</q>','Alchemy lab',4);8294order=800;new Game.TieredUpgrade('Sanity dance','Portals are <b>twice</b> as efficient.<q>We can change if we want to.<br>We can leave our brains behind.</q>','Portal',4);8295order=900;new Game.TieredUpgrade('Causality enforcer','Time machines are <b>twice</b> as efficient.<q>What happened, happened.</q>','Time machine',4);82968297order=5000;8298new Game.Upgrade('Lucky day','Golden cookies appear <b>twice as often</b> and stay <b>twice as long</b>.<q>Oh hey, a four-leaf penny!</q>',777777777,[27,6]);8299new Game.Upgrade('Serendipity','Golden cookies appear <b>twice as often</b> and stay <b>twice as long</b>.<q>What joy! Seven horseshoes!</q>',77777777777,[27,6]);83008301order=20000;8302new Game.Upgrade('Kitten engineers','You gain <b>more CpS</b> the more milk you have.<q>meow meow meow meow, sir</q>',90000000000000,Game.GetIcon('Kitten',3));Game.last.kitten=1;Game.MakeTiered(Game.last,3,18);83038304order=10020;8305Game.NewUpgradeCookie({name:'Dark chocolate-coated cookies',desc:'These absorb light so well you almost need to squint to see them.',icon:[10,3],power: 4, price: 99999999999});8306Game.NewUpgradeCookie({name:'White chocolate-coated cookies',desc:'These dazzling cookies absolutely glisten with flavor.',icon:[11,3],power: 4, price: 99999999999});83078308Game.GrandmaSynergies=[];8309Game.GrandmaSynergy=function(name,desc,building)8310{8311var building=Game.Objects[building];8312var grandmaNumber=(building.id-1);8313if (grandmaNumber==1) grandmaNumber='grandma';8314else grandmaNumber+=' grandmas';8315desc='Grandmas are <b>twice</b> as efficient. '+(building.plural.charAt(0).toUpperCase()+building.plural.slice(1))+' gain <b>+1% CpS</b> per '+grandmaNumber+'.<q>'+desc+'</q>';83168317var upgrade=new Game.Upgrade(name,desc,building.basePrice*Game.Tiers[2].price,[10,9],function(){Game.Objects['Grandma'].redraw();});8318building.grandma=upgrade;8319upgrade.buildingTie=building;8320Game.GrandmaSynergies.push(upgrade.name);8321return upgrade;8322}83238324order=250;8325Game.GrandmaSynergy('Farmer grandmas','A nice farmer to grow more cookies.','Farm');8326Game.GrandmaSynergy('Miner grandmas','A nice miner to dig more cookies.','Mine');8327Game.GrandmaSynergy('Worker grandmas','A nice worker to manufacture more cookies.','Factory');8328Game.GrandmaSynergy('Cosmic grandmas','A nice thing to... uh... cookies.','Shipment');8329Game.GrandmaSynergy('Transmuted grandmas','A nice golden grandma to convert into more cookies.','Alchemy lab');8330Game.GrandmaSynergy('Altered grandmas','a NiCe GrAnDmA tO bA##########','Portal');8331Game.GrandmaSynergy('Grandmas\' grandmas','A nice grandma\'s nice grandma to bake double the cookies.','Time machine');83328333order=14000;8334Game.baseResearchTime=Game.fps*60*30;8335Game.SetResearch=function(what,time)8336{8337if (Game.Upgrades[what] && !Game.Has(what))8338{8339Game.researchT=Game.baseResearchTime;8340if (Game.Has('Persistent memory')) Game.researchT=Math.ceil(Game.baseResearchTime/10);8341if (Game.Has('Ultrascience')) Game.researchT=Game.fps*5;8342Game.nextResearch=Game.Upgrades[what].id;8343if (Game.prefs.popups) Game.Popup('Research has begun.');8344else Game.Notify('Research has begun','Your bingo center/research facility is conducting experiments.',[9,0]);8345}8346}83478348new Game.Upgrade('Bingo center/Research facility','Grandma-operated science lab and leisure club.<br>Grandmas are <b>4 times</b> as efficient.<br><b>Regularly unlocks new upgrades</b>.<q>What could possibly keep those grandmothers in check?...<br>Bingo.</q>',1000000000000000,[11,9],function(){Game.SetResearch('Specialized chocolate chips');});Game.last.noPerm=1;83498350order=15000;8351new Game.Upgrade('Specialized chocolate chips','Cookie production multiplier <b>+1%</b>.<q>Computer-designed chocolate chips. Computer chips, if you will.</q>',1000000000000000,[0,9],function(){Game.SetResearch('Designer cocoa beans');});Game.last.pool='tech';8352new Game.Upgrade('Designer cocoa beans','Cookie production multiplier <b>+2%</b>.<q>Now more aerodynamic than ever!</q>',2000000000000000,[1,9],function(){Game.SetResearch('Ritual rolling pins');});Game.last.pool='tech';8353new Game.Upgrade('Ritual rolling pins','Grandmas are <b>twice</b> as efficient.<q>The result of years of scientific research!</q>',4000000000000000,[2,9],function(){Game.SetResearch('Underworld ovens');});Game.last.pool='tech';8354new Game.Upgrade('Underworld ovens','Cookie production multiplier <b>+3%</b>.<q>Powered by science, of course!</q>',8000000000000000,[3,9],function(){Game.SetResearch('One mind');});Game.last.pool='tech';8355new Game.Upgrade('One mind','Each grandma gains <b>+0.0<span></span>2 base CpS per grandma</b>.<div class="warning">Note : the grandmothers are growing restless. Do not encourage them.</div><q>We are one. We are many.</q>',16000000000000000,[4,9],function(){Game.elderWrath=1;Game.SetResearch('Exotic nuts');Game.storeToRefresh=1;});Game.last.pool='tech';8356//Game.last.clickFunction=function(){return confirm('Warning : purchasing this will have unexpected, and potentially undesirable results!\nIt\'s all downhill from here. You have been warned!\nPurchase anyway?');};8357Game.RequiresConfirmation(Game.last,'<div class="block"><b>Warning :</b> purchasing this will have unexpected, and potentially undesirable results!<br><small>It\'s all downhill from here. You have been warned!</small><br><br>Purchase anyway?</small></div>');8358new Game.Upgrade('Exotic nuts','Cookie production multiplier <b>+4%</b>.<q>You\'ll go crazy over these!</q>',32000000000000000,[5,9],function(){Game.SetResearch('Communal brainsweep');});Game.last.pool='tech';8359new Game.Upgrade('Communal brainsweep','Each grandma gains another <b>+0.0<span></span>2 base CpS per grandma</b>.<div class="warning">Note : proceeding any further in scientific research may have unexpected results. You have been warned.</div><q>We fuse. We merge. We grow.</q>',64000000000000000,[6,9],function(){Game.elderWrath=2;Game.SetResearch('Arcane sugar');Game.storeToRefresh=1;});Game.last.pool='tech';8360new Game.Upgrade('Arcane sugar','Cookie production multiplier <b>+5%</b>.<q>Tastes like insects, ligaments, and molasses.</q>',128000000000000000,[7,9],function(){Game.SetResearch('Elder Pact');});Game.last.pool='tech';8361new Game.Upgrade('Elder Pact','Each grandma gains <b>+0.0<span></span>5 base CpS per portal</b>.<div class="warning">Note : this is a bad idea.</div><q>squirm crawl slither writhe<br>today we rise</q>',256000000000000000,[8,9],function(){Game.elderWrath=3;Game.storeToRefresh=1;});Game.last.pool='tech';8362new Game.Upgrade('Elder Pledge','Contains the wrath of the elders, at least for a while.<q>This is a simple ritual involving anti-aging cream, cookie batter mixed in the moonlight, and a live chicken.</q>',1,[9,9],function()8363{8364Game.elderWrath=0;8365Game.pledges++;8366Game.pledgeT=Game.getPledgeDuration();8367Game.Unlock('Elder Covenant');8368Game.CollectWrinklers();8369Game.storeToRefresh=1;8370});8371Game.getPledgeDuration=function(){return Game.fps*60*(Game.Has('Sacrificial rolling pins')?60:30);}8372Game.last.pool='toggle';8373Game.last.displayFuncWhenOwned=function(){return '<div style="text-align:center;">Time remaining until pledge runs out :<br><b>'+Game.sayTime(Game.pledgeT,-1)+'</b></div>';}8374Game.last.timerDisplay=function(){if (!Game.Upgrades['Elder Pledge'].bought) return -1; else return 1-Game.pledgeT/Game.getPledgeDuration();}8375Game.last.priceFunc=function(){return Math.pow(8,Math.min(Game.pledges+2,14));}83768377Game.last.descFunc=function(){8378return '<div style="text-align:center;">'+(Game.pledges==0?'You haven\'t pledged to the elders yet.':('You\'ve pledged to the elders <b>'+(Game.pledges==1?'once':Game.pledges==2?'twice':(Game.pledges+' times'))+'</b>.'))+'<div class="line"></div></div>'+this.desc;8379};838083818382order=150;8383new Game.Upgrade('Plastic mouse','Clicking gains <b>+1% of your CpS</b>.<q>Slightly squeaky.</q>',50000,[11,0]);Game.MakeTiered(Game.last,1,11);8384new Game.Upgrade('Iron mouse','Clicking gains <b>+1% of your CpS</b>.<q>Click like it\'s 1349!</q>',5000000,[11,1]);Game.MakeTiered(Game.last,2,11);8385new Game.Upgrade('Titanium mouse','Clicking gains <b>+1% of your CpS</b>.<q>Heavy, but powerful.</q>',500000000,[11,2]);Game.MakeTiered(Game.last,3,11);8386new Game.Upgrade('Adamantium mouse','Clicking gains <b>+1% of your CpS</b>.<q>You could cut diamond with these.</q>',50000000000,[11,13]);Game.MakeTiered(Game.last,4,11);83878388order=40000;8389new Game.Upgrade('Ultrascience','Research takes only <b>5 seconds</b>.<q>YEAH, SCIENCE!</q>',7,[9,2]);//debug purposes only8390Game.last.pool='debug';83918392order=10020;8393Game.NewUpgradeCookie({name:'Eclipse cookies',desc:'Look to the cookie.',icon:[0,4],power: 2, price: 99999999999*5});8394Game.NewUpgradeCookie({name:'Zebra cookies',desc:'...',icon:[1,4],power: 2, price: 999999999999});83958396order=100;8397new Game.Upgrade('Quintillion fingers','The mouse and cursors gain <b>+5000</b> cookies for each non-cursor object owned.<q>man, just go click click click click click, it\'s real easy, man.</q>',10000000000000,[0,18]);Game.MakeTiered(Game.last,9,0);83988399order=40000;8400new Game.Upgrade('Gold hoard','Golden cookies appear <b>really often</b>.<q>That\'s entirely too many.</q>',7,[10,14]);//debug purposes only8401Game.last.pool='debug';84028403order=15000;8404new Game.Upgrade('Elder Covenant','Puts a permanent end to the elders\' wrath, at the price of 5% of your CpS.<q>This is a complicated ritual involving silly, inconsequential trivialities such as cursed laxatives, century-old cacao, and an infant.<br>Don\'t question it.</q>',66666666666666,[8,9],function()8405{8406Game.pledgeT=0;8407Game.Lock('Revoke Elder Covenant');8408Game.Unlock('Revoke Elder Covenant');8409Game.Lock('Elder Pledge');8410Game.Win('Elder calm');8411Game.CollectWrinklers();8412Game.storeToRefresh=1;8413});8414Game.last.pool='toggle';84158416new Game.Upgrade('Revoke Elder Covenant','You will get 5% of your CpS back, but the grandmatriarchs will return.<q>we<br>rise<br>again</q>',6666666666,[8,9],function()8417{8418Game.Lock('Elder Covenant');8419Game.Unlock('Elder Covenant');8420});8421Game.last.pool='toggle';84228423order=5000;8424new Game.Upgrade('Get lucky','Golden cookie effects last <b>twice as long</b>.<q>You\'ve been up all night, haven\'t you?</q>',77777777777777,[27,6]);84258426order=15000;8427new Game.Upgrade('Sacrificial rolling pins','Elder pledges last <b>twice</b> as long.<q>These are mostly just for spreading the anti-aging cream.<br>(And accessorily, shortening the chicken\'s suffering.)</q>',2888888888888,[2,9]);84288429order=10020;8430Game.NewUpgradeCookie({name:'Snickerdoodles',desc:'True to their name.',icon:[2,4],power: 2, price: 999999999999*5});8431Game.NewUpgradeCookie({name:'Stroopwafels',desc:'If it ain\'t dutch, it ain\'t much.',icon:[3,4],power: 2, price: 9999999999999});8432Game.NewUpgradeCookie({name:'Macaroons',desc:'Not to be confused with macarons.<br>These have coconut, okay?',icon:[4,4],power: 2, price: 9999999999999*5});84338434order=40000;8435new Game.Upgrade('Neuromancy','Can toggle upgrades on and off at will in the stats menu.<q>Can also come in handy to unsee things that can\'t be unseen.</q>',7,[4,9]);//debug purposes only8436Game.last.pool='debug';84378438order=10020;8439Game.NewUpgradeCookie({name:'Empire biscuits',desc:'For your growing cookie empire, of course!',icon:[5,4],power: 2, price: 99999999999999});8440order=10031;8441Game.NewUpgradeCookie({name:'British tea biscuits',desc:'Quite.',icon:[6,4],require:'Tin of british tea biscuits',power: 2, price: 99999999999999});8442Game.NewUpgradeCookie({name:'Chocolate british tea biscuits',desc:'Yes, quite.',icon:[7,4],require:Game.last.name,power: 2, price: 99999999999999});8443Game.NewUpgradeCookie({name:'Round british tea biscuits',desc:'Yes, quite riveting.',icon:[8,4],require:Game.last.name,power: 2, price: 99999999999999});8444Game.NewUpgradeCookie({name:'Round chocolate british tea biscuits',desc:'Yes, quite riveting indeed.',icon:[9,4],require:Game.last.name,power: 2, price: 99999999999999});8445Game.NewUpgradeCookie({name:'Round british tea biscuits with heart motif',desc:'Yes, quite riveting indeed, old chap.',icon:[10,4],require:Game.last.name,power: 2, price: 99999999999999});8446Game.NewUpgradeCookie({name:'Round chocolate british tea biscuits with heart motif',desc:'I like cookies.',icon:[11,4],require:Game.last.name,power: 2, price: 99999999999999});84478448order=1000;8449new Game.TieredUpgrade('Sugar bosons','Antimatter condensers are <b>twice</b> as efficient.<q>Sweet firm bosons.</q>','Antimatter condenser',1);8450new Game.TieredUpgrade('String theory','Antimatter condensers are <b>twice</b> as efficient.<q>Reveals new insight about the true meaning of baking cookies (and, as a bonus, the structure of the universe).</q>','Antimatter condenser',2);8451new Game.TieredUpgrade('Large macaron collider','Antimatter condensers are <b>twice</b> as efficient.<q>How singular!</q>','Antimatter condenser',3);8452new Game.TieredUpgrade('Big bang bake','Antimatter condensers are <b>twice</b> as efficient.<q>And that\'s how it all began.</q>','Antimatter condenser',4);84538454order=255;8455Game.GrandmaSynergy('Antigrandmas','A mean antigrandma to vomit more cookies.','Antimatter condenser');84568457order=10020;8458Game.NewUpgradeCookie({name:'Madeleines',desc:'Unforgettable!',icon:[12,3],power: 2, price: 99999999999999*5});8459Game.NewUpgradeCookie({name:'Palmiers',desc:'Palmier than you!',icon:[13,3],power: 2, price: 99999999999999*5});8460Game.NewUpgradeCookie({name:'Palets',desc:'You could probably play hockey with these.<br>I mean, you\'re welcome to try.',icon:[12,4],power: 2, price: 999999999999999});8461Game.NewUpgradeCookie({name:'Sablés',desc:'The name implies they\'re made of sand. But you know better, don\'t you?',icon:[13,4],power: 2, price: 999999999999999});84628463order=20000;8464new Game.Upgrade('Kitten overseers','You gain <b>more CpS</b> the more milk you have.<q>my purrpose is to serve you, sir</q>',90000000000000000,Game.GetIcon('Kitten',4));Game.last.kitten=1;Game.MakeTiered(Game.last,4,18);846584668467order=100;8468new Game.Upgrade('Sextillion fingers','The mouse and cursors gain <b>+50000</b> cookies for each non-cursor object owned.<q>sometimes<br>things just<br>click</q>',10000000000000000,[0,19]);Game.MakeTiered(Game.last,10,0);84698470order=200;new Game.TieredUpgrade('Double-thick glasses','Grandmas are <b>twice</b> as efficient.<q>Oh... so THAT\'s what I\'ve been baking.</q>','Grandma',5);8471order=300;new Game.TieredUpgrade('Gingerbread scarecrows','Farms are <b>twice</b> as efficient.<q>Staring at your crops with mischievous glee.</q>','Farm',5);8472order=500;new Game.TieredUpgrade('Recombobulators','Factories are <b>twice</b> as efficient.<q>A major part of cookie recombobulation.</q>','Factory',5);8473order=400;new Game.TieredUpgrade('H-bomb mining','Mines are <b>twice</b> as efficient.<q>Questionable efficiency, but spectacular nonetheless.</q>','Mine',5);8474order=600;new Game.TieredUpgrade('Chocolate monoliths','Shipments are <b>twice</b> as efficient.<q>My god. It\'s full of chocolate bars.</q>','Shipment',5);8475order=700;new Game.TieredUpgrade('Aqua crustulae','Alchemy labs are <b>twice</b> as efficient.<q>Careful with the dosing - one drop too much and you get muffins.<br>And nobody likes muffins.</q>','Alchemy lab',5);8476order=800;new Game.TieredUpgrade('Brane transplant','Portals are <b>twice</b> as efficient.<q>This refers to the practice of merging higher dimensional universes, or "branes", with our own, in order to facilitate transit (and harvesting of precious cookie dough).</q>','Portal',5);8477order=900;new Game.TieredUpgrade('Yestermorrow comparators','Time machines are <b>twice</b> as efficient.<q>Fortnights into milleniums.</q>','Time machine',5);8478order=1000;new Game.TieredUpgrade('Reverse cyclotrons','Antimatter condensers are <b>twice</b> as efficient.<q>These can uncollision particles and unspin atoms. For... uh... better flavor, and stuff.</q>','Antimatter condenser',5);84798480order=150;8481new Game.Upgrade('Unobtainium mouse','Clicking gains <b>+1% of your CpS</b>.<q>These nice mice should suffice.</q>',5000000000000,[11,14]);Game.MakeTiered(Game.last,5,11);84828483order=10020;8484Game.NewUpgradeCookie({name:'Caramoas',desc:'Yeah. That\'s got a nice ring to it.',icon:[14,4],require:'Box of brand biscuits',power: 3, price: 9999999999999999});8485Game.NewUpgradeCookie({name:'Sagalongs',desc:'Grandma\'s favorite?',icon:[15,3],require:'Box of brand biscuits',power: 3, price: 9999999999999999});8486Game.NewUpgradeCookie({name:'Shortfoils',desc:'Foiled again!',icon:[15,4],require:'Box of brand biscuits',power: 3, price: 9999999999999999});8487Game.NewUpgradeCookie({name:'Win mints',desc:'They\'re the luckiest cookies you\'ve ever tasted!',icon:[14,3],require:'Box of brand biscuits',power: 3, price: 9999999999999999});84888489order=40000;8490new Game.Upgrade('Perfect idling','You keep producing cookies even while the game is closed.<q>It\'s the most beautiful thing I\'ve ever seen.</q>',7,[10,0]);//debug purposes only8491Game.last.pool='debug';84928493order=10030;8494Game.NewUpgradeCookie({name:'Fig gluttons',desc:'Got it all figured out.',icon:[17,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});8495Game.NewUpgradeCookie({name:'Loreols',desc:'Because, uh... they\'re worth it?',icon:[16,3],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});8496Game.NewUpgradeCookie({name:'Jaffa cakes',desc:'If you want to bake a cookie from scratch, you must first build a factory.',icon:[17,3],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});8497Game.NewUpgradeCookie({name:'Grease\'s cups',desc:'Extra-greasy peanut butter.',icon:[16,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});84988499order=30000;8500new Game.Upgrade('Heavenly chip secret','Unlocks <b>5%</b> of the potential of your prestige level.<q>Grants the knowledge of heavenly chips, and how to use them to make baking more efficient.<br>It\'s a secret to everyone.</q>',11,[19,7]);Game.last.noPerm=1;8501new Game.Upgrade('Heavenly cookie stand','Unlocks <b>25%</b> of the potential of your prestige level.<q>Don\'t forget to visit the heavenly lemonade stand afterwards. When afterlife gives you lemons...</q>',1111,[18,7]);Game.last.noPerm=1;8502new Game.Upgrade('Heavenly bakery','Unlocks <b>50%</b> of the potential of your prestige level.<q>Also sells godly cakes and divine pastries. The pretzels aren\'t too bad either.</q>',111111,[17,7]);Game.last.noPerm=1;8503new Game.Upgrade('Heavenly confectionery','Unlocks <b>75%</b> of the potential of your prestige level.<q>They say angel bakers work there. They take angel lunch breaks and sometimes go on angel strikes.</q>',11111111,[16,7]);Game.last.noPerm=1;8504new Game.Upgrade('Heavenly key','Unlocks <b>100%</b> of the potential of your prestige level.<q>This is the key to the pearly (and tasty) gates of pastry heaven, granting you access to your entire stockpile of heavenly chips for baking purposes.<br>May you use them wisely.</q>',1111111111,[15,7]);Game.last.noPerm=1;85058506order=10100;8507Game.NewUpgradeCookie({name:'Skull cookies',desc:'Wanna know something spooky? You\'ve got one of these inside your head RIGHT NOW.',locked:1,icon:[12,8],power: 2, price: 444444444444});8508Game.NewUpgradeCookie({name:'Ghost cookies',desc:'They\'re something strange, but they look pretty good!',locked:1,icon:[13,8],power: 2, price: 444444444444});8509Game.NewUpgradeCookie({name:'Bat cookies',desc:'The cookies this town deserves.',locked:1,icon:[14,8],power: 2, price: 444444444444});8510Game.NewUpgradeCookie({name:'Slime cookies',desc:'The incredible melting cookies!',locked:1,icon:[15,8],power: 2, price: 444444444444});8511Game.NewUpgradeCookie({name:'Pumpkin cookies',desc:'Not even pumpkin-flavored. Tastes like glazing. Yeugh.',locked:1,icon:[16,8],power: 2, price: 444444444444});8512Game.NewUpgradeCookie({name:'Eyeball cookies',desc:'When you stare into the cookie, the cookie stares back at you.',locked:1,icon:[17,8],power: 2, price: 444444444444});8513Game.NewUpgradeCookie({name:'Spider cookies',desc:'You found the recipe on the web. They do whatever a cookie can.',locked:1,icon:[18,8],power: 2, price: 444444444444});85148515Game.halloweenDrops=['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'];85168517Game.GetHowManyHalloweenDrops=function()8518{8519var num=0;8520for (var i in Game.halloweenDrops) {if (Game.Has(Game.halloweenDrops[i])) num++;}8521return num;8522}8523/*for (var i in Game.halloweenDrops)8524{8525Game.Upgrades[Game.halloweenDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyHalloweenDrops()+'/'+Game.halloweenDrops.length+'</b> halloween cookies.</div><div class="line"></div>'+this.desc;};8526}*/85278528order=0;8529new Game.Upgrade('Persistent memory','Subsequent research will be <b>10 times</b> as fast.<q>It\'s all making sense!<br>Again!</q>',500,[9,2]);Game.last.pool='prestige';85308531order=40000;8532new Game.Upgrade('Wrinkler doormat','Wrinklers spawn much more frequently.<q>You\'re such a pushover.</q>',7,[19,8]);//debug purposes only8533Game.last.pool='debug';85348535order=10200;8536Game.NewUpgradeCookie({name:'Christmas tree biscuits',desc:'Whose pine is it anyway?',locked:1,icon:[12,10],power:2,price: 252525252525});8537Game.NewUpgradeCookie({name:'Snowflake biscuits',desc:'Mass-produced to be unique in every way.',locked:1,icon:[13,10],power:2,price: 252525252525});8538Game.NewUpgradeCookie({name:'Snowman biscuits',desc:'It\'s frosted. Doubly so.',locked:1,icon:[14,10],power:2,price: 252525252525});8539Game.NewUpgradeCookie({name:'Holly biscuits',desc:'You don\'t smooch under these ones. That would be the mistletoe (which, botanically, is a smellier variant of the mistlefinger).',locked:1,icon:[15,10],power:2,price: 252525252525});8540Game.NewUpgradeCookie({name:'Candy cane biscuits',desc:'It\'s two treats in one!<br>(Further inspection reveals the frosting does not actually taste like peppermint, but like mundane sugary frosting.)',locked:1,icon:[16,10],power:2,price: 252525252525});8541Game.NewUpgradeCookie({name:'Bell biscuits',desc:'What do these even have to do with christmas? Who cares, ring them in!',locked:1,icon:[17,10],power:2,price: 252525252525});8542Game.NewUpgradeCookie({name:'Present biscuits',desc:'The prequel to future biscuits. Watch out!',locked:1,icon:[18,10],power:2,price: 252525252525});85438544order=10020;8545Game.NewUpgradeCookie({name:'Gingerbread men',desc:'You like to bite the legs off first, right? How about tearing off the arms? You sick monster.',icon:[18,4],power: 2,price: 9999999999999999});8546Game.NewUpgradeCookie({name:'Gingerbread trees',desc:'Evergreens in pastry form. Yule be surprised what you can come up with.',icon:[18,3],power: 2,price: 9999999999999999});85478548order=25000;8549new Game.Upgrade('A festive hat','<b>Unlocks... something.</b><q>Not a creature was stirring, not even a mouse.</q>',25,[19,9],function()8550{8551var drop=choose(Game.santaDrops);8552Game.Unlock(drop);8553if (Game.prefs.popups) Game.Popup('In the festive hat, you find...<br>a festive test tube<br>and '+drop+'.');8554else Game.Notify('In the festive hat, you find...','a festive test tube<br>and <b>'+drop+'</b>.',Game.Upgrades[drop].icon);8555});85568557new Game.Upgrade('Increased merriness','Cookie production multiplier <b>+15%</b>.<br>Cost scales with Santa level.<q>It turns out that the key to increased merriness, strangely enough, happens to be a good campfire and some s\'mores.<br>You know what they say, after all; the s\'more, the merrier.</q>',2525,[17,9]);8558new Game.Upgrade('Improved jolliness','Cookie production multiplier <b>+15%</b>.<br>Cost scales with Santa level.<q>A nice wobbly belly goes a long way.<br>You jolly?</q>',2525,[17,9]);8559new Game.Upgrade('A lump of coal','Cookie production multiplier <b>+1%</b>.<br>Cost scales with Santa level.<q>Some of the world\'s worst stocking stuffing.<br>I guess you could try starting your own little industrial revolution, or something?...</q>',2525,[13,9]);8560new Game.Upgrade('An itchy sweater','Cookie production multiplier <b>+1%</b>.<br>Cost scales with Santa level.<q>You don\'t know what\'s worse : the embarrassingly quaint "elf on reindeer" motif, or the fact that wearing it makes you feel like you\'re wrapped in a dead sasquatch.</q>',2525,[14,9]);8561new Game.Upgrade('Reindeer baking grounds','Reindeer appear <b>twice as frequently</b>.<br>Cost scales with Santa level.<q>Male reindeer are from Mars; female reindeer are from venison.</q>',2525,[12,9]);8562new Game.Upgrade('Weighted sleighs','Reindeer are <b>twice as slow</b>.<br>Cost scales with Santa level.<q>Hope it was worth the weight.<br>(Something something forced into cervidude)</q>',2525,[12,9]);8563new Game.Upgrade('Ho ho ho-flavored frosting','Reindeer give <b>twice as much</b>.<br>Cost scales with Santa level.<q>It\'s time to up the antler.</q>',2525,[12,9]);8564new Game.Upgrade('Season savings','All buildings are <b>1% cheaper</b>.<br>Cost scales with Santa level.<q>By Santa\'s beard, what savings!<br>But who will save us?</q>',2525,[16,9],function(){Game.storeToRefresh=1;});8565new Game.Upgrade('Toy workshop','All upgrades are <b>5% cheaper</b>.<br>Cost scales with Santa level.<q>Watch yours-elf around elvesdroppers who might steal our production secrets.<br>Or elven worse!</q>',2525,[16,9],function(){Game.upgradesToRebuild=1;});8566new Game.Upgrade('Naughty list','Grandmas are <b>twice</b> as productive.<br>Cost scales with Santa level.<q>This list contains every unholy deed perpetuated by grandmakind.<br>He won\'t be checking this one twice.<br>Once. Once is enough.</q>',2525,[15,9]);8567new Game.Upgrade('Santa\'s bottomless bag','Random drops are <b>10% more common</b>.<br>Cost scales with Santa level.<q>This is one bottom you can\'t check out.</q>',2525,[19,9]);8568new Game.Upgrade('Santa\'s helpers','Clicking is <b>10% more powerful</b>.<br>Cost scales with Santa level.<q>Some choose to help hamburger; some choose to help you.<br>To each their own, I guess.</q>',2525,[19,9]);8569new Game.Upgrade('Santa\'s legacy','Cookie production multiplier <b>+3% per Santa\'s levels</b>.<br>Cost scales with Santa level.<q>In the north pole, you gotta get the elves first. Then when you get the elves, you start making the toys. Then when you get the toys... then you get the cookies.</q>',2525,[19,9]);8570new Game.Upgrade('Santa\'s milk and cookies','Milk is <b>5% more powerful</b>.<br>Cost scales with Santa level.<q>Part of Santa\'s dreadfully unbalanced diet.</q>',2525,[19,9]);85718572order=40000;8573new Game.Upgrade('Reindeer season','Reindeer spawn much more frequently.<q>Go, Cheater! Go, Hacker and Faker!</q>',7,[12,9]);//debug purposes only8574Game.last.pool='debug';85758576order=25000;8577new Game.Upgrade('Santa\'s dominion','Cookie production multiplier <b>+20%</b>.<br>All buildings are <b>1% cheaper</b>.<br>All upgrades are <b>2% cheaper</b>.<q>My name is Claus, king of kings;<br>Look on my toys, ye Mighty, and despair!</q>',2525252525252525,[19,10],function(){Game.storeToRefresh=1;});85788579order=10300;8580var heartPower=function(){8581var pow=2;8582if (Game.Has('Starlove')) pow=3;8583if (Game.hasGod)8584{8585var godLvl=Game.hasGod('seasons');8586if (godLvl==1) pow*=1.3;8587else if (godLvl==2) pow*=1.2;8588else if (godLvl==3) pow*=1.1;8589}8590return pow;8591};8592Game.NewUpgradeCookie({name:'Pure heart biscuits',desc:'Melty white chocolate<br>that says "I *like* like you".',season:'valentines',icon:[19,3], power:heartPower,price: 1000000});8593Game.NewUpgradeCookie({name:'Ardent heart biscuits',desc:'A red hot cherry biscuit that will nudge the target of your affection in interesting directions.',require:Game.last.name,season:'valentines',icon:[20,3], power:heartPower,price: 1000000000});8594Game.NewUpgradeCookie({name:'Sour heart biscuits',desc:'A bitter lime biscuit for the lonely and the heart-broken.',require:Game.last.name,season:'valentines',icon:[20,4], power:heartPower,price: 1000000000000});8595Game.NewUpgradeCookie({name:'Weeping heart biscuits',desc:'An ice-cold blueberry biscuit, symbol of a mending heart.',require:Game.last.name,season:'valentines',icon:[21,3], power:heartPower,price: 1000000000000000});8596Game.NewUpgradeCookie({name:'Golden heart biscuits',desc:'A beautiful biscuit to symbolize kindness, true love, and sincerity.',require:Game.last.name,season:'valentines',icon:[21,4], power:heartPower,price: 1000000000000000000});8597Game.NewUpgradeCookie({name:'Eternal heart biscuits',desc:'Silver icing for a very special someone you\'ve liked for a long, long time.',require:Game.last.name,season:'valentines',icon:[19,4], power:heartPower,price: 1000000000000000000000});85988599Game.heartDrops=['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits'];86008601Game.GetHowManyHeartDrops=function()8602{8603var num=0;8604for (var i in Game.heartDrops) {if (Game.Has(Game.heartDrops[i])) num++;}8605return num;8606}8607/*for (var i in Game.heartDrops)8608{8609Game.Upgrades[Game.heartDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyHeartDrops()+'/'+Game.heartDrops.length+'</b> heart biscuits.</div><div class="line"></div>'+this.desc;};8610}*/86118612order=1100;8613new Game.TieredUpgrade('Gem polish','Prisms are <b>twice</b> as efficient.<q>Get rid of the grime and let more light in.<br>Truly, truly outrageous.</q>','Prism',1);8614new Game.TieredUpgrade('9th color','Prisms are <b>twice</b> as efficient.<q>Delve into untouched optical depths where even the mantis shrimp hasn\'t set an eye!</q>','Prism',2);8615new Game.TieredUpgrade('Chocolate light','Prisms are <b>twice</b> as efficient.<q>Bask into its cocoalescence.<br>(Warning : may cause various interesting albeit deadly skin conditions.)</q>','Prism',3);8616new Game.TieredUpgrade('Grainbow','Prisms are <b>twice</b> as efficient.<q>Remember the different grains using the handy Roy G. Biv mnemonic : R is for rice, O is for oats... uh, B for barley?...</q>','Prism',4);8617new Game.TieredUpgrade('Pure cosmic light','Prisms are <b>twice</b> as efficient.<q>Your prisms now receive pristine, unadulterated photons from the other end of the universe.</q>','Prism',5);86188619order=255;8620Game.GrandmaSynergy('Rainbow grandmas','A luminous grandma to sparkle into cookies.','Prism');86218622order=24000;8623Game.seasonTriggerBasePrice=1000000000;//1111111111;8624new Game.Upgrade('Season switcher','Allows you to <b>trigger seasonal events</b> at will, for a price.<q>There will always be time.</q>',1111,[16,6],function(){for (var i in Game.seasons){Game.Unlock(Game.seasons[i].trigger);}});Game.last.pool='prestige';Game.last.parents=['Heralds'];8625new Game.Upgrade('Festive biscuit','Triggers <b>Christmas season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>\'Twas the night before Christmas- or was it?</q>',Game.seasonTriggerBasePrice,[12,10]);Game.last.season='christmas';Game.last.pool='toggle';8626new Game.Upgrade('Ghostly biscuit','Triggers <b>Halloween season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>spooky scary skeletons<br>will wake you with a boo</q>',Game.seasonTriggerBasePrice,[13,8]);Game.last.season='halloween';Game.last.pool='toggle';8627new Game.Upgrade('Lovesick biscuit','Triggers <b>Valentine\'s Day season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>Romance never goes out of fashion.</q>',Game.seasonTriggerBasePrice,[20,3]);Game.last.season='valentines';Game.last.pool='toggle';8628new Game.Upgrade('Fool\'s biscuit','Triggers <b>Business Day season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>Business. Serious business. This is absolutely all of your business.</q>',Game.seasonTriggerBasePrice,[17,6]);Game.last.season='fools';Game.last.pool='toggle';862986308631order=40000;8632new Game.Upgrade('Eternal seasons','Seasons now last forever.<q>Season to taste.</q>',7,[16,6],function(){for (var i in Game.seasons){Game.Unlock(Game.seasons[i].trigger);}});//debug purposes only8633Game.last.pool='debug';863486358636order=20000;8637new Game.Upgrade('Kitten managers','You gain <b>more CpS</b> the more milk you have.<q>that\'s not gonna paws any problem, sir</q>',900000000000000000000,Game.GetIcon('Kitten',5));Game.last.kitten=1;Game.MakeTiered(Game.last,5,18);86388639order=100;8640new Game.Upgrade('Septillion fingers','The mouse and cursors gain <b>+500000</b> cookies for each non-cursor object owned.<q>[cursory flavor text]</q>',10000000000000000000,[12,20]);Game.MakeTiered(Game.last,11,0);8641new Game.Upgrade('Octillion fingers','The mouse and cursors gain <b>+5000000</b> cookies for each non-cursor object owned.<q>Turns out you <b>can</b> quite put your finger on it.</q>',10000000000000000000000,[12,19]);Game.MakeTiered(Game.last,12,0);86428643order=150;new Game.Upgrade('Eludium mouse','Clicking gains <b>+1% of your CpS</b>.<q>I rodent do that if I were you.</q>',500000000000000,[11,15]);Game.MakeTiered(Game.last,6,11);8644new Game.Upgrade('Wishalloy mouse','Clicking gains <b>+1% of your CpS</b>.<q>Clicking is fine and dandy, but don\'t smash your mouse over it. Get your game on. Go play.</q>',50000000000000000,[11,16]);Game.MakeTiered(Game.last,7,11);8645order=200;new Game.TieredUpgrade('Aging agents','Grandmas are <b>twice</b> as efficient.<q>Counter-intuitively, grandmas have the uncanny ability to become more powerful the older they get.</q>','Grandma',6);8646order=300;new Game.TieredUpgrade('Pulsar sprinklers','Farms are <b>twice</b> as efficient.<q>There\'s no such thing as over-watering. The moistest is the bestest.</q>','Farm',6);8647order=500;new Game.TieredUpgrade('Deep-bake process','Factories are <b>twice</b> as efficient.<q>A patented process increasing cookie yield two-fold for the same amount of ingredients. Don\'t ask how, don\'t take pictures, and be sure to wear your protective suit.</q>','Factory',6);8648order=400;new Game.TieredUpgrade('Coreforge','Mines are <b>twice</b> as efficient.<q>You\'ve finally dug a tunnel down to the Earth\'s core. It\'s pretty warm down here.</q>','Mine',6);8649order=600;new Game.TieredUpgrade('Generation ship','Shipments are <b>twice</b> as efficient.<q>Built to last, this humongous spacecraft will surely deliver your cookies to the deep ends of space, one day.</q>','Shipment',6);8650order=700;new Game.TieredUpgrade('Origin crucible','Alchemy labs are <b>twice</b> as efficient.<q>Built from the rarest of earths and located at the very deepest of the largest mountain, this legendary crucible is said to retain properties from the big-bang itself.</q>','Alchemy lab',6);8651order=800;new Game.TieredUpgrade('Deity-sized portals','Portals are <b>twice</b> as efficient.<q>It\'s almost like, say, an elder god could fit through this thing now. Hypothetically.</q>','Portal',6);8652order=900;new Game.TieredUpgrade('Far future enactment','Time machines are <b>twice</b> as efficient.<q>The far future enactment authorizes you to delve deep into the future - where civilization has fallen and risen again, and cookies are plentiful.</q>','Time machine',6);8653order=1000;new Game.TieredUpgrade('Nanocosmics','Antimatter condensers are <b>twice</b> as efficient.<q>The theory of nanocosmics posits that each subatomic particle is in fact its own self-contained universe, holding unfathomable amounts of energy.<br>This somehow stacks with the nested universe theory, because physics.</q>','Antimatter condenser',6);8654order=1100;8655new Game.TieredUpgrade('Glow-in-the-dark','Prisms are <b>twice</b> as efficient.<q>Your prisms now glow in the dark, effectively doubling their output!</q>','Prism',6);86568657order=10032;8658Game.NewUpgradeCookie({name:'Rose macarons',desc:'Although an odd flavor, these pastries recently rose in popularity.',icon:[22,3],require:'Box of macarons', power:3,price: 9999});8659Game.NewUpgradeCookie({name:'Lemon macarons',desc:'Tastefully sour, delightful treats.',icon:[23,3],require:'Box of macarons', power:3,price: 9999999});8660Game.NewUpgradeCookie({name:'Chocolate macarons',desc:'They\'re like tiny sugary burgers!',icon:[24,3],require:'Box of macarons', power:3,price: 9999999999});8661Game.NewUpgradeCookie({name:'Pistachio macarons',desc:'Pistachio shells now removed after multiple complaints.',icon:[22,4],require:'Box of macarons', power:3,price: 9999999999999});8662Game.NewUpgradeCookie({name:'Hazelnut macarons',desc:'These go especially well with coffee.',icon:[23,4],require:'Box of macarons', power:3,price: 9999999999999999});8663Game.NewUpgradeCookie({name:'Violet macarons',desc:'It\'s like spraying perfume into your mouth!',icon:[24,4],require:'Box of macarons', power:3,price: 9999999999999999999});86648665order=40000;8666new Game.Upgrade('Magic shenanigans','Cookie production <b>multiplied by 1,000</b>.<q>It\'s magic. I ain\'t gotta explain sh<div style="display:inline-block;background:url(img/money.png);width:16px;height:16px;position:relative;top:4px;left:0px;margin:0px -2px;"></div>t.</q>',7,[17,5]);//debug purposes only8667Game.last.pool='debug';866886698670order=24000;8671new Game.Upgrade('Bunny biscuit','Triggers <b>Easter season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>All the world will be your enemy<br>and when they catch you,<br>they will kill you...<br>but first they must catch you.</q>',Game.seasonTriggerBasePrice,[0,12]);Game.last.season='easter';Game.last.pool='toggle';86728673var eggPrice=999999999999;8674var eggPrice2=99999999999999;8675new Game.Upgrade('Chicken egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>The egg. The egg came first. Get over it.</q>',eggPrice,[1,12]);8676new Game.Upgrade('Duck egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Then he waddled away.</q>',eggPrice,[2,12]);8677new Game.Upgrade('Turkey egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These hatch into strange, hand-shaped creatures.</q>',eggPrice,[3,12]);8678new Game.Upgrade('Quail egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These eggs are positively tiny. I mean look at them. How does this happen? Whose idea was that?</q>',eggPrice,[4,12]);8679new Game.Upgrade('Robin egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Holy azure-hued shelled embryos!</q>',eggPrice,[5,12]);8680new Game.Upgrade('Ostrich egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>One of the largest eggs in the world. More like ostrouch, am I right?<br>Guys?</q>',eggPrice,[6,12]);8681new Game.Upgrade('Cassowary egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>The cassowary is taller than you, possesses murderous claws and can easily outrun you.<br>You\'d do well to be casso-wary of them.</q>',eggPrice,[7,12]);8682new Game.Upgrade('Salmon roe','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Do the impossible, see the invisible.<br>Roe roe, fight the power?</q>',eggPrice,[8,12]);8683new Game.Upgrade('Frogspawn','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>I was going to make a pun about how these "toadally look like eyeballs", but froget it.</q>',eggPrice,[9,12]);8684new Game.Upgrade('Shark egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>HELLO IS THIS FOOD?<br>LET ME TELL YOU ABOUT FOOD.<br>WHY DO I KEEP EATING MY FRIENDS</q>',eggPrice,[10,12]);8685new Game.Upgrade('Turtle egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Turtles, right? Hatch from shells. Grow into shells. What\'s up with that?<br>Now for my skit about airplane food.</q>',eggPrice,[11,12]);8686new Game.Upgrade('Ant larva','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These are a delicacy in some countries, I swear. You will let these invade your digestive tract, and you will derive great pleasure from it.<br>And all will be well.</q>',eggPrice,[12,12]);8687new Game.Upgrade('Golden goose egg','Golden cookies appear <b>5% more often</b>.<br>Cost scales with how many eggs you own.<q>The sole vestige of a tragic tale involving misguided investments.</q>',eggPrice2,[13,12]);8688new Game.Upgrade('Faberge egg','All buildings and upgrades are <b>1% cheaper</b>.<br>Cost scales with how many eggs you own.<q>This outrageous egg is definitely fab.</q>',eggPrice2,[14,12],function(){Game.storeToRefresh=1;});8689new Game.Upgrade('Wrinklerspawn','Wrinklers explode into <b>5% more cookies</b>.<br>Cost scales with how many eggs you own.<q>Look at this little guy! It\'s gonna be a big boy someday! Yes it is!</q>',eggPrice2,[15,12]);8690new Game.Upgrade('Cookie egg','Clicking is <b>10% more powerful</b>.<br>Cost scales with how many eggs you own.<q>The shell appears to be chipped.<br>I wonder what\'s inside this one!</q>',eggPrice2,[16,12]);8691new Game.Upgrade('Omelette','Other eggs appear <b>10% more frequently</b>.<br>Cost scales with how many eggs you own.<q>Fromage not included.</q>',eggPrice2,[17,12]);8692new Game.Upgrade('Chocolate egg','Contains <b>a lot of cookies</b>.<br>Cost scales with how many eggs you own.<q>Laid by the elusive cocoa bird. There\'s a surprise inside!</q>',eggPrice2,[18,12],function()8693{8694var cookies=Game.cookies*0.05;8695if (Game.prefs.popups) Game.Popup('The chocolate egg bursts into<br>'+Beautify(cookies)+'!');8696else Game.Notify('Chocolate egg','The egg bursts into <b>'+Beautify(cookies)+'</b> cookies!',Game.Upgrades['Chocolate egg'].icon);8697Game.Earn(cookies);8698});8699new Game.Upgrade('Century egg','You continually gain <b>more CpS the longer you\'ve played</b> in the current ascension.<br>Cost scales with how many eggs you own.<q>Actually not centuries-old. This one isn\'t a day over 86!</q>',eggPrice2,[19,12]);8700Game.last.descFunc=function(){8701var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;8702day=Math.min(day,100);8703var n=(1-Math.pow(1-day/100,3))*0.1;8704return '<div style="text-align:center;">Current boost : <b>+'+Beautify(n*100,1)+'%</b></div><div class="line"></div>'+this.desc;8705};8706new Game.Upgrade('"egg"','<b>+9 CpS</b><q>hey it\'s "egg"</q>',eggPrice2,[20,12]);87078708Game.easterEggs=['Chicken egg','Duck egg','Turkey egg','Quail egg','Robin egg','Ostrich egg','Cassowary egg','Salmon roe','Frogspawn','Shark egg','Turtle egg','Ant larva','Golden goose egg','Faberge egg','Wrinklerspawn','Cookie egg','Omelette','Chocolate egg','Century egg','"egg"'];8709Game.eggDrops=['Chicken egg','Duck egg','Turkey egg','Quail egg','Robin egg','Ostrich egg','Cassowary egg','Salmon roe','Frogspawn','Shark egg','Turtle egg','Ant larva'];8710Game.rareEggDrops=['Golden goose egg','Faberge egg','Wrinklerspawn','Cookie egg','Omelette','Chocolate egg','Century egg','"egg"'];87118712Game.GetHowManyEggs=function()8713{8714var num=0;8715for (var i in Game.easterEggs) {if (Game.Has(Game.easterEggs[i])) num++;}8716return num;8717}8718for (var i in Game.eggDrops)//scale egg prices to how many eggs you have8719{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(2,Game.GetHowManyEggs())*999;}}8720//{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,2)*Game.cookiesPs*60*5;}}8721for (var i in Game.rareEggDrops)8722{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(3,Game.GetHowManyEggs())*999;}}8723//{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,3)*Game.cookiesPs*60*5;}}87248725/*for (var i in Game.easterEggs)8726{8727Game.Upgrades[Game.easterEggs[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyEggs()+'/'+Game.easterEggs.length+'</b> eggs.</div><div class="line"></div>'+this.desc;};8728}*/87298730Game.DropEgg=function(failRate)8731{8732failRate*=1/Game.dropRateMult();8733if (Game.season!='easter') return;8734if (Game.HasAchiev('Hide & seek champion')) failRate*=0.7;8735if (Game.Has('Omelette')) failRate*=0.9;8736if (Game.Has('Starspawn')) failRate*=0.9;8737if (Game.hasGod)8738{8739var godLvl=Game.hasGod('seasons');8740if (godLvl==1) failRate*=0.9;8741else if (godLvl==2) failRate*=0.95;8742else if (godLvl==3) failRate*=0.97;8743}8744if (Math.random()>=failRate)8745{8746var drop='';8747if (Math.random()<0.1) drop=choose(Game.rareEggDrops);8748else drop=choose(Game.eggDrops);8749if (Game.Has(drop) || Game.HasUnlocked(drop))//reroll if we have it8750{8751if (Math.random()<0.1) drop=choose(Game.rareEggDrops);8752else drop=choose(Game.eggDrops);8753}8754if (Game.Has(drop) || Game.HasUnlocked(drop)) return;8755Game.Unlock(drop);8756if (Game.prefs.popups) Game.Popup('You find :<br>'+drop+'!');8757else Game.Notify('You found an egg!','<b>'+drop+'</b>',Game.Upgrades[drop].icon);8758}8759};87608761order=10032;8762Game.NewUpgradeCookie({name:'Caramel macarons',desc:'The saltiest, chewiest of them all.',icon:[25,3],require:'Box of macarons', power:3,price: 9999999999999999999999});8763Game.NewUpgradeCookie({name:'Licorice macarons',desc:'Also known as "blackarons".',icon:[25,4],require:'Box of macarons', power:3,price: 9999999999999999999999999});876487658766order=525;8767new Game.TieredUpgrade('Taller tellers','Banks are <b>twice</b> as efficient.<q>Able to process a higher amount of transactions. Careful though, as taller tellers tell tall tales.</q>','Bank',1);8768new Game.TieredUpgrade('Scissor-resistant credit cards','Banks are <b>twice</b> as efficient.<q>For those truly valued customers.</q>','Bank',2);8769new Game.TieredUpgrade('Acid-proof vaults','Banks are <b>twice</b> as efficient.<q>You know what they say : better safe than sorry.</q>','Bank',3);8770new Game.TieredUpgrade('Chocolate coins','Banks are <b>twice</b> as efficient.<q>This revolutionary currency is much easier to melt from and into ingots - and tastes much better, for a change.</q>','Bank',4);8771new Game.TieredUpgrade('Exponential interest rates','Banks are <b>twice</b> as efficient.<q>Can\'t argue with mathematics! Now fork it over.</q>','Bank',5);8772new Game.TieredUpgrade('Financial zen','Banks are <b>twice</b> as efficient.<q>The ultimate grail of economic thought; the feng shui of big money, the stock market yoga - the Heimlich maneuver of dimes and nickels.</q>','Bank',6);87738774order=550;8775new Game.TieredUpgrade('Golden idols','Temples are <b>twice</b> as efficient.<q>Lure even greedier adventurers to retrieve your cookies. Now that\'s a real idol game!</q>','Temple',1);8776new Game.TieredUpgrade('Sacrifices','Temples are <b>twice</b> as efficient.<q>What\'s a life to a gigaton of cookies?</q>','Temple',2);8777new Game.TieredUpgrade('Delicious blessing','Temples are <b>twice</b> as efficient.<q>And lo, the Baker\'s almighty spoon came down and distributed holy gifts unto the believers - shimmering sugar, and chocolate dark as night, and all manner of wheats. And boy let me tell you, that party was mighty gnarly.</q>','Temple',3);8778new Game.TieredUpgrade('Sun festival','Temples are <b>twice</b> as efficient.<q>Free the primordial powers of your temples with these annual celebrations involving fire-breathers, traditional dancing, ritual beheadings and other merriments!</q>','Temple',4);8779new Game.TieredUpgrade('Enlarged pantheon','Temples are <b>twice</b> as efficient.<q>Enough spiritual inadequacy! More divinities than you\'ll ever need, or your money back! 100% guaranteed!</q>','Temple',5);8780new Game.TieredUpgrade('Great Baker in the sky','Temples are <b>twice</b> as efficient.<q>This is it. The ultimate deity has finally cast Their sublimely divine eye upon your operation; whether this is a good thing or possibly the end of days is something you should find out very soon.</q>','Temple',6);87818782order=575;8783new Game.TieredUpgrade('Pointier hats','Wizard towers are <b>twice</b> as efficient.<q>Tests have shown increased thaumic receptivity relative to the geometric proportions of wizardly conic implements.</q>','Wizard tower',1);8784new Game.TieredUpgrade('Beardlier beards','Wizard towers are <b>twice</b> as efficient.<q>Haven\'t you heard? The beard is the word.</q>','Wizard tower',2);8785new Game.TieredUpgrade('Ancient grimoires','Wizard towers are <b>twice</b> as efficient.<q>Contain interesting spells such as "Turn Water To Drool", "Grow Eyebrows On Furniture" and "Summon Politician".</q>','Wizard tower',3);8786new Game.TieredUpgrade('Kitchen curses','Wizard towers are <b>twice</b> as efficient.<q>Exotic magic involved in all things pastry-related. Hexcellent!</q>','Wizard tower',4);8787new Game.TieredUpgrade('School of sorcery','Wizard towers are <b>twice</b> as efficient.<q>This cookie-funded academy of witchcraft is home to the 4 prestigious houses of magic : the Jocks, the Nerds, the Preps, and the Deathmunchers.</q>','Wizard tower',5);8788new Game.TieredUpgrade('Dark formulas','Wizard towers are <b>twice</b> as efficient.<q>Eldritch forces are at work behind these spells - you get the feeling you really shouldn\'t be messing with those. But I mean, free cookies, right?</q>','Wizard tower',6);87898790order=250;8791Game.GrandmaSynergy('Banker grandmas','A nice banker to cash in more cookies.','Bank');8792Game.GrandmaSynergy('Priestess grandmas','A nice priestess to praise the one true Baker in the sky.','Temple');8793Game.GrandmaSynergy('Witch grandmas','A nice witch to cast a zip, and a zoop, and poof! Cookies.','Wizard tower');8794879587968797order=0;8798new Game.Upgrade('Tin of british tea biscuits','Contains an assortment of fancy biscuits.<q>Every time is tea time.</q>',25,[21,8]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];8799new Game.Upgrade('Box of macarons','Contains an assortment of macarons.<q>Multicolored delicacies filled with various kinds of jam.<br>Not to be confused with macaroons, macaroni, macarena or any of that nonsense.</q>',25,[20,8]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];8800new Game.Upgrade('Box of brand biscuits','Contains an assortment of popular biscuits.<q>They\'re brand new!</q>',25,[20,9]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];88018802order=10020;8803Game.NewUpgradeCookie({name:'Pure black chocolate cookies',desc:'Dipped in a lab-made substance darker than the darkest cocoa (dubbed "chocoalate").',icon:[26,3],power: 4,price: 9999999999999999*5});8804Game.NewUpgradeCookie({name:'Pure white chocolate cookies',desc:'Elaborated on the nano-scale, the coating on this biscuit is able to refract light even in a pitch-black environment.',icon:[26,4],power: 4,price: 9999999999999999*5});8805Game.NewUpgradeCookie({name:'Ladyfingers',desc:'Cleaned and sanitized so well you\'d swear they\'re actual biscuits.',icon:[27,3],power: 3,price: 99999999999999999});8806Game.NewUpgradeCookie({name:'Tuiles',desc:'These never go out of tile.',icon:[27,4],power: 3,price: 99999999999999999*5});8807Game.NewUpgradeCookie({name:'Chocolate-stuffed biscuits',desc:'A princely snack!<br>The holes are so the chocolate stuffing can breathe.',icon:[28,3],power: 3,price: 999999999999999999});8808Game.NewUpgradeCookie({name:'Checker cookies',desc:'A square cookie? This solves so many storage and packaging problems! You\'re a genius!',icon:[28,4],power: 3,price: 999999999999999999*5});8809Game.NewUpgradeCookie({name:'Butter cookies',desc:'These melt right off your mouth and into your heart. (Let\'s face it, they\'re rather fattening.)',icon:[29,3],power: 3,price: 9999999999999999999});8810Game.NewUpgradeCookie({name:'Cream cookies',desc:'It\'s like two chocolate chip cookies! But brought together with the magic of cream! It\'s fiendishly perfect!',icon:[29,4],power: 3,price: 9999999999999999999*5});88118812order=0;8813var desc='Placing an upgrade in this slot will make its effects <b>permanent</b> across all playthroughs.<br><b>Click to activate.</b>';8814new Game.Upgrade('Permanent upgrade slot I',desc, 100,[0,10]);Game.last.pool='prestige';Game.last.iconFunction=function(){return Game.PermanentSlotIcon(0);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(0);};8815new Game.Upgrade('Permanent upgrade slot II',desc, 2000,[1,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot I'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(1);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(1);};8816new Game.Upgrade('Permanent upgrade slot III',desc, 30000,[2,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot II'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(2);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(2);};8817new Game.Upgrade('Permanent upgrade slot IV',desc, 400000,[3,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot III'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(3);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(3);};8818new Game.Upgrade('Permanent upgrade slot V',desc, 5000000,[4,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot IV'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(4);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(4);};88198820var slots=['Permanent upgrade slot I','Permanent upgrade slot II','Permanent upgrade slot III','Permanent upgrade slot IV','Permanent upgrade slot V'];8821for (var i=0;i<slots.length;i++)8822{8823Game.Upgrades[slots[i]].descFunc=function(i){return function(){8824if (Game.permanentUpgrades[i]==-1) return this.desc;8825var upgrade=Game.UpgradesById[Game.permanentUpgrades[i]];8826return '<div style="text-align:center;">'+'Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(upgrade.icon[2]?'background-image:url('+upgrade.icon[2]+');':'')+'background-position:'+(-upgrade.icon[0]*48)+'px '+(-upgrade.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+upgrade.name+'</b><div class="line"></div></div>'+this.desc;8827};}(i);8828}88298830Game.PermanentSlotIcon=function(slot)8831{8832if (Game.permanentUpgrades[slot]==-1) return [slot,10];8833return Game.UpgradesById[Game.permanentUpgrades[slot]].icon;8834}8835Game.AssignPermanentSlot=function(slot)8836{8837PlaySound('snd/tick.mp3');8838Game.tooltip.hide();8839var list=[];8840for (var i in Game.Upgrades)8841{8842var me=Game.Upgrades[i];8843if (me.bought && me.unlocked && !me.noPerm && (me.pool=='' || me.pool=='cookie'))8844{8845var fail=0;8846for (var ii in Game.permanentUpgrades) {if (Game.permanentUpgrades[ii]==me.id) fail=1;}//check if not already in another permaslot8847if (!fail) list.push(me);8848}8849}88508851var sortMap=function(a,b)8852{8853if (a.order>b.order) return 1;8854else if (a.order<b.order) return -1;8855else return 0;8856}8857list.sort(sortMap);88588859var upgrades='';8860for (var i in list)8861{8862var me=list[i];8863upgrades+=Game.crate(me,'','PlaySound(\'snd/tick.mp3\');Game.PutUpgradeInPermanentSlot('+me.id+','+slot+');','upgradeForPermanent'+me.id);8864}8865var upgrade=Game.permanentUpgrades[slot];8866Game.SelectingPermanentUpgrade=upgrade;8867Game.Prompt('<h3>Pick an upgrade to make permanent</h3>'+88688869'<div class="line"></div><div style="margin:4px auto;clear:both;width:120px;"><div class="crate upgrade enabled" style="background-position:'+(-slot*48)+'px '+(-10*48)+'px;"></div><div id="upgradeToSlotNone" class="crate upgrade enabled" style="background-position:'+(-0*48)+'px '+(-7*48)+'px;display:'+(upgrade!=-1?'none':'block')+';"></div><div id="upgradeToSlotWrap" style="float:left;display:'+(upgrade==-1?'none':'block')+';">'+(Game.crate(Game.UpgradesById[upgrade==-1?0:upgrade],'','','upgradeToSlot'))+'</div></div>'+8870'<div class="block crateBox" style="overflow-y:scroll;float:left;clear:left;width:317px;padding:0px;height:250px;">'+upgrades+'</div>'+8871'<div class="block" style="float:right;width:152px;clear:right;height:234px;">Here are all the upgrades you\'ve purchased last playthrough.<div class="line"></div>Pick one to permanently gain its effects!<div class="line"></div>You can reassign this slot anytime you ascend.</div>'8872,[['Confirm','Game.permanentUpgrades['+slot+']=Game.SelectingPermanentUpgrade;Game.BuildAscendTree();Game.ClosePrompt();'],'Cancel'],0,'widePrompt');8873}8874Game.SelectingPermanentUpgrade=-1;8875Game.PutUpgradeInPermanentSlot=function(upgrade,slot)8876{8877Game.SelectingPermanentUpgrade=upgrade;8878l('upgradeToSlotWrap').innerHTML='';8879l('upgradeToSlotWrap').style.display=(upgrade==-1?'none':'block');8880l('upgradeToSlotNone').style.display=(upgrade!=-1?'none':'block');8881l('upgradeToSlotWrap').innerHTML=(Game.crate(Game.UpgradesById[upgrade==-1?0:upgrade],'','','upgradeToSlot'));8882}88838884new Game.Upgrade('Starspawn','Eggs drop <b>10%</b> more often.<br>Golden cookies appear <b>2%</b> more often during Easter.',111111,[0,12]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];8885new Game.Upgrade('Starsnow','Christmas cookies drop <b>5%</b> more often.<br>Reindeer appear <b>5%</b> more often.',111111,[12,9]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];8886new Game.Upgrade('Starterror','Spooky cookies drop <b>10%</b> more often.<br>Golden cookies appear <b>2%</b> more often during Halloween.',111111,[13,8]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];8887new Game.Upgrade('Starlove','Heart cookies are <b>50%</b> more powerful.<br>Golden cookies appear <b>2%</b> more often during Valentines.',111111,[20,3]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];8888new Game.Upgrade('Startrade','Golden cookies appear <b>5%</b> more often during Business day.',111111,[17,6]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];88898890var angelPriceFactor=7;8891var desc=function(percent,total){return 'You gain another <b>+'+percent+'%</b> of your regular CpS while the game is closed, for a total of <b>'+total+'%</b>.';}8892new Game.Upgrade('Angels',desc(10,15)+'<q>Lowest-ranking at the first sphere of pastry heaven, angels are tasked with delivering new recipes to the mortals they deem worthy.</q>',Math.pow(angelPriceFactor,1),[0,11]);Game.last.pool='prestige';Game.last.parents=['Twin Gates of Transcendence'];8893new Game.Upgrade('Archangels',desc(10,25)+'<q>Members of the first sphere of pastry heaven, archangels are responsible for the smooth functioning of the world\'s largest bakeries.</q>',Math.pow(angelPriceFactor,2),[1,11]);Game.last.pool='prestige';Game.last.parents=['Angels'];8894new Game.Upgrade('Virtues',desc(10,35)+'<q>Found at the second sphere of pastry heaven, virtues make use of their heavenly strength to push and drag the stars of the cosmos.</q>',Math.pow(angelPriceFactor,3),[2,11]);Game.last.pool='prestige';Game.last.parents=['Archangels'];8895new Game.Upgrade('Dominions',desc(10,45)+'<q>Ruling over the second sphere of pastry heaven, dominions hold a managerial position and are in charge of accounting and regulating schedules.</q>',Math.pow(angelPriceFactor,4),[3,11]);Game.last.pool='prestige';Game.last.parents=['Virtues'];8896new Game.Upgrade('Cherubim',desc(10,55)+'<q>Sieging at the first sphere of pastry heaven, the four-faced cherubim serve as heavenly bouncers and bodyguards.</q>',Math.pow(angelPriceFactor,5),[4,11]);Game.last.pool='prestige';Game.last.parents=['Dominions'];8897new Game.Upgrade('Seraphim',desc(10,65)+'<q>Leading the first sphere of pastry heaven, seraphim possess ultimate knowledge of everything pertaining to baking.</q>',Math.pow(angelPriceFactor,6),[5,11]);Game.last.pool='prestige';Game.last.parents=['Cherubim'];8898new Game.Upgrade('God',desc(10,75)+'<q>Like Santa, but less fun.</q>',Math.pow(angelPriceFactor,7),[6,11]);Game.last.pool='prestige';Game.last.parents=['Seraphim'];88998900new Game.Upgrade('Twin Gates of Transcendence','You now <b>keep making cookies while the game is closed</b>, at the rate of <b>5%</b> of your regular CpS and up to <b>1 hour</b> after the game is closed.<br>(Beyond 1 hour, this is reduced by a further 90% - your rate goes down to <b>0.5%</b> of your CpS.)<q>This is one occasion you\'re always underdressed for. Don\'t worry, just rush in past the bouncer and pretend you know people.</q>',1,[15,11]);Game.last.pool='prestige';89018902new Game.Upgrade('Heavenly luck','Golden cookies appear <b>5%</b> more often.<q>Someone up there likes you.</q>',77,[22,6]);Game.last.pool='prestige';8903new Game.Upgrade('Lasting fortune','Golden cookies effects last <b>10%</b> longer.<q>This isn\'t your average everyday luck. This is... advanced luck.</q>',777,[23,6]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];8904new Game.Upgrade('Decisive fate','Golden cookies stay <b>5%</b> longer.<q>Life just got a bit more intense.</q>',7777,[10,14]);Game.last.pool='prestige';Game.last.parents=['Lasting fortune'];89058906new Game.Upgrade('Divine discount','Buildings are <b>1% cheaper</b>.<q>Someone special deserves a special price.</q>',99999,[21,7]);Game.last.pool='prestige';Game.last.parents=['Decisive fate'];8907new Game.Upgrade('Divine sales','Upgrades are <b>1% cheaper</b>.<q>Everything must go!</q>',99999,[18,7]);Game.last.pool='prestige';Game.last.parents=['Decisive fate'];8908new Game.Upgrade('Divine bakeries','Cookie upgrades are <b>5 times cheaper</b>.<q>They sure know what they\'re doing.</q>',399999,[17,7]);Game.last.pool='prestige';Game.last.parents=['Divine sales','Divine discount'];89098910new Game.Upgrade('Starter kit','You start with <b>10 cursors</b>.<q>This can come in handy.</q>',50,[0,14]);Game.last.pool='prestige';Game.last.parents=['Tin of british tea biscuits','Box of macarons','Box of brand biscuits','Tin of butter cookies'];8911new Game.Upgrade('Starter kitchen','You start with <b>5 grandmas</b>.<q>Where did these come from?</q>',5000,[1,14]);Game.last.pool='prestige';Game.last.parents=['Starter kit'];8912new Game.Upgrade('Halo gloves','Clicks are <b>10% more powerful</b>.<q>Smite that cookie.</q>',55555,[22,7]);Game.last.pool='prestige';Game.last.parents=['Starter kit'];89138914new Game.Upgrade('Kitten angels','You gain <b>more CpS</b> the more milk you have.<q>All cats go to heaven.</q>',9000,[23,7]);Game.last.pool='prestige';Game.last.parents=['Dominions'];Game.last.kitten=1;89158916new Game.Upgrade('Unholy bait','Wrinklers appear <b>5 times</b> as fast.<q>No wrinkler can resist the scent of worm biscuits.</q>',44444,[15,12]);Game.last.pool='prestige';Game.last.parents=['Starter kitchen'];8917new Game.Upgrade('Sacrilegious corruption','Wrinklers regurgitate <b>5%</b> more cookies.<q>Unique in the animal kingdom, the wrinkler digestive tract is able to withstand an incredible degree of dilation - provided you prod them appropriately.</q>',444444,[19,8]);Game.last.pool='prestige';Game.last.parents=['Unholy bait'];891889198920order=200;new Game.TieredUpgrade('Xtreme walkers','Grandmas are <b>twice</b> as efficient.<q>Complete with flame decals and a little horn that goes "toot".</q>','Grandma',7);8921order=300;new Game.TieredUpgrade('Fudge fungus','Farms are <b>twice</b> as efficient.<q>A sugary parasite whose tendrils help cookie growth.<br>Please do not breathe in the spores. In case of spore ingestion, seek medical help within the next 36 seconds.</q>','Farm',7);8922order=400;new Game.TieredUpgrade('Planetsplitters','Mines are <b>twice</b> as efficient.<q>These new state-of-the-art excavators have been tested on Merula, Globort and Flwanza VI, among other distant planets which have been curiously quiet lately.</q>','Mine',7);8923order=500;new Game.TieredUpgrade('Cyborg workforce','Factories are <b>twice</b> as efficient.<q>Semi-synthetic organisms don\'t slack off, don\'t unionize, and have 20% shorter lunch breaks, making them ideal labor fodder.</q>','Factory',7);8924order=525;new Game.TieredUpgrade('Way of the wallet','Banks are <b>twice</b> as efficient.<q>This new monetary school of thought is all the rage on the banking scene; follow its precepts and you may just profit from it.</q>','Bank',7);8925order=550;new Game.TieredUpgrade('Creation myth','Temples are <b>twice</b> as efficient.<q>Stories have been circulating about the origins of the very first cookie that was ever baked; tales of how it all began, in the Dough beyond time and the Ovens of destiny.</q>','Temple',7);8926order=575;new Game.TieredUpgrade('Cookiemancy','Wizard towers are <b>twice</b> as efficient.<q>There it is; the perfected school of baking magic. From summoning chips to hexing nuts, there is not a single part of cookie-making that hasn\'t been improved tenfold by magic tricks.</q>','Wizard tower',7);8927order=600;new Game.TieredUpgrade('Dyson sphere','Shipments are <b>twice</b> as efficient.<q>You\'ve found a way to apply your knowledge of cosmic technology to slightly more local endeavors; this gigantic sphere of meta-materials, wrapping the solar system, is sure to kick your baking abilities up a notch.</q>','Shipment',7);8928order=700;new Game.TieredUpgrade('Theory of atomic fluidity','Alchemy labs are <b>twice</b> as efficient.<q>Pushing alchemy to its most extreme limits, you find that everything is transmutable into anything else - lead to gold, mercury to water; more importantly, you realize that anything can -and should- be converted to cookies.</q>','Alchemy lab',7);8929order=800;new Game.TieredUpgrade('End of times back-up plan','Portals are <b>twice</b> as efficient.<q>Just in case, alright?</q>','Portal',7);8930order=900;new Game.TieredUpgrade('Great loop hypothesis','Time machines are <b>twice</b> as efficient.<q>What if our universe is just one instance of an infinite cycle? What if, before and after it, stretched infinite amounts of the same universe, themselves containing infinite amounts of cookies?</q>','Time machine',7);8931order=1000;new Game.TieredUpgrade('The Pulse','Antimatter condensers are <b>twice</b> as efficient.<q>You\'ve tapped into the very pulse of the cosmos, a timeless rhythm along which every material and antimaterial thing beats in unison. This, somehow, means more cookies.</q>','Antimatter condenser',7);8932order=1100;8933new Game.TieredUpgrade('Lux sanctorum','Prisms are <b>twice</b> as efficient.<q>Your prism attendants have become increasingly mesmerized with something in the light - or maybe something beyond it; beyond us all, perhaps?</q>','Prism',7);893489358936order=200;new Game.TieredUpgrade('The Unbridling','Grandmas are <b>twice</b> as efficient.<q>It might be a classic tale of bad parenting, but let\'s see where grandma is going with this.</q>','Grandma',8);8937order=300;new Game.TieredUpgrade('Wheat triffids','Farms are <b>twice</b> as efficient.<q>Taking care of crops is so much easier when your plants can just walk about and help around the farm.<br>Do not pet. Do not feed. Do not attempt to converse with.</q>','Farm',8);8938order=400;new Game.TieredUpgrade('Canola oil wells','Mines are <b>twice</b> as efficient.<q>A previously untapped resource, canola oil permeates the underground olifers which grant it its particular taste and lucrative properties.</q>','Mine',8);8939order=500;new Game.TieredUpgrade('78-hour days','Factories are <b>twice</b> as efficient.<q>Why didn\'t we think of this earlier?</q>','Factory',8);8940order=525;new Game.TieredUpgrade('The stuff rationale','Banks are <b>twice</b> as efficient.<q>If not now, when? If not it, what? If not things... stuff?</q>','Bank',8);8941order=550;new Game.TieredUpgrade('Theocracy','Temples are <b>twice</b> as efficient.<q>You\'ve turned your cookie empire into a perfect theocracy, gathering the adoration of zillions of followers from every corner of the universe.<br>Don\'t let it go to your head.</q>','Temple',8);8942order=575;new Game.TieredUpgrade('Rabbit trick','Wizard towers are <b>twice</b> as efficient.<q>Using nothing more than a fancy top hat, your wizards have found a way to simultaneously curb rabbit population and produce heaps of extra cookies for basically free!<br>Resulting cookies may or may not be fit for vegans.</q>','Wizard tower',8);8943order=600;new Game.TieredUpgrade('The final frontier','Shipments are <b>twice</b> as efficient.<q>It\'s been a long road, getting from there to here. It\'s all worth it though - the sights are lovely and the oil prices slightly more reasonable.</q>','Shipment',8);8944order=700;new Game.TieredUpgrade('Beige goo','Alchemy labs are <b>twice</b> as efficient.<q>Well now you\'ve done it. Good job. Very nice. That\'s 3 galaxies you\'ve just converted into cookies. Good thing you can hop from universe to universe.</q>','Alchemy lab',8);8945order=800;new Game.TieredUpgrade('Maddening chants','Portals are <b>twice</b> as efficient.<q>A popular verse goes like so : "jau\'hn madden jau\'hn madden aeiouaeiouaeiou brbrbrbrbrbrbr"</q>','Portal',8);8946order=900;new Game.TieredUpgrade('Cookietopian moments of maybe','Time machines are <b>twice</b> as efficient.<q>Reminiscing how things could have been, should have been, will have been.</q>','Time machine',8);8947order=1000;new Game.TieredUpgrade('Some other super-tiny fundamental particle? Probably?','Antimatter condensers are <b>twice</b> as efficient.<q>When even the universe is running out of ideas, that\'s when you know you\'re nearing the end.</q>','Antimatter condenser',8);8948order=1100;8949new Game.TieredUpgrade('Reverse shadows','Prisms are <b>twice</b> as efficient.<q>Oh man, this is really messing with your eyes.</q>','Prism',8);895089518952order=20000;8953new Game.Upgrade('Kitten accountants','You gain <b>more CpS</b> the more milk you have.<q>business going great, sir</q>',900000000000000000000000,Game.GetIcon('Kitten',6));Game.last.kitten=1;Game.MakeTiered(Game.last,6,18);8954new Game.Upgrade('Kitten specialists','You gain <b>more CpS</b> the more milk you have.<q>optimeowzing your workflow like whoah, sir</q>',900000000000000000000000000,Game.GetIcon('Kitten',7));Game.last.kitten=1;Game.MakeTiered(Game.last,7,18);8955new Game.Upgrade('Kitten experts','You gain <b>more CpS</b> the more milk you have.<q>10 years expurrrtise in the cookie business, sir</q>',900000000000000000000000000000,Game.GetIcon('Kitten',8));Game.last.kitten=1;Game.MakeTiered(Game.last,8,18);89568957new Game.Upgrade('How to bake your dragon','Allows you to purchase a <b>crumbly egg</b> once you have earned 1 million cookies.<q>A tome full of helpful tips such as "oh god, stay away from it", "why did we buy this thing, it\'s not even house-broken" and "groom twice a week in the direction of the scales".</q>',9,[22,12]);Game.last.pool='prestige';89588959order=25100;8960new Game.Upgrade('A crumbly egg','Unlocks the <b>cookie dragon egg</b>.<q>Thank you for adopting this robust, fun-loving cookie dragon! It will bring you years of joy and entertainment.<br>Keep in a dry and cool place, and away from other house pets. Subscription to home insurance is strongly advised.</q>',25,[21,12]);89618962new Game.Upgrade('Chimera','Synergy upgrades are <b>2% cheaper</b>.<br>You gain another <b>+5%</b> of your regular CpS while the game is closed.<br>You retain optimal cookie production while the game is closed for <b>2 more days</b>.<q>More than the sum of its parts.</q>',Math.pow(angelPriceFactor,9),[24,7]);Game.last.pool='prestige';Game.last.parents=['God','Lucifer','Synergies Vol. II'];89638964new Game.Upgrade('Tin of butter cookies','Contains an assortment of rich butter cookies.<q>Five varieties of danish cookies.<br>Complete with little paper cups.</q>',25,[21,9]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];89658966new Game.Upgrade('Golden switch','Unlocks the <b>golden switch</b>, which passively boosts your CpS by 50% but disables golden cookies.<q>Less clicking, more idling.</q>',999,[21,10]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];89678968new Game.Upgrade('Classic dairy selection','Unlocks the <b>milk selector</b>, letting you pick which milk is displayed under your cookie.<br>Comes with a variety of basic flavors.<q>Don\'t have a cow, man.</q>',9,[1,8]);Game.last.pool='prestige';Game.last.parents=[];89698970new Game.Upgrade('Fanciful dairy selection','Contains more exotic flavors for your milk selector.<q>Strong bones for the skeleton army.</q>',1000000,[9,7]);Game.last.pool='prestige';Game.last.parents=['Classic dairy selection'];89718972order=10300;8973Game.NewUpgradeCookie({name:'Dragon cookie',desc:'Imbued with the vigor and vitality of a full-grown cookie dragon, this mystical cookie will embolden your empire for the generations to come.',icon:[10,25],power:5,price:9999999999999999*7,locked:1});897489758976order=40000;8977new Game.Upgrade('Golden switch [off]','Turning this on will give you a passive <b>+50% CpS</b>, but prevents golden cookies from spawning.<br>Cost is equal to 1 hour of production.',1000000,[20,10]);8978Game.last.pool='toggle';Game.last.toggleInto='Golden switch [on]';8979Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}8980var func=function(){8981if (Game.Has('Residual luck'))8982{8983var bonus=0;8984var upgrades=Game.goldenCookieUpgrades;8985for (var i in upgrades) {if (Game.Has(upgrades[i])) bonus++;}8986return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.goldenCookieUpgrades)+'<br><br>The effective boost is <b>+'+Beautify(Math.round(50+bonus*10))+'%</b><br>thanks to residual luck<br>and your <b>'+bonus+'</b> golden cookie upgrade'+(bonus==1?'':'s')+'.</div><div class="line"></div>'+this.desc;8987}8988return this.desc;8989};8990Game.last.descFunc=func;89918992new Game.Upgrade('Golden switch [on]','The switch is currently giving you a passive <b>+50% CpS</b>; it also prevents golden cookies from spawning.<br>Turning it off will revert those effects.<br>Cost is equal to 1 hour of production.',1000000,[21,10]);8993Game.last.pool='toggle';Game.last.toggleInto='Golden switch [off]';8994Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}8995Game.last.descFunc=func;89968997order=50000;8998new Game.Upgrade('Milk selector','Lets you pick what flavor of milk to display.',0,[1,8]);8999Game.last.descFunc=function(){9000var choice=this.choicesFunction()[Game.milkType];9001return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+choice.icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;9002};90039004Game.last.pool='toggle';9005Game.last.choicesFunction=function()9006{9007var choices=[];9008choices[0]={name:'Automatic',icon:[0,7]};9009choices[1]={name:'Plain milk',icon:[1,8]};9010choices[2]={name:'Chocolate milk',icon:[2,8]};9011choices[3]={name:'Raspberry milk',icon:[3,8]};9012choices[4]={name:'Orange milk',icon:[4,8]};9013choices[5]={name:'Caramel milk',icon:[5,8]};9014choices[6]={name:'Banana milk',icon:[6,8]};9015choices[7]={name:'Lime milk',icon:[7,8]};9016choices[8]={name:'Blueberry milk',icon:[8,8]};9017choices[9]={name:'Strawberry milk',icon:[9,8]};9018choices[10]={name:'Vanilla milk',icon:[10,8]};90199020if (Game.Has('Fanciful dairy selection'))9021{9022choices[11]={name:'Zebra milk',icon:[10,7]};9023choices[12]={name:'Cosmic milk',icon:[9,7]};9024choices[13]={name:'Flaming milk',icon:[8,7]};9025choices[14]={name:'Sanguine milk',icon:[7,7]};9026choices[15]={name:'Midas milk',icon:[6,7]};9027choices[16]={name:'Midnight milk',icon:[5,7]};9028choices[17]={name:'Green inferno milk',icon:[4,7]};9029choices[18]={name:'Frostfire milk',icon:[3,7]};90309031choices[24]={name:'Soy milk',icon:[27,23]};9032}90339034choices[19]={name:'Honey milk',icon:[21,23]};9035choices[20]={name:'Coffee milk',icon:[22,23]};9036choices[21]={name:'Tea milk',icon:[23,23]};9037choices[22]={name:'Coconut milk',icon:[24,23]};9038choices[23]={name:'Cherry milk',icon:[25,23]};90399040choices[25]={name:'Spiced milk',icon:[26,23]};9041choices[26]={name:'Maple milk',icon:[28,23]};9042choices[27]={name:'Mint milk',icon:[29,23]};90439044choices[Game.milkType].selected=1;9045return choices;9046}9047Game.last.choicesPick=function(id)9048{Game.milkType=id;}90499050Game.MilksByChoice={90510:{pic:'milkPlain'},90521:{pic:'milkPlain'},90532:{pic:'milkChocolate'},90543:{pic:'milkRaspberry'},90554:{pic:'milkOrange'},90565:{pic:'milkCaramel'},90576:{pic:'milkBanana'},90587:{pic:'milkLime'},90598:{pic:'milkBlueberry'},90609:{pic:'milkStrawberry'},906110:{pic:'milkVanilla'},906211:{pic:'milkZebra'},906312:{pic:'milkStars'},906413:{pic:'milkFire'},906514:{pic:'milkBlood'},906615:{pic:'milkGold'},906716:{pic:'milkBlack'},906817:{pic:'milkGreenFire'},906918:{pic:'milkBlueFire'},907019:{pic:'milkHoney'},907120:{pic:'milkCoffee'},907221:{pic:'milkTea'},907322:{pic:'milkCoconut'},907423:{pic:'milkCherry'},907524:{pic:'milkSoy'},907625:{pic:'milkSpiced'},907726:{pic:'milkMaple'},907827:{pic:'milkMint'},9079};908090819082order=10300;9083Game.NewUpgradeCookie({name:'Milk chocolate butter biscuit',desc:'Rewarded for owning 100 of everything.<br>It bears the engraving of a fine entrepreneur.',icon:[27,8],power: 10,price: 999999999999999999999,locked:1});9084Game.NewUpgradeCookie({name:'Dark chocolate butter biscuit',desc:'Rewarded for owning 150 of everything.<br>It is adorned with the image of an experienced cookie tycoon.',icon:[27,9],power: 10,price: 999999999999999999999999,locked:1});9085Game.NewUpgradeCookie({name:'White chocolate butter biscuit',desc:'Rewarded for owning 200 of everything.<br>The chocolate is chiseled to depict a masterful pastry magnate.',icon:[28,9],power: 10,price: 999999999999999999999999999,locked:1});9086Game.NewUpgradeCookie({name:'Ruby chocolate butter biscuit',desc:'Rewarded for owning 250 of everything.<br>Covered in a rare red chocolate, this biscuit is etched to represent the face of a cookie industrialist gone mad with power.',icon:[28,8],power: 10,price: 999999999999999999999999999999,locked:1});90879088order=10020;9089Game.NewUpgradeCookie({name:'Gingersnaps',desc:'Cookies with a soul. Probably.',icon:[29,10],power: 4,price: 99999999999999999999});9090Game.NewUpgradeCookie({name:'Cinnamon cookies',desc:'The secret is in the patented swirly glazing.',icon:[23,8],power: 4,price: 99999999999999999999*5});9091Game.NewUpgradeCookie({name:'Vanity cookies',desc:'One tiny candied fruit sits atop this decadent cookie.',icon:[22,8],power: 4,price: 999999999999999999999});9092Game.NewUpgradeCookie({name:'Cigars',desc:'Close, but no match for those extravagant cookie straws they serve in coffee shops these days.',icon:[25,8],power: 4,price: 999999999999999999999*5});9093Game.NewUpgradeCookie({name:'Pinwheel cookies',desc:'Bringing you the dizzying combination of brown flavor and beige taste!',icon:[22,10],power: 4,price: 9999999999999999999999});9094Game.NewUpgradeCookie({name:'Fudge squares',desc:'Not exactly cookies, but you won\'t care once you\'ve tasted one of these.<br>They\'re so good, it\'s fudged-up!',icon:[24,8],power: 4,price: 9999999999999999999999*5});90959096order=10030;9097Game.NewUpgradeCookie({name:'Digits',desc:'Three flavors, zero phalanges.',icon:[26,8],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});90989099order=10029;9100Game.NewUpgradeCookie({name:'Butter horseshoes',desc:'It would behoove you to not overindulge in these.',icon:[22,9],require:'Tin of butter cookies',power: 4, price: 99999999999999999999999});9101Game.NewUpgradeCookie({name:'Butter pucks',desc:'Lord, what fools these mortals be!<br>(This is kind of a hokey reference.)',icon:[23,9],require:'Tin of butter cookies',power: 4, price: 99999999999999999999999*5});9102Game.NewUpgradeCookie({name:'Butter knots',desc:'Look, you can call these pretzels if you want, but you\'d just be fooling yourself, wouldn\'t you?',icon:[24,9],require:'Tin of butter cookies',power: 4, price: 999999999999999999999999});9103Game.NewUpgradeCookie({name:'Butter slabs',desc:'Nothing butter than a slab to the face.',icon:[25,9],require:'Tin of butter cookies',power: 4, price: 999999999999999999999999*5});9104Game.NewUpgradeCookie({name:'Butter swirls',desc:'These are equal parts sugar, butter, and warm fuzzy feelings - all of which cause millions of deaths everyday.',icon:[26,9],require:'Tin of butter cookies',power: 4, price: 9999999999999999999999999});91059106order=10020;9107Game.NewUpgradeCookie({name:'Shortbread biscuits',desc:'These rich butter cookies are neither short, nor bread. What a country!',icon:[23,10],power: 4,price: 99999999999999999999999});9108Game.NewUpgradeCookie({name:'Millionaires\' shortbreads',desc:'Three thought-provoking layers of creamy chocolate, hard-working caramel and crumbly biscuit in a poignant commentary of class struggle.',icon:[24,10],power: 4,price: 99999999999999999999999*5});9109Game.NewUpgradeCookie({name:'Caramel cookies',desc:'The polymerized carbohydrates adorning these cookies are sure to stick to your teeth for quite a while.',icon:[25,10],power: 4,price: 999999999999999999999999});911091119112var desc=function(totalHours){9113var hours=totalHours%24;9114var days=Math.floor(totalHours/24);9115var str=hours+(hours==1?' hour':' hours');9116if (days>0) str=days+(days==1?' day':' days')+' and '+str;9117return 'You retain optimal cookie production while the game is closed for twice as long, for a total of <b>'+str+'</b>.';9118}9119new Game.Upgrade('Belphegor',desc(2)+'<q>A demon of shortcuts and laziness, Belphegor commands machines to do work in his stead.</q>',Math.pow(angelPriceFactor,1),[7,11]);Game.last.pool='prestige';Game.last.parents=['Twin Gates of Transcendence'];9120new Game.Upgrade('Mammon',desc(4)+'<q>The demonic embodiment of wealth, Mammon requests a tithe of blood and gold from all his worshippers.</q>',Math.pow(angelPriceFactor,2),[8,11]);Game.last.pool='prestige';Game.last.parents=['Belphegor'];9121new Game.Upgrade('Abaddon',desc(8)+'<q>Master of overindulgence, Abaddon governs the wrinkler brood and inspires their insatiability.</q>',Math.pow(angelPriceFactor,3),[9,11]);Game.last.pool='prestige';Game.last.parents=['Mammon'];9122new Game.Upgrade('Satan',desc(16)+'<q>The counterpoint to everything righteous, this demon represents the nefarious influence of deceit and temptation.</q>',Math.pow(angelPriceFactor,4),[10,11]);Game.last.pool='prestige';Game.last.parents=['Abaddon'];9123new Game.Upgrade('Asmodeus',desc(32)+'<q>This demon with three monstrous heads draws his power from the all-consuming desire for cookies and all things sweet.</q>',Math.pow(angelPriceFactor,5),[11,11]);Game.last.pool='prestige';Game.last.parents=['Satan'];9124new Game.Upgrade('Beelzebub',desc(64)+'<q>The festering incarnation of blight and disease, Beelzebub rules over the vast armies of pastry inferno.</q>',Math.pow(angelPriceFactor,6),[12,11]);Game.last.pool='prestige';Game.last.parents=['Asmodeus'];9125new Game.Upgrade('Lucifer',desc(128)+'<q>Also known as the Lightbringer, this infernal prince\'s tremendous ego caused him to be cast down from pastry heaven.</q>',Math.pow(angelPriceFactor,7),[13,11]);Game.last.pool='prestige';Game.last.parents=['Beelzebub'];91269127new Game.Upgrade('Golden cookie alert sound','Unlocks the <b>golden cookie sound selector</b>, which lets you pick whether golden cookies emit a sound when appearing or not.<q>A sound decision.</q>',9999,[28,6]);Game.last.pool='prestige';Game.last.parents=['Decisive fate','Golden switch'];91289129order=49900;9130new Game.Upgrade('Golden cookie sound selector','Lets you change the sound golden cookies make when they spawn.',0,[28,6]);9131Game.last.descFunc=function(){9132var choice=this.choicesFunction()[Game.chimeType];9133return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;9134};91359136Game.last.pool='toggle';9137Game.last.choicesFunction=function()9138{9139var choices=[];9140choices[0]={name:'No sound',icon:[0,7]};9141choices[1]={name:'Chime',icon:[22,6]};91429143choices[Game.chimeType].selected=1;9144return choices;9145}9146Game.last.choicesPick=function(id)9147{Game.chimeType=id;}914891499150new Game.Upgrade('Basic wallpaper assortment','Unlocks the <b>background selector</b>, letting you select the game\'s background.<br>Comes with a variety of basic flavors.<q>Prioritizing aesthetics over crucial utilitarian upgrades? Color me impressed.</q>',99,[29,5]);Game.last.pool='prestige';Game.last.parents=['Classic dairy selection'];91519152new Game.Upgrade('Legacy','This is the first heavenly upgrade; it unlocks the <b>Heavenly chips</b> system.<div class="line"></div>Each time you ascend, the cookies you made in your past life are turned into <b>heavenly chips</b> and <b>prestige</b>.<div class="line"></div><b>Heavenly chips</b> can be spent on a variety of permanent transcendental upgrades.<div class="line"></div>Your <b>prestige level</b> also gives you a permanent <b>+1% CpS</b> per level.<q>We\'ve all been waiting for you.</q>',1,[21,6]);Game.last.pool='prestige';Game.last.parents=[];91539154new Game.Upgrade('Elder spice','You can attract <b>2 more wrinklers</b>.<q>The cookie your cookie could smell like.</q>',444444,[19,8]);Game.last.pool='prestige';Game.last.parents=['Unholy bait'];91559156new Game.Upgrade('Residual luck','While the golden switch is on, you gain an additional <b>+10% CpS</b> per golden cookie upgrade owned.<q>Fortune comes in many flavors.</q>',99999,[27,6]);Game.last.pool='prestige';Game.last.parents=['Golden switch'];91579158order=150;new Game.Upgrade('Fantasteel mouse','Clicking gains <b>+1% of your CpS</b>.<q>You could be clicking using your touchpad and we\'d be none the wiser.</q>',5000000000000000000,[11,17]);Game.MakeTiered(Game.last,8,11);9159new Game.Upgrade('Nevercrack mouse','Clicking gains <b>+1% of your CpS</b>.<q>How much beefier can you make a mouse until it\'s considered a rat?</q>',500000000000000000000,[11,18]);Game.MakeTiered(Game.last,9,11);916091619162new Game.Upgrade('Five-finger discount','All upgrades are <b>1% cheaper per 100 cursors</b>.<q>Stick it to the man.</q>',555555,[28,7],function(){Game.upgradesToRebuild=1;});Game.last.pool='prestige';Game.last.parents=['Halo gloves','Abaddon'];916391649165order=5000;9166Game.SynergyUpgrade('Future almanacs','<q>Lets you predict optimal planting times. It\'s crazy what time travel can do!</q>','Farm','Time machine','synergy1');9167Game.SynergyUpgrade('Rain prayer','<q>A deeply spiritual ceremonial involving complicated dance moves and high-tech cloud-busting lasers.</q>','Farm','Temple','synergy2');91689169Game.SynergyUpgrade('Seismic magic','<q>Surprise earthquakes are an old favorite of wizardly frat houses.</q>','Mine','Wizard tower','synergy1');9170Game.SynergyUpgrade('Asteroid mining','<q>As per the <span>19</span>74 United Cosmic Convention, comets, moons, and inhabited planetoids are no longer legally excavatable.<br>But hey, a space bribe goes a long way.</q>','Mine','Shipment','synergy2');91719172Game.SynergyUpgrade('Quantum electronics','<q>Your machines won\'t even be sure if they\'re on or off!</q>','Factory','Antimatter condenser','synergy1');9173Game.SynergyUpgrade('Temporal overclocking','<q>Introduce more quickitude in your system for increased speedation of fastness.</q>','Factory','Time machine','synergy2');91749175Game.SynergyUpgrade('Contracts from beyond','<q>Make sure to read the fine print!</q>','Bank','Portal','synergy1');9176Game.SynergyUpgrade('Printing presses','<q>Fake bills so real, they\'re almost worth the ink they\'re printed with.</q>','Bank','Factory','synergy2');91779178Game.SynergyUpgrade('Paganism','<q>Some deities are better left unworshipped.</q>','Temple','Portal','synergy1');9179Game.SynergyUpgrade('God particle','<q>Turns out God is much tinier than we thought, I guess.</q>','Temple','Antimatter condenser','synergy2');91809181Game.SynergyUpgrade('Arcane knowledge','<q>Some things were never meant to be known - only mildly speculated.</q>','Wizard tower','Alchemy lab','synergy1');9182Game.SynergyUpgrade('Magical botany','<q>Already known in some reactionary newspapers as "the wizard\'s GMOs".</q>','Wizard tower','Farm','synergy2');91839184Game.SynergyUpgrade('Fossil fuels','<q>Somehow better than plutonium for powering rockets.<br>Extracted from the fuels of ancient, fossilized civilizations.</q>','Shipment','Mine','synergy1');9185Game.SynergyUpgrade('Shipyards','<q>Where carpentry, blind luck, and asbestos insulation unite to produce the most dazzling spaceships on the planet.</q>','Shipment','Factory','synergy2');91869187Game.SynergyUpgrade('Primordial ores','<q>Only when refining the purest metals will you extract the sweetest sap of the earth.</q>','Alchemy lab','Mine','synergy1');9188Game.SynergyUpgrade('Gold fund','<q>If gold is the backbone of the economy, cookies, surely, are its hip joints.</q>','Alchemy lab','Bank','synergy2');91899190Game.SynergyUpgrade('Infernal crops','<q>Sprinkle regularly with FIRE.</q>','Portal','Farm','synergy1');9191Game.SynergyUpgrade('Abysmal glimmer','<q>Someone, or something, is staring back at you.<br>Perhaps at all of us.</q>','Portal','Prism','synergy2');91929193Game.SynergyUpgrade('Relativistic parsec-skipping','<q>People will tell you this isn\'t physically possible.<br>These are people you don\'t want on your ship.</q>','Time machine','Shipment','synergy1');9194Game.SynergyUpgrade('Primeval glow','<q>From unending times, an ancient light still shines, impossibly pure and fragile in its old age.</q>','Time machine','Prism','synergy2');91959196Game.SynergyUpgrade('Extra physics funding','<q>Time to put your money where your particle colliders are.</q>','Antimatter condenser','Bank','synergy1');9197Game.SynergyUpgrade('Chemical proficiency','<q>Discover exciting new elements, such as Fleshmeltium, Inert Shampoo Byproduct #17 and Carbon++!</q>','Antimatter condenser','Alchemy lab','synergy2');91989199Game.SynergyUpgrade('Light magic','<q>Actually not to be taken lightly! No, I\'m serious. 178 people died last year. You don\'t mess around with magic.</q>','Prism','Wizard tower','synergy1');9200Game.SynergyUpgrade('Mystical energies','<q>Something beckons from within the light. It is warm, comforting, and apparently the cause for several kinds of exotic skin cancers.</q>','Prism','Temple','synergy2');920192029203new Game.Upgrade('Synergies Vol. I','Unlocks a new tier of upgrades that affect <b>2 buildings at the same time</b>.<br>Synergies appear once you have <b>15</b> of both buildings.<q>The many beats the few.</q>',222222,[10,20]);Game.last.pool='prestige';Game.last.parents=['Satan','Dominions'];9204new Game.Upgrade('Synergies Vol. II','Unlocks a new tier of upgrades that affect <b>2 buildings at the same time</b>.<br>Synergies appear once you have <b>75</b> of both buildings.<q>The several beats the many.</q>',2222222,[10,29]);Game.last.pool='prestige';Game.last.parents=['Beelzebub','Seraphim','Synergies Vol. I'];92059206new Game.Upgrade('Heavenly cookies','Cookie production multiplier <b>+10% permanently</b>.<q>Baked with heavenly chips. An otherwordly flavor that transcends time and space.</q>',3,[25,12]);Game.last.pool='prestige';Game.last.parents=['Legacy'];Game.last.power=10;Game.last.pseudoCookie=true;9207new Game.Upgrade('Wrinkly cookies','Cookie production multiplier <b>+10% permanently</b>.<q>The result of regular cookies left to age out for countless eons in a place where time and space are meaningless.</q>',6666666,[26,12]);Game.last.pool='prestige';Game.last.parents=['Sacrilegious corruption','Elder spice'];Game.last.power=10;Game.last.pseudoCookie=true;9208new Game.Upgrade('Distilled essence of redoubled luck','Golden cookies (and all other things that spawn, such as reindeer) have <b>1% chance of being doubled</b>.<q>Tastes glittery. The empty phial makes for a great pencil holder.</q>',7777777,[27,12]);Game.last.pool='prestige';Game.last.parents=['Divine bakeries','Residual luck'];92099210order=40000;9211new Game.Upgrade('Occult obstruction','Cookie production <b>reduced to 0</b>.<q>If symptoms persist, consult a doctor.</q>',7,[15,5]);//debug purposes only9212Game.last.pool='debug';9213new Game.Upgrade('Glucose-charged air','Sugar lumps coalesce <b>a whole lot faster</b>.<q>Don\'t breathe too much or you\'ll get diabetes!</q>',7,[29,16]);//debug purposes only9214Game.last.pool='debug';92159216order=10300;9217Game.NewUpgradeCookie({name:'Lavender chocolate butter biscuit',desc:'Rewarded for owning 300 of everything.<br>This subtly-flavored biscuit represents the accomplishments of decades of top-secret research. The molded design on the chocolate resembles a well-known entrepreneur who gave their all to the ancient path of baking.',icon:[26,10],power: 10,price: 999999999999999999999999999999999,locked:1});92189219order=10030;9220Game.NewUpgradeCookie({name:'Lombardia cookies',desc:'These come from those farms with the really good memory.',icon:[23,13],require:'Box of brand biscuits',power: 3, price: 999999999999999999999*5});9221Game.NewUpgradeCookie({name:'Bastenaken cookies',desc:'French cookies made of delicious cinnamon and candy sugar. These do not contain Nuts!',icon:[24,13],require:'Box of brand biscuits',power: 3, price: 999999999999999999999*5});92229223order=10020;9224Game.NewUpgradeCookie({name:'Pecan sandies',desc:'Stick a nut on a cookie and call it a day! Name your band after it! Whatever!',icon:[25,13],power: 4,price: 999999999999999999999999*5});9225Game.NewUpgradeCookie({name:'Moravian spice cookies',desc:'Popular for being the world\'s moravianest cookies.',icon:[26,13],power: 4,price: 9999999999999999999999999});9226Game.NewUpgradeCookie({name:'Anzac biscuits',desc:'Army biscuits from a bakery down under, containing no eggs but yes oats.',icon:[27,13],power: 4,price: 9999999999999999999999999*5});9227Game.NewUpgradeCookie({name:'Buttercakes',desc:'Glistening with cholesterol, these cookies moistly straddle the line between the legal definition of a cookie and just a straight-up stick of butter.',icon:[29,13],power: 4,price: 99999999999999999999999999});9228Game.NewUpgradeCookie({name:'Ice cream sandwiches',desc:'In an alternate universe, "ice cream sandwich" designates an ice cream cone filled with bacon, lettuce, and tomatoes. Maybe some sprinkles too.',icon:[28,13],power: 4,price: 99999999999999999999999999*5});92299230new Game.Upgrade('Stevia Caelestis','Sugar lumps ripen <b>an hour sooner</b>.<q>A plant of supernatural sweetness grown by angels in heavenly gardens.</q>',100000000,[25,15]);Game.last.pool='prestige';Game.last.parents=['Wrinkly cookies'];9231new Game.Upgrade('Diabetica Daemonicus','Sugar lumps mature <b>an hour sooner</b>.<q>A malevolent, if delicious herb that is said to grow on the cliffs of the darkest abyss of the underworld.</q>',300000000,[26,15]);Game.last.pool='prestige';Game.last.parents=['Stevia Caelestis','Lucifer'];9232new Game.Upgrade('Sucralosia Inutilis','Bifurcated sugar lumps appear <b>5% more often</b> and are <b>5% more likely</b> to drop 2 lumps.<q>A rare berry of uninteresting flavor that is as elusive as its uses are limited; only sought-after by the most avid collectors with too much wealth on their hands.</q>',1000000000,[27,15]);Game.last.pool='prestige';Game.last.parents=['Diabetica Daemonicus'];92339234//note : these showIf functions stop working beyond 10 quadrillion prestige level, due to loss in precision; the solution, of course, is to make sure 10 quadrillion is not an attainable prestige level9235new Game.Upgrade('Lucky digit','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade is a bit shy and only appears when your prestige level ends in 7.</q>',777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%10==7);};9236new Game.Upgrade('Lucky number','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade is a reclusive hermit and only appears when your prestige level ends in 777.</q>',77777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Lucky digit','Lasting fortune'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%1000==777);};9237new Game.Upgrade('Lucky payout','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade took an oath of complete seclusion from the rest of the world and only appears when your prestige level ends in 777777.</q>',77777777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Lucky number','Decisive fate'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%1000000==777777);};92389239order=50000;9240new Game.Upgrade('Background selector','Lets you pick which wallpaper to display.',0,[29,5]);9241Game.last.descFunc=function(){9242var choice=this.choicesFunction()[Game.bgType];9243return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+choice.icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;9244};92459246Game.last.pool='toggle';9247Game.last.choicesFunction=function()9248{9249var choices=[];9250choices[0]={name:'Automatic',icon:[0,7]};9251choices[1]={name:'Blue',icon:[21,21]};9252choices[2]={name:'Red',icon:[22,21]};9253choices[3]={name:'White',icon:[23,21]};9254choices[4]={name:'Black',icon:[24,21]};9255choices[5]={name:'Gold',icon:[25,21]};9256choices[6]={name:'Grandmas',icon:[26,21]};9257choices[7]={name:'Displeased grandmas',icon:[27,21]};9258choices[8]={name:'Angered grandmas',icon:[28,21]};9259choices[9]={name:'Money',icon:[29,21]};9260choices[Game.bgType].selected=1;9261return choices;9262}9263Game.last.choicesPick=function(id)9264{Game.bgType=id;}92659266Game.BGsByChoice={92670:{pic:'bgBlue'},92681:{pic:'bgBlue'},92692:{pic:'bgRed'},92703:{pic:'bgWhite'},92714:{pic:'bgBlack'},92725:{pic:'bgGold'},92736:{pic:'grandmas1'},92747:{pic:'grandmas2'},92758:{pic:'grandmas3'},92769:{pic:'bgMoney'},9277};92789279order=255;9280Game.GrandmaSynergy('Lucky grandmas','A fortunate grandma that always seems to find more cookies.','Chancemaker');92819282order=1200;9283new Game.TieredUpgrade('Your lucky cookie','Chancemakers are <b>twice</b> as efficient.<q>This is the first cookie you\'ve ever baked. It holds a deep sentimental value and, after all this time, an interesting smell.</q>','Chancemaker',1);9284new Game.TieredUpgrade('"All Bets Are Off" magic coin','Chancemakers are <b>twice</b> as efficient.<q>A coin that always lands on the other side when flipped. Not heads, not tails, not the edge. The <i>other side</i>.</q>','Chancemaker',2);9285new Game.TieredUpgrade('Winning lottery ticket','Chancemakers are <b>twice</b> as efficient.<q>What lottery? THE lottery, that\'s what lottery! Only lottery that matters!</q>','Chancemaker',3);9286new Game.TieredUpgrade('Four-leaf clover field','Chancemakers are <b>twice</b> as efficient.<q>No giant monsters here, just a whole lot of lucky grass.</q>','Chancemaker',4);9287new Game.TieredUpgrade('A recipe book about books','Chancemakers are <b>twice</b> as efficient.<q>Tip the scales in your favor with 28 creative new ways to cook the books.</q>','Chancemaker',5);9288new Game.TieredUpgrade('Leprechaun village','Chancemakers are <b>twice</b> as efficient.<q>You\'ve finally become accepted among the local leprechauns, who lend you their mythical luck as a sign of friendship (as well as some rather foul-tasting tea).</q>','Chancemaker',6);9289new Game.TieredUpgrade('Improbability drive','Chancemakers are <b>twice</b> as efficient.<q>A strange engine that turns statistics on their head. Recommended by the Grandmother\'s Guide to the Bakery.</q>','Chancemaker',7);9290new Game.TieredUpgrade('Antisuperstistronics','Chancemakers are <b>twice</b> as efficient.<q>An exciting new field of research that makes unlucky things lucky. No mirror unbroken, no ladder unwalked under!</q>','Chancemaker',8);92919292order=5000;9293Game.SynergyUpgrade('Gemmed talismans','<q>Good-luck charms covered in ancient and excruciatingly rare crystals. A must have for job interviews!</q>','Chancemaker','Mine','synergy1');92949295order=20000;9296new Game.Upgrade('Kitten consultants','You gain <b>more CpS</b> the more milk you have.<q>glad to be overpaid to work with you, sir</q>',900000000000000000000000000000000,Game.GetIcon('Kitten',9));Game.last.kitten=1;Game.MakeTiered(Game.last,9,18);92979298order=99999;9299var years=Math.floor((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365));9300//only updates on page load9301//may behave strangely on leap years9302Game.NewUpgradeCookie({name:'Birthday cookie',desc:'-',icon:[22,13],power:years,price:99999999999999999999999999999});Game.last.baseDesc='Cookie production multiplier <b>+1%</b> for every year Cookie Clicker has existed (currently : <b>+'+Beautify(years)+'%</b>).<q>Thank you for playing Cookie Clicker!<br>-Orteil</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);930393049305order=150;new Game.Upgrade('Armythril mouse','Clicking gains <b>+1% of your CpS</b>.<q>This one takes about 53 people to push it around and another 48 to jump down on the button and trigger a click. You could say it\'s got some heft to it.</q>',50000000000000000000000,[11,19]);Game.MakeTiered(Game.last,10,11);93069307order=200;new Game.TieredUpgrade('Reverse dementia','Grandmas are <b>twice</b> as efficient.<q>Extremely unsettling, and somehow even worse than the regular kind.</q>','Grandma',9);9308order=300;new Game.TieredUpgrade('Humane pesticides','Farms are <b>twice</b> as efficient.<q>Made by people, for people, from people and ready to unleash some righteous scorching pain on those pesky insects that so deserve it.</q>','Farm',9);9309order=400;new Game.TieredUpgrade('Mole people','Mines are <b>twice</b> as efficient.<q>Engineered from real human beings within your very labs, these sturdy little folks have a knack for finding the tastiest underground minerals in conditions that more expensive machinery probably wouldn\'t survive.</q>','Mine',9);9310order=500;new Game.TieredUpgrade('Machine learning','Factories are <b>twice</b> as efficient.<q>You figured you might get better productivity if you actually told your workers to learn how to work the machines. Sometimes, it\'s the little things...</q>','Factory',9);9311order=525;new Game.TieredUpgrade('Edible money','Banks are <b>twice</b> as efficient.<q>It\'s really quite simple; you make all currency too delicious not to eat, solving world hunger and inflation in one fell swoop!</q>','Bank',9);9312order=550;new Game.TieredUpgrade('Sick rap prayers','Temples are <b>twice</b> as efficient.<q>With their ill beat and radical rhymes, these way-hip religious tunes are sure to get all the youngins who thought they were 2 cool 4 church back on the pews and praying for more! Wicked!</q>','Temple',9);9313order=575;new Game.TieredUpgrade('Deluxe tailored wands','Wizard towers are <b>twice</b> as efficient.<q>In this age of science, most skillful wand-makers are now long gone; but thankfully - not all those wanders are lost.</q>','Wizard tower',9);9314order=600;new Game.TieredUpgrade('Autopilot','Shipments are <b>twice</b> as efficient.<q>Your ships are now fitted with completely robotic crews! It\'s crazy how much money you save when you don\'t have to compensate the families of those lost in space.</q>','Shipment',9);9315order=700;new Game.TieredUpgrade('The advent of chemistry','Alchemy labs are <b>twice</b> as efficient.<q>You know what? That whole alchemy nonsense was a load of baseless rubbish. Dear god, what were you thinking?</q>','Alchemy lab',9);9316order=800;new Game.TieredUpgrade('The real world','Portals are <b>twice</b> as efficient.<q>It turns out that our universe is actually the twisted dimension of another, saner plane of reality. Time to hop on over there and loot the place!</q>','Portal',9);9317order=900;new Game.TieredUpgrade('Second seconds','Time machines are <b>twice</b> as efficient.<q>That\'s twice as many seconds in the same amount of time! What a deal! Also, what in god\'s name!</q>','Time machine',9);9318order=1000;new Game.TieredUpgrade('Quantum comb','Antimatter condensers are <b>twice</b> as efficient.<q>Quantum entanglement is one of those things that are so annoying to explain that we might honestly be better off without it. This is finally possible thanks to the quantum comb!</q>','Antimatter condenser',9);9319order=1100;new Game.TieredUpgrade('Crystal mirrors','Prisms are <b>twice</b> as efficient.<q>Designed to filter more light back into your prisms, reaching levels of brightness that reality itself had never planned for.</q>','Prism',9);9320order=1200;new Game.TieredUpgrade('Bunnypedes','Chancemakers are <b>twice</b> as efficient.<q>You\'ve taken to breeding rabbits with hundreds of paws, which makes them intrinsically very lucky and thus a very handy (if very disturbing) pet.</q>','Chancemaker',9);93219322order=20000;9323new Game.Upgrade('Kitten assistants to the regional manager','You gain <b>more CpS</b> the more milk you have.<q>nothing stresses meowt... except having to seek the approval of my inferiors, sir</q>',900000000000000000000000000000000000,Game.GetIcon('Kitten',10));Game.last.kitten=1;Game.MakeTiered(Game.last,10,18);93249325order=5000;9326Game.SynergyUpgrade('Charm quarks','<q>They\'re after your lucky quarks!</q>','Chancemaker','Antimatter condenser','synergy2');932793289329order=10020;9330Game.NewUpgradeCookie({name:'Pink biscuits',desc:'One of the oldest cookies. Traditionally dipped in champagne to soften it, because the French will use any opportunity to drink.',icon:[21,16],power: 4,price: 999999999999999999999999999});9331Game.NewUpgradeCookie({name:'Whole-grain cookies',desc:'Covered in seeds and other earthy-looking debris. Really going for that "5-second rule" look.',icon:[22,16],power: 4,price: 999999999999999999999999999*5});9332Game.NewUpgradeCookie({name:'Candy cookies',desc:'These melt in your hands just a little bit.',icon:[23,16],power: 4,price: 9999999999999999999999999999});9333Game.NewUpgradeCookie({name:'Big chip cookies',desc:'You are in awe at the size of these chips. Absolute units.',icon:[24,16],power: 4,price: 9999999999999999999999999999*5});9334Game.NewUpgradeCookie({name:'One chip cookies',desc:'You get one.',icon:[25,16],power: 1,price: 99999999999999999999999999999});933593369337new Game.Upgrade('Sugar baking','Each unspent sugar lump (up to 100) gives <b>+1% CpS</b>.<div class="warning">Note : this means that spending sugar lumps will decrease your CpS until they grow back.</div><q>To bake with the sugary essence of eons themselves, you must first learn to take your sweet time.</q>',200000000,[21,17]);Game.last.pool='prestige';Game.last.parents=['Stevia Caelestis'];9338new Game.Upgrade('Sugar craving','Once an ascension, you may use the "Sugar frenzy" switch to <b>triple your CpS</b> for 1 hour, at the cost of <b>1 sugar lump</b>.<q>Just a little kick to sweeten the deal.</q>',400000000,[22,17]);Game.last.pool='prestige';Game.last.parents=['Sugar baking'];9339new Game.Upgrade('Sugar aging process','Each grandma (up to 600) makes sugar lumps ripen <b>6 seconds</b> sooner.<q>Aren\'t they just the sweetest?</q>',600000000,[23,17]);Game.last.pool='prestige';Game.last.parents=['Sugar craving','Diabetica Daemonicus'];93409341order=40050;9342new Game.Upgrade('Sugar frenzy','Activating this will <b>triple your CpS</b> for 1 hour, at the cost of <b>1 sugar lump</b>.<br>May only be used once per ascension.',0,[22,17]);9343Game.last.priceLumps=1;9344Game.last.pool='toggle';Game.last.toggleInto=0;9345Game.last.canBuyFunc=function(){return Game.lumps>=1;};9346Game.last.clickFunction=Game.spendLump(1,'activate the sugar frenzy',function()9347{9348Game.Upgrades['Sugar frenzy'].buy(1);9349buff=Game.gainBuff('sugar frenzy',60*60,3);9350if (Game.prefs.popups) Game.Popup('Sugar frenzy activated!');9351else Game.Notify('Sugar frenzy!','CpS x3 for 1 hour!',[29,14]);9352});93539354order=10020;9355Game.NewUpgradeCookie({name:'Sprinkles cookies',desc:'A bit of festive decorating helps hide the fact that this might be one of the blandest cookies you\'ve ever tasted.',icon:[21,14],power: 4,price: 99999999999999999999999999999*5});9356Game.NewUpgradeCookie({name:'Peanut butter blossoms',desc:'Topped with a scrumptious chocolate squirt, which is something we really wish we didn\'t just write.',icon:[22,14],power: 4,price: 999999999999999999999999999999});9357Game.NewUpgradeCookie({name:'No-bake cookies',desc:'You have no idea how these mysterious oven-less treats came to be or how they hold their shape. You\'re thinking either elephant glue or cold fusion.',icon:[21,15],power: 4,price: 999999999999999999999999999999*5});9358Game.NewUpgradeCookie({name:'Florentines',desc:'These make up for being the fruitcake of cookies by at least having the decency to feature chocolate.',icon:[26,16],power: 4,price: 9999999999999999999999999999999});9359Game.NewUpgradeCookie({name:'Chocolate crinkles',desc:'Non-denominational cookies to celebrate year-round deliciousness, and certainly not Christmas or some other nonsense.',icon:[22,15],power: 4,price: 9999999999999999999999999999999*5});9360Game.NewUpgradeCookie({name:'Maple cookies',desc:'Made with syrup from a land where milk comes in bags, instead of spontaneously pooling at the bottom of your screen depending on your achievements.',icon:[21,13],power: 4,price: 99999999999999999999999999999999});936193629363order=40000;9364new Game.Upgrade('Turbo-charged soil','Garden plants grow every second.<br>Garden seeds are free to plant.<br>You can switch soils at any time.<q>It\'s got electrolytes!</q>',7,[2,16]);//debug purposes only9365Game.last.buyFunction=function(){if (Game.Objects['Farm'].minigameLoaded){Game.Objects['Farm'].minigame.computeStepT();}}9366Game.last.pool='debug';93679368order=150;9369new Game.Upgrade('Technobsidian mouse','Clicking gains <b>+1% of your CpS</b>.<q>A highly advanced mouse of a sophisticated design. Only one thing on its mind : to click.</q>',5000000000000000000000000,[11,28]);Game.MakeTiered(Game.last,11,11);9370new Game.Upgrade('Plasmarble mouse','Clicking gains <b>+1% of your CpS</b>.<q>A shifting blur in the corner of your eye, this mouse can trigger a flurry of clicks when grazed by even the slightest breeze.</q>',500000000000000000000000000,[11,30]);Game.MakeTiered(Game.last,12,11);93719372order=20000;9373new Game.Upgrade('Kitten marketeers','You gain <b>more CpS</b> the more milk you have.<q>no such thing as a saturated markit, sir</q>',900000000000000000000000000000000000000,Game.GetIcon('Kitten',11));Game.last.kitten=1;Game.MakeTiered(Game.last,11,18);93749375order=10030;9376Game.NewUpgradeCookie({name:'Festivity loops',desc:'These garish biscuits are a perfect fit for children\'s birthday parties or the funerals of strange, eccentric billionaires.',icon:[25,17],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999*5});93779378order=10020;9379Game.NewUpgradeCookie({name:'Persian rice cookies',desc:'Rose water and poppy seeds are the secret ingredients of these small, butter-free cookies.',icon:[28,15],power: 4,price: 99999999999999999999999999999999*5});9380Game.NewUpgradeCookie({name:'Norwegian cookies',desc:'A flat butter cookie with a sliver of candied cherry on top. It is said that these illustrate the bleakness of scandinavian existentialism.',icon:[22,20],power: 4,price: 999999999999999999999999999999999});9381Game.NewUpgradeCookie({name:'Crispy rice cookies',desc:'Fun to make at home! Store-bought cookies are obsolete! Topple the system! There\'s marshmallows in these! Destroy capitalism!',icon:[23,20],power: 4,price: 999999999999999999999999999999999*5});9382Game.NewUpgradeCookie({name:'Ube cookies',desc:'The tint is obtained by the use of purple yams. According to color symbolism, these cookies are either noble, holy, or supervillains.',icon:[24,17],power: 4,price: 9999999999999999999999999999999999});9383Game.NewUpgradeCookie({name:'Butterscotch cookies',desc:'The butterscotch chips are just the right amount of sticky, and make you feel like you\'re eating candy.',icon:[24,20],power: 4,price: 9999999999999999999999999999999999*5});9384Game.NewUpgradeCookie({name:'Speculaas',desc:'These crunchy, almost obnoxiously cinnamony cookies are a source of dutch pride. About the origin of the name, one can only speculate.',icon:[21,20],power: 4,price: 99999999999999999999999999999999999});93859386order=10200;9387Game.NewUpgradeCookie({name:'Elderwort biscuits',desc:'-',icon:[22,25],power:2,price:60*2,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+2%</b>.<br>Grandma production multiplier <b>+2%</b>.<br>Dropped by elderwort plants.<q>They taste incredibly stale, even when baked fresh.</q>';9388Game.NewUpgradeCookie({name:'Bakeberry cookies',desc:'-',icon:[23,25],power:2,price:60,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+2%</b>.<br>Dropped by bakeberry plants.<q>Really good dipped in hot chocolate.</q>';9389Game.NewUpgradeCookie({name:'Duketater cookies',desc:'-',icon:[24,25],power:10,price:60*3,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+10%</b>.<br>Dropped by duketater plants.<q>Fragrant and mealy, with a slight yellow aftertaste.</q>';9390Game.NewUpgradeCookie({name:'Green yeast digestives',desc:'-',icon:[25,25],power:0,price:60*3,locked:1});Game.last.baseDesc='<b>+1%</b> golden cookie gains and effect duration.<br><b>+1%</b> golden cookie frequency.<br><b>+3%</b> random drops.<br>Dropped by green rot plants.<q>These are tastier than you\'d expect, but not by much.</q>';93919392order=23000;9393new Game.Upgrade('Fern tea','You gain <b>+3%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<br>Dropped by drowsyfern plants.<q>A chemically complex natural beverage, this soothing concoction has been used by mathematicians to solve equations in their sleep.</q>',60,[26,25]);9394new Game.Upgrade('Ichor syrup','You gain <b>+7%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<br>Sugar lumps mature <b>7 minutes</b> sooner.<br>Dropped by ichorpuff plants.<q>Tastes like candy. The smell is another story.</q>',60*2,[27,25]);93959396order=10200;9397Game.NewUpgradeCookie({name:'Wheat slims',desc:'-',icon:[28,25],power:1,price:30,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+1%</b>.<br>Dropped by baker\'s wheat plants.<q>The only reason you\'d consider these to be cookies is because you feel slightly sorry for them.</q>';93989399var gardenDrops=['Elderwort biscuits','Bakeberry cookies','Duketater cookies','Green yeast digestives','Fern tea','Ichor syrup','Wheat slims'];9400for (var i in gardenDrops)//scale by CpS9401{9402var it=Game.Upgrades[gardenDrops[i]];9403it.priceFunc=function(cost){return function(){return cost*Game.cookiesPs*60;}}(it.basePrice);9404it.baseDesc=it.baseDesc.replace('<q>','<br>Cost scales with CpS.<q>');9405it.desc=BeautifyInText(it.baseDesc);9406it.lasting=true;9407}940894099410order=10300;9411Game.NewUpgradeCookie({name:'Synthetic chocolate green honey butter biscuit',desc:'Rewarded for owning 350 of everything.<br>The recipe for this butter biscuit was once the sole heritage of an ancient mountain monastery. Its flavor is so refined that only a slab of lab-made chocolate specifically engineered to be completely tasteless could complement it.<br>Also it\'s got your face on it.',icon:[24,26],power: 10,price: 999999999999999999999999999999999999,locked:1});9412Game.NewUpgradeCookie({name:'Royal raspberry chocolate butter biscuit',desc:'Rewarded for owning 400 of everything.<br>Once reserved for the megalomaniac elite, this unique strain of fruity chocolate has a flavor and texture unlike any other. Whether its exorbitant worth is improved or lessened by the presence of your likeness on it still remains to be seen.',icon:[25,26],power: 10,price: 999999999999999999999999999999999999999,locked:1});9413Game.NewUpgradeCookie({name:'Ultra-concentrated high-energy chocolate butter biscuit',desc:'Rewarded for owning 450 of everything.<br>Infused with the power of several hydrogen bombs through a process that left most nuclear engineers and shareholders perplexed. Currently at the center of some rather heated United Nations meetings. Going in more detail about this chocolate would violate several state secrets, but we\'ll just add that someone\'s bust seems to be pictured on it. Perhaps yours?',icon:[26,26],power: 10,price: 999999999999999999999999999999999999999999,locked:1});9414941594169417order=200;new Game.TieredUpgrade('Timeproof hair dyes','Grandmas are <b>twice</b> as efficient.<q>Why do they always have those strange wispy pink dos? What do they know about candy floss that we don\'t?</q>','Grandma',10);9418order=300;new Game.TieredUpgrade('Barnstars','Farms are <b>twice</b> as efficient.<q>Ah, yes. These help quite a bit. Somehow.</q>','Farm',10);9419order=400;new Game.TieredUpgrade('Mine canaries','Mines are <b>twice</b> as efficient.<q>These aren\'t used for anything freaky! The miners just enjoy having a pet or two down there.</q>','Mine',10);9420order=500;new Game.TieredUpgrade('Brownie point system','Factories are <b>twice</b> as efficient.<q>Oh, these are lovely! You can now reward your factory employees for good behavior, such as working overtime or snitching on coworkers. 58 brownie points gets you a little picture of a brownie, and 178 of those pictures gets you an actual brownie piece for you to do with as you please! Infantilizing? Maybe. Oodles of fun? You betcha!</q>','Factory',10);9421order=525;new Game.TieredUpgrade('Grand supercycles','Banks are <b>twice</b> as efficient.<q>We let the public think these are complicated financial terms when really we\'re just rewarding the bankers with snazzy bicycles for a job well done. It\'s only natural after you built those fancy gold swimming pools for them, where they can take a dip and catch Kondratiev waves.</q>','Bank',10);9422order=550;new Game.TieredUpgrade('Psalm-reading','Temples are <b>twice</b> as efficient.<q>A theologically dubious and possibly blasphemous blend of fortune-telling and scripture studies.</q>','Temple',10);9423order=575;new Game.TieredUpgrade('Immobile spellcasting','Wizard towers are <b>twice</b> as efficient.<q>Wizards who master this skill can now cast spells without having to hop and skip and gesticulate embarrassingly, which is much sneakier and honestly quite a relief.</q>','Wizard tower',10);9424order=600;new Game.TieredUpgrade('Restaurants at the end of the universe','Shipments are <b>twice</b> as efficient.<q>Since the universe is spatially infinite, and therefore can be construed to have infinite ends, you\'ve opened an infinite chain of restaurants where your space truckers can rest and partake in some home-brand cookie-based meals.</q>','Shipment',10);9425order=700;new Game.TieredUpgrade('On second thought','Alchemy labs are <b>twice</b> as efficient.<q>Disregard that last upgrade, alchemy is where it\'s at! Your eggheads just found a way to transmute children\'s nightmares into rare metals!</q>','Alchemy lab',10);9426order=800;new Game.TieredUpgrade('Dimensional garbage gulper','Portals are <b>twice</b> as efficient.<q>So we\'ve been looking for a place to dispose of all the refuse that\'s been accumulating since we started baking - burnt cookies, failed experiments, unruly workers - and well, we figured rather than sell it to poor countries like we\'ve been doing, we could just dump it in some alternate trash dimension where it\'s not gonna bother anybody! Probably!</q>','Portal',10);9427order=900;new Game.TieredUpgrade('Additional clock hands','Time machines are <b>twice</b> as efficient.<q>It seemed like a silly idea at first, but it turns out these have the strange ability to twist time in interesting new ways.</q>','Time machine',10);9428order=1000;new Game.TieredUpgrade('Baking Nobel prize','Antimatter condensers are <b>twice</b> as efficient.<q>What better way to sponsor scientific growth than to motivate those smarmy nerds with a meaningless award! What\'s more, each prize comes with a fine print lifelong exclusive contract to come work for you (or else)!</q>','Antimatter condenser',10);9429order=1100;new Game.TieredUpgrade('Reverse theory of light','Prisms are <b>twice</b> as efficient.<q>A whole new world of physics opens up when you decide that antiphotons are real and posit that light is merely a void in shadow.</q>','Prism',10);9430order=1200;new Game.TieredUpgrade('Revised probabilistics','Chancemakers are <b>twice</b> as efficient.<q>Either something happens or it doesn\'t. That\'s a 50% chance! This suddenly makes a lot of unlikely things very possible.</q>','Chancemaker',10);94319432order=20000;9433new Game.Upgrade('Kitten analysts','You gain <b>more CpS</b> the more milk you have.<q>based on purrent return-on-investment meowdels we should be able to affurd to pay our empawyees somewhere around next century, sir</q>',900000000000000000000000000000000000000000,Game.GetIcon('Kitten',12));Game.last.kitten=1;Game.MakeTiered(Game.last,12,18);943494359436new Game.Upgrade('Eye of the wrinkler','Mouse over a wrinkler to see how many cookies are in its stomach.<q>Just a wrinkler and its will to survive.<br>Hangin\' tough, stayin\' hungry.</q>',99999999,[27,26]);Game.last.pool='prestige';Game.last.parents=['Wrinkly cookies'];94379438new Game.Upgrade('Inspired checklist','Unlocks the <b>Buy all</b> feature, which lets you instantly purchase every upgrade in your store (starting from the cheapest one).<br>Also unlocks the <b>Vault</b>, a store section where you can place upgrades you do not wish to auto-buy.<q>Snazzy grandma accessories? Check. Transdimensional abominations? Check. A bunch of eggs for some reason? Check. Machine that goes "ping"? Check and check.</q>',900000,[28,26]);Game.last.pool='prestige';Game.last.parents=['Persistent memory','Permanent upgrade slot IV'];94399440order=10300;9441Game.NewUpgradeCookie({name:'Pure pitch-black chocolate butter biscuit',desc:'Rewarded for owning 500 of everything.<br>This chocolate is so pure and so flawless that it has no color of its own, instead taking on the appearance of whatever is around it. You\'re a bit surprised to notice that this one isn\'t stamped with your effigy, as its surface is perfectly smooth (to the picometer) - until you realize it\'s quite literally reflecting your own face like a mirror.',icon:[24,27],power: 10,price: 999999999999999999999999999999999999999999999,locked:1});94429443order=10020;9444Game.NewUpgradeCookie({name:'Chocolate oatmeal cookies',desc:'These bad boys compensate for lack of a cohesive form and a lumpy, unsightly appearance by being just simply delicious. Something we should all aspire to.',icon:[23,28],power: 4,price: 99999999999999999999999999999999999*5});9445Game.NewUpgradeCookie({name:'Molasses cookies',desc:'Sticky, crackly, and dusted in fine sugar.<br>Some lunatics have been known to eat these with potatoes.',icon:[24,28],power: 4,price: 999999999999999999999999999999999999});9446Game.NewUpgradeCookie({name:'Biscotti',desc:'Almonds and pistachios make these very robust cookies slightly more interesting to eat than to bludgeon people with.',icon:[22,28],power: 4,price: 999999999999999999999999999999999999*5});9447Game.NewUpgradeCookie({name:'Waffle cookies',desc:'Whether these are cookies with shockingly waffle-like features or simply regular cookie-sized waffles is a debate we\'re not getting into here.',icon:[21,28],power: 4,price: 9999999999999999999999999999999999999});944894499450order=10000;9451//early cookies that unlock at the same time as coconut cookies; meant to boost early game a little bit9452Game.NewUpgradeCookie({name:'Almond cookies',desc:'Sometimes you feel like one of these. Sometimes you don\'t.',icon:[21,27],power: 2, price: 99999999});9453Game.NewUpgradeCookie({name:'Hazelnut cookies',desc:'Tastes like a morning stroll through a fragrant forest, minus the clouds of gnats.',icon:[22,27],power: 2, price: 99999999});9454Game.NewUpgradeCookie({name:'Walnut cookies',desc:'Some experts have pointed to the walnut\'s eerie resemblance to the human brain as a sign of its sentience - a theory most walnuts vehemently object to.',icon:[23,27],power: 2, price: 99999999});945594569457new Game.Upgrade('Label printer','Mouse over an upgrade to see its tier.<br><small>Note : only some upgrades have tiers. Tiers are purely cosmetic and have no effect on gameplay.</small><q>Also comes in real handy when you want to tell catsup apart from ketchup.</q>',999999,[28,29]);Game.last.pool='prestige';Game.last.parents=['Starter kitchen'];94589459946094619462order=200;new Game.TieredUpgrade('Good manners','Grandmas are <b>twice</b> as efficient.<q>Apparently these ladies are much more amiable if you take the time to learn their strange, ancient customs, which seem to involve saying "please" and "thank you" and staring at the sun with bulging eyes while muttering eldritch curses under your breath.</q>','Grandma',11);9463order=300;new Game.TieredUpgrade('Lindworms','Farms are <b>twice</b> as efficient.<q>You have to import these from far up north, but they really help areate the soil!</q>','Farm',11);9464order=400;new Game.TieredUpgrade('Bore again','Mines are <b>twice</b> as efficient.<q>After extracting so much sediment for so long, you\'ve formed some veritable mountains of your own from the accumulated piles of rock and dirt. Time to dig through those and see if you find anything fun!</q>','Mine',11);9465order=500;new Game.TieredUpgrade('"Volunteer" interns','Factories are <b>twice</b> as efficient.<q>If you\'re bad at something, always do it for free.</q>','Factory',11);9466order=525;new Game.TieredUpgrade('Rules of acquisition','Banks are <b>twice</b> as efficient.<q>Rule 387 : a cookie baked is a cookie kept.</q>','Bank',11);9467order=550;new Game.TieredUpgrade('War of the gods','Temples are <b>twice</b> as efficient.<q>An interesting game; the only winning move is not to pray.</q>','Temple',11);9468order=575;new Game.TieredUpgrade('Electricity','Wizard towers are <b>twice</b> as efficient.<q>Ancient magicks and forbidden hexes shroud this arcane knowledge, whose unfathomable power can mysteriously turn darkness into light and shock an elephant to death.</q>','Wizard tower',11);9469order=600;new Game.TieredUpgrade('Universal alphabet','Shipments are <b>twice</b> as efficient.<q>You\'ve managed to chart a language that can be understood by any sentient species in the galaxy; its exciting vocabulary contains over 56 trillion words that sound and look like sparkly burps, forming intricate sentences that usually translate to something like "give us your cookies, or else".</q>','Shipment',11);9470order=700;new Game.TieredUpgrade('Public betterment','Alchemy labs are <b>twice</b> as efficient.<q>Why do we keep trying to change useless matter into cookies, or cookies into even better cookies? Clearly, the way of the future is to change the people who eat the cookies into people with a greater understanding, appreciation and respect for the cookies they\'re eating. Into the vat you go!</q>','Alchemy lab',11);9471order=800;new Game.TieredUpgrade('Embedded microportals','Portals are <b>twice</b> as efficient.<q>We\'ve found out that if we bake the portals into the cookies themselves, we can transport people\'s taste buds straight into the taste dimension! Good thing your army of lawyers got rid of the FDA a while ago!</q>','Portal',11);9472order=900;new Game.TieredUpgrade('Nostalgia','Time machines are <b>twice</b> as efficient.<q>Your time machine technicians insist that this is some advanced new time travel tech, and not just an existing emotion universal to mankind. Either way, you have to admit that selling people the same old cookies just because it reminds them of the good old times is an interesting prospect.</q>','Time machine',11);9473order=1000;new Game.TieredUpgrade('The definite molecule','Antimatter condensers are <b>twice</b> as efficient.<q>Your scientists have found a way to pack a cookie into one single continuous molecule, opening exciting new prospects in both storage and flavor despite the fact that these take up to a whole year to digest.</q>','Antimatter condenser',11);9474order=1100;new Game.TieredUpgrade('Light capture measures','Prisms are <b>twice</b> as efficient.<q>As the universe gets ever so slightly dimmer due to you converting more and more of its light into cookies, you\'ve taken to finding new and unexplored sources of light for your prisms; for instance, the warm glow emitted by a pregnant woman, or the twinkle in the eye of a hopeful child.</q>','Prism',11);9475order=1200;new Game.TieredUpgrade('0-sided dice','Chancemakers are <b>twice</b> as efficient.<q>The advent of the 0-sided dice has had unexpected and tumultuous effects on the gambling community, and saw experts around the world calling you both a genius and an imbecile.</q>','Chancemaker',11);947694779478new Game.Upgrade('Heralds','You now benefit from the boost provided by <b>heralds</b>.<br>Each herald gives you <b>+1% CpS</b>.<br>Look on the purple flag at the top to see how many heralds are active at any given time.<q>Be excellent to each other.<br>And Patreon, dudes!</q>',100,[21,29]);Game.last.pool='prestige';94799480order=255;9481Game.GrandmaSynergy('Metagrandmas','A fractal grandma to make more grandmas to make more cookies.','Fractal engine');94829483order=1300;9484new Game.TieredUpgrade('Metabakeries','Fractal engines are <b>twice</b> as efficient.<q>They practically bake themselves!</q>','Fractal engine',1);9485new Game.TieredUpgrade('Mandelbrown sugar','Fractal engines are <b>twice</b> as efficient.<q>A substance that displays useful properties such as fractal sweetness and instant contact lethality.</q>','Fractal engine',2);9486new Game.TieredUpgrade('Fractoids','Fractal engines are <b>twice</b> as efficient.<q>Here\'s a frun fract : all in all, these were a terrible idea.</q>','Fractal engine',3);9487new Game.TieredUpgrade('Nested universe theory','Fractal engines are <b>twice</b> as efficient.<q>Asserts that each subatomic particle is host to a whole new universe, and therefore, another limitless quantity of cookies.<br>This somehow stacks with the theory of nanocosmics, because physics.</q>','Fractal engine',4);9488new Game.TieredUpgrade('Menger sponge cake','Fractal engines are <b>twice</b> as efficient.<q>Frighteningly absorbent thanks to its virtually infinite surface area. Keep it isolated in a dry chamber, never handle it with an open wound, and do not ever let it touch a body of water.</q>','Fractal engine',5);9489new Game.TieredUpgrade('One particularly good-humored cow','Fractal engines are <b>twice</b> as efficient.<q>This unassuming bovine was excruciatingly expensive and it may seem at first like you were ripped off. On closer inspection however, you notice that its earrings (it\'s wearing earrings) are actually fully functional copies of itself, each of which also wearing their own cow earrings, and so on, infinitely. It appears your dairy concerns will be taken care of for a while, although you\'ll have to put up with the cow\'s annoying snickering.</q>','Fractal engine',6);9490new Game.TieredUpgrade('Chocolate ouroboros','Fractal engines are <b>twice</b> as efficient.<q>Forever eating its own tail and digesting itself, in a metabolically dubious tale of delicious tragedy.</q>','Fractal engine',7);9491new Game.TieredUpgrade('Nested','Fractal engines are <b>twice</b> as efficient.<q>Clever self-reference or shameful cross-promotion? This upgrade apparently has the gall to advertise a link to <u>orteil.dashnet.org/nested</u>, in a tooltip you can\'t even click.</q>','Fractal engine',8);9492new Game.TieredUpgrade('Space-filling fibers','Fractal engines are <b>twice</b> as efficient.<q>This special ingredient has the incredible ability to fill the local space perfectly, effectively eradicating hunger in those who consume it!<br>Knowing that no hunger means no need for cookies, your marketers urge you to repurpose this product into next-level packing peanuts.</q>','Fractal engine',9);9493new Game.TieredUpgrade('Endless book of prose','Fractal engines are <b>twice</b> as efficient.','Fractal engine',10);9494Game.last.descFunc=function(){9495var str='"There once was a baker named '+Game.bakeryName+'. One day, there was a knock at the door; '+Game.bakeryName+' opened it and was suddenly face-to-face with a strange and menacing old grandma. The grandma opened her mouth and, in a strange little voice, started reciting this strange little tale : ';9496var n=35;9497var i=Math.floor(Game.T*0.1);9498return this.desc+'<q style="font-family:Courier;">'+(str.substr(i%str.length,n)+(i%str.length>(str.length-n)?str.substr(0,i%str.length-(str.length-n)):''))+'</q>';9499};9500new Game.TieredUpgrade('The set of all sets','Fractal engines are <b>twice</b> as efficient.<q>The answer, of course, is a definite maybe.</q>','Fractal engine',11);95019502order=5000;9503Game.SynergyUpgrade('Recursive mirrors','<q>Do you have any idea what happens when you point two of these at each other? Apparently, the universe doesn\'t either.</q>','Fractal engine','Prism','synergy1');9504//Game.SynergyUpgrade('Compounded odds','<q>When probabilities start cascading, "never in a billion lifetimes" starts looking terribly like "probably before Monday comes around".</q>','Fractal engine','Chancemaker','synergy1');9505Game.SynergyUpgrade('Mice clicking mice','','Fractal engine','Cursor','synergy2');9506Game.last.descFunc=function(){9507Math.seedrandom(Game.seed+'-blasphemouse');9508if (Math.random()<0.3) {Math.seedrandom();return this.desc+'<q>Absolutely blasphemouse!</q>';}9509else {Math.seedrandom();return this.desc+'<q>Absolutely blasphemous!</q>';}9510};951195129513order=10020;9514Game.NewUpgradeCookie({name:'Custard creams',desc:'British lore pits these in a merciless war against bourbon biscuits.<br>The filling evokes vanilla without quite approaching it.<br>They\'re tastier on the inside!',icon:[23,29],power: 4,price: 9999999999999999999999999999999999999*5});9515Game.NewUpgradeCookie({name:'Bourbon biscuits',desc:'Two chocolate biscuits joined together with even more chocolate.<br>The sworn rivals of custard creams, as legend has it.',icon:[24,29],power: 4,price: 99999999999999999999999999999999999999});951695179518new Game.Upgrade('Keepsakes','Seasonal random drops have a <b>1/5 chance</b> to carry over through ascensions.<q>Cherish the memories.</q>',1111111111,[22,29]);Game.last.pool='prestige';Game.last.parents=['Starsnow','Starlove','Starterror','Startrade','Starspawn'];95199520order=10020;9521Game.NewUpgradeCookie({name:'Mini-cookies',desc:'Have you ever noticed how the smaller something is, the easier it is to binge on it?',icon:[29,30],power: 5,price: 99999999999999999999999999999999999999*5});95229523new Game.Upgrade('Sugar crystal cookies','Cookie production multiplier <b>+5% permanently</b>, and <b>+1%</b> for every building type level 10 or higher.<q>Infused with cosmic sweetness. It gives off a faint shimmery sound when you hold it up to your ear.</q>',1000000000,[21,30]);Game.last.pool='prestige';Game.last.parents=['Sugar baking'];Game.last.power=function(){9524var n=5;9525for (var i in Game.Objects)9526{9527if (Game.Objects[i].level>=10) n++;9528}9529return n;9530};Game.last.pseudoCookie=true;9531Game.last.descFunc=function(){9532var n=5;9533for (var i in Game.Objects)9534{9535if (Game.Objects[i].level>=10) n++;9536}9537return '<div style="text-align:center;">Current : <b>+'+Beautify(n)+'%</b><div class="line"></div></div>'+this.desc;9538};9539new Game.Upgrade('Box of maybe cookies','Contains an assortment of...something.<q>These may or may not be considered cookies.</q>',333000000000,[25,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];9540new Game.Upgrade('Box of not cookies','Contains an assortment of...something.<q>These are strictly, definitely not cookies.</q>',333000000000,[26,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];9541new Game.Upgrade('Box of pastries','Contains an assortment of delicious pastries.<q>These are a damn slippery slope is what they are!</q>',333000000000,[27,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];95429543order=10040;9544Game.NewUpgradeCookie({name:'Profiteroles',desc:'Also known as cream puffs, these pastries are light, fluffy, filled with whipped cream and fun to throw at people when snowballs are running scarce.',icon:[29,29],require:'Box of pastries', power:4,price: Math.pow(10,31)});9545Game.NewUpgradeCookie({name:'Jelly donut',desc:'Guaranteed to contain at least 0.3% jelly filling, or your money back.<br>You can still see the jelly stab wound!',icon:[27,28],require:'Box of pastries', power:4,price: Math.pow(10,33)});9546Game.NewUpgradeCookie({name:'Glazed donut',desc:'Absolutely gooey with sugar. The hole is the tastiest part!',icon:[28,28],require:'Box of pastries', power:4,price: Math.pow(10,35)});9547Game.NewUpgradeCookie({name:'Chocolate cake',desc:'The cake is a Portal reference!',icon:[25,27],require:'Box of pastries', power:4,price: Math.pow(10,37)});9548Game.NewUpgradeCookie({name:'Strawberry cake',desc:'It\'s not easy to come up with flavor text for something as generic as this, but some would say it\'s a piece of cake.',icon:[26,27],require:'Box of pastries', power:4,price: Math.pow(10,39)});9549Game.NewUpgradeCookie({name:'Apple pie',desc:'It is said that some grandmas go rogue and bake these instead.',icon:[25,28],require:'Box of pastries', power:4,price: Math.pow(10,41)});9550Game.NewUpgradeCookie({name:'Lemon meringue pie',desc:'Meringue is a finicky substance made of sugar and egg whites that requires specific atmospheric conditions to be baked at all. The lemon, as far as we can tell, isn\'t nearly as picky.',icon:[26,28],require:'Box of pastries', power:4,price: Math.pow(10,43)});9551Game.NewUpgradeCookie({name:'Butter croissant',desc:'Look around.<br>A rude man in a striped shirt bikes past you. He smells of cigarettes and café-au-lait. Somewhere, a mime uses his moustache to make fun of the British. 300 pigeons fly overhead.<br>Relax. You\'re experiencing croissant.',icon:[29,28],require:'Box of pastries', power:4,price: Math.pow(10,45)});95529553order=10050;9554Game.NewUpgradeCookie({name:'Cookie dough',desc:'Bursting with infinite potential, but can also be eaten as is. Arguably worth the salmonella.',icon:[25,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,35)});9555Game.NewUpgradeCookie({name:'Burnt cookie',desc:'This cookie flew too close to the sun and is now a shadow of its former self. If only you remembered to set a timer, you wouldn\'t have this tragedy on your hands...',icon:[23,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,37)});9556Game.NewUpgradeCookie({name:'A chocolate chip cookie but with the chips picked off for some reason',desc:'This has to be the saddest thing you\'ve ever seen.',icon:[24,30],require:'Box of maybe cookies', power:3,price: Math.pow(10,39)});9557Game.NewUpgradeCookie({name:'Flavor text cookie',desc:'What you\'re currently reading is what gives this cookie its inimitable flavor.',icon:[22,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,41)});9558Game.NewUpgradeCookie({name:'High-definition cookie',desc:'Uncomfortably detailed, like those weird stories your aunt keeps telling at parties.',icon:[28,10],require:'Box of maybe cookies', power:5,price: Math.pow(10,43)});95599560order=10060;9561Game.NewUpgradeCookie({name:'Toast',desc:'A crisp slice of bread, begging for some butter and jam.<br>Why do people keep proposing these at parties?',icon:[27,10],require:'Box of not cookies', power:4,price: Math.pow(10,34)});9562Game.NewUpgradeCookie({name:'Peanut butter & jelly',desc:'It\'s time.',icon:[29,9],require:'Box of not cookies', power:4,price: Math.pow(10,36)});9563Game.NewUpgradeCookie({name:'Wookies',desc:'These aren\'t the cookies you\'re looking for.',icon:[26,30],require:'Box of not cookies', power:4,price: Math.pow(10,38)});9564Game.NewUpgradeCookie({name:'Cheeseburger',desc:'Absolutely no relation to cookies whatsoever - Orteil just wanted an excuse to draw a cheeseburger.',icon:[28,30],require:'Box of not cookies', power:4,price: Math.pow(10,40)});9565Game.NewUpgradeCookie({name:'One lone chocolate chip',desc:'The start of something beautiful.',icon:[27,30],require:'Box of not cookies', power:1,price: Math.pow(10,42)});956695679568new Game.Upgrade('Genius accounting','Unlocks <b>extra price information</b>.<br>Each displayed cost now specifies how long it\'ll take you to afford it, and how much of your bank it represents.<q>There\'s no accounting for taste, and yet here we are.</q>',2000000,[11,10]);Game.last.pool='prestige';Game.last.parents=['Inspired checklist'];956995709571new Game.Upgrade('Shimmering veil','Unlocks the <b>shimmering veil</b>, a switch that passively boosts your CpS by <b>50%</b>.<br>You start with the veil turned on; however, it is very fragile, and clicking the big cookie or any golden cookie or reindeer will turn it off, requiring 24 hours of CpS to turn back on.<q>Hands off!</q>',999999999,[9,10]);Game.last.pool='prestige';Game.last.parents=['Distilled essence of redoubled luck'];95729573order=40005;9574var func=function(){9575var boost=50;9576var resist=0;9577if (Game.Has('Reinforced membrane')) {boost+=10;resist+=10;}9578return (this.name=='Shimmering veil [on]'?'<div style="text-align:center;">Active.</div><div class="line"></div>':'')+'Boosts your cookie production by <b>'+Beautify(boost)+'%</b> when active.<br>The veil is very fragile and will break if you click the big cookie or any golden cookies or reindeer.<br><br>Once broken, turning the veil back on costs 24 hours of unbuffed CpS.'+(resist>0?('<br><br>Has a <b>'+Beautify(resist)+'%</b> chance to not break.'):'');9579};9580new Game.Upgrade('Shimmering veil [off]','',1000000,[9,10]);9581Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [on]';9582Game.last.priceFunc=function(){return Game.unbuffedCps*60*60*24;}9583Game.last.descFunc=func;9584new Game.Upgrade('Shimmering veil [on]','',0,[9,10]);9585Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [off]';9586Game.last.descFunc=func;95879588Game.loseShimmeringVeil=function(context)9589{9590if (!Game.Has('Shimmering veil')) return false;9591if (!Game.Has('Shimmering veil [off]') && Game.Has('Shimmering veil [on]')) return false;9592if (Game.Has('Reinforced membrane'))9593{9594if (context=='shimmer') Math.seedrandom(Game.seed+'/'+Game.goldenClicks);9595else if (context=='click') Math.seedrandom(Game.seed+'/'+Game.cookieClicks);9596if (Math.random()<0.1)9597{9598Game.Notify('The reinforced membrane protects the shimmering veil.','',[7,10]);9599Game.Win('Thick-skinned');9600return false;9601}9602Math.seedrandom();9603}9604var me=Game.Upgrades['Shimmering veil [on]'];9605me.bought=1;9606//Game.Upgrades[me.toggleInto].bought=false;9607Game.Lock(me.toggleInto);9608Game.Unlock(me.toggleInto);9609Game.Notify('The shimmering veil disappears...','',[9,10]);9610Game.upgradesToRebuild=1;9611Game.recalculateGains=1;9612PlaySound('snd/spellFail.mp3',0.75);9613}961496159616var getCookiePrice=function(level){return 999999999999999999999999999999999999999*Math.pow(10,(level-1)/2);};96179618order=10020;9619Game.NewUpgradeCookie({name:'Whoopie pies',desc:'Two chocolate halves joined together by a cream filling. It\'s got no eyebrows, but you never noticed until now.',icon:[21,31],power: 5,price: getCookiePrice(1)});9620Game.NewUpgradeCookie({name:'Caramel wafer biscuits',desc:'Coated in delicious chocolate. As many layers as you\'ll get in a biscuit without involving onions.',icon:[22,31],power: 5,price: getCookiePrice(2)});9621Game.NewUpgradeCookie({name:'Chocolate chip mocha cookies',desc:'Mocha started out as an excuse to smuggle chocolate into coffee. And now, in a poignant display of diplomacy and cultural exchange, it\'s bringing coffee to chocolate cookies.',icon:[23,31],power: 5,price: getCookiePrice(3)});9622Game.NewUpgradeCookie({name:'Earl Grey cookies',desc:'Captain Picard\'s favorite.',icon:[24,31],power: 5,price: getCookiePrice(4)});9623Game.NewUpgradeCookie({name:'Corn syrup cookies',desc:'The corn syrup makes it extra chewy. Not the type of stuff you\'d think to put in a cookie, but bakers make do.',icon:[25,31],power: 5,price: getCookiePrice(5)});9624Game.NewUpgradeCookie({name:'Icebox cookies',desc:'Can be prepared in a variety of shapes with a variety of ingredients. Made by freezing dough before baking it, mirroring a time-proven medieval torture practice. Gotta keep them guessing.',icon:[26,31],power: 5,price: getCookiePrice(6)});9625Game.NewUpgradeCookie({name:'Graham crackers',desc:'Inspired in their design by the wish to live a life of austere temperance, free from pleasure or cheer; it\'s no wonder these are so tasty.',icon:[27,31],power: 5,price: getCookiePrice(7)});9626Game.NewUpgradeCookie({name:'Hardtack',desc:'Extremely hard and, if we\'re being honest, extremely tack.<br>If you\'re considering eating this as a fun snack, you probably have other things to worry about than this game, like getting scurvy or your crew fomenting mutiny.',icon:[28,31],power: 5,price: getCookiePrice(8)});9627Game.NewUpgradeCookie({name:'Cornflake cookies',desc:'They\'re grrrrrroovy! Careful not to let it sit in your milk too long, lest you accidentally end up with a bowl of cereal and get confused.',icon:[29,31],power: 5,price: getCookiePrice(9)});9628Game.NewUpgradeCookie({name:'Tofu cookies',desc:'There\'s really two ways to go with tofu cooking; either it asserts itself in plain sight or it camouflages itself in the other ingredients. This happens to be the latter, and as such, you can\'t really tell the difference between this and a regular cookie, save for that one pixel on the left.',icon:[30,31],power: 5,price: getCookiePrice(10)});9629Game.NewUpgradeCookie({name:'Gluten-free cookies',desc:'Made with browned butter and milk to closely match the archetypal chocolate chip cookie.<br>For celiacs, a chance to indulge in a delicious risk-free pastry. For others, a strangely threatening confection whose empty eyes will never know heaven nor hell.',icon:[30,30],power: 5,price: getCookiePrice(10)});9630Game.NewUpgradeCookie({name:'Russian bread cookies',desc:'Also known as alphabet cookies; while most bakers follow the recipe to the letter, it is said that some substitute the flour for spelt. But don\'t take my word for it.',icon:[30,29],power: 5,price: getCookiePrice(11)});9631Game.NewUpgradeCookie({name:'Lebkuchen',desc:'Diverse cookies from Germany, fragrant with honey and spices, often baked around Christmas.<br>Once worn by warriors of old for protection in battle.<br>+5 STR, +20% magic resistance.',icon:[30,28],power: 5,price: getCookiePrice(12)});9632Game.NewUpgradeCookie({name:'Aachener Printen',desc:'The honey once used to sweeten these gingerbread-like treats has since been swapped out for beet sugar, providing another sad example of regressive evolution.',icon:[30,27],power: 5,price: getCookiePrice(13)});9633Game.NewUpgradeCookie({name:'Canistrelli',desc:'A dry biscuit flavored with anise and wine, tough like the people of Corsica where it comes from.',icon:[30,26],power: 5,price: getCookiePrice(14)});9634Game.NewUpgradeCookie({name:'Nice biscuits',desc:'Made with coconut and perfect with tea. Traces its origins to a French city so nice they named it that.',icon:[30,25],power: 5,price: getCookiePrice(15)});9635Game.NewUpgradeCookie({name:'French pure butter cookies',desc:'You can\'t tell what\'s stronger coming off these - the smell of butter or condescension.',icon:[31,25],power: 5,price: getCookiePrice(16)});9636Game.NewUpgradeCookie({name:'Petit beurre',desc:'An unassuming biscuit whose name simply means "little butter". Famed and feared for its four ears and forty-eight teeth.<br>When it hears ya, it\'ll get ya...',icon:[31,26],power: 5,price: getCookiePrice(16)});9637Game.NewUpgradeCookie({name:'Nanaimo bars',desc:'A delicious no-bake pastry hailing from Canada. Probably beats eating straight-up snow with maple syrup poured on it, but what do I know.',icon:[31,27],power: 5,price: getCookiePrice(17)});9638Game.NewUpgradeCookie({name:'Berger cookies',desc:'Messily slathered with chocolate fudge, but one of the most popular bergers of Baltimore, along with the triple fried egg berger and the blue crab cheeseberger.',icon:[31,28],power: 5,price: getCookiePrice(18)});9639Game.NewUpgradeCookie({name:'Chinsuko',desc:'A little piece of Okinawa in cookie form. Part of a Japanese custom of selling sweets as souvenirs. But hey, pressed pennies are cool too.',icon:[31,29],power: 5,price: getCookiePrice(19)});9640Game.NewUpgradeCookie({name:'Panda koala biscuits',desc:'Assorted jungle animals with equally assorted fillings.<br>Comes in chocolate, strawberry, vanilla and green tea.<br>Eat them all before they go extinct!',icon:[31,13],power: 5,price: getCookiePrice(19)});9641Game.NewUpgradeCookie({name:'Putri salju',desc:'A beloved Indonesian pastry; its name means "snow princess", for the powdered sugar it\'s coated with. Had we added these to Cookie Clicker some years ago, this is where we\'d make a reference to that one Disney movie, but it\'s probably time to let it go.',icon:[31,30],power: 5,price: getCookiePrice(20)});9642Game.NewUpgradeCookie({name:'Milk cookies',desc:'Best eaten with a tall glass of chocolate.',icon:[31,31],power: 5,price: getCookiePrice(21)});96439644order=9999;9645Game.NewUpgradeCookie({name:'Cookie crumbs',desc:'There used to be a cookie here. Now there isn\'t.<br>Good heavens, what did you <i>DO?!</i>',icon:[30,13],power:1,require:'Legacy',price:100});9646Game.NewUpgradeCookie({name:'Chocolate chip cookie',desc:'This is the cookie you\'ve been clicking this whole time. It looks a bit dented and nibbled on, but it\'s otherwise good as new.',icon:[10,0],power:10,require:'Legacy',price:1000000000000});964796489649new Game.Upgrade('Cosmic beginner\'s luck','Prior to purchasing the <b>Heavenly chip secret</b> upgrade in a run, random drops are <b>5 times more common</b>.<q>Oh! A penny!<br>Oh! A priceless heirloom!<br>Oh! Another penny!</q>',999999999*15,[8,10]);Game.last.pool='prestige';Game.last.parents=['Shimmering veil'];9650new Game.Upgrade('Reinforced membrane','The <b>shimmering veil</b> is more resistant, and has a <b>10% chance</b> not to break. It also gives <b>+10%</b> more CpS.<q>A consistency between jellyfish and cling wrap.</q>',999999999*15,[7,10]);Game.last.pool='prestige';Game.last.parents=['Shimmering veil'];965196529653order=255;9654Game.GrandmaSynergy('Binary grandmas','A digital grandma to transfer more cookies.<br>(See also : boolean grandmas, string grandmas, and not-a-number grandmas, also known as "NaNs".)','Javascript console');96559656order=1400;9657new Game.TieredUpgrade('The JavaScript console for dummies','Javascript consoles are <b>twice</b> as efficient.<q>This should get you started. The first line reads: "To open the javascript console, press-"<br>...the rest of the book is soaked in chocolate milk. If only there was a way to look up this sort of information...</q>','Javascript console',1);9658new Game.TieredUpgrade('64bit arrays','Javascript consoles are <b>twice</b> as efficient.<q>A long-form variable type to pack your cookies much more efficiently.</q>','Javascript console',2);9659new Game.TieredUpgrade('Stack overflow','Javascript consoles are <b>twice</b> as efficient.<q>This is really bad! You probably forgot to close a loop somewhere and now your programs are going crazy! The rest of your engineers seem really excited about it somehow. How could a software mishap like a stack overflow possibly ever help anyone?</q>','Javascript console',3);9660new Game.TieredUpgrade('Enterprise compiler','Javascript consoles are <b>twice</b> as efficient.<q>This bespoke javascript compiler took your team years of development and billions in research, but it should let you execute (certain) functions (up to) 2% faster (in optimal circumstances).</q>','Javascript console',4);9661new Game.TieredUpgrade('Syntactic sugar','Javascript consoles are <b>twice</b> as efficient.<q>Tastier code for tastier cookies.</q>','Javascript console',5);9662new Game.TieredUpgrade('A nice cup of coffee','Javascript consoles are <b>twice</b> as efficient.<q>All this nerd stuff has you exhausted. You make yourself a nice cup of coffee, brewed with roasted beans from some far-away island. You may have been working a bit too hard though - the cup of coffee starts talking to you, insisting that it is NOT javascript.</q>','Javascript console',6);9663new Game.TieredUpgrade('Just-in-time baking','Javascript consoles are <b>twice</b> as efficient.<q>A new method of preparing cookies; they bake themselves right in front of the customers before eating, leaving your kitchens mess-free.</q>','Javascript console',7);9664new Game.TieredUpgrade('cookies++','Javascript consoles are <b>twice</b> as efficient.<q>Your very own cookie-themed programming language, elegantly named after its most interesting ability - increasing the "cookies" variable by 1.</q>','Javascript console',8);9665new Game.TieredUpgrade('Software updates','Javascript consoles are <b>twice</b> as efficient.<q>This is grand news - someone\'s finally figured out the Wifi password, and your newfound internet connection seems to have triggered a whole lot of software updates! Your browsers, drivers and plugins all received a fresh coat of paint, and your javascript version has been updated to the latest ECMAScript specification. It\'s really too bad thousands had to die due to some deprecated function in your neurotoxin ventilation code, but I guess that\'s progress for you.</q>','Javascript console',9);9666new Game.TieredUpgrade('Game.Loop','Javascript consoles are <b>twice</b> as efficient.<q>You\'re not quite sure what to make of this. What does it mean? What does it do? Who would leave something like that just laying around here? Try asking again in 1/30th of a second.</q>','Javascript console',10);9667new Game.TieredUpgrade('eval()','Javascript consoles are <b>twice</b> as efficient.<q>It is said that this simple function holds the key to the universe, and that whosoever masters it may shape reality to their will.<br>Good thing you have no idea how it works. Makes for a neat plaque on your wall, though.</q>','Javascript console',11);96689669order=5000;9670Game.SynergyUpgrade('Script grannies','<q>Armies of energy drink-fueled grandmas ready to hack into the cyberspace for renegade e-cookies.</q>','Javascript console','Grandma','synergy1');9671Game.SynergyUpgrade('Tombola computing','','Javascript console','Chancemaker','synergy2');9672Game.last.descFunc=function(){9673Math.seedrandom(Game.seed+'-tombolacomputing');9674var str='(Your ticket reads '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+', entitling you to '+choose([Math.floor(Math.random()*5+2)+' lines of javascript','one free use of Math.random()','one qubit, whatever that is','one half-eaten cookie','a brand new vacuum cleaner','most of one room-temperature cup of orange soda','one really good sandwich','one handful of pocket lint','someone\'s mostly clean hairpiece','a trip to a fancy restaurant','the knowledge of those numbers','a furtive glance at the news ticker','another ticket, half-price','all-you-can-eat moldy bread','one lifetime supply of oxygen','the color '+choose['red','orange','yellow','green','blue','purple','black','white','gray','brown','pink','teal'],'increased intellect for a limited time','an ancient runesword','the throne of a far-away country','the position of Mafia capo. Good luck','one free time-travel week-end','something beautiful','the deed to some oil well','one hamburger made out of the animal, plant, or person of your choice','the last surviving '+choose['dodo bird','thylacine','unicorn','dinosaur','neanderthal'],'a deep feeling of accomplishment','a fleeting tinge of entertainment','a vague sense of unease','deep existential dread','one extra week added to your lifespan','breathe manually','blink right here and now','one meeting with any famous person, living or dead, in your next dream','one very nice dream','a wacky sound effect','45 seconds of moral flexibility','hundreds and thousands, also known as "sprinkles"','one circle, triangle, square or other simple geometric shape, of average dimensions','just this extra bit of randomness','the extra push you needed to turn your life around','a good fright','one secret superpower','a better luck next time','an irrational phobia of tombola tickets','one whole spider','an increased sense of self-worth and determination','inner peace','one double-XP week-end in the MMORPG of your choice','a little piece of the universe, represented by the trillions of atoms that make up this very ticket','food poisoning','the Moon! Well, conceptually','a new car, baby','a new catchphrase','an intrusive thought of your choice','- ...aw man, it just cuts off there','the director spot for the next big hit movie','really good-looking calves','one genuine pirate golden doubloon','"treasure and riches", or something','one boat, sunken','baby shoes, never worn','direct lineage to some King or Queen','innate knowledge of a dead language you\'ll never encounter','the melody of a song you don\'t know the words to','white noise','mild physical impairment','a new pair of lips','things, and such','one popular expression bearing your name','one typo','one get-out-of-jail-free card','the rest of your life... for now','one polite huff','a condescending stare','one cursed monkey paw','true love, probably','an interesting factoid about the animal, country, TV show or celebrity of your choice','a pop culture reference','minutes of fun','the etymology of the word "tombola" - it\'s Italian for "a tumble"','nothing. You lost, sorry'])+'.)';9675Math.seedrandom();9676return this.desc+'<q>Like quantum computing, but more fun.<br>'+str+'</q>';9677};96789679order=10020;9680Game.NewUpgradeCookie({name:'Kruidnoten',desc:'A festive dutch favorite; tiny cinnamony bites sometimes coated in chocolate. The name translates roughly to "kruidnoten".',icon:[30,3],power: 5,price: getCookiePrice(22)});9681Game.NewUpgradeCookie({name:'Marie biscuits',desc:'Pleasantly round, smoothly buttery, subtly vanilla-flavored, ornately embossed, each ridge represents a person Marie killed in prison.',icon:[30,4],power: 5,price: getCookiePrice(23)});9682Game.NewUpgradeCookie({name:'Meringue cookies',desc:'Probably the most exciting thing you can make out of egg whites. Also called forgotten cookies, due to the recipe being once lost in a sealed mystical vault for 10,000 years.',icon:[31,4],power: 5,price: getCookiePrice(24)});96839684order=10060;9685Game.NewUpgradeCookie({name:'Pizza',desc:'What is a pizza if not a large, chewy cookie, frosted with a rather exuberant tomato & cheese icing? Not a cookie, that\'s what.',icon:[31,9],require:'Box of not cookies', power:5,price: Math.pow(10,44)});96869687order=10050;9688Game.NewUpgradeCookie({name:'Crackers',desc:'These are the non-flavored kind with no salt added. Really just a judgement-free wheat square begging to have bits of ham and spreadable cheese piled onto it, its main contribution being "crunchy".',icon:[30,9],require:'Box of maybe cookies', power:4,price: Math.pow(10,45)});96899690order=10030;9691Game.NewUpgradeCookie({name:'Havabreaks',desc:'You can snap the sections neatly or just bite into the whole thing like some kind of lunatic. Some oversea countries manufacture these in hundreds of unique flavors, such as green tea, lobster bisque, and dark chocolate.',icon:[31,3],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999*5});96929693order=20000;9694new Game.Upgrade('Kitten executives','You gain <b>more CpS</b> the more milk you have.<q>ready to execute whatever and whoever you\'d like, sir</q>',900000000000000000000000000000000000000000000,Game.GetIcon('Kitten',13));Game.last.kitten=1;Game.MakeTiered(Game.last,13,18);969596969697order=10020;9698Game.NewUpgradeCookie({name:'Chai tea cookies',desc:'Not exactly Captain Picard\'s favorite, but I mean, these will do in a pinch.',icon:[23,32],power: 5,price: getCookiePrice(4)+5});Game.last.order=10020.5685;96999700Game.NewUpgradeCookie({name:'Yogurt cookies',desc:'Augmented by the wonders of dairy, these cookies are light and fluffy and just one more thing for the lactose-intolerant to avoid.<br>Truly for the cultured among us.',icon:[24,32],power: 5,price: getCookiePrice(25)});9701Game.NewUpgradeCookie({name:'Thumbprint cookies',desc:'Filled with jam and sometimes served in little paper cups. No longer admissible as biometric evidence in court. We\'re not having a repeat of that whole mess.',icon:[25,32],power: 5,price: getCookiePrice(26)});9702Game.NewUpgradeCookie({name:'Pizzelle',desc:'Thin, crisp waffle cookies baked in a bespoke iron following an ancient Italian recipe.<br>These cookies have been around for a long, long time.<br>These cookies have seen things.',icon:[26,32],power: 5,price: getCookiePrice(27)});97039704order=10030;9705Game.NewUpgradeCookie({name:'Zilla wafers',desc:'Popular vanilla-flavored biscuits that somehow keep ending up in banana pudding.<br>Themed after a beloved radioactive prehistoric monster, for some reason.',icon:[22,32],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999999*5});9706Game.NewUpgradeCookie({name:'Dim Dams',desc:'Two biscuits joined by chocolate and coated in even more chocolate.<br>You wonder - which one is the dim, and which one is the dam?',icon:[31,10],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999999*5});97079708order=10060;9709Game.NewUpgradeCookie({name:'Candy',desc:'There are two pillars to the world of sweets : pastries, of course - and candy.<br>You could make a whole new game just about these, but for now, please enjoy these assorted generic candies.',icon:[30,10],require:'Box of not cookies', power:5,price: Math.pow(10,46)});971097119712order=19000;9713new Game.TieredUpgrade('Fortune #001','Cursors are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Fingers are not the only thing you can count on.</q>','Cursor','fortune');9714new Game.TieredUpgrade('Fortune #002','Grandmas are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>A wrinkle is a crack in a mundane facade.</q>','Grandma','fortune');9715new Game.TieredUpgrade('Fortune #003','Farms are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The seeds of tomorrow already lie within the seeds of today.</q>','Farm','fortune');9716new Game.TieredUpgrade('Fortune #004','Mines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Riches from deep under elevate you all the same.</q>','Mine','fortune');9717new Game.TieredUpgrade('Fortune #005','Factories are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>True worth is not in what you find, but in what you make.</q>','Factory','fortune');9718new Game.TieredUpgrade('Fortune #006','Banks are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The value of money means nothing to a pocket.</q>','Bank','fortune');9719new Game.TieredUpgrade('Fortune #007','Temples are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Not all guides deserve worship.</q>','Temple','fortune');9720new Game.TieredUpgrade('Fortune #008','Wizard towers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Magic is about two things - showmanship, and rabbits.</q>','Wizard tower','fortune');9721new Game.TieredUpgrade('Fortune #009','Shipments are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Every mile travelled expands the mind by just as much.</q>','Shipment','fortune');9722new Game.TieredUpgrade('Fortune #010','Alchemy labs are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Don\'t get used to yourself. You\'re gonna have to change.</q>','Alchemy lab','fortune');9723new Game.TieredUpgrade('Fortune #011','Portals are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Every doorway is a gamble. Tread with care.</q>','Portal','fortune');9724new Game.TieredUpgrade('Fortune #012','Time machines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Do your future self a favor; they\'ll thank you for it.</q>','Time machine','fortune');9725new Game.TieredUpgrade('Fortune #013','Antimatter condensers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The world is made of what we put into it.</q>','Antimatter condenser','fortune');9726new Game.TieredUpgrade('Fortune #014','Prisms are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Staring at a dazzling light can blind you back to darkness.</q>','Prism','fortune');9727new Game.TieredUpgrade('Fortune #015','Chancemakers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Don\'t leave to blind chance what you could accomplish with deaf skill.</q>','Chancemaker','fortune');9728new Game.TieredUpgrade('Fortune #016','Fractal engines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>It\'s good to see yourself in others. Remember to see yourself in yourself, too.</q>','Fractal engine','fortune');9729new Game.TieredUpgrade('Fortune #017','Javascript consoles are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>If things aren\'t working out for you, rewrite the rules.</q>','Javascript console','fortune');973097319732order=19100;9733//note : price for these capped to base price OR 1 day of unbuffed CpS9734new Game.Upgrade('Fortune #100','Upgrades and buildings cost <b>-1%</b>; you gain <b>+1%</b> CpS.<q>True wealth is counted in gifts.</q>',9735Game.Tiers['fortune'].price*100000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);9736Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}9737new Game.Upgrade('Fortune #101','You gain <b>+7%</b> CpS.<q>Some people dream of fortunes; others dream of cookies.</q>',Game.Tiers['fortune'].price*100000000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);9738Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}9739new Game.Upgrade('Fortune #102','You gain <b>+1%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<q>Help, I\'m trapped in a browser game!</q>',Game.Tiers['fortune'].price*100000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);9740Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}9741new Game.Upgrade('Fortune #103','You gain <b>more CpS</b> the more milk you have.<q>Don\'t believe the superstitions; all cats are good luck.</q>',Game.Tiers['fortune'].price*100000000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',18);Game.last.kitten=1;9742Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}9743new Game.Upgrade('Fortune #104','Clicking gains <b>+1% of your CpS</b>.<q>Remember to stay in touch.</q>',Game.Tiers['fortune'].price*100000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',11);9744Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}97459746new Game.Upgrade('Fortune cookies','The news ticker may occasionally have <b>fortunes</b>, which may be clicked for something good.<q>These don\'t taste all that great but that\'s not really the point, is it?</q>',77777777777,[29,8]);Game.last.pool='prestige';Game.last.parents=['Distilled essence of redoubled luck'];974797489749//end of upgrades97509751Game.seasons={9752'christmas':{name:'Christmas',start:'Christmas season has started!',over:'Christmas season is over.',trigger:'Festive biscuit'},9753'valentines':{name:'Valentine\'s day',start:'Valentine\'s day has started!',over:'Valentine\'s day is over.',trigger:'Lovesick biscuit'},9754'fools':{name:'Business day',start:'Business day has started!',over:'Business day is over.',trigger:'Fool\'s biscuit'},9755'easter':{name:'Easter',start:'Easter season has started!',over:'Easter season is over.',trigger:'Bunny biscuit'},9756'halloween':{name:'Halloween',start:'Halloween has started!',over:'Halloween is over.',trigger:'Ghostly biscuit'}9757};97589759Game.listTinyOwnedUpgrades=function(arr)9760{9761var str='';9762for (var i=0;i<arr.length;i++)9763{9764if (Game.Has(arr[i]))9765{9766var it=Game.Upgrades[arr[i]];9767str+='<div class="icon" style="vertical-align:middle;display:inline-block;'+(it.icon[2]?'background-image:url('+it.icon[2]+');':'')+'background-position:'+(-it.icon[0]*48)+'px '+(-it.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div>';9768}9769}9770return str;9771}97729773Game.santaDrops=['Increased merriness','Improved jolliness','A lump of coal','An itchy sweater','Reindeer baking grounds','Weighted sleighs','Ho ho ho-flavored frosting','Season savings','Toy workshop','Naughty list','Santa\'s bottomless bag','Santa\'s helpers','Santa\'s legacy','Santa\'s milk and cookies'];97749775Game.GetHowManySantaDrops=function()9776{9777var num=0;9778for (var i in Game.santaDrops) {if (Game.Has(Game.santaDrops[i])) num++;}9779return num;9780}97819782Game.reindeerDrops=['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits'];9783Game.GetHowManyReindeerDrops=function()9784{9785var num=0;9786for (var i in Game.reindeerDrops) {if (Game.Has(Game.reindeerDrops[i])) num++;}9787return num;9788}9789/*for (var i in Game.santaDrops)9790{9791Game.Upgrades[Game.santaDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManySantaDrops()+'/'+Game.santaDrops.length+'</b> of Santa\'s gifts.</div><div class="line"></div>'+this.desc;};9792}*/97939794Game.seasonDrops=Game.heartDrops.concat(Game.halloweenDrops).concat(Game.easterEggs).concat(Game.santaDrops).concat(Game.reindeerDrops);97959796Game.saySeasonSwitchUses=function()9797{9798if (Game.seasonUses==0) return 'You haven\'t switched seasons this ascension yet.';9799return 'You\'ve switched seasons <b>'+(Game.seasonUses==1?'once':Game.seasonUses==2?'twice':(Game.seasonUses+' times'))+'</b> this ascension.';9800}9801Game.Upgrades['Festive biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.santaDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManySantaDrops()+'/'+Game.santaDrops.length+'</b> of Santa\'s gifts.<div class="line"></div>'+Game.listTinyOwnedUpgrades(Game.reindeerDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyReindeerDrops()+'/'+Game.reindeerDrops.length+'</b> reindeer cookies.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};9802Game.Upgrades['Bunny biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.easterEggs)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyEggs()+'/'+Game.easterEggs.length+'</b> eggs.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};9803Game.Upgrades['Ghostly biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.halloweenDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyHalloweenDrops()+'/'+Game.halloweenDrops.length+'</b> halloween cookies.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};9804Game.Upgrades['Lovesick biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.heartDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyHeartDrops()+'/'+Game.heartDrops.length+'</b> heart biscuits.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};9805Game.Upgrades['Fool\'s biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};98069807Game.computeSeasonPrices=function()9808{9809for (var i in Game.seasons)9810{9811Game.seasons[i].triggerUpgrade.priceFunc=function(){9812var m=1;9813if (Game.hasGod)9814{9815var godLvl=Game.hasGod('seasons');9816if (godLvl==1) m*=2;9817else if (godLvl==2) m*=1.50;9818else if (godLvl==3) m*=1.25;9819}9820//return Game.seasonTriggerBasePrice*Math.pow(2,Game.seasonUses)*m;9821//return Game.cookiesPs*60*Math.pow(1.5,Game.seasonUses)*m;9822return Game.seasonTriggerBasePrice+Game.unbuffedCps*60*Math.pow(1.5,Game.seasonUses)*m;9823}9824}9825}9826Game.computeSeasons=function()9827{9828for (var i in Game.seasons)9829{9830var me=Game.Upgrades[Game.seasons[i].trigger];9831Game.seasons[i].triggerUpgrade=me;9832me.pool='toggle';9833me.buyFunction=function()9834{9835Game.seasonUses+=1;9836Game.computeSeasonPrices();9837//Game.Lock(this.name);9838for (var i in Game.seasons)9839{9840var me=Game.Upgrades[Game.seasons[i].trigger];9841if (me.name!=this.name) {Game.Lock(me.name);Game.Unlock(me.name);}9842}9843if (Game.season!='' && Game.season!=this.season)9844{9845var str=Game.seasons[Game.season].over+'<div class="line"></div>';9846if (Game.prefs.popups) Game.Popup(str);9847else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon,4);9848}9849Game.season=this.season;9850Game.seasonT=Game.getSeasonDuration();9851Game.storeToRefresh=1;9852Game.upgradesToRebuild=1;9853Game.Objects['Grandma'].redraw();9854var str=Game.seasons[this.season].start+'<div class="line"></div>';9855if (Game.prefs.popups) Game.Popup(str);9856else Game.Notify(str,'',this.icon,4);9857}98589859me.clickFunction=function(me){return function()9860{9861//undo season9862if (me.bought && Game.season && me==Game.seasons[Game.season].triggerUpgrade)9863{9864me.lose();9865var str=Game.seasons[Game.season].over;9866if (Game.prefs.popups) Game.Popup(str);9867else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);9868if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}98699870Game.upgradesToRebuild=1;9871Game.recalculateGains=1;9872Game.season=Game.baseSeason;9873Game.seasonT=-1;9874PlaySound('snd/tick.mp3');9875return false;9876}9877else return true;9878};}(me);98799880me.displayFuncWhenOwned=function(){return '<div style="text-align:center;">Time remaining :<br><b>'+(Game.Has('Eternal seasons')?'forever':Game.sayTime(Game.seasonT,-1))+'</b><div style="font-size:80%;">(Click again to cancel season)</div></div>';}9881me.timerDisplay=function(upgrade){return function(){if (!Game.Upgrades[upgrade.name].bought || Game.Has('Eternal seasons')) return -1; else return 1-Game.seasonT/Game.getSeasonDuration();}}(me);98829883}9884}9885Game.getSeasonDuration=function(){return Game.fps*60*60*24;}9886Game.computeSeasons();98879888//alert untiered building upgrades9889for (var i in Game.Upgrades)9890{9891var me=Game.Upgrades[i];9892if (me.order>=200 && me.order<2000 && !me.tier && me.name.indexOf('grandma')==-1 && me.pool!='prestige') console.log(me.name+' has no tier.');9893}98949895Game.UpgradesByPool=[];9896for (var i in Game.Upgrades)9897{9898if (!Game.UpgradesByPool[Game.Upgrades[i].pool]) Game.UpgradesByPool[Game.Upgrades[i].pool]=[];9899Game.UpgradesByPool[Game.Upgrades[i].pool].push(Game.Upgrades[i]);9900}99019902Game.PrestigeUpgrades=[];9903for (var i in Game.Upgrades)9904{9905if (Game.Upgrades[i].pool=='prestige' || Game.Upgrades[i].pool=='prestigeDecor')9906{9907Game.PrestigeUpgrades.push(Game.Upgrades[i]);9908Game.Upgrades[i].posX=0;9909Game.Upgrades[i].posY=0;9910if (Game.Upgrades[i].parents.length==0 && Game.Upgrades[i].name!='Legacy') Game.Upgrades[i].parents=['Legacy'];9911Game.Upgrades[i].parents=Game.Upgrades[i].parents||[-1];9912for (var ii in Game.Upgrades[i].parents) {if (Game.Upgrades[i].parents[ii]!=-1) Game.Upgrades[i].parents[ii]=Game.Upgrades[Game.Upgrades[i].parents[ii]];}9913}9914}99159916Game.goldenCookieUpgrades=['Get lucky','Lucky day','Serendipity','Heavenly luck','Lasting fortune','Decisive fate','Lucky digit','Lucky number','Lucky payout','Golden goose egg'];99179918Game.cookieUpgrades=[];9919for (var i in Game.Upgrades)9920{9921var me=Game.Upgrades[i];9922if ((me.pool=='cookie' || me.pseudoCookie)) Game.cookieUpgrades.push(me);9923if (me.tier) Game.Tiers[me.tier].upgrades.push(me);9924}9925for (var i in Game.UnlockAt){Game.Upgrades[Game.UnlockAt[i].name].unlockAt=Game.UnlockAt[i];}9926for (var i in Game.Upgrades){if (Game.Upgrades[i].pool=='prestige') Game.Upgrades[i].order=Game.Upgrades[i].id;}99279928/*var oldPrestigePrices={"Chimera":5764801,"Synergies Vol. I":2525,"Synergies Vol. II":252525,"Label printer":9999};9929for (var i in oldPrestigePrices){Game.Upgrades[i].basePrice=oldPrestigePrices[i];}*/99309931Game.UpgradePositions={141:[176,-66],181:[-555,-93],253:[-272,-231],254:[-99,-294],255:[-193,-279],264:[48,123],265:[133,154],266:[223,166],267:[305,137],268:[382,85],269:[-640,42],270:[-614,-268],271:[-728,-120],272:[-688,-205],273:[-711,-31],274:[270,-328],275:[317,-439],276:[333,-556],277:[334,-676],278:[333,-796],279:[328,-922],280:[303,-1040],281:[194,-230],282:[-265,212],283:[-321,297],284:[-322,406],285:[-243,501],286:[-403,501],287:[-314,606],288:[-312,-374],289:[-375,-502],290:[-206,-476],291:[453,-745],292:[-375,-651],293:[-399,-794],323:[-86,120],325:[192,-1127],326:[-328,-158],327:[-192,290],328:[-3,237],329:[92,376],353:[121,-326],354:[77,-436],355:[64,-548],356:[57,-673],357:[52,-793],358:[58,-924],359:[82,-1043],360:[-188,408],362:[158,289],363:[-30,-30],364:[-232,-730],365:[-77,349],368:[-82,-532],393:[196,-714],394:[197,-964],395:[-143,-140],396:[-264,-889],397:[-69,563],408:[-204,-1036],409:[-72,-1152],410:[-70,-1328],411:[-388,137],412:[-470,253],413:[-482,389],449:[-367,-1113],450:[-334,-1214],451:[-278,-1303],495:[-402,-966],496:[200,49],505:[-545,-570],520:[-279,-8],537:[-907,-131],539:[-508,-1270],540:[-629,-1291],541:[-594,-1186],542:[-548,-1374],561:[300,-17],562:[52,646],591:[154,744],592:[180,608],643:[-121,710],};99329933for (var i in Game.UpgradePositions) {Game.UpgradesById[i].posX=Game.UpgradePositions[i][0];Game.UpgradesById[i].posY=Game.UpgradePositions[i][1];}993499359936/*=====================================================================================9937ACHIEVEMENTS9938=======================================================================================*/9939Game.Achievements=[];9940Game.AchievementsById=[];9941Game.AchievementsN=0;9942Game.AchievementsOwned=0;9943Game.Achievement=function(name,desc,icon)9944{9945this.id=Game.AchievementsN;9946this.name=name;9947this.desc=desc;9948this.baseDesc=this.desc;9949this.desc=BeautifyInText(this.baseDesc);9950this.icon=icon;9951this.won=0;9952this.disabled=0;9953this.order=this.id;9954if (order) this.order=order+this.id*0.001;9955this.pool='normal';9956this.vanilla=Game.vanilla;9957this.type='achievement';99589959this.click=function()9960{9961if (this.clickFunction) this.clickFunction();9962}9963Game.last=this;9964Game.Achievements[this.name]=this;9965Game.AchievementsById[this.id]=this;9966Game.AchievementsN++;9967return this;9968}99699970Game.Win=function(what)9971{9972if (typeof what==='string')9973{9974if (Game.Achievements[what])9975{9976if (Game.Achievements[what].won==0)9977{9978var name=Game.Achievements[what].shortName?Game.Achievements[what].shortName:Game.Achievements[what].name;9979Game.Achievements[what].won=1;9980if (Game.prefs.popups) Game.Popup('Achievement unlocked :<br>'+name);9981else Game.Notify('Achievement unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+name+'</div>',Game.Achievements[what].icon);9982if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned++;9983Game.recalculateGains=1;9984}9985}9986}9987else {for (var i in what) {Game.Win(what[i]);}}9988}9989Game.RemoveAchiev=function(what)9990{9991if (Game.Achievements[what])9992{9993if (Game.Achievements[what].won==1)9994{9995Game.Achievements[what].won=0;9996if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned--;9997Game.recalculateGains=1;9998}9999}10000}10001Game.Achievement.prototype.toggle=function()//cheating only10002{10003if (!this.won)10004{10005Game.Win(this.name);10006}10007else10008{10009Game.RemoveAchiev(this.name);10010}10011if (Game.onMenu=='stats') Game.UpdateMenu();10012}1001310014Game.CountsAsAchievementOwned=function(pool)10015{10016if (pool=='' || pool=='normal') return true; else return false;10017}1001810019Game.HasAchiev=function(what)10020{10021return (Game.Achievements[what]?Game.Achievements[what].won:0);10022}1002310024Game.TieredAchievement=function(name,desc,building,tier)10025{10026var achiev=new Game.Achievement(name,desc,Game.GetIcon(building,tier));10027Game.SetTier(building,tier);10028return achiev;10029}1003010031Game.ProductionAchievement=function(name,building,tier,q,mult)10032{10033var building=Game.Objects[building];10034var icon=[building.iconColumn,22];10035var n=12+building.n+(mult||0);10036if (tier==2) {icon[1]=23;n+=7;}10037else if (tier==3) {icon[1]=24;n+=14;}10038var pow=Math.pow(10,n);10039var achiev=new Game.Achievement(name,'Make <b>'+Beautify(pow)+'</b> cookies just from '+building.plural+'.'+(q?'<q>'+q+'</q>':''),icon);10040building.productionAchievs.push({pow:pow,achiev:achiev});10041return achiev;10042}1004310044Game.thresholdIcons=[0,1,2,3,4,5,6,7,8,9,10,11,18,19,20,21,22,23,24,25,26,27,28,29,21,22,23,24,25,26,27,28,29,21,22,23,24,25,26,27,28,29];10045Game.BankAchievements=[];10046Game.BankAchievement=function(name)10047{10048var threshold=Math.pow(10,Math.floor(Game.BankAchievements.length*1.5+2));10049if (Game.BankAchievements.length==0) threshold=1;10050var achiev=new Game.Achievement(name,'Bake <b>'+Beautify(threshold)+'</b> cookie'+(threshold==1?'':'s')+' in one ascension.',[Game.thresholdIcons[Game.BankAchievements.length],(Game.BankAchievements.length>32?1:Game.BankAchievements.length>23?2:5)]);10051achiev.threshold=threshold;10052achiev.order=100+Game.BankAchievements.length*0.01;10053Game.BankAchievements.push(achiev);10054return achiev;10055}10056Game.CpsAchievements=[];10057Game.CpsAchievement=function(name)10058{10059var threshold=Math.pow(10,Math.floor(Game.CpsAchievements.length*1.2));10060//if (Game.CpsAchievements.length==0) threshold=1;10061var achiev=new Game.Achievement(name,'Bake <b>'+Beautify(threshold)+'</b> cookie'+(threshold==1?'':'s')+' per second.',[Game.thresholdIcons[Game.CpsAchievements.length],(Game.CpsAchievements.length>32?1:Game.CpsAchievements.length>23?2:5)]);10062achiev.threshold=threshold;10063achiev.order=200+Game.CpsAchievements.length*0.01;10064Game.CpsAchievements.push(achiev);10065return achiev;10066}1006710068//define achievements10069//WARNING : do NOT add new achievements in between, this breaks the saves. Add them at the end !1007010071var order=0;//this is used to set the order in which the items are listed1007210073Game.BankAchievement('Wake and bake');10074Game.BankAchievement('Making some dough');10075Game.BankAchievement('So baked right now');10076Game.BankAchievement('Fledgling bakery');10077Game.BankAchievement('Affluent bakery');10078Game.BankAchievement('World-famous bakery');10079Game.BankAchievement('Cosmic bakery');10080Game.BankAchievement('Galactic bakery');10081Game.BankAchievement('Universal bakery');10082Game.BankAchievement('Timeless bakery');10083Game.BankAchievement('Infinite bakery');10084Game.BankAchievement('Immortal bakery');10085Game.BankAchievement('Don\'t stop me now');10086Game.BankAchievement('You can stop now');10087Game.BankAchievement('Cookies all the way down');10088Game.BankAchievement('Overdose');1008910090Game.CpsAchievement('Casual baking');10091Game.CpsAchievement('Hardcore baking');10092Game.CpsAchievement('Steady tasty stream');10093Game.CpsAchievement('Cookie monster');10094Game.CpsAchievement('Mass producer');10095Game.CpsAchievement('Cookie vortex');10096Game.CpsAchievement('Cookie pulsar');10097Game.CpsAchievement('Cookie quasar');10098Game.CpsAchievement('Oh hey, you\'re still here');10099Game.CpsAchievement('Let\'s never bake again');1010010101order=30010;10102new Game.Achievement('Sacrifice','Ascend with <b>1 million</b> cookies baked.<q>Easy come, easy go.</q>',[11,6]);10103new Game.Achievement('Oblivion','Ascend with <b>1 billion</b> cookies baked.<q>Back to square one.</q>',[11,6]);10104new Game.Achievement('From scratch','Ascend with <b>1 trillion</b> cookies baked.<q>It\'s been fun.</q>',[11,6]);1010510106order=11010;10107new Game.Achievement('Neverclick','Make <b>1 million</b> cookies by only having clicked <b>15 times</b>.',[12,0]);//Game.last.pool='shadow';10108order=1000;10109new Game.Achievement('Clicktastic','Make <b>1,000</b> cookies from clicking.',[11,0]);10110new Game.Achievement('Clickathlon','Make <b>100,000</b> cookies from clicking.',[11,1]);10111new Game.Achievement('Clickolympics','Make <b>10,000,000</b> cookies from clicking.',[11,2]);10112new Game.Achievement('Clickorama','Make <b>1,000,000,000</b> cookies from clicking.',[11,13]);1011310114order=1050;10115new Game.Achievement('Click','Have <b>1</b> cursor.',[0,0]);10116new Game.Achievement('Double-click','Have <b>2</b> cursors.',[0,6]);10117new Game.Achievement('Mouse wheel','Have <b>50</b> cursors.',[1,6]);10118new Game.Achievement('Of Mice and Men','Have <b>100</b> cursors.',[0,1]);10119new Game.Achievement('The Digital','Have <b>200</b> cursors.',[0,2]);1012010121order=1100;10122new Game.Achievement('Just wrong','Sell a grandma.<q>I thought you loved me.</q>',[10,9]);10123Game.TieredAchievement('Grandma\'s cookies','Have <b>1</b> grandma.','Grandma',1);10124Game.TieredAchievement('Sloppy kisses','Have <b>50</b> grandmas.','Grandma',2);10125Game.TieredAchievement('Retirement home','Have <b>100</b> grandmas.','Grandma',3);1012610127order=1200;10128Game.TieredAchievement('My first farm','Have <b>1</b> farm.','Farm',1);10129Game.TieredAchievement('Reap what you sow','Have <b>50</b> farms.','Farm',2);10130Game.TieredAchievement('Farm ill','Have <b>100</b> farms.','Farm',3);1013110132order=1400;10133Game.TieredAchievement('Production chain','Have <b>1</b> factory.','Factory',1);10134Game.TieredAchievement('Industrial revolution','Have <b>50</b> factories.','Factory',2);10135Game.TieredAchievement('Global warming','Have <b>100</b> factories.','Factory',3);1013610137order=1300;10138Game.TieredAchievement('You know the drill','Have <b>1</b> mine.','Mine',1);10139Game.TieredAchievement('Excavation site','Have <b>50</b> mines.','Mine',2);10140Game.TieredAchievement('Hollow the planet','Have <b>100</b> mines.','Mine',3);1014110142order=1500;10143Game.TieredAchievement('Expedition','Have <b>1</b> shipment.','Shipment',1);10144Game.TieredAchievement('Galactic highway','Have <b>50</b> shipments.','Shipment',2);10145Game.TieredAchievement('Far far away','Have <b>100</b> shipments.','Shipment',3);1014610147order=1600;10148Game.TieredAchievement('Transmutation','Have <b>1</b> alchemy lab.','Alchemy lab',1);10149Game.TieredAchievement('Transmogrification','Have <b>50</b> alchemy labs.','Alchemy lab',2);10150Game.TieredAchievement('Gold member','Have <b>100</b> alchemy labs.','Alchemy lab',3);1015110152order=1700;10153Game.TieredAchievement('A whole new world','Have <b>1</b> portal.','Portal',1);10154Game.TieredAchievement('Now you\'re thinking','Have <b>50</b> portals.','Portal',2);10155Game.TieredAchievement('Dimensional shift','Have <b>100</b> portals.','Portal',3);1015610157order=1800;10158Game.TieredAchievement('Time warp','Have <b>1</b> time machine.','Time machine',1);10159Game.TieredAchievement('Alternate timeline','Have <b>50</b> time machines.','Time machine',2);10160Game.TieredAchievement('Rewriting history','Have <b>100</b> time machines.','Time machine',3);101611016210163order=7000;10164new Game.Achievement('One with everything','Have <b>at least 1</b> of every building.',[2,7]);10165new Game.Achievement('Mathematician','Have at least <b>1 of the most expensive object, 2 of the second-most expensive, 4 of the next</b> and so on (capped at 128).',[23,12]);10166new Game.Achievement('Base 10','Have at least <b>10 of the most expensive object, 20 of the second-most expensive, 30 of the next</b> and so on.',[23,12]);1016710168order=10000;10169new Game.Achievement('Golden cookie','Click a <b>golden cookie</b>.',[10,14]);10170new Game.Achievement('Lucky cookie','Click <b>7 golden cookies</b>.',[22,6]);10171new Game.Achievement('A stroke of luck','Click <b>27 golden cookies</b>.',[23,6]);1017210173order=30200;10174new Game.Achievement('Cheated cookies taste awful','Hack in some cookies.',[10,6]);Game.last.pool='shadow';10175order=11010;10176new Game.Achievement('Uncanny clicker','Click really, really fast.<q>Well I\'ll be!</q>',[12,0]);1017710178order=5000;10179new Game.Achievement('Builder','Own <b>100</b> buildings.',[2,6]);10180new Game.Achievement('Architect','Own <b>500</b> buildings.',[3,6]);10181order=6000;10182new Game.Achievement('Enhancer','Purchase <b>20</b> upgrades.',[9,0]);10183new Game.Achievement('Augmenter','Purchase <b>50</b> upgrades.',[9,1]);1018410185order=11000;10186new Game.Achievement('Cookie-dunker','Dunk the cookie.<q>You did it!</q>',[1,8]);1018710188order=10000;10189new Game.Achievement('Fortune','Click <b>77 golden cookies</b>.<q>You should really go to bed.</q>',[24,6]);10190order=31000;10191new Game.Achievement('True Neverclick','Make <b>1 million</b> cookies with <b>no</b> cookie clicks.<q>This kinda defeats the whole purpose, doesn\'t it?</q>',[12,0]);Game.last.pool='shadow';1019210193order=20000;10194new Game.Achievement('Elder nap','Appease the grandmatriarchs at least <b>once</b>.<q>we<br>are<br>eternal</q>',[8,9]);10195new Game.Achievement('Elder slumber','Appease the grandmatriarchs at least <b>5 times</b>.<q>our mind<br>outlives<br>the universe</q>',[8,9]);1019610197order=1150;10198new Game.Achievement('Elder','Own at least <b>7</b> grandma types.',[10,9]);1019910200order=20000;10201new Game.Achievement('Elder calm','Declare a covenant with the grandmatriarchs.<q>we<br>have<br>fed</q>',[8,9]);1020210203order=5000;10204new Game.Achievement('Engineer','Own <b>1000</b> buildings.',[4,6]);1020510206order=10000;10207new Game.Achievement('Leprechaun','Click <b>777 golden cookies</b>.',[25,6]);10208new Game.Achievement('Black cat\'s paw','Click <b>7777 golden cookies</b>.',[26,6]);1020910210order=30050;10211new Game.Achievement('Nihilism','Ascend with <b>1 quadrillion</b> cookies baked.<q>There are many things<br>that need to be erased</q>',[11,7]);1021210213order=1900;10214Game.TieredAchievement('Antibatter','Have <b>1</b> antimatter condenser.','Antimatter condenser',1);10215Game.TieredAchievement('Quirky quarks','Have <b>50</b> antimatter condensers.','Antimatter condenser',2);10216Game.TieredAchievement('It does matter!','Have <b>100</b> antimatter condensers.','Antimatter condenser',3);1021710218order=6000;10219new Game.Achievement('Upgrader','Purchase <b>100</b> upgrades.',[9,2]);1022010221order=7000;10222new Game.Achievement('Centennial','Have at least <b>100 of everything</b>.',[6,6]);1022310224order=30500;10225new Game.Achievement('Hardcore','Get to <b>1 billion</b> cookies baked with <b>no upgrades purchased</b>.',[12,6]);//Game.last.pool='shadow';1022610227order=30600;10228new Game.Achievement('Speed baking I','Get to <b>1 million</b> cookies baked in <b>35 minutes</b>.',[12,5]);Game.last.pool='shadow';10229new Game.Achievement('Speed baking II','Get to <b>1 million</b> cookies baked in <b>25 minutes</b>.',[13,5]);Game.last.pool='shadow';10230new Game.Achievement('Speed baking III','Get to <b>1 million</b> cookies baked in <b>15 minutes</b>.',[14,5]);Game.last.pool='shadow';102311023210233order=61000;10234var achiev=new Game.Achievement('Getting even with the oven','Defeat the <b>Sentient Furnace</b> in the factory dungeons.',[12,7]);Game.last.pool='dungeon';10235var achiev=new Game.Achievement('Now this is pod-smashing','Defeat the <b>Ascended Baking Pod</b> in the factory dungeons.',[12,7]);Game.last.pool='dungeon';10236var achiev=new Game.Achievement('Chirped out','Find and defeat <b>Chirpy</b>, the dysfunctionning alarm bot.',[13,7]);Game.last.pool='dungeon';10237var achiev=new Game.Achievement('Follow the white rabbit','Find and defeat the elusive <b>sugar bunny</b>.',[14,7]);Game.last.pool='dungeon';1023810239order=1000;10240new Game.Achievement('Clickasmic','Make <b>100,000,000,000</b> cookies from clicking.',[11,14]);1024110242order=1100;10243Game.TieredAchievement('Friend of the ancients','Have <b>150</b> grandmas.','Grandma',4);10244Game.TieredAchievement('Ruler of the ancients','Have <b>200</b> grandmas.','Grandma',5);1024510246order=32000;10247new Game.Achievement('Wholesome','Unlock <b>100%</b> of your heavenly chips power.',[15,7]);1024810249order=33000;10250new Game.Achievement('Just plain lucky','You have <b>1 chance in 500,000</b> every second of earning this achievement.',[15,6]);Game.last.pool='shadow';1025110252order=21000;10253new Game.Achievement('Itchscratcher','Burst <b>1 wrinkler</b>.',[19,8]);10254new Game.Achievement('Wrinklesquisher','Burst <b>50 wrinklers</b>.',[19,8]);10255new Game.Achievement('Moistburster','Burst <b>200 wrinklers</b>.',[19,8]);1025610257order=22000;10258new Game.Achievement('Spooky cookies','Unlock <b>every Halloween-themed cookie</b>.<div class="line"></div>Owning this achievement makes Halloween-themed cookies drop more frequently in future playthroughs.',[12,8]);1025910260order=22100;10261new Game.Achievement('Coming to town','Reach <b>Santa\'s 7th form</b>.',[18,9]);10262new Game.Achievement('All hail Santa','Reach <b>Santa\'s final form</b>.',[19,10]);10263new Game.Achievement('Let it snow','Unlock <b>every Christmas-themed cookie</b>.<div class="line"></div>Owning this achievement makes Christmas-themed cookies drop more frequently in future playthroughs.',[19,9]);10264new Game.Achievement('Oh deer','Pop <b>1 reindeer</b>.',[12,9]);10265new Game.Achievement('Sleigh of hand','Pop <b>50 reindeer</b>.',[12,9]);10266new Game.Achievement('Reindeer sleigher','Pop <b>200 reindeer</b>.',[12,9]);1026710268order=1200;10269Game.TieredAchievement('Perfected agriculture','Have <b>150</b> farms.','Farm',4);10270order=1400;10271Game.TieredAchievement('Ultimate automation','Have <b>150</b> factories.','Factory',4);10272order=1300;10273Game.TieredAchievement('Can you dig it','Have <b>150</b> mines.','Mine',4);10274order=1500;10275Game.TieredAchievement('Type II civilization','Have <b>150</b> shipments.','Shipment',4);10276order=1600;10277Game.TieredAchievement('Gild wars','Have <b>150</b> alchemy labs.','Alchemy lab',4);10278order=1700;10279Game.TieredAchievement('Brain-split','Have <b>150</b> portals.','Portal',4);10280order=1800;10281Game.TieredAchievement('Time duke','Have <b>150</b> time machines.','Time machine',4);10282order=1900;10283Game.TieredAchievement('Molecular maestro','Have <b>150</b> antimatter condensers.','Antimatter condenser',4);1028410285order=2000;10286Game.TieredAchievement('Lone photon','Have <b>1</b> prism.','Prism',1);10287Game.TieredAchievement('Dazzling glimmer','Have <b>50</b> prisms.','Prism',2);10288Game.TieredAchievement('Blinding flash','Have <b>100</b> prisms.','Prism',3);10289Game.TieredAchievement('Unending glow','Have <b>150</b> prisms.','Prism',4);1029010291order=5000;10292new Game.Achievement('Lord of Constructs','Own <b>2000</b> buildings.<q>He saw the vast plains stretching ahead of him, and he said : let there be civilization.</q>',[5,6]);10293order=6000;10294new Game.Achievement('Lord of Progress','Purchase <b>200</b> upgrades.<q>One can always do better. But should you?</q>',[9,14]);10295order=7002;10296new Game.Achievement('Bicentennial','Have at least <b>200 of everything</b>.<q>You crazy person.</q>',[8,6]);1029710298order=22300;10299new Game.Achievement('Lovely cookies','Unlock <b>every Valentine-themed cookie</b>.',[20,3]);1030010301order=7001;10302new Game.Achievement('Centennial and a half','Have at least <b>150 of everything</b>.',[7,6]);1030310304order=11000;10305new Game.Achievement('Tiny cookie','Click the tiny cookie.<q>These aren\'t the cookies<br>you\'re clicking for.</q>',[0,5]);1030610307order=400000;10308new Game.Achievement('You win a cookie','This is for baking 10 trillion cookies and making it on the local news.<q>We\'re all so proud of you.</q>',[10,0]);1030910310order=1070;10311Game.ProductionAchievement('Click delegator','Cursor',1,0,7);10312order=1120;10313Game.ProductionAchievement('Gushing grannies','Grandma',1,0,6);10314order=1220;10315Game.ProductionAchievement('I hate manure','Farm',1);10316order=1320;10317Game.ProductionAchievement('Never dig down','Mine',1);10318order=1420;10319Game.ProductionAchievement('The incredible machine','Factory',1);10320order=1520;10321Game.ProductionAchievement('And beyond','Shipment',1);10322order=1620;10323Game.ProductionAchievement('Magnum Opus','Alchemy lab',1);10324order=1720;10325Game.ProductionAchievement('With strange eons','Portal',1);10326order=1820;10327Game.ProductionAchievement('Spacetime jigamaroo','Time machine',1);10328order=1920;10329Game.ProductionAchievement('Supermassive','Antimatter condenser',1);10330order=2020;10331Game.ProductionAchievement('Praise the sun','Prism',1);103321033310334order=1000;10335new Game.Achievement('Clickageddon','Make <b>10,000,000,000,000</b> cookies from clicking.',[11,15]);10336new Game.Achievement('Clicknarok','Make <b>1,000,000,000,000,000</b> cookies from clicking.',[11,16]);1033710338order=1050;10339new Game.Achievement('Extreme polydactyly','Have <b>300</b> cursors.',[0,13]);10340new Game.Achievement('Dr. T','Have <b>400</b> cursors.',[0,14]);1034110342order=1100;Game.TieredAchievement('The old never bothered me anyway','Have <b>250</b> grandmas.','Grandma',6);10343order=1200;Game.TieredAchievement('Homegrown','Have <b>200</b> farms.','Farm',5);10344order=1400;Game.TieredAchievement('Technocracy','Have <b>200</b> factories.','Factory',5);10345order=1300;Game.TieredAchievement('The center of the Earth','Have <b>200</b> mines.','Mine',5);10346order=1500;Game.TieredAchievement('We come in peace','Have <b>200</b> shipments.','Shipment',5);10347order=1600;Game.TieredAchievement('The secrets of the universe','Have <b>200</b> alchemy labs.','Alchemy lab',5);10348order=1700;Game.TieredAchievement('Realm of the Mad God','Have <b>200</b> portals.','Portal',5);10349order=1800;Game.TieredAchievement('Forever and ever','Have <b>200</b> time machines.','Time machine',5);10350order=1900;Game.TieredAchievement('Walk the planck','Have <b>200</b> antimatter condensers.','Antimatter condenser',5);10351order=2000;Game.TieredAchievement('Rise and shine','Have <b>200</b> prisms.','Prism',5);1035210353order=30200;10354new Game.Achievement('God complex','Name yourself <b>Orteil</b>.<div class="warning">Note : usurpers incur a -1% CpS penalty until they rename themselves something else.</div><q>But that\'s not you, is it?</q>',[17,5]);Game.last.pool='shadow';10355new Game.Achievement('Third-party','Use an <b>add-on</b>.<q>Some find vanilla to be the most boring flavor.</q>',[16,5]);Game.last.pool='shadow';//if you're making a mod, add a Game.Win('Third-party') somewhere in there!1035610357order=30050;10358new Game.Achievement('Dematerialize','Ascend with <b>1 quintillion</b> cookies baked.<q>Presto!<br>...where\'d the cookies go?</q>',[11,7]);10359new Game.Achievement('Nil zero zilch','Ascend with <b>1 sextillion</b> cookies baked.<q>To summarize : really not very much at all.</q>',[11,7]);10360new Game.Achievement('Transcendence','Ascend with <b>1 septillion</b> cookies baked.<q>Your cookies are now on a higher plane of being.</q>',[11,8]);10361new Game.Achievement('Obliterate','Ascend with <b>1 octillion</b> cookies baked.<q>Resistance is futile, albeit entertaining.</q>',[11,8]);10362new Game.Achievement('Negative void','Ascend with <b>1 nonillion</b> cookies baked.<q>You now have so few cookies that it\'s almost like you have a negative amount of them.</q>',[11,8]);1036310364order=22400;10365new Game.Achievement('The hunt is on','Unlock <b>1 egg</b>.',[1,12]);10366new Game.Achievement('Egging on','Unlock <b>7 eggs</b>.',[4,12]);10367new Game.Achievement('Mass Easteria','Unlock <b>14 eggs</b>.',[7,12]);10368new Game.Achievement('Hide & seek champion','Unlock <b>all the eggs</b>.<div class="line"></div>Owning this achievement makes eggs drop more frequently in future playthroughs.',[13,12]);1036910370order=11000;10371new Game.Achievement('What\'s in a name','Give your bakery a name.',[15,9]);103721037310374order=1425;10375Game.TieredAchievement('Pretty penny','Have <b>1</b> bank.','Bank',1);10376Game.TieredAchievement('Fit the bill','Have <b>50</b> banks.','Bank',2);10377Game.TieredAchievement('A loan in the dark','Have <b>100</b> banks.','Bank',3);10378Game.TieredAchievement('Need for greed','Have <b>150</b> banks.','Bank',4);10379Game.TieredAchievement('It\'s the economy, stupid','Have <b>200</b> banks.','Bank',5);10380order=1450;10381Game.TieredAchievement('Your time to shrine','Have <b>1</b> temple.','Temple',1);10382Game.TieredAchievement('Shady sect','Have <b>50</b> temples.','Temple',2);10383Game.TieredAchievement('New-age cult','Have <b>100</b> temples.','Temple',3);10384Game.TieredAchievement('Organized religion','Have <b>150</b> temples.','Temple',4);10385Game.TieredAchievement('Fanaticism','Have <b>200</b> temples.','Temple',5);10386order=1475;10387Game.TieredAchievement('Bewitched','Have <b>1</b> wizard tower.','Wizard tower',1);10388Game.TieredAchievement('The sorcerer\'s apprentice','Have <b>50</b> wizard towers.','Wizard tower',2);10389Game.TieredAchievement('Charms and enchantments','Have <b>100</b> wizard towers.','Wizard tower',3);10390Game.TieredAchievement('Curses and maledictions','Have <b>150</b> wizard towers.','Wizard tower',4);10391Game.TieredAchievement('Magic kingdom','Have <b>200</b> wizard towers.','Wizard tower',5);1039210393order=1445;10394Game.ProductionAchievement('Vested interest','Bank',1);10395order=1470;10396Game.ProductionAchievement('New world order','Temple',1);10397order=1495;10398Game.ProductionAchievement('Hocus pocus','Wizard tower',1);10399104001040110402order=1070;10403Game.ProductionAchievement('Finger clickin\' good','Cursor',2,0,7);10404order=1120;10405Game.ProductionAchievement('Panic at the bingo','Grandma',2,0,6);10406order=1220;10407Game.ProductionAchievement('Rake in the dough','Farm',2);10408order=1320;10409Game.ProductionAchievement('Quarry on','Mine',2);10410order=1420;10411Game.ProductionAchievement('Yes I love technology','Factory',2);10412order=1445;10413Game.ProductionAchievement('Paid in full','Bank',2);10414order=1470;10415Game.ProductionAchievement('Church of Cookiology','Temple',2);10416order=1495;10417Game.ProductionAchievement('Too many rabbits, not enough hats','Wizard tower',2);10418order=1520;10419Game.ProductionAchievement('The most precious cargo','Shipment',2);10420order=1620;10421Game.ProductionAchievement('The Aureate','Alchemy lab',2);10422order=1720;10423Game.ProductionAchievement('Ever more hideous','Portal',2);10424order=1820;10425Game.ProductionAchievement('Be kind, rewind','Time machine',2);10426order=1920;10427Game.ProductionAchievement('Infinitesimal','Antimatter condenser',2);10428order=2020;10429Game.ProductionAchievement('A still more glorious dawn','Prism',2);1043010431order=30000;10432new Game.Achievement('Rebirth','Ascend at least once.',[21,6]);1043310434order=11000;10435new Game.Achievement('Here you go','Click this achievement\'s slot.<q>All you had to do was ask.</q>',[1,7]);Game.last.clickFunction=function(){if (!Game.HasAchiev('Here you go')){PlaySound('snd/tick.mp3');Game.Win('Here you go');}};1043610437order=30000;10438new Game.Achievement('Resurrection','Ascend <b>10 times</b>.',[21,6]);10439new Game.Achievement('Reincarnation','Ascend <b>100 times</b>.',[21,6]);10440new Game.Achievement('Endless cycle','Ascend <b>1000 times</b>.<q>Oh hey, it\'s you again.</q>',[2,7]);Game.last.pool='shadow';10441104421044310444order=1100;10445Game.TieredAchievement('The agemaster','Have <b>300</b> grandmas.','Grandma',7);10446Game.TieredAchievement('To oldly go','Have <b>350</b> grandmas.','Grandma',8);1044710448order=1200;Game.TieredAchievement('Gardener extraordinaire','Have <b>250</b> farms.','Farm',6);10449order=1300;Game.TieredAchievement('Tectonic ambassador','Have <b>250</b> mines.','Mine',6);10450order=1400;Game.TieredAchievement('Rise of the machines','Have <b>250</b> factories.','Factory',6);10451order=1425;Game.TieredAchievement('Acquire currency','Have <b>250</b> banks.','Bank',6);10452order=1450;Game.TieredAchievement('Zealotry','Have <b>250</b> temples.','Temple',6);10453order=1475;Game.TieredAchievement('The wizarding world','Have <b>250</b> wizard towers.','Wizard tower',6);10454order=1500;Game.TieredAchievement('Parsec-masher','Have <b>250</b> shipments.','Shipment',6);10455order=1600;Game.TieredAchievement('The work of a lifetime','Have <b>250</b> alchemy labs.','Alchemy lab',6);10456order=1700;Game.TieredAchievement('A place lost in time','Have <b>250</b> portals.','Portal',6);10457order=1800;Game.TieredAchievement('Heat death','Have <b>250</b> time machines.','Time machine',6);10458order=1900;Game.TieredAchievement('Microcosm','Have <b>250</b> antimatter condensers.','Antimatter condenser',6);10459order=2000;Game.TieredAchievement('Bright future','Have <b>250</b> prisms.','Prism',6);1046010461order=25000;10462new Game.Achievement('Here be dragon','Complete your <b>dragon\'s training</b>.',[21,12]);1046310464Game.BankAchievement('How?');10465Game.BankAchievement('The land of milk and cookies');10466Game.BankAchievement('He who controls the cookies controls the universe');Game.last.baseDesc+='<q>The milk must flow!</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10467Game.BankAchievement('Tonight on Hoarders');10468Game.BankAchievement('Are you gonna eat all that?');10469Game.BankAchievement('We\'re gonna need a bigger bakery');10470Game.BankAchievement('In the mouth of madness');Game.last.baseDesc+='<q>A cookie is just what we tell each other it is.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10471Game.BankAchievement('Brought to you by the letter <div style="display:inline-block;background:url(img/money.png);width:16px;height:16px;"></div>');104721047310474Game.CpsAchievement('A world filled with cookies');10475Game.CpsAchievement('When this baby hits '+Beautify(10000000000000*60*60)+' cookies per hour');10476Game.CpsAchievement('Fast and delicious');10477Game.CpsAchievement('Cookiehertz : a really, really tasty hertz');Game.last.baseDesc+='<q>Tastier than a hertz donut, anyway.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10478Game.CpsAchievement('Woops, you solved world hunger');10479Game.CpsAchievement('Turbopuns');Game.last.baseDesc+='<q>Mother Nature will be like "slowwwww dowwwwwn".</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10480Game.CpsAchievement('Faster menner');10481Game.CpsAchievement('And yet you\'re still hungry');10482Game.CpsAchievement('The Abakening');10483Game.CpsAchievement('There\'s really no hard limit to how long these achievement names can be and to be quite honest I\'m rather curious to see how far we can go.<br>Adolphus W. Green (1844–1917) started as the Principal of the Groton School in 1864. By 1865, he became second assistant librarian at the New York Mercantile Library; from 1867 to 1869, he was promoted to full librarian. From 1869 to 1873, he worked for Evarts, Southmayd & Choate, a law firm co-founded by William M. Evarts, Charles Ferdinand Southmayd and Joseph Hodges Choate. He was admitted to the New York State Bar Association in 1873.<br>Anyway, how\'s your day been?');//Game.last.shortName='There\'s really no hard limit to how long these achievement names can be and to be quite honest I\'m [...]';10484Game.CpsAchievement('Fast');Game.last.baseDesc+='<q>Wow!</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);1048510486order=7002;10487new Game.Achievement('Bicentennial and a half','Have at least <b>250 of everything</b>.<q>Keep on truckin\'.</q>',[9,6]);1048810489order=11000;10490new Game.Achievement('Tabloid addiction','Click on the news ticker <b>50 times</b>.<q>Page 6 : Mad individual clicks on picture of pastry in a futile attempt to escape boredom!<br>Also page 6 : British parliament ate my baby!</q>',[27,7]);1049110492order=1000;10493new Game.Achievement('Clickastrophe','Make <b>100,000,000,000,000,000</b> cookies from clicking.',[11,17]);10494new Game.Achievement('Clickataclysm','Make <b>10,000,000,000,000,000,000</b> cookies from clicking.',[11,18]);1049510496order=1050;10497new Game.Achievement('Thumbs, phalanges, metacarpals','Have <b>500</b> cursors.<q>& KNUCKLES</q>',[0,15]);1049810499order=6000;10500new Game.Achievement('Polymath','Own <b>300</b> upgrades and <b>3000</b> buildings.<q>Excellence doesn\'t happen overnight - it usually takes a good couple days.</q>',[29,7]);1050110502order=6005;10503new Game.Achievement('The elder scrolls','Own a combined <b>777</b> grandmas and cursors.<q>Let me guess. Someone stole your cookie.</q>',[10,9]);1050410505order=30050;10506new Game.Achievement('To crumbs, you say?','Ascend with <b>1 decillion</b> cookies baked.<q>Very well then.</q>',[29,6]);1050710508order=1200;Game.TieredAchievement('Seedy business','Have <b>300</b> farms.','Farm',7);10509order=1300;Game.TieredAchievement('Freak fracking','Have <b>300</b> mines.','Mine',7);10510order=1400;Game.TieredAchievement('Modern times','Have <b>300</b> factories.','Factory',7);10511order=1425;Game.TieredAchievement('The nerve of war','Have <b>300</b> banks.','Bank',7);10512order=1450;Game.TieredAchievement('Wololo','Have <b>300</b> temples.','Temple',7);10513order=1475;Game.TieredAchievement('And now for my next trick, I\'ll need a volunteer from the audience','Have <b>300</b> wizard towers.','Wizard tower',7);10514order=1500;Game.TieredAchievement('It\'s not delivery','Have <b>300</b> shipments.','Shipment',7);10515order=1600;Game.TieredAchievement('Gold, Jerry! Gold!','Have <b>300</b> alchemy labs.','Alchemy lab',7);10516order=1700;Game.TieredAchievement('Forbidden zone','Have <b>300</b> portals.','Portal',7);10517order=1800;Game.TieredAchievement('cookie clicker forever and forever a hundred years cookie clicker, all day long forever, forever a hundred times, over and over cookie clicker adventures dot com','Have <b>300</b> time machines.','Time machine',7);10518order=1900;Game.TieredAchievement('Scientists baffled everywhere','Have <b>300</b> antimatter condensers.','Antimatter condenser',7);10519order=2000;Game.TieredAchievement('Harmony of the spheres','Have <b>300</b> prisms.','Prism',7);1052010521order=35000;10522new Game.Achievement('Last Chance to See','Burst the near-extinct <b>shiny wrinkler</b>.<q>You monster!</q>',[24,12]);Game.last.pool='shadow';1052310524order=10000;10525new Game.Achievement('Early bird','Click a golden cookie <b>less than 1 second after it spawns</b>.',[10,14]);10526new Game.Achievement('Fading luck','Click a golden cookie <b>less than 1 second before it dies</b>.',[10,14]);1052710528order=22100;10529new Game.Achievement('Eldeer','Pop a reindeer <b>during an elder frenzy</b>.',[12,9]);1053010531order=21100;10532new Game.Achievement('Dude, sweet','Harvest <b>7 coalescing sugar lumps</b>.',[24,14]);10533new Game.Achievement('Sugar rush','Harvest <b>30 coalescing sugar lumps</b>.',[26,14]);10534new Game.Achievement('Year\'s worth of cavities','Harvest <b>365 coalescing sugar lumps</b>.<q>My lumps my lumps my lumps.</q>',[29,14]);10535new Game.Achievement('Hand-picked','Successfully harvest a coalescing sugar lump before it\'s ripe.',[28,14]);10536new Game.Achievement('Sugar sugar','Harvest a <b>bifurcated sugar lump</b>.',[29,15]);10537new Game.Achievement('All-natural cane sugar','Harvest a <b>golden sugar lump</b>.',[29,16]);Game.last.pool='shadow';10538new Game.Achievement('Sweetmeats','Harvest a <b>meaty sugar lump</b>.',[29,17]);1053910540order=7002;10541new Game.Achievement('Tricentennial','Have at least <b>300 of everything</b>.<q>Can\'t stop, won\'t stop. Probably should stop, though.</q>',[29,12]);1054210543Game.CpsAchievement('Knead for speed');Game.last.baseDesc+='<q>How did we not make that one yet?</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10544Game.CpsAchievement('Well the cookies start coming and they don\'t stop coming');Game.last.baseDesc+='<q>Didn\'t make sense not to click for fun.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10545Game.CpsAchievement('I don\'t know if you\'ve noticed but all these icons are very slightly off-center');10546Game.CpsAchievement('The proof of the cookie is in the baking');Game.last.baseDesc+='<q>How can you have any cookies if you don\'t bake your dough?</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);10547Game.CpsAchievement('If it\'s worth doing, it\'s worth overdoing');1054810549Game.BankAchievement('The dreams in which I\'m baking are the best I\'ve ever had');10550Game.BankAchievement('Set for life');1055110552order=1200;Game.TieredAchievement('You and the beanstalk','Have <b>350</b> farms.','Farm',8);10553order=1300;Game.TieredAchievement('Romancing the stone','Have <b>350</b> mines.','Mine',8);10554order=1400;Game.TieredAchievement('Ex machina','Have <b>350</b> factories.','Factory',8);10555order=1425;Game.TieredAchievement('And I need it now','Have <b>350</b> banks.','Bank',8);10556order=1450;Game.TieredAchievement('Pray on the weak','Have <b>350</b> temples.','Temple',8);10557order=1475;Game.TieredAchievement('It\'s a kind of magic','Have <b>350</b> wizard towers.','Wizard tower',8);10558order=1500;Game.TieredAchievement('Make it so','Have <b>350</b> shipments.','Shipment',8);10559order=1600;Game.TieredAchievement('All that glitters is gold','Have <b>350</b> alchemy labs.','Alchemy lab',8);10560order=1700;Game.TieredAchievement('H̸̷͓̳̳̯̟͕̟͍͍̣͡ḛ̢̦̰̺̮̝͖͖̘̪͉͘͡ ̠̦͕̤̪̝̥̰̠̫̖̣͙̬͘ͅC̨̦̺̩̲̥͉̭͚̜̻̝̣̼͙̮̯̪o̴̡͇̘͎̞̲͇̦̲͞͡m̸̩̺̝̣̹̱͚̬̥̫̳̼̞̘̯͘ͅẹ͇̺̜́̕͢s̶̙̟̱̥̮̯̰̦͓͇͖͖̝͘͘͞','Have <b>350</b> portals.','Portal',8);10561order=1800;Game.TieredAchievement('Way back then','Have <b>350</b> time machines.','Time machine',8);10562order=1900;Game.TieredAchievement('Exotic matter','Have <b>350</b> antimatter condensers.','Antimatter condenser',8);10563order=2000;Game.TieredAchievement('At the end of the tunnel','Have <b>350</b> prisms.','Prism',8);10564105651056610567order=1070;10568Game.ProductionAchievement('Click (starring Adam Sandler)','Cursor',3,0,7);10569order=1120;10570Game.ProductionAchievement('Frantiquities','Grandma',3,0,6);10571order=1220;10572Game.ProductionAchievement('Overgrowth','Farm',3);10573order=1320;10574Game.ProductionAchievement('Sedimentalism','Mine',3);10575order=1420;10576Game.ProductionAchievement('Labor of love','Factory',3);10577order=1445;10578Game.ProductionAchievement('Reverse funnel system','Bank',3);10579order=1470;10580Game.ProductionAchievement('Thus spoke you','Temple',3);10581order=1495;10582Game.ProductionAchievement('Manafest destiny','Wizard tower',3);10583order=1520;10584Game.ProductionAchievement('Neither snow nor rain nor heat nor gloom of night','Shipment',3);10585order=1620;10586Game.ProductionAchievement('I\'ve got the Midas touch','Alchemy lab',3);10587order=1720;10588Game.ProductionAchievement('Which eternal lie','Portal',3);10589order=1820;10590Game.ProductionAchievement('Déjà vu','Time machine',3);10591order=1920;10592Game.ProductionAchievement('Powers of Ten','Antimatter condenser',3);10593order=2020;10594Game.ProductionAchievement('Now the dark days are gone','Prism',3);1059510596order=1070;10597new Game.Achievement('Freaky jazz hands','Reach level <b>10</b> cursors.',[0,26]);Game.Objects['Cursor'].levelAchiev10=Game.last;10598order=1120;10599new Game.Achievement('Methuselah','Reach level <b>10</b> grandmas.',[1,26]);Game.Objects['Grandma'].levelAchiev10=Game.last;10600order=1220;10601new Game.Achievement('Huge tracts of land','Reach level <b>10</b> farms.',[2,26]);Game.Objects['Farm'].levelAchiev10=Game.last;10602order=1320;10603new Game.Achievement('D-d-d-d-deeper','Reach level <b>10</b> mines.',[3,26]);Game.Objects['Mine'].levelAchiev10=Game.last;10604order=1420;10605new Game.Achievement('Patently genius','Reach level <b>10</b> factories.',[4,26]);Game.Objects['Factory'].levelAchiev10=Game.last;10606order=1445;10607new Game.Achievement('A capital idea','Reach level <b>10</b> banks.',[15,26]);Game.Objects['Bank'].levelAchiev10=Game.last;10608order=1470;10609new Game.Achievement('It belongs in a bakery','Reach level <b>10</b> temples.',[16,26]);Game.Objects['Temple'].levelAchiev10=Game.last;10610order=1495;10611new Game.Achievement('Motormouth','Reach level <b>10</b> wizard towers.',[17,26]);Game.Objects['Wizard tower'].levelAchiev10=Game.last;10612order=1520;10613new Game.Achievement('Been there done that','Reach level <b>10</b> shipments.',[5,26]);Game.Objects['Shipment'].levelAchiev10=Game.last;10614order=1620;10615new Game.Achievement('Phlogisticated substances','Reach level <b>10</b> alchemy labs.',[6,26]);Game.Objects['Alchemy lab'].levelAchiev10=Game.last;10616order=1720;10617new Game.Achievement('Bizarro world','Reach level <b>10</b> portals.',[7,26]);Game.Objects['Portal'].levelAchiev10=Game.last;10618order=1820;10619new Game.Achievement('The long now','Reach level <b>10</b> time machines.',[8,26]);Game.Objects['Time machine'].levelAchiev10=Game.last;10620order=1920;10621new Game.Achievement('Chubby hadrons','Reach level <b>10</b> antimatter condensers.',[13,26]);Game.Objects['Antimatter condenser'].levelAchiev10=Game.last;10622order=2020;10623new Game.Achievement('Palettable','Reach level <b>10</b> prisms.',[14,26]);Game.Objects['Prism'].levelAchiev10=Game.last;1062410625order=61470;10626order=61495;10627new Game.Achievement('Bibbidi-bobbidi-boo','Cast <b>9</b> spells.',[21,11]);10628new Game.Achievement('I\'m the wiz','Cast <b>99</b> spells.',[22,11]);10629new Game.Achievement('A wizard is you','Cast <b>999</b> spells.<q>I\'m a what?</q>',[29,11]);1063010631order=10000;10632new Game.Achievement('Four-leaf cookie','Have <b>4</b> golden cookies simultaneously.<q>Fairly rare, considering cookies don\'t even have leaves.</q>',[27,6]);Game.last.pool='shadow';1063310634order=2100;10635Game.TieredAchievement('Lucked out','Have <b>1</b> chancemaker.','Chancemaker',1);10636Game.TieredAchievement('What are the odds','Have <b>50</b> chancemakers.','Chancemaker',2);10637Game.TieredAchievement('Grandma needs a new pair of shoes','Have <b>100</b> chancemakers.','Chancemaker',3);10638Game.TieredAchievement('Million to one shot, doc','Have <b>150</b> chancemakers.','Chancemaker',4);10639Game.TieredAchievement('As luck would have it','Have <b>200</b> chancemakers.','Chancemaker',5);10640Game.TieredAchievement('Ever in your favor','Have <b>250</b> chancemakers.','Chancemaker',6);10641Game.TieredAchievement('Be a lady','Have <b>300</b> chancemakers.','Chancemaker',7);10642Game.TieredAchievement('Dicey business','Have <b>350</b> chancemakers.','Chancemaker',8);1064310644order=2120;10645Game.ProductionAchievement('Fingers crossed','Chancemaker',1);10646Game.ProductionAchievement('Just a statistic','Chancemaker',2);10647Game.ProductionAchievement('Murphy\'s wild guess','Chancemaker',3);1064810649new Game.Achievement('Let\'s leaf it at that','Reach level <b>10</b> chancemakers.',[19,26]);Game.Objects['Chancemaker'].levelAchiev10=Game.last;1065010651order=1000;10652new Game.Achievement('The ultimate clickdown','Make <b>1,000,000,000,000,000,000,000</b> cookies from clicking.<q>(of ultimate destiny.)</q>',[11,19]);106531065410655order=1100;10656Game.TieredAchievement('Aged well','Have <b>400</b> grandmas.','Grandma',9);10657Game.TieredAchievement('101st birthday','Have <b>450</b> grandmas.','Grandma',10);10658Game.TieredAchievement('Defense of the ancients','Have <b>500</b> grandmas.','Grandma',11);10659order=1200;Game.TieredAchievement('Harvest moon','Have <b>400</b> farms.','Farm',9);10660order=1300;Game.TieredAchievement('Mine?','Have <b>400</b> mines.','Mine',9);10661order=1400;Game.TieredAchievement('In full gear','Have <b>400</b> factories.','Factory',9);10662order=1425;Game.TieredAchievement('Treacle tart economics','Have <b>400</b> banks.','Bank',9);10663order=1450;Game.TieredAchievement('Holy cookies, grandma!','Have <b>400</b> temples.','Temple',9);10664order=1475;Game.TieredAchievement('The Prestige','Have <b>400</b> wizard towers.<q>(Unrelated to the Cookie Clicker feature of the same name.)</q>','Wizard tower',9);10665order=1500;Game.TieredAchievement('That\'s just peanuts to space','Have <b>400</b> shipments.','Shipment',9);10666order=1600;Game.TieredAchievement('Worth its weight in lead','Have <b>400</b> alchemy labs.','Alchemy lab',9);10667order=1700;Game.TieredAchievement('What happens in the vortex stays in the vortex','Have <b>400</b> portals.','Portal',9);10668order=1800;Game.TieredAchievement('Invited to yesterday\'s party','Have <b>400</b> time machines.','Time machine',9);10669order=1900;Game.TieredAchievement('Downsizing','Have <b>400</b> antimatter condensers.','Antimatter condenser',9);//the trailer got me really hyped up but i've read some pretty bad reviews. is it watchable ? is it worth seeing ? i don't mind matt damon10670order=2000;Game.TieredAchievement('My eyes','Have <b>400</b> prisms.','Prism',9);10671order=2100;Game.TieredAchievement('Maybe a chance in hell, actually','Have <b>400</b> chancemakers.','Chancemaker',9);1067210673order=1200;Game.TieredAchievement('Make like a tree','Have <b>450</b> farms.','Farm',10);10674order=1300;Game.TieredAchievement('Cave story','Have <b>450</b> mines.','Mine',10);10675order=1400;Game.TieredAchievement('In-cog-neato','Have <b>450</b> factories.','Factory',10);10676order=1425;Game.TieredAchievement('Save your breath because that\'s all you\'ve got left','Have <b>450</b> banks.','Bank',10);10677order=1450;Game.TieredAchievement('Vengeful and almighty','Have <b>450</b> temples.','Temple',10);10678order=1475;Game.TieredAchievement('Spell it out for you','Have <b>450</b> wizard towers.','Wizard tower',10);10679order=1500;Game.TieredAchievement('Space space space space space','Have <b>450</b> shipments.<q>It\'s too far away...</q>','Shipment',10);10680order=1600;Game.TieredAchievement('Don\'t get used to yourself, you\'re gonna have to change','Have <b>450</b> alchemy labs.','Alchemy lab',10);10681order=1700;Game.TieredAchievement('Objects in the mirror dimension are closer than they appear','Have <b>450</b> portals.','Portal',10);10682order=1800;Game.TieredAchievement('Groundhog day','Have <b>450</b> time machines.','Time machine',10);10683order=1900;Game.TieredAchievement('A matter of perspective','Have <b>450</b> antimatter condensers.','Antimatter condenser',10);10684order=2000;Game.TieredAchievement('Optical illusion','Have <b>450</b> prisms.','Prism',10);10685order=2100;Game.TieredAchievement('Jackpot','Have <b>450</b> chancemakers.','Chancemaker',10);1068610687order=36000;10688new Game.Achievement('So much to do so much to see','Manage a cookie legacy for <b>at least a year</b>.<q>Thank you so much for playing Cookie Clicker!</q>',[23,11]);Game.last.pool='shadow';10689106901069110692Game.CpsAchievement('Running with scissors');10693Game.CpsAchievement('Rarefied air');10694Game.CpsAchievement('Push it to the limit');10695Game.CpsAchievement('Green cookies sleep furiously');1069610697Game.BankAchievement('Panic! at Nabisco');10698Game.BankAchievement('Bursting at the seams');10699Game.BankAchievement('Just about full');10700Game.BankAchievement('Hungry for more');1070110702order=1000;10703new Game.Achievement('All the other kids with the pumped up clicks','Make <b>100,000,000,000,000,000,000,000</b> cookies from clicking.',[11,28]);10704new Game.Achievement('One...more...click...','Make <b>10,000,000,000,000,000,000,000,000</b> cookies from clicking.',[11,30]);1070510706order=61515;10707new Game.Achievement('Botany enthusiast','Harvest <b>100</b> mature garden plants.',[26,20]);10708new Game.Achievement('Green, aching thumb','Harvest <b>1000</b> mature garden plants.',[27,20]);10709new Game.Achievement('In the garden of Eden (baby)','Fill every tile of the biggest garden plot with plants.<q>Isn\'t tending to those precious little plants just so rock and/or roll?</q>',[28,20]);1071010711new Game.Achievement('Keeper of the conservatory','Unlock every garden seed.',[25,20]);10712new Game.Achievement('Seedless to nay','Convert a complete seed log into sugar lumps by sacrificing your garden to the sugar hornets.<div class="line"></div>Owning this achievement makes seeds <b>5% cheaper</b>, plants mature <b>5% sooner</b>, and plant upgrades drop <b>5% more</b>.',[29,20]);1071310714order=30050;10715new Game.Achievement('You get nothing','Ascend with <b>1 undecillion</b> cookies baked.<q>Good day sir!</q>',[29,6]);10716new Game.Achievement('Humble rebeginnings','Ascend with <b>1 duodecillion</b> cookies baked.<q>Started from the bottom, now we\'re here.</q>',[29,6]);10717new Game.Achievement('The end of the world','Ascend with <b>1 tredecillion</b> cookies baked.<q>(as we know it)</q>',[21,25]);10718new Game.Achievement('Oh, you\'re back','Ascend with <b>1 quattuordecillion</b> cookies baked.<q>Missed us?</q>',[21,25]);10719new Game.Achievement('Lazarus','Ascend with <b>1 quindecillion</b> cookies baked.<q>All rise.</q>',[21,25]);1072010721Game.CpsAchievement('Leisurely pace');10722Game.CpsAchievement('Hypersonic');1072310724Game.BankAchievement('Feed me, Orteil');10725Game.BankAchievement('And then what?');1072610727order=7002;10728new Game.Achievement('Tricentennial and a half','Have at least <b>350 of everything</b>.<q>(it\'s free real estate)</q>',[21,26]);10729new Game.Achievement('Quadricentennial','Have at least <b>400 of everything</b>.<q>You\'ve had to do horrible things to get this far.<br>Horrible... horrible things.</q>',[22,26]);10730new Game.Achievement('Quadricentennial and a half','Have at least <b>450 of everything</b>.<q>At this point, you might just be compensating for something.</q>',[23,26]);1073110732new Game.Achievement('Quincentennial','Have at least <b>500 of everything</b>.<q>Some people would say you\'re halfway there.<br>We do not care for those people and their reckless sense of unchecked optimism.</q>',[29,25]);107331073410735order=21100;10736new Game.Achievement('Maillard reaction','Harvest a <b>caramelized sugar lump</b>.',[29,27]);1073710738order=30250;10739new Game.Achievement('When the cookies ascend just right','Ascend with exactly <b>1,000,000,000,000 cookies</b>.',[25,7]);Game.last.pool='shadow';//this achievement is shadow because it is only achievable through blind luck or reading external guides; this may change in the future107401074110742order=1050;10743new Game.Achievement('With her finger and her thumb','Have <b>600</b> cursors.',[0,16]);1074410745order=1100;Game.TieredAchievement('But wait \'til you get older','Have <b>550</b> grandmas.','Grandma',12);10746order=1200;Game.TieredAchievement('Sharpest tool in the shed','Have <b>500</b> farms.','Farm',11);10747order=1300;Game.TieredAchievement('Hey now, you\'re a rock','Have <b>500</b> mines.','Mine',11);10748order=1400;Game.TieredAchievement('Break the mold','Have <b>500</b> factories.','Factory',11);10749order=1425;Game.TieredAchievement('Get the show on, get paid','Have <b>500</b> banks.','Bank',11);10750order=1450;Game.TieredAchievement('My world\'s on fire, how about yours','Have <b>500</b> temples.','Temple',11);10751order=1475;Game.TieredAchievement('The meteor men beg to differ','Have <b>500</b> wizard towers.','Wizard tower',11);10752order=1500;Game.TieredAchievement('Only shooting stars','Have <b>500</b> shipments.','Shipment',11);10753order=1600;Game.TieredAchievement('We could all use a little change','Have <b>500</b> alchemy labs.','Alchemy lab',11);//"all that glitters is gold" was already an achievement10754order=1700;Game.TieredAchievement('Your brain gets smart but your head gets dumb','Have <b>500</b> portals.','Portal',11);10755order=1800;Game.TieredAchievement('The years start coming','Have <b>500</b> time machines.','Time machine',11);10756order=1900;Game.TieredAchievement('What a concept','Have <b>500</b> antimatter condensers.','Antimatter condenser',11);10757order=2000;Game.TieredAchievement('You\'ll never shine if you don\'t glow','Have <b>500</b> prisms.','Prism',11);10758order=2100;Game.TieredAchievement('You\'ll never know if you don\'t go','Have <b>500</b> chancemakers.','Chancemaker',11);1075910760order=2200;10761Game.TieredAchievement('Self-contained','Have <b>1</b> fractal engine.','Fractal engine',1);10762Game.TieredAchievement('Threw you for a loop','Have <b>50</b> fractal engines.','Fractal engine',2);10763Game.TieredAchievement('The sum of its parts','Have <b>100</b> fractal engines.','Fractal engine',3);10764Game.TieredAchievement('Bears repeating','Have <b>150</b> fractal engines.<q>Where did these come from?</q>','Fractal engine',4);10765Game.TieredAchievement('More of the same','Have <b>200</b> fractal engines.','Fractal engine',5);10766Game.TieredAchievement('Last recurse','Have <b>250</b> fractal engines.','Fractal engine',6);10767Game.TieredAchievement('Out of one, many','Have <b>300</b> fractal engines.','Fractal engine',7);10768Game.TieredAchievement('An example of recursion','Have <b>350</b> fractal engines.','Fractal engine',8);10769Game.TieredAchievement('For more information on this achievement, please refer to its title','Have <b>400</b> fractal engines.','Fractal engine',9);10770Game.TieredAchievement('I\'m so meta, even this achievement','Have <b>450</b> fractal engines.','Fractal engine',10);10771Game.TieredAchievement('Never get bored','Have <b>500</b> fractal engines.','Fractal engine',11);1077210773order=2220;10774Game.ProductionAchievement('The needs of the many','Fractal engine',1);10775Game.ProductionAchievement('Eating its own','Fractal engine',2);10776Game.ProductionAchievement('We must go deeper','Fractal engine',3);1077710778new Game.Achievement('Sierpinski rhomboids','Reach level <b>10</b> fractal engines.',[20,26]);Game.Objects['Fractal engine'].levelAchiev10=Game.last;1077910780Game.CpsAchievement('Gotta go fast');10781Game.BankAchievement('I think it\'s safe to say you\'ve got it made');1078210783order=6000;10784new Game.Achievement('Renaissance baker','Own <b>400</b> upgrades and <b>4000</b> buildings.<q>If you have seen further, it is by standing on the shoulders of giants - a mysterious species of towering humanoids until now thought long-extinct.</q>',[10,10]);1078510786order=1150;10787new Game.Achievement('Veteran','Own at least <b>14</b> grandma types.<q>14\'s a crowd!</q>',[10,9]);1078810789order=10000;10790new Game.Achievement('Thick-skinned','Have your <b>reinforced membrane</b> protect the <b>shimmering veil</b>.',[7,10]);107911079210793order=2300;10794Game.TieredAchievement('F12','Have <b>1</b> javascript console.','Javascript console',1);10795Game.TieredAchievement('Variable success','Have <b>50</b> javascript consoles.','Javascript console',2);10796Game.TieredAchievement('No comments','Have <b>100</b> javascript consoles.','Javascript console',3);10797Game.TieredAchievement('Up to code','Have <b>150</b> javascript consoles.','Javascript console',4);10798Game.TieredAchievement('Works on my machine','Have <b>200</b> javascript consoles.','Javascript console',5);10799Game.TieredAchievement('Technical debt','Have <b>250</b> javascript consoles.','Javascript console',6);10800Game.TieredAchievement('Mind your language','Have <b>300</b> javascript consoles.','Javascript console',7);10801Game.TieredAchievement('Inconsolable','Have <b>350</b> javascript consoles.','Javascript console',8);10802Game.TieredAchievement('Closure','Have <b>400</b> javascript consoles.','Javascript console',9);10803Game.TieredAchievement('Dude what if we\'re all living in a simulation like what if we\'re all just code on a computer somewhere','Have <b>450</b> javascript consoles.','Javascript console',10);10804Game.TieredAchievement('Taking the back streets','Have <b>500</b> javascript consoles.','Javascript console',11);1080510806order=2320;10807Game.ProductionAchievement('Inherited prototype','Javascript console',1);10808Game.ProductionAchievement('A model of document object','Javascript console',2);10809Game.ProductionAchievement('First-class citizen','Javascript console',3);1081010811new Game.Achievement('Alexandria','Reach level <b>10</b> javascript consoles.',[32,26]);Game.Objects['Javascript console'].levelAchiev10=Game.last;1081210813Game.CpsAchievement('Bake him away, toys');10814Game.CpsAchievement('You\'re #1 so why try harder');10815Game.CpsAchievement('Haven\'t even begun to peak');10816Game.BankAchievement('A sometimes food');10817Game.BankAchievement('Not enough of a good thing');10818Game.BankAchievement('Horn of plenty');1081910820order=30050;10821new Game.Achievement('Smurf account','Ascend with <b>1 sexdecillion</b> cookies baked.<q>It\'s like you just appeared out of the blue!</q>',[21,32]);10822new Game.Achievement('If at first you don\'t succeed','Ascend with <b>1 septendecillion</b> cookies baked.<q>If at first you don\'t succeed, try, try, try again.<br>But isn\'t that the definition of insanity?</q>',[21,32]);1082310824order=33000;10825new Game.Achievement('O Fortuna','Own every <b>fortune upgrade</b>.<div class="line"></div>Owning this achievement makes fortunes appear <b>twice as often</b>; unlocked fortune upgrades also have a <b>40% chance</b> to carry over after ascending.',[29,8]);1082610827//end of achievements1082810829/*=====================================================================================10830BUFFS10831=======================================================================================*/1083210833Game.buffs=[];//buffs currently in effect by name10834Game.buffsN=0;10835Game.buffsL=l('buffs');10836Game.gainBuff=function(type,time,arg1,arg2,arg3)10837{10838type=Game.buffTypesByName[type];10839var obj=type.func(time,arg1,arg2,arg3);10840obj.type=type;10841obj.arg1=arg1;10842obj.arg2=arg2;10843obj.arg3=arg3;1084410845var buff={10846visible:true,10847time:0,10848name:'???',10849desc:'',10850icon:[0,0]10851};10852if (Game.buffs[obj.name])//if there is already a buff in effect with this name10853{10854var buff=Game.buffs[obj.name];10855if (obj.max) buff.time=Math.max(obj.time,buff.time);//new duration is max of old and new10856if (obj.add) buff.time+=obj.time;//new duration is old + new10857if (!obj.max && !obj.add) buff.time=obj.time;//new duration is set to new10858buff.maxTime=buff.time;10859}10860else//create new buff10861{10862for (var i in obj)//paste parameters onto buff10863{buff[i]=obj[i];}10864buff.maxTime=buff.time;10865Game.buffs[buff.name]=buff;10866buff.id=Game.buffsN;1086710868//create dom10869Game.buffsL.innerHTML=Game.buffsL.innerHTML+'<div id="buff'+buff.id+'" class="crate enabled buff" '+(buff.desc?Game.getTooltip(10870'<div class="prompt" style="min-width:200px;text-align:center;font-size:11px;margin:8px 0px;"><h3>'+buff.name+'</h3><div class="line"></div>'+buff.desc+'</div>'10871,'left',true):'')+' style="opacity:1;float:none;display:block;'+(buff.icon[2]?'background-image:url('+buff.icon[2]+');':'')+'background-position:'+(-buff.icon[0]*48)+'px '+(-buff.icon[1]*48)+'px;"></div>';1087210873buff.l=l('buff'+buff.id);1087410875Game.buffsN++;10876}10877Game.recalculateGains=1;10878Game.storeToRefresh=1;10879return buff;10880}10881Game.hasBuff=function(what)//returns 0 if there is no buff in effect with this name; else, returns it10882{if (!Game.buffs[what]) return 0; else return Game.buffs[what];}10883Game.updateBuffs=function()//executed every logic frame10884{10885for (var i in Game.buffs)10886{10887var buff=Game.buffs[i];1088810889if (buff.time>=0)10890{10891if (!l('buffPieTimer'+buff.id)) l('buff'+buff.id).innerHTML=l('buff'+buff.id).innerHTML+'<div class="pieTimer" id="buffPieTimer'+buff.id+'"></div>';10892var T=1-(buff.time/buff.maxTime);10893T=(T*144)%144;10894l('buffPieTimer'+buff.id).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';10895}10896buff.time--;10897if (buff.time<=0)10898{10899if (Game.onCrate==l('buff'+buff.id)) Game.tooltip.hide();10900if (buff.onDie) buff.onDie();10901Game.buffsL.removeChild(l('buff'+buff.id));10902if (Game.buffs[buff.name])10903{10904Game.buffs[buff.name]=0;10905delete Game.buffs[buff.name];10906}10907Game.recalculateGains=1;10908Game.storeToRefresh=1;10909}10910}10911}10912Game.killBuff=function(what)//remove a buff by name10913{if (Game.buffs[what]){Game.buffs[what].time=0;/*Game.buffs[what]=0;*/}}10914Game.killBuffs=function()//remove all buffs10915{Game.buffsL.innerHTML='';Game.buffs=[];Game.recalculateGains=1;Game.storeToRefresh=1;}109161091710918Game.buffTypes=[];//buff archetypes; only buffs declared from these can be saved and loaded10919Game.buffTypesByName=[];10920Game.buffTypesN=0;10921Game.buffType=function(name,func)10922{10923this.name=name;10924this.func=func;//this is a function that returns a buff object; it takes a "time" argument in seconds, and 3 more optional arguments at most, which will be saved and loaded as floats10925this.id=Game.buffTypesN;10926this.vanilla=Game.vanilla;10927Game.buffTypesByName[this.name]=this;10928Game.buffTypes[Game.buffTypesN]=this;10929Game.buffTypesN++;10930}1093110932/*10933basic buff parameters :10934name:'Kitten rain',10935desc:'It\'s raining kittens!',10936icon:[0,0],10937time:30*Game.fps10938other parameters :10939visible:false - will hide the buff from the buff list10940add:true - if this buff already exists, add the new duration to the old one10941max:true - if this buff already exists, set the new duration to the max of either10942onDie:function(){} - function will execute when the buff runs out10943power:3 - used by some buffs10944multCpS:3 - buff multiplies CpS by this amount10945multClick:3 - buff multiplies click power by this amount10946*/1094710948//base buffs10949new Game.buffType('frenzy',function(time,pow)10950{10951return {10952name:'Frenzy',10953desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',10954icon:[10,14],10955time:time*Game.fps,10956add:true,10957multCpS:pow,10958aura:110959};10960});10961new Game.buffType('blood frenzy',function(time,pow)10962{10963return {10964name:'Elder frenzy',10965desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',10966icon:[29,6],10967time:time*Game.fps,10968add:true,10969multCpS:pow,10970aura:110971};10972});10973new Game.buffType('clot',function(time,pow)10974{10975return {10976name:'Clot',10977desc:'Cookie production halved for '+Game.sayTime(time*Game.fps,-1)+'!',10978icon:[15,5],10979time:time*Game.fps,10980add:true,10981multCpS:pow,10982aura:210983};10984});10985new Game.buffType('dragon harvest',function(time,pow)10986{10987return {10988name:'Dragon Harvest',10989desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',10990icon:[10,25],10991time:time*Game.fps,10992add:true,10993multCpS:pow,10994aura:110995};10996});10997new Game.buffType('everything must go',function(time,pow)10998{10999return {11000name:'Everything must go',11001desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',11002icon:[17,6],11003time:time*Game.fps,11004add:true,11005power:pow,11006aura:111007};11008});11009new Game.buffType('cursed finger',function(time,pow)11010{11011return {11012name:'Cursed finger',11013desc:'Cookie production halted for '+Game.sayTime(time*Game.fps,-1)+',<br>but each click is worth '+Game.sayTime(time*Game.fps,-1)+' of CpS.',11014icon:[12,17],11015time:time*Game.fps,11016add:true,11017power:pow,11018multCpS:0,11019aura:111020};11021});11022new Game.buffType('click frenzy',function(time,pow)11023{11024return {11025name:'Click frenzy',11026desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',11027icon:[0,14],11028time:time*Game.fps,11029add:true,11030multClick:pow,11031aura:111032};11033});11034new Game.buffType('dragonflight',function(time,pow)11035{11036return {11037name:'Dragonflight',11038desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',11039icon:[0,25],11040time:time*Game.fps,11041add:true,11042multClick:pow,11043aura:111044};11045});11046new Game.buffType('cookie storm',function(time,pow)11047{11048return {11049name:'Cookie storm',11050desc:'Cookies everywhere!',11051icon:[22,6],11052time:time*Game.fps,11053add:true,11054power:pow,11055aura:111056};11057});11058new Game.buffType('building buff',function(time,pow,building)11059{11060var obj=Game.ObjectsById[building];11061return {11062name:Game.goldenCookieBuildingBuffs[obj.name][0],11063desc:'Your '+obj.amount+' '+obj.plural+' are boosting your CpS!<br>Cookie production +'+(Math.ceil(pow*100-100))+'% for '+Game.sayTime(time*Game.fps,-1)+'!',11064icon:[obj.iconColumn,14],11065time:time*Game.fps,11066add:true,11067multCpS:pow,11068aura:111069};11070});11071new Game.buffType('building debuff',function(time,pow,building)11072{11073var obj=Game.ObjectsById[building];11074return {11075name:Game.goldenCookieBuildingBuffs[obj.name][1],11076desc:'Your '+obj.amount+' '+obj.plural+' are rusting your CpS!<br>Cookie production '+(Math.ceil(pow*100-100))+'% slower for '+Game.sayTime(time*Game.fps,-1)+'!',11077icon:[obj.iconColumn,15],11078time:time*Game.fps,11079add:true,11080multCpS:1/pow,11081aura:211082};11083});11084new Game.buffType('sugar blessing',function(time,pow)11085{11086return {11087name:'Sugar blessing',11088desc:'You find 10% more golden cookies for the next '+Game.sayTime(time*Game.fps,-1)+'.',11089icon:[29,16],11090time:time*Game.fps,11091//add:true11092};11093});11094new Game.buffType('haggler luck',function(time,pow)11095{11096return {11097name:'Haggler\'s luck',11098desc:'All upgrades are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',11099icon:[25,11],11100time:time*Game.fps,11101power:pow,11102max:true11103};11104});11105new Game.buffType('haggler misery',function(time,pow)11106{11107return {11108name:'Haggler\'s misery',11109desc:'All upgrades are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',11110icon:[25,11],11111time:time*Game.fps,11112power:pow,11113max:true11114};11115});11116new Game.buffType('pixie luck',function(time,pow)11117{11118return {11119name:'Crafty pixies',11120desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',11121icon:[26,11],11122time:time*Game.fps,11123power:pow,11124max:true11125};11126});11127new Game.buffType('pixie misery',function(time,pow)11128{11129return {11130name:'Nasty goblins',11131desc:'All buildings are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',11132icon:[26,11],11133time:time*Game.fps,11134power:pow,11135max:true11136};11137});11138new Game.buffType('magic adept',function(time,pow)11139{11140return {11141name:'Magic adept',11142desc:'Spells backfire '+pow+' times less for '+Game.sayTime(time*Game.fps,-1)+'.',11143icon:[29,11],11144time:time*Game.fps,11145power:pow,11146max:true11147};11148});11149new Game.buffType('magic inept',function(time,pow)11150{11151return {11152name:'Magic inept',11153desc:'Spells backfire '+pow+' times more for '+Game.sayTime(time*Game.fps,-1)+'.',11154icon:[29,11],11155time:time*Game.fps,11156power:pow,11157max:true11158};11159});11160new Game.buffType('devastation',function(time,pow)11161{11162return {11163name:'Devastation',11164desc:'Clicking power +'+Math.floor(pow*100-100)+'% for '+Game.sayTime(time*Game.fps,-1)+'!',11165icon:[23,18],11166time:time*Game.fps,11167multClick:pow,11168aura:1,11169max:true11170};11171});11172new Game.buffType('sugar frenzy',function(time,pow)11173{11174return {11175name:'Sugar frenzy',11176desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',11177icon:[29,14],11178time:time*Game.fps,11179add:true,11180multCpS:pow,11181aura:011182};11183});1118411185//end of buffs111861118711188111891119011191BeautifyAll();11192Game.vanilla=0;//everything we create beyond this will not be saved in the default save111931119411195for (var i in Game.customCreate) {Game.customCreate[i]();}111961119711198/*=====================================================================================11199GRANDMAPOCALYPSE11200=======================================================================================*/11201Game.UpdateGrandmapocalypse=function()11202{11203if (Game.Has('Elder Covenant') || Game.Objects['Grandma'].amount==0) Game.elderWrath=0;11204else if (Game.pledgeT>0)//if the pledge is active, lower it11205{11206Game.pledgeT--;11207if (Game.pledgeT==0)//did we reach 0? make the pledge purchasable again11208{11209Game.Lock('Elder Pledge');11210Game.Unlock('Elder Pledge');11211Game.elderWrath=1;11212}11213}11214else11215{11216if (Game.Has('One mind') && Game.elderWrath==0)11217{11218Game.elderWrath=1;11219}11220if (Math.random()<0.001 && Game.elderWrath<Game.Has('One mind')+Game.Has('Communal brainsweep')+Game.Has('Elder Pact'))11221{11222Game.elderWrath++;//have we already pledged? make the elder wrath shift between different stages11223}11224if (Game.Has('Elder Pact') && Game.Upgrades['Elder Pledge'].unlocked==0)11225{11226Game.Lock('Elder Pledge');11227Game.Unlock('Elder Pledge');11228}11229}11230Game.elderWrathD+=((Game.elderWrath+1)-Game.elderWrathD)*0.001;//slowly fade to the target wrath state1123111232if (Game.elderWrath!=Game.elderWrathOld) Game.storeToRefresh=1;1123311234Game.elderWrathOld=Game.elderWrath;1123511236Game.UpdateWrinklers();11237}1123811239//wrinklers1124011241function inRect(x,y,rect)11242{11243//find out if the point x,y is in the rotated rectangle rect{w,h,r,o} (width,height,rotation in radians,y-origin) (needs to be normalized)11244//I found this somewhere online I guess11245var dx = x+Math.sin(-rect.r)*(-(rect.h/2-rect.o)),dy=y+Math.cos(-rect.r)*(-(rect.h/2-rect.o));11246var h1 = Math.sqrt(dx*dx + dy*dy);11247var currA = Math.atan2(dy,dx);11248var newA = currA - rect.r;11249var x2 = Math.cos(newA) * h1;11250var y2 = Math.sin(newA) * h1;11251if (x2 > -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true;11252return false;11253}1125411255Game.wrinklerHP=2.1;11256Game.wrinklers=[];11257for (var i=0;i<12;i++)11258{11259Game.wrinklers.push({id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:Game.wrinklerHP,selected:0,type:0});11260}11261Game.getWrinklersMax=function()11262{11263var n=10;11264if (Game.Has('Elder spice')) n+=2;11265return n;11266}11267Game.ResetWrinklers=function()11268{11269for (var i in Game.wrinklers)11270{11271Game.wrinklers[i]={id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:Game.wrinklerHP,selected:0,type:0};11272}11273}11274Game.CollectWrinklers=function()11275{11276for (var i in Game.wrinklers)11277{11278Game.wrinklers[i].hp=0;11279}11280}11281Game.wrinklerSquishSound=Math.floor(Math.random()*4)+1;11282Game.playWrinklerSquishSound=function()11283{11284PlaySound('snd/squish'+(Game.wrinklerSquishSound)+'.mp3',0.5);11285Game.wrinklerSquishSound+=Math.floor(Math.random()*1.5)+1;11286if (Game.wrinklerSquishSound>4) Game.wrinklerSquishSound-=4;11287}11288Game.SpawnWrinkler=function(me)11289{11290if (!me)11291{11292var max=Game.getWrinklersMax();11293var n=0;11294for (var i in Game.wrinklers)11295{11296if (Game.wrinklers[i].phase>0) n++;11297}11298for (var i in Game.wrinklers)11299{11300var it=Game.wrinklers[i];11301if (it.phase==0 && Game.elderWrath>0 && n<max && it.id<max)11302{11303me=it;11304break;11305}11306}11307}11308if (!me) return false;11309me.phase=1;11310me.hp=Game.wrinklerHP;11311me.type=0;11312if (Math.random()<0.0001) me.type=1;//shiny wrinkler11313return me;11314}11315Game.PopRandomWrinkler=function()11316{11317var wrinklers=[];11318for (var i in Game.wrinklers)11319{11320if (Game.wrinklers[i].phase>0 && Game.wrinklers[i].hp>0) wrinklers.push(Game.wrinklers[i]);11321}11322if (wrinklers.length>0)11323{11324var me=choose(wrinklers);11325me.hp=-10;11326return me;11327}11328return false;11329}11330Game.UpdateWrinklers=function()11331{11332var xBase=0;11333var yBase=0;11334var onWrinkler=0;11335if (Game.LeftBackground)11336{11337xBase=Game.cookieOriginX;11338yBase=Game.cookieOriginY;11339}11340var max=Game.getWrinklersMax();11341var n=0;11342for (var i in Game.wrinklers)11343{11344if (Game.wrinklers[i].phase>0) n++;11345}11346for (var i in Game.wrinklers)11347{11348var me=Game.wrinklers[i];11349if (me.phase==0 && Game.elderWrath>0 && n<max && me.id<max)11350{11351var chance=0.00001*Game.elderWrath;11352chance*=Game.eff('wrinklerSpawn');11353if (Game.Has('Unholy bait')) chance*=5;11354if (Game.hasGod)11355{11356var godLvl=Game.hasGod('scorn');11357if (godLvl==1) chance*=2.5;11358else if (godLvl==2) chance*=2;11359else if (godLvl==3) chance*=1.5;11360}11361if (Game.Has('Wrinkler doormat')) chance=0.1;11362if (Math.random()<chance)//respawn11363{11364Game.SpawnWrinkler(me);11365}11366}11367if (me.phase>0)11368{11369if (me.close<1) me.close+=(1/Game.fps)/10;11370if (me.close>1) me.close=1;11371}11372else me.close=0;11373if (me.close==1 && me.phase==1)11374{11375me.phase=2;11376Game.recalculateGains=1;11377}11378if (me.phase==2)11379{11380me.sucked+=(((Game.cookiesPs/Game.fps)*Game.cpsSucked));//suck the cookies11381}11382if (me.phase>0)11383{11384if (me.type==0)11385{11386if (me.hp<Game.wrinklerHP) me.hp+=0.04;11387me.hp=Math.min(Game.wrinklerHP,me.hp);11388}11389else if (me.type==1)11390{11391if (me.hp<Game.wrinklerHP*3) me.hp+=0.04;11392me.hp=Math.min(Game.wrinklerHP*3,me.hp);11393}11394var d=128*(2-me.close);//*Game.BigCookieSize;11395if (Game.prefs.fancy) d+=Math.cos(Game.T*0.05+parseInt(me.id))*4;11396me.r=(me.id/max)*360;11397if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.05+parseInt(me.id))*4;11398me.x=xBase+(Math.sin(me.r*Math.PI/180)*d);11399me.y=yBase+(Math.cos(me.r*Math.PI/180)*d);11400if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.09+parseInt(me.id))*4;11401var rect={w:100,h:200,r:(-me.r)*Math.PI/180,o:10};11402if (Math.random()<0.01) me.hurt=Math.max(me.hurt,Math.random());11403if (Game.T%5==0 && Game.CanClick) {if (Game.LeftBackground && Game.mouseX<Game.LeftBackground.canvas.width && inRect(Game.mouseX-me.x,Game.mouseY-me.y,rect)) me.selected=1; else me.selected=0;}11404if (me.selected && onWrinkler==0 && Game.CanClick)11405{11406me.hurt=Math.max(me.hurt,0.25);11407//me.close*=0.99;11408if (Game.Click && Game.lastClickedEl==l('backgroundLeftCanvas'))11409{11410if (Game.keys[17] && Game.sesame) {me.type=!me.type;PlaySound('snd/shimmerClick.mp3');}//ctrl-click on a wrinkler in god mode to toggle its shininess11411else11412{11413Game.playWrinklerSquishSound();11414me.hurt=1;11415me.hp-=0.75;11416if (Game.prefs.particles && !(me.hp<=0.5 && me.phase>0))11417{11418var x=me.x+(Math.sin(me.r*Math.PI/180)*90);11419var y=me.y+(Math.cos(me.r*Math.PI/180)*90);11420for (var ii=0;ii<3;ii++)11421{11422//Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');11423var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');11424part.r=-me.r;11425}11426}11427}11428Game.Click=0;11429}11430onWrinkler=1;11431}11432}1143311434if (me.hurt>0)11435{11436me.hurt-=5/Game.fps;11437//me.close-=me.hurt*0.05;11438//me.x+=Math.random()*2-1;11439//me.y+=Math.random()*2-1;11440me.r+=(Math.sin(Game.T*1)*me.hurt)*18;//Math.random()*2-1;11441}11442if (me.hp<=0.5 && me.phase>0)11443{11444Game.playWrinklerSquishSound();11445PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);11446Game.wrinklersPopped++;11447Game.recalculateGains=1;11448me.phase=0;11449me.close=0;11450me.hurt=0;11451me.hp=3;11452var toSuck=1.1;11453if (Game.Has('Sacrilegious corruption')) toSuck*=1.05;11454if (me.type==1) toSuck*=3;//shiny wrinklers are an elusive, profitable breed11455me.sucked*=toSuck;//cookie dough does weird things inside wrinkler digestive tracts11456if (Game.Has('Wrinklerspawn')) me.sucked*=1.05;11457if (Game.hasGod)11458{11459var godLvl=Game.hasGod('scorn');11460if (godLvl==1) me.sucked*=1.15;11461else if (godLvl==2) me.sucked*=1.1;11462else if (godLvl==3) me.sucked*=1.05;11463}11464if (me.sucked>0.5)11465{11466if (Game.prefs.popups) Game.Popup('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler : found '+Beautify(me.sucked)+' cookies!');11467else Game.Notify('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler','Found <b>'+Beautify(me.sucked)+'</b> cookies!',[19,8],6);11468Game.Popup('<div style="font-size:80%;">+'+Beautify(me.sucked)+' cookies</div>',Game.mouseX,Game.mouseY);1146911470if (Game.season=='halloween')11471{11472//if (Math.random()<(Game.HasAchiev('Spooky cookies')?0.2:0.05))//halloween cookie drops11473var failRate=0.95;11474if (Game.HasAchiev('Spooky cookies')) failRate=0.8;11475if (Game.Has('Starterror')) failRate*=0.9;11476failRate*=1/Game.dropRateMult();11477if (Game.hasGod)11478{11479var godLvl=Game.hasGod('seasons');11480if (godLvl==1) failRate*=0.9;11481else if (godLvl==2) failRate*=0.95;11482else if (godLvl==3) failRate*=0.97;11483}11484if (me.type==1) failRate*=0.9;11485if (Math.random()>failRate)//halloween cookie drops11486{11487var cookie=choose(['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies']);11488if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))11489{11490Game.Unlock(cookie);11491if (Game.prefs.popups) Game.Popup('Found : '+cookie+'!');11492else Game.Notify(cookie,'You also found <b>'+cookie+'</b>!',Game.Upgrades[cookie].icon);11493}11494}11495}11496Game.DropEgg(0.98);11497}11498if (me.type==1) Game.Win('Last Chance to See');11499Game.Earn(me.sucked);11500/*if (Game.prefs.particles)11501{11502var x=me.x+(Math.sin(me.r*Math.PI/180)*100);11503var y=me.y+(Math.cos(me.r*Math.PI/180)*100);11504for (var ii=0;ii<6;ii++)11505{11506Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');11507}11508}*/11509if (Game.prefs.particles)11510{11511var x=me.x+(Math.sin(me.r*Math.PI/180)*90);11512var y=me.y+(Math.cos(me.r*Math.PI/180)*90);11513if (me.sucked>0)11514{11515for (var ii=0;ii<5;ii++)11516{11517Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1.5,2);11518}11519}11520for (var ii=0;ii<8;ii++)11521{11522var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');11523part.r=-me.r;11524}11525}11526me.sucked=0;11527}11528}11529if (onWrinkler)11530{11531Game.mousePointer=1;11532}11533}11534Game.DrawWrinklers=function()11535{11536var ctx=Game.LeftBackground;11537var selected=0;11538for (var i in Game.wrinklers)11539{11540var me=Game.wrinklers[i];11541if (me.phase>0)11542{11543ctx.globalAlpha=me.close;11544ctx.save();11545ctx.translate(me.x,me.y);11546ctx.rotate(-(me.r)*Math.PI/180);11547//var s=Math.min(1,me.sucked/(Game.cookiesPs*60))*0.75+0.25;//scale wrinklers as they eat11548//ctx.scale(Math.pow(s,1.5)*1.25,s);11549//ctx.fillRect(-50,-10,100,200);11550if (me.type==1) ctx.drawImage(Pic('shinyWrinkler.png'),-50,-10);11551else if (Game.season=='christmas') ctx.drawImage(Pic('winterWrinkler.png'),-50,-10);11552else ctx.drawImage(Pic('wrinkler.png'),-50,-10);11553//ctx.fillText(me.id+' : '+me.sucked,0,0);11554if (me.type==1 && Math.random()<0.3 && Game.prefs.particles)//sparkle11555{11556ctx.globalAlpha=Math.random()*0.65+0.1;11557var s=Math.random()*30+5;11558ctx.globalCompositeOperation='lighter';11559ctx.drawImage(Pic('glint.jpg'),-s/2+Math.random()*50-25,-s/2+Math.random()*200,s,s);11560}11561ctx.restore();1156211563if (me.phase==2 && Math.random()<0.03 && Game.prefs.particles)11564{11565Game.particleAdd(me.x,me.y,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.5,1,2);11566}1156711568if (me.selected) selected=me;11569}11570}11571if (selected && Game.Has('Eye of the wrinkler'))11572{11573var x=Game.cookieOriginX;11574var y=Game.cookieOriginY;11575ctx.font='14px Merriweather';11576ctx.textAlign='center';11577var width=Math.max(ctx.measureText('Swallowed :').width,ctx.measureText(Beautify(selected.sucked)).width);11578ctx.fillStyle='#000';11579ctx.strokeStyle='#000';11580ctx.lineWidth=8;11581ctx.globalAlpha=0.5;11582ctx.beginPath();11583ctx.moveTo(x,y);11584ctx.lineTo(Math.floor(selected.x),Math.floor(selected.y));11585ctx.stroke();11586ctx.fillRect(x-width/2-8-14,y-23,width+16+28,38);11587ctx.globalAlpha=1;11588ctx.fillStyle='#fff';11589ctx.fillText('Swallowed :',x+14,y-8);11590ctx.fillText(Beautify(selected.sucked),x+14,y+8);11591ctx.drawImage(Pic('icons.png'),27*48,26*48,48,48,x-width/2-8-22,y-4-24,48,48);11592}11593}11594Game.SaveWrinklers=function()11595{11596var amount=0;11597var amountShinies=0;11598var number=0;11599var shinies=0;11600for (var i in Game.wrinklers)11601{11602if (Game.wrinklers[i].sucked>0.5)11603{11604number++;11605if (Game.wrinklers[i].type==1)11606{11607shinies++;11608amountShinies+=Game.wrinklers[i].sucked;11609}11610else amount+=Game.wrinklers[i].sucked;11611}11612}11613return {amount:amount,number:number,shinies:shinies,amountShinies:amountShinies};11614}11615Game.LoadWrinklers=function(amount,number,shinies,amountShinies)11616{11617if (number>0 && (amount>0 || amountShinies>0))11618{11619var fullNumber=number-shinies;11620var fullNumberShinies=shinies;11621for (var i in Game.wrinklers)11622{11623if (number>0)11624{11625Game.wrinklers[i].phase=2;11626Game.wrinklers[i].close=1;11627Game.wrinklers[i].hp=3;11628if (shinies>0) {Game.wrinklers[i].type=1;Game.wrinklers[i].sucked=amountShinies/fullNumberShinies;shinies--;}11629else Game.wrinklers[i].sucked=amount/fullNumber;11630number--;11631}//respawn11632}11633}11634}1163511636/*=====================================================================================11637SPECIAL THINGS AND STUFF11638=======================================================================================*/116391164011641Game.specialTab='';11642Game.specialTabHovered='';11643Game.specialTabs=[];1164411645Game.UpdateSpecial=function()11646{11647Game.specialTabs=[];11648if (Game.Has('A festive hat')) Game.specialTabs.push('santa');11649if (Game.Has('A crumbly egg')) Game.specialTabs.push('dragon');11650if (Game.specialTabs.length==0) {Game.ToggleSpecialMenu(0);return;}1165111652if (Game.LeftBackground)11653{11654Game.specialTabHovered='';11655var len=Game.specialTabs.length;11656if (len==0) return;11657var y=Game.LeftBackground.canvas.height-24-48*len;11658for (var i in Game.specialTabs)11659{11660var selected=0;11661if (Game.specialTab==Game.specialTabs[i]) selected=1;11662var x=24;11663var s=1;11664if (selected) {s=2;x+=24;}1166511666if (Math.abs(Game.mouseX-x)<=24*s && Math.abs(Game.mouseY-y)<=24*s)11667{11668Game.specialTabHovered=Game.specialTabs[i];11669Game.mousePointer=1;11670Game.CanClick=0;11671if (Game.Click)11672{11673if (Game.specialTab!=Game.specialTabs[i]) {Game.specialTab=Game.specialTabs[i];Game.ToggleSpecialMenu(1);PlaySound('snd/press.mp3');}11674else {Game.ToggleSpecialMenu(0);PlaySound('snd/press.mp3');}11675//PlaySound('snd/tick.mp3');11676}11677}1167811679y+=48;11680}11681}11682}1168311684Game.santaLevels=['Festive test tube','Festive ornament','Festive wreath','Festive tree','Festive present','Festive elf fetus','Elf toddler','Elfling','Young elf','Bulky elf','Nick','Santa Claus','Elder Santa','True Santa','Final Claus'];11685for (var i in Game.santaDrops)//scale christmas upgrade prices with santa level11686{Game.Upgrades[Game.santaDrops[i]].priceFunc=function(){return Math.pow(3,Game.santaLevel)*2525;}}116871168811689Game.UpgradeSanta=function()11690{11691var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);11692if (Game.cookies>moni && Game.santaLevel<14)11693{11694PlaySound('snd/shimmerClick.mp3');1169511696Game.Spend(moni);11697Game.santaLevel=(Game.santaLevel+1)%15;11698if (Game.santaLevel==14)11699{11700Game.Unlock('Santa\'s dominion');11701if (Game.prefs.popups) Game.Popup('You are granted<br>Santa\'s dominion.');11702else Game.Notify('You are granted Santa\'s dominion.','',Game.Upgrades['Santa\'s dominion'].icon);11703}11704var drops=[];11705for (var i in Game.santaDrops) {if (!Game.HasUnlocked(Game.santaDrops[i])) drops.push(Game.santaDrops[i]);}11706var drop=choose(drops);11707if (drop)11708{11709Game.Unlock(drop);11710if (Game.prefs.popups) Game.Popup('You find a present which contains...<br>'+drop+'!');11711else Game.Notify('Found a present!','You find a present which contains...<br><b>'+drop+'</b>!',Game.Upgrades[drop].icon);11712}1171311714Game.ToggleSpecialMenu(1);1171511716if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}1171711718if (Game.santaLevel>=6) Game.Win('Coming to town');11719if (Game.santaLevel>=14) Game.Win('All hail Santa');11720Game.recalculateGains=1;11721Game.upgradesToRebuild=1;11722}11723}1172411725Game.dragonLevels=[11726{name:'Dragon egg',action:'Chip it',pic:0,11727cost:function(){return Game.cookies>=1000000;},11728buy:function(){Game.Spend(1000000);},11729costStr:function(){return Beautify(1000000)+' cookies';}},11730{name:'Dragon egg',action:'Chip it',pic:1,11731cost:function(){return Game.cookies>=1000000*2;},11732buy:function(){Game.Spend(1000000*2);},11733costStr:function(){return Beautify(1000000*2)+' cookies';}},11734{name:'Dragon egg',action:'Chip it',pic:2,11735cost:function(){return Game.cookies>=1000000*4;},11736buy:function(){Game.Spend(1000000*4);},11737costStr:function(){return Beautify(1000000*4)+' cookies';}},11738{name:'Shivering dragon egg',action:'Hatch it',pic:3,11739cost:function(){return Game.cookies>=1000000*8;},11740buy:function(){Game.Spend(1000000*8);},11741costStr:function(){return Beautify(1000000*8)+' cookies';}},11742{name:'Krumblor, cookie hatchling',action:'Train Breath of Milk<br><small>Aura : kittens are 5% more effective</small>',pic:4,11743cost:function(){return Game.cookies>=1000000*16;},11744buy:function(){Game.Spend(1000000*16);},11745costStr:function(){return Beautify(1000000*16)+' cookies';}},11746{name:'Krumblor, cookie hatchling',action:'Train Dragon Cursor<br><small>Aura : clicking is 5% more effective</small>',pic:4,11747cost:function(){return Game.Objects['Cursor'].amount>=100;},11748buy:function(){Game.Objects['Cursor'].sacrifice(100);},11749costStr:function(){return '100 cursors';}},11750{name:'Krumblor, cookie hatchling',action:'Train Elder Battalion<br><small>Aura : grandmas gain +1% CpS for every non-grandma building</small>',pic:4,11751cost:function(){return Game.Objects['Grandma'].amount>=100;},11752buy:function(){Game.Objects['Grandma'].sacrifice(100);},11753costStr:function(){return '100 grandmas';}},11754{name:'Krumblor, cookie hatchling',action:'Train Reaper of Fields<br><small>Aura : golden cookies may trigger a Dragon Harvest</small>',pic:4,11755cost:function(){return Game.Objects['Farm'].amount>=100;},11756buy:function(){Game.Objects['Farm'].sacrifice(100);},11757costStr:function(){return '100 farms';}},11758{name:'Krumblor, cookie dragon',action:'Train Earth Shatterer<br><small>Aura : buildings sell back for 50% instead of 25%</small>',pic:5,11759cost:function(){return Game.Objects['Mine'].amount>=100;},11760buy:function(){Game.Objects['Mine'].sacrifice(100);},11761costStr:function(){return '100 mines';}},11762{name:'Krumblor, cookie dragon',action:'Train Master of the Armory<br><small>Aura : all upgrades are 2% cheaper</small>',pic:5,11763cost:function(){return Game.Objects['Factory'].amount>=100;},11764buy:function(){Game.Objects['Factory'].sacrifice(100);},11765costStr:function(){return '100 factories';}},11766{name:'Krumblor, cookie dragon',action:'Train Fierce Hoarder<br><small>Aura : all buildings are 2% cheaper</small>',pic:5,11767cost:function(){return Game.Objects['Bank'].amount>=100;},11768buy:function(){Game.Objects['Bank'].sacrifice(100);},11769costStr:function(){return '100 banks';}},11770{name:'Krumblor, cookie dragon',action:'Train Dragon God<br><small>Aura : prestige CpS bonus +5%</small>',pic:5,11771cost:function(){return Game.Objects['Temple'].amount>=100;},11772buy:function(){Game.Objects['Temple'].sacrifice(100);},11773costStr:function(){return '100 temples';}},11774{name:'Krumblor, cookie dragon',action:'Train Arcane Aura<br><small>Aura : golden cookies appear 5% more often</small>',pic:5,11775cost:function(){return Game.Objects['Wizard tower'].amount>=100;},11776buy:function(){Game.Objects['Wizard tower'].sacrifice(100);},11777costStr:function(){return '100 wizard towers';}},11778{name:'Krumblor, cookie dragon',action:'Train Dragonflight<br><small>Aura : golden cookies may trigger a Dragonflight</small>',pic:5,11779cost:function(){return Game.Objects['Shipment'].amount>=100;},11780buy:function(){Game.Objects['Shipment'].sacrifice(100);},11781costStr:function(){return '100 shipments';}},11782{name:'Krumblor, cookie dragon',action:'Train Ancestral Metamorphosis<br><small>Aura : golden cookies give 10% more cookies</small>',pic:5,11783cost:function(){return Game.Objects['Alchemy lab'].amount>=100;},11784buy:function(){Game.Objects['Alchemy lab'].sacrifice(100);},11785costStr:function(){return '100 alchemy labs';}},11786{name:'Krumblor, cookie dragon',action:'Train Unholy Dominion<br><small>Aura : wrath cookies give 10% more cookies</small>',pic:5,11787cost:function(){return Game.Objects['Portal'].amount>=100;},11788buy:function(){Game.Objects['Portal'].sacrifice(100);},11789costStr:function(){return '100 portals';}},11790{name:'Krumblor, cookie dragon',action:'Train Epoch Manipulator<br><small>Aura : golden cookie effects last 5% longer</small>',pic:5,11791cost:function(){return Game.Objects['Time machine'].amount>=100;},11792buy:function(){Game.Objects['Time machine'].sacrifice(100);},11793costStr:function(){return '100 time machines';}},11794{name:'Krumblor, cookie dragon',action:'Train Mind Over Matter<br><small>Aura : +25% random drops</small>',pic:5,11795cost:function(){return Game.Objects['Antimatter condenser'].amount>=100;},11796buy:function(){Game.Objects['Antimatter condenser'].sacrifice(100);},11797costStr:function(){return '100 antimatter condensers';}},11798{name:'Krumblor, cookie dragon',action:'Train Radiant Appetite<br><small>Aura : all cookie production multiplied by 2</small>',pic:5,11799cost:function(){return Game.Objects['Prism'].amount>=100;},11800buy:function(){Game.Objects['Prism'].sacrifice(100);},11801costStr:function(){return '100 prisms';}},11802{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Fortune<br><small>Aura : +123% CpS per golden cookie on-screen</small>',pic:5,11803cost:function(){return Game.Objects['Chancemaker'].amount>=100;},11804buy:function(){Game.Objects['Chancemaker'].sacrifice(100);},11805costStr:function(){return '100 chancemakers';}},11806{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Curve<br><small>Aura : sugar lumps grow 5% faster, 50% weirder</small>',pic:5,11807cost:function(){return Game.Objects['Fractal engine'].amount>=100;},11808buy:function(){Game.Objects['Fractal engine'].sacrifice(100);},11809costStr:function(){return '100 fractal engines';}},11810{name:'Krumblor, cookie dragon',action:'Train Reality Bending<br><small>Aura : 10% of every other aura, combined</small>',pic:5,11811cost:function(){return Game.Objects['Javascript console'].amount>=100;},11812buy:function(){Game.Objects['Javascript console'].sacrifice(100);},11813costStr:function(){return '100 javascript consoles';}},11814{name:'Krumblor, cookie dragon',action:'Bake dragon cookie<br><small>Delicious!</small>',pic:6,11815cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<50) fail=1;}return (fail==0);},11816buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(50);}Game.Unlock('Dragon cookie');},11817costStr:function(){return '50 of every building';}},11818{name:'Krumblor, cookie dragon',action:'Train secondary aura<br><small>Lets you use two dragon auras simultaneously</small>',pic:7,11819cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<200) fail=1;}return (fail==0);},11820buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(200);}},11821costStr:function(){return '200 of every building';}},11822{name:'Krumblor, cookie dragon',action:'Your dragon is fully trained.',pic:8}11823];1182411825Game.dragonAuras={118260:{name:'No aura',pic:[0,7],desc:'Select an aura from those your dragon knows.'},118271:{name:'Breath of Milk',pic:[18,25],desc:'Kittens are <b>5%</b> more effective.'},118282:{name:'Dragon Cursor',pic:[0,25],desc:'Clicking is <b>5%</b> more effective.'},118293:{name:'Elder Battalion',pic:[1,25],desc:'Grandmas gain <b>+1% CpS</b> for every non-grandma building.'},118304:{name:'Reaper of Fields',pic:[2,25],desc:'Golden cookies may trigger a <b>Dragon Harvest</b>.'},118315:{name:'Earth Shatterer',pic:[3,25],desc:'Buildings sell back for <b>50%</b> instead of 25%.'},118326:{name:'Master of the Armory',pic:[4,25],desc:'All upgrades are <b>2%</b> cheaper.'},118337:{name:'Fierce Hoarder',pic:[15,25],desc:'All buildings are <b>2%</b> cheaper.'},118348:{name:'Dragon God',pic:[16,25],desc:'Prestige CpS bonus <b>+5%</b>.'},118359:{name:'Arcane Aura',pic:[17,25],desc:'Golden cookies appear <b>+5%</b> more often.'},1183610:{name:'Dragonflight',pic:[5,25],desc:'Golden cookies may trigger a <b>Dragonflight</b>.'},1183711:{name:'Ancestral Metamorphosis',pic:[6,25],desc:'Golden cookies give <b>10%</b> more cookies.'},1183812:{name:'Unholy Dominion',pic:[7,25],desc:'Wrath cookies give <b>10%</b> more cookies.'},1183913:{name:'Epoch Manipulator',pic:[8,25],desc:'Golden cookies last <b>5%</b> longer.'},1184014:{name:'Mind Over Matter',pic:[13,25],desc:'Random drops are <b>25% more common</b>.'},1184115:{name:'Radiant Appetite',pic:[14,25],desc:'All cookie production <b>multiplied by 2</b>.'},1184216:{name:'Dragon\'s Fortune',pic:[19,25],desc:'<b>+123% CpS</b> per golden cookie on-screen, multiplicative.'},1184317:{name:'Dragon\'s Curve',pic:[20,25],desc:'<b>+5% sugar lump growth</b> and sugar lumps are <b>twice as likely</b> to be unusual.'},1184418:{name:'Reality Bending',pic:[32,25],desc:'<b>One tenth</b> of every other dragon aura, <b>combined</b>.'},11845};1184611847Game.hasAura=function(what)11848{11849if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) return true; else return false;11850}11851Game.auraMult=function(what)11852{11853var n=0;11854if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) n=1;11855if (Game.dragonAuras[Game.dragonAura].name=='Reality Bending' || Game.dragonAuras[Game.dragonAura2].name=='Reality Bending') n+=0.1;11856return n;11857}1185811859Game.SelectDragonAura=function(slot,update)11860{11861var currentAura=0;11862var otherAura=0;11863if (slot==0) currentAura=Game.dragonAura; else currentAura=Game.dragonAura2;11864if (slot==0) otherAura=Game.dragonAura2; else otherAura=Game.dragonAura;11865if (!update) Game.SelectingDragonAura=currentAura;1186611867var str='';11868for (var i in Game.dragonAuras)11869{11870if (Game.dragonLevel>=parseInt(i)+4)11871{11872var icon=Game.dragonAuras[i].pic;11873if (i==0 || i!=otherAura) str+='<div class="crate enabled'+(i==Game.SelectingDragonAura?' highlighted':'')+'" style="opacity:1;float:none;display:inline-block;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SetDragonAura('+i+','+slot+');" onMouseOut="Game.DescribeDragonAura('+Game.SelectingDragonAura+');" onMouseOver="Game.DescribeDragonAura('+i+');"'+11874'></div>';11875}11876}1187711878var highestBuilding=0;11879for (var i in Game.Objects) {if (Game.Objects[i].amount>0) highestBuilding=Game.Objects[i];}1188011881Game.Prompt('<h3>Set your dragon\'s '+(slot==1?'secondary ':'')+'aura</h3>'+11882'<div class="line"></div>'+11883'<div id="dragonAuraInfo" style="min-height:60px;"></div>'+11884'<div style="text-align:center;">'+str+'</div>'+11885'<div class="line"></div>'+11886'<div style="text-align:center;margin-bottom:8px;">'+(highestBuilding==0?'Switching your aura is <b>free</b> because you own no buildings.':'The cost of switching your aura is <b>1 '+highestBuilding.name+'</b>.<br>This will affect your CpS!')+'</div>'11887,[['Confirm',(slot==0?'Game.dragonAura':'Game.dragonAura2')+'=Game.SelectingDragonAura;'+(highestBuilding==0 || currentAura==Game.SelectingDragonAura?'':'Game.ObjectsById['+highestBuilding.id+'].sacrifice(1);')+'Game.ToggleSpecialMenu(1);Game.ClosePrompt();'],'Cancel'],0,'widePrompt');11888Game.DescribeDragonAura(Game.SelectingDragonAura);11889}11890Game.SelectingDragonAura=-1;11891Game.SetDragonAura=function(aura,slot)11892{11893Game.SelectingDragonAura=aura;11894Game.SelectDragonAura(slot,1);11895}11896Game.DescribeDragonAura=function(aura)11897{11898l('dragonAuraInfo').innerHTML=11899'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[aura].name+'</h4>'+11900'<div class="line"></div>'+11901Game.dragonAuras[aura].desc+11902'</div>';11903}1190411905Game.UpgradeDragon=function()11906{11907if (Game.dragonLevel<Game.dragonLevels.length-1 && Game.dragonLevels[Game.dragonLevel].cost())11908{11909PlaySound('snd/shimmerClick.mp3');11910Game.dragonLevels[Game.dragonLevel].buy();11911Game.dragonLevel=(Game.dragonLevel+1)%Game.dragonLevels.length;1191211913if (Game.dragonLevel>=Game.dragonLevels.length-1) Game.Win('Here be dragon');11914Game.ToggleSpecialMenu(1);11915if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}11916Game.recalculateGains=1;11917Game.upgradesToRebuild=1;11918}11919}1192011921Game.ToggleSpecialMenu=function(on)11922{11923if (on)11924{11925var pic='';11926var frame=0;11927if (Game.specialTab=='santa') {pic='santa.png';frame=Game.santaLevel;}11928else if (Game.specialTab=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}11929else {pic='dragon.png?v='+Game.version;frame=4;}1193011931var str='<div id="specialPic" style="position:absolute;left:-16px;top:-64px;width:96px;height:96px;background:url(img/'+pic+');background-position:'+(-frame*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div>';11932str+='<div class="close" onclick="PlaySound(\'snd/press.mp3\');Game.ToggleSpecialMenu(0);">x</div>';1193311934if (Game.specialTab=='santa')11935{11936var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);1193711938str+='<h3>'+Game.santaLevels[Game.santaLevel]+'</h3>';11939if (Game.santaLevel<14)11940{11941str+='<div class="line"></div>'+11942'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeSanta();">'+11943'<div style="display:table-cell;vertical-align:middle;">Evolve</div>'+11944'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+11945'<div style="display:table-cell;vertical-align:middle;font-size:65%;">cost :<div'+(Game.cookies>moni?'':' style="color:#777;"')+'>'+Beautify(Math.pow(Game.santaLevel+1,Game.santaLevel+1))+' '+(Game.santaLevel>0?'cookies':'cookie')+'</div></div>'+11946'</a></div>';11947}11948}11949else if (Game.specialTab=='dragon')11950{11951var level=Game.dragonLevels[Game.dragonLevel];1195211953str+='<h3>'+level.name+'</h3>';1195411955if (Game.dragonLevel>=5)11956{11957var icon=Game.dragonAuras[Game.dragonAura].pic;11958str+='<div class="crate enabled" style="opacity:1;position:absolute;right:18px;top:-58px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SelectDragonAura(0);" '+Game.getTooltip(11959'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura].name+'</h4>'+11960'<div class="line"></div>'+11961Game.dragonAuras[Game.dragonAura].desc+11962'</div>'11963,'top')+11964'></div>';11965}11966if (Game.dragonLevel>=24)//2nd aura slot; increased with last building (javascript consoles)11967{11968var icon=Game.dragonAuras[Game.dragonAura2].pic;11969str+='<div class="crate enabled" style="opacity:1;position:absolute;right:80px;top:-58px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SelectDragonAura(1);" '+Game.getTooltip(11970'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura2].name+'</h4>'+11971'<div class="line"></div>'+11972Game.dragonAuras[Game.dragonAura2].desc+11973'</div>'11974,'top')+11975'></div>';11976}1197711978if (Game.dragonLevel<Game.dragonLevels.length-1)11979{11980str+='<div class="line"></div>'+11981'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeDragon();">'+11982'<div style="display:table-cell;vertical-align:middle;">'+level.action+'</div>'+11983'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+11984'<div style="display:table-cell;vertical-align:middle;font-size:65%;">sacrifice<div'+(level.cost()?'':' style="color:#777;"')+'>'+level.costStr()+'</div></div>'+11985'</a></div>';11986}11987else11988{11989str+='<div class="line"></div>'+11990'<div style="text-align:center;margin-bottom:4px;">'+level.action+'</div>';11991}11992}1199311994l('specialPopup').innerHTML=str;1199511996l('specialPopup').className='framed prompt onScreen';11997}11998else11999{12000if (Game.specialTab!='')12001{12002Game.specialTab='';12003l('specialPopup').className='framed prompt offScreen';12004setTimeout(function(){if (Game.specialTab=='') {/*l('specialPopup').style.display='none';*/l('specialPopup').innerHTML='';}},1000*0.2);12005}12006}12007}12008Game.DrawSpecial=function()12009{12010var len=Game.specialTabs.length;12011if (len==0) return;12012Game.LeftBackground.globalAlpha=1;12013var y=Game.LeftBackground.canvas.height-24-48*len;12014var tabI=0;1201512016for (var i in Game.specialTabs)12017{12018var selected=0;12019var hovered=0;12020if (Game.specialTab==Game.specialTabs[i]) selected=1;12021if (Game.specialTabHovered==Game.specialTabs[i]) hovered=1;12022var x=24;12023var s=1;12024var pic='';12025var frame=0;12026if (hovered) {s=1;x=24;}12027if (selected) {s=1;x=48;}1202812029if (Game.specialTabs[i]=='santa') {pic='santa.png';frame=Game.santaLevel;}12030else if (Game.specialTabs[i]=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}12031else {pic='dragon.png?v='+Game.version;frame=4;}1203212033if (hovered || selected)12034{12035var ss=s*64;12036var r=Math.floor((Game.T*0.5)%360);12037Game.LeftBackground.save();12038Game.LeftBackground.translate(x,y);12039if (Game.prefs.fancy) Game.LeftBackground.rotate((r/360)*Math.PI*2);12040Game.LeftBackground.globalAlpha=0.75;12041Game.LeftBackground.drawImage(Pic('shine.png'),-ss/2,-ss/2,ss,ss);12042Game.LeftBackground.restore();12043}1204412045if (Game.prefs.fancy) Game.LeftBackground.drawImage(Pic(pic),96*frame,0,96,96,(x+(selected?0:Math.sin(Game.T*0.2+tabI)*3)-24*s),(y-(selected?6:Math.abs(Math.cos(Game.T*0.2+tabI))*6)-24*s),48*s,48*s);12046else Game.LeftBackground.drawImage(Pic(pic),96*frame,0,96,96,(x-24*s),(y-24*s),48*s,48*s);1204712048tabI++;12049y+=48;12050}1205112052}1205312054/*=====================================================================================12055VISUAL EFFECTS12056=======================================================================================*/1205712058Game.Milks=[12059{name:'Rank I - Plain milk',pic:'milkPlain',icon:[1,8]},12060{name:'Rank II - Chocolate milk',pic:'milkChocolate',icon:[2,8]},12061{name:'Rank III - Raspberry milk',pic:'milkRaspberry',icon:[3,8]},12062{name:'Rank IV - Orange milk',pic:'milkOrange',icon:[4,8]},12063{name:'Rank V - Caramel milk',pic:'milkCaramel',icon:[5,8]},12064{name:'Rank VI - Banana milk',pic:'milkBanana',icon:[6,8]},12065{name:'Rank VII - Lime milk',pic:'milkLime',icon:[7,8]},12066{name:'Rank VIII - Blueberry milk',pic:'milkBlueberry',icon:[8,8]},12067{name:'Rank IX - Strawberry milk',pic:'milkStrawberry',icon:[9,8]},12068{name:'Rank X - Vanilla milk',pic:'milkVanilla',icon:[10,8]},12069{name:'Rank XI - Honey milk',pic:'milkHoney',icon:[21,23]},12070{name:'Rank XII - Coffee milk',pic:'milkCoffee',icon:[22,23]},12071{name:'Rank XIII - Tea with a spot of milk',pic:'milkTea',icon:[23,23]},12072{name:'Rank XIV - Coconut milk',pic:'milkCoconut',icon:[24,23]},12073{name:'Rank XV - Cherry milk',pic:'milkCherry',icon:[25,23]},12074{name:'Rank XVI - Spiced milk',pic:'milkSpiced',icon:[26,23]},12075{name:'Rank XVII - Maple milk',pic:'milkMaple',icon:[28,23]},12076{name:'Rank XVIII - Mint milk',pic:'milkMint',icon:[29,23]},12077];12078Game.Milk=Game.Milks[0];1207912080Game.mousePointer=0;//when 1, draw the mouse as a pointer on the left screen1208112082Game.cookieOriginX=0;12083Game.cookieOriginY=0;12084Game.DrawBackground=function()12085{1208612087Timer.clean();12088//background12089if (!Game.Background)//init some stuff12090{12091Game.Background=l('backgroundCanvas').getContext('2d');12092Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;12093Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;12094Game.LeftBackground=l('backgroundLeftCanvas').getContext('2d');12095Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;12096Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;12097//preload ascend animation bits so they show up instantly12098Game.LeftBackground.globalAlpha=0;12099Game.LeftBackground.drawImage(Pic('brokenCookie.png'),0,0);12100Game.LeftBackground.drawImage(Pic('brokenCookieHalo.png'),0,0);12101Game.LeftBackground.drawImage(Pic('starbg.jpg'),0,0);1210212103window.addEventListener('resize', function(event)12104{12105Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;12106Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;12107Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;12108Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;12109});12110}1211112112var ctx=Game.LeftBackground;1211312114if (Game.OnAscend)12115{12116Timer.clean();12117//starry background on ascend screen12118var w=Game.Background.canvas.width;12119var h=Game.Background.canvas.height;12120var b=Game.ascendl.getBoundingClientRect();12121var x=(b.left+b.right)/2;12122var y=(b.top+b.bottom)/2;12123Game.Background.globalAlpha=0.5;12124var s=1*Game.AscendZoom*(1+Math.cos(Game.T*0.0027)*0.05);12125Game.Background.fillPattern(Pic('starbg.jpg'),0,0,w,h,1024*s,1024*s,x+Game.AscendOffX*0.25*s,y+Game.AscendOffY*0.25*s);12126Timer.track('star layer 1');12127if (Game.prefs.fancy)12128{12129//additional star layer12130Game.Background.globalAlpha=0.5*(0.5+Math.sin(Game.T*0.02)*0.3);12131var s=2*Game.AscendZoom*(1+Math.sin(Game.T*0.002)*0.07);12132//Game.Background.globalCompositeOperation='lighter';12133Game.Background.fillPattern(Pic('starbg.jpg'),0,0,w,h,1024*s,1024*s,x+Game.AscendOffX*0.25*s,y+Game.AscendOffY*0.25*s);12134//Game.Background.globalCompositeOperation='source-over';12135Timer.track('star layer 2');1213612137x=x+Game.AscendOffX*Game.AscendZoom;12138y=y+Game.AscendOffY*Game.AscendZoom;12139//wispy nebula around the center12140Game.Background.save();12141Game.Background.globalAlpha=0.5;12142Game.Background.translate(x,y);12143Game.Background.globalCompositeOperation='lighter';12144Game.Background.rotate(Game.T*0.001);12145s=(600+150*Math.sin(Game.T*0.007))*Game.AscendZoom;12146Game.Background.drawImage(Pic('heavenRing1.jpg'),-s/2,-s/2,s,s);12147Game.Background.rotate(-Game.T*0.0017);12148s=(600+150*Math.sin(Game.T*0.0037))*Game.AscendZoom;12149Game.Background.drawImage(Pic('heavenRing2.jpg'),-s/2,-s/2,s,s);12150Game.Background.restore();12151Timer.track('nebula');1215212153/*12154//links between upgrades12155//not in because I am bad at this12156Game.Background.globalAlpha=1;12157Game.Background.save();12158Game.Background.translate(x,y);12159s=(32)*Game.AscendZoom;1216012161for (var i in Game.PrestigeUpgrades)12162{12163var me=Game.PrestigeUpgrades[i];12164var ghosted=0;12165if (me.canBePurchased || Game.Has('Neuromancy')){}12166else12167{12168for (var ii in me.parents){if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;}12169}12170for (var ii in me.parents)//create pulsing links12171{12172if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))12173{12174var origX=0;12175var origY=0;12176var targX=me.posX+28;12177var targY=me.posY+28;12178if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}12179var rot=-Math.atan((targY-origY)/(origX-targX));12180if (targX<=origX) rot+=180;12181var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));12182origX+=2;12183origY-=18;12184//rot=-(Math.PI/2)*(me.id%4);12185Game.Background.translate(origX,origY);12186Game.Background.rotate(rot);12187//Game.Background.drawImage(Pic('linkPulse.png'),-s/2,-s/2,s,s);12188Game.Background.fillPattern(Pic('linkPulse.png'),0,-4,dist,8,32,8);12189Game.Background.rotate(-rot);12190Game.Background.translate(-origX,-origY);12191}12192}12193}12194Game.Background.restore();12195Timer.track('links');12196*/1219712198//Game.Background.drawImage(Pic('shadedBorders.png'),0,0,w,h);12199//Timer.track('border');12200}12201}12202else12203{1220412205var goodBuff=0;12206var badBuff=0;12207for (var i in Game.buffs)12208{12209if (Game.buffs[i].aura==1) goodBuff=1;12210if (Game.buffs[i].aura==2) badBuff=1;12211}1221212213if (Game.drawT%5==0)12214{12215Game.defaultBg='bgBlue';12216Game.bgR=0;1221712218if (Game.season=='fools') Game.defaultBg='bgMoney';12219if (Game.elderWrathD<1)12220{12221Game.bgR=0;12222Game.bg=Game.defaultBg;12223Game.bgFade=Game.defaultBg;12224}12225else if (Game.elderWrathD>=1 && Game.elderWrathD<2)12226{12227Game.bgR=(Game.elderWrathD-1)/1;12228Game.bg=Game.defaultBg;12229Game.bgFade='grandmas1';12230}12231else if (Game.elderWrathD>=2 && Game.elderWrathD<3)12232{12233Game.bgR=(Game.elderWrathD-2)/1;12234Game.bg='grandmas1';12235Game.bgFade='grandmas2';12236}12237else if (Game.elderWrathD>=3)// && Game.elderWrathD<4)12238{12239Game.bgR=(Game.elderWrathD-3)/1;12240Game.bg='grandmas2';12241Game.bgFade='grandmas3';12242}1224312244if (Game.bgType!=0 && Game.ascensionMode!=1)12245{12246Game.bgR=0;12247Game.bg=Game.BGsByChoice[Game.bgType].pic;12248Game.bgFade=Game.bg;12249}1225012251Game.Background.fillPattern(Pic(Game.bg+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);12252if (Game.bgR>0)12253{12254Game.Background.globalAlpha=Game.bgR;12255Game.Background.fillPattern(Pic(Game.bgFade+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);12256}12257Game.Background.globalAlpha=1;12258Game.Background.drawImage(Pic('shadedBordersSoft.png'),0,0,Game.Background.canvas.width,Game.Background.canvas.height);1225912260}12261Timer.track('window background');1226212263//clear12264ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);12265/*if (Game.AscendTimer<Game.AscendBreakpoint) ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);12266else12267{12268ctx.globalAlpha=0.05;12269ctx.fillStyle='#000';12270ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);12271ctx.globalAlpha=1;12272OldCanvasDrawImage.apply(ctx,[ctx.canvas,Math.random()*4-2,Math.random()*4-2-4]);12273ctx.globalAlpha=1;12274}*/12275Timer.clean();1227612277var showDragon=0;12278if (Game.hasBuff('Dragonflight') || Game.hasBuff('Dragon Harvest')) showDragon=1;1227912280Game.cookieOriginX=Math.floor(ctx.canvas.width/2);12281Game.cookieOriginY=Math.floor(ctx.canvas.height*0.4);1228212283if (Game.AscendTimer==0)12284{12285if (Game.prefs.particles)12286{12287//falling cookies12288var pic='';12289var opacity=1;12290if (Game.elderWrathD<=1.5)12291{12292if (Game.cookiesPs>=1000) pic='cookieShower3.png';12293else if (Game.cookiesPs>=500) pic='cookieShower2.png';12294else if (Game.cookiesPs>=50) pic='cookieShower1.png';12295else pic='';12296}12297if (pic!='')12298{12299if (Game.elderWrathD>=1) opacity=1-((Math.min(Game.elderWrathD,1.5)-1)/0.5);12300ctx.globalAlpha=opacity;12301var y=(Math.floor(Game.T*2)%512);12302ctx.fillPattern(Pic(pic),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);12303ctx.globalAlpha=1;12304}12305//snow12306if (Game.season=='christmas')12307{12308var y=(Math.floor(Game.T*2.5)%512);12309ctx.globalAlpha=0.75;12310ctx.globalCompositeOperation='lighter';12311ctx.fillPattern(Pic('snow2.jpg'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);12312ctx.globalCompositeOperation='source-over';12313ctx.globalAlpha=1;12314}12315//hearts12316if (Game.season=='valentines')12317{12318var y=(Math.floor(Game.T*2.5)%512);12319ctx.globalAlpha=1;12320ctx.fillPattern(Pic('heartStorm.png'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);12321ctx.globalAlpha=1;12322}12323Timer.track('left background');1232412325Game.particlesDraw(0);12326ctx.globalAlpha=1;12327Timer.track('particles');1232812329//big cookie shine12330var s=512;1233112332var x=Game.cookieOriginX;12333var y=Game.cookieOriginY;1233412335var r=Math.floor((Game.T*0.5)%360);12336ctx.save();12337ctx.translate(x,y);12338ctx.rotate((r/360)*Math.PI*2);12339var alphaMult=1;12340if (Game.bgType==2 || Game.bgType==4) alphaMult=0.5;12341var pic='shine.png';12342if (goodBuff) {pic='shineGold.png';alphaMult=1;}12343else if (badBuff) {pic='shineRed.png';alphaMult=1;}12344if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';12345ctx.globalAlpha=0.5*alphaMult;12346ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);12347ctx.rotate((-r*2/360)*Math.PI*2);12348ctx.globalAlpha=0.25*alphaMult;12349ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);12350ctx.restore();12351Timer.track('shine');1235212353if (Game.ReincarnateTimer>0)12354{12355ctx.globalAlpha=1-Game.ReincarnateTimer/Game.ReincarnateDuration;12356ctx.fillStyle='#000';12357ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);12358ctx.globalAlpha=1;12359}1236012361if (showDragon)12362{12363//big dragon12364var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);12365var x=Game.cookieOriginX-s/2;12366var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));12367ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);12368}1236912370//big cookie12371if (false)//don't do that12372{12373ctx.globalAlpha=1;12374var amount=Math.floor(Game.cookies).toString();12375var digits=amount.length;12376var space=0;12377for (var i=0;i<digits;i++)12378{12379var s=16*(digits-i);12380var num=parseInt(amount[i]);12381if (i>0) space-=s*(1-num/10)/2;12382if (i==0 && num>1) space+=s*0.1;12383for (var ii=0;ii<num;ii++)12384{12385var x=Game.cookieOriginX;12386var y=Game.cookieOriginY;12387var spin=Game.T*(0.005+i*0.001)+i+(ii/num)*Math.PI*2;12388x+=Math.sin(spin)*space;12389y+=Math.cos(spin)*space;12390ctx.drawImage(Pic('perfectCookie.png'),x-s/2,y-s/2,s,s);12391}12392space+=s/2;12393}12394}12395else12396{12397ctx.globalAlpha=1;12398var s=256*Game.BigCookieSize;12399var x=Game.cookieOriginX;12400var y=Game.cookieOriginY;12401ctx.save();12402ctx.translate(x,y);12403if (Game.season=='easter')12404{12405var nestW=304*0.98*Game.BigCookieSize;12406var nestH=161*0.98*Game.BigCookieSize;12407ctx.drawImage(Pic('nest.png'),-nestW/2,-nestH/2+130,nestW,nestH);12408}12409//ctx.rotate(((Game.startDate%360)/360)*Math.PI*2);12410ctx.drawImage(Pic('perfectCookie.png'),-s/2,-s/2,s,s);1241112412if (goodBuff && Game.prefs.particles)//sparkle12413{12414ctx.globalCompositeOperation='lighter';12415for (var i=0;i<1;i++)12416{12417ctx.globalAlpha=Math.random()*0.65+0.1;12418var size=Math.random()*30+5;12419var a=Math.random()*Math.PI*2;12420var d=s*0.9*Math.random()/2;12421ctx.drawImage(Pic('glint.jpg'),-size/2+Math.sin(a)*d,-size/2+Math.cos(a)*d,size,size);12422}12423}1242412425ctx.restore();12426Timer.track('big cookie');12427}12428}12429else//no particles12430{12431//big cookie shine12432var s=512;12433var x=Game.cookieOriginX-s/2;12434var y=Game.cookieOriginY-s/2;12435ctx.globalAlpha=0.5;12436ctx.drawImage(Pic('shine.png'),x,y,s,s);1243712438if (showDragon)12439{12440//big dragon12441var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);12442var x=Game.cookieOriginX-s/2;12443var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));12444ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);12445}1244612447//big cookie12448ctx.globalAlpha=1;12449var s=256*Game.BigCookieSize;12450var x=Game.cookieOriginX-s/2;12451var y=Game.cookieOriginY-s/2;12452ctx.drawImage(Pic('perfectCookie.png'),x,y,s,s);12453}1245412455//cursors12456if (Game.prefs.cursors)12457{12458ctx.save();12459ctx.translate(Game.cookieOriginX,Game.cookieOriginY);12460var pic=Pic('cursor.png');12461var fancy=Game.prefs.fancy;1246212463if (showDragon) ctx.globalAlpha=0.25;12464var amount=Game.Objects['Cursor'].amount;12465//var spe=-1;12466for (var i=0;i<amount;i++)12467{12468var n=Math.floor(i/50);12469//var a=((i+0.5*n)%50)/50;12470var w=0;12471if (fancy) w=(Math.sin(Game.T*0.025+(((i+n*12)%25)/25)*Math.PI*2));12472if (w>0.997) w=1.5;12473else if (w>0.994) w=0.5;12474else w=0;12475w*=-4;12476if (fancy) w+=Math.sin((n+Game.T*0.01)*Math.PI/2)*4;12477var x=0;12478var y=(140/* *Game.BigCookieSize*/+n*16+w)-16;1247912480var rot=7.2;//(1/50)*36012481if (i==0 && fancy) rot-=Game.T*0.1;12482if (i%50==0) rot+=7.2/2;12483ctx.rotate((rot/360)*Math.PI*2);12484ctx.drawImage(pic,0,0,32,32,x,y,32,32);12485//ctx.drawImage(pic,32*(i==spe),0,32,32,x,y,32,32);1248612487/*if (i==spe)12488{12489y+=16;12490x=Game.cookieOriginX+Math.sin(-((r-5)/360)*Math.PI*2)*y;12491y=Game.cookieOriginY+Math.cos(-((r-5)/360)*Math.PI*2)*y;12492if (Game.CanClick && ctx && Math.abs(Game.mouseX-x)<16 && Math.abs(Game.mouseY-y)<16) Game.mousePointer=1;12493}*/12494}12495ctx.restore();12496Timer.track('cursors');12497}12498}12499else12500{12501var tBase=Math.max(0,(Game.AscendTimer-Game.AscendBreakpoint)/(Game.AscendDuration-Game.AscendBreakpoint));12502//big crumbling cookie12503//var t=(3*Math.pow(tBase,2)-2*Math.pow(tBase,3));//S curve12504var t=Math.pow(tBase,0.5);1250512506var shake=0;12507if (Game.AscendTimer<Game.AscendBreakpoint) {shake=Game.AscendTimer/Game.AscendBreakpoint;}12508//else {shake=1-t;}1250912510ctx.globalAlpha=1;1251112512var x=Game.cookieOriginX;12513var y=Game.cookieOriginY;1251412515x+=(Math.random()*2-1)*10*shake;12516y+=(Math.random()*2-1)*10*shake;1251712518var s=1;12519if (tBase>0)12520{12521ctx.save();12522ctx.globalAlpha=1-Math.pow(t,0.5);12523ctx.translate(x,y);12524ctx.globalCompositeOperation='lighter';12525ctx.rotate(Game.T*0.007);12526s=0.5+Math.pow(tBase,0.6)*1;12527var s2=(600)*s;12528ctx.drawImage(Pic('heavenRing1.jpg'),-s2/2,-s2/2,s2,s2);12529ctx.rotate(-Game.T*0.002);12530s=0.5+Math.pow(1-tBase,0.4)*1;12531s2=(600)*s;12532ctx.drawImage(Pic('heavenRing2.jpg'),-s2/2,-s2/2,s2,s2);12533ctx.restore();12534}1253512536s=256;//*Game.BigCookieSize;1253712538ctx.save();12539ctx.translate(x,y);12540ctx.rotate((t*(-0.1))*Math.PI*2);1254112542var chunks={0:7,1:6,2:3,3:2,4:8,5:1,6:9,7:5,8:0,9:4};12543s*=t/2+1;12544/*ctx.globalAlpha=(1-t)*0.33;12545for (var i=0;i<10;i++)12546{12547var d=(t-0.2)*(80+((i+2)%3)*40);12548ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,s,s);12549}12550ctx.globalAlpha=(1-t)*0.66;12551for (var i=0;i<10;i++)12552{12553var d=(t-0.1)*(80+((i+2)%3)*40);12554ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,s,s);12555}*/12556ctx.globalAlpha=1-t;12557for (var i=0;i<10;i++)12558{12559var d=(t)*(80+((i+2)%3)*40);12560var x2=(Math.random()*2-1)*5*shake;12561var y2=(Math.random()*2-1)*5*shake;12562ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d+x2,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d+y2,s,s);12563}12564var brokenHalo=1-Math.min(t/(1/3),1/3)*3;12565if (Game.AscendTimer<Game.AscendBreakpoint) brokenHalo=Game.AscendTimer/Game.AscendBreakpoint;12566ctx.globalAlpha=brokenHalo;12567ctx.drawImage(Pic('brokenCookieHalo.png'),-s/1.3333,-s/1.3333,s*1.5,s*1.5);1256812569ctx.restore();1257012571//flares12572var n=9;12573var t=Game.AscendTimer/Game.AscendBreakpoint;12574if (Game.AscendTimer<Game.AscendBreakpoint)12575{12576ctx.save();12577ctx.translate(x,y);12578for (var i=0;i<n;i++)12579{12580if (Math.floor(t/3*n*3+i*2.7)%2)12581{12582var t2=Math.pow((t/3*n*3+i*2.7)%1,1.5);12583ctx.globalAlpha=(1-t)*(Game.drawT%2==0?0.5:1);12584var sw=(1-t2*0.5)*96;12585var sh=(0.5+t2*1.5)*96;12586ctx.drawImage(Pic('shineSpoke.png'),-sw/2,-sh-32-(1-t2)*256,sw,sh);12587}12588ctx.rotate(Math.PI*2/n);12589}12590ctx.restore();12591}125921259312594//flash at breakpoint12595if (tBase<0.1 && tBase>0)12596{12597ctx.globalAlpha=1-tBase/0.1;12598ctx.fillStyle='#fff';12599ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);12600ctx.globalAlpha=1;12601}12602if (tBase>0.8)12603{12604ctx.globalAlpha=(tBase-0.8)/0.2;12605ctx.fillStyle='#000';12606ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);12607ctx.globalAlpha=1;12608}12609}1261012611//milk and milk accessories12612if (Game.prefs.milk)12613{12614var width=ctx.canvas.width;12615var height=ctx.canvas.height;12616var x=Math.floor((Game.T*2-(Game.milkH-Game.milkHd)*2000+480*2)%480);//Math.floor((Game.T*2+Math.sin(Game.T*0.1)*2+Math.sin(Game.T*0.03)*2-(Game.milkH-Game.milkHd)*2000+480*2)%480);12617var y=(Game.milkHd)*height;//(((Game.milkHd)*ctx.canvas.height)*(1+0.05*(Math.sin(Game.T*0.017)/2+0.5)));12618var a=1;12619if (Game.AscendTimer>0)12620{12621y*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;12622a*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;12623}12624else if (Game.ReincarnateTimer>0)12625{12626y*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;12627a*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;12628}1262912630if (Game.TOYS)12631{12632//golly12633if (!Game.Toy)12634{12635Game.toys=[];12636Game.toysType=choose([1,2]);12637Game.Toy=function(x,y)12638{12639this.id=Game.toys.length;12640this.x=x;12641this.y=y;12642this.xd=Math.random()*10-5;12643this.yd=Math.random()*10-5;12644this.r=Math.random()*Math.PI*2;12645this.rd=Math.random()*0.1-0.05;12646var v=Math.random();var a=0.5;var b=0.5;12647if (v<=a) v=b-b*Math.pow(1-v/a,3); else v=b+(1-b)*Math.pow((v-a)/(1-a),3);12648this.s=(Game.toysType==1?64:48)*(0.1+v*1.9);12649if (Game.toysType==2) this.s=(this.id%10==1)?96:48;12650this.st=this.s;this.s=0;12651var cookies=[[10,0]];12652for (var i in Game.Upgrades)12653{12654var cookie=Game.Upgrades[i];12655if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);12656}12657this.icon=choose(cookies);12658this.dragged=false;12659this.l=document.createElement('div');12660this.l.innerHTML=this.id;12661this.l.style.cssText='cursor:pointer;border-radius:'+(this.s/2)+'px;opacity:0;width:'+this.s+'px;height:'+this.s+'px;background:#999;position:absolute;left:0px;top:0px;z-index:10000000;transform:translate(-1000px,-1000px);';12662l('sectionLeft').appendChild(this.l);12663AddEvent(this.l,'mousedown',function(what){return function(){what.dragged=true;};}(this));12664AddEvent(this.l,'mouseup',function(what){return function(){what.dragged=false;};}(this));12665Game.toys.push(this);12666return this;12667}12668for (var i=0;i<Math.floor(Math.random()*15+(Game.toysType==1?5:30));i++)12669{12670new Game.Toy(Math.random()*width,Math.random()*height*0.3);12671}12672}12673ctx.globalAlpha=0.5;12674for (var i in Game.toys)12675{12676var me=Game.toys[i];12677ctx.save();12678ctx.translate(me.x,me.y);12679ctx.rotate(me.r);12680if (Game.toysType==1) ctx.drawImage(Pic('smallCookies.png'),(me.id%8)*64,0,64,64,-me.s/2,-me.s/2,me.s,me.s);12681else ctx.drawImage(Pic('icons.png'),me.icon[0]*48,me.icon[1]*48,48,48,-me.s/2,-me.s/2,me.s,me.s);12682ctx.restore();12683}12684ctx.globalAlpha=1;12685for (var i in Game.toys)12686{12687var me=Game.toys[i];12688//psst... not real physics12689for (var ii in Game.toys)12690{12691var it=Game.toys[ii];12692if (it.id!=me.id)12693{12694var x1=me.x+me.xd;12695var y1=me.y+me.yd;12696var x2=it.x+it.xd;12697var y2=it.y+it.yd;12698var dist=Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2))/(me.s/2+it.s/2);12699if (dist<(Game.toysType==1?0.95:0.75))12700{12701var angle=Math.atan2(y1-y2,x1-x2);12702var v1=Math.sqrt(Math.pow((me.xd),2)+Math.pow((me.yd),2));12703var v2=Math.sqrt(Math.pow((it.xd),2)+Math.pow((it.yd),2));12704var v=((v1+v2)/2+dist)*0.75;12705var ratio=it.s/me.s;12706me.xd+=Math.sin(-angle+Math.PI/2)*v*(ratio);12707me.yd+=Math.cos(-angle+Math.PI/2)*v*(ratio);12708it.xd+=Math.sin(-angle-Math.PI/2)*v*(1/ratio);12709it.yd+=Math.cos(-angle-Math.PI/2)*v*(1/ratio);12710me.rd+=(Math.random()*1-0.5)*0.1*(ratio);12711it.rd+=(Math.random()*1-0.5)*0.1*(1/ratio);12712me.rd*=Math.min(1,v);12713it.rd*=Math.min(1,v);12714}12715}12716}12717if (me.y>=height-(Game.milkHd)*height+8)12718{12719me.xd*=0.85;12720me.yd*=0.85;12721me.rd*=0.85;12722me.yd-=1;12723me.xd+=(Math.random()*1-0.5)*0.3;12724me.yd+=(Math.random()*1-0.5)*0.05;12725me.rd+=(Math.random()*1-0.5)*0.02;12726}12727else12728{12729me.xd*=0.99;12730me.rd*=0.99;12731me.yd+=1;12732}12733me.yd*=(Math.min(1,Math.abs(me.y-(height-(Game.milkHd)*height)/16)));12734me.rd+=me.xd*0.01/(me.s/(Game.toysType==1?64:48));12735if (me.x<me.s/2 && me.xd<0) me.xd=Math.max(0.1,-me.xd*0.6); else if (me.x<me.s/2) {me.xd=0;me.x=me.s/2;}12736if (me.x>width-me.s/2 && me.xd>0) me.xd=Math.min(-0.1,-me.xd*0.6); else if (me.x>width-me.s/2) {me.xd=0;me.x=width-me.s/2;}12737me.xd=Math.min(Math.max(me.xd,-30),30);12738me.yd=Math.min(Math.max(me.yd,-30),30);12739me.rd=Math.min(Math.max(me.rd,-0.5),0.5);12740me.x+=me.xd;12741me.y+=me.yd;12742me.r+=me.rd;12743me.r=me.r%(Math.PI*2);12744me.s+=(me.st-me.s)*0.5;12745if (Game.toysType==2 && !me.dragged && Math.random()<0.003) me.st=choose([48,48,48,48,96]);12746if (me.dragged)12747{12748me.x=Game.mouseX;12749me.y=Game.mouseY;12750me.xd+=((Game.mouseX-Game.mouseX2)*3-me.xd)*0.5;12751me.yd+=((Game.mouseY-Game.mouseY2)*3-me.yd)*0.512752me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px) scale(50)';12753}12754else me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px)';12755me.l.style.width=me.s+'px';12756me.l.style.height=me.s+'px';12757ctx.save();12758ctx.translate(me.x,me.y);12759ctx.rotate(me.r);12760if (Game.toysType==1) ctx.drawImage(Pic('smallCookies.png'),(me.id%8)*64,0,64,64,-me.s/2,-me.s/2,me.s,me.s);12761else ctx.drawImage(Pic('icons.png'),me.icon[0]*48,me.icon[1]*48,48,48,-me.s/2,-me.s/2,me.s,me.s);12762ctx.restore();12763}12764}1276512766var pic=Game.Milk.pic;12767if (Game.milkType!=0 && Game.ascensionMode!=1) pic=Game.MilksByChoice[Game.milkType].pic;12768ctx.globalAlpha=0.9*a;12769ctx.fillPattern(Pic(pic+'.png'),0,height-y,width+480,1,480,480,x,0);1277012771ctx.fillStyle='#000';12772ctx.fillRect(0,height-y+480,width,Math.max(0,(y-480)));12773ctx.globalAlpha=1;1277412775Timer.track('milk');12776}1277712778if (Game.AscendTimer>0)12779{12780ctx.drawImage(Pic('shadedBordersSoft.png'),0,0,ctx.canvas.width,ctx.canvas.height);12781}1278212783if (Game.AscendTimer==0)12784{12785Game.DrawWrinklers();Timer.track('wrinklers');12786Game.DrawSpecial();Timer.track('evolvables');1278712788Game.particlesDraw(2);Timer.track('text particles');1278912790//shiny border during frenzies etc12791ctx.globalAlpha=1;12792var borders='shadedBordersSoft.png';12793if (goodBuff) borders='shadedBordersGold.png';12794else if (badBuff) borders='shadedBordersRed.png';12795if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';12796ctx.drawImage(Pic(borders),0,0,ctx.canvas.width,ctx.canvas.height);12797if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='source-over';12798}12799}12800};128011280212803/*=====================================================================================12804INITIALIZATION END; GAME READY TO LAUNCH12805=======================================================================================*/1280612807Game.killShimmers();1280812809//booooo12810Game.RuinTheFun=function(silent)12811{12812Game.popups=0;12813Game.SetAllUpgrades(1);12814Game.SetAllAchievs(1);12815Game.popups=0;12816Game.Earn(999999999999999999999999999999);12817Game.MaxSpecials();12818Game.nextResearch=0;12819Game.researchT=-1;12820Game.upgradesToRebuild=1;12821Game.recalculateGains=1;12822Game.popups=1;12823for (var i in Game.Objects)12824{12825var me=Game.Objects[i];12826if (me.minigame && me.minigame.onRuinTheFun) me.minigame.onRuinTheFun();12827}12828if (!silent)12829{12830if (Game.prefs.popups) Game.Popup('Thou doth ruineth the fun!');12831else Game.Notify('Thou doth ruineth the fun!','You\'re free. Free at last.',[11,5]);12832}12833return 'You feel a bitter taste in your mouth...';12834}1283512836Game.SetAllUpgrades=function(on)12837{12838Game.popups=0;12839var leftout=['Magic shenanigans','Occult obstruction','Glucose-charged air'];12840for (var i in Game.Upgrades)12841{12842if (on && (Game.Upgrades[i].pool=='toggle' || leftout.indexOf(Game.Upgrades[i].name)!=-1)) {}12843else if (on) Game.Upgrades[i].earn();12844else if (!on) Game.Upgrades[i].lose();12845}12846Game.upgradesToRebuild=1;12847Game.recalculateGains=1;12848Game.popups=1;12849}12850Game.SetAllAchievs=function(on)12851{12852Game.popups=0;12853for (var i in Game.Achievements)12854{12855if (on && Game.Achievements[i].pool!='dungeon') Game.Win(Game.Achievements[i].name);12856else if (!on) Game.RemoveAchiev(Game.Achievements[i].name);12857}12858Game.recalculateGains=1;12859Game.popups=1;12860}12861Game.GetAllDebugs=function()12862{12863Game.popups=0;12864for (var i in Game.Upgrades)12865{12866if (Game.Upgrades[i].pool=='debug') Game.Upgrades[i].earn();12867}12868Game.upgradesToRebuild=1;12869Game.recalculateGains=1;12870Game.popups=1;12871}12872Game.MaxSpecials=function()12873{12874Game.dragonLevel=Game.dragonLevels.length-1;12875Game.santaLevel=Game.santaLevels.length-1;12876}1287712878Game.SesameReset=function()12879{12880var name=Game.bakeryName;12881Game.HardReset(2);12882Game.bakeryName=name;12883Game.bakeryNameRefresh();12884Game.Achievements['Cheated cookies taste awful'].won=1;12885}1288612887Game.debugTimersOn=0;12888Game.sesame=0;12889Game.OpenSesame=function()12890{12891var str='';12892str+='<div class="icon" style="position:absolute;left:-9px;top:-6px;background-position:'+(-10*48)+'px '+(-6*48)+'px;"></div>';12893str+='<div style="position:absolute;left:0px;top:0px;z-index:10;font-size:10px;background:#000;padding:1px;" id="fpsCounter"></div>';1289412895str+='<div id="devConsoleContent">';12896str+='<div class="title" style="font-size:14px;margin:6px;">Dev tools</div>';1289712898str+='<a class="option neato" '+Game.clickStr+'="Game.Ascend(1);">Ascend</a>';12899str+='<div class="line"></div>';12900str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=10;Game.cookiesEarned*=10;">x10</a>';12901str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=10;Game.cookiesEarned/=10;">/10</a><br>';12902str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=1000;Game.cookiesEarned*=1000;">x1k</a>';12903str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=1000;Game.cookiesEarned/=1000;">/1k</a><br>';12904str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].buy(100);}">Buy 100 of all</a>';//for (var n=0;n<100;n++){for (var i in Game.Objects){Game.Objects[i].buy(1);}}12905str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].sell(100);}">Sell 100 of all</a><br>';12906str+='<a class="option neato" '+Game.clickStr+'="Game.gainLumps(10);">+10 lumps</a>';12907str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].level=0;Game.Objects[i].onMinigame=false;Game.Objects[i].refresh();}Game.recalculateGains=1;">Reset levels</a>';12908str+='<div class="line"></div>';12909str+='<a class="option warning" '+Game.clickStr+'="Game.RuinTheFun(1);">Ruin The Fun</a>';12910str+='<a class="option warning" '+Game.clickStr+'="Game.SesameReset();">Wipe</a>';12911str+='<a class="option neato" '+Game.clickStr+'="Game.GetAllDebugs();">All debugs</a>';12912str+='<a class="option neato" '+Game.clickStr+'="Game.debugTimersOn=!Game.debugTimersOn;Game.OpenSesame();">Timers '+(Game.debugTimersOn?'On':'Off')+'</a><br>';12913str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(0);">No upgrades</a>';12914str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(1);">All upgrades</a><br>';12915str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(0);">No achievs</a>';12916str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(1);">All achievs</a><br>';12917str+='<a class="option neato" '+Game.clickStr+'="Game.santaLevel=0;Game.dragonLevel=0;">Reset specials</a>';12918str+='<a class="option neato" '+Game.clickStr+'="Game.MaxSpecials();">Max specials</a><br>';12919str+='<a class="option neato" '+Game.clickStr+'="Game.lumpRefill=0;/*Date.now()-Game.getLumpRefillMax();*/">Reset refills</a>';12920str+='<a class="option neato" '+Game.clickStr+'="Game.EditAscend();">'+(Game.DebuggingPrestige?'Exit Ascend Edit':'Ascend Edit')+'</a>';12921str+='<a class="option neato" '+Game.clickStr+'="Game.DebugUpgradeCpS();">Debug upgrades CpS</a>';12922str+='<a class="option neato" '+Game.clickStr+'="Game.seed=Game.makeSeed();">Re-seed</a>';12923str+='<a class="option neato" '+Game.clickStr+'="Game.heralds=100;l(\'heraldsAmount\').innerHTML=Game.heralds;Game.externalDataLoaded=true;Game.recalculateGains=1;">Max heralds</a>';12924str+='<div class="line"></div>';12925for (var i=0;i<Game.goldenCookieChoices.length/2;i++)12926{12927str+='<a class="option neato" '+Game.clickStr+'="var newShimmer=new Game.shimmer(\'golden\');newShimmer.force=\''+Game.goldenCookieChoices[i*2+1]+'\';">'+Game.goldenCookieChoices[i*2]+'</a>';12928//str+='<a class="option neato" '+Game.clickStr+'="Game.goldenCookie.force=\''+Game.goldenCookie.choices[i*2+1]+'\';Game.goldenCookie.spawn();">'+Game.goldenCookie.choices[i*2]+'</a>';12929//str+='<a class="option neato" '+Game.clickStr+'="Game.goldenCookie.click(0,\''+Game.goldenCookie.choices[i*2+1]+'\');">'+Game.goldenCookie.choices[i*2]+'</a>';12930}12931str+='</div>';1293212933l('devConsole').innerHTML=str;1293412935if (!l('fpsGraph'))12936{12937var div=document.createElement('canvas');12938div.id='fpsGraph';12939div.width=128;12940div.height=64;12941div.style.opacity=0.5;12942div.style.pointerEvents='none';12943div.style.transformOrigin='0% 0%';12944div.style.transform='scale(0.75)';12945//l('devConsole').appendChild(div);12946l('devConsole').parentNode.insertBefore(div,l('devConsole').nextSibling);12947Game.fpsGraph=div;12948Game.fpsGraphCtx=Game.fpsGraph.getContext('2d',{alpha:false});12949var ctx=Game.fpsGraphCtx;12950ctx.fillStyle='#000';12951ctx.fillRect(0,0,128,64);12952}1295312954l('debug').style.display='block';12955Game.sesame=1;12956Game.Achievements['Cheated cookies taste awful'].won=1;12957}1295812959Game.EditAscend=function()12960{12961if (!Game.DebuggingPrestige)12962{12963Game.DebuggingPrestige=true;12964Game.AscendTimer=0;12965Game.OnAscend=1;12966Game.removeClass('ascendIntro');12967Game.addClass('ascending');12968}12969else12970{12971Game.DebuggingPrestige=false;12972}12973Game.BuildAscendTree();12974Game.OpenSesame();12975}1297612977//experimental debugging function that cycles through every owned upgrade, turns it off and on, and lists how much each upgrade is participating to CpS12978Game.debuggedUpgradeCpS=[];12979Game.debuggedUpgradeCpClick=[];12980Game.debugColors=['#322','#411','#600','#900','#f30','#f90','#ff0','#9f0','#0f9','#09f','#90f'];12981Game.DebugUpgradeCpS=function()12982{12983Game.CalculateGains();12984Game.debuggedUpgradeCpS=[];12985Game.debuggedUpgradeCpClick=[];12986var CpS=Game.cookiesPs;12987var CpClick=Game.computedMouseCps;12988for (var i in Game.Upgrades)12989{12990var me=Game.Upgrades[i];12991if (me.bought)12992{12993me.bought=0;12994Game.CalculateGains();12995//Game.debuggedUpgradeCpS[me.name]=CpS-Game.cookiesPs;12996Game.debuggedUpgradeCpS[me.name]=(CpS/(Game.cookiesPs||1)-1);12997Game.debuggedUpgradeCpClick[me.name]=(CpClick/(Game.computedMouseCps||1)-1);12998me.bought=1;12999}13000}13001Game.CalculateGains();13002}1300313004130051300613007for (var i in Game.customInit) {Game.customInit[i]();}1300813009if (!Game.LoadSave())13010{//try to load the save when we open the page. if this fails, try to brute-force it half a second later13011setTimeout(function(){13012var local=Game.localStorageGet(Game.SaveTo);13013Game.LoadSave(local);13014},500);13015}1301613017Game.ready=1;13018setTimeout(function(){if (typeof showAds==='undefined' && (!l('detectAds') || l('detectAds').clientHeight<1)) Game.addClass('noAds');},500);13019l('javascriptError').innerHTML='';13020l('javascriptError').style.display='none';13021Game.Loop();13022Game.Draw();13023}13024/*=====================================================================================13025LOGIC13026=======================================================================================*/13027Game.Logic=function()13028{13029Game.bounds=Game.l.getBoundingClientRect();1303013031if (!Game.OnAscend && Game.AscendTimer==0)13032{13033for (var i in Game.Objects)13034{13035if (Game.Objects[i].eachFrame) Game.Objects[i].eachFrame();13036}13037Game.UpdateSpecial();13038Game.UpdateGrandmapocalypse();1303913040//these are kinda fun13041//if (Game.BigCookieState==2 && !Game.promptOn && Game.Scroll!=0) Game.ClickCookie();13042//if (Game.BigCookieState==1 && !Game.promptOn) Game.ClickCookie();1304313044//handle graphic stuff13045if (Game.prefs.wobbly)13046{13047if (Game.BigCookieState==1) Game.BigCookieSizeT=0.98;13048else if (Game.BigCookieState==2) Game.BigCookieSizeT=1.05;13049else Game.BigCookieSizeT=1;13050Game.BigCookieSizeD+=(Game.BigCookieSizeT-Game.BigCookieSize)*0.75;13051Game.BigCookieSizeD*=0.75;13052Game.BigCookieSize+=Game.BigCookieSizeD;13053Game.BigCookieSize=Math.max(0.1,Game.BigCookieSize);13054}13055else13056{13057if (Game.BigCookieState==1) Game.BigCookieSize+=(0.98-Game.BigCookieSize)*0.5;13058else if (Game.BigCookieState==2) Game.BigCookieSize+=(1.05-Game.BigCookieSize)*0.5;13059else Game.BigCookieSize+=(1-Game.BigCookieSize)*0.5;13060}13061Game.particlesUpdate();1306213063if (Game.mousePointer) l('sectionLeft').style.cursor='pointer';13064else l('sectionLeft').style.cursor='auto';13065Game.mousePointer=0;1306613067//handle milk and milk accessories13068Game.milkProgress=Game.AchievementsOwned/25;13069if (Game.milkProgress>=0.5) Game.Unlock('Kitten helpers');13070if (Game.milkProgress>=1) Game.Unlock('Kitten workers');13071if (Game.milkProgress>=2) Game.Unlock('Kitten engineers');13072if (Game.milkProgress>=3) Game.Unlock('Kitten overseers');13073if (Game.milkProgress>=4) Game.Unlock('Kitten managers');13074if (Game.milkProgress>=5) Game.Unlock('Kitten accountants');13075if (Game.milkProgress>=6) Game.Unlock('Kitten specialists');13076if (Game.milkProgress>=7) Game.Unlock('Kitten experts');13077if (Game.milkProgress>=8) Game.Unlock('Kitten consultants');13078if (Game.milkProgress>=9) Game.Unlock('Kitten assistants to the regional manager');13079if (Game.milkProgress>=10) Game.Unlock('Kitten marketeers');13080if (Game.milkProgress>=11) Game.Unlock('Kitten analysts');13081if (Game.milkProgress>=12) Game.Unlock('Kitten executives');13082Game.milkH=Math.min(1,Game.milkProgress)*0.35;13083Game.milkHd+=(Game.milkH-Game.milkHd)*0.02;1308413085Game.Milk=Game.Milks[Math.min(Math.floor(Game.milkProgress),Game.Milks.length-1)];1308613087if (Game.autoclickerDetected>0) Game.autoclickerDetected--;1308813089//handle research13090if (Game.researchT>0)13091{13092Game.researchT--;13093}13094if (Game.researchT==0 && Game.nextResearch)13095{13096if (!Game.Has(Game.UpgradesById[Game.nextResearch].name))13097{13098Game.Unlock(Game.UpgradesById[Game.nextResearch].name);13099if (Game.prefs.popups) Game.Popup('Researched : '+Game.UpgradesById[Game.nextResearch].name);13100else Game.Notify('Research complete','You have discovered : <b>'+Game.UpgradesById[Game.nextResearch].name+'</b>.',Game.UpgradesById[Game.nextResearch].icon);13101}13102Game.nextResearch=0;13103Game.researchT=-1;13104Game.recalculateGains=1;13105}13106//handle seasons13107if (Game.seasonT>0)13108{13109Game.seasonT--;13110}13111if (Game.seasonT<=0 && Game.season!='' && Game.season!=Game.baseSeason && !Game.Has('Eternal seasons'))13112{13113var str=Game.seasons[Game.season].over;13114if (Game.prefs.popups) Game.Popup(str);13115else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);13116if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}13117Game.season=Game.baseSeason;13118Game.seasonT=-1;13119}1312013121//press ctrl to bulk-buy 10, shift to bulk-buy 10013122if (!Game.promptOn)13123{13124if ((Game.keys[16] || Game.keys[17]) && !Game.buyBulkShortcut)13125{13126Game.buyBulkOld=Game.buyBulk;13127if (Game.keys[16]) Game.buyBulk=100;13128if (Game.keys[17]) Game.buyBulk=10;13129Game.buyBulkShortcut=1;13130Game.storeBulkButton(-1);13131}13132}13133if ((!Game.keys[16] && !Game.keys[17]) && Game.buyBulkShortcut)//release13134{13135Game.buyBulk=Game.buyBulkOld;13136Game.buyBulkShortcut=0;13137Game.storeBulkButton(-1);13138}1313913140//handle cookies13141if (Game.recalculateGains) Game.CalculateGains();13142Game.Earn(Game.cookiesPs/Game.fps);//add cookies per second1314313144//grow lumps13145Game.doLumps();1314613147//minigames13148for (var i in Game.Objects)13149{13150var me=Game.Objects[i];13151if (Game.isMinigameReady(me) && me.minigame.logic && Game.ascensionMode!=1) me.minigame.logic();13152}1315313154if (Game.specialTab!='' && Game.T%(Game.fps*3)==0) Game.ToggleSpecialMenu(1);1315513156//wrinklers13157if (Game.cpsSucked>0)13158{13159Game.Dissolve((Game.cookiesPs/Game.fps)*Game.cpsSucked);13160Game.cookiesSucked+=((Game.cookiesPs/Game.fps)*Game.cpsSucked);13161//should be using one of the following, but I'm not sure what I'm using this stat for anymore13162//Game.cookiesSucked=Game.wrinklers.reduce(function(s,w){return s+w.sucked;},0);13163//for (var i in Game.wrinklers) {Game.cookiesSucked+=Game.wrinklers[i].sucked;}13164}1316513166//var cps=Game.cookiesPs+Game.cookies*0.01;//exponential cookies13167//Game.Earn(cps/Game.fps);//add cookies per second1316813169for (var i in Game.Objects)13170{13171var me=Game.Objects[i];13172me.totalCookies+=(me.storedTotalCps*Game.globalCpsMult)/Game.fps;13173}13174if (Game.cookies && Game.T%Math.ceil(Game.fps/Math.min(10,Game.cookiesPs))==0 && Game.prefs.particles) Game.particleAdd();//cookie shower1317513176if (Game.T%(Game.fps*10)==0) Game.recalculateGains=1;//recalculate CpS every 10 seconds (for dynamic boosts such as Century egg)1317713178/*=====================================================================================13179UNLOCKING STUFF13180=======================================================================================*/13181if (Game.T%(Game.fps)==0 && Math.random()<1/500000) Game.Win('Just plain lucky');//1 chance in 500,000 every second achievement13182if (Game.T%(Game.fps*5)==0 && Game.ObjectsById.length>0)//check some achievements and upgrades13183{13184if (isNaN(Game.cookies)) {Game.cookies=0;Game.cookiesEarned=0;Game.recalculateGains=1;}1318513186var timePlayed=new Date();13187timePlayed.setTime(Date.now()-Game.startDate);1318813189if (!Game.fullDate || (Date.now()-Game.fullDate)>=365*24*60*60*1000) Game.Win('So much to do so much to see');1319013191if (Game.cookiesEarned>=1000000 && (Game.ascensionMode==1 || Game.resets==0))//challenge run or hasn't ascended yet13192{13193if (timePlayed<=1000*60*35) Game.Win('Speed baking I');13194if (timePlayed<=1000*60*25) Game.Win('Speed baking II');13195if (timePlayed<=1000*60*15) Game.Win('Speed baking III');1319613197if (Game.cookieClicks<=15) Game.Win('Neverclick');13198if (Game.cookieClicks<=0) Game.Win('True Neverclick');13199if (Game.cookiesEarned>=1000000000 && Game.UpgradesOwned==0) Game.Win('Hardcore');13200}1320113202for (var i in Game.UnlockAt)13203{13204var unlock=Game.UnlockAt[i];13205if (Game.cookiesEarned>=unlock.cookies)13206{13207var pass=1;13208if (unlock.require && !Game.Has(unlock.require) && !Game.HasAchiev(unlock.require)) pass=0;13209if (unlock.season && Game.season!=unlock.season) pass=0;13210if (pass) {Game.Unlock(unlock.name);Game.Win(unlock.name);}13211}13212}1321313214if (Game.Has('Golden switch')) Game.Unlock('Golden switch [off]');13215if (Game.Has('Shimmering veil') && !Game.Has('Shimmering veil [off]') && !Game.Has('Shimmering veil [on]')) {Game.Unlock('Shimmering veil [on]');Game.Upgrades['Shimmering veil [off]'].earn();}13216if (Game.Has('Sugar craving')) Game.Unlock('Sugar frenzy');13217if (Game.Has('Classic dairy selection')) Game.Unlock('Milk selector');13218if (Game.Has('Basic wallpaper assortment')) Game.Unlock('Background selector');13219if (Game.Has('Golden cookie alert sound')) Game.Unlock('Golden cookie sound selector');1322013221if (Game.Has('Eternal heart biscuits')) Game.Win('Lovely cookies');13222if (Game.season=='easter')13223{13224var eggs=0;13225for (var i in Game.easterEggs)13226{13227if (Game.HasUnlocked(Game.easterEggs[i])) eggs++;13228}13229if (eggs>=1) Game.Win('The hunt is on');13230if (eggs>=7) Game.Win('Egging on');13231if (eggs>=14) Game.Win('Mass Easteria');13232if (eggs>=Game.easterEggs.length) Game.Win('Hide & seek champion');13233}1323413235if (Game.Has('Fortune cookies'))13236{13237var list=Game.Tiers['fortune'].upgrades;13238var fortunes=0;13239for (var i in list)13240{13241if (Game.Has(list[i].name)) fortunes++;13242}13243if (fortunes>=list.length) Game.Win('O Fortuna');13244}1324513246if (Game.prestige>0 && Game.ascensionMode!=1)13247{13248Game.Unlock('Heavenly chip secret');13249if (Game.Has('Heavenly chip secret')) Game.Unlock('Heavenly cookie stand');13250if (Game.Has('Heavenly cookie stand')) Game.Unlock('Heavenly bakery');13251if (Game.Has('Heavenly bakery')) Game.Unlock('Heavenly confectionery');13252if (Game.Has('Heavenly confectionery')) Game.Unlock('Heavenly key');1325313254if (Game.Has('Heavenly key')) Game.Win('Wholesome');13255}1325613257for (var i in Game.BankAchievements)13258{13259if (Game.cookiesEarned>=Game.BankAchievements[i].threshold) Game.Win(Game.BankAchievements[i].name);13260}1326113262var buildingsOwned=0;13263var mathematician=1;13264var base10=1;13265var minAmount=100000;13266for (var i in Game.Objects)13267{13268buildingsOwned+=Game.Objects[i].amount;13269minAmount=Math.min(Game.Objects[i].amount,minAmount);13270if (!Game.HasAchiev('Mathematician')) {if (Game.Objects[i].amount<Math.min(128,Math.pow(2,(Game.ObjectsById.length-Game.Objects[i].id)-1))) mathematician=0;}13271if (!Game.HasAchiev('Base 10')) {if (Game.Objects[i].amount<(Game.ObjectsById.length-Game.Objects[i].id)*10) base10=0;}13272}13273if (minAmount>=1) Game.Win('One with everything');13274if (mathematician==1) Game.Win('Mathematician');13275if (base10==1) Game.Win('Base 10');13276if (minAmount>=100) {Game.Win('Centennial');Game.Unlock('Milk chocolate butter biscuit');}13277if (minAmount>=150) {Game.Win('Centennial and a half');Game.Unlock('Dark chocolate butter biscuit');}13278if (minAmount>=200) {Game.Win('Bicentennial');Game.Unlock('White chocolate butter biscuit');}13279if (minAmount>=250) {Game.Win('Bicentennial and a half');Game.Unlock('Ruby chocolate butter biscuit');}13280if (minAmount>=300) {Game.Win('Tricentennial');Game.Unlock('Lavender chocolate butter biscuit');}13281if (minAmount>=350) {Game.Win('Tricentennial and a half');Game.Unlock('Synthetic chocolate green honey butter biscuit');}13282if (minAmount>=400) {Game.Win('Quadricentennial');Game.Unlock('Royal raspberry chocolate butter biscuit');}13283if (minAmount>=450) {Game.Win('Quadricentennial and a half');Game.Unlock('Ultra-concentrated high-energy chocolate butter biscuit');}13284if (minAmount>=500) {Game.Win('Quincentennial');Game.Unlock('Pure pitch-black chocolate butter biscuit');}1328513286if (Game.handmadeCookies>=1000) {Game.Win('Clicktastic');Game.Unlock('Plastic mouse');}13287if (Game.handmadeCookies>=100000) {Game.Win('Clickathlon');Game.Unlock('Iron mouse');}13288if (Game.handmadeCookies>=10000000) {Game.Win('Clickolympics');Game.Unlock('Titanium mouse');}13289if (Game.handmadeCookies>=1000000000) {Game.Win('Clickorama');Game.Unlock('Adamantium mouse');}13290if (Game.handmadeCookies>=100000000000) {Game.Win('Clickasmic');Game.Unlock('Unobtainium mouse');}13291if (Game.handmadeCookies>=10000000000000) {Game.Win('Clickageddon');Game.Unlock('Eludium mouse');}13292if (Game.handmadeCookies>=1000000000000000) {Game.Win('Clicknarok');Game.Unlock('Wishalloy mouse');}13293if (Game.handmadeCookies>=100000000000000000) {Game.Win('Clickastrophe');Game.Unlock('Fantasteel mouse');}13294if (Game.handmadeCookies>=10000000000000000000) {Game.Win('Clickataclysm');Game.Unlock('Nevercrack mouse');}13295if (Game.handmadeCookies>=1000000000000000000000) {Game.Win('The ultimate clickdown');Game.Unlock('Armythril mouse');}13296if (Game.handmadeCookies>=100000000000000000000000) {Game.Win('All the other kids with the pumped up clicks');Game.Unlock('Technobsidian mouse');}13297if (Game.handmadeCookies>=10000000000000000000000000) {Game.Win('One...more...click...');Game.Unlock('Plasmarble mouse');}1329813299if (Game.cookiesEarned<Game.cookies) Game.Win('Cheated cookies taste awful');1330013301if (Game.Has('Skull cookies') && Game.Has('Ghost cookies') && Game.Has('Bat cookies') && Game.Has('Slime cookies') && Game.Has('Pumpkin cookies') && Game.Has('Eyeball cookies') && Game.Has('Spider cookies')) Game.Win('Spooky cookies');13302if (Game.wrinklersPopped>=1) Game.Win('Itchscratcher');13303if (Game.wrinklersPopped>=50) Game.Win('Wrinklesquisher');13304if (Game.wrinklersPopped>=200) Game.Win('Moistburster');1330513306if (Game.cookiesEarned>=1000000 && Game.Has('How to bake your dragon')) Game.Unlock('A crumbly egg');1330713308if (Game.cookiesEarned>=25 && Game.season=='christmas') Game.Unlock('A festive hat');13309if (Game.Has('Christmas tree biscuits') && Game.Has('Snowflake biscuits') && Game.Has('Snowman biscuits') && Game.Has('Holly biscuits') && Game.Has('Candy cane biscuits') && Game.Has('Bell biscuits') && Game.Has('Present biscuits')) Game.Win('Let it snow');1331013311if (Game.reindeerClicked>=1) Game.Win('Oh deer');13312if (Game.reindeerClicked>=50) Game.Win('Sleigh of hand');13313if (Game.reindeerClicked>=200) Game.Win('Reindeer sleigher');1331413315if (buildingsOwned>=100) Game.Win('Builder');13316if (buildingsOwned>=500) Game.Win('Architect');13317if (buildingsOwned>=1000) Game.Win('Engineer');13318if (buildingsOwned>=2000) Game.Win('Lord of Constructs');13319if (Game.UpgradesOwned>=20) Game.Win('Enhancer');13320if (Game.UpgradesOwned>=50) Game.Win('Augmenter');13321if (Game.UpgradesOwned>=100) Game.Win('Upgrader');13322if (Game.UpgradesOwned>=200) Game.Win('Lord of Progress');13323if (buildingsOwned>=3000 && Game.UpgradesOwned>=300) Game.Win('Polymath');13324if (buildingsOwned>=4000 && Game.UpgradesOwned>=400) Game.Win('Renaissance baker');1332513326if (Game.cookiesEarned>=10000000000000 && !Game.HasAchiev('You win a cookie')) {Game.Win('You win a cookie');Game.Earn(1);}1332713328if (Game.shimmerTypes['golden'].n>=4) Game.Win('Four-leaf cookie');1332913330var grandmas=0;13331for (var i in Game.GrandmaSynergies)13332{13333if (Game.Has(Game.GrandmaSynergies[i])) grandmas++;13334}13335if (!Game.HasAchiev('Elder') && grandmas>=7) Game.Win('Elder');13336if (!Game.HasAchiev('Veteran') && grandmas>=14) Game.Win('Veteran');13337if (Game.Objects['Grandma'].amount>=6 && !Game.Has('Bingo center/Research facility') && Game.HasAchiev('Elder')) Game.Unlock('Bingo center/Research facility');13338if (Game.pledges>0) Game.Win('Elder nap');13339if (Game.pledges>=5) Game.Win('Elder slumber');13340if (Game.pledges>=10) Game.Unlock('Sacrificial rolling pins');13341if (Game.Objects['Cursor'].amount+Game.Objects['Grandma'].amount>=777) Game.Win('The elder scrolls');1334213343for (var i in Game.Objects)13344{13345var it=Game.Objects[i];13346for (var ii in it.productionAchievs)13347{13348if (it.totalCookies>=it.productionAchievs[ii].pow) Game.Win(it.productionAchievs[ii].achiev.name);13349}13350}1335113352if (!Game.HasAchiev('Cookie-dunker') && Game.LeftBackground && Game.milkProgress>0.1 && (Game.LeftBackground.canvas.height*0.4+256/2-16)>((1-Game.milkHd)*Game.LeftBackground.canvas.height)) Game.Win('Cookie-dunker');13353//&& l('bigCookie').getBoundingClientRect().bottom>l('milk').getBoundingClientRect().top+16 && Game.milkProgress>0.1) Game.Win('Cookie-dunker');1335413355for (var i in Game.customChecks) {Game.customChecks[i]();}13356}1335713358Game.cookiesd+=(Game.cookies-Game.cookiesd)*0.3;1335913360if (Game.storeToRefresh) Game.RefreshStore();13361if (Game.upgradesToRebuild) Game.RebuildUpgrades();1336213363Game.updateShimmers();13364Game.updateBuffs();1336513366Game.UpdateTicker();13367}1336813369if (Game.T%(Game.fps*2)==0)13370{13371var title='Cookie Clicker';13372if (Game.season=='fools') title='Cookie Baker';13373document.title=(Game.OnAscend?'Ascending! ':'')+Beautify(Game.cookies)+' '+(Game.cookies==1?'cookie':'cookies')+' - '+title;13374}13375if (Game.T%15==0)13376{13377//written through the magic of "hope for the best" maths13378var chipsOwned=Game.HowMuchPrestige(Game.cookiesReset);13379var ascendNowToOwn=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));13380var ascendNowToGet=ascendNowToOwn-Math.floor(chipsOwned);13381var nextChipAt=Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet+1))-Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet));13382var cookiesToNext=Game.HowManyCookiesReset(ascendNowToOwn+1)-(Game.cookiesEarned+Game.cookiesReset);13383var percent=1-(cookiesToNext/nextChipAt);1338413385//fill the tooltip under the Legacy tab13386var date=new Date();13387date.setTime(Date.now()-Game.startDate);13388var timeInSeconds=date.getTime()/1000;13389var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);1339013391var str='';13392str+='You\'ve been on this run for <b>'+(startDate==''?'not very long':(startDate))+'</b>.<br>';13393str+='<div class="line"></div>';13394if (Game.prestige>0)13395{13396str+='Your prestige level is currently <b>'+Beautify(Game.prestige)+'</b>.<br>(CpS +'+Beautify(Game.prestige)+'%)';13397str+='<div class="line"></div>';13398}13399if (ascendNowToGet<1) str+='Ascending now would grant you no prestige.';13400else if (ascendNowToGet<2) str+='Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';13401else str+='Ascending now would grant you<br><b>'+Beautify(ascendNowToGet)+' prestige levels</b> (+'+Beautify(ascendNowToGet)+'% CpS)<br>and <b>'+Beautify(ascendNowToGet)+' heavenly chips</b> to spend.';13402str+='<div class="line"></div>';13403str+='You need <b>'+Beautify(cookiesToNext)+' more cookies</b> for the next level.<br>';13404l('ascendTooltip').innerHTML=str;1340513406if (ascendNowToGet>0)//show number saying how many chips you'd get resetting now13407{13408var str=ascendNowToGet.toString();13409var str2='';13410for (var i in str)//add commas13411{13412if ((str.length-i)%3==0 && i>0) str2+=',';13413str2+=str[i];13414}13415Game.ascendNumber.innerHTML='+'+str2;13416Game.ascendNumber.style.display='block';13417}13418else13419{13420Game.ascendNumber.style.display='none';13421}1342213423if (ascendNowToGet>Game.ascendMeterLevel || Game.ascendMeterPercentT<Game.ascendMeterPercent)13424{13425//reset the gauge and play a sound if we gained a potential level13426Game.ascendMeterPercent=0;13427//PlaySound('snd/levelPrestige.mp3');//a bit too annoying13428}13429Game.ascendMeterLevel=ascendNowToGet;13430Game.ascendMeterPercentT=percent;//gauge that fills up as you near your next chip13431//if (Game.ascendMeterPercentT<Game.ascendMeterPercent) {Game.ascendMeterPercent=0;PlaySound('snd/levelPrestige.mp3',0.5);}13432//if (percent>=1) {Game.ascendMeter.className='';} else Game.ascendMeter.className='filling';13433}13434Game.ascendMeter.style.right=Math.floor(Math.max(0,1-Game.ascendMeterPercent)*100)+'px';13435Game.ascendMeterPercent+=(Game.ascendMeterPercentT-Game.ascendMeterPercent)*0.1;1343613437Game.NotesLogic();13438if (Game.mouseMoved || Game.Scroll || Game.tooltip.dynamic) Game.tooltip.update();1343913440if (Game.T%(Game.fps*5)==0 && !Game.mouseDown && (Game.onMenu=='stats' || Game.onMenu=='prefs')) Game.UpdateMenu();13441if (Game.T%(Game.fps*1)==0) Game.UpdatePrompt();13442if (Game.AscendTimer>0) Game.UpdateAscendIntro();13443if (Game.ReincarnateTimer>0) Game.UpdateReincarnateIntro();13444if (Game.OnAscend) Game.UpdateAscend();1344513446for (var i in Game.customLogic) {Game.customLogic[i]();}1344713448if (Game.sparklesT>0)13449{13450Game.sparkles.style.backgroundPosition=-Math.floor((Game.sparklesFrames-Game.sparklesT+1)*128)+'px 0px';13451Game.sparklesT--;13452if (Game.sparklesT==1) Game.sparkles.style.display='none';13453}1345413455Game.Click=0;13456Game.Scroll=0;13457Game.mouseMoved=0;13458Game.CanClick=1;1345913460if ((Game.toSave || (Game.T%(Game.fps*60)==0 && Game.T>Game.fps*10 && Game.prefs.autosave)) && !Game.OnAscend)13461{13462//check if we can save : no minigames are loading13463var canSave=true;13464for (var i in Game.Objects)13465{13466var me=Game.Objects[i];13467if (me.minigameLoading){canSave=false;break;}13468}13469if (canSave) Game.WriteSave();13470}1347113472//every 30 minutes : get server data (ie. update notification, patreon data)13473if (Game.T%(Game.fps*60*30)==0 && Game.T>Game.fps*10/* && Game.prefs.autoupdate*/) {Game.CheckUpdates();Game.GrabData();}1347413475Game.T++;13476}1347713478/*=====================================================================================13479DRAW13480=======================================================================================*/1348113482Game.Draw=function()13483{13484Game.DrawBackground();Timer.track('end of background');1348513486if (!Game.OnAscend)13487{1348813489var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies');13490var str=Beautify(Math.round(Game.cookiesd));13491if (Game.cookiesd>=1000000)//dirty padding13492{13493var spacePos=str.indexOf(' ');13494var dotPos=str.indexOf('.');13495var add='';13496if (spacePos!=-1)13497{13498if (dotPos==-1) add+='.000';13499else13500{13501if (spacePos-dotPos==2) add+='00';13502if (spacePos-dotPos==3) add+='0';13503}13504}13505str=[str.slice(0, spacePos),add,str.slice(spacePos)].join('');13506}13507if (str.length>11 && !Game.mobile) unit='<br>cookies';13508str+=unit;13509if (Game.prefs.monospace) str='<span class="monospace">'+str+'</span>';13510str=str+'<div style="font-size:50%;"'+(Game.cpsSucked>0?' class="warning"':'')+'>per second : '+Beautify(Game.cookiesPs*(1-Game.cpsSucked),1)+'</div>';//display cookie amount13511l('cookies').innerHTML=str;13512l('compactCookies').innerHTML=str;13513Timer.track('cookie amount');1351413515for (var i in Game.Objects)13516{13517var me=Game.Objects[i];13518if (me.onMinigame && me.minigame.draw && !me.muted) me.minigame.draw();13519}13520Timer.track('draw minigames');1352113522if (Game.drawT%5==0)13523{13524//if (Game.prefs.monospace) {l('cookies').className='title monospace';} else {l('cookies').className='title';}13525var lastLocked=0;13526for (var i in Game.Objects)13527{13528var me=Game.Objects[i];1352913530//make products full-opacity if we can buy them13531var classes='product';13532var price=me.bulkPrice;13533if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';lastLocked=0;me.locked=0;} else {classes+=' locked';lastLocked++;me.locked=1;}13534if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) classes+=' enabled'; else classes+=' disabled';13535if (lastLocked>2) classes+=' toggledOff';13536me.l.className=classes;13537//if (me.id>0) {l('productName'+me.id).innerHTML=Beautify(me.storedTotalCps/Game.ObjectsById[me.id-1].storedTotalCps,2);}13538}1353913540//make upgrades full-opacity if we can buy them13541var lastPrice=0;13542for (var i in Game.UpgradesInStore)13543{13544var me=Game.UpgradesInStore[i];13545if (!me.bought)13546{13547var price=me.getPrice();13548var canBuy=me.canBuy();//(Game.cookies>=price);13549var enabled=(l('upgrade'+i).className.indexOf('enabled')>-1);13550if ((canBuy && !enabled) || (!canBuy && enabled)) Game.upgradesToRebuild=1;13551if (price<lastPrice) Game.storeToRefresh=1;//is this upgrade less expensive than the previous one? trigger a refresh to sort it again13552lastPrice=price;13553}13554if (me.timerDisplay)13555{13556var T=me.timerDisplay();13557if (T!=-1)13558{13559if (!l('upgradePieTimer'+i)) l('upgrade'+i).innerHTML=l('upgrade'+i).innerHTML+'<div class="pieTimer" id="upgradePieTimer'+i+'"></div>';13560T=(T*144)%144;13561l('upgradePieTimer'+i).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';13562}13563}1356413565//if (me.canBuy()) l('upgrade'+i).className='crate upgrade enabled'; else l('upgrade'+i).className='crate upgrade disabled';13566}13567}13568Timer.track('store');1356913570if (Game.PARTY)//i was bored and felt like messing with CSS13571{13572var pulse=Math.pow((Game.T%10)/10,0.5);13573Game.l.style.filter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';13574Game.l.style.webkitFilter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';13575Game.l.style.transform='scale('+(1.02-0.02*pulse)+','+(1.02-0.02*pulse)+') rotate('+(Math.sin(Game.T*0.5)*0.5)+'deg)';13576l('wrapper').style.overflowX='hidden';13577l('wrapper').style.overflowY='hidden';13578}1357913580Timer.clean();13581if (Game.prefs.animate && ((Game.prefs.fancy && Game.drawT%1==0) || (!Game.prefs.fancy && Game.drawT%10==0)) && Game.AscendTimer==0 && Game.onMenu=='') Game.DrawBuildings();Timer.track('buildings');1358213583Game.textParticlesUpdate();Timer.track('text particles');13584}1358513586Game.NotesDraw();Timer.track('notes');13587//Game.tooltip.update();//changed to only update when the mouse is moved1358813589for (var i in Game.customDraw) {Game.customDraw[i]();}1359013591Game.drawT++;13592//if (Game.prefs.altDraw) requestAnimationFrame(Game.Draw);13593}1359413595/*=====================================================================================13596MAIN LOOP13597=======================================================================================*/13598Game.Loop=function()13599{13600if (Game.timedout) return false;13601Timer.say('START');13602Timer.track('browser stuff');13603Timer.say('LOGIC');13604//update game logic !13605Game.catchupLogic=0;13606Game.Logic();13607Game.catchupLogic=1;1360813609var time=Date.now();136101361113612//latency compensator13613Game.accumulatedDelay+=((time-Game.time)-1000/Game.fps);13614if (Game.prefs.timeout && time-Game.lastActivity>=1000*60*5)13615{13616if (Game.accumulatedDelay>1000*60*30) Game.delayTimeouts+=3;//more than 30 minutes delay ? computer probably asleep and not making cookies anyway13617else if (Game.accumulatedDelay>1000*5) Game.delayTimeouts++;//add to timeout counter when we skip 10 seconds worth of frames (and the player has been inactive for at least 5 minutes)13618if (Game.delayTimeouts>=3) Game.Timeout();//trigger timeout when the timeout counter is 3+13619}1362013621Game.accumulatedDelay=Math.min(Game.accumulatedDelay,1000*5);//don't compensate over 5 seconds; if you do, something's probably very wrong13622Game.time=time;13623while (Game.accumulatedDelay>0)13624{13625Game.Logic();13626Game.accumulatedDelay-=1000/Game.fps;//as long as we're detecting latency (slower than target fps), execute logic (this makes drawing slower but makes the logic behave closer to correct target fps)13627}13628Game.catchupLogic=0;13629Timer.track('logic');13630Timer.say('END LOGIC');13631if (!Game.prefs.altDraw)13632{13633var hasFocus=document.hasFocus();13634Timer.say('DRAW');13635if (hasFocus || Game.prefs.focus || Game.loopT%10==0) requestAnimationFrame(Game.Draw);13636//if (document.hasFocus() || Game.loopT%5==0) Game.Draw();13637Timer.say('END DRAW');13638}13639else requestAnimationFrame(Game.Draw);1364013641//if (!hasFocus) Game.tooltip.hide();1364213643if (Game.sesame)13644{13645//fps counter and graph13646Game.previousFps=Game.currentFps;13647Game.currentFps=Game.getFps();13648var ctx=Game.fpsGraphCtx;13649ctx.drawImage(Game.fpsGraph,-1,0);13650ctx.fillStyle='rgb('+Math.round((1-Game.currentFps/Game.fps)*128)+',0,0)';13651ctx.fillRect(128-1,0,1,64);13652ctx.strokeStyle='#fff';13653ctx.beginPath();13654ctx.moveTo(128-1,(1-Game.previousFps/Game.fps)*64);13655ctx.lineTo(128,(1-Game.currentFps/Game.fps)*64);13656ctx.stroke();1365713658l('fpsCounter').innerHTML=Game.currentFps+' fps';13659var str='';13660for (var i in Timer.labels) {str+=Timer.labels[i];}13661if (Game.debugTimersOn) l('debugLog').style.display='block';13662else l('debugLog').style.display='none';13663l('debugLog').innerHTML=str;1366413665}13666Timer.reset();1366713668Game.loopT++;13669setTimeout(Game.Loop,1000/Game.fps);13670}13671}136721367313674/*=====================================================================================13675LAUNCH THIS THING13676=======================================================================================*/13677Game.Launch();13678//try {Game.Launch();}13679//catch(err) {console.log('ERROR : '+err.message);}1368013681window.onload=function()13682{1368313684if (!Game.ready)13685{13686if (top!=self) Game.ErrorFrame();13687else13688{13689console.log('[=== '+choose([13690'Oh, hello!',13691'hey, how\'s it hangin',13692'About to cheat in some cookies or just checking for bugs?',13693'Remember : cheated cookies taste awful!',13694'Hey, Orteil here. Cheated cookies taste awful... or do they?',13695])+' ===]');13696Game.Load();13697//try {Game.Load();}13698//catch(err) {console.log('ERROR : '+err.message);}13699}13700}13701};137021370313704