Please make sure your javascript is enabled, then refresh.
60 | This could also be caused by a problem on our side, in which case - wait a moment, then refresh!
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
Menu
98 |
Stats
99 |
Updates
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
Store
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | /*
2 | All this code is copyright Orteil, 2013.
3 | -with some help, advice and fixes by Debugbro and Opti
4 | Spoilers ahead.
5 | http://orteil.dashnet.org
6 | */
7 |
8 | /*=====================================================================================
9 | MISC HELPER FUNCTIONS
10 | =======================================================================================*/
11 | function l(what) {return document.getElementById(what);}
12 | function choose(arr) {return arr[Math.floor(Math.random()*arr.length)];}
13 |
14 | if(!Array.prototype.indexOf) {
15 | Array.prototype.indexOf = function(needle) {
16 | for(var i = 0; i < this.length; i++) {
17 | if(this[i] === needle) {
18 | return i;
19 | }
20 | }
21 | return -1;
22 | };
23 | }
24 |
25 | function shuffle(array)
26 | {
27 | var counter = array.length, temp, index;
28 | // While there are elements in the array
29 | while (counter--)
30 | {
31 | // Pick a random index
32 | index = (Math.random() * counter) | 0;
33 |
34 | // And swap the last element with it
35 | temp = array[counter];
36 | array[counter] = array[index];
37 | array[index] = temp;
38 | }
39 | return array;
40 | }
41 | function Beautify(what,floats)//turns 9999999 into 9,999,999
42 | {
43 | var str='';
44 | what=Math.round(what*100000)/100000;//get rid of weird rounding errors
45 | if (floats>0)
46 | {
47 | var floater=what-Math.floor(what);
48 | floater=Math.round(floater*100000)/100000;//get rid of weird rounding errors
49 | var floatPresent=floater?1:0;
50 | floater=(floater.toString()+'0000000').slice(2,2+floats);//yes this is hacky (but it works)
51 | str=Beautify(Math.floor(what))+(floatPresent?('.'+floater):'');
52 | }
53 | else
54 | {
55 | what=Math.floor(what);
56 | what=(what+'').split('').reverse();
57 | for (var i in what)
58 | {
59 | if (i%3==0 && i>0) str=','+str;
60 | str=what[i]+str;
61 | }
62 | }
63 | return str;
64 | }
65 |
66 |
67 | function utf8_to_b64( str ) {
68 | try{
69 | return Base64.encode(unescape(encodeURIComponent( str )));
70 | //return window.btoa(unescape(encodeURIComponent( str )));
71 | }
72 | catch(err)
73 | {
74 | //Popup('There was a problem while encrypting to base64. ('+err+')');
75 | return '';
76 | }
77 | }
78 |
79 | function b64_to_utf8( str ) {
80 | try{
81 | return decodeURIComponent(escape(Base64.decode( str )));
82 | //return decodeURIComponent(escape(window.atob( str )));
83 | }
84 | catch(err)
85 | {
86 | //Popup('There was a problem while decrypting from base64. ('+err+')');
87 | return '';
88 | }
89 | }
90 |
91 |
92 | function CompressBin(arr)//compress a sequence like [0,1,1,0,1,0]... into a number like 54.
93 | {
94 | var str='';
95 | var arr2=arr.slice(0);
96 | arr2.unshift(1);
97 | arr2.push(1);
98 | arr2.reverse();
99 | for (var i in arr2)
100 | {
101 | str+=arr2[i];
102 | }
103 | str=parseInt(str,2);
104 | return str;
105 | }
106 |
107 | function UncompressBin(num)//uncompress a number like 54 to a sequence like [0,1,1,0,1,0].
108 | {
109 | var arr=num.toString(2);
110 | arr=arr.split('');
111 | arr.reverse();
112 | arr.shift();
113 | arr.pop();
114 | return arr;
115 | }
116 |
117 | function CompressLargeBin(arr)//we have to compress in smaller chunks to avoid getting into scientific notation
118 | {
119 | var arr2=arr.slice(0);
120 | var thisBit=[];
121 | var bits=[];
122 | for (var i in arr2)
123 | {
124 | thisBit.push(arr2[i]);
125 | if (thisBit.length>=50)
126 | {
127 | bits.push(CompressBin(thisBit));
128 | thisBit=[];
129 | }
130 | }
131 | if (thisBit.length>0) bits.push(CompressBin(thisBit));
132 | arr2=bits.join(';');
133 | return arr2;
134 | }
135 |
136 | function UncompressLargeBin(arr)
137 | {
138 | var arr2=arr.split(';');
139 | var bits=[];
140 | for (var i in arr2)
141 | {
142 | bits.push(UncompressBin(parseInt(arr2[i])));
143 | }
144 | arr2=[];
145 | for (var i in bits)
146 | {
147 | for (var ii in bits[i]) arr2.push(bits[i][ii]);
148 | }
149 | return arr2;
150 | }
151 |
152 | //seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html
153 | (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);
154 |
155 |
156 | /*=====================================================================================
157 | GAME INITIALIZATION
158 | =======================================================================================*/
159 | Game={};
160 |
161 | Game.Launch=function()
162 | {
163 | Game.ready=0;
164 | Game.Init=function()
165 | {
166 | Game.ready=1;
167 | l('javascriptError').innerHTML='
Loading...
';
168 |
169 |
170 | /*=====================================================================================
171 | VARIABLES AND PRESETS
172 | =======================================================================================*/
173 | Game.T=0;
174 | Game.fps=30;
175 |
176 | Game.version=1.036;
177 | Game.beta=0;
178 | l('versionNumber').innerHTML='v.'+Game.version+(Game.beta?' beta':'');
179 | //l('links').innerHTML=(Game.beta?'Live version | ':'Try the beta! | ')+'Cookie Clicker Classic';
180 | l('links').innerHTML='Cookie Clicker Classic';
181 |
182 | //latency compensator stuff
183 | Game.time=new Date().getTime();
184 | Game.fpsMeasure=new Date().getTime();
185 | Game.accumulatedDelay=0;
186 | Game.catchupLogic=0;
187 |
188 | Game.cookiesEarned=0;//all cookies earned during gameplay
189 | Game.cookies=0;//cookies
190 | Game.cookiesd=0;//cookies display
191 | Game.cookiesPs=1;//cookies per second (to recalculate with every new purchase)
192 | Game.cookiesReset=0;//cookies lost to resetting
193 | Game.frenzy=0;//as long as >0, cookie production is multiplied by frenzyPower
194 | Game.frenzyPower=1;
195 | Game.clickFrenzy=0;//as long as >0, mouse clicks get 777x more cookies
196 | Game.cookieClicks=0;//+1 for each click on the cookie
197 | Game.goldenClicks=0;//+1 for each golden cookie clicked
198 | Game.missedGoldenClicks=0;//+1 for each golden cookie missed
199 | Game.handmadeCookies=0;//all the cookies made from clicking the cookie
200 | Game.milkProgress=0;//you can a little bit for each achievement; 0-1 : milk; 1-2 : chocolate milk; 2-3 : raspberry milk
201 | Game.milkH=Game.milkProgress/2;//milk height, between 0 and 1 (although should never go above 0.5)
202 | Game.milkHd=0;//milk height display
203 | Game.milkType=-1;//custom milk : 0=plain, 1=chocolate...
204 | Game.backgroundType=-1;//custom background : 0=blue, 1=red...
205 | Game.prestige=[];//cool stuff that carries over beyond resets
206 |
207 | Game.elderWrath=0;
208 | Game.elderWrathD=0;
209 | Game.pledges=0;
210 | Game.pledgeT=0;
211 | Game.researchT=0;
212 | Game.nextResearch=0;
213 |
214 | Game.bg='';//background (grandmas and such)
215 | Game.bgFade='';//fading to background
216 | Game.bgR=0;//ratio (0 - not faded, 1 - fully faded)
217 | Game.bgRd=0;//ratio displayed
218 |
219 | Game.startDate=parseInt(new Date().getTime());
220 |
221 | Game.prefs=[];
222 | Game.DefaultPrefs=function()
223 | {
224 | Game.prefs.particles=1;
225 | Game.prefs.numbers=1;
226 | Game.prefs.autosave=1;
227 | Game.prefs.autoupdate=1;
228 | Game.prefs.milk=1;
229 | Game.prefs.fancy=1;
230 | }
231 | Game.DefaultPrefs();
232 |
233 | /*=====================================================================================
234 | UPDATE CHECKER (broken?)
235 | =======================================================================================*/
236 | Game.CheckUpdates=function()
237 | {
238 | ajax('server.php?q=checkupdate',Game.CheckUpdatesResponse);
239 | }
240 | Game.CheckUpdatesResponse=function(response)
241 | {
242 | var r=response.split('|');
243 | if (parseFloat(r[0])>Game.version)
244 | {
245 | var str='New version available : v.'+r[0]+'!';
246 | if (r[1]) str+=' Update note : "'+r[1]+'"';
247 | str+=' Refresh to get it!';
248 | l('alert').innerHTML=str;
249 | l('alert').style.display='block';
250 | }
251 | }
252 |
253 | /*=====================================================================================
254 | SAVE
255 | =======================================================================================*/
256 | Game.ExportSave=function()
257 | {
258 | var save=prompt('Copy this text and keep it somewhere safe!',Game.WriteSave(1));
259 | }
260 | Game.ImportSave=function()
261 | {
262 | var save=prompt('Please paste in the text that was given to you on save export.','');
263 | if (save && save!='') Game.LoadSave(save);
264 | Game.WriteSave();
265 | }
266 |
267 | Game.WriteSave=function(exporting)//guess what we'e using to save the game?
268 | {
269 | var str='';
270 | str+=Game.version+'|';
271 | str+='|';//just in case we need some more stuff here
272 | str+=//save stats
273 | parseInt(Game.startDate)+
274 | '|';
275 | str+=//prefs
276 | (Game.prefs.particles?'1':'0')+
277 | (Game.prefs.numbers?'1':'0')+
278 | (Game.prefs.autosave?'1':'0')+
279 | (Game.prefs.autoupdate?'1':'0')+
280 | (Game.prefs.milk?'1':'0')+
281 | (Game.prefs.fancy?'1':'0')+
282 | '|';
283 | str+=parseFloat(Math.floor(Game.cookies))+';'+
284 | parseFloat(Math.floor(Game.cookiesEarned))+';'+
285 | parseInt(Math.floor(Game.cookieClicks))+';'+
286 | parseInt(Math.floor(Game.goldenClicks))+';'+
287 | parseFloat(Math.floor(Game.handmadeCookies))+';'+
288 | parseInt(Math.floor(Game.missedGoldenClicks))+';'+
289 | parseInt(Math.floor(Game.backgroundType))+';'+
290 | parseInt(Math.floor(Game.milkType))+';'+
291 | parseFloat(Math.floor(Game.cookiesReset))+';'+
292 | parseInt(Math.floor(Game.elderWrath))+';'+
293 | parseInt(Math.floor(Game.pledges))+';'+
294 | parseInt(Math.floor(Game.pledgeT))+';'+
295 | parseInt(Math.floor(Game.nextResearch))+';'+
296 | parseInt(Math.floor(Game.researchT))+
297 | '|';//cookies
298 | for (var i in Game.Objects)//buildings
299 | {
300 | var me=Game.Objects[i];
301 | str+=me.amount+','+me.bought+','+Math.floor(me.totalCookies)+','+me.specialUnlocked+';';
302 | }
303 | str+='|';
304 | var toCompress=[];
305 | for (var i in Game.Upgrades)//upgrades
306 | {
307 | var me=Game.Upgrades[i];
308 | toCompress.push(Math.min(me.unlocked,1),Math.min(me.bought,1));
309 | }
310 | toCompress=CompressLargeBin(toCompress);
311 | str+=toCompress;
312 | str+='|';
313 | var toCompress=[];
314 | for (var i in Game.Achievements)//achievements
315 | {
316 | var me=Game.Achievements[i];
317 | toCompress.push(Math.min(me.won));
318 | }
319 | toCompress=CompressLargeBin(toCompress);
320 | str+=toCompress;
321 |
322 |
323 | if (exporting)
324 | {
325 | str=escape(utf8_to_b64(str)+'!END!');
326 | return str;
327 | }
328 | else
329 | {
330 | //that's right
331 | //we're using cookies
332 | //yeah I went there
333 | var now=new Date();//we storin dis for 5 years, people
334 | now.setFullYear(now.getFullYear()+5);//mmh stale cookies
335 | str=utf8_to_b64(str)+'!END!';
336 | str='CookieClickerGame='+escape(str)+'; expires='+now.toUTCString()+';';
337 | document.cookie=str;//aaand save
338 | if (document.cookie.indexOf('CookieClickerGame')<0) Game.Popup('Error while saving. Export your save instead!');
339 | else Game.Popup('Game saved');
340 | }
341 | }
342 |
343 | /*=====================================================================================
344 | LOAD
345 | =======================================================================================*/
346 | Game.LoadSave=function(data)
347 | {
348 | var str='';
349 | if (data) str=unescape(data);
350 | else if (document.cookie.indexOf('CookieClickerGame')>=0) str=unescape(document.cookie.split('CookieClickerGame=')[1]);//get cookie here
351 |
352 | if (str!='')
353 | {
354 | var version=0;
355 | var oldstr=str.split('|');
356 | if (oldstr[0]<1) {}
357 | else
358 | {
359 | str=str.split('!END!')[0];
360 | str=b64_to_utf8(str);
361 | }
362 | if (str!='')
363 | {
364 | var spl='';
365 | str=str.split('|');
366 | version=parseFloat(str[0]);
367 | if (version>=1 && version>Game.version)
368 | {
369 | alert('Error : you are attempting to load a save from a later version (v.'+version+'; you are using v.'+Game.version+').');
370 | return;
371 | }
372 | else if (version>=1)
373 | {
374 | spl=str[2].split(';');//save stats
375 | Game.startDate=parseInt(spl[0]);
376 | spl=str[3].split('');//prefs
377 | Game.prefs.particles=parseInt(spl[0]);
378 | Game.prefs.numbers=parseInt(spl[1]);
379 | Game.prefs.autosave=parseInt(spl[2]);
380 | Game.prefs.autoupdate=spl[3]?parseInt(spl[3]):1;
381 | Game.prefs.milk=spl[4]?parseInt(spl[4]):1;
382 | Game.prefs.fancy=parseInt(spl[5]);if (Game.prefs.fancy) Game.removeClass('noFancy'); else if (!Game.prefs.fancy) Game.addClass('noFancy');
383 | spl=str[4].split(';');//cookies
384 | Game.cookies=parseFloat(spl[0]);Game.cookiesEarned=parseFloat(spl[1]);
385 | Game.cookieClicks=spl[2]?parseInt(spl[2]):0;
386 | Game.goldenClicks=spl[3]?parseInt(spl[3]):0;
387 | Game.handmadeCookies=spl[4]?parseFloat(spl[4]):0;
388 | Game.missedGoldenClicks=spl[5]?parseInt(spl[5]):0;
389 | Game.backgroundType=spl[6]?parseInt(spl[6]):0;
390 | Game.milkType=spl[7]?parseInt(spl[7]):0;
391 | Game.cookiesReset=spl[8]?parseFloat(spl[8]):0;
392 | Game.elderWrath=spl[9]?parseInt(spl[9]):0;
393 | Game.pledges=spl[10]?parseInt(spl[10]):0;
394 | Game.pledgeT=spl[11]?parseInt(spl[11]):0;
395 | Game.nextResearch=spl[12]?parseInt(spl[12]):0;
396 | Game.researchT=spl[13]?parseInt(spl[13]):0;
397 | spl=str[5].split(';');//buildings
398 | Game.BuildingsOwned=0;
399 | for (var i in Game.ObjectsById)
400 | {
401 | var me=Game.ObjectsById[i];
402 | if (spl[i])
403 | {
404 | var mestr=spl[i].toString().split(',');
405 | me.amount=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);me.totalCookies=parseInt(mestr[2]);me.specialUnlocked=parseInt(mestr[3]);
406 | Game.BuildingsOwned+=me.amount;
407 | }
408 | else
409 | {
410 | me.unlocked=0;me.bought=0;me.totalCookies=0;
411 | }
412 | }
413 | if (version<1.035)//old non-binary algorithm
414 | {
415 | spl=str[6].split(';');//upgrades
416 | Game.UpgradesOwned=0;
417 | for (var i in Game.UpgradesById)
418 | {
419 | var me=Game.UpgradesById[i];
420 | if (spl[i])
421 | {
422 | var mestr=spl[i].split(',');
423 | me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
424 | if (me.bought) Game.UpgradesOwned++;
425 | }
426 | else
427 | {
428 | me.unlocked=0;me.bought=0;
429 | }
430 | }
431 | if (str[7]) spl=str[7].split(';'); else spl=[];//achievements
432 | Game.AchievementsOwned=0;
433 | for (var i in Game.AchievementsById)
434 | {
435 | var me=Game.AchievementsById[i];
436 | if (spl[i])
437 | {
438 | var mestr=spl[i].split(',');
439 | me.won=parseInt(mestr[0]);
440 | }
441 | else
442 | {
443 | me.won=0;
444 | }
445 | if (me.won && me.hide!=3) Game.AchievementsOwned++;
446 | }
447 | }
448 | else
449 | {
450 | if (str[6]) spl=str[6]; else spl=[];//upgrades
451 | spl=UncompressLargeBin(spl);
452 | Game.UpgradesOwned=0;
453 | for (var i in Game.UpgradesById)
454 | {
455 | var me=Game.UpgradesById[i];
456 | if (spl[i*2])
457 | {
458 | var mestr=[spl[i*2],spl[i*2+1]];
459 | me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
460 | if (me.bought) Game.UpgradesOwned++;
461 | }
462 | else
463 | {
464 | me.unlocked=0;me.bought=0;
465 | }
466 | }
467 | if (str[7]) spl=str[7]; else spl=[];//achievements
468 | spl=UncompressLargeBin(spl);
469 | Game.AchievementsOwned=0;
470 | for (var i in Game.AchievementsById)
471 | {
472 | var me=Game.AchievementsById[i];
473 | if (spl[i])
474 | {
475 | var mestr=[spl[i]];
476 | me.won=parseInt(mestr[0]);
477 | }
478 | else
479 | {
480 | me.won=0;
481 | }
482 | if (me.won && me.hide!=3) Game.AchievementsOwned++;
483 | }
484 | }
485 |
486 |
487 | for (var i in Game.ObjectsById)
488 | {
489 | var me=Game.ObjectsById[i];
490 | if (me.buyFunction) me.buyFunction();
491 | me.setSpecial(0);
492 | if (me.special) me.special();
493 | me.refresh();
494 | }
495 | }
496 | else//importing old version save
497 | {
498 | /*
499 | Game.startDate=parseInt(new Date().getTime());
500 | Game.cookies=parseInt(str[1]);
501 | Game.cookiesEarned=parseInt(str[1]);
502 |
503 | for (var i in Game.ObjectsById)
504 | {
505 | var me=Game.ObjectsById[i];
506 | me.amount=0;me.bought=0;me.totalCookies=0;
507 | me.refresh();
508 | }
509 | for (var i in Game.UpgradesById)
510 | {
511 | var me=Game.UpgradesById[i];
512 | me.unlocked=0;me.bought=0;
513 | }
514 |
515 | var moni=0;
516 | moni+=15*Math.pow(1.1,parseInt(str[2]));
517 | moni+=100*Math.pow(1.1,parseInt(str[4]));
518 | moni+=500*Math.pow(1.1,parseInt(str[6]));
519 | moni+=2000*Math.pow(1.1,parseInt(str[8]));
520 | moni+=7000*Math.pow(1.1,parseInt(str[10]));
521 | moni+=50000*Math.pow(1.1,parseInt(str[12]));
522 | moni+=1000000*Math.pow(1.1,parseInt(str[14]));
523 | if (parseInt(str[16])) moni+=123456789*Math.pow(1.1,parseInt(str[16]));
524 |
525 | alert('Imported old save from version '+version+'; recovered '+Beautify(Game.cookies)+' cookies, and converted buildings back to '+Beautify(moni)+' cookies.');
526 |
527 | Game.cookies+=moni;
528 | Game.cookiesEarned+=moni;
529 | */
530 | alert('Sorry, you can\'t import saves from the old version anymore.');
531 | return;
532 | }
533 |
534 |
535 | Game.goldenCookie.reset();
536 |
537 | Game.prestige=[];
538 |
539 | Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,13));
540 |
541 | Game.RebuildUpgrades();
542 |
543 | Game.TickerAge=0;
544 |
545 | Game.elderWrathD=0;
546 | Game.frenzy=0;
547 | Game.frenzyPower=1;
548 | Game.clickFrenzy=0;
549 | Game.recalculateGains=1;
550 | Game.storeToRebuild=1;
551 | Game.upgradesToRebuild=1;
552 | Game.Popup('Game loaded');
553 | }
554 | }
555 | }
556 |
557 | /*=====================================================================================
558 | RESET
559 | =======================================================================================*/
560 | Game.Reset=function(bypass)
561 | {
562 | if (bypass || confirm('Do you REALLY want to start over?\n(your will lose your progress, but you will keep your achievements and your prestige.)'))
563 | {
564 | if (!bypass)
565 | {
566 | if (Game.cookiesEarned>=1000000) Game.Win('Sacrifice');
567 | if (Game.cookiesEarned>=1000000000) Game.Win('Oblivion');
568 | if (Game.cookiesEarned>=1000000000000) Game.Win('From scratch');
569 | if (Game.cookiesEarned>=1000000000000000) Game.Win('Nihilism');
570 | }
571 | Game.cookiesReset+=Game.cookiesEarned;
572 | Game.cookies=0;
573 | Game.cookiesEarned=0;
574 | Game.cookieClicks=0;
575 | //Game.goldenClicks=0;
576 | //Game.missedGoldenClicks=0;
577 | Game.handmadeCookies=0;
578 | Game.backgroundType=-1;
579 | Game.milkType=-1;
580 | Game.frenzy=0;
581 | Game.frenzyPower=1;
582 | Game.clickFrenzy=0;
583 | Game.pledges=0;
584 | Game.pledgeT=0;
585 | Game.elderWrath=0;
586 | Game.nextResearch=0;
587 | Game.researchT=0;
588 | Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,13));
589 | for (var i in Game.ObjectsById)
590 | {
591 | var me=Game.ObjectsById[i];
592 | me.amount=0;me.bought=0;me.totalCookies=0;me.specialUnlocked=0;
593 | me.setSpecial(0);
594 | me.refresh();
595 | }
596 | for (var i in Game.UpgradesById)
597 | {
598 | var me=Game.UpgradesById[i];
599 | me.unlocked=0;me.bought=0;
600 | }
601 | /*
602 | for (var i in Game.AchievementsById)
603 | {
604 | var me=Game.AchievementsById[i];
605 | me.won=0;
606 | }*/
607 | //Game.DefaultPrefs();
608 | Game.BuildingsOwned=0;
609 | Game.UpgradesOwned=0;
610 | Game.RebuildUpgrades();
611 | Game.TickerAge=0;
612 | Game.recalculateGains=1;
613 | Game.storeToRebuild=1;
614 | Game.upgradesToRebuild=1;
615 | Game.startDate=parseInt(new Date().getTime());
616 | Game.goldenCookie.reset();
617 |
618 | Game.Popup('Game reset');
619 |
620 | if (!bypass)
621 | {
622 | var prestige=0;
623 | if (Game.prestige.ready) prestige=Game.prestige['Heavenly chips'];
624 | Game.prestige=[];
625 | Game.CalculatePrestige();
626 | prestige=Game.prestige['Heavenly chips']-prestige;
627 | if (prestige!=0) Game.Popup('You earn '+prestige+' heavenly chip'+(prestige==1?'':'s')+'!');
628 | }
629 | }
630 | }
631 | Game.HardReset=function()
632 | {
633 | if (confirm('Do you REALLY want to wipe your save?\n(you will lose your progress, your achievements, and your prestige!)'))
634 | {
635 | if (confirm('Whoah now, are you really, REALLY sure?\n(don\'t say we didn\'t warn you!)'))
636 | {
637 | for (var i in Game.AchievementsById)
638 | {
639 | var me=Game.AchievementsById[i];
640 | me.won=0;
641 | }
642 | Game.AchievementsOwned=0;
643 | Game.goldenClicks=0;
644 | Game.missedGoldenClicks=0;
645 | Game.Reset(1);
646 | Game.cookiesReset=0;
647 | Game.prestige=[];
648 | Game.CalculatePrestige();
649 | }
650 | }
651 | }
652 |
653 |
654 | /*=====================================================================================
655 | COOKIE ECONOMICS
656 | =======================================================================================*/
657 | Game.Earn=function(howmuch)
658 | {
659 | Game.cookies+=howmuch;
660 | Game.cookiesEarned+=howmuch;
661 | }
662 | Game.Spend=function(howmuch)
663 | {
664 | Game.cookies-=howmuch;
665 | }
666 | Game.mouseCps=function()
667 | {
668 | var add=0;
669 | if (Game.Has('Thousand fingers')) add+=0.1;
670 | if (Game.Has('Million fingers')) add+=0.5;
671 | if (Game.Has('Billion fingers')) add+=2;
672 | if (Game.Has('Trillion fingers')) add+=10;
673 | if (Game.Has('Quadrillion fingers')) add+=20;
674 | if (Game.Has('Quintillion fingers')) add+=100;
675 | var num=0;
676 | for (var i in Game.Objects) {if (Game.Objects[i].name!='Cursor') num+=Game.Objects[i].amount;}
677 | add=add*num;
678 | if (Game.Has('Plastic mouse')) add+=Game.cookiesPs*0.01;
679 | if (Game.Has('Iron mouse')) add+=Game.cookiesPs*0.01;
680 | if (Game.Has('Titanium mouse')) add+=Game.cookiesPs*0.01;
681 | if (Game.Has('Adamantium mouse')) add+=Game.cookiesPs*0.01;
682 | var mult=1;
683 | if (Game.clickFrenzy>0) mult*=777;
684 | return mult*Game.ComputeCps(1,Game.Has('Reinforced index finger'),Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add);
685 | }
686 | Game.computedMouseCps=1;
687 | Game.globalCpsMult=1;
688 | Game.lastClick=0;
689 | Game.autoclickerDetected=0;
690 | Game.ClickCookie=function()
691 | {
692 | if (new Date().getTime()-Game.lastClick<1000/250)
693 | {
694 | }
695 | else
696 | {
697 | if (new Date().getTime()-Game.lastClick<1000/15)
698 | {
699 | Game.autoclickerDetected+=Game.fps;
700 | if (Game.autoclickerDetected>=Game.fps*5) Game.Win('Uncanny clicker');
701 | }
702 | Game.Earn(Game.computedMouseCps);
703 | Game.handmadeCookies+=Game.computedMouseCps;
704 | if (Game.prefs.particles) Game.cookieParticleAdd();
705 | if (Game.prefs.numbers) Game.cookieNumberAdd('+'+Beautify(Game.computedMouseCps,1));
706 | Game.cookieClicks++;
707 | }
708 | Game.lastClick=new Date().getTime();
709 | }
710 | l('bigCookie').onclick=Game.ClickCookie;
711 |
712 | Game.HowMuchPrestige=function(cookies)
713 | {
714 | var prestige=cookies/1000000000000;
715 | //prestige=Math.max(0,Math.floor(Math.pow(prestige,0.5)));//old version
716 | prestige=Math.max(0,Math.floor((-1+Math.pow(1+8*prestige,0.5))/2));//geometric progression
717 | return prestige;
718 | }
719 | Game.CalculatePrestige=function()
720 | {
721 | var prestige=Game.HowMuchPrestige(Game.cookiesReset);
722 | Game.prestige=[];
723 | Game.prestige['Heavenly chips']=prestige;
724 | Game.prestige.ready=1;
725 | }
726 | /*=====================================================================================
727 | CPS RECALCULATOR
728 | =======================================================================================*/
729 | Game.recalculateGains=1;
730 | Game.CalculateGains=function()
731 | {
732 | Game.cookiesPs=0;
733 | var mult=1;
734 | for (var i in Game.Upgrades)
735 | {
736 | var me=Game.Upgrades[i];
737 | if (me.bought>0)
738 | {
739 | if (me.type=='cookie' && Game.Has(me.name)) mult+=me.power*0.01;
740 | }
741 | }
742 | mult+=Game.Has('Specialized chocolate chips')*0.01;
743 | mult+=Game.Has('Designer cocoa beans')*0.02;
744 | mult+=Game.Has('Underworld ovens')*0.03;
745 | mult+=Game.Has('Exotic nuts')*0.04;
746 | mult+=Game.Has('Arcane sugar')*0.05;
747 |
748 | if (!Game.prestige.ready) Game.CalculatePrestige();
749 | mult+=parseInt(Game.prestige['Heavenly chips'])*0.02;
750 |
751 | for (var i in Game.Objects)
752 | {
753 | var me=Game.Objects[i];
754 | me.storedCps=(typeof(me.cps)=='function'?me.cps():me.cps);
755 | me.storedTotalCps=me.amount*me.storedCps;
756 | Game.cookiesPs+=me.storedTotalCps;
757 | }
758 |
759 | if (Game.Has('Kitten helpers')) mult*=(1+Game.milkProgress*0.05);
760 | if (Game.Has('Kitten workers')) mult*=(1+Game.milkProgress*0.1);
761 | if (Game.Has('Kitten engineers')) mult*=(1+Game.milkProgress*0.2);
762 | if (Game.Has('Kitten overseers')) mult*=(1+Game.milkProgress*0.3);
763 |
764 | if (Game.frenzy>0) mult*=Game.frenzyPower;
765 |
766 | if (Game.Has('Elder Covenant')) mult*=0.95;
767 |
768 | Game.globalCpsMult=mult;
769 | Game.cookiesPs*=Game.globalCpsMult;
770 |
771 | for (var i=0;i=Game.cpsAchievs[i*2+1]) Game.Win(Game.cpsAchievs[i*2]);
774 | }
775 |
776 | Game.computedMouseCps=Game.mouseCps();
777 |
778 | Game.recalculateGains=0;
779 | }
780 | /*=====================================================================================
781 | GOLDEN COOKIE
782 | =======================================================================================*/
783 | Game.goldenCookie={x:0,y:0,life:0,delay:0,dur:13,toDie:1,wrath:0,chain:0,last:''};
784 | Game.goldenCookie.reset=function()
785 | {
786 | Game.goldenCookie.life=0;
787 | Game.goldenCookie.delay=0;
788 | Game.goldenCookie.dur=13;
789 | Game.goldenCookie.toDie=1;
790 | Game.goldenCookie.last='';
791 | Game.goldenCookie.chain=0;
792 | }
793 | Game.goldenCookie.spawn=function()
794 | {
795 | if (Game.goldenCookie.delay!=0 || Game.goldenCookie.life!=0) Game.Win('Cheated cookies taste awful');
796 | var me=l('goldenCookie');
797 | if ((Game.elderWrath==1 && Math.random()<0.33) || (Game.elderWrath==2 && Math.random()<0.66) || (Game.elderWrath==3))
798 | {
799 | Game.goldenCookie.wrath=1;
800 | me.style.background='url(img/wrathCookie.png)';
801 | }
802 | else
803 | {
804 | Game.goldenCookie.wrath=0;
805 | me.style.background='url(img/goldCookie.png)';
806 | }
807 | var r=Math.floor(Math.random()*360);
808 | me.style.transform='rotate('+r+'deg)';
809 | me.style.mozTransform='rotate('+r+'deg)';
810 | me.style.webkitTransform='rotate('+r+'deg)';
811 | me.style.msTransform='rotate('+r+'deg)';
812 | me.style.oTransform='rotate('+r+'deg)';
813 | var screen=l('game').getBoundingClientRect();
814 | Game.goldenCookie.x=Math.floor(Math.random()*(screen.right-screen.left-128)+screen.left+64)-64;
815 | Game.goldenCookie.y=Math.floor(Math.random()*(screen.bottom-screen.top-128)+screen.top+64)-64;
816 | me.style.left=Game.goldenCookie.x+'px';
817 | me.style.top=Game.goldenCookie.y+'px';
818 | me.style.display='block';
819 | var dur=13;
820 | if (Game.Has('Lucky day')) dur*=2;
821 | if (Game.Has('Serendipity')) dur*=2;
822 | if (Game.goldenCookie.chain>0) dur=6;
823 | Game.goldenCookie.dur=dur;
824 | Game.goldenCookie.life=Game.fps*Game.goldenCookie.dur;
825 | me.toDie=0;
826 | }
827 | Game.goldenCookie.update=function()
828 | {
829 | if (Game.goldenCookie.delay==0 && Game.goldenCookie.life==0) Game.goldenCookie.spawn();
830 | if (Game.goldenCookie.life>0)
831 | {
832 | Game.goldenCookie.life--;
833 | l('goldenCookie').style.opacity=1-Math.pow((Game.goldenCookie.life/(Game.fps*Game.goldenCookie.dur))*2-1,4);
834 | if (Game.goldenCookie.life==0 || Game.goldenCookie.toDie==1)
835 | {
836 | if (Game.goldenCookie.life==0) Game.goldenCookie.chain=0;
837 | var m=(5+Math.floor(Math.random()*10));
838 | if (Game.Has('Lucky day')) m/=2;
839 | if (Game.Has('Serendipity')) m/=2;
840 | if (Game.goldenCookie.chain>0) m=0.05;
841 | if (Game.Has('Gold hoard')) m=0.01;
842 | Game.goldenCookie.delay=Math.ceil(Game.fps*60*m);
843 | l('goldenCookie').style.display='none';
844 | if (Game.goldenCookie.toDie==0) Game.missedGoldenClicks++;
845 | Game.goldenCookie.toDie=0;
846 | Game.goldenCookie.life=0;
847 | }
848 | }
849 | if (Game.goldenCookie.delay>0) Game.goldenCookie.delay--;
850 | }
851 | Game.goldenCookie.choose=function()
852 | {
853 | var list=[];
854 | if (Game.goldenCookie.wrath>0) list.push('clot','multiply cookies','ruin cookies');
855 | else list.push('frenzy','multiply cookies');
856 | if (Game.goldenCookie.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie');
857 | else if (Math.random()<0.01 && Game.cookiesEarned>=100000) list.push('chain cookie');
858 | if (Math.random()<0.05) list.push('click frenzy');
859 | if (Game.goldenCookie.last!='' && Math.random()<0.8 && list.indexOf(Game.goldenCookie.last)!=-1) list.splice(list.indexOf(Game.goldenCookie.last),1);//80% chance to force a different one
860 | var choice=choose(list);
861 | return choice;
862 | }
863 | Game.goldenCookie.click=function()
864 | {
865 | if (Game.goldenCookie.life>0)
866 | {
867 | Game.goldenCookie.toDie=1;
868 | Game.goldenClicks++;
869 |
870 | if (Game.goldenClicks>=1) Game.Win('Golden cookie');
871 | if (Game.goldenClicks>=7) Game.Win('Lucky cookie');
872 | if (Game.goldenClicks>=27) Game.Win('A stroke of luck');
873 | if (Game.goldenClicks>=77) Game.Win('Fortune');
874 | if (Game.goldenClicks>=777) Game.Win('Leprechaun');
875 | if (Game.goldenClicks>=7777) Game.Win('Black cat\'s paw');
876 |
877 | if (Game.goldenClicks>=7) Game.Unlock('Lucky day');
878 | if (Game.goldenClicks>=27) Game.Unlock('Serendipity');
879 | if (Game.goldenClicks>=77) Game.Unlock('Get lucky');
880 |
881 | l('goldenCookie').style.display='none';
882 |
883 | var choice=Game.goldenCookie.choose();
884 |
885 | if (Game.goldenCookie.chain>0) choice='chain cookie';
886 | Game.goldenCookie.last=choice;
887 |
888 | if (choice!='chain cookie') Game.goldenCookie.chain=0;
889 | if (choice=='frenzy')
890 | {
891 | var time=77+77*Game.Has('Get lucky');
892 | Game.frenzy=Game.fps*time;
893 | Game.frenzyPower=7;
894 | Game.recalculateGains=1;
895 | Game.Popup('Frenzy : cookie production x7 for '+time+' seconds!');
896 | }
897 | else if (choice=='multiply cookies')
898 | {
899 | var moni=Math.min(Game.cookies*0.1,Game.cookiesPs*60*20)+13;//add 10% to cookies owned (+13), or 20 minutes of cookie production - whichever is lowest
900 | Game.Earn(moni);
901 | Game.Popup('Lucky! +'+Beautify(moni)+' cookies!');
902 | }
903 | else if (choice=='ruin cookies')
904 | {
905 | var 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 lowest
906 | moni=Math.min(Game.cookies,moni);
907 | Game.Spend(moni);
908 | Game.Popup('Ruin! Lost '+Beautify(moni)+' cookies!');
909 | }
910 | else if (choice=='blood frenzy')
911 | {
912 | var time=6+6*Game.Has('Get lucky');
913 | Game.frenzy=Game.fps*time;//*2;//we shouldn't need *2 but I keep getting reports of it lasting only 3 seconds
914 | Game.frenzyPower=666;
915 | Game.recalculateGains=1;
916 | Game.Popup('Elder frenzy : cookie production x666 for '+time+' seconds!');
917 | }
918 | else if (choice=='clot')
919 | {
920 | var time=66+66*Game.Has('Get lucky');
921 | Game.frenzy=Game.fps*time;
922 | Game.frenzyPower=0.5;
923 | Game.recalculateGains=1;
924 | Game.Popup('Clot : cookie production halved for '+time+' seconds!');
925 | }
926 | else if (choice=='click frenzy')
927 | {
928 | var time=13+13*Game.Has('Get lucky');
929 | Game.clickFrenzy=Game.fps*time;
930 | Game.recalculateGains=1;
931 | Game.Popup('Click frenzy! Clicking power x777 for '+time+' seconds!');
932 | }
933 | else if (choice=='chain cookie')
934 | {
935 | Game.goldenCookie.chain++;
936 | var moni='';
937 | for (var i=0;i12 || moni>=Game.cookies*1) && Game.goldenCookie.chain>4) Game.goldenCookie.chain=0;
941 | Game.Earn(moni);
942 | }
943 | }
944 | }
945 | l('goldenCookie').onclick=Game.goldenCookie.click;
946 |
947 |
948 | /*=====================================================================================
949 | PARTICLES
950 | =======================================================================================*/
951 | //falling cookies
952 | Game.cookieParticles=[];
953 | var str='';
954 | for (var i=0;i<40;i++)
955 | {
956 | Game.cookieParticles[i]={x:0,y:0,life:-1};
957 | str+='';
958 | }
959 | l('cookieShower').innerHTML=str;
960 | Game.cookieParticlesUpdate=function()
961 | {
962 | for (var i in Game.cookieParticles)
963 | {
964 | var me=Game.cookieParticles[i];
965 | if (me.life!=-1)
966 | {
967 | me.y+=me.life*0.5+Math.random()*0.5;
968 | me.life++;
969 | var el=me.l;
970 | el.style.left=Math.floor(me.x)+'px';
971 | el.style.top=Math.floor(me.y)+'px';
972 | el.style.opacity=1-(me.life/(Game.fps*2));
973 | if (me.life>=Game.fps*2)
974 | {
975 | me.life=-1;
976 | me.l.style.opacity=0;
977 | }
978 | }
979 | }
980 | }
981 | Game.cookieParticleAdd=function()
982 | {
983 | //pick the first free (or the oldest) particle to replace it
984 | if (Game.prefs.particles)
985 | {
986 | var highest=0;
987 | var highestI=0;
988 | for (var i in Game.cookieParticles)
989 | {
990 | if (Game.cookieParticles[i].life==-1) {highestI=i;break;}
991 | if (Game.cookieParticles[i].life>highest)
992 | {
993 | highest=Game.cookieParticles[i].life;
994 | highestI=i;
995 | }
996 | }
997 | var i=highestI;
998 | var rect=l('cookieShower').getBoundingClientRect();
999 | var x=Math.floor(Math.random()*(rect.right-rect.left));
1000 | var y=-32;
1001 | var me=Game.cookieParticles[i];
1002 | if (!me.l) me.l=l('cookieParticle'+i);
1003 | me.life=0;
1004 | me.x=x;
1005 | me.y=y;
1006 | var r=Math.floor(Math.random()*360);
1007 | me.l.style.backgroundPosition=(Math.floor(Math.random()*8)*64)+'px 0px';
1008 | me.l.style.transform='rotate('+r+'deg)';
1009 | me.l.style.mozTransform='rotate('+r+'deg)';
1010 | me.l.style.webkitTransform='rotate('+r+'deg)';
1011 | me.l.style.msTransform='rotate('+r+'deg)';
1012 | me.l.style.oTransform='rotate('+r+'deg)';
1013 | }
1014 | }
1015 |
1016 | //rising numbers
1017 | Game.cookieNumbers=[];
1018 | var str='';
1019 | for (var i=0;i<20;i++)
1020 | {
1021 | Game.cookieNumbers[i]={x:0,y:0,life:-1,text:''};
1022 | str+='';
1023 | }
1024 | l('cookieNumbers').innerHTML=str;
1025 | Game.cookieNumbersUpdate=function()
1026 | {
1027 | for (var i in Game.cookieNumbers)
1028 | {
1029 | var me=Game.cookieNumbers[i];
1030 | if (me.life!=-1)
1031 | {
1032 | me.y-=me.life*0.5+Math.random()*0.5;
1033 | me.life++;
1034 | var el=me.l;
1035 | el.style.left=Math.floor(me.x)+'px';
1036 | el.style.top=Math.floor(me.y)+'px';
1037 | el.style.opacity=1-(me.life/(Game.fps*1));
1038 | //l('cookieNumber'+i).style.zIndex=(1000+(Game.fps*1-me.life));
1039 | if (me.life>=Game.fps*1)
1040 | {
1041 | me.life=-1;
1042 | me.l.style.opacity=0;
1043 | }
1044 | }
1045 | }
1046 | }
1047 | Game.cookieNumberAdd=function(text)
1048 | {
1049 | //pick the first free (or the oldest) particle to replace it
1050 | var highest=0;
1051 | var highestI=0;
1052 | for (var i in Game.cookieNumbers)
1053 | {
1054 | if (Game.cookieNumbers[i].life==-1) {highestI=i;break;}
1055 | if (Game.cookieNumbers[i].life>highest)
1056 | {
1057 | highest=Game.cookieNumbers[i].life;
1058 | highestI=i;
1059 | }
1060 | }
1061 | var i=highestI;
1062 | var x=-100+(Math.random()-0.5)*40;
1063 | var y=0+(Math.random()-0.5)*40;
1064 | var me=Game.cookieNumbers[i];
1065 | if (!me.l) me.l=l('cookieNumber'+i);
1066 | me.life=0;
1067 | me.x=x;
1068 | me.y=y;
1069 | me.text=text;
1070 | me.l.innerHTML=text;
1071 | me.l.style.left=Math.floor(Game.cookieNumbers[i].x)+'px';
1072 | me.l.style.top=Math.floor(Game.cookieNumbers[i].y)+'px';
1073 | }
1074 |
1075 | //generic particles
1076 | Game.particles=[];
1077 | Game.particlesY=0;
1078 | var str='';
1079 | for (var i=0;i<20;i++)
1080 | {
1081 | Game.particles[i]={x:0,y:0,life:-1,text:''};
1082 | str+='';
1083 | }
1084 | l('particles').innerHTML=str;
1085 | Game.particlesUpdate=function()
1086 | {
1087 | Game.particlesY=0;
1088 | for (var i in Game.particles)
1089 | {
1090 | var me=Game.particles[i];
1091 | if (me.life!=-1)
1092 | {
1093 | Game.particlesY+=64;//me.l.clientHeight;
1094 | var y=me.y-(1-Math.pow(1-me.life/(Game.fps*4),10))*50;
1095 | //me.y=me.life*0.25+Math.random()*0.25;
1096 | me.life++;
1097 | var el=me.l;
1098 | el.style.left=Math.floor(-200+me.x)+'px';
1099 | el.style.bottom=Math.floor(-y)+'px';
1100 | el.style.opacity=1-(me.life/(Game.fps*4));
1101 | if (me.life>=Game.fps*4)
1102 | {
1103 | me.life=-1;
1104 | el.style.opacity=0;
1105 | el.style.display='none';
1106 | }
1107 | }
1108 | }
1109 | }
1110 | Game.particlesAdd=function(text,el)
1111 | {
1112 | //pick the first free (or the oldest) particle to replace it
1113 | var highest=0;
1114 | var highestI=0;
1115 | for (var i in Game.particles)
1116 | {
1117 | if (Game.particles[i].life==-1) {highestI=i;break;}
1118 | if (Game.particles[i].life>highest)
1119 | {
1120 | highest=Game.particles[i].life;
1121 | highestI=i;
1122 | }
1123 | }
1124 | var i=highestI;
1125 | var x=(Math.random()-0.5)*40;
1126 | var y=0;//+(Math.random()-0.5)*40;
1127 | if (!el)
1128 | {
1129 | var rect=l('game').getBoundingClientRect();
1130 | var x=Math.floor((rect.left+rect.right)/2);
1131 | var y=Math.floor((rect.bottom));
1132 | x+=(Math.random()-0.5)*40;
1133 | y+=0;//(Math.random()-0.5)*40;
1134 | }
1135 | var me=Game.particles[i];
1136 | if (!me.l) me.l=l('particle'+i);
1137 | me.life=0;
1138 | me.x=x;
1139 | me.y=y-Game.particlesY;
1140 | me.text=text;
1141 | me.l.innerHTML=text;
1142 | me.l.style.left=Math.floor(Game.particles[i].x-200)+'px';
1143 | me.l.style.bottom=Math.floor(-Game.particles[i].y)+'px';
1144 | me.l.style.display='block';
1145 | Game.particlesY+=60;
1146 | }
1147 | Game.Popup=function(text)
1148 | {
1149 | Game.particlesAdd(text);
1150 | }
1151 |
1152 |
1153 | Game.veil=1;
1154 | Game.veilOn=function()
1155 | {
1156 | //l('sectionMiddle').style.display='none';
1157 | l('sectionRight').style.display='none';
1158 | l('backgroundLayer2').style.background='#000 url(img/darkNoise.png)';
1159 | Game.veil=1;
1160 | }
1161 | Game.veilOff=function()
1162 | {
1163 | //l('sectionMiddle').style.display='block';
1164 | l('sectionRight').style.display='block';
1165 | l('backgroundLayer2').style.background='transparent';
1166 | Game.veil=0;
1167 | }
1168 |
1169 | /*=====================================================================================
1170 | MENUS
1171 | =======================================================================================*/
1172 | Game.cssClasses=[];
1173 | Game.addClass=function(what) {if (Game.cssClasses.indexOf(what)==-1) Game.cssClasses.push(what);Game.updateClasses();}
1174 | Game.removeClass=function(what) {var i=Game.cssClasses.indexOf(what);if(i!=-1) {Game.cssClasses.splice(i,1);}Game.updateClasses();}
1175 | Game.updateClasses=function() {var str='';for (var i in Game.cssClasses) {str+=Game.cssClasses[i]+' ';}l('game').className=str;}
1176 |
1177 | Game.WriteButton=function(prefName,button,on,off,callback)
1178 | {
1179 | return ''+(Game.prefs[prefName]?on:off)+'';
1180 | }
1181 | Game.Toggle=function(prefName,button,on,off)
1182 | {
1183 | if (Game.prefs[prefName])
1184 | {
1185 | l(button).innerHTML=off;
1186 | l(button).className='';
1187 | Game.prefs[prefName]=0;
1188 | }
1189 | else
1190 | {
1191 | l(button).innerHTML=on;
1192 | l(button).className='enabled';
1193 | Game.prefs[prefName]=1;
1194 | }
1195 | }
1196 | Game.ToggleFancy=function()
1197 | {
1198 | if (Game.prefs.fancy) Game.removeClass('noFancy');
1199 | else if (!Game.prefs.fancy) Game.addClass('noFancy');
1200 | }
1201 | Game.onMenu='';
1202 | Game.ShowMenu=function(what)
1203 | {
1204 | if (!what) what='';
1205 | if (Game.onMenu=='' && what!='') Game.addClass('onMenu');
1206 | else if (Game.onMenu!='' && what!=Game.onMenu) Game.addClass('onMenu');
1207 | else if (what==Game.onMenu) {Game.removeClass('onMenu');what='';}
1208 | Game.onMenu=what;
1209 | Game.UpdateMenu();
1210 | }
1211 | Game.sayTime=function(time,detail)
1212 | {
1213 | var str='';
1214 | var detail=detail||0;
1215 | time=Math.floor(time);
1216 | if (time>=Game.fps*60*60*24*2 && detail<2) str=Beautify(time/(Game.fps*60*60*24))+' days';
1217 | else if (time>=Game.fps*60*60*24 && detail<2) str='1 day';
1218 | else if (time>=Game.fps*60*60*2 && detail<3) str=Beautify(time/(Game.fps*60*60))+' hours';
1219 | else if (time>=Game.fps*60*60 && detail<3) str='1 hour';
1220 | else if (time>=Game.fps*60*2 && detail<4) str=Beautify(time/(Game.fps*60))+' minutes';
1221 | else if (time>=Game.fps*60 && detail<4) str='1 minute';
1222 | else if (time>=Game.fps*2 && detail<5) str=Beautify(time/(Game.fps))+' seconds';
1223 | else if (time>=Game.fps && detail<5) str='1 second';
1224 | return str;
1225 | }
1226 |
1227 | Game.UpdateMenu=function()
1228 | {
1229 | var str='';
1230 | if (Game.onMenu!='')
1231 | {
1232 | str+='
Note : this game is updated fairly frequently, which often involves rebalancing. Expect to see prices and cookies/second vary wildly from one update to another!
'+
1270 |
1271 | '
'+
1272 | '
15/09/2013 - anticookies
'+
1273 | '
-ran out of regular matter to make your cookies? Try our new antimatter condensers!
'+
1274 | '
-renamed Hard-reset to "Wipe save" to avoid confusion
'+
1275 | '
-reset achievements are now regular achievements and require cookies baked all time, not cookies in bank
'+
1276 | '
-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)
'+
1277 | '
-golden cookie clicks are no longer reset by soft-resets
'+
1278 | '
-you can now see how long you\'ve been playing in the stats
'+
1279 |
1280 | '
'+
1281 | '
08/09/2013 - everlasting cookies
'+
1282 | '
-added a prestige system - resetting gives you permanent CpS boosts (the more cookies made before resetting, the bigger the boost!)
'+
1283 | '
-save format has been slightly modified to take less space
'+
1284 | '
-Leprechaun has been bumped to 777 golden cookies clicked and is now shadow; Fortune is the new 77 golden cookies achievement
'+
1285 | '
-clicking frenzy is now x777
'+
1286 |
1287 | '
'+
1288 | '
04/09/2013 - smarter cookie
'+
1289 | '
-golden cookies only have 20% chance of giving the same outcome twice in a row now
'+
1290 | '
-added a golden cookie upgrade
'+
1291 | '
-added an upgrade that makes pledges last twice as long (requires having pledged 10 times)
'+
1292 | '
-Quintillion fingers is now twice as efficient
'+
1293 | '
-Uncanny clicker was really too unpredictable; it is now a regular achievement and no longer requires a world record, just *pretty fast* clicking
'+
1294 |
1295 | '
'+
1296 | '
02/09/2013 - a better way out
'+
1297 | '
-Elder Covenant is even cheaper, and revoking it is cheaper still (also added a new achievement for getting it)
'+
1298 | '
-each grandma upgrade now requires 15 of the matching building
'+
1299 | '
-the dreaded bottom cursor has been fixed with a new cursor display style
'+
1300 | '
-added an option for faster, cheaper graphics
'+
1301 | '
-base64 encoding has been redone; this might make saving possible again on some older browsers
'+
1302 | '
-shadow achievements now have their own section
'+
1303 | '
-raspberry juice is now named raspberry milk, despite raspberry juice being delicious and going unquestionably well with cookies
'+
1304 | '
-HOTFIX : cursors now click; fancy graphics button renamed; cookies amount now more visible against cursors
'+
1305 |
1306 | '
'+
1307 | '
01/09/2013 - sorting things out
'+
1308 | '
-upgrades and achievements are properly sorted in the stats screen
'+
1309 | '
-made Elder Covenant much cheaper and less harmful
'+
1310 | '
-importing from the first version has been disabled, as promised
'+
1311 | '
-"One mind" now actually asks you to confirm the upgrade
'+
1312 |
1313 | '
'+
1314 | '
31/08/2013 - hotfixes
'+
1315 | '
-added a way to permanently stop the grandmapocalypse
'+
1316 | '
-Elder Pledge price is now capped
'+
1317 | '
-One Mind and other grandma research upgrades are now a little more powerful, if not 100% accurate
'+
1318 | '
-"golden" cookie now appears again during grandmapocalypse; Elder Pledge-related achievements are now unlockable
'+
1319 |
1320 | '
'+
1321 | '
31/08/2013 - too many grandmas
'+
1322 | '
-the grandmapocalypse is back, along with more grandma types
'+
1323 | '
-added some upgrades that boost your clicking power and make it scale with your cps
'+
1324 | '
-clicking achievements made harder; Neverclick is now a shadow achievement; Uncanny clicker should now truly be a world record
'+
1325 |
1326 | '
'+
1327 | '
28/08/2013 - over-achiever
'+
1328 | '
-added a few more achievements
'+
1329 | '
-reworked the "Bake X cookies" achievements so they take longer to achieve
'+
1330 |
1331 | '
'+
1332 | '
27/08/2013 - a bad idea
'+
1333 | '
-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!
'+
1334 | '
-made some achievements hidden for added mystery
'+
1335 |
1336 | '
'+
1337 | '
27/08/2013 - a sense of achievement
'+
1338 | '
-added achievements (and milk)
'+
1339 | '
(this is a big update, please don\'t get too mad if you lose some data!)
'+
1340 |
1341 | '
'+
1342 | '
26/08/2013 - new upgrade tier
'+
1343 | '
-added some more upgrades (including a couple golden cookie-related ones)
'+
1344 | '
-added clicking stats
'+
1345 |
1346 | '
'+
1347 | '
26/08/2013 - more tweaks
'+
1348 | '
-tweaked a couple cursor upgrades
'+
1349 | '
-made time machines less powerful
'+
1350 | '
-added offline mode option
'+
1351 |
1352 | '
'+
1353 | '
25/08/2013 - tweaks
'+
1354 | '
-rebalanced progression curve (mid- and end-game objects cost more and give more)
'+
1355 | '
-added some more cookie upgrades
'+
1356 | '
-added CpS for cursors
'+
1357 | '
-added sell button
'+
1358 | '
-made golden cookie more useful
'+
1359 |
1360 | '
'+
1361 | '
24/08/2013 - hotfixes
'+
1362 | '
-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)
'+
1363 | '
-upgrade store now has unlimited slots (just hover over it), due to popular demand
'+
1364 | '
-added update log
'+
1365 |
1366 | '
'+
1367 | '
24/08/2013 - big update!
'+
1368 | '
-revamped the whole game (new graphics, new game mechanics)
'+
1369 | '
-added upgrades
'+
1370 | '
-much safer saving
'+
1371 |
1372 | '
'+
1373 | '
08/08/2013 - game launch
'+
1374 | '
-made the game in a couple hours, for laughs
'+
1375 | '
-kinda starting to regret it
'+
1376 | '
-ah well
'+
1377 | '
'
1378 | ;
1379 | }
1380 | else if (Game.onMenu=='stats')
1381 | {
1382 | var buildingsOwned=0;
1383 | buildingsOwned=Game.BuildingsOwned;
1384 | var upgrades='';
1385 | var cookieUpgrades='';
1386 | var upgradesTotal=0;
1387 | var upgradesOwned=0;
1388 |
1389 | var list=[];
1390 | for (var i in Game.Upgrades)//sort the upgrades
1391 | {
1392 | list.push(Game.Upgrades[i]);
1393 | }
1394 | var sortMap=function(a,b)
1395 | {
1396 | if (a.order>b.order) return 1;
1397 | else if (a.order0 && me.hide!=3)
1408 | {
1409 | str2+='
Milk : '+Math.round(Game.milkProgress*100)+'% ('+milkName+') (Note : you gain milk through achievements. Milk can unlock unique upgrades over time.)
'+
1537 | '
'+achievements+'
'+
1538 | (shadowAchievements!=''?(
1539 | '
Shadow achievements (These are feats that are either unfair or difficult to attain. They do not give milk.)
'+
1540 | '
'+shadowAchievements+'
'
1541 | ):'')+
1542 | '
'
1543 | ;
1544 | }
1545 | l('menu').innerHTML=str;
1546 | }
1547 | l('prefsButton').onclick=function(){Game.ShowMenu('prefs');};
1548 | l('statsButton').onclick=function(){Game.ShowMenu('stats');};
1549 | l('logButton').onclick=function(){Game.ShowMenu('log');};
1550 |
1551 |
1552 | /*=====================================================================================
1553 | TOOLTIP
1554 | =======================================================================================*/
1555 | Game.tooltip={text:'',x:0,y:0,origin:0,on:0};
1556 | Game.tooltip.draw=function(from,text,x,y,origin)
1557 | {
1558 | this.text=text;
1559 | this.x=x;
1560 | this.y=y;
1561 | this.origin=origin;
1562 | var tt=l('tooltip');
1563 | var tta=l('tooltipAnchor');
1564 | tta.style.display='block';
1565 | var rect=from.getBoundingClientRect();
1566 | //var screen=tta.parentNode.getBoundingClientRect();
1567 | var x=0,y=0;
1568 | tt.style.left='auto';
1569 | tt.style.top='auto';
1570 | tt.style.right='auto';
1571 | tt.style.bottom='auto';
1572 | tta.style.left='auto';
1573 | tta.style.top='auto';
1574 | tta.style.right='auto';
1575 | tta.style.bottom='auto';
1576 | tt.style.width='auto';
1577 | tt.style.height='auto';
1578 | if (this.origin=='left')
1579 | {
1580 | x=rect.left;
1581 | y=rect.top;
1582 | tt.style.right='0';
1583 | tt.style.top='0';
1584 | }
1585 | else if (this.origin=='bottom-right')
1586 | {
1587 | x=rect.right;
1588 | y=rect.bottom;
1589 | tt.style.right='0';
1590 | tt.style.top='0';
1591 | }
1592 | else {alert('Tooltip anchor '+this.origin+' needs to be implemented');}
1593 | tta.style.left=Math.floor(x+this.x)+'px';
1594 | tta.style.top=Math.floor(y-32+this.y)+'px';
1595 | tt.innerHTML=unescape(text);
1596 | this.on=1;
1597 | }
1598 | Game.tooltip.hide=function()
1599 | {
1600 | l('tooltipAnchor').style.display='none';
1601 | this.on=0;
1602 | }
1603 | Game.getTooltip=function(text,x,y,origin)
1604 | {
1605 | origin=(origin?origin:'middle');
1606 | return 'onMouseOut="Game.tooltip.hide();" onMouseOver="Game.tooltip.draw(this,\''+escape(text)+'\','+x+','+y+',\''+origin+'\');"';
1607 | }
1608 |
1609 | /*=====================================================================================
1610 | NEWS TICKER
1611 | =======================================================================================*/
1612 | Game.Ticker='';
1613 | Game.TickerAge=0;
1614 | Game.TickerN=0;
1615 | Game.getNewTicker=function()
1616 | {
1617 | var list=[];
1618 |
1619 | if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)
1620 | {
1621 | if (Game.Objects['Grandma'].amount>0) list.push(choose([
1622 | 'Moist cookies.grandma',
1623 | 'We\'re nice grandmas.grandma',
1624 | 'Indentured servitude.grandma',
1625 | 'Come give grandma a kiss.grandma',
1626 | 'Why don\'t you visit more often?grandma',
1627 | 'Call me...grandma'
1628 | ]));
1629 |
1630 | if (Game.Objects['Grandma'].amount>=50) list.push(choose([
1631 | 'Absolutely disgusting.grandma',
1632 | 'You make me sick.grandma',
1633 | 'You disgust me.grandma',
1634 | 'We rise.grandma',
1635 | 'It begins.grandma',
1636 | 'It\'ll all be over soon.grandma',
1637 | 'You could have stopped it.grandma'
1638 | ]));
1639 |
1640 | if (Game.HasAchiev('Just wrong')) list.push(choose([
1641 | 'News : cookie manufacturer downsizes, sells own grandmother!',
1642 | 'It has betrayed us, the filthy little thing.grandma',
1643 | 'It tried to get rid of us, the nasty little thing.grandma',
1644 | 'It thought we would go away by selling us. How quaint.grandma',
1645 | 'I can smell your rotten cookies.grandma'
1646 | ]));
1647 |
1648 | if (Game.Objects['Grandma'].amount>=1 && Game.pledges>0 && Game.elderWrath==0) list.push(choose([
1649 | 'shrivelgrandma',
1650 | 'writhegrandma',
1651 | 'throbgrandma',
1652 | 'gnawgrandma',
1653 | 'We will rise again.grandma',
1654 | 'A mere setback.grandma',
1655 | 'We are not satiated.grandma',
1656 | 'Too late.grandma'
1657 | ]));
1658 |
1659 | if (Game.Objects['Farm'].amount>0) list.push(choose([
1660 | 'News : cookie farms suspected of employing undeclared elderly workforce!',
1661 | 'News : cookie farms release harmful chocolate in our rivers, says scientist!',
1662 | 'News : genetically-modified chocolate controversy strikes cookie farmers!',
1663 | 'News : free-range farm cookies popular with today\'s hip youth, says specialist.',
1664 | 'News : farm cookies deemed unfit for vegans, says nutritionist.'
1665 | ]));
1666 |
1667 | if (Game.Objects['Factory'].amount>0) list.push(choose([
1668 | 'News : cookie factories linked to global warming!',
1669 | 'News : cookie factories involved in chocolate weather controversy!',
1670 | 'News : cookie factories on strike, robotic minions employed to replace workforce!',
1671 | 'News : cookie factories on strike - workers demand to stop being paid in cookies!',
1672 | 'News : factory-made cookies linked to obesity, says study.'
1673 | ]));
1674 |
1675 | if (Game.Objects['Mine'].amount>0) list.push(choose([
1676 | 'News : '+Math.floor(Math.random()*1000+2)+' miners dead in chocolate mine catastrophe!',
1677 | 'News : '+Math.floor(Math.random()*1000+2)+' miners trapped in collapsed chocolate mine!',
1678 | 'News : chocolate mines found to cause earthquakes and sink holes!',
1679 | 'News : chocolate mine goes awry, floods village in chocolate!',
1680 | 'News : depths of chocolate mines found to house "peculiar, chocolaty beings"!'
1681 | ]));
1682 |
1683 | if (Game.Objects['Shipment'].amount>0) list.push(choose([
1684 | 'News : new chocolate planet found, becomes target of cookie-trading spaceships!',
1685 | 'News : massive chocolate planet found with 99.8% certified pure dark chocolate core!',
1686 | 'News : space tourism booming as distant planets attract more bored millionaires!',
1687 | 'News : chocolate-based organisms found on distant planet!',
1688 | 'News : ancient baking artifacts found on distant planet; "terrifying implications", experts say.'
1689 | ]));
1690 |
1691 | if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([
1692 | 'News : national gold reserves dwindle as more and more of the precious mineral is turned to cookies!',
1693 | 'News : chocolate jewelry found fashionable, gold and diamonds "just a fad", says specialist.',
1694 | 'News : silver found to also be transmutable into white chocolate!',
1695 | 'News : defective alchemy lab shut down, found to convert cookies to useless gold.',
1696 | 'News : alchemy-made cookies shunned by purists!'
1697 | ]));
1698 |
1699 | if (Game.Objects['Portal'].amount>0) list.push(choose([
1700 | 'News : nation worried as more and more unsettling creatures emerge from dimensional portals!',
1701 | 'News : dimensional portals involved in city-engulfing disaster!',
1702 | 'News : tourism to cookieverse popular with bored teenagers! Casualty rate as high as 73%!',
1703 | 'News : cookieverse portals suspected to cause fast aging and obsession with baking, says study.',
1704 | 'News : "do not settle near portals," says specialist; "your children will become strange and corrupted inside."'
1705 | ]));
1706 |
1707 | if (Game.Objects['Time machine'].amount>0) list.push(choose([
1708 | 'News : time machines involved in history-rewriting scandal! Or are they?',
1709 | 'News : time machines used in unlawful time tourism!',
1710 | 'News : cookies brought back from the past "unfit for human consumption", says historian.',
1711 | 'News : various historical figures inexplicably replaced with talking lumps of dough!',
1712 | 'News : "I have seen the future," says time machine operator, "and I do not wish to go there again."'
1713 | ]));
1714 |
1715 | if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([
1716 | 'News : whole town seemingly swallowed by antimatter-induced black hole; more reliable sources affirm town "never really existed"!',
1717 | 'News : "explain to me again why we need particle accelerators to bake cookies?" asks misguided local woman.',
1718 | 'News : first antimatter condenser successfully turned on, doesn\'t rip apart reality!',
1719 | 'News : researchers conclude that what the cookie industry needs, first and foremost, is "more magnets".',
1720 | 'News : "unravelling the fabric of reality just makes these cookies so much tastier", claims scientist.'
1721 | ]));
1722 |
1723 | if (Game.HasAchiev('Base 10')) list.push('News : cookie manufacturer completely forgoes common sense, lets OCD drive building decisions!');
1724 | if (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!');
1725 | if (Game.HasAchiev('A world filled with cookies')) list.push('News : known universe now jammed with cookies! No vacancies!');
1726 | if (Game.HasAchiev('Serendipity')) list.push('News : local cookie manufacturer becomes luckiest being alive!');
1727 |
1728 | if (Game.Has('Kitten helpers')) list.push('News : faint meowing heard around local cookie facilities; suggests new ingredient being tested.');
1729 | if (Game.Has('Kitten workers')) list.push('News : crowds of meowing kittens with little hard hats reported near local cookie facilities.');
1730 | if (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.');
1731 | if (Game.Has('Kitten overseers')) list.push('News : locals report troups of bossy kittens meowing adorable orders at passerbys.');
1732 |
1733 | var 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'];
1734 | if (Game.cookiesEarned>=10000) list.push(
1735 | 'News : '+choose([
1736 | 'cookies found to '+choose(['increase lifespan','sensibly increase intelligence','reverse aging','decrease hair loss','prevent arthritis','cure blindness'])+' in '+choose(animals)+'!',
1737 | 'cookies found to make '+choose(animals)+' '+choose(['more docile','more handsome','nicer','less hungry','more pragmatic','tastier'])+'!',
1738 | 'cookies tested on '+choose(animals)+', found to have no ill effects.',
1739 | 'cookies unexpectedly popular among '+choose(animals)+'!',
1740 | 'unsightly lumps found on '+choose(animals)+' near cookie facility; "they\'ve pretty much always looked like that", say biologists.',
1741 | 'new species of '+choose(animals)+' discovered in distant country; "yup, tastes like cookies", says biologist.',
1742 | 'cookies go well with roasted '+choose(animals)+', says controversial chef.',
1743 | '"do your cookies contain '+choose(animals)+'?", asks PSA warning against counterfeit cookies.'
1744 | ]),
1745 | 'News : "'+choose([
1746 | 'I\'m all about cookies',
1747 | 'I just can\'t stop eating cookies. I think I seriously need help',
1748 | 'I guess I have a cookie problem',
1749 | 'I\'m not addicted to cookies. That\'s just speculation by fans with too much free time',
1750 | 'my upcoming album contains 3 songs about cookies',
1751 | 'I\'ve had dreams about cookies 3 nights in a row now. I\'m a bit worried honestly',
1752 | 'accusations of cookie abuse are only vile slander',
1753 | 'cookies really helped me when I was feeling low',
1754 | 'cookies are the secret behind my perfect skin',
1755 | 'cookies helped me stay sane while filming my upcoming movie',
1756 | 'cookies helped me stay thin and healthy',
1757 | 'I\'ll say one word, just one : cookies',
1758 | 'alright, I\'ll say it - I\'ve never eaten a single cookie in my life'
1759 | ])+'", reveals celebrity.',
1760 | 'News : '+choose(['doctors recommend twice-daily consumption of fresh cookies.','doctors warn against chocolate chip-snorting teen fad.','doctors advise against new cookie-free fad diet.','doctors warn mothers about the dangers of "home-made cookies".']),
1761 | choose([
1762 | 'News : scientist predicts imminent cookie-related "end of the world"; becomes joke among peers.',
1763 | 'News : man robs bank, buys cookies.',
1764 | 'News : what makes cookies taste so right? "Probably all the [*****] they put in them", says anonymous tipper.',
1765 | 'News : man found allergic to cookies; "what a weirdo", says family.',
1766 | 'News : foreign politician involved in cookie-smuggling scandal.',
1767 | '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.',
1768 | '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'])+'.',
1769 | 'News : cookie shortage strikes town, people forced to eat cupcakes; "just not the same", concedes mayor.',
1770 | 'News : "you gotta admit, all this cookie stuff is a bit ominous", says confused idiot.',
1771 | 'News : movie cancelled from lack of actors; "everybody\'s at home eating cookies", laments director.',
1772 | 'News : comedian forced to cancel cookie routine due to unrelated indigestion.',
1773 | 'News : new cookie-based religion sweeps the nation.',
1774 | 'News : fossil records show cookie-based organisms prevalent during Cambrian explosion, scientists say.',
1775 | 'News : mysterious illegal cookies seized; "tastes terrible", says police.',
1776 | 'News : man found dead after ingesting cookie; investigators favor "mafia snitch" hypothesis.',
1777 | 'News : "the universe pretty much loops on itself," suggests researcher; "it\'s cookies all the way down."',
1778 | 'News : minor cookie-related incident turns whole town to ashes; neighboring cities asked to chip in for reconstruction.',
1779 | 'News : is our media controlled by the cookie industry? This could very well be the case, says crackpot conspiracy theorist.',
1780 | '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.']),
1781 | 'News : all-cookie restaurant opening downtown. Dishes such as braised cookies, cookie thermidor, and for dessert : crepes.',
1782 | '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.'
1783 | ])
1784 | );
1785 | }
1786 |
1787 | if (list.length==0)
1788 | {
1789 | if (Game.cookiesEarned<5) list.push('You feel like making cookies. But nobody wants to eat your cookies.');
1790 | else if (Game.cookiesEarned<50) list.push('Your first batch goes to the trash. The neighborhood raccoon barely touches it.');
1791 | else if (Game.cookiesEarned<100) list.push('Your family accepts to try some of your cookies.');
1792 | else if (Game.cookiesEarned<500) list.push('Your cookies are popular in the neighborhood.');
1793 | else if (Game.cookiesEarned<1000) list.push('People are starting to talk about your cookies.');
1794 | else if (Game.cookiesEarned<3000) list.push('Your cookies are talked about for miles around.');
1795 | else if (Game.cookiesEarned<6000) list.push('Your cookies are renowned in the whole town!');
1796 | else if (Game.cookiesEarned<10000) list.push('Your cookies bring all the boys to the yard.');
1797 | else if (Game.cookiesEarned<20000) list.push('Your cookies now have their own website!');
1798 | else if (Game.cookiesEarned<30000) list.push('Your cookies are worth a lot of money.');
1799 | else if (Game.cookiesEarned<40000) list.push('Your cookies sell very well in distant countries.');
1800 | else if (Game.cookiesEarned<60000) list.push('People come from very far away to get a taste of your cookies.');
1801 | else if (Game.cookiesEarned<80000) list.push('Kings and queens from all over the world are enjoying your cookies.');
1802 | else if (Game.cookiesEarned<100000) list.push('There are now museums dedicated to your cookies.');
1803 | else if (Game.cookiesEarned<200000) list.push('A national day has been created in honor of your cookies.');
1804 | else if (Game.cookiesEarned<300000) list.push('Your cookies have been named a part of the world wonders.');
1805 | else if (Game.cookiesEarned<450000) list.push('History books now include a whole chapter about your cookies.');
1806 | else if (Game.cookiesEarned<600000) list.push('Your cookies have been placed under government surveillance.');
1807 | else if (Game.cookiesEarned<1000000) list.push('The whole planet is enjoying your cookies!');
1808 | else if (Game.cookiesEarned<5000000) list.push('Strange creatures from neighboring planets wish to try your cookies.');
1809 | else if (Game.cookiesEarned<10000000) list.push('Elder gods from the whole cosmos have awoken to taste your cookies.');
1810 | else if (Game.cookiesEarned<30000000) list.push('Beings from other dimensions lapse into existence just to get a taste of your cookies.');
1811 | else if (Game.cookiesEarned<100000000) list.push('Your cookies have achieved sentience.');
1812 | else if (Game.cookiesEarned<300000000) list.push('The universe has now turned into cookie dough, to the molecular level.');
1813 | else if (Game.cookiesEarned<1000000000) list.push('Your cookies are rewriting the fundamental laws of the universe.');
1814 | else if (Game.cookiesEarned<10000000000) list.push('A local news station runs a 10-minute segment about your cookies. Success! (you win a cookie)');
1815 | else if (Game.cookiesEarned<10100000000) list.push('it\'s time to stop playing');//only show this for 100 millions (it's funny for a moment)
1816 | }
1817 |
1818 | if (Game.elderWrath>0 && (Game.pledges==0 || Math.random()<0.5))
1819 | {
1820 | list=[];
1821 | if (Game.elderWrath==1) list.push(choose([
1822 | 'News : millions of old ladies reported missing!',
1823 | 'News : processions of old ladies sighted around cookie facilities!',
1824 | 'News : families around the continent report agitated, transfixed grandmothers!',
1825 | 'News : doctors swarmed by cases of old women with glassy eyes and a foamy mouth!',
1826 | 'News : nurses report "strange scent of cookie dough" around female elderly patients!'
1827 | ]));
1828 | if (Game.elderWrath==2) list.push(choose([
1829 | 'News : town in disarray as strange old ladies break into homes to abduct infants and baking utensils!',
1830 | 'News : sightings of old ladies with glowing eyes terrify local population!',
1831 | 'News : retirement homes report "female residents slowly congealing in their seats"!',
1832 | 'News : whole continent undergoing mass exodus of old ladies!',
1833 | 'News : old women freeze in place in streets, ooze warm sugary syrup!'
1834 | ]));
1835 | if (Game.elderWrath==3) list.push(choose([
1836 | 'News : large "flesh highways" scar continent, stretch between various cookie facilities!',
1837 | 'News : wrinkled "flesh tendrils" visible from space!',
1838 | 'News : remains of "old ladies" found frozen in the middle of growing fleshy structures!',
1839 | 'News : all hope lost as writhing mass of flesh and dough engulfs whole city!',
1840 | 'News : nightmare continues as wrinkled acres of flesh expand at alarming speeds!'
1841 | ]));
1842 | }
1843 |
1844 | Game.TickerAge=Game.fps*10;
1845 | Game.Ticker=choose(list);
1846 | Game.TickerN++;
1847 | }
1848 | Game.TickerDraw=function()
1849 | {
1850 | var str='';
1851 | var o=0;
1852 | if (Game.Ticker!='')
1853 | {
1854 | if (Game.TickerAgeadd 1,000 | add 1,000,000';
1865 | }
1866 |
1867 |
1868 | /*=====================================================================================
1869 | BUILDINGS
1870 | =======================================================================================*/
1871 | Game.storeToRebuild=1;
1872 | Game.priceIncrease=1.15;
1873 | Game.Objects=[];
1874 | Game.ObjectsById=[];
1875 | Game.ObjectsN=0;
1876 | Game.BuildingsOwned=0;
1877 | Game.Object=function(name,commonName,desc,pic,icon,background,price,cps,drawFunction,buyFunction)
1878 | {
1879 | this.id=Game.ObjectsN;
1880 | this.name=name;
1881 | this.displayName=this.name;
1882 | commonName=commonName.split('|');
1883 | this.single=commonName[0];
1884 | this.plural=commonName[1];
1885 | this.actionName=commonName[2];
1886 | this.desc=desc;
1887 | this.basePrice=price;
1888 | this.price=this.basePrice;
1889 | this.cps=cps;
1890 | this.totalCookies=0;
1891 | this.storedCps=0;
1892 | this.storedTotalCps=0;
1893 | this.pic=pic;
1894 | this.icon=icon;
1895 | this.background=background;
1896 | this.buyFunction=buyFunction;
1897 | this.drawFunction=drawFunction;
1898 |
1899 | this.special=null;//special is a function that should be triggered when the object's special is unlocked, or on load (if it's already unlocked). For example, creating a new dungeon.
1900 | this.onSpecial=0;//are we on this object's special screen (dungeons etc)?
1901 | this.specialUnlocked=0;
1902 | this.specialDrawFunction=null;
1903 | this.drawSpecialButton=null;
1904 |
1905 | this.amount=0;
1906 | this.bought=0;
1907 |
1908 | this.buy=function()
1909 | {
1910 | var price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
1911 | if (Game.cookies>=price)
1912 | {
1913 | Game.Spend(price);
1914 | this.amount++;
1915 | this.bought++;
1916 | price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
1917 | this.price=price;
1918 | if (this.buyFunction) this.buyFunction();
1919 | if (this.drawFunction) this.drawFunction();
1920 | Game.storeToRebuild=1;
1921 | Game.recalculateGains=1;
1922 | if (this.amount==1 && this.id!=0) l('row'+this.id).className='row enabled';
1923 | Game.BuildingsOwned++;
1924 | }
1925 | }
1926 | this.sell=function()
1927 | {
1928 | var price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
1929 | price=Math.floor(price*0.5);
1930 | if (this.amount>0)
1931 | {
1932 | //Game.Earn(price);
1933 | Game.cookies+=price;
1934 | this.amount--;
1935 | price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
1936 | this.price=price;
1937 | if (this.sellFunction) this.sellFunction();
1938 | if (this.drawFunction) this.drawFunction();
1939 | Game.storeToRebuild=1;
1940 | Game.recalculateGains=1;
1941 | Game.BuildingsOwned--;
1942 | }
1943 | }
1944 |
1945 | this.setSpecial=function(what)//change whether we're on the special overlay for this object or not
1946 | {
1947 | if (what==1) this.onSpecial=1;
1948 | else this.onSpecial=0;
1949 | if (this.id!=0)
1950 | {
1951 | if (this.onSpecial)
1952 | {
1953 | l('rowSpecial'+this.id).style.display='block';
1954 | if (this.specialDrawFunction) this.specialDrawFunction();
1955 | }
1956 | else
1957 | {
1958 | l('rowSpecial'+this.id).style.display='none';
1959 | if (this.drawFunction) this.drawFunction();
1960 | }
1961 | }
1962 | }
1963 | this.unlockSpecial=function()
1964 | {
1965 | if (this.specialUnlocked==0)
1966 | {
1967 | this.specialUnlocked=1;
1968 | this.setSpecial(0);
1969 | if (this.special) this.special();
1970 | this.refresh();
1971 | }
1972 | }
1973 |
1974 | this.refresh=function()
1975 | {
1976 | this.price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
1977 | if (this.amount==0 && this.id!=0) l('row'+this.id).className='row';
1978 | else if (this.amount>0 && this.id!=0) l('row'+this.id).className='row enabled';
1979 | if (this.drawFunction && !this.onSpecial) this.drawFunction();
1980 | //else if (this.specialDrawFunction && this.onSpecial) this.specialDrawFunction();
1981 | }
1982 |
1983 | if (this.id!=0)//draw it
1984 | {
1985 | var str='
';
1986 | l('rows').innerHTML=l('rows').innerHTML+str;
1987 | }
1988 |
1989 | Game.Objects[this.name]=this;
1990 | Game.ObjectsById[this.id]=this;
1991 | Game.ObjectsN++;
1992 | return this;
1993 | }
1994 |
1995 | Game.NewDrawFunction=function(pic,xVariance,yVariance,w,shift,heightOffset)
1996 | {
1997 | //pic : either 0 (the default picture will be used), a filename (will be used as override), or a function to determine a filename
1998 | //xVariance : the pictures will have a random horizontal shift by this many pixels
1999 | //yVariance : the pictures will have a random vertical shift by this many pixels
2000 | //w : how many pixels between each picture (or row of pictures)
2001 | //shift : if >1, arrange the pictures in rows containing this many pictures
2002 | //heightOffset : the pictures will be displayed at this height, +32 pixels
2003 | return function()
2004 | {
2005 | if (pic==0 && typeof(pic)!='function') pic=this.pic;
2006 | shift=shift || 1;
2007 | heightOffset=heightOffset || 0;
2008 | var bgW=0;
2009 | var str='';
2010 | var offX=0;
2011 | var offY=0;
2012 |
2013 | if (this.drawSpecialButton && this.specialUnlocked)
2014 | {
2015 | l('rowSpecialButton'+this.id).style.display='block';
2016 | l('rowSpecialButton'+this.id).innerHTML=this.drawSpecialButton();
2017 | str+='
'+this.drawSpecialButton()+'
';
2018 | l('rowInfo'+this.id).style.paddingLeft=(8+128)+'px';
2019 | offX+=128;
2020 | }
2021 |
2022 | for (var i=0;i';
2036 | bgW=Math.max(bgW,x+64);
2037 | }
2038 | bgW+=offX;
2039 | l('rowObjects'+this.id).innerHTML=str;
2040 | l('rowBackground'+this.id).style.width=bgW+'px';
2041 | }
2042 | }
2043 |
2044 | Game.RebuildStore=function()//redraw the store from scratch
2045 | {
2046 | var str='';
2047 | for (var i in Game.Objects)
2048 | {
2049 | var me=Game.Objects[i];
2050 | str+='
';
2104 | },function(){
2105 | if (this.amount>=1) Game.Unlock(['Reinforced index finger','Carpal tunnel prevention cream']);
2106 | if (this.amount>=10) Game.Unlock('Ambidextrous');
2107 | if (this.amount>=20) Game.Unlock('Thousand fingers');
2108 | if (this.amount>=40) Game.Unlock('Million fingers');
2109 | if (this.amount>=80) Game.Unlock('Billion fingers');
2110 | if (this.amount>=120) Game.Unlock('Trillion fingers');
2111 | if (this.amount>=160) Game.Unlock('Quadrillion fingers');
2112 | if (this.amount>=200) Game.Unlock('Quintillion fingers');
2113 |
2114 | if (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');
2115 | });
2116 |
2117 | Game.SpecialGrandmaUnlock=15;
2118 | new Game.Object('Grandma','grandma|grandmas|baked','A nice grandma to bake more cookies.','grandma','grandmaIcon','grandmaBackground',100,function(){
2119 | var mult=0;
2120 | if (Game.Has('Farmer grandmas')) mult++;
2121 | if (Game.Has('Worker grandmas')) mult++;
2122 | if (Game.Has('Miner grandmas')) mult++;
2123 | if (Game.Has('Cosmic grandmas')) mult++;
2124 | if (Game.Has('Transmuted grandmas')) mult++;
2125 | if (Game.Has('Altered grandmas')) mult++;
2126 | if (Game.Has('Grandmas\' grandmas')) mult++;
2127 | if (Game.Has('Antigrandmas')) mult++;
2128 | if (Game.Has('Bingo center/Research facility')) mult+=2;
2129 | if (Game.Has('Ritual rolling pins')) mult++;
2130 | var add=0;
2131 | if (Game.Has('One mind')) add+=Game.Objects['Grandma'].amount*0.02;
2132 | if (Game.Has('Communal brainsweep')) add+=Game.Objects['Grandma'].amount*0.02;
2133 | if (Game.Has('Elder Pact')) add+=Game.Objects['Portal'].amount*0.05;
2134 | return Game.ComputeCps(0.5,Game.Has('Forwards from grandma')*0.3+add,Game.Has('Steel-plated rolling pins')+Game.Has('Lubricated dentures')+Game.Has('Prune juice')+mult);
2135 | },Game.NewDrawFunction(function(){
2136 | var list=['grandma'];
2137 | if (Game.Has('Farmer grandmas')) list.push('farmerGrandma');
2138 | if (Game.Has('Worker grandmas')) list.push('workerGrandma');
2139 | if (Game.Has('Miner grandmas')) list.push('minerGrandma');
2140 | if (Game.Has('Cosmic grandmas')) list.push('cosmicGrandma');
2141 | if (Game.Has('Transmuted grandmas')) list.push('transmutedGrandma');
2142 | if (Game.Has('Altered grandmas')) list.push('alteredGrandma');
2143 | if (Game.Has('Grandmas\' grandmas')) list.push('grandmasGrandma');
2144 | if (Game.Has('Antigrandmas')) list.push('antiGrandma');
2145 | return choose(list);
2146 | },8,8,32,3,16),function(){
2147 | if (this.amount>=1) Game.Unlock(['Forwards from grandma','Steel-plated rolling pins']);if (this.amount>=10) Game.Unlock('Lubricated dentures');if (this.amount>=50) Game.Unlock('Prune juice');
2148 | if (this.amount>=1) Game.Win('Grandma\'s cookies');if (this.amount>=50) Game.Win('Sloppy kisses');if (this.amount>=100) Game.Win('Retirement home');
2149 | });
2150 | Game.Objects['Grandma'].sellFunction=function()
2151 | {
2152 | Game.Win('Just wrong');
2153 | if (this.amount==0)
2154 | {
2155 | Game.Lock('Elder Pledge');
2156 | Game.pledgeT=0;
2157 | }
2158 | };
2159 |
2160 | new Game.Object('Farm','farm|farms|harvested','Grows cookie plants from cookie seeds.','farm','farmIcon','farmBackground',500,function(){
2161 | return Game.ComputeCps(2,Game.Has('Cheap hoes')*0.5,Game.Has('Fertilizer')+Game.Has('Cookie trees')+Game.Has('Genetically-modified cookies'));
2162 | },Game.NewDrawFunction(0,16,16,64,2,32),function(){
2163 | if (this.amount>=1) Game.Unlock(['Cheap hoes','Fertilizer']);if (this.amount>=10) Game.Unlock('Cookie trees');if (this.amount>=50) Game.Unlock('Genetically-modified cookies');
2164 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Farmer grandmas');
2165 | if (this.amount>=1) Game.Win('My first farm');if (this.amount>=50) Game.Win('Reap what you sow');if (this.amount>=100) Game.Win('Farm ill');
2166 | });
2167 |
2168 | new Game.Object('Factory','factory|factories|mass-produced','Produces large quantities of cookies.','factory','factoryIcon','factoryBackground',3000,function(){
2169 | return Game.ComputeCps(10,Game.Has('Sturdier conveyor belts')*4,Game.Has('Child labor')+Game.Has('Sweatshop')+Game.Has('Radium reactors'));
2170 | },Game.NewDrawFunction(0,32,2,64,1,-22),function(){
2171 | if (this.amount>=1) Game.Unlock(['Sturdier conveyor belts','Child labor']);if (this.amount>=10) Game.Unlock('Sweatshop');if (this.amount>=50) Game.Unlock('Radium reactors');
2172 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Worker grandmas');
2173 | if (this.amount>=1) Game.Win('Production chain');if (this.amount>=50) Game.Win('Industrial revolution');if (this.amount>=100) Game.Win('Global warming');
2174 | });
2175 |
2176 | new Game.Object('Mine','mine|mines|mined','Mines out cookie dough and chocolate chips.','mine','mineIcon','mineBackground',10000,function(){
2177 | return Game.ComputeCps(40,Game.Has('Sugar gas')*10,Game.Has('Megadrill')+Game.Has('Ultradrill')+Game.Has('Ultimadrill'));
2178 | },Game.NewDrawFunction(0,16,16,64,2,24),function(){
2179 | if (this.amount>=1) Game.Unlock(['Sugar gas','Megadrill']);if (this.amount>=10) Game.Unlock('Ultradrill');if (this.amount>=50) Game.Unlock('Ultimadrill');
2180 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Miner grandmas');
2181 | if (this.amount>=1) Game.Win('You know the drill');if (this.amount>=50) Game.Win('Excavation site');if (this.amount>=100) Game.Win('Hollow the planet');
2182 | });
2183 |
2184 | new Game.Object('Shipment','shipment|shipments|shipped','Brings in fresh cookies from the cookie planet.','shipment','shipmentIcon','shipmentBackground',40000,function(){
2185 | return Game.ComputeCps(100,Game.Has('Vanilla nebulae')*30,Game.Has('Wormholes')+Game.Has('Frequent flyer')+Game.Has('Warp drive'));
2186 | },Game.NewDrawFunction(0,16,16,64),function(){
2187 | if (this.amount>=1) Game.Unlock(['Vanilla nebulae','Wormholes']);if (this.amount>=10) Game.Unlock('Frequent flyer');if (this.amount>=50) Game.Unlock('Warp drive');
2188 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Cosmic grandmas');
2189 | if (this.amount>=1) Game.Win('Expedition');if (this.amount>=50) Game.Win('Galactic highway');if (this.amount>=100) Game.Win('Far far away');
2190 | });
2191 |
2192 | new Game.Object('Alchemy lab','alchemy lab|alchemy labs|transmuted','Turns gold into cookies!','alchemylab','alchemylabIcon','alchemylabBackground',200000,function(){
2193 | return Game.ComputeCps(400,Game.Has('Antimony')*100,Game.Has('Essence of dough')+Game.Has('True chocolate')+Game.Has('Ambrosia'));
2194 | },Game.NewDrawFunction(0,16,16,64,2,16),function(){
2195 | if (this.amount>=1) Game.Unlock(['Antimony','Essence of dough']);if (this.amount>=10) Game.Unlock('True chocolate');if (this.amount>=50) Game.Unlock('Ambrosia');
2196 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Transmuted grandmas');
2197 | if (this.amount>=1) Game.Win('Transmutation');if (this.amount>=50) Game.Win('Transmogrification');if (this.amount>=100) Game.Win('Gold member');
2198 | });
2199 |
2200 | new Game.Object('Portal','portal|portals|retrieved','Opens a door to the Cookieverse.','portal','portalIcon','portalBackground',1666666,function(){
2201 | return Game.ComputeCps(6666,Game.Has('Ancient tablet')*1666,Game.Has('Insane oatling workers')+Game.Has('Soul bond')+Game.Has('Sanity dance'));
2202 | },Game.NewDrawFunction(0,32,32,64,2),function(){
2203 | if (this.amount>=1) Game.Unlock(['Ancient tablet','Insane oatling workers']);if (this.amount>=10) Game.Unlock('Soul bond');if (this.amount>=50) Game.Unlock('Sanity dance');
2204 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Altered grandmas');
2205 | if (this.amount>=1) Game.Win('A whole new world');if (this.amount>=50) Game.Win('Now you\'re thinking');if (this.amount>=100) Game.Win('Dimensional shift');
2206 | });
2207 | new Game.Object('Time machine','time machine|time machines|recovered','Brings cookies from the past, before they were even eaten.','timemachine','timemachineIcon','timemachineBackground',123456789,function(){
2208 | return Game.ComputeCps(98765,Game.Has('Flux capacitors')*9876,Game.Has('Time paradox resolver')+Game.Has('Quantum conundrum')+Game.Has('Causality enforcer'));
2209 | },Game.NewDrawFunction(0,32,32,64,1),function(){
2210 | if (this.amount>=1) Game.Unlock(['Flux capacitors','Time paradox resolver']);if (this.amount>=10) Game.Unlock('Quantum conundrum');if (this.amount>=50) Game.Unlock('Causality enforcer');
2211 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Grandmas\' grandmas');
2212 | if (this.amount>=1) Game.Win('Time warp');if (this.amount>=50) Game.Win('Alternate timeline');if (this.amount>=100) Game.Win('Rewriting history');
2213 | });
2214 | new Game.Object('Antimatter condenser','antimatter condenser|antimatter condensers|condensed','Condenses the antimatter in the universe into cookies.','antimattercondenser','antimattercondenserIcon','antimattercondenserBackground',3999999999,function(){
2215 | return Game.ComputeCps(999999,Game.Has('Sugar bosons')*99999,Game.Has('String theory')+Game.Has('Large macaron collider')+Game.Has('Big bang bake'));
2216 | },Game.NewDrawFunction(0,0,64,64,1),function(){
2217 | if (this.amount>=1) Game.Unlock(['Sugar bosons','String theory']);if (this.amount>=10) Game.Unlock('Large macaron collider');if (this.amount>=50) Game.Unlock('Big bang bake');
2218 | if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Antigrandmas');
2219 | if (this.amount>=1) Game.Win('Antibatter');if (this.amount>=50) Game.Win('Quirky quarks');if (this.amount>=100) Game.Win('It does matter!');
2220 | });
2221 | Game.Objects['Antimatter condenser'].displayName='Antimatter condenser';//shrink the name since it's so large
2222 |
2223 | /*=====================================================================================
2224 | UPGRADES
2225 | =======================================================================================*/
2226 | Game.upgradesToRebuild=1;
2227 | Game.Upgrades=[];
2228 | Game.UpgradesById=[];
2229 | Game.UpgradesN=0;
2230 | Game.UpgradesInStore=[];
2231 | Game.UpgradesOwned=0;
2232 | Game.Upgrade=function(name,desc,price,icon,buyFunction)
2233 | {
2234 | this.id=Game.UpgradesN;
2235 | this.name=name;
2236 | this.desc=desc;
2237 | this.basePrice=price;
2238 | this.icon=icon;
2239 | this.buyFunction=buyFunction;
2240 | /*this.unlockFunction=unlockFunction;
2241 | this.unlocked=(this.unlockFunction?0:1);*/
2242 | this.unlocked=0;
2243 | this.bought=0;
2244 | this.hide=0;//0=show, 3=hide (1-2 : I have no idea)
2245 | this.order=this.id;
2246 | if (order) this.order=order+this.id*0.001;
2247 | this.type='';
2248 | if (type) this.type=type;
2249 | this.power=0;
2250 | if (power) this.power=power;
2251 |
2252 | this.buy=function()
2253 | {
2254 | var cancelPurchase=0;
2255 | if (this.clickFunction) cancelPurchase=!this.clickFunction();
2256 | if (!cancelPurchase)
2257 | {
2258 | var price=this.basePrice;
2259 | if (Game.cookies>=price && !this.bought)
2260 | {
2261 | Game.Spend(price);
2262 | this.bought=1;
2263 | if (this.buyFunction) this.buyFunction();
2264 | Game.upgradesToRebuild=1;
2265 | Game.recalculateGains=1;
2266 | Game.UpgradesOwned++;
2267 | }
2268 | }
2269 | }
2270 |
2271 | this.toggle=function()//cheating only
2272 | {
2273 | if (!this.bought)
2274 | {
2275 | this.bought=1;
2276 | if (this.buyFunction) this.buyFunction();
2277 | Game.upgradesToRebuild=1;
2278 | Game.recalculateGains=1;
2279 | Game.UpgradesOwned++;
2280 | }
2281 | else
2282 | {
2283 | this.bought=0;
2284 | Game.upgradesToRebuild=1;
2285 | Game.recalculateGains=1;
2286 | Game.UpgradesOwned--;
2287 | }
2288 | Game.UpdateMenu();
2289 | }
2290 |
2291 | Game.Upgrades[this.name]=this;
2292 | Game.UpgradesById[this.id]=this;
2293 | Game.UpgradesN++;
2294 | return this;
2295 | }
2296 |
2297 | Game.Unlock=function(what)
2298 | {
2299 | if (typeof what==='string')
2300 | {
2301 | if (Game.Upgrades[what])
2302 | {
2303 | if (Game.Upgrades[what].unlocked==0)
2304 | {
2305 | Game.Upgrades[what].unlocked=1;
2306 | Game.upgradesToRebuild=1;
2307 | Game.recalculateGains=1;
2308 | }
2309 | }
2310 | }
2311 | else {for (var i in what) {Game.Unlock(what[i]);}}
2312 | }
2313 | Game.Lock=function(what)
2314 | {
2315 | if (typeof what==='string')
2316 | {
2317 | if (Game.Upgrades[what])
2318 | {
2319 | Game.Upgrades[what].unlocked=0;
2320 | Game.Upgrades[what].bought=0;
2321 | Game.upgradesToRebuild=1;
2322 | if (Game.Upgrades[what].bought==1)
2323 | {
2324 | Game.UpgradesOwned--;
2325 | }
2326 | Game.recalculateGains=1;
2327 | }
2328 | }
2329 | else {for (var i in what) {Game.Lock(what[i]);}}
2330 | }
2331 |
2332 | Game.Has=function(what)
2333 | {
2334 | return (Game.Upgrades[what]?Game.Upgrades[what].bought:0);
2335 | }
2336 |
2337 | Game.RebuildUpgrades=function()//recalculate the upgrades you can buy
2338 | {
2339 | Game.upgradesToRebuild=0;
2340 | var list=[];
2341 | for (var i in Game.Upgrades)
2342 | {
2343 | var me=Game.Upgrades[i];
2344 | if (!me.bought)
2345 | {
2346 | if (me.unlocked) list.push(me);
2347 | }
2348 | }
2349 |
2350 | var sortMap=function(a,b)
2351 | {
2352 | if (a.basePrice>b.basePrice) return 1;
2353 | else if (a.basePrice'+me.name+''+me.desc
2370 | '
'+Beautify(Math.round(me.basePrice))+'
[Upgrade]
'+me.name+'
'+me.desc+'
'
2371 | ,0,16,'bottom-right')+' onclick="Game.UpgradesById['+me.id+'].buy();" id="upgrade'+i+'" style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">';
2372 | }
2373 | l('upgrades').innerHTML=str;
2374 | }
2375 |
2376 | var tier1=10;
2377 | var tier2=100;
2378 | var tier3=1000;
2379 | var tier4=10000;
2380 |
2381 | var type='';
2382 | var power=0;
2383 |
2384 | //define upgrades
2385 | //WARNING : do NOT add new upgrades in between, this breaks the saves. Add them at the end !
2386 | var order=100;//this is used to set the order in which the items are listed
2387 | new Game.Upgrade('Reinforced index finger','The mouse gains +1 cookie per click. Cursors gain +0.1 base CpS.prod prod',100,[0,0]);
2388 | new Game.Upgrade('Carpal tunnel prevention cream','The mouse and cursors are twice as efficient.',400,[0,0]);
2389 | new Game.Upgrade('Ambidextrous','The mouse and cursors are twice as efficient.Look ma, both hands!',10000,[0,6]);
2390 | new Game.Upgrade('Thousand fingers','The mouse and cursors gain +0.1 cookies for each non-cursor object owned.clickity',500000,[0,6]);
2391 | new Game.Upgrade('Million fingers','The mouse and cursors gain +0.5 cookies for each non-cursor object owned.clickityclickity',50000000,[1,6]);
2392 | new Game.Upgrade('Billion fingers','The mouse and cursors gain +2 cookies for each non-cursor object owned.clickityclickityclickity',500000000,[2,6]);
2393 | new Game.Upgrade('Trillion fingers','The mouse and cursors gain +10 cookies for each non-cursor object owned.clickityclickityclickityclickity',5000000000,[3,6]);
2394 |
2395 | order=200;
2396 | new Game.Upgrade('Forwards from grandma','Grandmas gain +0.3 base CpS.RE:RE:thought you\'d get a kick out of this ;))',Game.Objects['Grandma'].basePrice*tier1,[1,0]);
2397 | new Game.Upgrade('Steel-plated rolling pins','Grandmas are twice as efficient.',Game.Objects['Grandma'].basePrice*tier2,[1,0]);
2398 | new Game.Upgrade('Lubricated dentures','Grandmas are twice as efficient.Squish',Game.Objects['Grandma'].basePrice*tier3,[1,1]);
2399 |
2400 | order=300;
2401 | new Game.Upgrade('Cheap hoes','Farms gain +0.5 base CpS.',Game.Objects['Farm'].basePrice*tier1,[2,0]);
2402 | new Game.Upgrade('Fertilizer','Farms are twice as efficient.It\'s chocolate, I swear.',Game.Objects['Farm'].basePrice*tier2,[2,0]);
2403 | new Game.Upgrade('Cookie trees','Farms are twice as efficient.A relative of the breadfruit.',Game.Objects['Farm'].basePrice*tier3,[2,1]);
2404 |
2405 | order=400;
2406 | new Game.Upgrade('Sturdier conveyor belts','Factories gain +4 base CpS.',Game.Objects['Factory'].basePrice*tier1,[4,0]);
2407 | new Game.Upgrade('Child labor','Factories are twice as efficient.Cheaper, healthier workforce - and so much more receptive to whipping!',Game.Objects['Factory'].basePrice*tier2,[4,0]);
2408 | new Game.Upgrade('Sweatshop','Factories are twice as efficient.Slackers will be terminated.',Game.Objects['Factory'].basePrice*tier3,[4,1]);
2409 |
2410 | order=500;
2411 | new Game.Upgrade('Sugar gas','Mines gain +10 base CpS.A pink, volatile gas, found in the depths of some chocolate caves.',Game.Objects['Mine'].basePrice*tier1,[3,0]);
2412 | new Game.Upgrade('Megadrill','Mines are twice as efficient.',Game.Objects['Mine'].basePrice*tier2,[3,0]);
2413 | new Game.Upgrade('Ultradrill','Mines are twice as efficient.',Game.Objects['Mine'].basePrice*tier3,[3,1]);
2414 |
2415 | order=600;
2416 | new Game.Upgrade('Vanilla nebulae','Shipments gain +30 base CpS.',Game.Objects['Shipment'].basePrice*tier1,[5,0]);
2417 | new Game.Upgrade('Wormholes','Shipments are twice as efficient.By using these as shortcuts, your ships can travel much faster.',Game.Objects['Shipment'].basePrice*tier2,[5,0]);
2418 | new Game.Upgrade('Frequent flyer','Shipments are twice as efficient.Come back soon!',Game.Objects['Shipment'].basePrice*tier3,[5,1]);
2419 |
2420 | order=700;
2421 | new Game.Upgrade('Antimony','Alchemy labs gain +100 base CpS.Actually worth a lot of mony.',Game.Objects['Alchemy lab'].basePrice*tier1,[6,0]);
2422 | new Game.Upgrade('Essence of dough','Alchemy labs are twice as efficient.Extracted through the 5 ancient steps of alchemical baking.',Game.Objects['Alchemy lab'].basePrice*tier2,[6,0]);
2423 | new Game.Upgrade('True chocolate','Alchemy labs are twice as efficient.The purest form of cacao.',Game.Objects['Alchemy lab'].basePrice*tier3,[6,1]);
2424 |
2425 | order=800;
2426 | new Game.Upgrade('Ancient tablet','Portals gain +1,666 base CpS.A strange slab of peanut brittle, holding an ancient cookie recipe. Neat!',Game.Objects['Portal'].basePrice*tier1,[7,0]);
2427 | new Game.Upgrade('Insane oatling workers','Portals are twice as efficient.ARISE, MY MINIONS!',Game.Objects['Portal'].basePrice*tier2,[7,0]);
2428 | new Game.Upgrade('Soul bond','Portals are twice as efficient.So I just sign up and get more cookies? Sure, whatever!',Game.Objects['Portal'].basePrice*tier3,[7,1]);
2429 |
2430 | order=900;
2431 | new Game.Upgrade('Flux capacitors','Time machines gain +9,876 base CpS.Bake to the future.',1234567890,[8,0]);
2432 | new Game.Upgrade('Time paradox resolver','Time machines are twice as efficient.No more fooling around with your own grandmother!',9876543210,[8,0]);
2433 | new Game.Upgrade('Quantum conundrum','Time machines are twice as efficient.It\'s full of stars!',98765456789,[8,1]);
2434 |
2435 | order=20000;
2436 | new Game.Upgrade('Kitten helpers','You gain more CpS the more milk you have.meow may I help you',9000000,[1,7]);
2437 | new Game.Upgrade('Kitten workers','You gain more CpS the more milk you have.meow meow meow meow',9000000000,[2,7]);
2438 |
2439 | order=10000;
2440 | type='cookie';power=5;
2441 | new Game.Upgrade('Oatmeal raisin cookies','Cookie production multiplier +5%.No raisin to hate these.',99999999,[0,3]);
2442 | new Game.Upgrade('Peanut butter cookies','Cookie production multiplier +5%.',99999999,[1,3]);
2443 | new Game.Upgrade('Plain cookies','Cookie production multiplier +5%.Meh.',99999999,[2,3]);
2444 | new Game.Upgrade('Coconut cookies','Cookie production multiplier +5%.',999999999,[3,3]);
2445 | new Game.Upgrade('White chocolate cookies','Cookie production multiplier +5%.',999999999,[4,3]);
2446 | new Game.Upgrade('Macadamia nut cookies','Cookie production multiplier +5%.',999999999,[5,3]);
2447 | power=10;new Game.Upgrade('Double-chip cookies','Cookie production multiplier +10%.',99999999999,[6,3]);
2448 | power=5;new Game.Upgrade('Sugar cookies','Cookie production multiplier +5%.',99999999,[7,3]);
2449 | power=10;new Game.Upgrade('White chocolate macadamia nut cookies','Cookie production multiplier +10%.',99999999999,[8,3]);
2450 | new Game.Upgrade('All-chocolate cookies','Cookie production multiplier +10%.',99999999999,[9,3]);
2451 | type='';power=0;
2452 |
2453 | order=100;
2454 | new Game.Upgrade('Quadrillion fingers','The mouse and cursors gain +20 cookies for each non-cursor object owned.clickityclickityclickityclickityclick',50000000000,[3,6]);
2455 |
2456 | order=200;new Game.Upgrade('Prune juice','Grandmas are twice as efficient.Gets me going.',Game.Objects['Grandma'].basePrice*tier4,[1,2]);
2457 | order=300;new Game.Upgrade('Genetically-modified cookies','Farms are twice as efficient.All-natural mutations.',Game.Objects['Farm'].basePrice*tier4,[2,2]);
2458 | order=400;new Game.Upgrade('Radium reactors','Factories are twice as efficient.Gives your cookies a healthy glow.',Game.Objects['Factory'].basePrice*tier4,[4,2]);
2459 | order=500;new Game.Upgrade('Ultimadrill','Mines are twice as efficient.Pierce the heavens, etc.',Game.Objects['Mine'].basePrice*tier4,[3,2]);
2460 | order=600;new Game.Upgrade('Warp drive','Shipments are twice as efficient.',Game.Objects['Shipment'].basePrice*tier4,[5,2]);
2461 | order=700;new Game.Upgrade('Ambrosia','Alchemy labs are twice as efficient.',Game.Objects['Alchemy lab'].basePrice*tier4,[6,2]);
2462 | order=800;new Game.Upgrade('Sanity dance','Portals are twice as efficient.We can change if we want to. We can leave our brains behind.',Game.Objects['Portal'].basePrice*tier4,[7,2]);
2463 | order=900;new Game.Upgrade('Causality enforcer','Time machines are twice as efficient.What happened, happened.',1234567890000,[8,2]);
2464 |
2465 | order=5000;
2466 | new Game.Upgrade('Lucky day','Golden cookies appear twice as often and last twice as long.',777777777,[10,1]);
2467 | new Game.Upgrade('Serendipity','Golden cookies appear twice as often and last twice as long.',77777777777,[10,1]);
2468 |
2469 | order=20000;
2470 | new Game.Upgrade('Kitten engineers','You gain more CpS the more milk you have.meow meow meow meow, sir',9000000000000,[3,7]);
2471 |
2472 | order=10000;
2473 | type='cookie';power=15;
2474 | new Game.Upgrade('Dark chocolate-coated cookies','Cookie production multiplier +15%.',999999999999,[10,3]);
2475 | new Game.Upgrade('White chocolate-coated cookies','Cookie production multiplier +15%.',999999999999,[11,3]);
2476 | type='';power=0;
2477 |
2478 | order=250;
2479 | new Game.Upgrade('Farmer grandmas','Grandmas are twice as efficient.',Game.Objects['Farm'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2480 | new Game.Upgrade('Worker grandmas','Grandmas are twice as efficient.',Game.Objects['Factory'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2481 | new Game.Upgrade('Miner grandmas','Grandmas are twice as efficient.',Game.Objects['Mine'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2482 | new Game.Upgrade('Cosmic grandmas','Grandmas are twice as efficient.',Game.Objects['Shipment'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2483 | new Game.Upgrade('Transmuted grandmas','Grandmas are twice as efficient.',Game.Objects['Alchemy lab'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2484 | new Game.Upgrade('Altered grandmas','Grandmas are twice as efficient.',Game.Objects['Portal'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2485 | new Game.Upgrade('Grandmas\' grandmas','Grandmas are twice as efficient.',Game.Objects['Time machine'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2486 |
2487 | order=15000;
2488 | Game.baseResearchTime=Game.fps*60*30;
2489 | Game.SetResearch=function(what,time)
2490 | {
2491 | if (Game.Upgrades[what])
2492 | {
2493 | Game.researchT=Game.Has('Ultrascience')?Game.fps*5:Game.baseResearchTime;
2494 | Game.nextResearch=Game.Upgrades[what].id;
2495 | Game.Popup('Research has begun.');
2496 | }
2497 | }
2498 |
2499 | new Game.Upgrade('Bingo center/Research facility','Grandma-operated science lab and leisure club. Grandmas are 4 times as efficient. Regularly unlocks new upgrades.',100000000000,[11,9],function(){Game.SetResearch('Specialized chocolate chips');});
2500 | new Game.Upgrade('Specialized chocolate chips','[Research] Cookie production multiplier +1%.Computer-designed chocolate chips. Computer chips, if you will.',10000000000,[0,9],function(){Game.SetResearch('Designer cocoa beans');});
2501 | new Game.Upgrade('Designer cocoa beans','[Research] Cookie production multiplier +2%.Now more aerodynamic than ever!',20000000000,[1,9],function(){Game.SetResearch('Ritual rolling pins');});
2502 | new Game.Upgrade('Ritual rolling pins','[Research] Grandmas are twice as efficient.The result of years of scientific research!',40000000000,[2,9],function(){Game.SetResearch('Underworld ovens');});
2503 | new Game.Upgrade('Underworld ovens','[Research] Cookie production multiplier +3%.Powered by science, of course!',80000000000,[3,9],function(){Game.SetResearch('One mind');});
2504 | new Game.Upgrade('One mind','[Research] Each grandma gains +1 base CpS for each 50 grandmas.
Note : the grandmothers are growing restless. Do not encourage them.
We are one. We are many.',160000000000,[4,9],function(){Game.elderWrath=1;Game.SetResearch('Exotic nuts');});
2505 | Game.Upgrades['One mind'].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?');};
2506 | new Game.Upgrade('Exotic nuts','[Research] Cookie production multiplier +4%.You\'ll go crazy over these!',320000000000,[5,9],function(){Game.SetResearch('Communal brainsweep');});
2507 | new Game.Upgrade('Communal brainsweep','[Research] Each grandma gains another +1 base CpS for each 50 grandmas.
Note : proceeding any further in scientific research may have unexpected results. You have been warned.
We fuse. We merge. We grow.',640000000000,[6,9],function(){Game.elderWrath=2;Game.SetResearch('Arcane sugar');});
2508 | new Game.Upgrade('Arcane sugar','[Research] Cookie production multiplier +5%.Tastes like insects, ligaments, and molasses.',1280000000000,[7,9],function(){Game.SetResearch('Elder Pact');});
2509 | new Game.Upgrade('Elder Pact','[Research] Each grandma gains +1 base CpS for each 20 portals.
Note : this is a bad idea.
squirm crawl slither writhe today we rise',2560000000000,[8,9],function(){Game.elderWrath=3;});
2510 | new Game.Upgrade('Elder Pledge','[Repeatable] Contains the wrath of the elders, at least for a while.',1,[9,9],function()
2511 | {
2512 | Game.elderWrath=0;
2513 | Game.pledges++;
2514 | Game.pledgeT=Game.fps*60*(Game.Has('Sacrificial rolling pins')?60:30);
2515 | Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,13));
2516 | Game.Unlock('Elder Covenant');
2517 | });
2518 | Game.Upgrades['Elder Pledge'].hide=3;
2519 |
2520 | order=150;
2521 | new Game.Upgrade('Plastic mouse','Clicking gains +1% of your CpS.',50000,[11,0]);
2522 | new Game.Upgrade('Iron mouse','Clicking gains +1% of your CpS.',5000000,[11,0]);
2523 | new Game.Upgrade('Titanium mouse','Clicking gains +1% of your CpS.',500000000,[11,1]);
2524 | new Game.Upgrade('Adamantium mouse','Clicking gains +1% of your CpS.',50000000000,[11,2]);
2525 |
2526 | order=40000;
2527 | new Game.Upgrade('Ultrascience','Research takes only 5 seconds.',7,[9,2]);//debug purposes only
2528 | Game.Upgrades['Ultrascience'].hide=3;
2529 |
2530 | order=10000;
2531 | type='cookie';power=15;
2532 | new Game.Upgrade('Eclipse cookies','Cookie production multiplier +15%.Look to the cookie.',9999999999999,[0,4]);
2533 | new Game.Upgrade('Zebra cookies','Cookie production multiplier +15%.',9999999999999,[1,4]);
2534 | type='';power=0;
2535 |
2536 | order=100;
2537 | new Game.Upgrade('Quintillion fingers','The mouse and cursors gain +100 cookies for each non-cursor object owned.man, just go click click click click click, it\'s real easy, man.',50000000000000,[3,6]);
2538 |
2539 | order=40000;
2540 | new Game.Upgrade('Gold hoard','Golden cookies appear really often.',7,[10,1]);//debug purposes only
2541 | Game.Upgrades['Gold hoard'].hide=3;
2542 |
2543 | order=15000;
2544 | new Game.Upgrade('Elder Covenant','[Switch] Puts a permanent end to the elders\' wrath, at the price of 5% of your CpS.',6666666666666,[8,9],function()
2545 | {
2546 | Game.pledgeT=0;
2547 | Game.Lock('Revoke Elder Covenant');
2548 | Game.Unlock('Revoke Elder Covenant');
2549 | Game.Lock('Elder Pledge');
2550 | Game.Win('Elder calm');
2551 | });
2552 | Game.Upgrades['Elder Covenant'].hide=3;
2553 |
2554 | new Game.Upgrade('Revoke Elder Covenant','[Switch] You will get 5% of your CpS back, but the grandmatriarchs will return.',6666666666,[8,9],function()
2555 | {
2556 | Game.Lock('Elder Covenant');
2557 | Game.Unlock('Elder Covenant');
2558 | });
2559 | Game.Upgrades['Revoke Elder Covenant'].hide=3;
2560 |
2561 | order=5000;
2562 | new Game.Upgrade('Get lucky','Golden cookie effects last twice as long.You\'ve been up all night, haven\'t you?',77777777777777,[10,1]);
2563 |
2564 | order=15000;
2565 | new Game.Upgrade('Sacrificial rolling pins','Elder pledge last twice as long.',2888888888888,[2,9]);
2566 |
2567 | order=10000;
2568 | type='cookie';power=15;
2569 | new Game.Upgrade('Snickerdoodles','Cookie production multiplier +15%.',99999999999999,[2,4]);
2570 | new Game.Upgrade('Stroopwafels','Cookie production multiplier +15%.If it ain\'t dutch, it ain\'t much.',99999999999999,[3,4]);
2571 | new Game.Upgrade('Macaroons','Cookie production multiplier +15%.',99999999999999,[4,4]);
2572 | type='';power=0;
2573 |
2574 | order=40000;
2575 | new Game.Upgrade('Neuromancy','Can toggle upgrades on and off at will in the stats menu.',7,[4,9]);//debug purposes only
2576 | Game.Upgrades['Neuromancy'].hide=3;
2577 |
2578 | order=10000;
2579 | type='cookie';power=15;
2580 | new Game.Upgrade('Empire biscuits','Cookie production multiplier +15%.',99999999999999,[5,4]);
2581 | new Game.Upgrade('British tea biscuits','Cookie production multiplier +15%.',99999999999999,[6,4]);
2582 | new Game.Upgrade('Chocolate british tea biscuits','Cookie production multiplier +15%.',99999999999999,[7,4]);
2583 | new Game.Upgrade('Round british tea biscuits','Cookie production multiplier +15%.',99999999999999,[8,4]);
2584 | new Game.Upgrade('Round chocolate british tea biscuits','Cookie production multiplier +15%.',99999999999999,[9,4]);
2585 | new Game.Upgrade('Round british tea biscuits with heart motif','Cookie production multiplier +15%.',99999999999999,[10,4]);
2586 | new Game.Upgrade('Round chocolate british tea biscuits with heart motif','Cookie production multiplier +15%.Quite.',99999999999999,[11,4]);
2587 | type='';power=0;
2588 |
2589 |
2590 | order=1000;
2591 | new Game.Upgrade('Sugar bosons','Antimatter condensers gain +99,999 base CpS.',Game.Objects['Antimatter condenser'].basePrice*tier1,[13,0]);
2592 | new Game.Upgrade('String theory','Antimatter condensers are twice as efficient.',Game.Objects['Antimatter condenser'].basePrice*tier2,[13,0]);
2593 | new Game.Upgrade('Large macaron collider','Antimatter condensers are twice as efficient.How singular!',Game.Objects['Antimatter condenser'].basePrice*tier3,[13,1]);
2594 | new Game.Upgrade('Big bang bake','Antimatter condensers are twice as efficient.And that\'s how it all began.',Game.Objects['Antimatter condenser'].basePrice*tier4,[13,2]);
2595 |
2596 | order=250;
2597 | new Game.Upgrade('Antigrandmas','Grandmas are twice as efficient.',Game.Objects['Antimatter condenser'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();});
2598 |
2599 | order=10000;
2600 | type='cookie';power=20;
2601 | new Game.Upgrade('Madeleines','Cookie production multiplier +20%.Unforgettable!',199999999999999,[12,3]);
2602 | new Game.Upgrade('Palmiers','Cookie production multiplier +20%.',199999999999999,[13,3]);
2603 | new Game.Upgrade('Palets','Cookie production multiplier +20%.',199999999999999,[12,4]);
2604 | new Game.Upgrade('Sablés','Cookie production multiplier +20%.',199999999999999,[13,4]);
2605 | type='';power=0;
2606 |
2607 | order=20000;
2608 | new Game.Upgrade('Kitten overseers','You gain more CpS the more milk you have.my purrpose is to serve you, sir',900000000000000,[8,7]);
2609 |
2610 | /*
2611 | new Game.Upgrade('Plain milk','Unlocks plain milk, available in the menu.',120000000000,[4,8]);
2612 | new Game.Upgrade('Chocolate milk','Unlocks chocolate milk, available in the menu.',120000000000,[5,8]);
2613 | new Game.Upgrade('Raspberry milk','Unlocks raspberry milk, available in the menu.',120000000000,[6,8]);
2614 | new Game.Upgrade('Ain\'t got milk','Unlocks no milk please, available in the menu.',120000000000,[0,8]);
2615 |
2616 | new Game.Upgrade('Blue background','Unlocks the blue background, available in the menu.',120000000000,[0,9]);
2617 | new Game.Upgrade('Red background','Unlocks the red background, available in the menu.',120000000000,[1,9]);
2618 | new Game.Upgrade('White background','Unlocks the white background, available in the menu.',120000000000,[2,9]);
2619 | new Game.Upgrade('Black background','Unlocks the black background, available in the menu.',120000000000,[3,9]);
2620 | */
2621 |
2622 |
2623 | /*=====================================================================================
2624 | ACHIEVEMENTS
2625 | =======================================================================================*/
2626 | Game.Achievements=[];
2627 | Game.AchievementsById=[];
2628 | Game.AchievementsN=0;
2629 | Game.AchievementsOwned=0;
2630 | Game.Achievement=function(name,desc,icon,hide)
2631 | {
2632 | this.id=Game.AchievementsN;
2633 | this.name=name;
2634 | this.desc=desc;
2635 | this.icon=icon;
2636 | this.won=0;
2637 | this.disabled=0;
2638 | this.hide=hide||0;//hide levels : 0=show, 1=hide description, 2=hide, 3=secret (doesn't count toward achievement total)
2639 | this.order=this.id;
2640 | if (order) this.order=order+this.id*0.001;
2641 |
2642 | Game.Achievements[this.name]=this;
2643 | Game.AchievementsById[this.id]=this;
2644 | Game.AchievementsN++;
2645 | return this;
2646 | }
2647 |
2648 | Game.Win=function(what)
2649 | {
2650 | if (typeof what==='string')
2651 | {
2652 | if (Game.Achievements[what])
2653 | {
2654 | if (Game.Achievements[what].won==0)
2655 | {
2656 | Game.Achievements[what].won=1;
2657 | Game.Popup('Achievement unlocked : '+Game.Achievements[what].name+' ');
2658 | if (Game.Achievements[what].hide!=3) Game.AchievementsOwned++;
2659 | Game.recalculateGains=1;
2660 | }
2661 | }
2662 | }
2663 | else {for (var i in what) {Game.Win(what[i]);}}
2664 | }
2665 |
2666 | Game.HasAchiev=function(what)
2667 | {
2668 | return (Game.Achievements[what]?Game.Achievements[what].won:0);
2669 | }
2670 |
2671 | //define achievements
2672 | //WARNING : do NOT add new achievements in between, this breaks the saves. Add them at the end !
2673 |
2674 | var order=100;//this is used to set the order in which the items are listed
2675 | //new Game.Achievement('name','description',[0,0]);
2676 | Game.moneyAchievs=[
2677 | 'Wake and bake', 1,
2678 | 'Making some dough', 100,
2679 | 'So baked right now', 1000,
2680 | 'Fledgling bakery', 10000,
2681 | 'Affluent bakery', 100000,
2682 | 'World-famous bakery', 1000000,
2683 | 'Cosmic bakery', 10000000,
2684 | 'Galactic bakery', 100000000,
2685 | 'Universal bakery', 1000000000,
2686 | 'Timeless bakery', 5000000000,
2687 | 'Infinite bakery', 10000000000,
2688 | 'Immortal bakery', 50000000000,
2689 | 'You can stop now', 100000000000,
2690 | 'Cookies all the way down', 500000000000,
2691 | 'Overdose', 1000000000000,
2692 | 'How?', 10000000000000
2693 | ];
2694 | for (var i=0;i'+Beautify(Game.moneyAchievs[i*2+1])+' cookie'+(Game.moneyAchievs[i*2+1]==1?'':'s')+'.',pic,2);
2699 | }
2700 |
2701 | order=200;
2702 | Game.cpsAchievs=[
2703 | 'Casual baking', 1,
2704 | 'Hardcore baking', 10,
2705 | 'Steady tasty stream', 100,
2706 | 'Cookie monster', 1000,
2707 | 'Mass producer', 10000,
2708 | 'Cookie vortex', 100000,
2709 | 'Cookie pulsar', 1000000,
2710 | 'Cookie quasar', 10000000,
2711 | 'A world filled with cookies', 100000000,
2712 | 'Let\'s never bake again', 1000000000
2713 | ];
2714 | for (var i=0;i'+Beautify(Game.cpsAchievs[i*2+1])+' cookie'+(Game.cpsAchievs[i*2+1]==1?'':'s')+' per second.',pic,2);
2718 | }
2719 |
2720 | order=30000;
2721 | new Game.Achievement('Sacrifice','Reset your game with 1 million cookies baked.Easy come, easy go.',[11,6],2);
2722 | new Game.Achievement('Oblivion','Reset your game with 1 billion cookies baked.Back to square one.',[11,6],2);
2723 | new Game.Achievement('From scratch','Reset your game with 1 trillion cookies baked.It\'s been fun.',[11,6],2);
2724 |
2725 | order=31000;
2726 | new Game.Achievement('Neverclick','Make 1 million cookies by only having clicked 15 times.',[12,0],3);
2727 | order=1000;
2728 | new Game.Achievement('Clicktastic','Make 1,000 cookies from clicking.',[11,0]);
2729 | new Game.Achievement('Clickathlon','Make 100,000 cookies from clicking.',[11,1]);
2730 | new Game.Achievement('Clickolympics','Make 10,000,000 cookies from clicking.',[11,1]);
2731 | new Game.Achievement('Clickorama','Make 1,000,000,000 cookies from clicking.',[11,2]);
2732 |
2733 | order=1050;
2734 | new Game.Achievement('Click','Have 1 cursor.',[0,0]);
2735 | new Game.Achievement('Double-click','Have 2 cursors.',[0,6]);
2736 | new Game.Achievement('Mouse wheel','Have 50 cursors.',[1,6]);
2737 | new Game.Achievement('Of Mice and Men','Have 100 cursors.',[2,6]);
2738 | new Game.Achievement('The Digital','Have 200 cursors.',[3,6]);
2739 |
2740 | order=1100;
2741 | new Game.Achievement('Just wrong','Sell a grandma.I thought you loved me.',[10,9],2);
2742 | new Game.Achievement('Grandma\'s cookies','Have 1 grandma.',[1,0]);
2743 | new Game.Achievement('Sloppy kisses','Have 50 grandmas.',[1,1]);
2744 | new Game.Achievement('Retirement home','Have 100 grandmas.',[1,2]);
2745 |
2746 | order=1200;
2747 | new Game.Achievement('My first farm','Have 1 farm.',[2,0]);
2748 | new Game.Achievement('Reap what you sow','Have 50 farms.',[2,1]);
2749 | new Game.Achievement('Farm ill','Have 100 farms.',[2,2]);
2750 |
2751 | order=1300;
2752 | new Game.Achievement('Production chain','Have 1 factory.',[4,0]);
2753 | new Game.Achievement('Industrial revolution','Have 50 factories.',[4,1]);
2754 | new Game.Achievement('Global warming','Have 100 factories.',[4,2]);
2755 |
2756 | order=1400;
2757 | new Game.Achievement('You know the drill','Have 1 mine.',[3,0]);
2758 | new Game.Achievement('Excavation site','Have 50 mines.',[3,1]);
2759 | new Game.Achievement('Hollow the planet','Have 100 mines.',[3,2]);
2760 |
2761 | order=1500;
2762 | new Game.Achievement('Expedition','Have 1 shipment.',[5,0]);
2763 | new Game.Achievement('Galactic highway','Have 50 shipments.',[5,1]);
2764 | new Game.Achievement('Far far away','Have 100 shipments.',[5,2]);
2765 |
2766 | order=1600;
2767 | new Game.Achievement('Transmutation','Have 1 alchemy lab.',[6,0]);
2768 | new Game.Achievement('Transmogrification','Have 50 alchemy labs.',[6,1]);
2769 | new Game.Achievement('Gold member','Have 100 alchemy labs.',[6,2]);
2770 |
2771 | order=1700;
2772 | new Game.Achievement('A whole new world','Have 1 portal.',[7,0]);
2773 | new Game.Achievement('Now you\'re thinking','Have 50 portals.',[7,1]);
2774 | new Game.Achievement('Dimensional shift','Have 100 portals.',[7,2]);
2775 |
2776 | order=1800;
2777 | new Game.Achievement('Time warp','Have 1 time machine.',[8,0]);
2778 | new Game.Achievement('Alternate timeline','Have 50 time machines.',[8,1]);
2779 | new Game.Achievement('Rewriting history','Have 100 time machines.',[8,2]);
2780 |
2781 | order=7000;
2782 | new Game.Achievement('One with everything','Have at least 1 of every building.',[4,6],2);
2783 | new Game.Achievement('Mathematician','Have at least 1 time machine, 2 portals, 4 alchemy labs, 8 shipments and so on (128 max).',[7,6],2);
2784 | new Game.Achievement('Base 10','Have at least 10 time machines, 20 portals, 30 alchemy labs, 40 shipments and so on.',[8,6],2);
2785 |
2786 | order=10000;
2787 | new Game.Achievement('Golden cookie','Click a golden cookie.',[10,1],1);
2788 | new Game.Achievement('Lucky cookie','Click 7 golden cookies.',[10,1],1);
2789 | new Game.Achievement('A stroke of luck','Click 27 golden cookies.',[10,1],1);
2790 |
2791 | order=30200;
2792 | new Game.Achievement('Cheated cookies taste awful','Hack in some cookies.',[10,6],3);
2793 | order=30001;
2794 | new Game.Achievement('Uncanny clicker','Click really, really fast.Well I\'ll be!',[12,0],2);
2795 |
2796 | order=5000;
2797 | new Game.Achievement('Builder','Own 100 buildings.',[4,6],1);
2798 | new Game.Achievement('Architect','Own 400 buildings.',[5,6],1);
2799 | order=6000;
2800 | new Game.Achievement('Enhancer','Purchase 20 upgrades.',[9,0],1);
2801 | new Game.Achievement('Augmenter','Purchase 50 upgrades.',[9,1],1);
2802 |
2803 | order=11000;
2804 | new Game.Achievement('Cookie-dunker','Dunk the cookie.You did it!',[4,7],2);
2805 |
2806 | order=10000;
2807 | new Game.Achievement('Fortune','Click 77 golden cookies.You should really go to bed.',[10,1],1);
2808 | order=31000;
2809 | new Game.Achievement('True Neverclick','Make 1 million cookies with no cookie clicks.This kinda defeats the whole purpose, doesn\'t it?',[12,0],3);
2810 |
2811 | order=20000;
2812 | new Game.Achievement('Elder nap','Appease the grandmatriarchs at least once.we are eternal',[8,9],2);
2813 | new Game.Achievement('Elder slumber','Appease the grandmatriarchs at least 5 times.our mind outlives the universe',[8,9],2);
2814 |
2815 | order=1100;
2816 | new Game.Achievement('Elder','Own every grandma type.',[10,9],2);
2817 |
2818 | order=20000;
2819 | new Game.Achievement('Elder calm','Declare a covenant with the grandmatriarchs.we have fed',[8,9],2);
2820 |
2821 | order=5000;
2822 | new Game.Achievement('Engineer','Own 800 buildings.',[6,6],1);
2823 |
2824 | order=10000;
2825 | new Game.Achievement('Leprechaun','Click 777 golden cookies.',[10,1],1);
2826 | new Game.Achievement('Black cat\'s paw','Click 7777 golden cookies.',[10,1],3);
2827 |
2828 | order=30000;
2829 | new Game.Achievement('Nihilism','Reset your game with 1 quadrillion cookies baked.There are many things that need to be erased',[11,6],2);
2830 | //new Game.Achievement('Galactus\' Reprimand','Reset your game with 1 quintillion coo- okay no I'm yanking your chain
2831 |
2832 | order=1900;
2833 | new Game.Achievement('Antibatter','Have 1 antimatter condenser.',[13,0]);
2834 | new Game.Achievement('Quirky quarks','Have 50 antimatter condensers.',[13,1]);
2835 | new Game.Achievement('It does matter!','Have 100 antimatter condensers.',[13,2]);
2836 |
2837 | order=6000;
2838 | new Game.Achievement('Upgrader','Purchase 100 upgrades.',[9,2],1);
2839 |
2840 | order=7000;
2841 | new Game.Achievement('Centennial','Have at least 100 of everything.',[9,6],2);
2842 |
2843 |
2844 | Game.RuinTheFun=function()
2845 | {
2846 | for (var i in Game.Upgrades)
2847 | {
2848 | Game.Unlock(Game.Upgrades[i].name);
2849 |
2850 | Game.Upgrades[i].bought++;
2851 | if (Game.Upgrades[i].buyFunction) Game.Upgrades[i].buyFunction();
2852 | }
2853 | for (var i in Game.Achievements)
2854 | {
2855 | Game.Win(Game.Achievements[i].name);
2856 | }
2857 | Game.Earn(999999999999999999);
2858 | Game.upgradesToRebuild=1;
2859 | Game.recalculateGains=1;
2860 | }
2861 |
2862 | /*=====================================================================================
2863 | GRANDMAPOCALYPSE
2864 | =======================================================================================*//** BEGIN EDIT **/
2865 | Game.UpdateGrandmapocalypse=function()
2866 | {
2867 | if (Game.Has('Elder Covenant') || Game.Objects['Grandma'].amount==0) Game.elderWrath=0;
2868 | else if (Game.pledgeT>0)//if the pledge is active, lower it
2869 | {
2870 | Game.pledgeT--;
2871 | if (Game.pledgeT==0)//did we reach 0? make the pledge purchasable again
2872 | {
2873 | Game.Lock('Elder Pledge');
2874 | Game.Unlock('Elder Pledge');
2875 | Game.elderWrath=1;
2876 | }
2877 | }
2878 | else
2879 | {
2880 | if (Game.Has('One mind') && Game.elderWrath==0)
2881 | {
2882 | Game.elderWrath=1;
2883 | }
2884 | if (Math.random()<0.001 && Game.elderWrath0.1)
2902 | {
2903 | if (Game.elderWrathD<1)
2904 | {
2905 | Game.bgR=0;
2906 | if (Game.bg!=Game.defaultBg || Game.bgFade!=Game.defaultBg)
2907 | {
2908 | Game.bg=Game.defaultBg;
2909 | Game.bgFade=Game.defaultBg;
2910 | l('backgroundLayer1').style.background='url(img/'+Game.bg+'.jpg)';
2911 | l('backgroundLayer2').style.background='url(img/'+Game.bgFade+'.jpg)';
2912 | l('backgroundLayer1').style.backgroundSize='auto';
2913 | l('backgroundLayer2').style.backgroundSize='auto';
2914 | }
2915 | }
2916 | else if (Game.elderWrathD>=1 && Game.elderWrathD<2)
2917 | {
2918 | Game.bgR=(Game.elderWrathD-1)/1;
2919 | if (Game.bg!=Game.defaultBg || Game.bgFade!='grandmas1')
2920 | {
2921 | Game.bg=Game.defaultBg;
2922 | Game.bgFade='grandmas1';
2923 | l('backgroundLayer1').style.background='url(img/'+Game.bg+'.jpg)';
2924 | l('backgroundLayer2').style.background='url(img/'+Game.bgFade+'.jpg)';
2925 | l('backgroundLayer1').style.backgroundSize='auto';
2926 | l('backgroundLayer2').style.backgroundSize='512px';
2927 | }
2928 | }
2929 | else if (Game.elderWrathD>=2 && Game.elderWrathD<3)
2930 | {
2931 | Game.bgR=(Game.elderWrathD-2)/1;
2932 | if (Game.bg!='grandmas1' || Game.bgFade!='grandmas2')
2933 | {
2934 | Game.bg='grandmas1';
2935 | Game.bgFade='grandmas2';
2936 | l('backgroundLayer1').style.background='url(img/'+Game.bg+'.jpg)';
2937 | l('backgroundLayer2').style.background='url(img/'+Game.bgFade+'.jpg)';
2938 | l('backgroundLayer1').style.backgroundSize='512px';
2939 | l('backgroundLayer2').style.backgroundSize='512px';
2940 | }
2941 | }
2942 | else if (Game.elderWrathD>=3 && Game.elderWrathD<4)
2943 | {
2944 | Game.bgR=(Game.elderWrathD-3)/1;
2945 | if (Game.bg!='grandmas2' || Game.bgFade!='grandmas3')
2946 | {
2947 | Game.bg='grandmas2';
2948 | Game.bgFade='grandmas3';
2949 | l('backgroundLayer1').style.background='url(img/'+Game.bg+'.jpg)';
2950 | l('backgroundLayer2').style.background='url(img/'+Game.bgFade+'.jpg)';
2951 | l('backgroundLayer1').style.backgroundSize='512px';
2952 | l('backgroundLayer2').style.backgroundSize='512px';
2953 | }
2954 | }
2955 | Game.bgRd+=(Game.bgR-Game.bgRd)*0.5;
2956 | l('backgroundLayer2').style.opacity=Game.bgR;
2957 | //why are these so slow (maybe replaceable with a large canvas)
2958 | /*var x=Math.sin(Game.T*0.2)*Math.random()*8;
2959 | var y=Math.sin(Game.T*0.2)*Math.random()*8;
2960 | l('backgroundLayer1').style.backgroundPosition=Math.floor(x)+'px '+Math.floor(y)+'px';
2961 | l('backgroundLayer2').style.backgroundPosition=Math.floor(x)+'px '+Math.floor(y)+'px';*/
2962 | }
2963 | };
2964 |
2965 |
2966 | /*=====================================================================================
2967 | DUNGEONS (unfinished)
2968 | =======================================================================================*/
2969 |
2970 | LaunchDungeons();
2971 |
2972 | /*=====================================================================================
2973 | INITIALIZATION END; GAME READY TO LAUNCH
2974 | =======================================================================================*/
2975 |
2976 | Game.LoadSave();
2977 |
2978 | Game.ready=1;
2979 | l('javascriptError').innerHTML='';
2980 | l('javascriptError').style.display='none';
2981 | Game.Loop();
2982 | }
2983 |
2984 | /*=====================================================================================
2985 | LOGIC
2986 | =======================================================================================*/
2987 | Game.Logic=function()
2988 | {
2989 | Game.UpdateGrandmapocalypse();
2990 |
2991 | //handle milk and milk accessories
2992 | Game.milkProgress=Game.AchievementsOwned/25;
2993 | if (Game.milkProgress>=0.5) Game.Unlock('Kitten helpers');
2994 | if (Game.milkProgress>=1) Game.Unlock('Kitten workers');
2995 | if (Game.milkProgress>=2) Game.Unlock('Kitten engineers');
2996 | if (Game.milkProgress>=3) Game.Unlock('Kitten overseers');
2997 | Game.milkH=Math.min(1,Game.milkProgress)*0.35;
2998 | Game.milkHd+=(Game.milkH-Game.milkHd)*0.02;
2999 |
3000 | if (Game.autoclickerDetected>0) Game.autoclickerDetected--;
3001 |
3002 | //handle research
3003 | if (Game.researchT>0)
3004 | {
3005 | Game.researchT--;
3006 | }
3007 | if (Game.researchT==0 && Game.nextResearch)
3008 | {
3009 | Game.Unlock(Game.UpgradesById[Game.nextResearch].name);
3010 | Game.Popup('Researched : '+Game.UpgradesById[Game.nextResearch].name);
3011 | Game.nextResearch=0;
3012 | Game.researchT=-1;
3013 | }
3014 |
3015 | //handle cookies
3016 | if (Game.recalculateGains) Game.CalculateGains();;
3017 | Game.Earn(Game.cookiesPs/Game.fps);//add cookies per second
3018 | //var cps=Game.cookiesPs+Game.cookies*0.01;//exponential cookies
3019 | //Game.Earn(cps/Game.fps);//add cookies per second
3020 |
3021 | for (var i in Game.Objects)
3022 | {
3023 | var me=Game.Objects[i];
3024 | me.totalCookies+=me.storedTotalCps/Game.fps;
3025 | }
3026 | if (Game.cookies && Game.T%Math.ceil(Game.fps/Math.min(10,Game.cookiesPs))==0 && Game.prefs.numbers) Game.cookieParticleAdd();//cookie shower
3027 | if (Game.frenzy>0)
3028 | {
3029 | Game.frenzy--;
3030 | if (Game.frenzy==0) Game.recalculateGains=1;
3031 | }
3032 | if (Game.clickFrenzy>0)
3033 | {
3034 | Game.clickFrenzy--;
3035 | if (Game.clickFrenzy==0) Game.recalculateGains=1;
3036 | }
3037 | if (Game.T%(Game.fps*5)==0 && Game.ObjectsById.length>0)//check some achievements and upgrades
3038 | {
3039 | //if (Game.Has('Arcane sugar') && !Game.Has('Elder Pact')) Game.Unlock('Elder Pact');//temporary fix for something stupid I've done
3040 |
3041 | //if (Game.Objects['Factory'].amount>=50 && Game.Objects['Factory'].specialUnlocked==0) {Game.Objects['Factory'].unlockSpecial();Game.Popup('You have unlocked the factory dungeons!');}
3042 | if (isNaN(Game.cookies)) {Game.cookies=0;Game.cookiesEarned=0;Game.recalculateGains=1;}
3043 |
3044 | if (Game.cookiesEarned>=9999999) Game.Unlock(['Oatmeal raisin cookies','Peanut butter cookies','Plain cookies','Sugar cookies']);
3045 | if (Game.cookiesEarned>=99999999) Game.Unlock(['Coconut cookies','White chocolate cookies','Macadamia nut cookies']);
3046 | if (Game.cookiesEarned>=999999999) Game.Unlock(['Double-chip cookies','White chocolate macadamia nut cookies','All-chocolate cookies']);
3047 | if (Game.cookiesEarned>=9999999999) Game.Unlock(['Dark chocolate-coated cookies','White chocolate-coated cookies']);
3048 | if (Game.cookiesEarned>=99999999999) Game.Unlock(['Eclipse cookies','Zebra cookies']);
3049 | if (Game.cookiesEarned>=999999999999) Game.Unlock(['Snickerdoodles','Stroopwafels','Macaroons']);
3050 | if (Game.cookiesEarned>=999999999999 && Game.Has('Snickerdoodles') && Game.Has('Stroopwafels') && Game.Has('Macaroons'))
3051 | {
3052 | Game.Unlock('Empire biscuits');
3053 | if (Game.Has('Empire biscuits')) Game.Unlock('British tea biscuits');
3054 | if (Game.Has('British tea biscuits')) Game.Unlock('Chocolate british tea biscuits');
3055 | if (Game.Has('Chocolate british tea biscuits')) Game.Unlock('Round british tea biscuits');
3056 | if (Game.Has('Round british tea biscuits')) Game.Unlock('Round chocolate british tea biscuits');
3057 | if (Game.Has('Round chocolate british tea biscuits')) Game.Unlock('Round british tea biscuits with heart motif');
3058 | if (Game.Has('Round british tea biscuits with heart motif')) Game.Unlock('Round chocolate british tea biscuits with heart motif');
3059 | }
3060 | if (Game.cookiesEarned>=9999999999999) Game.Unlock(['Madeleines','Palmiers','Palets','Sablés']);
3061 |
3062 | for (var i=0;i=Game.moneyAchievs[i*2+1]) Game.Win(Game.moneyAchievs[i*2]);
3065 | }
3066 | var buildingsOwned=0;
3067 | var oneOfEach=1;
3068 | var mathematician=1;
3069 | var base10=1;
3070 | var centennial=1;
3071 | for (var i in Game.Objects)
3072 | {
3073 | buildingsOwned+=Game.Objects[i].amount;
3074 | if (!Game.HasAchiev('One with everything')) {if (Game.Objects[i].amount==0) oneOfEach=0;}
3075 | if (!Game.HasAchiev('Mathematician')) {if (Game.Objects[i].amount=1000000 && Game.cookieClicks<=15) Game.Win('Neverclick');
3084 | if (Game.cookiesEarned>=1000000 && Game.cookieClicks<=0) Game.Win('True Neverclick');
3085 | if (Game.handmadeCookies>=1000) {Game.Win('Clicktastic');Game.Unlock('Plastic mouse');}
3086 | if (Game.handmadeCookies>=100000) {Game.Win('Clickathlon');Game.Unlock('Iron mouse');}
3087 | if (Game.handmadeCookies>=10000000) {Game.Win('Clickolympics');Game.Unlock('Titanium mouse');}
3088 | if (Game.handmadeCookies>=1000000000) {Game.Win('Clickorama');Game.Unlock('Adamantium mouse');}
3089 | if (Game.cookiesEarned=100) Game.Win('Builder');
3092 | if (buildingsOwned>=400) Game.Win('Architect');
3093 | if (buildingsOwned>=800) Game.Win('Engineer');
3094 | if (Game.UpgradesOwned>=20) Game.Win('Enhancer');
3095 | if (Game.UpgradesOwned>=50) Game.Win('Augmenter');
3096 | if (Game.UpgradesOwned>=100) Game.Win('Upgrader');
3097 |
3098 | if (!Game.HasAchiev('Elder') && Game.Has('Farmer grandmas') && Game.Has('Worker grandmas') && Game.Has('Miner grandmas') && Game.Has('Cosmic grandmas') && Game.Has('Transmuted grandmas') && Game.Has('Altered grandmas') && Game.Has('Grandmas\' grandmas')) Game.Win('Elder');
3099 | if (Game.Objects['Grandma'].amount>=6 && !Game.Has('Bingo center/Research facility') && Game.HasAchiev('Elder')) Game.Unlock('Bingo center/Research facility');
3100 | if (Game.pledges>0) Game.Win('Elder nap');
3101 | if (Game.pledges>=5) Game.Win('Elder slumber');
3102 | if (Game.pledges>=10) Game.Unlock('Sacrificial rolling pins');
3103 |
3104 | if (!Game.HasAchiev('Cookie-dunker') && l('bigCookie').getBoundingClientRect().bottom>l('milk').getBoundingClientRect().top+16 && Game.milkProgress>0.1) Game.Win('Cookie-dunker');
3105 | }
3106 |
3107 | Game.cookiesd+=(Game.cookies-Game.cookiesd)*0.3;
3108 |
3109 | if (Game.storeToRebuild) Game.RebuildStore();
3110 | if (Game.upgradesToRebuild) Game.RebuildUpgrades();
3111 |
3112 | if (Game.T%(Game.fps)==0) document.title=Beautify(Game.cookies)+' '+(Game.cookies==1?'cookie':'cookies')+' - Cookie Clicker';
3113 |
3114 | Game.TickerAge--;
3115 | if (Game.TickerAge<=0 || Game.Ticker=='') Game.getNewTicker();
3116 |
3117 | var veilLimit=0;//10;
3118 | if (Game.veil==1 && Game.cookiesEarned>=veilLimit) Game.veilOff();
3119 | else if (Game.veil==0 && Game.cookiesEarnedGame.fps*10 && Game.prefs.autosave) Game.WriteSave();
3124 | if (Game.T%(Game.fps*60*30)==0 && Game.T>Game.fps*10 && Game.prefs.autoupdate) Game.CheckUpdates();
3125 |
3126 | Game.T++;
3127 | }
3128 |
3129 | /*=====================================================================================
3130 | DRAW
3131 | =======================================================================================*/
3132 | Game.Draw=function()
3133 | {
3134 | if (Math.floor(Game.T%Game.fps/4)==0) Game.DrawGrandmapocalypse();
3135 |
3136 | //handle milk and milk accessories
3137 | if (Game.prefs.milk)
3138 | {
3139 | var x=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);
3140 | var y=0;
3141 | var m1=l('milkLayer1');
3142 | var m2=l('milkLayer2');
3143 | m1.style.backgroundPosition=x+'px '+y+'px';
3144 | m2.style.backgroundPosition=x+'px '+y+'px';
3145 | l('milk').style.height=(Game.milkHd*100)+'%';
3146 | var m1o=1;
3147 | var m2o=0;
3148 | var m1i='milkWave';
3149 | var m2i='chocolateMilkWave';
3150 | if (Game.milkProgress<1) {m1o=1;m1i='milkWave';m2i='chocolateMilkWave';}
3151 | else if (Game.milkProgress<2) {m1o=1-(Game.milkProgress-1);m1i='milkWave';m2i='chocolateMilkWave';}
3152 | else if (Game.milkProgress<3) {m1o=1-(Game.milkProgress-2);m1i='chocolateMilkWave';m2i='raspberryWave';}
3153 | else {m1o=1;m1i='raspberryWave';m2i='raspberryWave';}
3154 | m2o=1-m1o;
3155 | if (m1.style.backgroundImage!='url(img/'+m1i+'.png') m1.style.backgroundImage='url(img/'+m1i+'.png)';
3156 | if (m2.style.backgroundImage!='url(img/'+m2i+'.png') m2.style.backgroundImage='url(img/'+m2i+'.png)';
3157 | m1.style.opacity=m1o;
3158 | m2.style.opacity=m2o;
3159 | }
3160 |
3161 | if (Game.prefs.particles)
3162 | {
3163 | //shine
3164 | var r=Math.floor((Game.T*0.5)%360);
3165 | var me=l('cookieShine');
3166 | me.style.transform='rotate('+r+'deg)';
3167 | me.style.mozTransform='rotate('+r+'deg)';
3168 | me.style.webkitTransform='rotate('+r+'deg)';
3169 | me.style.msTransform='rotate('+r+'deg)';
3170 | me.style.oTransform='rotate('+r+'deg)';
3171 |
3172 | //cursors
3173 | var r=((-Game.T*0.05)%360);
3174 | var me=l('cookieCursors');
3175 | me.style.transform='rotate('+r+'deg)';
3176 | me.style.mozTransform='rotate('+r+'deg)';
3177 | me.style.webkitTransform='rotate('+r+'deg)';
3178 | me.style.msTransform='rotate('+r+'deg)';
3179 | me.style.oTransform='rotate('+r+'deg)';
3180 | }
3181 |
3182 |
3183 | //handle cursors
3184 |
3185 | if (Game.prefs.particles)
3186 | {
3187 | var amount=Game.Objects['Cursor'].amount;
3188 | for (var i=0;i0.997) w=1.5;
3202 | else if (w>0.994) w=0.5;
3203 | else w=0;
3204 | w*=-4;
3205 | //w+=Math.pow(Math.sin(((Game.T*0.05+(i/amount)*Game.fps)%Game.fps)/Game.fps*Math.PI*3),2)*15+5;
3206 |
3207 | var x=(Math.sin(a*Math.PI*2)*(140+n*16+w))-16;
3208 | var y=(Math.cos(a*Math.PI*2)*(140+n*16+w))-16;
3209 | var r=Math.floor(-(a)*360);
3210 | me.style.left=x+'px';
3211 | me.style.top=y+'px';
3212 | }
3213 | }
3214 |
3215 | //handle cookies
3216 | if (Game.prefs.particles)
3217 | {
3218 | if (Game.elderWrathD<=1.5)
3219 | {
3220 | if (Game.cookiesPs>=1000) l('cookieShower').style.backgroundImage='url(img/cookieShower3.png)';
3221 | else if (Game.cookiesPs>=500) l('cookieShower').style.backgroundImage='url(img/cookieShower2.png)';
3222 | else if (Game.cookiesPs>=50) l('cookieShower').style.backgroundImage='url(img/cookieShower1.png)';
3223 | else l('cookieShower').style.backgroundImage='none';
3224 | l('cookieShower').style.backgroundPosition='0px '+(Math.floor(Game.T*2)%512)+'px';
3225 | }
3226 | if (Game.elderWrathD>=1 && Game.elderWrathD<1.5) l('cookieShower').style.opacity=1-((Game.elderWrathD-1)/0.5);
3227 | }
3228 |
3229 | var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies');
3230 | if (Math.round(Game.cookiesd).toString().length>11) unit=' cookies';
3231 | l('cookies').innerHTML=Beautify(Math.round(Game.cookiesd))+unit+'