Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AroriaNetwork
GitHub Repository: AroriaNetwork/3kho-backup
Path: blob/main/projects/cookie-clicker/main.js
1834 views
1
/*
2
All this code is copyright Orteil, 2013-2020.
3
-with some help, advice and fixes by Nicholas Laux, Debugbro, Opti, and lots of people on reddit, Discord, and the DashNet forums
4
-also includes a bunch of snippets found on stackoverflow.com and others
5
-want to mod the game? scroll down to the "MODDING API" section
6
Hello, and welcome to the joyous mess that is main.js. Code contained herein is not guaranteed to be good, consistent, or sane. Most of this is years old at this point and harkens back to simpler, cruder times. In particular I've tried to maintain compatibility with fairly old versions of javascript, which means luxuries such as 'let', arrow functions and string literals are unavailable. Have a nice trip.
7
Spoilers ahead.
8
http://orteil.dashnet.org
9
*/
10
11
var VERSION=2.031;
12
var BETA=0;
13
14
/*=====================================================================================
15
MISC HELPER FUNCTIONS
16
=======================================================================================*/
17
function l(what) {return document.getElementById(what);}
18
function choose(arr) {return arr[Math.floor(Math.random()*arr.length)];}
19
20
function escapeRegExp(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");}
21
function replaceAll(find,replace,str){return str.replace(new RegExp(escapeRegExp(find),'g'),replace);}
22
23
//disable sounds coming from soundjay.com (sorry)
24
var realAudio=Audio;//backup real audio
25
Audio=function(src){
26
if (src && src.indexOf('soundjay')>-1) {Game.Popup('Sorry, no sounds hotlinked from soundjay.com.');this.play=function(){};}
27
else return new realAudio(src);
28
};
29
30
if(!Array.prototype.indexOf) {
31
Array.prototype.indexOf = function(needle) {
32
for(var i = 0; i < this.length; i++) {
33
if(this[i] === needle) {return i;}
34
}
35
return -1;
36
};
37
}
38
39
function randomFloor(x) {if ((x%1)<Math.random()) return Math.floor(x); else return Math.ceil(x);}
40
41
function shuffle(array)
42
{
43
var counter = array.length, temp, index;
44
// While there are elements in the array
45
while (counter--)
46
{
47
// Pick a random index
48
index = (Math.random() * counter) | 0;
49
50
// And swap the last element with it
51
temp = array[counter];
52
array[counter] = array[index];
53
array[index] = temp;
54
}
55
return array;
56
}
57
58
var sinArray=[];
59
for (var i=0;i<360;i++)
60
{
61
//let's make a lookup table
62
sinArray[i]=Math.sin(i/360*Math.PI*2);
63
}
64
function quickSin(x)
65
{
66
//oh man this isn't all that fast actually
67
//why do I do this. why
68
var sign=x<0?-1:1;
69
return sinArray[Math.round(
70
(Math.abs(x)*360/Math.PI/2)%360
71
)]*sign;
72
}
73
74
/*function ajax(url,callback){
75
var ajaxRequest;
76
try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest=new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {try{ajaxRequest=new ActiveXObject('Microsoft.XMLHTTP');} catch (e){alert("Something broke!");return false;}}}
77
if (callback){ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){callback(ajaxRequest.responseText);}}}
78
ajaxRequest.open('GET',url+'&nocache='+(new Date().getTime()),true);ajaxRequest.send(null);
79
}*/
80
81
var ajax=function(url,callback)
82
{
83
var httpRequest=new XMLHttpRequest();
84
if (!httpRequest){return false;}
85
httpRequest.onreadystatechange=function()
86
{
87
try{
88
if (httpRequest.readyState===XMLHttpRequest.DONE && httpRequest.status===200)
89
{
90
callback(httpRequest.responseText);
91
}
92
}catch(e){}
93
}
94
//httpRequest.onerror=function(e){console.log('ERROR',e);}
95
if (url.indexOf('?')==-1) url+='?'; else url+='&';
96
url+='nocache='+Date.now();
97
httpRequest.open('GET',url);
98
httpRequest.setRequestHeader('Content-Type','text/plain');
99
httpRequest.overrideMimeType('text/plain');
100
httpRequest.send();
101
return true;
102
}
103
104
function toFixed(x)
105
{
106
if (Math.abs(x) < 1.0) {
107
var e = parseInt(x.toString().split('e-')[1]);
108
if (e) {
109
x *= Math.pow(10,e-1);
110
x = '0.' + (new Array(e)).join('0') + x.toString().substring(2);
111
}
112
} else {
113
var e = parseInt(x.toString().split('+')[1]);
114
if (e > 20) {
115
e -= 20;
116
x /= Math.pow(10,e);
117
x += (new Array(e+1)).join('0');
118
}
119
}
120
return x;
121
}
122
123
//Beautify and number-formatting adapted from the Frozen Cookies add-on (http://cookieclicker.wikia.com/wiki/Frozen_Cookies_%28JavaScript_Add-on%29)
124
function formatEveryThirdPower(notations)
125
{
126
return function (val)
127
{
128
var base=0,notationValue='';
129
if (!isFinite(val)) return 'Infinity';
130
if (val>=1000000)
131
{
132
val/=1000;
133
while(Math.round(val)>=1000)
134
{
135
val/=1000;
136
base++;
137
}
138
if (base>=notations.length) {return 'Infinity';} else {notationValue=notations[base];}
139
}
140
return (Math.round(val*1000)/1000)+notationValue;
141
};
142
}
143
144
function rawFormatter(val){return Math.round(val*1000)/1000;}
145
146
var formatLong=[' thousand',' million',' billion',' trillion',' quadrillion',' quintillion',' sextillion',' septillion',' octillion',' nonillion'];
147
var prefixes=['','un','duo','tre','quattuor','quin','sex','septen','octo','novem'];
148
var suffixes=['decillion','vigintillion','trigintillion','quadragintillion','quinquagintillion','sexagintillion','septuagintillion','octogintillion','nonagintillion'];
149
for (var i in suffixes)
150
{
151
for (var ii in prefixes)
152
{
153
formatLong.push(' '+prefixes[ii]+suffixes[i]);
154
}
155
}
156
157
var formatShort=['k','M','B','T','Qa','Qi','Sx','Sp','Oc','No'];
158
var prefixes=['','Un','Do','Tr','Qa','Qi','Sx','Sp','Oc','No'];
159
var suffixes=['D','V','T','Qa','Qi','Sx','Sp','O','N'];
160
for (var i in suffixes)
161
{
162
for (var ii in prefixes)
163
{
164
formatShort.push(' '+prefixes[ii]+suffixes[i]);
165
}
166
}
167
formatShort[10]='Dc';
168
169
170
var numberFormatters=
171
[
172
formatEveryThirdPower(formatShort),
173
formatEveryThirdPower(formatLong),
174
rawFormatter
175
];
176
function Beautify(val,floats)
177
{
178
var negative=(val<0);
179
var decimal='';
180
var fixed=val.toFixed(floats);
181
if (Math.abs(val)<1000 && floats>0 && Math.floor(fixed)!=fixed) decimal='.'+(fixed.toString()).split('.')[1];
182
val=Math.floor(Math.abs(val));
183
if (floats>0 && fixed==val+1) val++;
184
var formatter=numberFormatters[Game.prefs.format?2:1];
185
var output=(val.toString().indexOf('e+')!=-1 && Game.prefs.format==1)?val.toPrecision(3).toString():formatter(val).toString().replace(/\B(?=(\d{3})+(?!\d))/g,',');
186
//var output=formatter(val).toString().replace(/\B(?=(\d{3})+(?!\d))/g,',');
187
if (output=='0') negative=false;
188
return negative?'-'+output:output+decimal;
189
}
190
function shortenNumber(val)
191
{
192
//if no scientific notation, return as is, else :
193
//keep only the 5 first digits (plus dot), round the rest
194
//may or may not work properly
195
if (val>=1000000 && isFinite(val))
196
{
197
var num=val.toString();
198
var ind=num.indexOf('e+');
199
if (ind==-1) return val;
200
var str='';
201
for (var i=0;i<ind;i++) {str+=(i<6?num[i]:'0');}
202
str+='e+';
203
str+=num.split('e+')[1];
204
return parseFloat(str);
205
}
206
return val;
207
}
208
209
SimpleBeautify=function(val)
210
{
211
var str=val.toString();
212
var str2='';
213
for (var i in str)//add commas
214
{
215
if ((str.length-i)%3==0 && i>0) str2+=',';
216
str2+=str[i];
217
}
218
return str2;
219
}
220
221
var beautifyInTextFilter=/(([\d]+[,]*)+)/g;//new regex
222
function BeautifyInTextFunction(str){return Beautify(parseInt(str.replace(/,/g,''),10));};
223
function BeautifyInText(str) {return str.replace(beautifyInTextFilter,BeautifyInTextFunction);}//reformat every number inside a string
224
function BeautifyAll()//run through upgrades and achievements to reformat the numbers
225
{
226
var func=function(what){what.desc=BeautifyInText(what.baseDesc);}
227
Game.UpgradesById.forEach(func);
228
Game.AchievementsById.forEach(func);
229
}
230
231
//these are faulty, investigate later
232
//function utf8_to_b64(str){return btoa(str);}
233
//function b64_to_utf8(str){return atob(str);}
234
235
function utf8_to_b64( str ) {
236
try{return Base64.encode(unescape(encodeURIComponent( str )));}
237
catch(err)
238
{return '';}
239
}
240
241
function b64_to_utf8( str ) {
242
try{return decodeURIComponent(escape(Base64.decode( str )));}
243
catch(err)
244
{return '';}
245
}
246
247
function CompressBin(arr)//compress a sequence like [0,1,1,0,1,0]... into a number like 54.
248
{
249
var str='';
250
var arr2=arr.slice(0);
251
arr2.unshift(1);
252
arr2.push(1);
253
arr2.reverse();
254
for (var i in arr2)
255
{
256
str+=arr2[i];
257
}
258
str=parseInt(str,2);
259
return str;
260
}
261
262
function UncompressBin(num)//uncompress a number like 54 to a sequence like [0,1,1,0,1,0].
263
{
264
var arr=num.toString(2);
265
arr=arr.split('');
266
arr.reverse();
267
arr.shift();
268
arr.pop();
269
return arr;
270
}
271
272
function CompressLargeBin(arr)//we have to compress in smaller chunks to avoid getting into scientific notation
273
{
274
var arr2=arr.slice(0);
275
var thisBit=[];
276
var bits=[];
277
for (var i in arr2)
278
{
279
thisBit.push(arr2[i]);
280
if (thisBit.length>=50)
281
{
282
bits.push(CompressBin(thisBit));
283
thisBit=[];
284
}
285
}
286
if (thisBit.length>0) bits.push(CompressBin(thisBit));
287
arr2=bits.join(';');
288
return arr2;
289
}
290
291
function UncompressLargeBin(arr)
292
{
293
var arr2=arr.split(';');
294
var bits=[];
295
for (var i in arr2)
296
{
297
bits.push(UncompressBin(parseInt(arr2[i])));
298
}
299
arr2=[];
300
for (var i in bits)
301
{
302
for (var ii in bits[i]) arr2.push(bits[i][ii]);
303
}
304
return arr2;
305
}
306
307
308
function pack(bytes) {
309
var chars = [];
310
var len=bytes.length;
311
for(var i = 0, n = len; i < n;) {
312
chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));
313
}
314
return String.fromCharCode.apply(null, chars);
315
}
316
317
function unpack(str) {
318
var bytes = [];
319
var len=str.length;
320
for(var i = 0, n = len; i < n; i++) {
321
var char = str.charCodeAt(i);
322
bytes.push(char >>> 8, char & 0xFF);
323
}
324
return bytes;
325
}
326
327
//modified from http://www.smashingmagazine.com/2011/10/19/optimizing-long-lists-of-yesno-values-with-javascript/
328
function pack2(/* string */ values) {
329
var chunks = values.match(/.{1,14}/g), packed = '';
330
for (var i=0; i < chunks.length; i++) {
331
packed += String.fromCharCode(parseInt('1'+chunks[i], 2));
332
}
333
return packed;
334
}
335
336
function unpack2(/* string */ packed) {
337
var values = '';
338
for (var i=0; i < packed.length; i++) {
339
values += packed.charCodeAt(i).toString(2).substring(1);
340
}
341
return values;
342
}
343
344
function pack3(values){
345
//too many save corruptions, darn it to heck
346
return values;
347
}
348
349
350
//file save function from https://github.com/eligrey/FileSaver.js
351
var saveAs=saveAs||function(view){"use strict";if(typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var doc=view.document,get_URL=function(){return view.URL||view.webkitURL||view},save_link=doc.createElementNS("http://www.w3.org/1999/xhtml","a"),can_use_save_link="download"in save_link,click=function(node){var event=new MouseEvent("click");node.dispatchEvent(event)},is_safari=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),webkit_req_fs=view.webkitRequestFileSystem,req_fs=view.requestFileSystem||webkit_req_fs||view.mozRequestFileSystem,throw_outside=function(ex){(view.setImmediate||view.setTimeout)(function(){throw ex},0)},force_saveable_type="application/octet-stream",fs_min_size=0,arbitrary_revoke_timeout=500,revoke=function(file){var revoker=function(){if(typeof file==="string"){get_URL().revokeObjectURL(file)}else{file.remove()}};if(view.chrome){revoker()}else{setTimeout(revoker,arbitrary_revoke_timeout)}},dispatch=function(filesaver,event_types,event){event_types=[].concat(event_types);var i=event_types.length;while(i--){var listener=filesaver["on"+event_types[i]];if(typeof listener==="function"){try{listener.call(filesaver,event||filesaver)}catch(ex){throw_outside(ex)}}}},auto_bom=function(blob){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)){return new Blob(["\ufeff",blob],{type:blob.type})}return blob},FileSaver=function(blob,name,no_auto_bom){if(!no_auto_bom){blob=auto_bom(blob)}var filesaver=this,type=blob.type,blob_changed=false,object_url,target_view,dispatch_all=function(){dispatch(filesaver,"writestart progress write writeend".split(" "))},fs_error=function(){if(target_view&&is_safari&&typeof FileReader!=="undefined"){var reader=new FileReader;reader.onloadend=function(){var base64Data=reader.result;target_view.location.href="data:attachment/file"+base64Data.slice(base64Data.search(/[,;]/));filesaver.readyState=filesaver.DONE;dispatch_all()};reader.readAsDataURL(blob);filesaver.readyState=filesaver.INIT;return}if(blob_changed||!object_url){object_url=get_URL().createObjectURL(blob)}if(target_view){target_view.location.href=object_url}else{var new_tab=view.open(object_url,"_blank");if(new_tab==undefined&&is_safari){view.location.href=object_url}}filesaver.readyState=filesaver.DONE;dispatch_all();revoke(object_url)},abortable=function(func){return function(){if(filesaver.readyState!==filesaver.DONE){return func.apply(this,arguments)}}},create_if_not_found={create:true,exclusive:false},slice;filesaver.readyState=filesaver.INIT;if(!name){name="download"}if(can_use_save_link){object_url=get_URL().createObjectURL(blob);setTimeout(function(){save_link.href=object_url;save_link.download=name;click(save_link);dispatch_all();revoke(object_url);filesaver.readyState=filesaver.DONE});return}if(view.chrome&&type&&type!==force_saveable_type){slice=blob.slice||blob.webkitSlice;blob=slice.call(blob,0,blob.size,force_saveable_type);blob_changed=true}if(webkit_req_fs&&name!=="download"){name+=".download"}if(type===force_saveable_type||webkit_req_fs){target_view=view}if(!req_fs){fs_error();return}fs_min_size+=blob.size;req_fs(view.TEMPORARY,fs_min_size,abortable(function(fs){fs.root.getDirectory("saved",create_if_not_found,abortable(function(dir){var save=function(){dir.getFile(name,create_if_not_found,abortable(function(file){file.createWriter(abortable(function(writer){writer.onwriteend=function(event){target_view.location.href=file.toURL();filesaver.readyState=filesaver.DONE;dispatch(filesaver,"writeend",event);revoke(file)};writer.onerror=function(){var error=writer.error;if(error.code!==error.ABORT_ERR){fs_error()}};"writestart progress write abort".split(" ").forEach(function(event){writer["on"+event]=filesaver["on"+event]});writer.write(blob);filesaver.abort=function(){writer.abort();filesaver.readyState=filesaver.DONE};filesaver.readyState=filesaver.WRITING}),fs_error)}),fs_error)};dir.getFile(name,{create:false},abortable(function(file){file.remove();save()}),abortable(function(ex){if(ex.code===ex.NOT_FOUND_ERR){save()}else{fs_error()}}))}),fs_error)}),fs_error)},FS_proto=FileSaver.prototype,saveAs=function(blob,name,no_auto_bom){return new FileSaver(blob,name,no_auto_bom)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(blob,name,no_auto_bom){if(!no_auto_bom){blob=auto_bom(blob)}return navigator.msSaveOrOpenBlob(blob,name||"download")}}FS_proto.abort=function(){var filesaver=this;filesaver.readyState=filesaver.DONE;dispatch(filesaver,"abort")};FS_proto.readyState=FS_proto.INIT=0;FS_proto.WRITING=1;FS_proto.DONE=2;FS_proto.error=FS_proto.onwritestart=FS_proto.onprogress=FS_proto.onwrite=FS_proto.onabort=FS_proto.onerror=FS_proto.onwriteend=null;return saveAs}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!=null){define([],function(){return saveAs})}
352
353
354
//seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html
355
(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);
356
357
function bind(scope,fn)
358
{
359
//use : bind(this,function(){this.x++;}) - returns a function where "this" refers to the scoped this
360
return function() {fn.apply(scope,arguments);};
361
}
362
363
var grabProps=function(arr,prop)
364
{
365
if (!arr) return [];
366
arr2=[];
367
for (var i=0;i<arr.length;i++)
368
{
369
arr2.push(arr[i][prop]);
370
}
371
return arr2;
372
}
373
374
CanvasRenderingContext2D.prototype.fillPattern=function(img,X,Y,W,H,iW,iH,offX,offY)
375
{
376
//for when built-in patterns aren't enough
377
if (img.alt!='blank')
378
{
379
var offX=offX||0;
380
var offY=offY||0;
381
if (offX<0) {offX=offX-Math.floor(offX/iW)*iW;} if (offX>0) {offX=(offX%iW)-iW;}
382
if (offY<0) {offY=offY-Math.floor(offY/iH)*iH;} if (offY>0) {offY=(offY%iH)-iH;}
383
for (var y=offY;y<H;y+=iH){for (var x=offX;x<W;x+=iW){this.drawImage(img,X+x,Y+y,iW,iH);}}
384
}
385
}
386
387
var OldCanvasDrawImage=CanvasRenderingContext2D.prototype.drawImage;
388
CanvasRenderingContext2D.prototype.drawImage=function()
389
{
390
//only draw the image if it's loaded
391
if (arguments[0].alt!='blank') OldCanvasDrawImage.apply(this,arguments);
392
}
393
394
395
if (!document.hasFocus) document.hasFocus=function(){return document.hidden;};//for Opera
396
397
function AddEvent(html_element, event_name, event_function)
398
{
399
if(html_element.attachEvent) html_element.attachEvent("on" + event_name, function() {event_function.call(html_element);});
400
else if(html_element.addEventListener) html_element.addEventListener(event_name, event_function, false);
401
}
402
403
function FireEvent(el, etype)
404
{
405
if (el.fireEvent)
406
{el.fireEvent('on'+etype);}
407
else
408
{
409
var evObj=document.createEvent('Events');
410
evObj.initEvent(etype,true,false);
411
el.dispatchEvent(evObj);
412
}
413
}
414
415
var Loader=function()//asset-loading system
416
{
417
this.loadingN=0;
418
this.assetsN=0;
419
this.assets=[];
420
this.assetsLoading=[];
421
this.assetsLoaded=[];
422
this.domain='';
423
this.loaded=0;//callback
424
this.doneLoading=0;
425
426
this.blank=document.createElement('canvas');
427
this.blank.width=8;
428
this.blank.height=8;
429
this.blank.alt='blank';
430
431
this.Load=function(assets)
432
{
433
for (var i in assets)
434
{
435
this.loadingN++;
436
this.assetsN++;
437
if (!this.assetsLoading[assets[i]] && !this.assetsLoaded[assets[i]])
438
{
439
var img=new Image();
440
img.src=this.domain+assets[i];
441
img.alt=assets[i];
442
img.onload=bind(this,this.onLoad);
443
this.assets[assets[i]]=img;
444
this.assetsLoading.push(assets[i]);
445
}
446
}
447
}
448
this.Replace=function(old,newer)
449
{
450
if (this.assets[old])
451
{
452
var img=new Image();
453
if (newer.indexOf('http')!=-1) img.src=newer;
454
else img.src=this.domain+newer;
455
img.alt=newer;
456
img.onload=bind(this,this.onLoad);
457
this.assets[old]=img;
458
}
459
}
460
this.onLoadReplace=function()
461
{
462
}
463
this.onLoad=function(e)
464
{
465
this.assetsLoaded.push(e.target.alt);
466
this.assetsLoading.splice(this.assetsLoading.indexOf(e.target.alt),1);
467
this.loadingN--;
468
if (this.doneLoading==0 && this.loadingN<=0 && this.loaded!=0)
469
{
470
this.doneLoading=1;
471
this.loaded();
472
}
473
}
474
this.getProgress=function()
475
{
476
return (1-this.loadingN/this.assetsN);
477
}
478
}
479
480
var Pic=function(what)
481
{
482
if (Game.Loader.assetsLoaded.indexOf(what)!=-1) return Game.Loader.assets[what];
483
else if (Game.Loader.assetsLoading.indexOf(what)==-1) Game.Loader.Load([what]);
484
return Game.Loader.blank;
485
}
486
487
var Sounds=[];
488
var OldPlaySound=function(url,vol)
489
{
490
var volume=1;
491
if (vol!==undefined) volume=vol;
492
if (!Game.volume || volume==0) return 0;
493
if (!Sounds[url]) {Sounds[url]=new Audio(url);Sounds[url].onloadeddata=function(e){e.target.volume=Math.pow(volume*Game.volume/100,2);}}
494
else if (Sounds[url].readyState>=2) {Sounds[url].currentTime=0;Sounds[url].volume=Math.pow(volume*Game.volume/100,2);}
495
Sounds[url].play();
496
}
497
var SoundInsts=[];
498
var SoundI=0;
499
for (var i=0;i<12;i++){SoundInsts[i]=new Audio();}
500
var pitchSupport=false;
501
//note : Chrome turns out to not support webkitPreservesPitch despite the specifications claiming otherwise, and Firefox clips some short sounds when changing playbackRate, so i'm turning the feature off completely until browsers get it together
502
//if (SoundInsts[0].preservesPitch || SoundInsts[0].mozPreservesPitch || SoundInsts[0].webkitPreservesPitch) pitchSupport=true;
503
504
var PlaySound=function(url,vol,pitchVar)
505
{
506
//url : the url of the sound to play (will be cached so it only loads once)
507
//vol : volume between 0 and 1 (multiplied by game volume setting); defaults to 1 (full volume)
508
//(DISABLED) pitchVar : pitch variance in browsers that support it (Firefox only at the moment); defaults to 0.05 (which means pitch can be up to -5% or +5% anytime the sound plays)
509
var volume=1;
510
if (typeof vol!=='undefined') volume=vol;
511
if (!Game.volume || volume==0) return 0;
512
if (!Sounds[url])
513
{
514
//sound isn't loaded, cache it
515
Sounds[url]=new Audio(url);
516
Sounds[url].onloadeddata=function(e){PlaySound(url,vol,pitchVar);}
517
}
518
else if (Sounds[url].readyState>=2)
519
{
520
var sound=SoundInsts[SoundI];
521
SoundI++;
522
if (SoundI>=12) SoundI=0;
523
sound.src=Sounds[url].src;
524
//sound.currentTime=0;
525
sound.volume=Math.pow(volume*Game.volume/100,2);
526
if (pitchSupport)
527
{
528
var pitchVar=(typeof pitchVar==='undefined')?0.05:pitchVar;
529
var rate=1+(Math.random()*2-1)*pitchVar;
530
sound.preservesPitch=false;
531
sound.mozPreservesPitch=false;
532
sound.webkitPreservesPitch=false;
533
sound.playbackRate=rate;
534
}
535
sound.play();
536
}
537
}
538
539
if (!Date.now){Date.now=function now() {return new Date().getTime();};}
540
541
triggerAnim=function(element,anim)
542
{
543
if (!element) return;
544
element.classList.remove(anim);
545
void element.offsetWidth;
546
element.classList.add(anim);
547
};
548
549
var debugStr='';
550
var Debug=function(what)
551
{
552
if (!debugStr) debugStr=what;
553
else debugStr+='; '+what;
554
}
555
556
var Timer={};
557
Timer.t=Date.now();
558
Timer.labels=[];
559
Timer.smoothed=[];
560
Timer.reset=function()
561
{
562
Timer.labels=[];
563
Timer.t=Date.now();
564
}
565
Timer.track=function(label)
566
{
567
if (!Game.sesame) return;
568
var now=Date.now();
569
if (!Timer.smoothed[label]) Timer.smoothed[label]=0;
570
Timer.smoothed[label]+=((now-Timer.t)-Timer.smoothed[label])*0.1;
571
Timer.labels[label]='<div style="padding-left:8px;">'+label+' : '+Math.round(Timer.smoothed[label])+'ms</div>';
572
Timer.t=now;
573
}
574
Timer.clean=function()
575
{
576
if (!Game.sesame) return;
577
var now=Date.now();
578
Timer.t=now;
579
}
580
Timer.say=function(label)
581
{
582
if (!Game.sesame) return;
583
Timer.labels[label]='<div style="border-top:1px solid #ccc;">'+label+'</div>';
584
}
585
586
587
/*=====================================================================================
588
GAME INITIALIZATION
589
=======================================================================================*/
590
var Game={};
591
592
Game.Launch=function()
593
{
594
Game.version=VERSION;
595
Game.beta=BETA;
596
if (window.location.href.indexOf('/beta')>-1) Game.beta=1;
597
Game.https=(location.protocol!='https:')?false:true;
598
Game.mobile=0;
599
Game.touchEvents=0;
600
//if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) Game.mobile=1;
601
//if (Game.mobile) Game.touchEvents=1;
602
//if ('ontouchstart' in document.documentElement) Game.touchEvents=1;
603
604
var css=document.createElement('style');
605
css.type='text/css';
606
css.innerHTML='body .icon,body .crate,body .usesIcon{background-image:url(img/icons.png?v='+Game.version+');}';
607
document.head.appendChild(css);
608
609
Game.baseSeason='';//halloween, christmas, valentines, fools, easter
610
//automatic season detection (might not be 100% accurate)
611
var year=new Date().getFullYear();
612
var leap=(((year%4==0)&&(year%100!=0))||(year%400==0))?1:0;
613
var day=Math.floor((new Date()-new Date(year,0,0))/(1000*60*60*24));
614
if (day>=41 && day<=46) Game.baseSeason='valentines';
615
else if (day+leap>=90 && day<=92+leap) Game.baseSeason='fools';
616
else if (day>=304-7+leap && day<=304+leap) Game.baseSeason='halloween';
617
else if (day>=349+leap && day<=365+leap) Game.baseSeason='christmas';
618
else
619
{
620
//easter is a pain goddamn
621
var easterDay=function(Y){var C = Math.floor(Y/100);var N = Y - 19*Math.floor(Y/19);var K = Math.floor((C - 17)/25);var I = C - Math.floor(C/4) - Math.floor((C - K)/3) + 19*N + 15;I = I - 30*Math.floor((I/30));I = I - Math.floor(I/28)*(1 - Math.floor(I/28)*Math.floor(29/(I + 1))*Math.floor((21 - N)/11));var J = Y + Math.floor(Y/4) + I + 2 - C + Math.floor(C/4);J = J - 7*Math.floor(J/7);var L = I - J;var M = 3 + Math.floor((L + 40)/44);var D = L + 28 - 31*Math.floor(M/4);return new Date(Y,M-1,D);}(year);
622
easterDay=Math.floor((easterDay-new Date(easterDay.getFullYear(),0,0))/(1000*60*60*24));
623
if (day>=easterDay-7 && day<=easterDay) Game.baseSeason='easter';
624
}
625
626
Game.updateLog=
627
'<div class="selectable">'+
628
'<div class="section">Info</div>'+
629
'<div class="subsection">'+
630
'<div class="title">About</div>'+
631
'<div class="listing">Cookie Clicker is a javascript game by <a href="//orteil.dashnet.org" target="_blank">Orteil</a> and <a href="//dashnet.org" target="_blank">Opti</a>.</div>'+
632
//'<div class="listing">We have an <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord</a>, as well as a <a href="http://forum.dashnet.org" target="_blank">forum</a>; '+
633
'<div class="listing">We have an <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord</a>; '+
634
'if you\'re looking for help, you may also want to visit the <a href="http://www.reddit.com/r/CookieClicker" target="_blank">subreddit</a> '+
635
'or the <a href="http://cookieclicker.wikia.com/wiki/Cookie_Clicker_Wiki" target="_blank">wiki</a>.</div>'+
636
'<div class="listing">News and teasers are usually posted on my <a href="https://orteil42.tumblr.com/" target="_blank">tumblr</a> and <a href="https://twitter.com/orteil42" target="_blank">twitter</a>.</div>'+
637
'<div class="listing" id="supportSection"><b style="color:#fff;opacity:1;">Cookie Clicker is 100% free, forever.</b> Want to support us so we can keep developing games? Here\'s some ways you can help :<div style="margin:4px 12px;line-height:150%;">'+
638
'<br>&bull; support us on <a href="https://www.patreon.com/dashnet" target="_blank" class="highlightHover" style="background:#f86754;box-shadow:0px 0px 0px 1px #c52921 inset,0px 2px 0px #ff966d inset;text-shadow:0px -1px 0px #ff966d,0px 1px 0px #c52921;text-decoration:none;color:#fff;font-weight:bold;padding:1px 4px;">Patreon</a> <span style="opacity:0.5;">(there\'s perks!)</span>'+
639
'<br>&bull; <form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post" id="donate"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="BBN2WL3TC6QH4"><input type="submit" id="donateButton" value="donate" name="submit" alt="PayPal — The safer, easier way to pay online."><img alt="" border="0" src="https://www.paypalobjects.com/nl_NL/i/scr/pixel.gif" width="1" height="1"></form> to our PayPal <span style="opacity:0.5;">(note: PayPal takes at least $0.32 in fees so only amounts above that reach us!)</span>'+
640
'<br>&bull; disable your adblocker<br>&bull; check out our <a href="http://www.redbubble.com/people/dashnet" target="_blank">rad cookie shirts, hoodies and stickers</a>!<br>&bull; (if you want!)</div></div>'+
641
'<div class="listing warning">Note : if you find a new bug after an update and you\'re using a 3rd-party add-on, make sure it\'s not just your add-on causing it!</div>'+
642
'<div class="listing warning">Warning : clearing your browser cache or cookies <small>(what else?)</small> will result in your save being wiped. Export your save and back it up first!</div>'+
643
644
'</div><div class="subsection">'+
645
'<div class="title">Version history</div>'+
646
647
'</div><div class="subsection update">'+
648
'<div class="title">01/11/2020 - alternate reality</div>'+
649
'<div class="listing">&bull; new building</div>'+
650
'<div class="listing">&bull; new upgrade tier</div>'+
651
'<div class="listing">&bull; new achievement tier</div>'+
652
'<div class="listing">&bull; new heavenly upgrades</div>'+
653
'<div class="listing">&bull; new modding API</div>'+
654
'<div class="listing">&bull; new rebalancing (ascension slot prices, finger upgrades...)</div>'+
655
'<div class="listing">&bull; new fixes (leap years, ghost swaps, carryover seeds...)</div>'+
656
'<div class="listing">&bull; new stuff</div>'+
657
658
'</div><div class="subsection update small">'+
659
'<div class="title">23/08/2020 - money me, money now</div>'+
660
'<div class="listing">&bull; finalized stock market minigame beta and added it to live version</div>'+
661
'<div class="listing">&bull; dark mode added to stock market minigame</div>'+
662
'<div class="listing">&bull; can no longer select a milk before unlocking it; milk selector layout has been improved</div>'+
663
'<div class="listing">&bull; stock market goods have higher value caps and a larger spread; can also shift-click the hide buttons to hide/show all other stocks</div>'+
664
665
'</div><div class="subsection update small">'+
666
'<div class="title">08/08/2020 - checking account (beta)</div>'+
667
'<div class="listing">&bull; stock market layout has been revised</div>'+
668
'<div class="listing">&bull; selling stocks no longer increases cookies baked all time</div>'+
669
'<div class="listing">&bull; stock prices are now defined by your highest raw CpS this ascension (which is now displayed in the stats screen)</div>'+
670
'<div class="listing">&bull; can no longer buy and sell a stock in the same tick</div>'+
671
'<div class="listing">&bull; warehouse space now gains +10 per associated building level (up from +5)</div>'+
672
'<div class="listing">&bull; bank level now improves average (and maximum) stock values</div>'+
673
'<div class="listing">&bull; later stocks are worth more</div>'+
674
'<div class="listing">&bull; Cookie Clicker turns 7!</div>'+
675
676
'</div><div class="subsection update">'+
677
'<div class="title">18/06/2020 - making bank (beta)</div>'+
678
'<div class="listing">&bull; added the stock market minigame, accessible with level 1 banks or above; buy low, sell high!</div>'+
679
'<div class="listing">&bull; (minigame subject to heavy rebalancing over the coming patches)</div>'+
680
'<div class="listing">&bull; added a couple heavenly upgrades, including one that lets you pet your dragon</div>'+
681
'<div class="listing">&bull; added a new tier of building upgrades and achievements</div>'+
682
'<div class="listing">&bull; reindeer clicks now properly count for shimmering veil</div>'+
683
'<div class="listing">&bull; numbers in scientific notation should display better with Short numbers off</div>'+
684
'<div class="listing">&bull; replaced ツ in the javascript console building display with more accurate ッ</div>'+
685
686
'</div><div class="subsection update">'+
687
'<div class="title">28/09/2019 - going off-script</div>'+
688
'<div class="listing">&bull; added a new building</div>'+
689
'<div class="listing">&bull; added fortune cookies (a new heavenly upgrade)</div>'+
690
'<div class="listing">&bull; more upgrades, achievements etc</div>'+
691
'<div class="listing">&bull; updated the Russian bread cookies icon to better reflect their cyrillic origins</div>'+
692
'<div class="listing">&bull; <i style="font-style:italic;">stealth update :</i> the sugar lump refill timeout (not sugar lump growth) now no longer ticks down while the game is closed (this fixes an exploit)</div>'+
693
'<div class="listing">&bull; also released the official Android version of Cookie Clicker, playable <a href="https://play.google.com/store/apps/details?id=org.dashnet.cookieclicker" target="_blank">here</a> (iOS version will come later)</div>'+
694
695
'</div><div class="subsection update small">'+
696
'<div class="title">01/04/2019 - 2.019 (the "this year" update)</div>'+
697
'<div class="listing">&bull; game has been renamed to "Cookie Clicker" to avoid confusion</div>'+
698
'<div class="listing">&bull; can now click the big cookie to generate cookies for free</div>'+
699
'<div class="listing">&bull; removed fall damage</div>'+
700
//'<div class="listing">&bull; fixed various typos : player\'s name is now correctly spelled as "[bakeryName]"</div>'+
701
'<div class="listing">&bull; removed all references to computer-animated movie <i style="font-style:italic;">Hoodwinked!</i> (2005)</div>'+
702
'<div class="listing">&bull; went back in time and invented cookies and computer mice, ensuring Cookie Clicker would one day come to exist</div>'+
703
'<div class="listing">&bull; game now fully compliant with Geneva Conventions</div>'+
704
'<div class="listing">&bull; dropped support for TI-84 version</div>'+
705
'<div class="listing">&bull; released a low-res retro version of the game, playable here : <a href="//orteil.dashnet.org/experiments/cookie/" target="_blank">orteil.dashnet.org/experiments/cookie</a></div>'+
706
'<div class="listing">&bull; updated version number</div>'+
707
708
'</div><div class="subsection update small">'+
709
'<div class="title">05/03/2019 - cookies for days</div>'+
710
'<div class="listing">&bull; added over 20 new cookies, all previously suggested by our supporters on <a href="https://www.patreon.com/dashnet" target="_blank">Patreon</a></div>'+
711
'<div class="listing">&bull; added 2 heavenly upgrades</div>'+
712
'<div class="listing">&bull; the Golden goose egg now counts as a golden cookie upgrade for Residual luck purposes</div>'+
713
'<div class="listing">&bull; golden sugar lumps now either double your cookies, or give you 24 hours of your CpS, whichever is lowest (previously was doubling cookies with no cap)</div>'+
714
'<div class="listing">&bull; the amount of heralds is now saved with your game, and is used to compute offline CpS the next time the game is loaded; previously, on page load, the offline calculation assumed heralds to be 0</div>'+
715
'<div class="listing">&bull; added a system to counteract the game freezing up (and not baking cookies) after being inactive for a long while on slower computers; instead, this will now trigger sleep mode, during which you still produce cookies as if the game was closed; to enable this feature, use the "Sleep mode timeout" option in the settings</div>'+
716
'<div class="listing">&bull; vaulting upgrades is now done with shift-click, as ctrl-click was posing issues for Mac browsers</div>'+
717
'<div class="listing">&bull; made tooltips for building CpS boosts from synergies hopefully clearer</div>'+
718
'<div class="listing">&bull; fixed an exploit with gambler\'s fever dream working across exports and ascensions</div>'+
719
'<div class="listing">&bull; can now hide tooltips in the garden by keeping the shift key pressed to make it easier to see where you\'re planting</div>'+
720
'<div class="listing">&bull; fixed a bug with golden cookies/reindeer not disappearing properly in some circumstances</div>'+
721
'<div class="listing">&bull; the Dragon\'s Curve aura should now properly make sugar lumps twice as weird</div>'+
722
'<div class="listing">&bull; the ctrl key should less often register incorrectly as pressed</div>'+
723
'<div class="listing">&bull; added a new ad slot in the top-right, as while our playerbase is strong and supportive as ever, our ad revenue sometimes fluctuates badly; we may remove the ad again should our income stabilize</div>'+
724
'<div class="listing">&bull; made a few adjustments to make the game somewhat playable in mobile browsers; it\'s not perfect and can get buggy, but it\'s functional! (you may need to zoom out or scroll around to view the game properly)</div>'+
725
'<div class="listing">&bull; speaking of which, we also got some good progress on the mobile app version (built from scratch for mobile), so stay tuned!</div>'+
726
727
'</div><div class="subsection update">'+
728
'<div class="title">25/10/2018 - feedback loop</div>'+
729
'<div class="listing">&bull; added a new building</div>'+
730
'<div class="listing">&bull; launched our <a href="https://www.patreon.com/dashnet" class="orangeLink" target="_blank">Patreon</a> <span style="font-size:80%;">(the link is orange so you\'ll notice it!)</span></div>'+
731
'<div class="listing">&bull; added a bunch of new heavenly upgrades, one of which ties into our Patreon but benefits everyone (this is still experimental!)</div>'+
732
'<div class="listing">&bull; when hovering over grandmas, you can now see their names and ages</div>'+
733
'<div class="listing">&bull; "make X cookies just from Y" requirements are now higher</div>'+
734
'<div class="listing">&bull; tweaked the prices of some heavenly upgrades to better fit the current cookie economy (it turns out billions of heavenly chips is now very achievable)</div>'+
735
'<div class="listing">&bull; building tooltips now display what % of CpS they contribute through synergy upgrades</div>'+
736
'<div class="listing">&bull; queenbeets now give up to 4% of bank, down from 6%</div>'+
737
'<div class="listing">&bull; among other things, season switches now display how many seasonal upgrades you\'re missing, and permanent upgrade slots now display the name of the slotted upgrade</div>'+
738
'<div class="listing">&bull; season switches have reworked prices</div>'+
739
'<div class="listing">&bull; season switches can now be cancelled by clicking them again</div>'+
740
'<div class="listing">&bull; can no longer accidentally click wrinklers through other elements</div>'+
741
'<div class="listing">&bull; sugar frenzy now triples your CpS for an hour instead of doubling it</div>'+
742
'<div class="listing">&bull; this text is now selectable</div>'+
743
'<div class="listing">&bull; progress on dungeons minigame is still very much ongoing</div>'+
744
745
'</div><div class="subsection update small">'+
746
'<div class="title">08/08/2018 - hey now</div>'+
747
'<div class="listing">&bull; Cookie Clicker somehow turns 5, going against doctors\' most optimistic estimates</div>'+
748
'<div class="listing">&bull; added a new tier of building achievements, all named after Smash Mouth\'s classic 1999 hit "All Star"</div>'+
749
'<div class="listing">&bull; added a new tier of building upgrades, all named after nothing in particular</div>'+
750
'<div class="listing">&bull; <b>to our players :</b> thank you so much for sticking with us all those years and allowing us to keep making the dumbest game known to mankind</div>'+
751
'<div class="listing">&bull; resumed work on the dungeons minigame</div>'+
752
753
'</div><div class="subsection update small">'+
754
'<div class="title">01/08/2018 - buy buy buy</div>'+
755
'<div class="listing">&bull; added a heavenly upgrade that lets you buy all your upgrades instantly</div>'+
756
'<div class="listing">&bull; added a heavenly upgrade that lets you see upgrade tiers (feature was previously removed due to being confusing)</div>'+
757
'<div class="listing">&bull; added a new wrinkler-related heavenly upgrade</div>'+
758
'<div class="listing">&bull; added a new upgrade tier</div>'+
759
'<div class="listing">&bull; added a couple new cookies and achievements</div>'+
760
'<div class="listing">&bull; new "extra buttons" setting; turning it on adds buttons that let you minimize buildings</div>'+
761
'<div class="listing">&bull; new "lump confirmation" setting; turning it on will show a confirmation prompt when you spend sugar lumps</div>'+
762
'<div class="listing">&bull; buildings now sell back for 25% of their current price (down from 50%); Earth Shatterer modified accordingly, now gives back 50% (down from 85%)</div>'+
763
'<div class="listing">&bull; farm soils now unlock correctly based on current amount of farms</div>'+
764
'<div class="listing">&bull; cheapcaps have a new exciting nerf</div>'+
765
'<div class="listing">&bull; wrinklegill spawns a bunch more</div>'+
766
'<div class="listing">&bull; can now ctrl-shift-click on "Harvest all" to only harvest mature, non-immortal plants</div>'+
767
'<div class="listing">&bull; added a new rare type of sugar lump</div>'+
768
769
'</div><div class="subsection update small">'+
770
'<div class="title">20/04/2018 - weeding out some bugs</div>'+
771
'<div class="listing">&bull; golden clovers and wrinklegills should spawn a bit more often</div>'+
772
'<div class="listing">&bull; cronerice matures a lot sooner</div>'+
773
'<div class="listing">&bull; mature elderworts stay mature after reloading</div>'+
774
'<div class="listing">&bull; garden interface occupies space more intelligently</div>'+
775
'<div class="listing">&bull; seed price displays should be better behaved with short numbers disabled</div>'+
776
'<div class="listing">&bull; minigame animations are now turned off if using the "Fancy graphics" option is disabled</div>'+
777
'<div class="listing">&bull; CpS achievement requirements were dialed down a wee tad</div>'+
778
779
'</div><div class="subsection update small">'+
780
'<div class="title">19/04/2018 - garden patch</div>'+
781
'<div class="listing">&bull; upgrades dropped by garden plants now stay unlocked forever (but drop much more rarely)</div>'+
782
'<div class="listing">&bull; garden sugar lump refill now also makes plants spread and mutate 3 times more during the bonus tick</div>'+
783
'<div class="listing">&bull; a few new upgrades</div>'+
784
'<div class="listing">&bull; a couple bug fixes and rephrasings</div>'+
785
786
'</div><div class="subsection update">'+
787
'<div class="title">18/04/2018 - your garden-variety update</div>'+
788
'<div class="listing">&bull; added the garden, a minigame unlocked by having at least level 1 farms</div>'+
789
'<div class="listing">&bull; added a little arrow and a blinky label to signal the game has updated since you last played it (hi!)</div>'+
790
'<div class="listing">&bull; new cookies, milk flavors and achievements</div>'+
791
'<div class="listing">&bull; sugar lumps are now unlocked whenever you\'ve baked at least a billion cookies, instead of on your first ascension</div>'+
792
'<div class="listing">&bull; sugar lump type now saves correctly</div>'+
793
'<div class="listing">&bull; minigame sugar lump refills can now only be done every 15 minutes (timer shared across all minigames)</div>'+
794
'<div class="listing">&bull; CpS achievements now have steeper requirements</div>'+
795
'<div class="listing">&bull; golden cookies now last 5% shorter for every other golden cookie on the screen</div>'+
796
'<div class="listing">&bull; the game now remembers which minigames are closed or open</div>'+
797
'<div class="listing">&bull; added a popup that shows when a season starts (so people won\'t be so confused about "the game looking weird today")</div>'+
798
'<div class="listing">&bull; permanent upgrade slots now show a tooltip for the selected upgrade</div>'+
799
'<div class="listing">&bull; finally fixed the save corruption bug, hopefully</div>'+
800
801
'</div><div class="subsection update small">'+
802
'<div class="title">24/02/2018 - sugar coating</div>'+
803
'<div class="listing">&bull; added link to <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord server</a></div>'+
804
'<div class="listing">&bull; felt weird about pushing an update without content so :</div>'+
805
'<div class="listing">&bull; added a handful of new cookies</div>'+
806
'<div class="listing">&bull; added 3 new heavenly upgrades</div>'+
807
'<div class="listing">&bull; short numbers should now be displayed up to novemnonagintillions</div>'+
808
'<div class="listing">&bull; cookie chains no longer spawn from the Force the Hand of Fate spell</div>'+
809
'<div class="listing">&bull; bigger, better Cookie Clicker content coming later this year</div>'+
810
811
'</div><div class="subsection update">'+
812
'<div class="title">08/08/2017 - 4 more years</div>'+
813
'<div class="listing">&bull; new building : Chancemakers</div>'+
814
'<div class="listing">&bull; new milk, new kittens, new dragon aura, new cookie, new upgrade tier</div>'+
815
'<div class="listing">&bull; buffs no longer affect offline CpS</div>'+
816
'<div class="listing">&bull; Godzamok\'s hunger was made less potent (this is a nerf, very sorry)</div>'+
817
'<div class="listing">&bull; grimoire spell costs and maximum magic work differently</div>'+
818
'<div class="listing">&bull; Spontaneous Edifice has been reworked</div>'+
819
'<div class="listing">&bull; changed unlock levels and prices for some cursor upgrades</div>'+
820
'<div class="listing">&bull; fixed buggy pantheon slots, hopefully</div>'+
821
'<div class="listing">&bull; fixed "Legacy started a long while ago" showing as "a few seconds ago"</div>'+
822
'<div class="listing">&bull; Cookie Clicker just turned 4. Thank you for sticking with us this long!</div>'+
823
824
'</div><div class="subsection update">'+
825
'<div class="title">15/07/2017 - the spiritual update</div>'+
826
'<div class="listing">&bull; implemented sugar lumps, which start coalescing if you\'ve ascended at least once and can be used as currency for special things</div>'+
827
'<div class="listing">&bull; buildings can now level up by using sugar lumps in the main buildings display, permanently boosting their CpS</div>'+
828
'<div class="listing">&bull; added two new features unlocked by levelling up their associated buildings, Temples and Wizard towers; more building-related minigames will be implemented in the future</div>'+
829
'<div class="listing">&bull; active buffs are now saved</div>'+
830
'<div class="listing">&bull; the background selector upgrade is now functional</div>'+
831
'<div class="listing">&bull; the top menu no longer scrolls with the rest</div>'+
832
'<div class="listing">&bull; timespans are written nicer</div>'+
833
'<div class="listing">&bull; Dragonflights now tend to supercede Click frenzies, you will rarely have both at the same time</div>'+
834
'<div class="listing">&bull; some old bugs were phased out and replaced by new ones</div>'+
835
836
'</div><div class="subsection update small">'+
837
'<div class="title">24/07/2016 - golden cookies overhaul</div>'+
838
'<div class="listing">&bull; golden cookies and reindeer now follow a new system involving explicitly defined buffs</div>'+
839
'<div class="listing">&bull; a bunch of new golden cookie effects have been added</div>'+
840
'<div class="listing">&bull; CpS gains from eggs are now multiplicative</div>'+
841
'<div class="listing">&bull; shiny wrinklers are now saved</div>'+
842
'<div class="listing">&bull; reindeer have been rebalanced ever so slightly</div>'+
843
'<div class="listing">&bull; added a new cookie upgrade near the root of the heavenly upgrade tree; this is intended to boost early ascensions and speed up the game as a whole</div>'+
844
'<div class="listing">&bull; due to EU legislation, implemented a warning message regarding browser cookies; do understand that the irony is not lost on us</div>'+
845
846
'</div><div class="subsection update">'+
847
'<div class="title">08/02/2016 - legacy</div>'+
848
'<div class="listing"><b>Everything that was implemented during the almost 2-year-long beta has been added to the live game. To recap :</b></div>'+
849
'<div class="listing">&bull; 3 new buildings : banks, temples, and wizard towers; these have been added in-between existing buildings and as such, may disrupt some building-related achievements</div>'+
850
'<div class="listing">&bull; the ascension system has been redone from scratch, with a new heavenly upgrade tree</div>'+
851
'<div class="listing">&bull; mysterious new features such as angel-powered offline progression, challenge runs, and a cookie dragon</div>'+
852
'<div class="listing">&bull; sounds have been added (can be disabled in the options)</div>'+
853
'<div class="listing">&bull; heaps of rebalancing and bug fixes</div>'+
854
'<div class="listing">&bull; a couple more upgrades and achievements, probably</div>'+
855
'<div class="listing">&bull; fresh new options to further customize your cookie-clicking experience</div>'+
856
'<div class="listing">&bull; quality-of-life improvements : better bulk-buy, better switches etc</div>'+
857
'<div class="listing">&bull; added some <a href="http://en.wikipedia.org/wiki/'+choose(['Krzysztof_Arciszewski','Eustachy_Sanguszko','Maurycy_Hauke','Karol_Turno','Tadeusz_Kutrzeba','Kazimierz_Fabrycy','Florian_Siwicki'])+'" target="_blank">general polish</a></div>'+/* i liked this dumb pun too much to let it go unnoticed */
858
'<div class="listing">&bull; tons of other little things we can\'t even remember right now</div>'+
859
'<div class="listing">Miss the old version? Your old save was automatically exported <a href="//orteil.dashnet.org/cookieclicker/v10466/" target="_blank">here</a>!</div>'+
860
861
'</div><div class="subsection update small">'+
862
'<div class="title">05/02/2016 - legacy beta, more fixes</div>'+
863
'<div class="listing">&bull; added challenge modes, which can be selected when ascending (only 1 for now : "Born again")</div>'+
864
'<div class="listing">&bull; changed the way bulk-buying and bulk-selling works</div>'+
865
'<div class="listing">&bull; more bugs ironed out</div>'+
866
867
'</div><div class="subsection update">'+
868
'<div class="title">03/02/2016 - legacy beta, part III</div>'+
869
'<div class="listing warning">&bull; Not all bugs have been fixed, but everything should be much less broken.</div>'+
870
'<div class="listing">&bull; Additions'+
871
'<div style="opacity:0.8;margin-left:12px;">'+
872
'-a few more achievements<br>'+
873
'-new option for neat, but slow CSS effects (disabled by default)<br>'+
874
'-new option for a less grating cookie sound (enabled by default)<br>'+
875
'-new option to bring back the boxes around icons in the stats screen<br>'+
876
'-new buttons for saving and loading your game to a text file<br>'+
877
'</div>'+
878
'</div>'+
879
'<div class="listing">&bull; Changes'+
880
'<div style="opacity:0.8;margin-left:12px;">'+
881
'-early game should be a bit faster and very late game was kindly asked to tone it down a tad<br>'+
882
'-dragonflight should be somewhat less ridiculously overpowered<br>'+
883
'-please let me know if the rebalancing was too heavy or not heavy enough<br>'+
884
'-santa and easter upgrades now depend on Santa level and amount of eggs owned, respectively, instead of costing several minutes worth of CpS<br>'+
885
'-cookie upgrades now stack multiplicatively rather than additively<br>'+
886
'-golden switch now gives +50% CpS, and residual luck is +10% CpS per golden cookie upgrade (up from +25% and +1%, respectively)<br>'+
887
'-lucky cookies and cookie chain payouts have been modified a bit, possibly for the better, who knows!<br>'+
888
'-wrinklers had previously been reduced to a maximum of 8 (10 with a heavenly upgrade), but are now back to 10 (12 with the upgrade)<br>'+
889
/*'-all animations are now handled by requestAnimationFrame(), which should hopefully help make the game less resource-intensive<br>'+*/
890
'-an ascension now only counts for achievement purposes if you earned at least 1 prestige level from it<br>'+
891
'-the emblematic Cookie Clicker font (Kavoon) was bugged in Firefox, and has been replaced with a new font (Merriweather)<br>'+
892
'-the mysterious wrinkly creature is now even rarer, but has a shadow achievement tied to it<br>'+
893
'</div>'+
894
'</div>'+
895
'<div class="listing">&bull; Fixes'+
896
'<div style="opacity:0.8;margin-left:12px;">'+
897
'-prestige now grants +1% CpS per level as intended, instead of +100%<br>'+
898
'-heavenly chips should no longer add up like crazy when you ascend<br>'+
899
'-upgrades in the store should no longer randomly go unsorted<br>'+
900
'-window can be resized to any size again<br>'+
901
'-the "Stats" and "Options" buttons have been swapped again<br>'+
902
'-the golden cookie sound should be somewhat clearer<br>'+
903
'-the ascend screen should be less CPU-hungry<br>'+
904
'</div>'+
905
'</div>'+
906
907
'</div><div class="subsection update">'+
908
'<div class="title">20/12/2015 - legacy beta, part II</div>'+
909
'<div class="listing warning">&bull; existing beta saves have been wiped due to format inconsistencies and just plain broken balance; you\'ll have to start over from scratch - which will allow you to fully experience the update and find all the awful little bugs that no doubt plague it</div>'+
910
'<div class="listing warning">&bull; importing your save from the live version is also fine</div>'+
911
'<div class="listing">&bull; we took so long to make this update, Cookie Clicker turned 2 years old in the meantime! Hurray!</div>'+
912
'<div class="listing">&bull; heaps of new upgrades and achievements</div>'+
913
'<div class="listing">&bull; fixed a whole bunch of bugs</div>'+
914
'<div class="listing">&bull; did a lot of rebalancing</div>'+
915
'<div class="listing">&bull; reworked heavenly chips and heavenly cookies (still experimenting, will probably rebalance things further)</div>'+
916
'<div class="listing">&bull; you may now unlock a dragon friend</div>'+
917
'<div class="listing">&bull; switches and season triggers now have their own store section</div>'+
918
'<div class="listing">&bull; ctrl-s and ctrl-o now save the game and open the import menu, respectively</div>'+
919
'<div class="listing">&bull; added some quick sounds, just as a test</div>'+
920
'<div class="listing">&bull; a couple more options</div>'+
921
'<div class="listing">&bull; even more miscellaneous changes and additions</div>'+
922
923
'</div><div class="subsection update">'+
924
'<div class="title">25/08/2014 - legacy beta, part I</div>'+
925
'<div class="listing">&bull; 3 new buildings</div>'+
926
'<div class="listing">&bull; price and CpS curves revamped</div>'+
927
'<div class="listing">&bull; CpS calculations revamped; cookie upgrades now stack multiplicatively</div>'+
928
'<div class="listing">&bull; prestige system redone from scratch, with a whole new upgrade tree</div>'+
929
'<div class="listing">&bull; added some <a href="http://en.wikipedia.org/wiki/'+choose(['Krzysztof_Arciszewski','Eustachy_Sanguszko','Maurycy_Hauke','Karol_Turno','Tadeusz_Kutrzeba','Kazimierz_Fabrycy','Florian_Siwicki'])+'" target="_blank">general polish</a></div>'+
930
'<div class="listing">&bull; tons of other miscellaneous fixes and additions</div>'+
931
'<div class="listing">&bull; Cookie Clicker is now 1 year old! (Thank you guys for all the support!)</div>'+
932
'<div class="listing warning">&bull; Note : this is a beta; you are likely to encounter bugs and oversights. Feel free to send me feedback if you find something fishy!</div>'+
933
934
'</div><div class="subsection update small">'+
935
'<div class="title">18/05/2014 - better late than easter</div>'+
936
'<div class="listing">&bull; bunnies and eggs, somehow</div>'+
937
'<div class="listing">&bull; prompts now have keyboard shortcuts like system prompts would</div>'+
938
'<div class="listing">&bull; naming your bakery? you betcha</div>'+
939
'<div class="listing">&bull; "Fast notes" option to make all notifications close faster; new button to close all notifications</div>'+
940
'<div class="listing">&bull; the dungeons beta is now available on <a href="//orteil.dashnet.org/cookieclicker/betadungeons" target="_blank">/betadungeons</a></div>'+
941
942
'</div><div class="subsection update small">'+
943
'<div class="title">09/04/2014 - nightmare in heaven</div>'+
944
'<div class="listing">&bull; broke a thing; heavenly chips were corrupted for some people</div>'+
945
'<div class="listing">&bull; will probably update to /beta first in the future</div>'+
946
'<div class="listing">&bull; sorry again</div>'+
947
948
'</div><div class="subsection update small">'+
949
'<div class="title">09/04/2014 - quality of life</div>'+
950
'<div class="listing">&bull; new upgrade and achievement tier</div>'+
951
'<div class="listing">&bull; popups and prompts are much nicer</div>'+
952
'<div class="listing">&bull; tooltips on buildings are more informative</div>'+
953
'<div class="listing">&bull; implemented a simplified version of the <a href="https://github.com/Icehawk78/FrozenCookies" target="_blank">Frozen Cookies</a> add-on\'s short number formatting</div>'+
954
'<div class="listing">&bull; you can now buy 10 and sell all of a building at a time</div>'+
955
'<div class="listing">&bull; tons of optimizations and subtler changes</div>'+
956
'<div class="listing">&bull; you can now <a href="//orteil.dashnet.org/cookies2cash/" target="_blank">convert your cookies to cash</a>!</div>'+
957
958
'</div><div class="subsection update small">'+
959
'<div class="title">05/04/2014 - pity the fool</div>'+
960
'<div class="listing">&bull; wrinklers should now be saved so you don\'t have to pop them everytime you refresh the game</div>'+
961
'<div class="listing">&bull; you now properly win 1 cookie upon reaching 10 billion cookies and making it on the local news</div>'+
962
'<div class="listing">&bull; miscellaneous fixes and tiny additions</div>'+
963
'<div class="listing">&bull; added a few very rudimentary mod hooks</div>'+
964
'<div class="listing">&bull; the game should work again in Opera</div>'+
965
'<div class="listing">&bull; don\'t forget to check out <a href="//orteil.dashnet.org/randomgen/" target="_blank">RandomGen</a>, our all-purpose random generator maker!</div>'+
966
967
'</div><div class="subsection update small">'+
968
'<div class="title">01/04/2014 - fooling around</div>'+
969
'<div class="listing">&bull; it\'s about time : Cookie Clicker has turned into the much more realistic Cookie Baker</div>'+
970
'<div class="listing">&bull; season triggers are cheaper and properly unlock again when they run out</div>'+
971
'<div class="listing">&bull; buildings should properly unlock (reminder : building unlocking is completely cosmetic and does not change the gameplay)</div>'+
972
973
'</div><div class="subsection update small">'+
974
'<div class="title">14/02/2014 - lovely rainbowcalypse</div>'+
975
'<div class="listing">&bull; new building (it\'s been a while). More to come!</div>'+
976
'<div class="listing">&bull; you can now trigger seasonal events to your heart\'s content (upgrade unlocks at 5000 heavenly chips)</div>'+
977
'<div class="listing">&bull; new ultra-expensive batch of seasonal cookie upgrades you\'ll love to hate</div>'+
978
'<div class="listing">&bull; new timer bars for golden cookie buffs</div>'+
979
'<div class="listing">&bull; buildings are now hidden when you start out and appear as they become available</div>'+
980
'<div class="listing">&bull; technical stuff : the game is now saved through localstorage instead of browser cookies, therefore ruining a perfectly good pun</div>'+
981
982
'</div><div class="subsection update small">'+
983
'<div class="title">22/12/2013 - merry fixmas</div>'+
984
'<div class="listing">&bull; some issues with the christmas upgrades have been fixed</div>'+
985
'<div class="listing">&bull; reindeer cookie drops are now more common</div>'+
986
'<div class="listing">&bull; reindeers are now reindeer</div>'+
987
988
'</div><div class="subsection update">'+
989
'<div class="title">20/12/2013 - Christmas is here</div>'+
990
'<div class="listing">&bull; there is now a festive new evolving upgrade in store</div>'+
991
'<div class="listing">&bull; reindeer are running amok (catch them if you can!)</div>'+
992
'<div class="listing">&bull; added a new option to warn you when you close the window, so you don\'t lose your un-popped wrinklers</div>'+
993
'<div class="listing">&bull; also added a separate option for displaying cursors</div>'+
994
'<div class="listing">&bull; all the Halloween features are still there (and having the Spooky cookies achievements makes the Halloween cookies drop much more often)</div>'+
995
'<div class="listing">&bull; oh yeah, we now have <a href="http://www.redbubble.com/people/dashnet" target="_blank">Cookie Clicker shirts, stickers and hoodies</a>! (they\'re really rad)</div>'+
996
997
'</div><div class="subsection update small">'+
998
'<div class="title">29/10/2013 - spooky update</div>'+
999
'<div class="listing">&bull; the Grandmapocalypse now spawns wrinklers, hideous elderly creatures that damage your CpS when they reach your big cookie. Thankfully, you can click on them to make them explode (you\'ll even gain back the cookies they\'ve swallowed - with interest!).</div>'+
1000
'<div class="listing">&bull; wrath cookie now 27% spookier</div>'+
1001
'<div class="listing">&bull; some other stuff</div>'+
1002
'<div class="listing">&bull; you should totally go check out <a href="http://candybox2.net/" target="_blank">Candy Box 2</a>, the sequel to the game that inspired Cookie Clicker</div>'+
1003
1004
'</div><div class="subsection update small">'+
1005
'<div class="title">15/10/2013 - it\'s a secret</div>'+
1006
'<div class="listing">&bull; added a new heavenly upgrade that gives you 5% of your heavenly chips power for 11 cookies (if you purchased the Heavenly key, you might need to buy it again, sorry)</div>'+
1007
'<div class="listing">&bull; golden cookie chains should now work properly</div>'+
1008
1009
'</div><div class="subsection update small">'+
1010
'<div class="title">15/10/2013 - player-friendly</div>'+
1011
'<div class="listing">&bull; heavenly upgrades are now way, way cheaper</div>'+
1012
'<div class="listing">&bull; tier 5 building upgrades are 5 times cheaper</div>'+
1013
'<div class="listing">&bull; cursors now just plain disappear with Fancy Graphics off, I might add a proper option to toggle only the cursors later</div>'+
1014
'<div class="listing">&bull; warning : the Cookie Monster add-on seems to be buggy with this update, you might want to wait until its programmer updates it</div>'+
1015
1016
'</div><div class="subsection update small">'+
1017
'<div class="title">15/10/2013 - a couple fixes</div>'+
1018
'<div class="listing">&bull; golden cookies should no longer spawn embarrassingly often</div>'+
1019
'<div class="listing">&bull; cursors now stop moving if Fancy Graphics is turned off</div>'+
1020
1021
'</div><div class="subsection update small">'+
1022
'<div class="title">14/10/2013 - going for the gold</div>'+
1023
'<div class="listing">&bull; golden cookie chains work a bit differently</div>'+
1024
'<div class="listing">&bull; golden cookie spawns are more random</div>'+
1025
'<div class="listing">&bull; CpS achievements are no longer affected by golden cookie frenzies</div>'+
1026
'<div class="listing">&bull; revised cookie-baking achievement requirements</div>'+
1027
'<div class="listing">&bull; heavenly chips now require upgrades to function at full capacity</div>'+
1028
'<div class="listing">&bull; added 4 more cookie upgrades, unlocked after reaching certain amounts of Heavenly Chips</div>'+
1029
'<div class="listing">&bull; speed baking achievements now require you to have no heavenly upgrades; as such, they have been reset for everyone (along with the Hardcore achievement) to better match their initially intended difficulty</div>'+
1030
'<div class="listing">&bull; made good progress on the mobile port</div>'+
1031
1032
'</div><div class="subsection update small">'+
1033
'<div class="title">01/10/2013 - smoothing it out</div>'+
1034
'<div class="listing">&bull; some visual effects have been completely rewritten and should now run more smoothly (and be less CPU-intensive)</div>'+
1035
'<div class="listing">&bull; new upgrade tier</div>'+
1036
'<div class="listing">&bull; new milk tier</div>'+
1037
'<div class="listing">&bull; cookie chains have different capping mechanics</div>'+
1038
'<div class="listing">&bull; antimatter condensers are back to their previous price</div>'+
1039
'<div class="listing">&bull; heavenly chips now give +2% CpS again (they will be extensively reworked in the future)</div>'+
1040
'<div class="listing">&bull; farms have been buffed a bit (to popular demand)</div>'+
1041
'<div class="listing">&bull; dungeons still need a bit more work and will be released soon - we want them to be just right! (you can test an unfinished version in <a href="//orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">the beta</a>)</div>'+
1042
1043
'</div><div class="subsection update">'+
1044
'<div class="title">28/09/2013 - dungeon beta</div>'+
1045
'<div class="listing">&bull; from now on, big updates will come through a beta stage first (you can <a href="//orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">try it here</a>)</div>'+
1046
'<div class="listing">&bull; first dungeons! (you need 50 factories to unlock them!)</div>'+
1047
'<div class="listing">&bull; cookie chains can be longer</div>'+
1048
'<div class="listing">&bull; antimatter condensers are a bit more expensive</div>'+
1049
'<div class="listing">&bull; heavenly chips now only give +1% cps each (to account for all the cookies made from condensers)</div>'+
1050
'<div class="listing">&bull; added flavor text on all upgrades</div>'+
1051
1052
'</div><div class="subsection update small">'+
1053
'<div class="title">15/09/2013 - anticookies</div>'+
1054
'<div class="listing">&bull; ran out of regular matter to make your cookies? Try our new antimatter condensers!</div>'+
1055
'<div class="listing">&bull; renamed Hard-reset to "Wipe save" to avoid confusion</div>'+
1056
'<div class="listing">&bull; reset achievements are now regular achievements and require cookies baked all time, not cookies in bank</div>'+
1057
'<div class="listing">&bull; heavenly chips have been nerfed a bit (and are now awarded following a geometric progression : 1 trillion for the first, 2 for the second, etc); the prestige system will be extensively reworked in a future update (after dungeons)</div>'+
1058
'<div class="listing">&bull; golden cookie clicks are no longer reset by soft-resets</div>'+
1059
'<div class="listing">&bull; you can now see how long you\'ve been playing in the stats</div>'+
1060
1061
'</div><div class="subsection update small">'+
1062
'<div class="title">08/09/2013 - everlasting cookies</div>'+
1063
'<div class="listing">&bull; added a prestige system - resetting gives you permanent CpS boosts (the more cookies made before resetting, the bigger the boost!)</div>'+
1064
'<div class="listing">&bull; save format has been slightly modified to take less space</div>'+
1065
'<div class="listing">&bull; Leprechaun has been bumped to 777 golden cookies clicked and is now shadow; Fortune is the new 77 golden cookies achievement</div>'+
1066
'<div class="listing">&bull; clicking frenzy is now x777</div>'+
1067
1068
'</div><div class="subsection update small">'+
1069
'<div class="title">04/09/2013 - smarter cookie</div>'+
1070
'<div class="listing">&bull; golden cookies only have 20% chance of giving the same outcome twice in a row now</div>'+
1071
'<div class="listing">&bull; added a golden cookie upgrade</div>'+
1072
'<div class="listing">&bull; added an upgrade that makes pledges last twice as long (requires having pledged 10 times)</div>'+
1073
'<div class="listing">&bull; Quintillion fingers is now twice as efficient</div>'+
1074
'<div class="listing">&bull; Uncanny clicker was really too unpredictable; it is now a regular achievement and no longer requires a world record, just *pretty fast* clicking</div>'+
1075
1076
'</div><div class="subsection update small">'+
1077
'<div class="title">02/09/2013 - a better way out</div>'+
1078
'<div class="listing">&bull; Elder Covenant is even cheaper, and revoking it is cheaper still (also added a new achievement for getting it)</div>'+
1079
'<div class="listing">&bull; each grandma upgrade now requires 15 of the matching building</div>'+
1080
'<div class="listing">&bull; the dreaded bottom cursor has been fixed with a new cursor display style</div>'+
1081
'<div class="listing">&bull; added an option for faster, cheaper graphics</div>'+
1082
'<div class="listing">&bull; base64 encoding has been redone; this might make saving possible again on some older browsers</div>'+
1083
'<div class="listing">&bull; shadow achievements now have their own section</div>'+
1084
'<div class="listing">&bull; raspberry juice is now named raspberry milk, despite raspberry juice being delicious and going unquestionably well with cookies</div>'+
1085
'<div class="listing">&bull; HOTFIX : cursors now click; fancy graphics button renamed; cookies amount now more visible against cursors</div>'+
1086
1087
'</div><div class="subsection update small">'+
1088
'<div class="title">01/09/2013 - sorting things out</div>'+
1089
'<div class="listing">&bull; upgrades and achievements are properly sorted in the stats screen</div>'+
1090
'<div class="listing">&bull; made Elder Covenant much cheaper and less harmful</div>'+
1091
'<div class="listing">&bull; importing from the first version has been disabled, as promised</div>'+
1092
'<div class="listing">&bull; "One mind" now actually asks you to confirm the upgrade</div>'+
1093
1094
'</div><div class="subsection update small">'+
1095
'<div class="title">31/08/2013 - hotfixes</div>'+
1096
'<div class="listing">&bull; added a way to permanently stop the grandmapocalypse</div>'+
1097
'<div class="listing">&bull; Elder Pledge price is now capped</div>'+
1098
'<div class="listing">&bull; One Mind and other grandma research upgrades are now a little more powerful, if not 100% accurate</div>'+
1099
'<div class="listing">&bull; "golden" cookie now appears again during grandmapocalypse; Elder Pledge-related achievements are now unlockable</div>'+
1100
1101
'</div><div class="subsection update">'+
1102
'<div class="title">31/08/2013 - too many grandmas</div>'+
1103
'<div class="listing">&bull; the grandmapocalypse is back, along with more grandma types</div>'+
1104
'<div class="listing">&bull; added some upgrades that boost your clicking power and make it scale with your cps</div>'+
1105
'<div class="listing">&bull; clicking achievements made harder; Neverclick is now a shadow achievement; Uncanny clicker should now truly be a world record</div>'+
1106
1107
'</div><div class="subsection update small">'+
1108
'<div class="title">28/08/2013 - over-achiever</div>'+
1109
'<div class="listing">&bull; added a few more achievements</div>'+
1110
'<div class="listing">&bull; reworked the "Bake X cookies" achievements so they take longer to achieve</div>'+
1111
1112
'</div><div class="subsection update small">'+
1113
'<div class="title">27/08/2013 - a bad idea</div>'+
1114
'<div class="listing">&bull; due to popular demand, retired 5 achievements (the "reset your game" and "cheat" ones); they can still be unlocked, but do not count toward your total anymore. Don\'t worry, there will be many more achievements soon!</div>'+
1115
'<div class="listing">&bull; made some achievements hidden for added mystery</div>'+
1116
1117
'</div><div class="subsection update">'+
1118
'<div class="title">27/08/2013 - a sense of achievement</div>'+
1119
'<div class="listing">&bull; added achievements (and milk)</div>'+
1120
'<div class="listing"><i>(this is a big update, please don\'t get too mad if you lose some data!)</i></div>'+
1121
1122
'</div><div class="subsection update small">'+
1123
'<div class="title">26/08/2013 - new upgrade tier</div>'+
1124
'<div class="listing">&bull; added some more upgrades (including a couple golden cookie-related ones)</div>'+
1125
'<div class="listing">&bull; added clicking stats</div>'+
1126
1127
'</div><div class="subsection update small">'+
1128
'<div class="title">26/08/2013 - more tweaks</div>'+
1129
'<div class="listing">&bull; tweaked a couple cursor upgrades</div>'+
1130
'<div class="listing">&bull; made time machines less powerful</div>'+
1131
'<div class="listing">&bull; added offline mode option</div>'+
1132
1133
'</div><div class="subsection update small">'+
1134
'<div class="title">25/08/2013 - tweaks</div>'+
1135
'<div class="listing">&bull; rebalanced progression curve (mid- and end-game objects cost more and give more)</div>'+
1136
'<div class="listing">&bull; added some more cookie upgrades</div>'+
1137
'<div class="listing">&bull; added CpS for cursors</div>'+
1138
'<div class="listing">&bull; added sell button</div>'+
1139
'<div class="listing">&bull; made golden cookie more useful</div>'+
1140
1141
'</div><div class="subsection update small">'+
1142
'<div class="title">24/08/2013 - hotfixes</div>'+
1143
'<div class="listing">&bull; added import/export feature, which also allows you to retrieve a save game from the old version (will be disabled in a week to prevent too much cheating)</div>'+
1144
'<div class="listing">&bull; upgrade store now has unlimited slots (just hover over it), due to popular demand</div>'+
1145
'<div class="listing">&bull; added update log</div>'+
1146
1147
'</div><div class="subsection update">'+
1148
'<div class="title">24/08/2013 - big update!</div>'+
1149
'<div class="listing">&bull; revamped the whole game (new graphics, new game mechanics)</div>'+
1150
'<div class="listing">&bull; added upgrades</div>'+
1151
'<div class="listing">&bull; much safer saving</div>'+
1152
1153
'</div><div class="subsection update">'+
1154
'<div class="title">08/08/2013 - game launch</div>'+
1155
'<div class="listing">&bull; made the game in a couple hours, for laughs</div>'+
1156
'<div class="listing">&bull; kinda starting to regret it</div>'+
1157
'<div class="listing">&bull; ah well</div>'+
1158
'</div>'+
1159
'</div>'
1160
;
1161
1162
Game.ready=0;
1163
1164
Game.Load=function()
1165
{
1166
//l('javascriptError').innerHTML='<div style="padding:64px 128px;"><div class="title">Loading...</div></div>';
1167
Game.Loader=new Loader();
1168
Game.Loader.domain='img/';
1169
Game.Loader.loaded=Game.Init;
1170
Game.Loader.Load(['filler.png']);
1171
}
1172
Game.ErrorFrame=function()
1173
{
1174
l('javascriptError').innerHTML=
1175
'<div class="title">Oops. Wrong address!</div>'+
1176
'<div>It looks like you\'re accessing Cookie Clicker from another URL than the official one.<br>'+
1177
'You can <a href="//orteil.dashnet.org/cookieclicker/" target="_blank">play Cookie Clicker over here</a>!<br>'+
1178
'<small>(If for any reason, you are unable to access the game on the official URL, we are currently working on a second domain.)</small></div>';
1179
}
1180
Game.timedout=false;
1181
Game.Timeout=function()
1182
{
1183
Game.WriteSave();
1184
Game.killShimmers();
1185
l('javascriptError').innerHTML='Cookie Clicker is in sleep mode'+(Game.Has('Twin Gates of Transcendence')?' and generating offline cookies':'')+'.<br><a '+Game.clickStr+'="Game.Resume();">Click here</a> to resume from your save file.<br><div style="font-style:italic;font-size:65%;line-height:110%;opacity:0.75;">(this happens when too many frames are skipped at once,<br>usually when the game has been running in the background for a while)<br>(you can turn this feature off in the settings menu)</div>';
1186
l('javascriptError').style.display='block';
1187
Game.timedout=true;
1188
console.log('[=== Game timed out and has been put in sleep mode. Data was saved. ===]');
1189
}
1190
Game.Resume=function()
1191
{
1192
l('javascriptError').innerHTML='';
1193
l('javascriptError').style.display='none';
1194
Game.timedout=false;
1195
Game.time=Date.now();
1196
Game.accumulatedDelay=0;
1197
Game.delayTimeouts=0;
1198
Game.lastActivity=Date.now();
1199
Game.Loop();
1200
Game.LoadSave();
1201
console.log('[=== Game resumed! Data was loaded. ===]');
1202
}
1203
1204
1205
Game.Init=function()
1206
{
1207
Game.ready=1;
1208
1209
/*=====================================================================================
1210
VARIABLES AND PRESETS
1211
=======================================================================================*/
1212
Game.T=0;
1213
Game.drawT=0;
1214
Game.loopT=0;
1215
Game.fps=30;
1216
1217
Game.season=Game.baseSeason;
1218
1219
Game.l=l('game');
1220
Game.bounds=0;//rectangle defining screen limits (right,left,bottom,top) updated every logic frame
1221
1222
if (Game.mobile==1)
1223
{
1224
l('wrapper').className='mobile';
1225
}
1226
Game.clickStr=Game.touchEvents?'ontouchend':'onclick';
1227
1228
Game.SaveTo='CookieClickerGame';
1229
if (Game.beta) Game.SaveTo='CookieClickerGameBeta';
1230
l('versionNumber').innerHTML='v. '+Game.version+'<div id="httpsSwitch" style="cursor:pointer;display:inline-block;background:url(img/'+(Game.https?'lockOn':'lockOff')+'.png);width:16px;height:16px;position:relative;top:4px;left:0px;margin:0px -2px;"></div>'+(Game.beta?' <span style="color:#ff0;">beta</span>':'');
1231
1232
Game.lastActivity=Date.now();//reset on mouse move, key press or click
1233
1234
//latency compensator stuff
1235
Game.time=Date.now();
1236
Game.accumulatedDelay=0;
1237
Game.delayTimeouts=0;//how many times we've gone over the timeout delay
1238
Game.catchupLogic=0;
1239
Game.fpsStartTime=0;
1240
Game.frameNumber=0;
1241
Game.currentFps=Game.fps;
1242
Game.previousFps=Game.currentFps;
1243
Game.getFps=function()
1244
{
1245
Game.frameNumber++;
1246
var currentTime=(Date.now()-Game.fpsStartTime )/1000;
1247
var result=Math.floor((Game.frameNumber/currentTime));
1248
if (currentTime>1)
1249
{
1250
Game.fpsStartTime=Date.now();
1251
Game.frameNumber=0;
1252
}
1253
return result;
1254
}
1255
1256
Game.cookiesEarned=0;//all cookies earned during gameplay
1257
Game.cookies=0;//cookies
1258
Game.cookiesd=0;//cookies display
1259
Game.cookiesPs=1;//cookies per second (to recalculate with every new purchase)
1260
Game.cookiesPsRaw=0;//raw cookies per second
1261
Game.cookiesPsRawHighest=0;//highest raw cookies per second this ascension
1262
Game.cookiesReset=0;//cookies lost to resetting (used to determine prestige and heavenly chips)
1263
Game.cookieClicks=0;//+1 for each click on the cookie
1264
Game.goldenClicks=0;//+1 for each golden cookie clicked (all time)
1265
Game.goldenClicksLocal=0;//+1 for each golden cookie clicked (this game only)
1266
Game.missedGoldenClicks=0;//+1 for each golden cookie missed
1267
Game.handmadeCookies=0;//all the cookies made from clicking the cookie
1268
Game.milkProgress=0;//you gain a little bit for each achievement. Each increment of 1 is a different milk displayed.
1269
Game.milkH=Game.milkProgress/2;//milk height, between 0 and 1 (although should never go above 0.5)
1270
Game.milkHd=0;//milk height display
1271
Game.milkType=0;//custom milk
1272
Game.bgType=0;//custom background
1273
Game.chimeType=0;//golden cookie chime
1274
Game.prestige=0;//prestige level (recalculated depending on Game.cookiesReset)
1275
Game.heavenlyChips=0;//heavenly chips the player currently has
1276
Game.heavenlyChipsDisplayed=0;//ticks up or down to match Game.heavenlyChips
1277
Game.heavenlyChipsSpent=0;//heavenly chips spent on cookies, upgrades and such
1278
Game.heavenlyCookies=0;//how many cookies have we baked from chips (unused)
1279
Game.permanentUpgrades=[-1,-1,-1,-1,-1];
1280
Game.ascensionMode=0;//type of challenge run if any
1281
Game.resets=0;//reset counter
1282
Game.lumps=-1;//sugar lumps
1283
Game.lumpsTotal=-1;//sugar lumps earned across all playthroughs (-1 means they haven't even started yet)
1284
Game.lumpT=Date.now();//time when the current lump started forming
1285
Game.lumpRefill=0;//time left before a sugar lump can be used again (on minigame refills etc) in logic frames
1286
1287
Game.makeSeed=function()
1288
{
1289
var chars='abcdefghijklmnopqrstuvwxyz'.split('');
1290
var str='';
1291
for (var i=0;i<5;i++){str+=choose(chars);}
1292
return str;
1293
}
1294
Game.seed=Game.makeSeed();//each run has its own seed, used for deterministic random stuff
1295
1296
Game.volume=50;//sound volume
1297
1298
Game.elderWrath=0;
1299
Game.elderWrathOld=0;
1300
Game.elderWrathD=0;
1301
Game.pledges=0;
1302
Game.pledgeT=0;
1303
Game.researchT=0;
1304
Game.nextResearch=0;
1305
Game.cookiesSucked=0;//cookies sucked by wrinklers
1306
Game.cpsSucked=0;//percent of CpS being sucked by wrinklers
1307
Game.wrinklersPopped=0;
1308
Game.santaLevel=0;
1309
Game.reindeerClicked=0;
1310
Game.seasonT=0;
1311
Game.seasonUses=0;
1312
Game.dragonLevel=0;
1313
Game.dragonAura=0;
1314
Game.dragonAura2=0;
1315
1316
Game.fortuneGC=0;
1317
Game.fortuneCPS=0;
1318
1319
Game.blendModesOn=(document.createElement('detect').style.mixBlendMode==='');
1320
1321
Game.bg='';//background (grandmas and such)
1322
Game.bgFade='';//fading to background
1323
Game.bgR=0;//ratio (0 - not faded, 1 - fully faded)
1324
Game.bgRd=0;//ratio displayed
1325
1326
Game.windowW=window.innerWidth;
1327
Game.windowH=window.innerHeight;
1328
1329
window.addEventListener('resize',function(event)
1330
{
1331
Game.windowW=window.innerWidth;
1332
Game.windowH=window.innerHeight;
1333
1334
for (var i in Game.Objects)
1335
{
1336
var me=Game.Objects[i];
1337
me.toResize=true;
1338
if (me.minigame && me.minigame.onResize) me.minigame.onResize();
1339
}
1340
});
1341
1342
Game.startDate=parseInt(Date.now());//when we started playing
1343
Game.fullDate=parseInt(Date.now());//when we started playing (carries over with resets)
1344
Game.lastDate=parseInt(Date.now());//when we last saved the game (used to compute "cookies made since we closed the game" etc)
1345
1346
Game.prefs=[];
1347
Game.DefaultPrefs=function()
1348
{
1349
Game.prefs.particles=1;//particle effects : falling cookies etc
1350
Game.prefs.numbers=1;//numbers that pop up when clicking the cookie
1351
Game.prefs.autosave=1;//save the game every minute or so
1352
Game.prefs.autoupdate=1;//send an AJAX request to the server every 30 minutes (note : ignored)
1353
Game.prefs.milk=1;//display milk
1354
Game.prefs.fancy=1;//CSS shadow effects (might be heavy on some browsers)
1355
Game.prefs.warn=0;//warn before closing the window
1356
Game.prefs.cursors=1;//display cursors
1357
Game.prefs.focus=1;//make the game refresh less frequently when off-focus
1358
Game.prefs.popups=0;//use old-style popups
1359
Game.prefs.format=0;//shorten numbers
1360
Game.prefs.notifs=0;//notifications fade faster
1361
Game.prefs.animate=1;//animate buildings
1362
Game.prefs.wobbly=1;//wobbly cookie
1363
Game.prefs.monospace=0;//alt monospace font for cookies
1364
Game.prefs.filters=0;//CSS filter effects (might be heavy on some browsers)
1365
Game.prefs.cookiesound=1;//use new cookie click sound
1366
Game.prefs.crates=0;//show crates around icons in stats
1367
Game.prefs.altDraw=0;//use requestAnimationFrame to update drawing instead of fixed 30 fps setTimeout
1368
Game.prefs.showBackupWarning=1;//if true, show a "Have you backed up your save?" message on save load; set to false when save is exported
1369
Game.prefs.extraButtons=1;//if true, show Mute buttons and the building master bar
1370
Game.prefs.askLumps=0;//if true, show a prompt before spending lumps
1371
Game.prefs.customGrandmas=1;//if true, show patreon names for grandmas
1372
Game.prefs.timeout=0;//if true, game may show pause screen when timed out
1373
}
1374
Game.DefaultPrefs();
1375
1376
window.onbeforeunload=function(event)
1377
{
1378
if (Game.prefs && Game.prefs.warn)
1379
{
1380
if (typeof event=='undefined') event=window.event;
1381
if (event) event.returnValue='Are you sure you want to close Cookie Clicker?';
1382
}
1383
}
1384
1385
Game.Mobile=function()
1386
{
1387
if (!Game.mobile)
1388
{
1389
l('wrapper').className='mobile';
1390
Game.mobile=1;
1391
}
1392
else
1393
{
1394
l('wrapper').className='';
1395
Game.mobile=0;
1396
}
1397
}
1398
1399
Game.showBackupWarning=function()
1400
{
1401
Game.Notify('Back up your save!','Hello again! Just a reminder that you may want to back up your Cookie Clicker save every once in a while, just in case.<br>To do so, go to Options and hit "Export save" or "Save to file"!<div class="line"></div><a style="float:right;" onclick="Game.prefs.showBackupWarning=0;==CLOSETHIS()==">Don\'t show this again</a>',[25,7]);
1402
}
1403
1404
/*=====================================================================================
1405
MODDING API
1406
=======================================================================================*/
1407
/*
1408
to use:
1409
-have your mod call Game.registerMod("unique id",mod object)
1410
-the "unique id" value is a string the mod will use to index and retrieve its save data; special characters are ignored
1411
-the "mod object" value is an object structured like so:
1412
{
1413
init:function(){
1414
//this function is called as soon as the mod is registered
1415
//declare hooks here
1416
},
1417
save:function(){
1418
//use this to store persistent data associated with your mod
1419
return 'a string to be saved';
1420
},
1421
load:function(str){
1422
//do stuff with the string data you saved previously
1423
},
1424
}
1425
-the mod object may also contain any other data or functions you want, for instance to make them accessible to other mods
1426
-your mod and its data can be accessed with Game.mods['mod id']
1427
-hooks are functions the game calls automatically in certain circumstances, like when calculating cookies per click or when redrawing the screen
1428
-to add a hook: Game.registerHook('hook id',yourFunctionHere) - note: you can also declare whole arrays of hooks, ie. Game.registerHook('hook id',[function1,function2,...])
1429
-to remove a hook: Game.removeHook('hook id',theSameFunctionHere)
1430
-some hooks are fed a parameter you can use in the function
1431
-list of valid hook ids:
1432
'logic' - called every logic tick
1433
'draw' - called every draw tick
1434
'reset' - called whenever the player resets; parameter is true if this is a hard reset, false if it's an ascension
1435
'reincarnate' - called when the player has reincarnated after an ascension
1436
'ticker' - called when determining news ticker text; should return an array of possible choices to add
1437
'cps' - called when determining the CpS; parameter is the current CpS; should return the modified CpS
1438
'cookiesPerClick' - called when determining the cookies per click; parameter is the current value; should return the modified value
1439
'click' - called when the big cookie is clicked
1440
'create' - called after the game declares all buildings, upgrades and achievs; use this to declare your own - note that saving/loading functionality for custom content is not explicitly implemented and may be unpredictable and broken
1441
'check' - called every few seconds when we check for upgrade/achiev unlock conditions; you can also use this for other checks that you don't need happening every logic frame
1442
-function hooks are provided for convenience and more advanced mod functionality will probably involve manual code injection
1443
-please be mindful of the length of the data you save, as it does inflate the export-save-to-string feature
1444
1445
NOTE: modding API is susceptible to change and may not always function super-well
1446
*/
1447
Game.mods={};
1448
Game.sortedMods=[];
1449
Game.modSaveData={};
1450
Game.modHooks={};
1451
Game.modHooksNames=['logic','draw','reset','reincarnate','ticker','cps','cookiesPerClick','click','create','check'];
1452
for (var i=0;i<Game.modHooksNames.length;i++){Game.modHooks[Game.modHooksNames[i]]=[];}
1453
Game.registerMod=function(id,obj)
1454
{
1455
id=id.replace(/\W+/g,' ');
1456
if (Game.mods[id]) {console.log('ERROR: mod already registered with the id "'+id+'".');return false;}
1457
Game.mods[id]=obj;
1458
Game.sortedMods.push(obj);
1459
obj.id=id;
1460
console.log('Mod "'+id+'" added.');
1461
if (Game.Win) Game.Win('Third-party');
1462
if (obj.init) obj.init();
1463
if (obj.load && Game.modSaveData[id]) obj.load(Game.modSaveData[id]);
1464
}
1465
Game.registerHook=function(hook,func)
1466
{
1467
if (func.constructor===Array)
1468
{
1469
for (var i=0;i<func.length;i++){Game.registerHook(hook,func[i]);}
1470
return;
1471
}
1472
if (typeof func!=='function') return;
1473
if (typeof Game.modHooks[hook]!=='undefined') Game.modHooks[hook].push(func);
1474
else console.log('Error: a mod tried to register a non-existent hook named "'+hook+'".');
1475
}
1476
Game.removeHook=function(hook,func)
1477
{
1478
if (func.constructor===Array)
1479
{
1480
for (var i=0;i<func.length;i++){Game.removeHook(hook,func[i]);}
1481
return;
1482
}
1483
if (typeof func!=='function') return;
1484
if (typeof Game.modHooks[hook]!=='undefined' && Game.modHooks[hook].indexOf(func)!=-1) Game.modHooks[hook].splice(Game.modHooks[hook].indexOf(func),1);
1485
else console.log('Error: a mod tried to remove a non-existent hook named "'+hook+'".');
1486
}
1487
Game.runModHook=function(hook,param)
1488
{
1489
for (var i=0;i<Game.modHooks[hook].length;i++)
1490
{
1491
Game.modHooks[hook][i](param);
1492
}
1493
}
1494
Game.runModHookOnValue=function(hook,val)
1495
{
1496
for (var i=0;i<Game.modHooks[hook].length;i++)
1497
{
1498
val=Game.modHooks[hook][i](val);
1499
}
1500
return val;
1501
}
1502
Game.safeSaveString=function(str)
1503
{
1504
//look as long as it works
1505
str=replaceAll('|','[P]',str);
1506
str=replaceAll(';','[S]',str);
1507
return str;
1508
}
1509
Game.safeLoadString=function(str)
1510
{
1511
str=replaceAll('[P]','|',str);
1512
str=replaceAll('[S]',';',str);
1513
return str;
1514
}
1515
Game.saveModData=function()
1516
{
1517
var str='';
1518
for (var i=0;i<Game.sortedMods.length;i++)
1519
{
1520
if (Game.sortedMods[i]['save']) Game.modSaveData[Game.sortedMods[i].id]=Game.sortedMods[i]['save']();
1521
}
1522
for (var i in Game.modSaveData)
1523
{
1524
str+=i+':'+Game.safeSaveString(Game.modSaveData[i])+';';
1525
}
1526
return str;
1527
}
1528
Game.loadModData=function()
1529
{
1530
for (var i in Game.modSaveData)
1531
{
1532
if (Game.mods[i] && Game.mods[i]['load']) Game.mods[i]['load'](Game.modSaveData[i]);
1533
}
1534
}
1535
Game.deleteModData=function(id)
1536
{
1537
if (Game.modSaveData[id]) delete Game.modSaveData[id];
1538
}
1539
Game.deleteAllModData=function()
1540
{
1541
Game.modSaveData={};
1542
}
1543
Game.CheckModData=function()
1544
{
1545
var modsN=0;
1546
var str='';
1547
for (var i in Game.modSaveData)
1548
{
1549
str+='<div style="border-bottom:1px dashed rgba(255,255,255,0.2);clear:both;overflow:hidden;padding:4px 0px;">';
1550
str+='<div style="float:left;width:49%;text-align:left;overflow:hidden;"><b>'+i+'</b>';
1551
if (Game.mods[i]) str+=' (loaded)';
1552
str+='</div>';
1553
str+='<div style="float:right;width:49%;text-align:right;overflow:hidden;">'+Game.modSaveData[i].length+' chars <a class="option warning" style="padding:0px 2px;font-size:10px;margin:0px;vertical-align:top;" '+Game.clickStr+'="Game.deleteModData(\''+i+'\');PlaySound(\'snd/tick.mp3\');Game.ClosePrompt();Game.CheckModData();">X</a>';
1554
str+='</div>';
1555
str+='</div>';
1556
modsN++;
1557
}
1558
if (modsN==0) str+='No mod data present.';
1559
else str+='<div><a class="option warning" style="font-size:11px;margin-top:4px;" '+Game.clickStr+'="Game.deleteAllModData();PlaySound(\'snd/tick.mp3\');Game.ClosePrompt();Game.CheckModData();">Delete all</a></div>';
1560
Game.Prompt('<h3>Mod data</h3><div class="block">These are the mods present in your save data. You may delete some of this data to make your save file smaller.</div><div class="block" style="font-size:11px;">'+str+'</div>',['Back']);
1561
}
1562
1563
Game.LoadMod=function(url)//this loads the mod at the given URL and gives the script an automatic id (URL "http://example.com/my_mod.js" gives the id "modscript_my_mod")
1564
{
1565
var js=document.createElement('script');
1566
var id=url.split('/');id=id[id.length-1].split('.')[0];
1567
js.setAttribute('type','text/javascript');
1568
js.setAttribute('id','modscript_'+id);
1569
js.setAttribute('src',url);
1570
document.head.appendChild(js);
1571
console.log('Loaded the mod '+url+', '+id+'.');
1572
}
1573
1574
1575
1576
if (false)
1577
{
1578
//EXAMPLE MOD
1579
Game.registerMod('test mod',{
1580
/*
1581
what this example mod does:
1582
-double your CpS
1583
-display a little popup for half a second whenever you click the big cookie
1584
-add a little intro text above your bakery name, and generate that intro text at random if you don't already have one
1585
-save and load your intro text
1586
*/
1587
init:function(){
1588
Game.registerHook('reincarnate',function(){Game.mods['test mod'].addIntro();});
1589
Game.registerHook('check',function(){if (!Game.playerIntro){Game.mods['test mod'].addIntro();}});
1590
Game.registerHook('click',function(){Game.Notify(choose(['A good click.','A solid click.','A mediocre click.','An excellent click!']),'',0,0.5);});
1591
Game.registerHook('cps',function(cps){return cps*2;});
1592
},
1593
save:function(){
1594
//note: we use stringified JSON for ease and clarity but you could store any type of string
1595
return JSON.stringify({text:Game.playerIntro})
1596
},
1597
load:function(str){
1598
var data=JSON.parse(str);
1599
if (data.text) Game.mods['test mod'].addIntro(data.text);
1600
},
1601
addIntro:function(text){
1602
//note: this is not a mod hook, just a function that's part of the mod
1603
Game.playerIntro=text||choose(['oh snap, it\'s','watch out, it\'s','oh no! here comes','hide your cookies, for here comes','behold! it\'s']);
1604
if (!l('bakerySubtitle')) l('bakeryName').insertAdjacentHTML('afterend','<div id="bakerySubtitle" class="title" style="text-align:center;position:absolute;left:0px;right:0px;bottom:32px;font-size:12px;pointer-events:none;text-shadow:0px 1px 1px #000,0px 0px 4px #f00;opacity:0.8;"></div>');
1605
l('bakerySubtitle').textContent='~'+Game.playerIntro+'~';
1606
},
1607
});
1608
}
1609
1610
1611
1612
//replacing an existing canvas picture with a new one at runtime : Game.Loader.Replace('perfectCookie.png','imperfectCookie.png');
1613
//upgrades and achievements can use other pictures than icons.png; declare their icon with [posX,posY,'http://example.com/myIcons.png']
1614
//check out the "UNLOCKING STUFF" section to see how unlocking achievs and upgrades is done
1615
1616
1617
1618
/*=====================================================================================
1619
BAKERY NAME
1620
=======================================================================================*/
1621
Game.RandomBakeryName=function()
1622
{
1623
return (Math.random()>0.05?(choose(['Magic','Fantastic','Fancy','Sassy','Snazzy','Pretty','Cute','Pirate','Ninja','Zombie','Robot','Radical','Urban','Cool','Hella','Sweet','Awful','Double','Triple','Turbo','Techno','Disco','Electro','Dancing','Wonder','Mutant','Space','Science','Medieval','Future','Captain','Bearded','Lovely','Tiny','Big','Fire','Water','Frozen','Metal','Plastic','Solid','Liquid','Moldy','Shiny','Happy','Happy Little','Slimy','Tasty','Delicious','Hungry','Greedy','Lethal','Professor','Doctor','Power','Chocolate','Crumbly','Choklit','Righteous','Glorious','Mnemonic','Psychic','Frenetic','Hectic','Crazy','Royal','El','Von'])+' '):'Mc')+choose(['Cookie','Biscuit','Muffin','Scone','Cupcake','Pancake','Chip','Sprocket','Gizmo','Puppet','Mitten','Sock','Teapot','Mystery','Baker','Cook','Grandma','Click','Clicker','Spaceship','Factory','Portal','Machine','Experiment','Monster','Panic','Burglar','Bandit','Booty','Potato','Pizza','Burger','Sausage','Meatball','Spaghetti','Macaroni','Kitten','Puppy','Giraffe','Zebra','Parrot','Dolphin','Duckling','Sloth','Turtle','Goblin','Pixie','Gnome','Computer','Pirate','Ninja','Zombie','Robot']);
1624
}
1625
Game.GetBakeryName=function() {return Game.RandomBakeryName();}
1626
Game.bakeryName=Game.GetBakeryName();
1627
Game.bakeryNameL=l('bakeryName');
1628
Game.bakeryNameL.textContent=Game.bakeryName+'\'s bakery';
1629
Game.bakeryNameSet=function(what)
1630
{
1631
Game.bakeryName=what.replace(/\W+/g,' ');
1632
Game.bakeryName=Game.bakeryName.substring(0,28);
1633
Game.bakeryNameRefresh();
1634
}
1635
Game.bakeryNameRefresh=function()
1636
{
1637
var name=Game.bakeryName;
1638
if (name.slice(-1).toLowerCase()=='s') name+='\' bakery'; else name+='\'s bakery';
1639
Game.bakeryNameL.textContent=name;
1640
name=Game.bakeryName.toLowerCase();
1641
if (name=='orteil') Game.Win('God complex');
1642
if (name.indexOf('saysopensesame',name.length-('saysopensesame').length)>0 && !Game.sesame) Game.OpenSesame();
1643
Game.recalculateGains=1;
1644
}
1645
Game.bakeryNamePrompt=function()
1646
{
1647
Game.Prompt('<h3>Name your bakery</h3><div class="block" style="text-align:center;">What should your bakery\'s name be?</div><div class="block"><input type="text" style="text-align:center;width:100%;" id="bakeryNameInput" value="'+Game.bakeryName+'"/></div>',[['Confirm','if (l(\'bakeryNameInput\').value.length>0) {Game.bakeryNameSet(l(\'bakeryNameInput\').value);Game.Win(\'What\\\'s in a name\');Game.ClosePrompt();}'],['Random','Game.bakeryNamePromptRandom();'],'Cancel']);
1648
l('bakeryNameInput').focus();
1649
l('bakeryNameInput').select();
1650
}
1651
Game.bakeryNamePromptRandom=function()
1652
{
1653
l('bakeryNameInput').value=Game.RandomBakeryName();
1654
}
1655
AddEvent(Game.bakeryNameL,'click',Game.bakeryNamePrompt);
1656
1657
1658
/*=====================================================================================
1659
TOOLTIP
1660
=======================================================================================*/
1661
Game.tooltip={text:'',x:0,y:0,origin:'',on:0,tt:l('tooltip'),tta:l('tooltipAnchor'),shouldHide:1,dynamic:0,from:0};
1662
Game.tooltip.draw=function(from,text,origin)
1663
{
1664
this.shouldHide=0;
1665
this.text=text;
1666
this.from=from;
1667
//this.x=x;
1668
//this.y=y;
1669
this.origin=origin;
1670
var tt=this.tt;
1671
var tta=this.tta;
1672
tt.style.left='auto';
1673
tt.style.top='auto';
1674
tt.style.right='auto';
1675
tt.style.bottom='auto';
1676
if (typeof this.text==='function')
1677
{
1678
var text=this.text();
1679
if (text=='') tta.style.opacity='0';
1680
else
1681
{
1682
tt.innerHTML=unescape(text);
1683
tta.style.opacity='1';
1684
}
1685
}
1686
else tt.innerHTML=unescape(this.text);
1687
//tt.innerHTML=(typeof this.text==='function')?unescape(this.text()):unescape(this.text);
1688
tta.style.display='block';
1689
tta.style.visibility='hidden';
1690
Game.tooltip.update();
1691
tta.style.visibility='visible';
1692
this.on=1;
1693
}
1694
Game.tooltip.update=function()
1695
{
1696
var X=0;
1697
var Y=0;
1698
var width=this.tt.offsetWidth;
1699
var height=this.tt.offsetHeight;
1700
if (this.origin=='store')
1701
{
1702
X=Game.windowW-332-width;
1703
Y=Game.mouseY-32;
1704
if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-42;
1705
Y=Math.max(0,Math.min(Game.windowH-height-44,Y));
1706
/*this.tta.style.right='308px';//'468px';
1707
this.tta.style.left='auto';
1708
if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-2;
1709
this.tta.style.top=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y-48))+'px';*/
1710
}
1711
else
1712
{
1713
if (Game.onCrate)
1714
{
1715
var rect=Game.onCrate.getBoundingClientRect();
1716
rect={left:rect.left,top:rect.top,right:rect.right,bottom:rect.bottom};
1717
if (rect.left==0 && rect.top==0)//if we get that bug where we get stuck in the top-left, move to the mouse (REVISION : just do nothing)
1718
{return false;/*rect.left=Game.mouseX-24;rect.right=Game.mouseX+24;rect.top=Game.mouseY-24;rect.bottom=Game.mouseY+24;*/}
1719
if (this.origin=='left')
1720
{
1721
X=rect.left-width-16;
1722
Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;
1723
Y=Math.max(0,Math.min(Game.windowH-height-19,Y));
1724
if (X<0) X=rect.right;
1725
}
1726
else
1727
{
1728
X=rect.left+(rect.right-rect.left)/2-width/2-8;
1729
Y=rect.top-height-48;
1730
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1731
if (Y<0) Y=rect.bottom-32;
1732
}
1733
}
1734
else if (this.origin=='bottom-right')
1735
{
1736
X=Game.mouseX+8;
1737
Y=Game.mouseY-32;
1738
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1739
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1740
}
1741
else if (this.origin=='bottom')
1742
{
1743
X=Game.mouseX-width/2-8;
1744
Y=Game.mouseY+24;
1745
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1746
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1747
}
1748
else if (this.origin=='left')
1749
{
1750
X=Game.mouseX-width-24;
1751
Y=Game.mouseY-height/2-8;
1752
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1753
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1754
}
1755
else if (this.origin=='this' && this.from)
1756
{
1757
var rect=this.from.getBoundingClientRect();
1758
X=(rect.left+rect.right)/2-width/2-8;
1759
Y=(rect.top)-this.tt.clientHeight-48;
1760
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1761
//Y=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y));
1762
if (Y<0) Y=(rect.bottom-24);
1763
if (Y+height+40>Game.windowH)
1764
{
1765
X=rect.right+8;
1766
Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;
1767
Y=Math.max(0,Math.min(Game.windowH-height-19,Y));
1768
}
1769
}
1770
else
1771
{
1772
X=Game.mouseX-width/2-8;
1773
Y=Game.mouseY-height-32;
1774
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1775
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1776
}
1777
}
1778
this.tta.style.left=X+'px';
1779
this.tta.style.right='auto';
1780
this.tta.style.top=Y+'px';
1781
this.tta.style.bottom='auto';
1782
if (this.shouldHide) {this.hide();this.shouldHide=0;}
1783
else if (Game.drawT%10==0 && typeof(this.text)==='function')
1784
{
1785
var text=this.text();
1786
if (text=='') this.tta.style.opacity='0';
1787
else
1788
{
1789
this.tt.innerHTML=unescape(text);
1790
this.tta.style.opacity='1';
1791
}
1792
}
1793
}
1794
Game.tooltip.hide=function()
1795
{
1796
this.tta.style.display='none';
1797
this.dynamic=0;
1798
this.on=0;
1799
}
1800
Game.getTooltip=function(text,origin,isCrate)
1801
{
1802
origin=(origin?origin:'middle');
1803
if (isCrate) return 'onMouseOut="Game.setOnCrate(0);Game.tooltip.shouldHide=1;" onMouseOver="if (!Game.mouseDown) {Game.setOnCrate(this);Game.tooltip.dynamic=0;Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');Game.tooltip.wobble();}"';
1804
else return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=0;Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');Game.tooltip.wobble();"';
1805
}
1806
Game.getDynamicTooltip=function(func,origin,isCrate)
1807
{
1808
origin=(origin?origin:'middle');
1809
if (isCrate) return 'onMouseOut="Game.setOnCrate(0);Game.tooltip.shouldHide=1;" onMouseOver="if (!Game.mouseDown) {Game.setOnCrate(this);Game.tooltip.dynamic=1;Game.tooltip.draw(this,'+'function(){return '+func+'();}'+',\''+origin+'\');Game.tooltip.wobble();}"';
1810
return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=1;Game.tooltip.draw(this,'+'function(){return '+func+'();}'+',\''+origin+'\');Game.tooltip.wobble();"';
1811
}
1812
Game.attachTooltip=function(el,func,origin)
1813
{
1814
if (typeof func==='string')
1815
{
1816
var str=func;
1817
func=function(str){return function(){return str;};}(str);
1818
}
1819
origin=(origin?origin:'middle');
1820
AddEvent(el,'mouseover',function(func,el,origin){return function(){Game.tooltip.dynamic=1;Game.tooltip.draw(el,func,origin);};}(func,el,origin));
1821
AddEvent(el,'mouseout',function(){return function(){Game.tooltip.shouldHide=1;};}());
1822
}
1823
Game.tooltip.wobble=function()
1824
{
1825
//disabled because this effect doesn't look good with the slight slowdown it might or might not be causing.
1826
if (false)
1827
{
1828
this.tt.className='framed';
1829
void this.tt.offsetWidth;
1830
this.tt.className='framed wobbling';
1831
}
1832
}
1833
1834
1835
/*=====================================================================================
1836
UPDATE CHECKER
1837
=======================================================================================*/
1838
Game.CheckUpdates=function()
1839
{
1840
ajax('server.php?q=checkupdate',Game.CheckUpdatesResponse);
1841
}
1842
Game.CheckUpdatesResponse=function(response)
1843
{
1844
var r=response.split('|');
1845
var str='';
1846
if (r[0]=='alert')
1847
{
1848
if (r[1]) str=r[1];
1849
}
1850
else if (parseFloat(r[0])>Game.version)
1851
{
1852
str='<b>New version available : v. '+r[0]+'!</b>';
1853
if (r[1]) str+='<br><small>Update note : "'+r[1]+'"</small>';
1854
str+='<br><b>Refresh to get it!</b>';
1855
}
1856
if (str!='')
1857
{
1858
l('alert').innerHTML=str;
1859
l('alert').style.display='block';
1860
}
1861
}
1862
1863
/*=====================================================================================
1864
DATA GRABBER
1865
=======================================================================================*/
1866
1867
Game.externalDataLoaded=false;
1868
1869
Game.grandmaNames=['Granny','Gusher','Ethel','Edna','Doris','Maud','Hilda','Gladys','Michelle','Michele','Phyllis','Millicent','Muriel','Myrtle','Mildred','Mavis','Helen','Gloria','Sheila','Betty','Gertrude','Agatha','Beryl','Agnes','Pearl','Precious','Ruby','Vera','Bonnie','Ada','Bunny','Cookie','Darling','Gaga','GamGam','Memaw','Mimsy','Peanut','Nana','Nan','Tootsie','Warty','Stinky','Heinous'];
1870
Game.customGrandmaNames=[];
1871
Game.heralds=0;
1872
1873
Game.GrabData=function()
1874
{
1875
ajax('/patreon/grab.php',Game.GrabDataResponse);
1876
}
1877
Game.GrabDataResponse=function(response)
1878
{
1879
/*
1880
response should be formatted as
1881
{"herald":3,"grandma":"a|b|c|...}
1882
*/
1883
var r={};
1884
try{
1885
r=JSON.parse(response);
1886
if (typeof r['herald']!=='undefined')
1887
{
1888
Game.heralds=parseInt(r['herald']);
1889
Game.heralds=Math.max(0,Math.min(100,Game.heralds));
1890
}
1891
if (typeof r['grandma']!=='undefined' && r['grandma']!='')
1892
{
1893
Game.customGrandmaNames=r['grandma'].split('|');
1894
Game.customGrandmaNames=Game.customGrandmaNames.filter(function(el){return el!='';});
1895
}
1896
1897
l('heraldsAmount').textContent=Game.heralds;
1898
Game.externalDataLoaded=true;
1899
}catch(e){}
1900
}
1901
1902
1903
1904
Game.attachTooltip(l('httpsSwitch'),'<div style="padding:8px;width:350px;text-align:center;font-size:11px;">You are currently playing Cookie Clicker on the <b>'+(Game.https?'HTTPS':'HTTP')+'</b> protocol.<br>The <b>'+(Game.https?'HTTP':'HTTPS')+'</b> version uses a different save slot than this one.<br>Click this lock to reload the page and switch to the <b>'+(Game.https?'HTTP':'HTTPS')+'</b> version!</div>','this');
1905
AddEvent(l('httpsSwitch'),'click',function(){
1906
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
1907
if (location.protocol=='https:') location.href='http:'+window.location.href.substring(window.location.protocol.length);
1908
else if (location.protocol=='http:') location.href='https:'+window.location.href.substring(window.location.protocol.length);
1909
});
1910
1911
Game.attachTooltip(l('topbarTwitter'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s twitter, which frequently features game updates.</div>','this');
1912
Game.attachTooltip(l('topbarTumblr'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s tumblr, which frequently features game updates.</div>','this');
1913
Game.attachTooltip(l('topbarDiscord'),'<div style="padding:8px;width:250px;text-align:center;">Our official discord server.<br>You can share tips and questions about Cookie Clicker and all our other games!</div>','this');
1914
Game.attachTooltip(l('topbarPatreon'),'<div style="padding:8px;width:250px;text-align:center;">Support us on Patreon and help us keep updating Cookie Clicker!<br>There\'s neat rewards for patrons too!</div>','this');
1915
Game.attachTooltip(l('topbarMerch'),'<div style="padding:8px;width:250px;text-align:center;">Cookie Clicker shirts, hoodies and stickers!</div>','this');
1916
Game.attachTooltip(l('topbarMobileCC'),'<div style="padding:8px;width:250px;text-align:center;">Play Cookie Clicker on your phone!<br>(Android only; iOS version will be released later)</div>','this');
1917
1918
Game.attachTooltip(l('heralds'),function(){
1919
var str='';
1920
1921
if (!Game.externalDataLoaded) str+='Heralds couldn\'t be loaded. There may be an issue with our servers, or you are playing the game locally.';
1922
else
1923
{
1924
if (Game.heralds==0) str+='There are no heralds at the moment. Please consider <b style="color:#bc3aff;">donating to our Patreon</b>!';
1925
else
1926
{
1927
str+=(Game.heralds==1?'<b style="color:#bc3aff;text-shadow:0px 1px 0px #6d0096;">1 herald</b> is':'<b style="color:#fff;text-shadow:0px 1px 0px #6d0096,0px 0px 6px #bc3aff;">'+Game.heralds+' heralds</b> are')+' selflessly inspiring a boost in production for everyone, resulting in<br><b style="color:#cdaa89;text-shadow:0px 1px 0px #7c4532,0px 0px 6px #7c4532;"><div style="width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(img/money.png);"></div> +'+Game.heralds+'% cookies per second</b>.';
1928
str+='<div class="line"></div>';
1929
if (Game.ascensionMode==1) str+='You are in a <b>Born again</b> run, and are not currently benefiting from heralds.';
1930
else if (Game.Has('Heralds')) str+='You own the <b>Heralds</b> upgrade, and therefore benefit from the production boost.';
1931
else str+='To benefit from the herald bonus, you need a special upgrade you do not yet own. You will permanently unlock it later in the game.';
1932
}
1933
}
1934
str+='<div class="line"></div><span style="font-size:90%;opacity:0.6;"><b>Heralds</b> are people who have donated to our highest Patreon tier, and are limited to 100.<br>Each herald gives everyone +1% CpS.<br>Heralds benefit everyone playing the game, regardless of whether you donated.</span>';
1935
1936
str+='<div style="width:31px;height:39px;background:url(img/heraldFlag.png);position:absolute;top:0px;left:8px;"></div><div style="width:31px;height:39px;background:url(img/heraldFlag.png);position:absolute;top:0px;right:8px;"></div>';
1937
1938
return '<div style="padding:8px;width:300px;text-align:center;" class="prompt"><h3>Heralds</h3><div class="block">'+str+'</div></div>';
1939
},'this');
1940
l('heraldsAmount').textContent='?';
1941
l('heralds').style.display='inline-block';
1942
1943
Game.GrabData();
1944
1945
1946
Game.useLocalStorage=1;
1947
Game.localStorageGet=function(key)
1948
{
1949
var local=0;
1950
try {local=window.localStorage.getItem(key);} catch (exception) {}
1951
return local;
1952
}
1953
Game.localStorageSet=function(key,str)
1954
{
1955
var local=0;
1956
try {local=window.localStorage.setItem(key,str);} catch (exception) {}
1957
return local;
1958
}
1959
//window.localStorage.clear();//won't switch back to cookie-based if there is localStorage info
1960
1961
/*=====================================================================================
1962
SAVE
1963
=======================================================================================*/
1964
Game.ExportSave=function()
1965
{
1966
Game.prefs.showBackupWarning=0;
1967
Game.Prompt('<h3>Export save</h3><div class="block">This is your save code.<br>Copy it and keep it somewhere safe!</div><div class="block"><textarea id="textareaPrompt" style="width:100%;height:128px;" readonly>'+Game.WriteSave(1)+'</textarea></div>',['All done!']);//prompt('Copy this text and keep it somewhere safe!',Game.WriteSave(1));
1968
l('textareaPrompt').focus();l('textareaPrompt').select();
1969
}
1970
Game.ImportSave=function()
1971
{
1972
Game.Prompt('<h3>Import save</h3><div class="block">Please paste in the code that was given to you on save export.</div><div class="block"><textarea id="textareaPrompt" style="width:100%;height:128px;"></textarea></div>',[['Load','if (l(\'textareaPrompt\').value.length>0) {Game.ImportSaveCode(l(\'textareaPrompt\').value);Game.ClosePrompt();}'],'Nevermind']);//prompt('Please paste in the text that was given to you on save export.','');
1973
l('textareaPrompt').focus();
1974
}
1975
Game.ImportSaveCode=function(save)
1976
{
1977
if (save && save!='') Game.LoadSave(save);
1978
}
1979
1980
Game.FileSave=function()
1981
{
1982
Game.prefs.showBackupWarning=0;
1983
var filename=Game.bakeryName.replace(/[^a-zA-Z0-9]+/g,'')+'Bakery';
1984
var text=Game.WriteSave(1);
1985
var blob=new Blob([text],{type:'text/plain;charset=utf-8'});
1986
saveAs(blob,filename+'.txt');
1987
}
1988
Game.FileLoad=function(e)
1989
{
1990
if (e.target.files.length==0) return false;
1991
var file=e.target.files[0];
1992
var reader=new FileReader();
1993
reader.onload=function(e)
1994
{
1995
Game.ImportSaveCode(e.target.result);
1996
}
1997
reader.readAsText(file);
1998
}
1999
2000
Game.toSave=false;
2001
Game.WriteSave=function(type)
2002
{
2003
Game.toSave=false;
2004
//type : none is default, 1=return string only, 2=return uncompressed string, 3=return uncompressed, commented string
2005
Game.lastDate=parseInt(Game.time);
2006
var str='';
2007
if (type==3) str+='\nGame version\n';
2008
str+=Game.version+'|';
2009
str+='|';//just in case we need some more stuff here
2010
if (type==3) str+='\n\nRun details';
2011
str+=//save stats
2012
(type==3?'\n run start date : ':'')+parseInt(Game.startDate)+';'+
2013
(type==3?'\n legacy start date : ':'')+parseInt(Game.fullDate)+';'+
2014
(type==3?'\n date when we last opened the game : ':'')+parseInt(Game.lastDate)+';'+
2015
(type==3?'\n bakery name : ':'')+(Game.bakeryName)+';'+
2016
(type==3?'\n seed : ':'')+(Game.seed)+
2017
'|';
2018
if (type==3) str+='\n\nPacked preferences bitfield\n ';
2019
var str2=//prefs
2020
(Game.prefs.particles?'1':'0')+
2021
(Game.prefs.numbers?'1':'0')+
2022
(Game.prefs.autosave?'1':'0')+
2023
(Game.prefs.autoupdate?'1':'0')+
2024
(Game.prefs.milk?'1':'0')+
2025
(Game.prefs.fancy?'1':'0')+
2026
(Game.prefs.warn?'1':'0')+
2027
(Game.prefs.cursors?'1':'0')+
2028
(Game.prefs.focus?'1':'0')+
2029
(Game.prefs.format?'1':'0')+
2030
(Game.prefs.notifs?'1':'0')+
2031
(Game.prefs.wobbly?'1':'0')+
2032
(Game.prefs.monospace?'1':'0')+
2033
(Game.prefs.filters?'1':'0')+
2034
(Game.prefs.cookiesound?'1':'0')+
2035
(Game.prefs.crates?'1':'0')+
2036
(Game.prefs.showBackupWarning?'1':'0')+
2037
(Game.prefs.extraButtons?'1':'0')+
2038
(Game.prefs.askLumps?'1':'0')+
2039
(Game.prefs.customGrandmas?'1':'0')+
2040
(Game.prefs.timeout?'1':'0')+
2041
'';
2042
str2=pack3(str2);
2043
str+=str2+'|';
2044
if (type==3) str+='\n\nMisc game data';
2045
str+=
2046
(type==3?'\n cookies : ':'')+parseFloat(Game.cookies).toString()+';'+
2047
(type==3?'\n total cookies earned : ':'')+parseFloat(Game.cookiesEarned).toString()+';'+
2048
(type==3?'\n cookie clicks : ':'')+parseInt(Math.floor(Game.cookieClicks))+';'+
2049
(type==3?'\n golden cookie clicks : ':'')+parseInt(Math.floor(Game.goldenClicks))+';'+
2050
(type==3?'\n cookies made by clicking : ':'')+parseFloat(Game.handmadeCookies).toString()+';'+
2051
(type==3?'\n golden cookies missed : ':'')+parseInt(Math.floor(Game.missedGoldenClicks))+';'+
2052
(type==3?'\n background type : ':'')+parseInt(Math.floor(Game.bgType))+';'+
2053
(type==3?'\n milk type : ':'')+parseInt(Math.floor(Game.milkType))+';'+
2054
(type==3?'\n cookies from past runs : ':'')+parseFloat(Game.cookiesReset).toString()+';'+
2055
(type==3?'\n elder wrath : ':'')+parseInt(Math.floor(Game.elderWrath))+';'+
2056
(type==3?'\n pledges : ':'')+parseInt(Math.floor(Game.pledges))+';'+
2057
(type==3?'\n pledge time left : ':'')+parseInt(Math.floor(Game.pledgeT))+';'+
2058
(type==3?'\n currently researching : ':'')+parseInt(Math.floor(Game.nextResearch))+';'+
2059
(type==3?'\n research time left : ':'')+parseInt(Math.floor(Game.researchT))+';'+
2060
(type==3?'\n ascensions : ':'')+parseInt(Math.floor(Game.resets))+';'+
2061
(type==3?'\n golden cookie clicks (this run) : ':'')+parseInt(Math.floor(Game.goldenClicksLocal))+';'+
2062
(type==3?'\n cookies sucked by wrinklers : ':'')+parseFloat(Game.cookiesSucked).toString()+';'+
2063
(type==3?'\n wrinkles popped : ':'')+parseInt(Math.floor(Game.wrinklersPopped))+';'+
2064
(type==3?'\n santa level : ':'')+parseInt(Math.floor(Game.santaLevel))+';'+
2065
(type==3?'\n reindeer clicked : ':'')+parseInt(Math.floor(Game.reindeerClicked))+';'+
2066
(type==3?'\n season time left : ':'')+parseInt(Math.floor(Game.seasonT))+';'+
2067
(type==3?'\n season switcher uses : ':'')+parseInt(Math.floor(Game.seasonUses))+';'+
2068
(type==3?'\n current season : ':'')+(Game.season?Game.season:'')+';';
2069
var wrinklers=Game.SaveWrinklers();
2070
str+=
2071
(type==3?'\n amount of cookies contained in wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amount))+';'+
2072
(type==3?'\n number of wrinklers : ':'')+parseInt(Math.floor(wrinklers.number))+';'+
2073
(type==3?'\n prestige level : ':'')+parseFloat(Game.prestige).toString()+';'+
2074
(type==3?'\n heavenly chips : ':'')+parseFloat(Game.heavenlyChips).toString()+';'+
2075
(type==3?'\n heavenly chips spent : ':'')+parseFloat(Game.heavenlyChipsSpent).toString()+';'+
2076
(type==3?'\n heavenly cookies : ':'')+parseFloat(Game.heavenlyCookies).toString()+';'+
2077
(type==3?'\n ascension mode : ':'')+parseInt(Math.floor(Game.ascensionMode))+';'+
2078
(type==3?'\n permanent upgrades : ':'')+parseInt(Math.floor(Game.permanentUpgrades[0]))+';'+parseInt(Math.floor(Game.permanentUpgrades[1]))+';'+parseInt(Math.floor(Game.permanentUpgrades[2]))+';'+parseInt(Math.floor(Game.permanentUpgrades[3]))+';'+parseInt(Math.floor(Game.permanentUpgrades[4]))+';'+
2079
(type==3?'\n dragon level : ':'')+parseInt(Math.floor(Game.dragonLevel))+';'+
2080
(type==3?'\n dragon aura : ':'')+parseInt(Math.floor(Game.dragonAura))+';'+
2081
(type==3?'\n dragon aura 2 : ':'')+parseInt(Math.floor(Game.dragonAura2))+';'+
2082
(type==3?'\n chime type : ':'')+parseInt(Math.floor(Game.chimeType))+';'+
2083
(type==3?'\n volume : ':'')+parseInt(Math.floor(Game.volume))+';'+
2084
(type==3?'\n number of shiny wrinklers : ':'')+parseInt(Math.floor(wrinklers.shinies))+';'+
2085
(type==3?'\n amount of cookies contained in shiny wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amountShinies))+';'+
2086
(type==3?'\n current amount of sugar lumps : ':'')+parseFloat(Math.floor(Game.lumps))+';'+
2087
(type==3?'\n total amount of sugar lumps made : ':'')+parseFloat(Math.floor(Game.lumpsTotal))+';'+
2088
(type==3?'\n time when current sugar lump started : ':'')+parseFloat(Math.floor(Game.lumpT))+';'+
2089
(type==3?'\n time when last refilled a minigame with a sugar lump : ':'')+parseFloat(Math.floor(Game.lumpRefill))+';'+
2090
(type==3?'\n sugar lump type : ':'')+parseInt(Math.floor(Game.lumpCurrentType))+';'+
2091
(type==3?'\n vault : ':'')+Game.vault.join(',')+';'+
2092
(type==3?'\n heralds : ':'')+parseInt(Game.heralds)+';'+
2093
(type==3?'\n golden cookie fortune : ':'')+parseInt(Game.fortuneGC)+';'+
2094
(type==3?'\n CpS fortune : ':'')+parseInt(Game.fortuneCPS)+';'+
2095
(type==3?'\n highest raw CpS : ':'')+parseFloat(Game.cookiesPsRawHighest)+';'+
2096
'|';//cookies and lots of other stuff
2097
2098
if (type==3) str+='\n\nBuildings : amount, bought, cookies produced, level, minigame data';
2099
for (var i in Game.Objects)//buildings
2100
{
2101
var me=Game.Objects[i];
2102
if (type==3) str+='\n '+me.name+' : ';
2103
if (me.vanilla)
2104
{
2105
str+=me.amount+','+me.bought+','+parseFloat(Math.floor(me.totalCookies))+','+parseInt(me.level);
2106
if (Game.isMinigameReady(me)) str+=','+me.minigame.save(); else str+=',';
2107
str+=','+(me.muted?'1':'0');
2108
str+=','+me.highest;
2109
str+=';';
2110
}
2111
}
2112
str+='|';
2113
if (type==3) str+='\n\nPacked upgrades bitfield (unlocked and bought)\n ';
2114
var toCompress=[];
2115
for (var i in Game.UpgradesById)//upgrades
2116
{
2117
var me=Game.UpgradesById[i];
2118
if (me.vanilla) toCompress.push(Math.min(me.unlocked,1),Math.min(me.bought,1));
2119
};
2120
2121
toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);
2122
2123
str+=toCompress;
2124
str+='|';
2125
if (type==3) str+='\n\nPacked achievements bitfield (won)\n ';
2126
var toCompress=[];
2127
for (var i in Game.AchievementsById)//achievements
2128
{
2129
var me=Game.AchievementsById[i];
2130
if (me.vanilla) toCompress.push(Math.min(me.won));
2131
}
2132
toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);
2133
str+=toCompress;
2134
2135
str+='|';
2136
if (type==3) str+='\n\nBuffs : type, maxTime, time, arg1, arg2, arg3';
2137
for (var i in Game.buffs)
2138
{
2139
var me=Game.buffs[i];
2140
if (me.type)
2141
{
2142
if (type==3) str+='\n '+me.type.name+' : ';
2143
if (me.type.vanilla)
2144
{
2145
str+=me.type.id+','+me.maxTime+','+me.time;
2146
if (typeof me.arg1!=='undefined') str+=','+parseFloat(me.arg1);
2147
if (typeof me.arg2!=='undefined') str+=','+parseFloat(me.arg2);
2148
if (typeof me.arg3!=='undefined') str+=','+parseFloat(me.arg3);
2149
str+=';';
2150
}
2151
}
2152
}
2153
2154
2155
if (type==3) str+='\n\nCustom :\n';
2156
2157
str+='|';
2158
str+=Game.saveModData();
2159
2160
if (type==2 || type==3)
2161
{
2162
return str;
2163
}
2164
else if (type==1)
2165
{
2166
str=escape(utf8_to_b64(str)+'!END!');
2167
return str;
2168
}
2169
else
2170
{
2171
if (Game.useLocalStorage)
2172
{
2173
//so we used to save the game using browser cookies, which was just really neat considering the game's name
2174
//we're using localstorage now, which is more efficient but not as cool
2175
//a moment of silence for our fallen puns
2176
str=utf8_to_b64(str)+'!END!';
2177
if (str.length<10)
2178
{
2179
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Purchasing an upgrade might fix this.');
2180
else Game.Notify('Saving failed!','Purchasing an upgrade and saving again might fix this.<br>This really shouldn\'t happen; please notify Orteil on his tumblr.');
2181
}
2182
else
2183
{
2184
str=escape(str);
2185
Game.localStorageSet(Game.SaveTo,str);//aaand save
2186
if (!Game.localStorageGet(Game.SaveTo))
2187
{
2188
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');
2189
else Game.Notify('Error while saving','Export your save instead!');
2190
}
2191
else if (document.hasFocus())
2192
{
2193
if (Game.prefs.popups) Game.Popup('Game saved');
2194
else Game.Notify('Game saved','','',1,1);
2195
}
2196
}
2197
}
2198
else//legacy system
2199
{
2200
//that's right
2201
//we're using cookies
2202
//yeah I went there
2203
var now=new Date();//we storin dis for 5 years, people
2204
now.setFullYear(now.getFullYear()+5);//mmh stale cookies
2205
str=utf8_to_b64(str)+'!END!';
2206
Game.saveData=escape(str);
2207
str=Game.SaveTo+'='+escape(str)+'; expires='+now.toUTCString()+';';
2208
document.cookie=str;//aaand save
2209
if (document.cookie.indexOf(Game.SaveTo)<0)
2210
{
2211
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');
2212
else Game.Notify('Error while saving','Export your save instead!','',0,1);
2213
}
2214
else if (document.hasFocus())
2215
{
2216
if (Game.prefs.popups) Game.Popup('Game saved');
2217
else Game.Notify('Game saved','','',1,1);
2218
}
2219
}
2220
}
2221
}
2222
2223
/*=====================================================================================
2224
LOAD
2225
=======================================================================================*/
2226
Game.salvageSave=function()
2227
{
2228
//for when Cookie Clicker won't load and you need your save
2229
console.log('===================================================');
2230
console.log('This is your save data. Copypaste it (without quotation marks) into another version using the "Import save" feature.');
2231
console.log(Game.localStorageGet(Game.SaveTo));
2232
}
2233
Game.LoadSave=function(data)
2234
{
2235
var str='';
2236
if (data) str=unescape(data);
2237
else
2238
{
2239
if (Game.useLocalStorage)
2240
{
2241
var local=Game.localStorageGet(Game.SaveTo);
2242
if (!local)//no localstorage save found? let's get the cookie one last time
2243
{
2244
if (document.cookie.indexOf(Game.SaveTo)>=0)
2245
{
2246
str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);
2247
document.cookie=Game.SaveTo+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
2248
}
2249
else return false;
2250
}
2251
else
2252
{
2253
str=unescape(local);
2254
}
2255
}
2256
else//legacy system
2257
{
2258
if (document.cookie.indexOf(Game.SaveTo)>=0) str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);//get cookie here
2259
else return false;
2260
}
2261
}
2262
if (str!='')
2263
{
2264
var version=0;
2265
var oldstr=str.split('|');
2266
if (oldstr[0]<1) {}
2267
else
2268
{
2269
str=str.split('!END!')[0];
2270
str=b64_to_utf8(str);
2271
}
2272
if (str!='')
2273
{
2274
var spl='';
2275
str=str.split('|');
2276
version=parseFloat(str[0]);
2277
2278
if (isNaN(version) || str.length<5)
2279
{
2280
if (Game.prefs.popups) Game.Popup('Oops, looks like the import string is all wrong!');
2281
else Game.Notify('Error importing save','Oops, looks like the import string is all wrong!','',6,1);
2282
return false;
2283
}
2284
if (version>=1 && version>Game.version)
2285
{
2286
if (Game.prefs.popups) Game.Popup('Error : you are attempting to load a save from a future version (v. '+version+'; you are using v. '+Game.version+').');
2287
else Game.Notify('Error importing save','You are attempting to load a save from a future version (v. '+version+'; you are using v. '+Game.version+').','',6,1);
2288
return false;
2289
}
2290
if (version==1.0501)//prompt if we loaded from the 2014 beta
2291
{
2292
setTimeout(function(){Game.Prompt('<h3>New beta</h3><div class="block">Hey there! Unfortunately, your old beta save won\'t work here anymore; you\'ll have to start fresh or import your save from the live version.<div class="line"></div>Thank you for beta-testing Cookie Clicker, we hope you\'ll enjoy it and find strange and interesting bugs!</div>',[['Alright then!','Game.ClosePrompt();']]);},200);
2293
return false;
2294
}
2295
else if (version<1.0501)//prompt if we loaded from the 2014 live version
2296
{
2297
setTimeout(function(){Game.Prompt('<h3>Update</h3><div class="block"><b>Hey there!</b> Cookie Clicker just received a pretty substantial update, and you might notice that some things have been moved around. Don\'t panic!<div class="line"></div>Your building numbers may look strange, making it seem like you own buildings you\'ve never bought; this is because we\'ve added <b>3 new buildings</b> after factories (and swapped mines and factories), offsetting everything after them. Likewise, some building-related upgrades and achievements may look a tad shuffled around. This is all perfectly normal!<div class="line"></div>We\'ve also rebalanced Heavenly Chips amounts and behavior. Your amount of chips might be lower or higher than before.<br>You can now ascend through the <b>Legacy button</b> at the top!<div class="line"></div>Thank you for playing Cookie Clicker. We\'ve put a lot of work and care into this update and we hope you\'ll enjoy it!</div>',[['Neat!','Game.ClosePrompt();']]);},200);
2298
}
2299
if (version>=1)
2300
{
2301
Game.T=0;
2302
2303
spl=str[2].split(';');//save stats
2304
Game.startDate=parseInt(spl[0]);
2305
Game.fullDate=parseInt(spl[1]);
2306
Game.lastDate=parseInt(spl[2]);
2307
Game.bakeryNameSet(spl[3]?spl[3]:Game.GetBakeryName());
2308
Game.seed=spl[4]?spl[4]:Game.makeSeed();
2309
//prefs
2310
if (version<1.0503) spl=str[3].split('');
2311
else if (version<2.0046) spl=unpack2(str[3]).split('');
2312
else spl=(str[3]).split('');
2313
Game.prefs.particles=parseInt(spl[0]);
2314
Game.prefs.numbers=parseInt(spl[1]);
2315
Game.prefs.autosave=parseInt(spl[2]);
2316
Game.prefs.autoupdate=spl[3]?parseInt(spl[3]):1;
2317
Game.prefs.milk=spl[4]?parseInt(spl[4]):1;
2318
Game.prefs.fancy=parseInt(spl[5]);if (Game.prefs.fancy) Game.removeClass('noFancy'); else if (!Game.prefs.fancy) Game.addClass('noFancy');
2319
Game.prefs.warn=spl[6]?parseInt(spl[6]):0;
2320
Game.prefs.cursors=spl[7]?parseInt(spl[7]):0;
2321
Game.prefs.focus=spl[8]?parseInt(spl[8]):0;
2322
Game.prefs.format=spl[9]?parseInt(spl[9]):0;
2323
Game.prefs.notifs=spl[10]?parseInt(spl[10]):0;
2324
Game.prefs.wobbly=spl[11]?parseInt(spl[11]):0;
2325
Game.prefs.monospace=spl[12]?parseInt(spl[12]):0;
2326
Game.prefs.filters=parseInt(spl[13]);if (Game.prefs.filters) Game.removeClass('noFilters'); else if (!Game.prefs.filters) Game.addClass('noFilters');
2327
Game.prefs.cookiesound=spl[14]?parseInt(spl[14]):1;
2328
Game.prefs.crates=spl[15]?parseInt(spl[15]):0;
2329
Game.prefs.showBackupWarning=spl[16]?parseInt(spl[16]):1;
2330
Game.prefs.extraButtons=spl[17]?parseInt(spl[17]):1;if (!Game.prefs.extraButtons) Game.removeClass('extraButtons'); else if (Game.prefs.extraButtons) Game.addClass('extraButtons');
2331
Game.prefs.askLumps=spl[18]?parseInt(spl[18]):0;
2332
Game.prefs.customGrandmas=spl[19]?parseInt(spl[19]):1;
2333
Game.prefs.timeout=spl[20]?parseInt(spl[20]):0;
2334
BeautifyAll();
2335
spl=str[4].split(';');//cookies and lots of other stuff
2336
Game.cookies=parseFloat(spl[0]);
2337
Game.cookiesEarned=parseFloat(spl[1]);
2338
Game.cookieClicks=spl[2]?parseInt(spl[2]):0;
2339
Game.goldenClicks=spl[3]?parseInt(spl[3]):0;
2340
Game.handmadeCookies=spl[4]?parseFloat(spl[4]):0;
2341
Game.missedGoldenClicks=spl[5]?parseInt(spl[5]):0;
2342
Game.bgType=spl[6]?parseInt(spl[6]):0;
2343
Game.milkType=spl[7]?parseInt(spl[7]):0;
2344
Game.cookiesReset=spl[8]?parseFloat(spl[8]):0;
2345
Game.elderWrath=spl[9]?parseInt(spl[9]):0;
2346
Game.pledges=spl[10]?parseInt(spl[10]):0;
2347
Game.pledgeT=spl[11]?parseInt(spl[11]):0;
2348
Game.nextResearch=spl[12]?parseInt(spl[12]):0;
2349
Game.researchT=spl[13]?parseInt(spl[13]):0;
2350
Game.resets=spl[14]?parseInt(spl[14]):0;
2351
Game.goldenClicksLocal=spl[15]?parseInt(spl[15]):0;
2352
Game.cookiesSucked=spl[16]?parseFloat(spl[16]):0;
2353
Game.wrinklersPopped=spl[17]?parseInt(spl[17]):0;
2354
Game.santaLevel=spl[18]?parseInt(spl[18]):0;
2355
Game.reindeerClicked=spl[19]?parseInt(spl[19]):0;
2356
Game.seasonT=spl[20]?parseInt(spl[20]):0;
2357
Game.seasonUses=spl[21]?parseInt(spl[21]):0;
2358
Game.season=spl[22]?spl[22]:Game.baseSeason;
2359
var wrinklers={amount:spl[23]?parseFloat(spl[23]):0,number:spl[24]?parseInt(spl[24]):0};
2360
Game.prestige=spl[25]?parseFloat(spl[25]):0;
2361
Game.heavenlyChips=spl[26]?parseFloat(spl[26]):0;
2362
Game.heavenlyChipsSpent=spl[27]?parseFloat(spl[27]):0;
2363
Game.heavenlyCookies=spl[28]?parseFloat(spl[28]):0;
2364
Game.ascensionMode=spl[29]?parseInt(spl[29]):0;
2365
Game.permanentUpgrades[0]=spl[30]?parseInt(spl[30]):-1;Game.permanentUpgrades[1]=spl[31]?parseInt(spl[31]):-1;Game.permanentUpgrades[2]=spl[32]?parseInt(spl[32]):-1;Game.permanentUpgrades[3]=spl[33]?parseInt(spl[33]):-1;Game.permanentUpgrades[4]=spl[34]?parseInt(spl[34]):-1;
2366
//if (version<1.05) {Game.heavenlyChipsEarned=Game.HowMuchPrestige(Game.cookiesReset);Game.heavenlyChips=Game.heavenlyChipsEarned;}
2367
Game.dragonLevel=spl[35]?parseInt(spl[35]):0;
2368
if (version<2.0041 && Game.dragonLevel==Game.dragonLevels.length-2) {Game.dragonLevel=Game.dragonLevels.length-1;}
2369
Game.dragonAura=spl[36]?parseInt(spl[36]):0;
2370
Game.dragonAura2=spl[37]?parseInt(spl[37]):0;
2371
Game.chimeType=spl[38]?parseInt(spl[38]):0;
2372
Game.volume=spl[39]?parseInt(spl[39]):50;
2373
wrinklers.shinies=spl[40]?parseInt(spl[40]):0;
2374
wrinklers.amountShinies=spl[41]?parseFloat(spl[41]):0;
2375
Game.lumps=spl[42]?parseFloat(spl[42]):-1;
2376
Game.lumpsTotal=spl[43]?parseFloat(spl[43]):-1;
2377
Game.lumpT=spl[44]?parseInt(spl[44]):Date.now();
2378
Game.lumpRefill=spl[45]?parseInt(spl[45]):0;
2379
if (version<2.022) Game.lumpRefill=Game.fps*60;
2380
Game.lumpCurrentType=spl[46]?parseInt(spl[46]):0;
2381
Game.vault=spl[47]?spl[47].split(','):[];
2382
for (var i in Game.vault){Game.vault[i]=parseInt(Game.vault[i]);}
2383
var actualHeralds=Game.heralds;//we store the actual amount of heralds to restore it later; here we used the amount present in the save to compute offline CpS
2384
Game.heralds=spl[48]?parseInt(spl[48]):Game.heralds;
2385
Game.fortuneGC=spl[49]?parseInt(spl[49]):0;
2386
Game.fortuneCPS=spl[50]?parseInt(spl[50]):0;
2387
Game.cookiesPsRawHighest=spl[51]?parseFloat(spl[51]):0;
2388
2389
spl=str[5].split(';');//buildings
2390
Game.BuildingsOwned=0;
2391
for (var i in Game.ObjectsById)
2392
{
2393
var me=Game.ObjectsById[i];
2394
me.switchMinigame(false);
2395
me.pics=[];
2396
if (spl[i])
2397
{
2398
var mestr=spl[i].toString().split(',');
2399
me.amount=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);me.totalCookies=parseFloat(mestr[2]);me.level=parseInt(mestr[3]||0);me.highest=(version>=2.024?parseInt(mestr[6]):me.amount);
2400
if (me.minigame && me.minigameLoaded && me.minigame.reset) {me.minigame.reset(true);me.minigame.load(mestr[4]||'');} else me.minigameSave=(mestr[4]||0);
2401
me.muted=parseInt(mestr[5])||0;
2402
Game.BuildingsOwned+=me.amount;
2403
if (version<2.003) me.level=0;
2404
}
2405
else
2406
{
2407
me.amount=0;me.unlocked=0;me.bought=0;me.highest=0;me.totalCookies=0;me.level=0;
2408
}
2409
}
2410
2411
Game.LoadMinigames();
2412
2413
if (version<1.035)//old non-binary algorithm
2414
{
2415
spl=str[6].split(';');//upgrades
2416
Game.UpgradesOwned=0;
2417
for (var i in Game.UpgradesById)
2418
{
2419
var me=Game.UpgradesById[i];
2420
if (spl[i])
2421
{
2422
var mestr=spl[i].split(',');
2423
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2424
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2425
}
2426
else
2427
{
2428
me.unlocked=0;me.bought=0;
2429
}
2430
}
2431
if (str[7]) spl=str[7].split(';'); else spl=[];//achievements
2432
Game.AchievementsOwned=0;
2433
for (var i in Game.AchievementsById)
2434
{
2435
var me=Game.AchievementsById[i];
2436
if (spl[i])
2437
{
2438
var mestr=spl[i].split(',');
2439
me.won=parseInt(mestr[0]);
2440
}
2441
else
2442
{
2443
me.won=0;
2444
}
2445
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2446
}
2447
}
2448
else if (version<1.0502)//old awful packing system
2449
{
2450
if (str[6]) spl=str[6]; else spl=[];//upgrades
2451
if (version<1.05) spl=UncompressLargeBin(spl);
2452
else spl=unpack(spl);
2453
Game.UpgradesOwned=0;
2454
for (var i in Game.UpgradesById)
2455
{
2456
var me=Game.UpgradesById[i];
2457
if (spl[i*2])
2458
{
2459
var mestr=[spl[i*2],spl[i*2+1]];
2460
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2461
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2462
}
2463
else
2464
{
2465
me.unlocked=0;me.bought=0;
2466
}
2467
}
2468
if (str[7]) spl=str[7]; else spl=[];//achievements
2469
if (version<1.05) spl=UncompressLargeBin(spl);
2470
else spl=unpack(spl);
2471
Game.AchievementsOwned=0;
2472
for (var i in Game.AchievementsById)
2473
{
2474
var me=Game.AchievementsById[i];
2475
if (spl[i])
2476
{
2477
var mestr=[spl[i]];
2478
me.won=parseInt(mestr[0]);
2479
}
2480
else
2481
{
2482
me.won=0;
2483
}
2484
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2485
}
2486
}
2487
else
2488
{
2489
if (str[6]) spl=str[6]; else spl=[];//upgrades
2490
if (version<2.0046) spl=unpack2(spl).split('');
2491
else spl=(spl).split('');
2492
Game.UpgradesOwned=0;
2493
for (var i in Game.UpgradesById)
2494
{
2495
var me=Game.UpgradesById[i];
2496
if (spl[i*2])
2497
{
2498
var mestr=[spl[i*2],spl[i*2+1]];
2499
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2500
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2501
}
2502
else
2503
{
2504
me.unlocked=0;me.bought=0;
2505
}
2506
}
2507
if (str[7]) spl=str[7]; else spl=[];//achievements
2508
if (version<2.0046) spl=unpack2(spl).split('');
2509
else spl=(spl).split('');
2510
Game.AchievementsOwned=0;
2511
for (var i in Game.AchievementsById)
2512
{
2513
var me=Game.AchievementsById[i];
2514
if (spl[i])
2515
{
2516
var mestr=[spl[i]];
2517
me.won=parseInt(mestr[0]);
2518
}
2519
else
2520
{
2521
me.won=0;
2522
}
2523
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2524
}
2525
}
2526
2527
Game.killBuffs();
2528
var buffsToLoad=[];
2529
spl=(str[8]||'').split(';');//buffs
2530
for (var i in spl)
2531
{
2532
if (spl[i])
2533
{
2534
var mestr=spl[i].toString().split(',');
2535
buffsToLoad.push(mestr);
2536
}
2537
}
2538
2539
2540
spl=(str[9]||'').split(';');//mod data
2541
2542
for (var i in spl)
2543
{
2544
if (spl[i])
2545
{
2546
var data=spl[i].split(':');
2547
var modId=data[0];
2548
data.shift();
2549
data=Game.safeLoadString(data.join(':'));
2550
Game.modSaveData[modId]=data;
2551
}
2552
}
2553
2554
for (var i in Game.ObjectsById)
2555
{
2556
var me=Game.ObjectsById[i];
2557
if (me.buyFunction) me.buyFunction();
2558
me.refresh();
2559
if (me.id>0)
2560
{
2561
if (me.muted) me.mute(1);
2562
}
2563
}
2564
2565
if (version<1.0503)//upgrades that used to be regular, but are now heavenly
2566
{
2567
var me=Game.Upgrades['Persistent memory'];me.unlocked=0;me.bought=0;
2568
var me=Game.Upgrades['Season switcher'];me.unlocked=0;me.bought=0;
2569
}
2570
2571
if (Game.bgType==-1) Game.bgType=0;
2572
if (Game.milkType==-1) Game.milkType=0;
2573
2574
2575
//advance timers
2576
var framesElapsed=Math.ceil(((Date.now()-Game.lastDate)/1000)*Game.fps);
2577
if (Game.pledgeT>0) Game.pledgeT=Math.max(Game.pledgeT-framesElapsed,1);
2578
if (Game.seasonT>0) Game.seasonT=Math.max(Game.seasonT-framesElapsed,1);
2579
if (Game.researchT>0) Game.researchT=Math.max(Game.researchT-framesElapsed,1);
2580
2581
2582
Game.ResetWrinklers();
2583
Game.LoadWrinklers(wrinklers.amount,wrinklers.number,wrinklers.shinies,wrinklers.amountShinies);
2584
2585
//recompute season trigger prices
2586
if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}
2587
Game.computeSeasonPrices();
2588
2589
//recompute prestige
2590
Game.prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
2591
//if ((Game.heavenlyChips+Game.heavenlyChipsSpent)<Game.prestige)
2592
//{Game.heavenlyChips=Game.prestige;Game.heavenlyChipsSpent=0;}//chips owned and spent don't add up to total prestige? set chips owned to prestige
2593
2594
2595
Game.loadModData();
2596
2597
2598
if (version==1.037 && Game.beta)//are we opening the new beta? if so, save the old beta to /betadungeons
2599
{
2600
window.localStorage.setItem('CookieClickerGameBetaDungeons',window.localStorage.getItem('CookieClickerGameBeta'));
2601
Game.Notify('Beta save data','Your beta save data has been safely exported to /betadungeons.',20);
2602
}
2603
else if (version==1.0501 && Game.beta)//are we opening the newer beta? if so, save the old beta to /oldbeta
2604
{
2605
window.localStorage.setItem('CookieClickerGameOld',window.localStorage.getItem('CookieClickerGameBeta'));
2606
//Game.Notify('Beta save data','Your beta save data has been safely exported to /oldbeta.',20);
2607
}
2608
if (version<=1.0466 && !Game.beta)//export the old 2014 version to /v10466
2609
{
2610
window.localStorage.setItem('CookieClickerGamev10466',window.localStorage.getItem('CookieClickerGame'));
2611
//Game.Notify('Beta save data','Your save data has been safely exported to /v10466.',20);
2612
}
2613
if (version==1.9)//are we importing from the 1.9 beta? remove all heavenly upgrades and refund heavenly chips
2614
{
2615
for (var i in Game.UpgradesById)
2616
{
2617
var me=Game.UpgradesById[i];
2618
if (me.bought && me.pool=='prestige')
2619
{
2620
me.unlocked=0;
2621
me.bought=0;
2622
}
2623
}
2624
Game.heavenlyChips=Game.prestige;
2625
Game.heavenlyChipsSpent=0;
2626
2627
setTimeout(function(){Game.Prompt('<h3>Beta patch</h3><div class="block">We\'ve tweaked some things and fixed some others, please check the update notes!<div class="line"></div>Of note : due to changes in prestige balancing, all your heavenly upgrades have been removed and your heavenly chips refunded; you\'ll be able to reallocate them next time you ascend.<div class="line"></div>Thank you again for beta-testing Cookie Clicker!</div>',[['Alright then!','Game.ClosePrompt();']]);},200);
2628
}
2629
if (version<=1.0466)//are we loading from the old live version? reset HCs
2630
{
2631
Game.heavenlyChips=Game.prestige;
2632
Game.heavenlyChipsSpent=0;
2633
}
2634
2635
if (Game.ascensionMode!=1)
2636
{
2637
if (Game.Has('Starter kit')) Game.Objects['Cursor'].free=10;
2638
if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].free=5;
2639
}
2640
2641
Game.CalculateGains();
2642
2643
var timeOffline=(Date.now()-Game.lastDate)/1000;
2644
2645
if (Math.random()<1/10000) Game.TOYS=1;//teehee!
2646
2647
//compute cookies earned while the game was closed
2648
if (Game.mobile || Game.Has('Perfect idling') || Game.Has('Twin Gates of Transcendence'))
2649
{
2650
if (Game.Has('Perfect idling'))
2651
{
2652
var maxTime=60*60*24*1000000000;
2653
var percent=100;
2654
}
2655
else
2656
{
2657
var maxTime=60*60;
2658
if (Game.Has('Belphegor')) maxTime*=2;
2659
if (Game.Has('Mammon')) maxTime*=2;
2660
if (Game.Has('Abaddon')) maxTime*=2;
2661
if (Game.Has('Satan')) maxTime*=2;
2662
if (Game.Has('Asmodeus')) maxTime*=2;
2663
if (Game.Has('Beelzebub')) maxTime*=2;
2664
if (Game.Has('Lucifer')) maxTime*=2;
2665
2666
var percent=5;
2667
if (Game.Has('Angels')) percent+=10;
2668
if (Game.Has('Archangels')) percent+=10;
2669
if (Game.Has('Virtues')) percent+=10;
2670
if (Game.Has('Dominions')) percent+=10;
2671
if (Game.Has('Cherubim')) percent+=10;
2672
if (Game.Has('Seraphim')) percent+=10;
2673
if (Game.Has('God')) percent+=10;
2674
2675
if (Game.Has('Chimera')) {maxTime+=60*60*24*2;percent+=5;}
2676
2677
if (Game.Has('Fern tea')) percent+=3;
2678
if (Game.Has('Ichor syrup')) percent+=7;
2679
if (Game.Has('Fortune #102')) percent+=1;
2680
}
2681
2682
var timeOfflineOptimal=Math.min(timeOffline,maxTime);
2683
var timeOfflineReduced=Math.max(0,timeOffline-timeOfflineOptimal);
2684
var amount=(timeOfflineOptimal+timeOfflineReduced*0.1)*Game.cookiesPs*(percent/100);
2685
2686
if (amount>0)
2687
{
2688
if (Game.prefs.popups) Game.Popup('Earned '+Beautify(amount)+' cookie'+(Math.floor(amount)==1?'':'s')+' while you were away');
2689
else Game.Notify('Welcome back!','You earned <b>'+Beautify(amount)+'</b> cookie'+(Math.floor(amount)==1?'':'s')+' while you were away.<br>('+Game.sayTime(timeOfflineOptimal*Game.fps,-1)+' at '+Math.floor(percent)+'% CpS'+(timeOfflineReduced?', plus '+Game.sayTime(timeOfflineReduced*Game.fps,-1)+' at '+(Math.floor(percent*10)/100)+'%':'')+'.)',[Math.floor(Math.random()*16),11]);
2690
Game.Earn(amount);
2691
}
2692
}
2693
2694
//we load buffs after everything as we do not want them to interfer with offline CpS
2695
for (var i in buffsToLoad)
2696
{
2697
var mestr=buffsToLoad[i];
2698
var type=Game.buffTypes[parseInt(mestr[0])];
2699
Game.gainBuff(type.name,parseFloat(mestr[1])/Game.fps,parseFloat(mestr[3]||0),parseFloat(mestr[4]||0),parseFloat(mestr[5]||0)).time=parseFloat(mestr[2]);
2700
}
2701
2702
2703
Game.loadLumps(timeOffline);
2704
2705
Game.bakeryNameRefresh();
2706
2707
}
2708
else//importing old version save
2709
{
2710
Game.Notify('Error importing save','Sorry, you can\'t import saves from the old version anymore.','',6,1);
2711
return false;
2712
}
2713
2714
2715
Game.RebuildUpgrades();
2716
2717
Game.TickerAge=0;
2718
Game.TickerEffect=0;
2719
2720
Game.elderWrathD=0;
2721
Game.recalculateGains=1;
2722
Game.storeToRefresh=1;
2723
Game.upgradesToRebuild=1;
2724
2725
Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);
2726
2727
Game.specialTab='';
2728
Game.ToggleSpecialMenu(0);
2729
2730
Game.killShimmers();
2731
2732
if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie
2733
{
2734
Game.ReincarnateTimer=1;
2735
Game.addClass('reincarnating');
2736
Game.BigCookieSize=0;
2737
}
2738
2739
if (version<Game.version) l('logButton').classList.add('hasUpdate');
2740
2741
if (Game.season!='' && Game.season==Game.baseSeason)
2742
{
2743
if (Game.season=='valentines') Game.Notify('Valentine\'s Day!','It\'s <b>Valentine\'s season</b>!<br>Love\'s in the air and cookies are just that much sweeter!',[20,3],60*3);
2744
else if (Game.season=='fools') Game.Notify('Business Day!','It\'s <b>Business season</b>!<br>Don\'t panic! Things are gonna be looking a little more corporate for a few days.',[17,6],60*3);
2745
else if (Game.season=='halloween') Game.Notify('Halloween!','It\'s <b>Halloween season</b>!<br>Everything is just a little bit spookier!',[13,8],60*3);
2746
else if (Game.season=='christmas') Game.Notify('Christmas time!','It\'s <b>Christmas season</b>!<br>Bring good cheer to all and you just may get cookies in your stockings!',[12,10],60*3);
2747
else if (Game.season=='easter') Game.Notify('Easter!','It\'s <b>Easter season</b>!<br>Keep an eye out and you just might click a rabbit or two!',[0,12],60*3);
2748
}
2749
2750
Game.heralds=actualHeralds;
2751
2752
if (Game.prefs.popups) Game.Popup('Game loaded');
2753
else Game.Notify('Game loaded','','',1,1);
2754
2755
if (Game.prefs.showBackupWarning==1) Game.showBackupWarning();
2756
}
2757
}
2758
else return false;
2759
return true;
2760
}
2761
2762
/*=====================================================================================
2763
RESET
2764
=======================================================================================*/
2765
Game.Reset=function(hard)
2766
{
2767
Game.T=0;
2768
2769
var cookiesForfeited=Game.cookiesEarned;
2770
if (!hard)
2771
{
2772
if (cookiesForfeited>=1000000) Game.Win('Sacrifice');
2773
if (cookiesForfeited>=1000000000) Game.Win('Oblivion');
2774
if (cookiesForfeited>=1000000000000) Game.Win('From scratch');
2775
if (cookiesForfeited>=1000000000000000) Game.Win('Nihilism');
2776
if (cookiesForfeited>=1000000000000000000) Game.Win('Dematerialize');
2777
if (cookiesForfeited>=1000000000000000000000) Game.Win('Nil zero zilch');
2778
if (cookiesForfeited>=1000000000000000000000000) Game.Win('Transcendence');
2779
if (cookiesForfeited>=1000000000000000000000000000) Game.Win('Obliterate');
2780
if (cookiesForfeited>=1000000000000000000000000000000) Game.Win('Negative void');
2781
if (cookiesForfeited>=1000000000000000000000000000000000) Game.Win('To crumbs, you say?');
2782
if (cookiesForfeited>=1000000000000000000000000000000000000) Game.Win('You get nothing');
2783
if (cookiesForfeited>=1000000000000000000000000000000000000000) Game.Win('Humble rebeginnings');
2784
if (cookiesForfeited>=1000000000000000000000000000000000000000000) Game.Win('The end of the world');
2785
if (cookiesForfeited>=1000000000000000000000000000000000000000000000) Game.Win('Oh, you\'re back');
2786
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000) Game.Win('Lazarus');
2787
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000) Game.Win('Smurf account');
2788
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000000) Game.Win('If at first you don\'t succeed');
2789
2790
if (Math.round(Game.cookies)==1000000000000) Game.Win('When the cookies ascend just right');
2791
}
2792
2793
Game.killBuffs();
2794
2795
Game.seed=Game.makeSeed();
2796
2797
Game.cookiesReset+=Game.cookiesEarned;
2798
Game.cookies=0;
2799
Game.cookiesEarned=0;
2800
Game.cookieClicks=0;
2801
Game.goldenClicksLocal=0;
2802
//Game.goldenClicks=0;
2803
//Game.missedGoldenClicks=0;
2804
Game.handmadeCookies=0;
2805
Game.cookiesPsRawHighest=0;
2806
if (hard)
2807
{
2808
Game.bgType=0;
2809
Game.milkType=0;
2810
Game.chimeType=0;
2811
2812
Game.vault=[];
2813
}
2814
Game.pledges=0;
2815
Game.pledgeT=0;
2816
Game.elderWrath=0;
2817
Game.nextResearch=0;
2818
Game.researchT=0;
2819
Game.seasonT=0;
2820
Game.seasonUses=0;
2821
Game.season=Game.baseSeason;
2822
Game.computeSeasonPrices();
2823
2824
Game.startDate=parseInt(Date.now());
2825
Game.lastDate=parseInt(Date.now());
2826
2827
Game.cookiesSucked=0;
2828
Game.wrinklersPopped=0;
2829
Game.ResetWrinklers();
2830
2831
Game.santaLevel=0;
2832
Game.reindeerClicked=0;
2833
2834
Game.dragonLevel=0;
2835
Game.dragonAura=0;
2836
Game.dragonAura2=0;
2837
2838
Game.fortuneGC=0;
2839
Game.fortuneCPS=0;
2840
2841
Game.TickerClicks=0;
2842
2843
if (Game.gainedPrestige>0) Game.resets++;
2844
if (!hard && Game.canLumps() && Game.ascensionMode!=1) Game.addClass('lumpsOn');
2845
else Game.removeClass('lumpsOn');
2846
Game.gainedPrestige=0;
2847
2848
for (var i in Game.ObjectsById)
2849
{
2850
var me=Game.ObjectsById[i];
2851
me.amount=0;me.bought=0;me.highest=0;me.free=0;me.totalCookies=0;
2852
me.switchMinigame(false);
2853
if (hard) {me.muted=0;}
2854
me.pics=[];
2855
me.refresh();
2856
}
2857
for (var i in Game.UpgradesById)
2858
{
2859
var me=Game.UpgradesById[i];
2860
if (hard || me.pool!='prestige') me.bought=0;
2861
if (hard) me.unlocked=0;
2862
if (me.pool!='prestige' && !me.lasting)
2863
{
2864
if (Game.Has('Keepsakes') && Game.seasonDrops.indexOf(me.name)!=-1 && Math.random()<1/5){}
2865
else if (Game.ascensionMode==1 && Game.HasAchiev('O Fortuna') && me.tier=='fortune'){}
2866
else if (Game.HasAchiev('O Fortuna') && me.tier=='fortune' && Math.random()<0.4){}
2867
else me.unlocked=0;
2868
}
2869
}
2870
2871
Game.BuildingsOwned=0;
2872
Game.UpgradesOwned=0;
2873
2874
Game.cookiesPsByType={};
2875
Game.cookiesMultByType={};
2876
2877
if (!hard)
2878
{
2879
if (Game.ascensionMode!=1)
2880
{
2881
for (var i in Game.permanentUpgrades)
2882
{
2883
if (Game.permanentUpgrades[i]!=-1)
2884
{Game.UpgradesById[Game.permanentUpgrades[i]].earn();}
2885
}
2886
if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}
2887
2888
if (Game.Has('Starter kit')) Game.Objects['Cursor'].getFree(10);
2889
if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].getFree(5);
2890
}
2891
}
2892
2893
/*for (var i in Game.AchievementsById)
2894
{
2895
var me=Game.AchievementsById[i];
2896
me.won=0;
2897
}*/
2898
//Game.DefaultPrefs();
2899
BeautifyAll();
2900
2901
Game.RebuildUpgrades();
2902
Game.TickerAge=0;
2903
Game.TickerEffect=0;
2904
Game.recalculateGains=1;
2905
Game.storeToRefresh=1;
2906
Game.upgradesToRebuild=1;
2907
Game.killShimmers();
2908
2909
Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);
2910
2911
Game.LoadMinigames();
2912
for (var i in Game.ObjectsById)
2913
{
2914
var me=Game.ObjectsById[i];
2915
if (hard && me.minigame && me.minigame.launch) {me.minigame.launch();me.minigame.reset(true);}
2916
else if (!hard && me.minigame && me.minigame.reset) me.minigame.reset();
2917
}
2918
2919
l('toggleBox').style.display='none';
2920
l('toggleBox').innerHTML='';
2921
Game.choiceSelectorOn=-1;
2922
Game.ToggleSpecialMenu(0);
2923
Game.specialTab='';
2924
2925
l('logButton').classList.remove('hasUpdate');
2926
2927
Game.runModHook('reset',hard);
2928
2929
if (hard)
2930
{
2931
if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie
2932
{
2933
Game.ReincarnateTimer=1;
2934
Game.addClass('reincarnating');
2935
Game.BigCookieSize=0;
2936
}
2937
if (Game.prefs.popups) Game.Popup('Game reset');
2938
else Game.Notify('Game reset','So long, cookies.',[21,6],6);
2939
}
2940
}
2941
Game.HardReset=function(bypass)
2942
{
2943
if (!bypass)
2944
{
2945
Game.Prompt('<h3>Wipe save</h3><div class="block">Do you REALLY want to wipe your save?<br><small>You will lose your progress, your achievements, and your heavenly chips!</small></div>',[['Yes!','Game.ClosePrompt();Game.HardReset(1);'],'No']);
2946
}
2947
else if (bypass==1)
2948
{
2949
Game.Prompt('<h3>Wipe save</h3><div class="block">Whoah now, are you really, <b><i>REALLY</i></b> sure you want to go through with this?<br><small>Don\'t say we didn\'t warn you!</small></div>',[['Do it!','Game.ClosePrompt();Game.HardReset(2);'],'No']);
2950
}
2951
else
2952
{
2953
for (var i in Game.AchievementsById)
2954
{
2955
var me=Game.AchievementsById[i];
2956
me.won=0;
2957
}
2958
for (var i in Game.ObjectsById)
2959
{
2960
var me=Game.ObjectsById[i];
2961
me.level=0;
2962
}
2963
2964
Game.AchievementsOwned=0;
2965
Game.goldenClicks=0;
2966
Game.missedGoldenClicks=0;
2967
Game.Reset(1);
2968
Game.resets=0;
2969
Game.fullDate=parseInt(Date.now());
2970
Game.bakeryName=Game.GetBakeryName();
2971
Game.bakeryNameRefresh();
2972
Game.cookiesReset=0;
2973
Game.prestige=0;
2974
Game.heavenlyChips=0;
2975
Game.heavenlyChipsSpent=0;
2976
Game.heavenlyCookies=0;
2977
Game.permanentUpgrades=[-1,-1,-1,-1,-1];
2978
Game.ascensionMode=0;
2979
Game.lumps=-1;
2980
Game.lumpsTotal=-1;
2981
Game.lumpT=Date.now();
2982
Game.lumpRefill=0;
2983
Game.removeClass('lumpsOn');
2984
}
2985
}
2986
2987
2988
2989
Game.onCrate=0;
2990
Game.setOnCrate=function(what)
2991
{
2992
Game.onCrate=what;
2993
}
2994
Game.crate=function(me,context,forceClickStr,id)
2995
{
2996
//produce a crate with associated tooltip for an upgrade or achievement
2997
//me is an object representing the upgrade or achievement
2998
//context can be "store", "ascend", "stats" or undefined
2999
//forceClickStr changes what is done when the crate is clicked
3000
//id is the resulting div's desired id
3001
3002
var classes='crate';
3003
var enabled=0;
3004
var noFrame=0;
3005
var attachment='top';
3006
var neuromancy=0;
3007
if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
3008
var mysterious=0;
3009
var clickStr='';
3010
3011
if (me.type=='upgrade')
3012
{
3013
var canBuy=(context=='store'?me.canBuy():true);
3014
if (context=='stats' && me.bought==0 && !Game.Has('Neuromancy') && (!Game.sesame || me.pool!='debug')) return '';
3015
else if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
3016
else if (context=='store' && !canBuy) enabled=0;
3017
else if (context=='ascend' && me.bought==0) enabled=0;
3018
else enabled=1;
3019
if (me.bought>0) enabled=1;
3020
3021
if (context=='stats' && !Game.prefs.crates) noFrame=1;
3022
3023
classes+=' upgrade';
3024
if (me.pool=='prestige') classes+=' heavenly';
3025
3026
3027
if (neuromancy) clickStr='Game.UpgradesById['+me.id+'].toggle();';
3028
}
3029
else if (me.type=='achievement')
3030
{
3031
if (context=='stats' && me.won==0 && me.pool!='normal') return '';
3032
else if (context!='stats') enabled=1;
3033
3034
if (context=='stats' && !Game.prefs.crates) noFrame=1;
3035
3036
classes+=' achievement';
3037
if (me.pool=='shadow') classes+=' shadow';
3038
if (me.won>0) enabled=1;
3039
else mysterious=1;
3040
if (!enabled) clickStr='Game.AchievementsById['+me.id+'].click();';
3041
3042
if (neuromancy) clickStr='Game.AchievementsById['+me.id+'].toggle();';
3043
}
3044
3045
if (context=='store') attachment='store';
3046
3047
if (forceClickStr) clickStr=forceClickStr;
3048
3049
if (me.choicesFunction) classes+=' selector';
3050
3051
3052
var icon=me.icon;
3053
if (mysterious) icon=[0,7];
3054
3055
if (me.iconFunction) icon=me.iconFunction();
3056
3057
if (me.bought && context=='store') enabled=0;
3058
3059
if (enabled) classes+=' enabled';// else classes+=' disabled';
3060
if (noFrame) classes+=' noFrame';
3061
3062
var text=[];
3063
if (Game.sesame)
3064
{
3065
if (Game.debuggedUpgradeCpS[me.name] || Game.debuggedUpgradeCpClick[me.name])
3066
{
3067
text.push('x'+Beautify(1+Game.debuggedUpgradeCpS[me.name],2));text.push(Game.debugColors[Math.floor(Math.max(0,Math.min(Game.debugColors.length-1,Math.pow(Game.debuggedUpgradeCpS[me.name]/2,0.5)*Game.debugColors.length)))]);
3068
text.push('x'+Beautify(1+Game.debuggedUpgradeCpClick[me.name],2));text.push(Game.debugColors[Math.floor(Math.max(0,Math.min(Game.debugColors.length-1,Math.pow(Game.debuggedUpgradeCpClick[me.name]/2,0.5)*Game.debugColors.length)))]);
3069
}
3070
if (Game.extraInfo) {text.push(Math.floor(me.order)+(me.power?'<br>P:'+me.power:''));text.push('#fff');}
3071
}
3072
var textStr='';
3073
for (var i=0;i<text.length;i+=2)
3074
{
3075
textStr+='<div style="opacity:0.9;z-index:1000;padding:0px 2px;background:'+text[i+1]+';color:#000;font-size:10px;position:absolute;top:'+(i/2*10)+'px;left:0px;">'+text[i]+'</div>';
3076
}
3077
3078
return '<div'+
3079
(clickStr!=''?(' '+Game.clickStr+'="'+clickStr+'"'):'')+
3080
' class="'+classes+'" '+
3081
Game.getDynamicTooltip(
3082
'function(){return Game.crateTooltip(Game.'+(me.type=='upgrade'?'Upgrades':'Achievements')+'ById['+me.id+'],'+(context?'\''+context+'\'':'')+');}',
3083
attachment,true
3084
)+
3085
(id?'id="'+id+'" ':'')+
3086
'style="'+(mysterious?
3087
'background-position:'+(-0*48)+'px '+(-7*48)+'px':
3088
(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px')+';'+
3089
((context=='ascend' && me.pool=='prestige')?'position:absolute;left:'+me.posX+'px;top:'+me.posY+'px;':'')+
3090
'">'+
3091
textStr+
3092
(me.choicesFunction?'<div class="selectorCorner"></div>':'')+
3093
'</div>';
3094
}
3095
Game.crateTooltip=function(me,context)
3096
{
3097
var tags=[];
3098
mysterious=0;
3099
var neuromancy=0;
3100
var price='';
3101
if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
3102
3103
if (me.type=='upgrade')
3104
{
3105
if (me.pool=='prestige') tags.push('Heavenly','#efa438');
3106
else if (me.pool=='tech') tags.push('Tech','#36a4ff');
3107
else if (me.pool=='cookie') tags.push('Cookie',0);
3108
else if (me.pool=='debug') tags.push('Debug','#00c462');
3109
else if (me.pool=='toggle') tags.push('Switch',0);
3110
else tags.push('Upgrade',0);
3111
3112
if (me.tier!=0 && Game.Has('Label printer')) tags.push('Tier : '+Game.Tiers[me.tier].name,Game.Tiers[me.tier].color);
3113
if (me.name=='Label printer' && Game.Has('Label printer')) tags.push('Tier : Self-referential','#ff00ea');
3114
3115
if (me.isVaulted()) tags.push('Vaulted','#4e7566');
3116
3117
if (me.bought>0)
3118
{
3119
if (me.pool=='tech') tags.push('Researched',0);
3120
else if (me.kitten) tags.push('Purrchased',0);
3121
else tags.push('Purchased',0);
3122
}
3123
3124
if (me.lasting && me.unlocked) tags.push('Unlocked forever','#f2ff87');
3125
3126
if (neuromancy && me.bought==0) tags.push('Click to learn!','#00c462');
3127
else if (neuromancy && me.bought>0) tags.push('Click to unlearn!','#00c462');
3128
3129
var canBuy=(context=='store'?me.canBuy():true);
3130
var cost=me.getPrice();
3131
if (me.priceLumps>0) cost=me.priceLumps;
3132
3133
if (me.priceLumps==0 && cost==0) price='';
3134
else
3135
{
3136
price='<div style="float:right;text-align:right;"><span class="price'+
3137
(me.priceLumps>0?(' lump'):'')+
3138
(me.pool=='prestige'?((me.bought || Game.heavenlyChips>=cost)?' heavenly':' heavenly disabled'):'')+
3139
(context=='store'?(canBuy?'':' disabled'):'')+
3140
'">'+Beautify(Math.round(cost))+'</span>'+((me.pool!='prestige' && me.priceLumps==0)?Game.costDetails(cost):'')+'</div>';
3141
}
3142
}
3143
else if (me.type=='achievement')
3144
{
3145
if (me.pool=='shadow') tags.push('Shadow Achievement','#9700cf');
3146
else tags.push('Achievement',0);
3147
if (me.won>0) tags.push('Unlocked',0);
3148
else {tags.push('Locked',0);mysterious=1;}
3149
3150
if (neuromancy && me.won==0) tags.push('Click to win!','#00c462');
3151
else if (neuromancy && me.won>0) tags.push('Click to lose!','#00c462');
3152
}
3153
3154
var tagsStr='';
3155
for (var i=0;i<tags.length;i+=2)
3156
{
3157
if (i%2==0) tagsStr+=' <div class="tag" style="color:'+(tags[i+1]==0?'#fff':tags[i+1])+';">['+tags[i]+']</div>';
3158
}
3159
tagsStr=tagsStr.substring(1);
3160
3161
var icon=me.icon;
3162
if (mysterious) icon=[0,7];
3163
3164
if (me.iconFunction) icon=me.iconFunction();
3165
3166
3167
var tip='';
3168
if (context=='store')
3169
{
3170
if (me.pool!='toggle' && me.pool!='tech')
3171
{
3172
var purchase=me.kitten?'purrchase':'purchase';
3173
if (Game.Has('Inspired checklist'))
3174
{
3175
if (me.isVaulted()) tip='Upgrade is vaulted and will not be auto-'+purchase+'d.<br>Click to '+purchase+'. Shift-click to unvault.';
3176
else tip='Click to '+purchase+'. Shift-click to vault.';
3177
if (Game.keys[16]) tip+='<br>(You are holding Shift.)';
3178
else tip+='<br>(You are not holding Shift.)';
3179
}
3180
else tip='Click to '+purchase+'.';
3181
}
3182
else if (me.pool=='toggle' && me.choicesFunction) tip='Click to open selector.';
3183
else if (me.pool=='toggle') tip='Click to toggle.';
3184
else if (me.pool=='tech') tip='Click to research.';
3185
}
3186
3187
var desc=me.desc;
3188
if (me.descFunc) desc=me.descFunc(context);
3189
if (me.bought && context=='store' && me.displayFuncWhenOwned) desc=me.displayFuncWhenOwned()+'<div class="line"></div>'+desc;
3190
if (me.unlockAt)
3191
{
3192
if (me.unlockAt.require)
3193
{
3194
var it=Game.Upgrades[me.unlockAt.require];
3195
desc='<div style="font-size:80%;text-align:center;">From <div class="icon" style="vertical-align:middle;display:inline-block;'+(it.icon[2]?'background-image:url('+it.icon[2]+');':'')+'background-position:'+(-it.icon[0]*48)+'px '+(-it.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> '+it.name+'</div><div class="line"></div>'+desc;
3196
}
3197
/*else if (me.unlockAt.season)
3198
{
3199
var it=Game.seasons[me.unlockAt.season];
3200
desc='<div style="font-size:80%;text-align:center;">From <div class="icon" style="vertical-align:middle;display:inline-block;'+(Game.Upgrades[it.trigger].icon[2]?'background-image:url('+Game.Upgrades[it.trigger].icon[2]+');':'')+'background-position:'+(-Game.Upgrades[it.trigger].icon[0]*48)+'px '+(-Game.Upgrades[it.trigger].icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> '+it.name+'</div><div class="line"></div>'+desc;
3201
}*/
3202
else if (me.unlockAt.text)
3203
{
3204
var it=Game.Upgrades[me.unlockAt.require];
3205
desc='<div style="font-size:80%;text-align:center;">From <b>'+text+'</b></div><div class="line"></div>'+desc;
3206
}
3207
}
3208
3209
return '<div style="padding:8px 4px;min-width:350px;">'+
3210
'<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+
3211
(me.bought && context=='store'?'':price)+
3212
'<div class="name">'+(mysterious?'???':me.name)+'</div>'+
3213
tagsStr+
3214
'<div class="line"></div><div class="description">'+(mysterious?'???':desc)+'</div></div>'+
3215
(tip!=''?('<div class="line"></div><div style="font-size:10px;font-weight:bold;color:#999;text-align:center;padding-bottom:4px;line-height:100%;">'+tip+'</div>'):'')+
3216
(Game.sesame?('<div style="font-size:9px;">Id : '+me.id+' | Order : '+Math.floor(me.order)+(me.tier?' | Tier : '+me.tier:'')+'</div>'):'');
3217
}
3218
3219
Game.costDetails=function(cost)
3220
{
3221
if (!Game.Has('Genius accounting')) return '';
3222
if (!cost) return '';
3223
var priceInfo='';
3224
var cps=Game.cookiesPs*(1-Game.cpsSucked);
3225
if (cost>Game.cookies) priceInfo+='in '+Game.sayTime(((cost-Game.cookies)/cps+1)*Game.fps)+'<br>';
3226
priceInfo+=Game.sayTime((cost/cps+1)*Game.fps)+' worth<br>';
3227
priceInfo+=Beautify((cost/Game.cookies)*100,1)+'% of bank<br>';
3228
return '<div style="font-size:80%;opacity:0.7;line-height:90%;">'+priceInfo+'</div>';
3229
}
3230
3231
3232
/*=====================================================================================
3233
PRESTIGE
3234
=======================================================================================*/
3235
3236
Game.HCfactor=3;
3237
Game.HowMuchPrestige=function(cookies)//how much prestige [cookies] should land you
3238
{
3239
return Math.pow(cookies/1000000000000,1/Game.HCfactor);
3240
}
3241
Game.HowManyCookiesReset=function(chips)//how many cookies [chips] are worth
3242
{
3243
//this must be the inverse of the above function (ie. if cookies=chips^2, chips=cookies^(1/2) )
3244
return Math.pow(chips,Game.HCfactor)*1000000000000;
3245
}
3246
Game.gainedPrestige=0;
3247
Game.EarnHeavenlyChips=function(cookiesForfeited)
3248
{
3249
//recalculate prestige and chips owned
3250
var prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+cookiesForfeited));
3251
if (prestige>Game.prestige)//did we gain prestige levels?
3252
{
3253
var prestigeDifference=prestige-Game.prestige;
3254
Game.gainedPrestige=prestigeDifference;
3255
Game.heavenlyChips+=prestigeDifference;
3256
Game.prestige=prestige;
3257
if (Game.prefs.popups) Game.Popup('You gain '+Beautify(prestigeDifference)+' prestige level'+(prestigeDifference==1?'':'s')+'!');
3258
else Game.Notify('You forfeit your '+Beautify(cookiesForfeited)+' cookies.','You gain <b>'+Beautify(prestigeDifference)+'</b> prestige level'+(prestigeDifference==1?'':'s')+'!',[19,7]);
3259
}
3260
}
3261
3262
Game.GetHeavenlyMultiplier=function()
3263
{
3264
var heavenlyMult=0;
3265
if (Game.Has('Heavenly chip secret')) heavenlyMult+=0.05;
3266
if (Game.Has('Heavenly cookie stand')) heavenlyMult+=0.20;
3267
if (Game.Has('Heavenly bakery')) heavenlyMult+=0.25;
3268
if (Game.Has('Heavenly confectionery')) heavenlyMult+=0.25;
3269
if (Game.Has('Heavenly key')) heavenlyMult+=0.25;
3270
//if (Game.hasAura('Dragon God')) heavenlyMult*=1.05;
3271
heavenlyMult*=1+Game.auraMult('Dragon God')*0.05;
3272
if (Game.Has('Lucky digit')) heavenlyMult*=1.01;
3273
if (Game.Has('Lucky number')) heavenlyMult*=1.01;
3274
if (Game.Has('Lucky payout')) heavenlyMult*=1.01;
3275
if (Game.hasGod)
3276
{
3277
var godLvl=Game.hasGod('creation');
3278
if (godLvl==1) heavenlyMult*=0.7;
3279
else if (godLvl==2) heavenlyMult*=0.8;
3280
else if (godLvl==3) heavenlyMult*=0.9;
3281
}
3282
return heavenlyMult;
3283
}
3284
3285
Game.ascensionModes={
3286
0:{name:'None',desc:'No special modifiers.',icon:[10,0]},
3287
1:{name:'Born again',desc:'This run will behave as if you\'d just started the game from scratch. Prestige levels and heavenly upgrades will have no effect, as will sugar lumps and building levels. Perma-upgrades and minigames will be unavailable.<div class="line"></div>Some achievements are only available in this mode.',icon:[2,7]}/*,
3288
2:{name:'Trigger finger',desc:'In this run, scrolling your mouse wheel on the cookie counts as clicking it. Some upgrades introduce new clicking behaviors.<br>No clicking achievements may be obtained in this mode.<div class="line"></div>Reaching 1 quadrillion cookies in this mode unlocks a special heavenly upgrade.',icon:[12,0]}*/
3289
};
3290
3291
Game.ascendMeterPercent=0;
3292
Game.ascendMeterPercentT=0;
3293
Game.ascendMeterLevel=100000000000000000000000000000;
3294
3295
Game.nextAscensionMode=0;
3296
Game.UpdateAscensionModePrompt=function()
3297
{
3298
var icon=Game.ascensionModes[Game.nextAscensionMode].icon;
3299
var name=Game.ascensionModes[Game.nextAscensionMode].name;
3300
l('ascendModeButton').innerHTML=
3301
'<div class="crate noFrame enabled" '+Game.clickStr+'="Game.PickAscensionMode();" '+Game.getTooltip(
3302
'<div style="min-width:200px;text-align:center;font-size:11px;">Challenge mode for the next run :<br><b>'+name+'</b><div class="line"></div>Challenge modes apply special modifiers to your next ascension.<br>Click to change.</div>'
3303
,'bottom-right')+' style="opacity:1;float:none;display:block;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';
3304
}
3305
Game.PickAscensionMode=function()
3306
{
3307
PlaySound('snd/tick.mp3');
3308
Game.tooltip.hide();
3309
3310
var str='';
3311
for (var i in Game.ascensionModes)
3312
{
3313
var icon=Game.ascensionModes[i].icon;
3314
str+='<div class="crate enabled'+(i==Game.nextAscensionMode?' highlighted':'')+'" id="challengeModeSelector'+i+'" style="opacity:1;float:none;display:inline-block;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="Game.nextAscensionMode='+i+';Game.PickAscensionMode();PlaySound(\'snd/tick.mp3\');Game.choiceSelectorOn=-1;" onMouseOut="l(\'challengeSelectedName\').innerHTML=Game.ascensionModes[Game.nextAscensionMode].name;l(\'challengeSelectedDesc\').innerHTML=Game.ascensionModes[Game.nextAscensionMode].desc;" onMouseOver="l(\'challengeSelectedName\').innerHTML=Game.ascensionModes['+i+'].name;l(\'challengeSelectedDesc\').innerHTML=Game.ascensionModes['+i+'].desc;"'+
3315
'></div>';
3316
}
3317
Game.Prompt('<h3>Select a challenge mode</h3>'+
3318
'<div class="line"></div><div class="crateBox">'+str+'</div><h4 id="challengeSelectedName">'+Game.ascensionModes[Game.nextAscensionMode].name+'</h4><div class="line"></div><div id="challengeSelectedDesc" style="min-height:128px;">'+Game.ascensionModes[Game.nextAscensionMode].desc+'</div><div class="line"></div>'
3319
,[['Confirm','Game.UpdateAscensionModePrompt();Game.ClosePrompt();']],0,'widePrompt');
3320
}
3321
3322
Game.UpdateLegacyPrompt=function()
3323
{
3324
if (!l('legacyPromptData')) return 0;
3325
var date=new Date();
3326
date.setTime(Date.now()-Game.startDate);
3327
var timeInSeconds=date.getTime()/1000;
3328
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
3329
3330
var ascendNowToGet=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)-Game.HowMuchPrestige(Game.cookiesReset));
3331
var cookiesToNext=Math.floor(Game.HowManyCookiesReset(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)+1)-Game.cookiesReset-Game.cookiesEarned);
3332
l('legacyPromptData').innerHTML=''+
3333
'<div class="icon" style="pointer-event:none;transform:scale(2);opacity:0.25;position:absolute;right:-8px;bottom:-8px;background-position:'+(-19*48)+'px '+(-7*48)+'px;"></div>'+
3334
'<div class="listing"><b>Run duration :</b> '+(startDate==''?'tiny':(startDate))+'</div>'+
3335
//'<div class="listing">Earned : '+Beautify(Game.cookiesEarned)+', Reset : '+Beautify(Game.cookiesReset)+'</div>'+
3336
'<div class="listing"><b>Prestige level :</b> '+Beautify(Game.prestige)+'</div>'+
3337
'<div class="listing"><b>Heavenly chips :</b> '+Beautify(Game.heavenlyChips)+'</div>'+
3338
(ascendNowToGet>=1?('<div class="listing"><b>Ascending now will produce :</b> '+Beautify(ascendNowToGet)+' heavenly chip'+((ascendNowToGet)==1?'':'s')+'</div>'):
3339
('<div class="listing warning"><b>'+Beautify(cookiesToNext)+'</b> more cookie'+((cookiesToNext)==1?'':'s')+' for the next prestige level.<br>You may ascend now, but will gain no benefits.</div>'))+
3340
'';
3341
if (1 || ascendNowToGet>=1) l('promptOption0').style.display='inline-block'; else l('promptOption0').style.display='none';
3342
}
3343
3344
l('ascendOverlay').innerHTML=
3345
'<div id="ascendBox">'+
3346
'<div class="ascendData smallFramed prompt" '+Game.getTooltip(
3347
'<div style="min-width:300px;text-align:center;font-size:11px;">Each prestige level grants you a permanent <b>+1% CpS</b>.<br>The more levels you have, the more cookies they require.</div>'
3348
,'bottom-right')+' style="margin-top:8px;"><h3 id="ascendPrestige"></h3></div>'+
3349
'<div class="ascendData smallFramed prompt" '+Game.getTooltip(
3350
'<div style="min-width:300px;text-align:center;font-size:11px;">Heavenly chips are used to buy heavenly upgrades.<br>You gain <b>1 chip</b> every time you gain a prestige level.</div>'
3351
,'bottom-right')+'><h3 id="ascendHCs"></h3></div>'+
3352
'<a id="ascendButton" class="option framed large red" '+Game.getTooltip(
3353
'<div style="min-width:300px;text-align:center;font-size:11px;">Click this once you\'ve bought<br>everything you need!</div>'
3354
,'bottom-right')+' style="font-size:16px;margin-top:0px;"><span class="fancyText" style="font-size:20px;">Reincarnate</span></a>'+
3355
'<div id="ascendModeButton" style="position:absolute;right:34px;bottom:25px;display:none;"></div>'+
3356
'<input type="text" style="display:block;" id="upgradePositions"/></div>'+
3357
3358
'<div id="ascendInfo"><div class="ascendData smallFramed" style="margin-top:22px;width:40%;font-size:11px;">You are ascending.<br>Drag the screen around<br>or use arrow keys!<br>When you\'re ready,<br>click Reincarnate.</div></div>';
3359
3360
Game.UpdateAscensionModePrompt();
3361
3362
AddEvent(l('ascendButton'),'click',function(){
3363
PlaySound('snd/tick.mp3');
3364
Game.Reincarnate();
3365
});
3366
3367
Game.ascendl=l('ascend');
3368
Game.ascendContentl=l('ascendContent');
3369
Game.ascendZoomablel=l('ascendZoomable');
3370
Game.ascendUpgradesl=l('ascendUpgrades');
3371
Game.OnAscend=0;
3372
Game.AscendTimer=0;//how far we are into the ascend animation
3373
Game.AscendDuration=Game.fps*5;//how long the ascend animation is
3374
Game.AscendBreakpoint=Game.AscendDuration*0.5;//at which point the cookie explodes during the ascend animation
3375
Game.UpdateAscendIntro=function()
3376
{
3377
if (Game.AscendTimer==1) PlaySound('snd/charging.mp3');
3378
if (Game.AscendTimer==Math.floor(Game.AscendBreakpoint)) PlaySound('snd/thud.mp3');
3379
Game.AscendTimer++;
3380
if (Game.AscendTimer>Game.AscendDuration)//end animation and launch ascend screen
3381
{
3382
PlaySound('snd/cymbalRev.mp3',0.5);
3383
PlaySound('snd/choir.mp3');
3384
Game.EarnHeavenlyChips(Game.cookiesEarned);
3385
Game.AscendTimer=0;
3386
Game.OnAscend=1;Game.removeClass('ascendIntro');
3387
Game.addClass('ascending');
3388
Game.BuildAscendTree();
3389
Game.heavenlyChipsDisplayed=Game.heavenlyChips;
3390
Game.nextAscensionMode=0;
3391
Game.ascensionMode=0;
3392
Game.UpdateAscensionModePrompt();
3393
}
3394
}
3395
Game.ReincarnateTimer=0;//how far we are into the reincarnation animation
3396
Game.ReincarnateDuration=Game.fps*1;//how long the reincarnation animation is
3397
Game.UpdateReincarnateIntro=function()
3398
{
3399
if (Game.ReincarnateTimer==1) PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
3400
Game.ReincarnateTimer++;
3401
if (Game.ReincarnateTimer>Game.ReincarnateDuration)//end animation and launch regular game
3402
{
3403
Game.ReincarnateTimer=0;
3404
Game.removeClass('reincarnating');
3405
}
3406
}
3407
Game.Reincarnate=function(bypass)
3408
{
3409
if (!bypass) Game.Prompt('<h3>Reincarnate</h3><div class="block">Are you ready to return to the mortal world?</div>',[['Yes','Game.ClosePrompt();Game.Reincarnate(1);'],'No']);
3410
else
3411
{
3412
Game.ascendUpgradesl.innerHTML='';
3413
Game.ascensionMode=Game.nextAscensionMode;
3414
Game.nextAscensionMode=0;
3415
Game.Reset();
3416
if (Game.HasAchiev('Rebirth'))
3417
{
3418
if (Game.prefs.popups) Game.Popup('Reincarnated');
3419
else Game.Notify('Reincarnated','Hello, cookies!',[10,0],4);
3420
}
3421
if (Game.resets>=1000) Game.Win('Endless cycle');
3422
if (Game.resets>=100) Game.Win('Reincarnation');
3423
if (Game.resets>=10) Game.Win('Resurrection');
3424
if (Game.resets>=1) Game.Win('Rebirth');
3425
Game.removeClass('ascending');
3426
Game.OnAscend=0;
3427
//trigger the reincarnate animation
3428
Game.ReincarnateTimer=1;
3429
Game.addClass('reincarnating');
3430
Game.BigCookieSize=0;
3431
3432
Game.runModHook('reincarnate');
3433
}
3434
}
3435
Game.GiveUpAscend=function(bypass)
3436
{
3437
if (!bypass) Game.Prompt('<h3>Give up</h3><div class="block">Are you sure? You\'ll have to start this run over and won\'t gain any heavenly chips!</div>',[['Yes','Game.ClosePrompt();Game.GiveUpAscend(1);'],'No']);
3438
else
3439
{
3440
if (Game.prefs.popups) Game.Popup('Game reset');
3441
else Game.Notify('Gave up','Let\'s try this again!',[0,5],4);
3442
Game.Reset();
3443
}
3444
}
3445
Game.Ascend=function(bypass)
3446
{
3447
if (!bypass) Game.Prompt('<h3>Ascend</h3><div class="block">Do you REALLY want to ascend?<div class="line"></div>You will lose your progress and start over from scratch.<div class="line"></div>All your cookies will be converted into prestige and heavenly chips.<div class="line"></div>You will keep your achievements'+(Game.canLumps()?', building levels and sugar lumps':'')+'.</div>',[['Yes!','Game.ClosePrompt();Game.Ascend(1);'],'No']);
3448
else
3449
{
3450
if (Game.prefs.popups) Game.Popup('Ascending');
3451
else Game.Notify('Ascending','So long, cookies.',[20,7],4);
3452
Game.OnAscend=0;Game.removeClass('ascending');
3453
Game.addClass('ascendIntro');
3454
//trigger the ascend animation
3455
Game.AscendTimer=1;
3456
Game.killShimmers();
3457
l('toggleBox').style.display='none';
3458
l('toggleBox').innerHTML='';
3459
Game.choiceSelectorOn=-1;
3460
Game.ToggleSpecialMenu(0);
3461
Game.AscendOffX=0;
3462
Game.AscendOffY=0;
3463
Game.AscendOffXT=0;
3464
Game.AscendOffYT=0;
3465
Game.AscendZoomT=1;
3466
Game.AscendZoom=0.2;
3467
}
3468
}
3469
3470
Game.DebuggingPrestige=0;
3471
Game.AscendDragX=0;
3472
Game.AscendDragY=0;
3473
Game.AscendOffX=0;
3474
Game.AscendOffY=0;
3475
Game.AscendZoom=1;
3476
Game.AscendOffXT=0;
3477
Game.AscendOffYT=0;
3478
Game.AscendZoomT=1;
3479
Game.AscendDragging=0;
3480
Game.AscendGridSnap=24;
3481
Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};
3482
Game.UpdateAscend=function()
3483
{
3484
if (Game.keys[37]) Game.AscendOffXT+=16*(1/Game.AscendZoomT);
3485
if (Game.keys[38]) Game.AscendOffYT+=16*(1/Game.AscendZoomT);
3486
if (Game.keys[39]) Game.AscendOffXT-=16*(1/Game.AscendZoomT);
3487
if (Game.keys[40]) Game.AscendOffYT-=16*(1/Game.AscendZoomT);
3488
3489
if (Game.AscendOffXT>-Game.heavenlyBounds.left) Game.AscendOffXT=-Game.heavenlyBounds.left;
3490
if (Game.AscendOffXT<-Game.heavenlyBounds.right) Game.AscendOffXT=-Game.heavenlyBounds.right;
3491
if (Game.AscendOffYT>-Game.heavenlyBounds.top) Game.AscendOffYT=-Game.heavenlyBounds.top;
3492
if (Game.AscendOffYT<-Game.heavenlyBounds.bottom) Game.AscendOffYT=-Game.heavenlyBounds.bottom;
3493
Game.AscendOffX+=(Game.AscendOffXT-Game.AscendOffX)*0.5;
3494
Game.AscendOffY+=(Game.AscendOffYT-Game.AscendOffY)*0.5;
3495
Game.AscendZoom+=(Game.AscendZoomT-Game.AscendZoom)*0.25;
3496
if (Math.abs(Game.AscendZoomT-Game.AscendZoom)<0.005) Game.AscendZoom=Game.AscendZoomT;
3497
3498
if (Game.DebuggingPrestige)
3499
{
3500
for (var i in Game.PrestigeUpgrades)
3501
{
3502
var me=Game.PrestigeUpgrades[i];
3503
AddEvent(l('heavenlyUpgrade'+me.id),'mousedown',function(me){return function(){
3504
if (!Game.DebuggingPrestige) return;
3505
Game.SelectedHeavenlyUpgrade=me;
3506
}}(me));
3507
AddEvent(l('heavenlyUpgrade'+me.id),'mouseup',function(me){return function(){
3508
if (Game.SelectedHeavenlyUpgrade==me) {Game.SelectedHeavenlyUpgrade=0;Game.BuildAscendTree();}
3509
}}(me));
3510
}
3511
}
3512
3513
if (Game.mouseDown && !Game.promptOn)
3514
{
3515
if (!Game.AscendDragging)
3516
{
3517
Game.AscendDragX=Game.mouseX;
3518
Game.AscendDragY=Game.mouseY;
3519
}
3520
Game.AscendDragging=1;
3521
3522
if (Game.DebuggingPrestige)
3523
{
3524
if (Game.SelectedHeavenlyUpgrade)
3525
{
3526
Game.tooltip.hide();
3527
//drag upgrades around
3528
var me=Game.SelectedHeavenlyUpgrade;
3529
me.posX+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);
3530
me.posY+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);
3531
var posX=me.posX;//Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;
3532
var posY=me.posY;//Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;
3533
l('heavenlyUpgrade'+me.id).style.left=Math.floor(posX)+'px';
3534
l('heavenlyUpgrade'+me.id).style.top=Math.floor(posY)+'px';
3535
for (var ii in me.parents)
3536
{
3537
var origX=0;
3538
var origY=0;
3539
var targX=me.posX+28;
3540
var targY=me.posY+28;
3541
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
3542
var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;
3543
if (targX<=origX) rot+=180;
3544
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
3545
//l('heavenlyLink'+me.id+'-'+ii).style='width:'+dist+'px;-webkit-transform:rotate('+rot+'deg);-moz-transform:rotate('+rot+'deg);-ms-transform:rotate('+rot+'deg);-o-transform:rotate('+rot+'deg);transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;';
3546
l('heavenlyLink'+me.id+'-'+ii).style='width:'+dist+'px;transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;';
3547
}
3548
}
3549
}
3550
if (!Game.SelectedHeavenlyUpgrade)
3551
{
3552
Game.AscendOffXT+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);
3553
Game.AscendOffYT+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);
3554
}
3555
Game.AscendDragX=Game.mouseX;
3556
Game.AscendDragY=Game.mouseY;
3557
}
3558
else
3559
{
3560
/*if (Game.SelectedHeavenlyUpgrade)
3561
{
3562
var me=Game.SelectedHeavenlyUpgrade;
3563
me.posX=Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;
3564
me.posY=Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;
3565
l('heavenlyUpgrade'+me.id).style.left=me.posX+'px';
3566
l('heavenlyUpgrade'+me.id).style.top=me.posY+'px';
3567
}*/
3568
Game.AscendDragging=0;
3569
Game.SelectedHeavenlyUpgrade=0;
3570
}
3571
if (Game.Click || Game.promptOn)
3572
{
3573
Game.AscendDragging=0;
3574
}
3575
3576
//Game.ascendl.style.backgroundPosition=Math.floor(Game.AscendOffX/2)+'px '+Math.floor(Game.AscendOffY/2)+'px';
3577
//Game.ascendl.style.backgroundPosition=Math.floor(Game.AscendOffX/2)+'px '+Math.floor(Game.AscendOffY/2)+'px,'+Math.floor(Game.AscendOffX/4)+'px '+Math.floor(Game.AscendOffY/4)+'px';
3578
//Game.ascendContentl.style.left=Math.floor(Game.AscendOffX)+'px';
3579
//Game.ascendContentl.style.top=Math.floor(Game.AscendOffY)+'px';
3580
Game.ascendContentl.style.webkitTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3581
Game.ascendContentl.style.msTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3582
Game.ascendContentl.style.oTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3583
Game.ascendContentl.style.mozTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3584
Game.ascendContentl.style.transform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3585
Game.ascendZoomablel.style.webkitTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3586
Game.ascendZoomablel.style.msTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3587
Game.ascendZoomablel.style.oTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3588
Game.ascendZoomablel.style.mozTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3589
Game.ascendZoomablel.style.transform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3590
3591
//if (Game.Scroll!=0) Game.ascendContentl.style.transformOrigin=Math.floor(Game.windowW/2-Game.mouseX)+'px '+Math.floor(Game.windowH/2-Game.mouseY)+'px';
3592
if (Game.Scroll<0 && !Game.promptOn) {Game.AscendZoomT=0.5;}
3593
if (Game.Scroll>0 && !Game.promptOn) {Game.AscendZoomT=1;}
3594
3595
if (Game.T%2==0)
3596
{
3597
l('ascendPrestige').innerHTML='Prestige level :<br>'+SimpleBeautify(Game.prestige);
3598
l('ascendHCs').innerHTML='Heavenly chips :<br><span class="price heavenly">'+SimpleBeautify(Math.round(Game.heavenlyChipsDisplayed))+'</span>';
3599
if (Game.prestige>0) l('ascendModeButton').style.display='block';
3600
else l('ascendModeButton').style.display='none';
3601
}
3602
Game.heavenlyChipsDisplayed+=(Game.heavenlyChips-Game.heavenlyChipsDisplayed)*0.4;
3603
3604
if (Game.DebuggingPrestige && Game.T%10==0)
3605
{
3606
var str='';
3607
for (var i in Game.PrestigeUpgrades)
3608
{
3609
var me=Game.PrestigeUpgrades[i];
3610
str+=me.id+':['+Math.floor(me.posX)+','+Math.floor(me.posY)+'],';
3611
}
3612
l('upgradePositions').value='Game.UpgradePositions={'+str+'};';
3613
}
3614
//if (Game.T%5==0) Game.BuildAscendTree();
3615
}
3616
Game.AscendRefocus=function()
3617
{
3618
Game.AscendOffX=0;
3619
Game.AscendOffY=0;
3620
Game.ascendl.className='';
3621
}
3622
3623
Game.SelectedHeavenlyUpgrade=0;
3624
Game.PurchaseHeavenlyUpgrade=function(what)
3625
{
3626
//if (Game.Has('Neuromancy')) Game.UpgradesById[what].toggle(); else
3627
if (Game.UpgradesById[what].buy())
3628
{
3629
if (l('heavenlyUpgrade'+what)){var rect=l('heavenlyUpgrade'+what).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}
3630
//Game.BuildAscendTree();
3631
}
3632
}
3633
Game.BuildAscendTree=function()
3634
{
3635
var str='';
3636
Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};
3637
3638
if (Game.DebuggingPrestige) l('upgradePositions').style.display='block'; else l('upgradePositions').style.display='none';
3639
3640
for (var i in Game.PrestigeUpgrades)
3641
{
3642
var me=Game.PrestigeUpgrades[i];
3643
me.canBePurchased=1;
3644
if (!me.bought && !Game.DebuggingPrestige)
3645
{
3646
if (me.showIf && !me.showIf()) me.canBePurchased=0;
3647
else
3648
{
3649
for (var ii in me.parents)
3650
{
3651
if (me.parents[ii]!=-1 && !me.parents[ii].bought) me.canBePurchased=0;
3652
}
3653
}
3654
}
3655
}
3656
str+='<div class="crateBox" style="filter:none;-webkit-filter:none;">';//chrome is still bad at these
3657
for (var i in Game.PrestigeUpgrades)
3658
{
3659
var me=Game.PrestigeUpgrades[i];
3660
3661
var ghosted=0;
3662
if (me.canBePurchased || Game.Has('Neuromancy'))
3663
{
3664
str+=Game.crate(me,'ascend','Game.PurchaseHeavenlyUpgrade('+me.id+');','heavenlyUpgrade'+me.id);
3665
}
3666
else
3667
{
3668
for (var ii in me.parents)
3669
{
3670
if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;
3671
}
3672
if (me.showIf && !me.showIf()) ghosted=0;
3673
if (ghosted)
3674
{
3675
//maybe replace this with Game.crate()
3676
str+='<div class="crate upgrade heavenly ghosted" id="heavenlyUpgrade'+me.id+'" style="position:absolute;left:'+me.posX+'px;top:'+me.posY+'px;'+(me.icon[2]?'background-image:url('+me.icon[2]+');':'')+'background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>';
3677
}
3678
}
3679
if (me.canBePurchased || Game.Has('Neuromancy') || ghosted)
3680
{
3681
if (me.posX<Game.heavenlyBounds.left) Game.heavenlyBounds.left=me.posX;
3682
if (me.posX>Game.heavenlyBounds.right) Game.heavenlyBounds.right=me.posX;
3683
if (me.posY<Game.heavenlyBounds.top) Game.heavenlyBounds.top=me.posY;
3684
if (me.posY>Game.heavenlyBounds.bottom) Game.heavenlyBounds.bottom=me.posY;
3685
}
3686
for (var ii in me.parents)//create pulsing links
3687
{
3688
if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))
3689
{
3690
var origX=0;
3691
var origY=0;
3692
var targX=me.posX+28;
3693
var targY=me.posY+28;
3694
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
3695
var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;
3696
if (targX<=origX) rot+=180;
3697
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
3698
str+='<div class="parentLink" id="heavenlyLink'+me.id+'-'+ii+'" style="'+(ghosted?'opacity:0.1;':'')+'width:'+dist+'px;-webkit-transform:rotate('+rot+'deg);-moz-transform:rotate('+rot+'deg);-ms-transform:rotate('+rot+'deg);-o-transform:rotate('+rot+'deg);transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;"></div>';
3699
}
3700
}
3701
}
3702
Game.heavenlyBounds.left-=128;
3703
Game.heavenlyBounds.top-=128;
3704
Game.heavenlyBounds.right+=128+64;
3705
Game.heavenlyBounds.bottom+=128+64;
3706
//str+='<div style="border:1px solid red;position:absolute;left:'+Game.heavenlyBounds.left+'px;width:'+(Game.heavenlyBounds.right-Game.heavenlyBounds.left)+'px;top:'+Game.heavenlyBounds.top+'px;height:'+(Game.heavenlyBounds.bottom-Game.heavenlyBounds.top)+'px;"></div>';
3707
str+='</div>';
3708
Game.ascendUpgradesl.innerHTML=str;
3709
}
3710
3711
3712
/*=====================================================================================
3713
COALESCING SUGAR LUMPS
3714
=======================================================================================*/
3715
Game.lumpMatureAge=1;
3716
Game.lumpRipeAge=1;
3717
Game.lumpOverripeAge=1;
3718
Game.lumpCurrentType=0;
3719
l('comments').innerHTML=l('comments').innerHTML+
3720
'<div id="lumps" onclick="Game.clickLump();" '+Game.getDynamicTooltip('Game.lumpTooltip','bottom')+'><div id="lumpsIcon" class="usesIcon"></div><div id="lumpsIcon2" class="usesIcon"></div><div id="lumpsAmount">0</div></div>';
3721
Game.lumpTooltip=function()
3722
{
3723
var str='<div style="padding:8px;width:400px;font-size:11px;text-align:center;">'+
3724
'You have <span class="price lump">'+Beautify(Game.lumps)+' sugar lump'+(Game.lumps==1?'':'s')+'</span>.'+
3725
'<div class="line"></div>'+
3726
'A <b>sugar lump</b> is coalescing here, attracted by your accomplishments.';
3727
3728
var age=Date.now()-Game.lumpT;
3729
str+='<div class="line"></div>';
3730
if (age<0) str+='This sugar lump has been exposed to time travel shenanigans and will take an excruciating <b>'+Game.sayTime(((Game.lumpMatureAge-age)/1000+1)*Game.fps,-1)+'</b> to reach maturity.';
3731
else if (age<Game.lumpMatureAge) str+='This sugar lump is still growing and will take <b>'+Game.sayTime(((Game.lumpMatureAge-age)/1000+1)*Game.fps,-1)+'</b> to reach maturity.';
3732
else if (age<Game.lumpRipeAge) str+='This sugar lump is mature and will be ripe in <b>'+Game.sayTime(((Game.lumpRipeAge-age)/1000+1)*Game.fps,-1)+'</b>.<br>You may <b>click it to harvest it now</b>, but there is a <b>50% chance you won\'t get anything</b>.';
3733
else if (age<Game.lumpOverripeAge) str+='<b>This sugar lump is ripe! Click it to harvest it.</b><br>If you do nothing, it will auto-harvest in <b>'+Game.sayTime(((Game.lumpOverripeAge-age)/1000+1)*Game.fps,-1)+'</b>.';
3734
3735
var phase=(age/Game.lumpOverripeAge)*7;
3736
if (phase>=3)
3737
{
3738
if (Game.lumpCurrentType!=0) str+='<div class="line"></div>';
3739
if (Game.lumpCurrentType==1) str+='This sugar lump grew to be <b>bifurcated</b>; harvesting it has a 50% chance of yielding two lumps.';
3740
else if (Game.lumpCurrentType==2) str+='This sugar lump grew to be <b>golden</b>; harvesting it will yield 2 to 7 lumps, your current cookies will be doubled (capped to a gain of 24 hours of your CpS), and you will find 10% more golden cookies for the next 24 hours.';
3741
else if (Game.lumpCurrentType==3) str+='This sugar lump was affected by the elders and grew to be <b>meaty</b>; harvesting it will yield between 0 and 2 lumps.';
3742
else if (Game.lumpCurrentType==4) str+='This sugar lump is <b>caramelized</b>, its stickiness binding it to unexpected things; harvesting it will yield between 1 and 3 lumps and will refill your sugar lump cooldowns.';
3743
}
3744
3745
str+='<div class="line"></div>';
3746
str+='Your sugar lumps mature after <b>'+Game.sayTime((Game.lumpMatureAge/1000)*Game.fps,-1)+'</b>,<br>ripen after <b>'+Game.sayTime((Game.lumpRipeAge/1000)*Game.fps,-1)+'</b>,<br>and fall after <b>'+Game.sayTime((Game.lumpOverripeAge/1000)*Game.fps,-1)+'</b>.';
3747
3748
str+='<div class="line"></div>'+
3749
'&bull; Sugar lumps can be harvested when mature, though if left alone beyond that point they will start ripening (increasing the chance of harvesting them) and will eventually fall and be auto-harvested after some time.<br>&bull; Sugar lumps are delicious and may be used as currency for all sorts of things.<br>&bull; Once a sugar lump is harvested, another one will start growing in its place.<br>&bull; Note that sugar lumps keep growing when the game is closed.';
3750
3751
str+='</div>';
3752
return str;
3753
}
3754
Game.computeLumpTimes=function()
3755
{
3756
var hour=1000*60*60;
3757
Game.lumpMatureAge=hour*20;
3758
Game.lumpRipeAge=hour*23;
3759
if (Game.Has('Stevia Caelestis')) Game.lumpRipeAge-=hour;
3760
if (Game.Has('Diabetica Daemonicus')) Game.lumpMatureAge-=hour;
3761
if (Game.Has('Ichor syrup')) Game.lumpMatureAge-=1000*60*7;
3762
if (Game.Has('Sugar aging process')) Game.lumpRipeAge-=6000*Math.min(600,Game.Objects['Grandma'].amount);//capped at 600 grandmas
3763
if (Game.hasGod && Game.BuildingsOwned%10==0)
3764
{
3765
var godLvl=Game.hasGod('order');
3766
if (godLvl==1) Game.lumpRipeAge-=hour;
3767
else if (godLvl==2) Game.lumpRipeAge-=(hour/3)*2;
3768
else if (godLvl==3) Game.lumpRipeAge-=(hour/3);
3769
}
3770
//if (Game.hasAura('Dragon\'s Curve')) {Game.lumpMatureAge/=1.05;Game.lumpRipeAge/=1.05;}
3771
Game.lumpMatureAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;Game.lumpRipeAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;
3772
Game.lumpOverripeAge=Game.lumpRipeAge+hour;
3773
if (Game.Has('Glucose-charged air')) {Game.lumpMatureAge/=2000;Game.lumpRipeAge/=2000;Game.lumpOverripeAge/=2000;}
3774
}
3775
Game.loadLumps=function(time)
3776
{
3777
Game.computeLumpTimes();
3778
//Game.computeLumpType();
3779
if (!Game.canLumps()) Game.removeClass('lumpsOn');
3780
else
3781
{
3782
if (Game.ascensionMode!=1) Game.addClass('lumpsOn');
3783
Game.lumpT=Math.min(Date.now(),Game.lumpT);
3784
var age=Math.max(Date.now()-Game.lumpT,0);
3785
var amount=Math.floor(age/Game.lumpOverripeAge);//how many lumps did we harvest since we closed the game?
3786
if (amount>=1)
3787
{
3788
Game.harvestLumps(1,true);
3789
Game.lumpCurrentType=0;//all offline lumps after the first one have a normal type
3790
if (amount>1) Game.harvestLumps(amount-1,true);
3791
if (Game.prefs.popups) Game.Popup('Harvested '+Beautify(amount)+' sugar lump'+(amount==1?'':'s')+' while you were away');
3792
else Game.Notify('','You harvested <b>'+Beautify(amount)+'</b> sugar lump'+(amount==1?'':'s')+' while you were away.',[29,14]);
3793
Game.lumpT=Date.now()-(age-amount*Game.lumpOverripeAge);
3794
Game.computeLumpType();
3795
}
3796
}
3797
}
3798
Game.gainLumps=function(total)
3799
{
3800
if (Game.lumpsTotal==-1){Game.lumpsTotal=0;Game.lumps=0;}
3801
Game.lumps+=total;
3802
Game.lumpsTotal+=total;
3803
3804
if (Game.lumpsTotal>=7) Game.Win('Dude, sweet');
3805
if (Game.lumpsTotal>=30) Game.Win('Sugar rush');
3806
if (Game.lumpsTotal>=365) Game.Win('Year\'s worth of cavities');
3807
}
3808
Game.clickLump=function()
3809
{
3810
if (!Game.canLumps()) return;
3811
var age=Date.now()-Game.lumpT;
3812
if (age<Game.lumpMatureAge) {}
3813
else if (age<Game.lumpRipeAge)
3814
{
3815
var amount=choose([0,1]);
3816
if (amount!=0) Game.Win('Hand-picked');
3817
Game.harvestLumps(amount);
3818
Game.computeLumpType();
3819
}
3820
else if (age<Game.lumpOverripeAge)
3821
{
3822
Game.harvestLumps(1);
3823
Game.computeLumpType();
3824
}
3825
}
3826
Game.harvestLumps=function(amount,silent)
3827
{
3828
if (!Game.canLumps()) return;
3829
Game.lumpT=Date.now();
3830
var total=amount;
3831
if (Game.lumpCurrentType==1 && Game.Has('Sucralosia Inutilis') && Math.random()<0.05) total*=2;
3832
else if (Game.lumpCurrentType==1) total*=choose([1,2]);
3833
else if (Game.lumpCurrentType==2)
3834
{
3835
total*=choose([2,3,4,5,6,7]);
3836
Game.gainBuff('sugar blessing',24*60*60,1);
3837
Game.Earn(Math.min(Game.cookiesPs*60*60*24,Game.cookies));
3838
if (Game.prefs.popups) Game.Popup('Sugar blessing activated!');
3839
else Game.Notify('Sugar blessing activated!','Your cookies have been doubled.<br>+10% golden cookies for the next 24 hours.',[29,16]);
3840
}
3841
else if (Game.lumpCurrentType==3) total*=choose([0,0,1,2,2]);
3842
else if (Game.lumpCurrentType==4)
3843
{
3844
total*=choose([1,2,3]);
3845
Game.lumpRefill=0;//Date.now()-Game.getLumpRefillMax();
3846
if (Game.prefs.popups) Game.Popup('Sugar lump cooldowns cleared!');
3847
else Game.Notify('Sugar lump cooldowns cleared!','',[29,27]);
3848
}
3849
total=Math.floor(total);
3850
Game.gainLumps(total);
3851
if (Game.lumpCurrentType==1) Game.Win('Sugar sugar');
3852
else if (Game.lumpCurrentType==2) Game.Win('All-natural cane sugar');
3853
else if (Game.lumpCurrentType==3) Game.Win('Sweetmeats');
3854
else if (Game.lumpCurrentType==4) Game.Win('Maillard reaction');
3855
3856
if (!silent)
3857
{
3858
var rect=l('lumpsIcon2').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);
3859
if (total>0) Game.Popup('<small>+'+Beautify(total)+' sugar lump'+(total==1?'':'s')+'</small>',(rect.left+rect.right)/2,(rect.top+rect.bottom)/2-48);
3860
else Game.Popup('<small>Botched harvest!</small>',(rect.left+rect.right)/2,(rect.top+rect.bottom)/2-48);
3861
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
3862
}
3863
Game.computeLumpTimes();
3864
}
3865
Game.computeLumpType=function()
3866
{
3867
Math.seedrandom(Game.seed+'/'+Game.lumpT);
3868
var types=[0];
3869
var loop=1;
3870
//if (Game.hasAura('Dragon\'s Curve')) loop=2;
3871
loop+=Game.auraMult('Dragon\'s Curve');
3872
loop=randomFloor(loop);
3873
for (var i=0;i<loop;i++)
3874
{
3875
if (Math.random()<(Game.Has('Sucralosia Inutilis')?0.15:0.1)) types.push(1);//bifurcated
3876
if (Math.random()<3/1000) types.push(2);//golden
3877
if (Math.random()<0.1*Game.elderWrath) types.push(3);//meaty
3878
if (Math.random()<1/50) types.push(4);//caramelized
3879
}
3880
Game.lumpCurrentType=choose(types);
3881
Math.seedrandom();
3882
}
3883
3884
Game.canLumps=function()//grammatically pleasing function name
3885
{
3886
if (Game.lumpsTotal>-1 || (Game.ascensionMode!=1 && (Game.cookiesEarned+Game.cookiesReset)>=1000000000)) return true;
3887
return false;
3888
}
3889
3890
Game.getLumpRefillMax=function()
3891
{
3892
return Game.fps*60*15;//1000*60*15;//15 minutes
3893
}
3894
Game.getLumpRefillRemaining=function()
3895
{
3896
return Game.lumpRefill;//Game.getLumpRefillMax()-(Date.now()-Game.lumpRefill);
3897
}
3898
Game.canRefillLump=function()
3899
{
3900
return Game.lumpRefill<=0;//((Date.now()-Game.lumpRefill)>=Game.getLumpRefillMax());
3901
}
3902
Game.refillLump=function(n,func)
3903
{
3904
if (Game.lumps>=n && Game.canRefillLump())
3905
{
3906
Game.spendLump(n,'refill',function()
3907
{
3908
if (!Game.sesame) Game.lumpRefill=Game.getLumpRefillMax();//Date.now();
3909
func();
3910
})();
3911
}
3912
}
3913
Game.spendLump=function(n,str,func)
3914
{
3915
//ask if we want to spend N lumps
3916
return function()
3917
{
3918
if (Game.lumps<n) return false;
3919
if (Game.prefs.askLumps)
3920
{
3921
PlaySound('snd/tick.mp3');
3922
Game.promptConfirmFunc=func;//bit dumb
3923
Game.Prompt('<div class="icon" style="background:url(img/icons.png?v='+Game.version+');float:left;margin-left:-8px;margin-top:-8px;background-position:'+(-29*48)+'px '+(-14*48)+'px;"></div><div style="margin:16px 8px;">Do you want to spend <b>'+Beautify(n)+' lump'+(n!=1?'s':'')+'</b> to '+str+'?</div>',[['Yes','Game.lumps-='+n+';Game.promptConfirmFunc();Game.promptConfirmFunc=0;Game.recalculateGains=1;Game.ClosePrompt();'],'No']);
3924
return false;
3925
}
3926
else
3927
{
3928
Game.lumps-=n;
3929
func();
3930
Game.recalculateGains=1;
3931
}
3932
}
3933
}
3934
3935
Game.doLumps=function()
3936
{
3937
if (Game.lumpRefill>0) Game.lumpRefill--;
3938
3939
if (!Game.canLumps()) {Game.removeClass('lumpsOn');return;}
3940
if (Game.lumpsTotal==-1)
3941
{
3942
//first time !
3943
if (Game.ascensionMode!=1) Game.addClass('lumpsOn');
3944
Game.lumpT=Date.now();
3945
Game.lumpsTotal=0;
3946
Game.lumps=0;
3947
Game.computeLumpType();
3948
3949
Game.Notify('Sugar lumps!','Because you\'ve baked a <b>billion cookies</b> in total, you are now attracting <b>sugar lumps</b>. They coalesce quietly near the top of your screen, under the Stats button.<br>You will be able to harvest them when they\'re ripe, after which you may spend them on all sorts of things!',[23,14]);
3950
}
3951
var age=Date.now()-Game.lumpT;
3952
if (age>Game.lumpOverripeAge)
3953
{
3954
age=0;
3955
Game.harvestLumps(1);
3956
Game.computeLumpType();
3957
}
3958
3959
var phase=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7));
3960
var phase2=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7)+1);
3961
var row=14;
3962
var row2=14;
3963
var type=Game.lumpCurrentType;
3964
if (type==1)//double
3965
{
3966
//if (phase>=6) row=15;
3967
if (phase2>=6) row2=15;
3968
}
3969
else if (type==2)//golden
3970
{
3971
if (phase>=4) row=16;
3972
if (phase2>=4) row2=16;
3973
}
3974
else if (type==3)//meaty
3975
{
3976
if (phase>=4) row=17;
3977
if (phase2>=4) row2=17;
3978
}
3979
else if (type==4)//caramelized
3980
{
3981
if (phase>=4) row=27;
3982
if (phase2>=4) row2=27;
3983
}
3984
var icon=[23+Math.min(phase,5),row];
3985
var icon2=[23+phase2,row2];
3986
if (age<0){icon=[17,5];icon2=[17,5];}
3987
var opacity=Math.min(6,(age/Game.lumpOverripeAge)*7)%1;
3988
if (phase>=6) {opacity=1;}
3989
l('lumpsIcon').style.backgroundPosition=(-icon[0]*48)+'px '+(-icon[1]*48)+'px';
3990
l('lumpsIcon2').style.backgroundPosition=(-icon2[0]*48)+'px '+(-icon2[1]*48)+'px';
3991
l('lumpsIcon2').style.opacity=opacity;
3992
l('lumpsAmount').textContent=Beautify(Game.lumps);
3993
}
3994
3995
/*=====================================================================================
3996
COOKIE ECONOMICS
3997
=======================================================================================*/
3998
Game.Earn=function(howmuch)
3999
{
4000
Game.cookies+=howmuch;
4001
Game.cookiesEarned+=howmuch;
4002
}
4003
Game.Spend=function(howmuch)
4004
{
4005
Game.cookies-=howmuch;
4006
}
4007
Game.Dissolve=function(howmuch)
4008
{
4009
Game.cookies-=howmuch;
4010
Game.cookiesEarned-=howmuch;
4011
Game.cookies=Math.max(0,Game.cookies);
4012
Game.cookiesEarned=Math.max(0,Game.cookiesEarned);
4013
}
4014
Game.mouseCps=function()
4015
{
4016
var add=0;
4017
if (Game.Has('Thousand fingers')) add+= 0.1;
4018
if (Game.Has('Million fingers')) add*= 5;
4019
if (Game.Has('Billion fingers')) add*= 10;
4020
if (Game.Has('Trillion fingers')) add*= 20;
4021
if (Game.Has('Quadrillion fingers')) add*= 20;
4022
if (Game.Has('Quintillion fingers')) add*= 20;
4023
if (Game.Has('Sextillion fingers')) add*= 20;
4024
if (Game.Has('Septillion fingers')) add*= 20;
4025
if (Game.Has('Octillion fingers')) add*= 20;
4026
if (Game.Has('Nonillion fingers')) add*= 20;
4027
4028
var num=0;
4029
for (var i in Game.Objects) {num+=Game.Objects[i].amount;}
4030
num-=Game.Objects['Cursor'].amount;
4031
add=add*num;
4032
if (Game.Has('Plastic mouse')) add+=Game.cookiesPs*0.01;
4033
if (Game.Has('Iron mouse')) add+=Game.cookiesPs*0.01;
4034
if (Game.Has('Titanium mouse')) add+=Game.cookiesPs*0.01;
4035
if (Game.Has('Adamantium mouse')) add+=Game.cookiesPs*0.01;
4036
if (Game.Has('Unobtainium mouse')) add+=Game.cookiesPs*0.01;
4037
if (Game.Has('Eludium mouse')) add+=Game.cookiesPs*0.01;
4038
if (Game.Has('Wishalloy mouse')) add+=Game.cookiesPs*0.01;
4039
if (Game.Has('Fantasteel mouse')) add+=Game.cookiesPs*0.01;
4040
if (Game.Has('Nevercrack mouse')) add+=Game.cookiesPs*0.01;
4041
if (Game.Has('Armythril mouse')) add+=Game.cookiesPs*0.01;
4042
if (Game.Has('Technobsidian mouse')) add+=Game.cookiesPs*0.01;
4043
if (Game.Has('Plasmarble mouse')) add+=Game.cookiesPs*0.01;
4044
if (Game.Has('Miraculite mouse')) add+=Game.cookiesPs*0.01;
4045
4046
if (Game.Has('Fortune #104')) add+=Game.cookiesPs*0.01;
4047
var mult=1;
4048
4049
4050
if (Game.Has('Santa\'s helpers')) mult*=1.1;
4051
if (Game.Has('Cookie egg')) mult*=1.1;
4052
if (Game.Has('Halo gloves')) mult*=1.1;
4053
if (Game.Has('Dragon claw')) mult*=1.03;
4054
4055
if (Game.Has('Aura gloves'))
4056
{
4057
mult*=1+0.05*Math.min(Game.Objects['Cursor'].level,Game.Has('Luminous gloves')?20:10);
4058
}
4059
4060
mult*=Game.eff('click');
4061
4062
if (Game.hasGod)
4063
{
4064
var godLvl=Game.hasGod('labor');
4065
if (godLvl==1) mult*=1.15;
4066
else if (godLvl==2) mult*=1.1;
4067
else if (godLvl==3) mult*=1.05;
4068
}
4069
4070
for (var i in Game.buffs)
4071
{
4072
if (typeof Game.buffs[i].multClick != 'undefined') mult*=Game.buffs[i].multClick;
4073
}
4074
4075
//if (Game.hasAura('Dragon Cursor')) mult*=1.05;
4076
mult*=1+Game.auraMult('Dragon Cursor')*0.05;
4077
4078
var out=mult*Game.ComputeCps(1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add);
4079
4080
out=Game.runModHookOnValue('cookiesPerClick',out);
4081
4082
if (Game.hasBuff('Cursed finger')) out=Game.buffs['Cursed finger'].power;
4083
return out;
4084
}
4085
Game.computedMouseCps=1;
4086
Game.globalCpsMult=1;
4087
Game.unbuffedCps=0;
4088
Game.buildingCps=0;
4089
Game.lastClick=0;
4090
Game.CanClick=1;
4091
Game.autoclickerDetected=0;
4092
Game.BigCookieState=0;//0 = normal, 1 = clicked (small), 2 = released/hovered (big)
4093
Game.BigCookieSize=0;
4094
Game.BigCookieSizeD=0;
4095
Game.BigCookieSizeT=1;
4096
Game.cookieClickSound=Math.floor(Math.random()*7)+1;
4097
Game.playCookieClickSound=function()
4098
{
4099
if (Game.prefs.cookiesound) PlaySound('snd/clickb'+(Game.cookieClickSound)+'.mp3',0.5);
4100
else PlaySound('snd/click'+(Game.cookieClickSound)+'.mp3',0.5);
4101
Game.cookieClickSound+=Math.floor(Math.random()*4)+1;
4102
if (Game.cookieClickSound>7) Game.cookieClickSound-=7;
4103
}
4104
Game.ClickCookie=function(e,amount)
4105
{
4106
var now=Date.now();
4107
if (e) e.preventDefault();
4108
if (Game.OnAscend || Game.AscendTimer>0 || Game.T<3 || now-Game.lastClick<1000/250) {}
4109
else
4110
{
4111
if (now-Game.lastClick<1000/15)
4112
{
4113
Game.autoclickerDetected+=Game.fps;
4114
if (Game.autoclickerDetected>=Game.fps*5) Game.Win('Uncanny clicker');
4115
}
4116
Game.loseShimmeringVeil('click');
4117
var amount=amount?amount:Game.computedMouseCps;
4118
Game.Earn(amount);
4119
Game.handmadeCookies+=amount;
4120
if (Game.prefs.particles)
4121
{
4122
Game.particleAdd();
4123
Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1,2);
4124
}
4125
if (Game.prefs.numbers) Game.particleAdd(Game.mouseX+Math.random()*8-4,Game.mouseY-8+Math.random()*8-4,0,-2,1,4,2,'','+'+Beautify(amount,1));
4126
4127
Game.runModHook('click');
4128
4129
Game.playCookieClickSound();
4130
Game.cookieClicks++;
4131
}
4132
Game.lastClick=now;
4133
Game.Click=0;
4134
}
4135
Game.mouseX=0;
4136
Game.mouseY=0;
4137
Game.mouseX2=0;
4138
Game.mouseY2=0;
4139
Game.mouseMoved=0;
4140
Game.GetMouseCoords=function(e)
4141
{
4142
var posx=0;
4143
var posy=0;
4144
if (!e) var e=window.event;
4145
if (e.pageX||e.pageY)
4146
{
4147
posx=e.pageX;
4148
posy=e.pageY;
4149
}
4150
else if (e.clientX || e.clientY)
4151
{
4152
posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
4153
posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
4154
}
4155
var x=0;
4156
var y=32;
4157
/*
4158
var el=l('sectionLeft');
4159
while(el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop))
4160
{
4161
x+=el.offsetLeft-el.scrollLeft;
4162
y+=el.offsetTop-el.scrollTop;
4163
el=el.offsetParent;
4164
}*/
4165
Game.mouseX2=Game.mouseX;
4166
Game.mouseY2=Game.mouseY;
4167
Game.mouseX=posx-x;
4168
Game.mouseY=posy-y;
4169
Game.mouseMoved=1;
4170
Game.lastActivity=Game.time;
4171
}
4172
var bigCookie=l('bigCookie');
4173
bigCookie.setAttribute('alt','Big clickable cookie');
4174
Game.Click=0;
4175
Game.lastClickedEl=0;
4176
Game.clickFrom=0;
4177
Game.Scroll=0;
4178
Game.mouseDown=0;
4179
if (!Game.touchEvents)
4180
{
4181
AddEvent(bigCookie,'click',Game.ClickCookie);
4182
AddEvent(bigCookie,'mousedown',function(event){Game.BigCookieState=1;if (Game.prefs.cookiesound) {Game.playCookieClickSound();}if (event) event.preventDefault();});
4183
AddEvent(bigCookie,'mouseup',function(event){Game.BigCookieState=2;if (event) event.preventDefault();});
4184
AddEvent(bigCookie,'mouseout',function(event){Game.BigCookieState=0;});
4185
AddEvent(bigCookie,'mouseover',function(event){Game.BigCookieState=2;});
4186
AddEvent(document,'mousemove',Game.GetMouseCoords);
4187
AddEvent(document,'mousedown',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;Game.clickFrom=event.target;});
4188
AddEvent(document,'mouseup',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;Game.clickFrom=0;});
4189
AddEvent(document,'click',function(event){Game.lastActivity=Game.time;Game.Click=1;Game.lastClickedEl=event.target;Game.clickFrom=0;});
4190
Game.handleScroll=function(e)
4191
{
4192
if (!e) e=event;
4193
Game.Scroll=(e.detail<0||e.wheelDelta>0)?1:-1;
4194
Game.lastActivity=Game.time;
4195
};
4196
AddEvent(document,'DOMMouseScroll',Game.handleScroll);
4197
AddEvent(document,'mousewheel',Game.handleScroll);
4198
}
4199
else
4200
{
4201
//touch events
4202
AddEvent(bigCookie,'touchend',Game.ClickCookie);
4203
AddEvent(bigCookie,'touchstart',function(event){Game.BigCookieState=1;if (event) event.preventDefault();});
4204
AddEvent(bigCookie,'touchend',function(event){Game.BigCookieState=0;if (event) event.preventDefault();});
4205
//AddEvent(document,'touchmove',Game.GetMouseCoords);
4206
AddEvent(document,'mousemove',Game.GetMouseCoords);
4207
AddEvent(document,'touchstart',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;});
4208
AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;});
4209
AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.Click=1;});
4210
}
4211
4212
Game.keys=[];
4213
AddEvent(window,'keyup',function(e){
4214
Game.lastActivity=Game.time;
4215
if (e.keyCode==27)
4216
{
4217
Game.ClosePrompt();
4218
if (Game.AscendTimer>0) Game.AscendTimer=Game.AscendDuration;
4219
}//esc closes prompt
4220
else if (e.keyCode==13) Game.ConfirmPrompt();//enter confirms prompt
4221
Game.keys[e.keyCode]=0;
4222
});
4223
AddEvent(window,'keydown',function(e){
4224
if (!Game.OnAscend && Game.AscendTimer==0)
4225
{
4226
if (e.ctrlKey && e.keyCode==83) {Game.toSave=true;e.preventDefault();}//ctrl-s saves the game
4227
else if (e.ctrlKey && e.keyCode==79) {Game.ImportSave();e.preventDefault();}//ctrl-o opens the import menu
4228
}
4229
if ((e.keyCode==16 || e.keyCode==17) && Game.tooltip.dynamic) Game.tooltip.update();
4230
Game.keys[e.keyCode]=1;
4231
});
4232
4233
AddEvent(window,'visibilitychange',function(e){
4234
Game.keys=[];//reset all key pressed on visibility change (should help prevent ctrl still being down after ctrl-tab)
4235
});
4236
4237
/*=====================================================================================
4238
CPS RECALCULATOR
4239
=======================================================================================*/
4240
4241
Game.heavenlyPower=1;//how many CpS percents a single heavenly chip gives
4242
Game.recalculateGains=1;
4243
Game.cookiesPsByType={};
4244
Game.cookiesMultByType={};
4245
//display bars with http://codepen.io/anon/pen/waGyEJ
4246
Game.effs={};
4247
Game.eff=function(name,def){if (typeof Game.effs[name]==='undefined') return (typeof def==='undefined'?1:def); else return Game.effs[name];};
4248
4249
Game.CalculateGains=function()
4250
{
4251
Game.cookiesPs=0;
4252
var mult=1;
4253
//add up effect bonuses from building minigames
4254
var effs={};
4255
for (var i in Game.Objects)
4256
{
4257
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs)
4258
{
4259
var myEffs=Game.Objects[i].minigame.effs;
4260
for (var ii in myEffs)
4261
{
4262
if (effs[ii]) effs[ii]*=myEffs[ii];
4263
else effs[ii]=myEffs[ii];
4264
}
4265
}
4266
}
4267
Game.effs=effs;
4268
4269
if (Game.ascensionMode!=1) mult+=parseFloat(Game.prestige)*0.01*Game.heavenlyPower*Game.GetHeavenlyMultiplier();
4270
4271
mult*=Game.eff('cps');
4272
4273
if (Game.Has('Heralds') && Game.ascensionMode!=1) mult*=1+0.01*Game.heralds;
4274
4275
for (var i in Game.cookieUpgrades)
4276
{
4277
var me=Game.cookieUpgrades[i];
4278
if (Game.Has(me.name))
4279
{
4280
mult*=(1+(typeof(me.power)==='function'?me.power(me):me.power)*0.01);
4281
}
4282
}
4283
4284
if (Game.Has('Specialized chocolate chips')) mult*=1.01;
4285
if (Game.Has('Designer cocoa beans')) mult*=1.02;
4286
if (Game.Has('Underworld ovens')) mult*=1.03;
4287
if (Game.Has('Exotic nuts')) mult*=1.04;
4288
if (Game.Has('Arcane sugar')) mult*=1.05;
4289
4290
if (Game.Has('Increased merriness')) mult*=1.15;
4291
if (Game.Has('Improved jolliness')) mult*=1.15;
4292
if (Game.Has('A lump of coal')) mult*=1.01;
4293
if (Game.Has('An itchy sweater')) mult*=1.01;
4294
if (Game.Has('Santa\'s dominion')) mult*=1.2;
4295
4296
if (Game.Has('Fortune #100')) mult*=1.01;
4297
if (Game.Has('Fortune #101')) mult*=1.07;
4298
4299
if (Game.Has('Dragon scale')) mult*=1.03;
4300
4301
var buildMult=1;
4302
if (Game.hasGod)
4303
{
4304
var godLvl=Game.hasGod('asceticism');
4305
if (godLvl==1) mult*=1.15;
4306
else if (godLvl==2) mult*=1.1;
4307
else if (godLvl==3) mult*=1.05;
4308
4309
var godLvl=Game.hasGod('ages');
4310
if (godLvl==1) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*3))*Math.PI*2);
4311
else if (godLvl==2) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*12))*Math.PI*2);
4312
else if (godLvl==3) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*24))*Math.PI*2);
4313
4314
var godLvl=Game.hasGod('decadence');
4315
if (godLvl==1) buildMult*=0.93;
4316
else if (godLvl==2) buildMult*=0.95;
4317
else if (godLvl==3) buildMult*=0.98;
4318
4319
var godLvl=Game.hasGod('industry');
4320
if (godLvl==1) buildMult*=1.1;
4321
else if (godLvl==2) buildMult*=1.06;
4322
else if (godLvl==3) buildMult*=1.03;
4323
4324
var godLvl=Game.hasGod('labor');
4325
if (godLvl==1) buildMult*=0.97;
4326
else if (godLvl==2) buildMult*=0.98;
4327
else if (godLvl==3) buildMult*=0.99;
4328
}
4329
4330
if (Game.Has('Santa\'s legacy')) mult*=1+(Game.santaLevel+1)*0.03;
4331
4332
4333
Game.milkProgress=Game.AchievementsOwned/25;
4334
var milkMult=1;
4335
if (Game.Has('Santa\'s milk and cookies')) milkMult*=1.05;
4336
//if (Game.hasAura('Breath of Milk')) milkMult*=1.05;
4337
milkMult*=1+Game.auraMult('Breath of Milk')*0.05;
4338
if (Game.hasGod)
4339
{
4340
var godLvl=Game.hasGod('mother');
4341
if (godLvl==1) milkMult*=1.1;
4342
else if (godLvl==2) milkMult*=1.05;
4343
else if (godLvl==3) milkMult*=1.03;
4344
}
4345
milkMult*=Game.eff('milk');
4346
4347
var catMult=1;
4348
4349
if (Game.Has('Kitten helpers')) catMult*=(1+Game.milkProgress*0.1*milkMult);
4350
if (Game.Has('Kitten workers')) catMult*=(1+Game.milkProgress*0.125*milkMult);
4351
if (Game.Has('Kitten engineers')) catMult*=(1+Game.milkProgress*0.15*milkMult);
4352
if (Game.Has('Kitten overseers')) catMult*=(1+Game.milkProgress*0.175*milkMult);
4353
if (Game.Has('Kitten managers')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4354
if (Game.Has('Kitten accountants')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4355
if (Game.Has('Kitten specialists')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4356
if (Game.Has('Kitten experts')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4357
if (Game.Has('Kitten consultants')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4358
if (Game.Has('Kitten assistants to the regional manager')) catMult*=(1+Game.milkProgress*0.175*milkMult);
4359
if (Game.Has('Kitten marketeers')) catMult*=(1+Game.milkProgress*0.15*milkMult);
4360
if (Game.Has('Kitten analysts')) catMult*=(1+Game.milkProgress*0.125*milkMult);
4361
if (Game.Has('Kitten executives')) catMult*=(1+Game.milkProgress*0.115*milkMult);
4362
if (Game.Has('Kitten angels')) catMult*=(1+Game.milkProgress*0.1*milkMult);
4363
if (Game.Has('Fortune #103')) catMult*=(1+Game.milkProgress*0.05*milkMult);
4364
4365
Game.cookiesMultByType['kittens']=catMult;
4366
4367
for (var i in Game.Objects)
4368
{
4369
var me=Game.Objects[i];
4370
me.storedCps=me.cps(me);
4371
if (Game.ascensionMode!=1) me.storedCps*=(1+me.level*0.01)*buildMult;
4372
if (me.id==1 && Game.Has('Milkhelp&reg; lactose intolerance relief tablets')) me.storedCps*=1+0.05*Game.milkProgress*milkMult;//this used to be "me.storedCps*=1+0.1*Math.pow(catMult-1,0.5)" which was. hmm
4373
me.storedTotalCps=me.amount*me.storedCps;
4374
Game.cookiesPs+=me.storedTotalCps;
4375
Game.cookiesPsByType[me.name]=me.storedTotalCps;
4376
}
4377
//cps from buildings only
4378
Game.buildingCps=Game.cookiesPs;
4379
4380
if (Game.Has('"egg"')) {Game.cookiesPs+=9;Game.cookiesPsByType['"egg"']=9;}//"egg"
4381
4382
mult*=catMult;
4383
4384
var eggMult=1;
4385
if (Game.Has('Chicken egg')) eggMult*=1.01;
4386
if (Game.Has('Duck egg')) eggMult*=1.01;
4387
if (Game.Has('Turkey egg')) eggMult*=1.01;
4388
if (Game.Has('Quail egg')) eggMult*=1.01;
4389
if (Game.Has('Robin egg')) eggMult*=1.01;
4390
if (Game.Has('Ostrich egg')) eggMult*=1.01;
4391
if (Game.Has('Cassowary egg')) eggMult*=1.01;
4392
if (Game.Has('Salmon roe')) eggMult*=1.01;
4393
if (Game.Has('Frogspawn')) eggMult*=1.01;
4394
if (Game.Has('Shark egg')) eggMult*=1.01;
4395
if (Game.Has('Turtle egg')) eggMult*=1.01;
4396
if (Game.Has('Ant larva')) eggMult*=1.01;
4397
if (Game.Has('Century egg'))
4398
{
4399
//the boost increases a little every day, with diminishing returns up to +10% on the 100th day
4400
var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;
4401
day=Math.min(day,100);
4402
eggMult*=1+(1-Math.pow(1-day/100,3))*0.1;
4403
}
4404
4405
Game.cookiesMultByType['eggs']=eggMult;
4406
mult*=eggMult;
4407
4408
if (Game.Has('Sugar baking')) mult*=(1+Math.min(100,Game.lumps)*0.01);
4409
4410
//if (Game.hasAura('Radiant Appetite')) mult*=2;
4411
mult*=1+Game.auraMult('Radiant Appetite');
4412
4413
var rawCookiesPs=Game.cookiesPs*mult;
4414
for (var i in Game.CpsAchievements)
4415
{
4416
if (rawCookiesPs>=Game.CpsAchievements[i].threshold) Game.Win(Game.CpsAchievements[i].name);
4417
}
4418
Game.cookiesPsRaw=rawCookiesPs;
4419
Game.cookiesPsRawHighest=Math.max(Game.cookiesPsRawHighest,rawCookiesPs);
4420
4421
var n=Game.shimmerTypes['golden'].n;
4422
var auraMult=Game.auraMult('Dragon\'s Fortune');
4423
for (var i=0;i<n;i++){mult*=1+auraMult*1.23;}
4424
4425
name=Game.bakeryName.toLowerCase();
4426
if (name=='orteil') mult*=0.99;
4427
else if (name=='ortiel') mult*=0.98;//or so help me
4428
4429
var sucking=0;
4430
for (var i in Game.wrinklers)
4431
{
4432
if (Game.wrinklers[i].phase==2)
4433
{
4434
sucking++;
4435
}
4436
}
4437
var suckRate=1/20;//each wrinkler eats a twentieth of your CpS
4438
suckRate*=Game.eff('wrinklerEat');
4439
4440
Game.cpsSucked=sucking*suckRate;
4441
4442
4443
if (Game.Has('Elder Covenant')) mult*=0.95;
4444
4445
if (Game.Has('Golden switch [off]'))
4446
{
4447
var goldenSwitchMult=1.5;
4448
if (Game.Has('Residual luck'))
4449
{
4450
var upgrades=Game.goldenCookieUpgrades;
4451
for (var i in upgrades) {if (Game.Has(upgrades[i])) goldenSwitchMult+=0.1;}
4452
}
4453
mult*=goldenSwitchMult;
4454
}
4455
if (Game.Has('Shimmering veil [off]'))
4456
{
4457
var veilMult=0.5;
4458
if (Game.Has('Reinforced membrane')) veilMult+=0.1;
4459
mult*=1+veilMult;
4460
}
4461
if (Game.Has('Magic shenanigans')) mult*=1000;
4462
if (Game.Has('Occult obstruction')) mult*=0;
4463
4464
4465
Game.cookiesPs=Game.runModHookOnValue('cps',Game.cookiesPs);
4466
4467
4468
//cps without golden cookie effects
4469
Game.unbuffedCps=Game.cookiesPs*mult;
4470
4471
for (var i in Game.buffs)
4472
{
4473
if (typeof Game.buffs[i].multCpS!=='undefined') mult*=Game.buffs[i].multCpS;
4474
}
4475
4476
Game.globalCpsMult=mult;
4477
Game.cookiesPs*=Game.globalCpsMult;
4478
4479
//if (Game.hasBuff('Cursed finger')) Game.cookiesPs=0;
4480
4481
Game.computedMouseCps=Game.mouseCps();
4482
4483
Game.computeLumpTimes();
4484
4485
Game.recalculateGains=0;
4486
}
4487
4488
Game.dropRateMult=function()
4489
{
4490
var rate=1;
4491
if (Game.Has('Green yeast digestives')) rate*=1.03;
4492
if (Game.Has('Dragon teddy bear')) rate*=1.03;
4493
rate*=Game.eff('itemDrops');
4494
//if (Game.hasAura('Mind Over Matter')) rate*=1.25;
4495
rate*=1+Game.auraMult('Mind Over Matter')*0.25;
4496
if (Game.Has('Santa\'s bottomless bag')) rate*=1.1;
4497
if (Game.Has('Cosmic beginner\'s luck') && !Game.Has('Heavenly chip secret')) rate*=5;
4498
return rate;
4499
}
4500
/*=====================================================================================
4501
SHIMMERS (GOLDEN COOKIES & SUCH)
4502
=======================================================================================*/
4503
Game.shimmersL=l('shimmers');
4504
Game.shimmers=[];//all shimmers currently on the screen
4505
Game.shimmersN=Math.floor(Math.random()*10000);
4506
Game.shimmer=function(type,obj,noCount)
4507
{
4508
this.type=type;
4509
4510
this.l=document.createElement('div');
4511
this.l.className='shimmer';
4512
if (!Game.touchEvents) {AddEvent(this.l,'click',function(what){return function(event){what.pop(event);};}(this));}
4513
else {AddEvent(this.l,'touchend',function(what){return function(event){what.pop(event);};}(this));}//touch events
4514
4515
this.x=0;
4516
this.y=0;
4517
this.id=Game.shimmersN;
4518
4519
this.forceObj=obj||0;
4520
this.noCount=noCount;
4521
if (!this.noCount) {Game.shimmerTypes[this.type].n++;Game.recalculateGains=1;}
4522
4523
this.init();
4524
4525
Game.shimmersL.appendChild(this.l);
4526
Game.shimmers.push(this);
4527
Game.shimmersN++;
4528
}
4529
Game.shimmer.prototype.init=function()//executed when the shimmer is created
4530
{
4531
Game.shimmerTypes[this.type].initFunc(this);
4532
}
4533
Game.shimmer.prototype.update=function()//executed every frame
4534
{
4535
Game.shimmerTypes[this.type].updateFunc(this);
4536
}
4537
Game.shimmer.prototype.pop=function(event)//executed when the shimmer is popped by the player
4538
{
4539
if (event) event.preventDefault();
4540
Game.loseShimmeringVeil('shimmer');
4541
Game.Click=0;
4542
Game.shimmerTypes[this.type].popFunc(this);
4543
}
4544
Game.shimmer.prototype.die=function()//executed after the shimmer disappears (from old age or popping)
4545
{
4546
if (Game.shimmerTypes[this.type].spawnsOnTimer && this.spawnLead)
4547
{
4548
//if this was the spawn lead for this shimmer type, set the shimmer type's "spawned" to 0 and restart its spawn timer
4549
var type=Game.shimmerTypes[this.type];
4550
type.time=0;
4551
type.spawned=0;
4552
type.minTime=type.getMinTime(this);
4553
type.maxTime=type.getMaxTime(this);
4554
}
4555
Game.shimmersL.removeChild(this.l);
4556
if (Game.shimmers.indexOf(this)!=-1) Game.shimmers.splice(Game.shimmers.indexOf(this),1);
4557
if (!this.noCount) {Game.shimmerTypes[this.type].n=Math.max(0,Game.shimmerTypes[this.type].n-1);Game.recalculateGains=1;}
4558
}
4559
4560
4561
Game.updateShimmers=function()//run shimmer functions, kill overtimed shimmers and spawn new ones
4562
{
4563
for (var i in Game.shimmers)
4564
{
4565
Game.shimmers[i].update();
4566
}
4567
4568
//cookie storm!
4569
if (Game.hasBuff('Cookie storm') && Math.random()<0.5)
4570
{
4571
var newShimmer=new Game.shimmer('golden',0,1);
4572
newShimmer.dur=Math.ceil(Math.random()*4+1);
4573
newShimmer.life=Math.ceil(Game.fps*newShimmer.dur);
4574
newShimmer.force='cookie storm drop';
4575
newShimmer.sizeMult=Math.random()*0.75+0.25;
4576
}
4577
4578
//spawn shimmers
4579
for (var i in Game.shimmerTypes)
4580
{
4581
var me=Game.shimmerTypes[i];
4582
if (me.spawnsOnTimer && me.spawnConditions())//only run on shimmer types that work on a timer
4583
{
4584
if (!me.spawned)//no shimmer spawned for this type? check the timer and try to spawn one
4585
{
4586
me.time++;
4587
if (Math.random()<Math.pow(Math.max(0,(me.time-me.minTime)/(me.maxTime-me.minTime)),5))
4588
{
4589
var newShimmer=new Game.shimmer(i);
4590
newShimmer.spawnLead=1;
4591
if (Game.Has('Distilled essence of redoubled luck') && Math.random()<0.01) var newShimmer=new Game.shimmer(i);
4592
me.spawned=1;
4593
}
4594
}
4595
}
4596
}
4597
}
4598
Game.killShimmers=function()//stop and delete all shimmers (used on resetting etc)
4599
{
4600
for (var i=Game.shimmers.length-1;i>=0;i--)
4601
{
4602
Game.shimmers[i].die();
4603
}
4604
for (var i in Game.shimmerTypes)
4605
{
4606
var me=Game.shimmerTypes[i];
4607
if (me.reset) me.reset();
4608
me.n=0;
4609
if (me.spawnsOnTimer)
4610
{
4611
me.time=0;
4612
me.spawned=0;
4613
me.minTime=me.getMinTime(me);
4614
me.maxTime=me.getMaxTime(me);
4615
}
4616
}
4617
}
4618
4619
Game.shimmerTypes={
4620
//in these, "me" refers to the shimmer itself, and "this" to the shimmer's type object
4621
'golden':{
4622
reset:function()
4623
{
4624
this.chain=0;
4625
this.totalFromChain=0;
4626
this.last='';
4627
},
4628
initFunc:function(me)
4629
{
4630
if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/chime.mp3');
4631
4632
//set image
4633
var bgPic='img/goldCookie.png';
4634
var picX=0;var picY=0;
4635
4636
4637
if ((!me.forceObj || !me.forceObj.noWrath) && ((me.forceObj && me.forceObj.wrath) || (Game.elderWrath==1 && Math.random()<1/3) || (Game.elderWrath==2 && Math.random()<2/3) || (Game.elderWrath==3) || (Game.hasGod && Game.hasGod('scorn'))))
4638
{
4639
me.wrath=1;
4640
if (Game.season=='halloween') bgPic='img/spookyCookie.png';
4641
else bgPic='img/wrathCookie.png';
4642
}
4643
else
4644
{
4645
me.wrath=0;
4646
}
4647
4648
if (Game.season=='valentines')
4649
{
4650
bgPic='img/hearts.png';
4651
picX=Math.floor(Math.random()*8);
4652
}
4653
else if (Game.season=='fools')
4654
{
4655
bgPic='img/contract.png';
4656
if (me.wrath) bgPic='img/wrathContract.png';
4657
}
4658
else if (Game.season=='easter')
4659
{
4660
bgPic='img/bunnies.png';
4661
picX=Math.floor(Math.random()*4);
4662
picY=0;
4663
if (me.wrath) picY=1;
4664
}
4665
4666
me.x=Math.floor(Math.random()*Math.max(0,(Game.bounds.right-300)-Game.bounds.left-128)+Game.bounds.left+64)-64;
4667
me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-128)+Game.bounds.top+64)-64;
4668
me.l.style.left=me.x+'px';
4669
me.l.style.top=me.y+'px';
4670
me.l.style.width='96px';
4671
me.l.style.height='96px';
4672
me.l.style.backgroundImage='url('+bgPic+')';
4673
me.l.style.backgroundPosition=(-picX*96)+'px '+(-picY*96)+'px';
4674
me.l.style.opacity='0';
4675
me.l.style.display='block';
4676
me.l.setAttribute('alt',me.wrath?'Wrath cookie':'Golden cookie');
4677
4678
me.life=1;//the cookie's current progression through its lifespan (in frames)
4679
me.dur=13;//duration; the cookie's lifespan in seconds before it despawns
4680
4681
var dur=13;
4682
if (Game.Has('Lucky day')) dur*=2;
4683
if (Game.Has('Serendipity')) dur*=2;
4684
if (Game.Has('Decisive fate')) dur*=1.05;
4685
if (Game.Has('Lucky digit')) dur*=1.01;
4686
if (Game.Has('Lucky number')) dur*=1.01;
4687
if (Game.Has('Lucky payout')) dur*=1.01;
4688
if (!me.wrath) dur*=Game.eff('goldenCookieDur');
4689
else dur*=Game.eff('wrathCookieDur');
4690
dur*=Math.pow(0.95,Game.shimmerTypes['golden'].n-1);//5% shorter for every other golden cookie on the screen
4691
if (this.chain>0) dur=Math.max(2,10/this.chain);//this is hilarious
4692
me.dur=dur;
4693
me.life=Math.ceil(Game.fps*me.dur);
4694
me.force='';
4695
me.sizeMult=1;
4696
},
4697
updateFunc:function(me)
4698
{
4699
var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,4);
4700
me.l.style.opacity=curve;
4701
//this line makes each golden cookie pulse in a unique way
4702
if (Game.prefs.fancy) me.l.style.transform='rotate('+(Math.sin(me.id*0.69)*24+Math.sin(Game.T*(0.35+Math.sin(me.id*0.97)*0.15)+me.id/*+Math.sin(Game.T*0.07)*2+2*/)*(3+Math.sin(me.id*0.36)*2))+'deg) scale('+(me.sizeMult*(1+Math.sin(me.id*0.53)*0.2)*curve*(1+(0.06+Math.sin(me.id*0.41)*0.05)*(Math.sin(Game.T*(0.25+Math.sin(me.id*0.73)*0.15)+me.id))))+')';
4703
me.life--;
4704
if (me.life<=0) {this.missFunc(me);me.die();}
4705
},
4706
popFunc:function(me)
4707
{
4708
//get achievs and stats
4709
if (me.spawnLead)
4710
{
4711
Game.goldenClicks++;
4712
Game.goldenClicksLocal++;
4713
4714
if (Game.goldenClicks>=1) Game.Win('Golden cookie');
4715
if (Game.goldenClicks>=7) Game.Win('Lucky cookie');
4716
if (Game.goldenClicks>=27) Game.Win('A stroke of luck');
4717
if (Game.goldenClicks>=77) Game.Win('Fortune');
4718
if (Game.goldenClicks>=777) Game.Win('Leprechaun');
4719
if (Game.goldenClicks>=7777) Game.Win('Black cat\'s paw');
4720
if (Game.goldenClicks>=27777) Game.Win('Seven horseshoes');
4721
4722
if (Game.goldenClicks>=7) Game.Unlock('Lucky day');
4723
if (Game.goldenClicks>=27) Game.Unlock('Serendipity');
4724
if (Game.goldenClicks>=77) Game.Unlock('Get lucky');
4725
4726
if ((me.life/Game.fps)>(me.dur-1)) Game.Win('Early bird');
4727
if (me.life<Game.fps) Game.Win('Fading luck');
4728
}
4729
4730
if (Game.forceUnslotGod)
4731
{
4732
if (Game.forceUnslotGod('asceticism')) Game.useSwap(1000000);
4733
}
4734
4735
//select an effect
4736
var list=[];
4737
if (me.wrath>0) list.push('clot','multiply cookies','ruin cookies');
4738
else list.push('frenzy','multiply cookies');
4739
if (me.wrath>0 && Game.hasGod && Game.hasGod('scorn')) list.push('clot','ruin cookies','clot','ruin cookies');
4740
if (me.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie','cookie storm');
4741
else if (Math.random()<0.03 && Game.cookiesEarned>=100000) list.push('chain cookie','cookie storm');
4742
if (Math.random()<0.05 && Game.season=='fools') list.push('everything must go');
4743
if (Math.random()<0.1 && (Math.random()<0.05 || !Game.hasBuff('Dragonflight'))) list.push('click frenzy');
4744
if (me.wrath && Math.random()<0.1) list.push('cursed finger');
4745
4746
if (Game.BuildingsOwned>=10 && Math.random()<0.25) list.push('building special');
4747
4748
if (Game.canLumps() && Math.random()<0.0005) list.push('free sugar lump');
4749
4750
if ((me.wrath==0 && Math.random()<0.15) || Math.random()<0.05)
4751
{
4752
//if (Game.hasAura('Reaper of Fields')) list.push('dragon harvest');
4753
if (Math.random()<Game.auraMult('Reaper of Fields')) list.push('dragon harvest');
4754
//if (Game.hasAura('Dragonflight')) list.push('dragonflight');
4755
if (Math.random()<Game.auraMult('Dragonflight')) list.push('dragonflight');
4756
}
4757
4758
if (this.last!='' && Math.random()<0.8 && list.indexOf(this.last)!=-1) list.splice(list.indexOf(this.last),1);//80% chance to force a different one
4759
if (Math.random()<0.0001) list.push('blab');
4760
var choice=choose(list);
4761
4762
if (this.chain>0) choice='chain cookie';
4763
if (me.force!='') {this.chain=0;choice=me.force;me.force='';}
4764
if (choice!='chain cookie') this.chain=0;
4765
4766
this.last=choice;
4767
4768
//create buff for effect
4769
//buff duration multiplier
4770
var effectDurMod=1;
4771
if (Game.Has('Get lucky')) effectDurMod*=2;
4772
if (Game.Has('Lasting fortune')) effectDurMod*=1.1;
4773
if (Game.Has('Lucky digit')) effectDurMod*=1.01;
4774
if (Game.Has('Lucky number')) effectDurMod*=1.01;
4775
if (Game.Has('Green yeast digestives')) effectDurMod*=1.01;
4776
if (Game.Has('Lucky payout')) effectDurMod*=1.01;
4777
//if (Game.hasAura('Epoch Manipulator')) effectDurMod*=1.05;
4778
effectDurMod*=1+Game.auraMult('Epoch Manipulator')*0.05;
4779
if (!me.wrath) effectDurMod*=Game.eff('goldenCookieEffDur');
4780
else effectDurMod*=Game.eff('wrathCookieEffDur');
4781
4782
if (Game.hasGod)
4783
{
4784
var godLvl=Game.hasGod('decadence');
4785
if (godLvl==1) effectDurMod*=1.07;
4786
else if (godLvl==2) effectDurMod*=1.05;
4787
else if (godLvl==3) effectDurMod*=1.02;
4788
}
4789
4790
//effect multiplier (from lucky etc)
4791
var mult=1;
4792
//if (me.wrath>0 && Game.hasAura('Unholy Dominion')) mult*=1.1;
4793
//else if (me.wrath==0 && Game.hasAura('Ancestral Metamorphosis')) mult*=1.1;
4794
if (me.wrath>0) mult*=1+Game.auraMult('Unholy Dominion')*0.1;
4795
else if (me.wrath==0) mult*=1+Game.auraMult('Ancestral Metamorphosis')*0.1;
4796
if (Game.Has('Green yeast digestives')) mult*=1.01;
4797
if (Game.Has('Dragon fang')) mult*=1.03;
4798
if (!me.wrath) mult*=Game.eff('goldenCookieGain');
4799
else mult*=Game.eff('wrathCookieGain');
4800
4801
var popup='';
4802
var buff=0;
4803
4804
if (choice=='building special')
4805
{
4806
var time=Math.ceil(30*effectDurMod);
4807
var list=[];
4808
for (var i in Game.Objects)
4809
{
4810
if (Game.Objects[i].amount>=10) list.push(Game.Objects[i].id);
4811
}
4812
if (list.length==0) {choice='frenzy';}//default to frenzy if no proper building
4813
else
4814
{
4815
var obj=choose(list);
4816
var pow=Game.ObjectsById[obj].amount/10+1;
4817
if (me.wrath && Math.random()<0.3)
4818
{
4819
buff=Game.gainBuff('building debuff',time,pow,obj);
4820
}
4821
else
4822
{
4823
buff=Game.gainBuff('building buff',time,pow,obj);
4824
}
4825
}
4826
}
4827
4828
if (choice=='free sugar lump')
4829
{
4830
Game.gainLumps(1);
4831
popup='Sweet!<div style="font-size:65%;">Found 1 sugar lump!</div>';
4832
}
4833
else if (choice=='frenzy')
4834
{
4835
buff=Game.gainBuff('frenzy',Math.ceil(77*effectDurMod),7);
4836
}
4837
else if (choice=='dragon harvest')
4838
{
4839
buff=Game.gainBuff('dragon harvest',Math.ceil(60*effectDurMod),15);
4840
}
4841
else if (choice=='everything must go')
4842
{
4843
buff=Game.gainBuff('everything must go',Math.ceil(8*effectDurMod),5);
4844
}
4845
else if (choice=='multiply cookies')
4846
{
4847
var moni=mult*Math.min(Game.cookies*0.15,Game.cookiesPs*60*15)+13;//add 15% to cookies owned (+13), or 15 minutes of cookie production - whichever is lowest
4848
Game.Earn(moni);
4849
popup='Lucky!<div style="font-size:65%;">+'+Beautify(moni)+' cookies!</div>';
4850
}
4851
else if (choice=='ruin cookies')
4852
{
4853
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
4854
moni=Math.min(Game.cookies,moni);
4855
Game.Spend(moni);
4856
popup='Ruin!<div style="font-size:65%;">Lost '+Beautify(moni)+' cookies!</div>';
4857
}
4858
else if (choice=='blood frenzy')
4859
{
4860
buff=Game.gainBuff('blood frenzy',Math.ceil(6*effectDurMod),666);
4861
}
4862
else if (choice=='clot')
4863
{
4864
buff=Game.gainBuff('clot',Math.ceil(66*effectDurMod),0.5);
4865
}
4866
else if (choice=='cursed finger')
4867
{
4868
buff=Game.gainBuff('cursed finger',Math.ceil(10*effectDurMod),Game.cookiesPs*Math.ceil(10*effectDurMod));
4869
}
4870
else if (choice=='click frenzy')
4871
{
4872
buff=Game.gainBuff('click frenzy',Math.ceil(13*effectDurMod),777);
4873
}
4874
else if (choice=='dragonflight')
4875
{
4876
buff=Game.gainBuff('dragonflight',Math.ceil(10*effectDurMod),1111);
4877
if (Math.random()<0.8) Game.killBuff('Click frenzy');
4878
}
4879
else if (choice=='chain cookie')
4880
{
4881
//fix by Icehawk78
4882
if (this.chain==0) this.totalFromChain=0;
4883
this.chain++;
4884
var digit=me.wrath?6:7;
4885
if (this.chain==1) this.chain+=Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);
4886
4887
var maxPayout=Math.min(Game.cookiesPs*60*60*6,Game.cookies*0.5)*mult;
4888
var moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain)*digit*mult),maxPayout));
4889
var nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain+1)*digit*mult),maxPayout));
4890
this.totalFromChain+=moni;
4891
var moniStr=Beautify(moni);
4892
4893
//break the chain if we're above 5 digits AND it's more than 50% of our bank, it grants more than 6 hours of our CpS, or just a 1% chance each digit (update : removed digit limit)
4894
if (Math.random()<0.01 || nextMoni>=maxPayout)
4895
{
4896
this.chain=0;
4897
popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!<br>Cookie chain over. You made '+Beautify(this.totalFromChain)+' cookies.</div>';
4898
}
4899
else
4900
{
4901
popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!</div>';//
4902
}
4903
Game.Earn(moni);
4904
}
4905
else if (choice=='cookie storm')
4906
{
4907
buff=Game.gainBuff('cookie storm',Math.ceil(7*effectDurMod),7);
4908
}
4909
else if (choice=='cookie storm drop')
4910
{
4911
var moni=Math.max(mult*(Game.cookiesPs*60*Math.floor(Math.random()*7+1)),Math.floor(Math.random()*7+1));//either 1-7 cookies or 1-7 minutes of cookie production, whichever is highest
4912
Game.Earn(moni);
4913
popup='<div style="font-size:75%;">+'+Beautify(moni)+' cookies!</div>';
4914
}
4915
else if (choice=='blab')//sorry (it's really rare)
4916
{
4917
var str=choose([
4918
'Cookie crumbliness x3 for 60 seconds!',
4919
'Chocolatiness x7 for 77 seconds!',
4920
'Dough elasticity halved for 66 seconds!',
4921
'Golden cookie shininess doubled for 3 seconds!',
4922
'World economy halved for 30 seconds!',
4923
'Grandma kisses 23% stingier for 45 seconds!',
4924
'Thanks for clicking!',
4925
'Fooled you! This one was just a test.',
4926
'Golden cookies clicked +1!',
4927
'Your click has been registered. Thank you for your cooperation.',
4928
'Thanks! That hit the spot!',
4929
'Thank you. A team has been dispatched.',
4930
'They know.',
4931
'Oops. This was just a chocolate cookie with shiny aluminium foil.'
4932
]);
4933
popup=str;
4934
}
4935
4936
if (popup=='' && buff && buff.name && buff.desc) popup=buff.name+'<div style="font-size:65%;">'+buff.desc+'</div>';
4937
if (popup!='') Game.Popup(popup,me.x+me.l.offsetWidth/2,me.y);
4938
4939
Game.DropEgg(0.9);
4940
4941
//sparkle and kill the shimmer
4942
Game.SparkleAt(me.x+48,me.y+48);
4943
if (choice=='cookie storm drop')
4944
{
4945
if (Game.prefs.cookiesound) PlaySound('snd/clickb'+Math.floor(Math.random()*7+1)+'.mp3',0.75);
4946
else PlaySound('snd/click'+Math.floor(Math.random()*7+1)+'.mp3',0.75);
4947
}
4948
else PlaySound('snd/shimmerClick.mp3');
4949
me.die();
4950
},
4951
missFunc:function(me)
4952
{
4953
if (this.chain>0 && this.totalFromChain>0)
4954
{
4955
Game.Popup('Cookie chain broken.<div style="font-size:65%;">You made '+Beautify(this.totalFromChain)+' cookies.</div>',me.x+me.l.offsetWidth/2,me.y);
4956
this.chain=0;this.totalFromChain=0;
4957
}
4958
if (me.spawnLead) Game.missedGoldenClicks++;
4959
},
4960
spawnsOnTimer:true,
4961
spawnConditions:function()
4962
{
4963
if (!Game.Has('Golden switch [off]')) return true; else return false;
4964
},
4965
spawned:0,
4966
time:0,
4967
minTime:0,
4968
maxTime:0,
4969
getTimeMod:function(me,m)
4970
{
4971
if (Game.Has('Lucky day')) m/=2;
4972
if (Game.Has('Serendipity')) m/=2;
4973
if (Game.Has('Golden goose egg')) m*=0.95;
4974
if (Game.Has('Heavenly luck')) m*=0.95;
4975
if (Game.Has('Green yeast digestives')) m*=0.99;
4976
//if (Game.hasAura('Arcane Aura')) m*=0.95;
4977
m*=1-Game.auraMult('Arcane Aura')*0.05;
4978
if (Game.hasBuff('Sugar blessing')) m*=0.9;
4979
if (Game.season=='easter' && Game.Has('Starspawn')) m*=0.98;
4980
else if (Game.season=='halloween' && Game.Has('Starterror')) m*=0.98;
4981
else if (Game.season=='valentines' && Game.Has('Starlove')) m*=0.98;
4982
else if (Game.season=='fools' && Game.Has('Startrade')) m*=0.95;
4983
if (!me.wrath) m*=1/Game.eff('goldenCookieFreq');
4984
else m*=1/Game.eff('wrathCookieFreq');
4985
if (Game.hasGod)
4986
{
4987
var godLvl=Game.hasGod('industry');
4988
if (godLvl==1) m*=1.1;
4989
else if (godLvl==2) m*=1.06;
4990
else if (godLvl==3) m*=1.03;
4991
var godLvl=Game.hasGod('mother');
4992
if (godLvl==1) m*=1.15;
4993
else if (godLvl==2) m*=1.1;
4994
else if (godLvl==3) m*=1.05;
4995
4996
if (Game.season!='')
4997
{
4998
var godLvl=Game.hasGod('seasons');
4999
if (Game.season!='fools')
5000
{
5001
if (godLvl==1) m*=0.97;
5002
else if (godLvl==2) m*=0.98;
5003
else if (godLvl==3) m*=0.99;
5004
}
5005
else
5006
{
5007
if (godLvl==1) m*=0.955;
5008
else if (godLvl==2) m*=0.97;
5009
else if (godLvl==3) m*=0.985;
5010
}
5011
}
5012
}
5013
if (this.chain>0) m=0.05;
5014
if (Game.Has('Gold hoard')) m=0.01;
5015
return Math.ceil(Game.fps*60*m);
5016
},
5017
getMinTime:function(me)
5018
{
5019
var m=5;
5020
return this.getTimeMod(me,m);
5021
},
5022
getMaxTime:function(me)
5023
{
5024
var m=15;
5025
return this.getTimeMod(me,m);
5026
},
5027
last:'',
5028
},
5029
'reindeer':{
5030
reset:function()
5031
{
5032
},
5033
initFunc:function(me)
5034
{
5035
if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/jingle.mp3');
5036
5037
me.x=-128;
5038
me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-256)+Game.bounds.top+128)-128;
5039
//me.l.style.left=me.x+'px';
5040
//me.l.style.top=me.y+'px';
5041
me.l.style.width='167px';
5042
me.l.style.height='212px';
5043
me.l.style.backgroundImage='url(img/frostedReindeer.png)';
5044
me.l.style.opacity='0';
5045
//me.l.style.transform='rotate('+(Math.random()*60-30)+'deg) scale('+(Math.random()*1+0.25)+')';
5046
me.l.style.display='block';
5047
me.l.setAttribute('alt','Reindeer');
5048
5049
me.life=1;//the reindeer's current progression through its lifespan (in frames)
5050
me.dur=4;//duration; the cookie's lifespan in seconds before it despawns
5051
5052
var dur=4;
5053
if (Game.Has('Weighted sleighs')) dur*=2;
5054
dur*=Game.eff('reindeerDur');
5055
me.dur=dur;
5056
me.life=Math.ceil(Game.fps*me.dur);
5057
me.sizeMult=1;
5058
},
5059
updateFunc:function(me)
5060
{
5061
var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,12);
5062
me.l.style.opacity=curve;
5063
me.l.style.transform='translate('+(me.x+(Game.bounds.right-Game.bounds.left)*(1-me.life/(Game.fps*me.dur)))+'px,'+(me.y-Math.abs(Math.sin(me.life*0.1))*128)+'px) rotate('+(Math.sin(me.life*0.2+0.3)*10)+'deg) scale('+(me.sizeMult*(1+Math.sin(me.id*0.53)*0.1))+')';
5064
me.life--;
5065
if (me.life<=0) {this.missFunc(me);me.die();}
5066
},
5067
popFunc:function(me)
5068
{
5069
//get achievs and stats
5070
if (me.spawnLead)
5071
{
5072
Game.reindeerClicked++;
5073
}
5074
5075
var val=Game.cookiesPs*60;
5076
if (Game.hasBuff('Elder frenzy')) val*=0.5;//very sorry
5077
if (Game.hasBuff('Frenzy')) val*=0.75;//I sincerely apologize
5078
var moni=Math.max(25,val);//1 minute of cookie production, or 25 cookies - whichever is highest
5079
if (Game.Has('Ho ho ho-flavored frosting')) moni*=2;
5080
moni*=Game.eff('reindeerGain');
5081
Game.Earn(moni);
5082
if (Game.hasBuff('Elder frenzy')) Game.Win('Eldeer');
5083
5084
var cookie='';
5085
var failRate=0.8;
5086
if (Game.HasAchiev('Let it snow')) failRate=0.6;
5087
failRate*=1/Game.dropRateMult();
5088
if (Game.Has('Starsnow')) failRate*=0.95;
5089
if (Game.hasGod)
5090
{
5091
var godLvl=Game.hasGod('seasons');
5092
if (godLvl==1) failRate*=0.9;
5093
else if (godLvl==2) failRate*=0.95;
5094
else if (godLvl==3) failRate*=0.97;
5095
}
5096
if (Math.random()>failRate)//christmas cookie drops
5097
{
5098
cookie=choose(['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits']);
5099
if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))
5100
{
5101
Game.Unlock(cookie);
5102
}
5103
else cookie='';
5104
}
5105
5106
var popup='';
5107
5108
if (Game.prefs.popups) Game.Popup('You found '+choose(['Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen','Rudolph'])+'!<br>The reindeer gives you '+Beautify(moni)+' cookies.'+(cookie==''?'':'<br>You are also rewarded with '+cookie+'!'));
5109
else Game.Notify('You found '+choose(['Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen','Rudolph'])+'!','The reindeer gives you '+Beautify(moni)+' cookies.'+(cookie==''?'':'<br>You are also rewarded with '+cookie+'!'),[12,9],6);
5110
popup='<div style="font-size:80%;">+'+Beautify(moni)+' cookies!</div>';
5111
5112
if (popup!='') Game.Popup(popup,Game.mouseX,Game.mouseY);
5113
5114
//sparkle and kill the shimmer
5115
Game.SparkleAt(Game.mouseX,Game.mouseY);
5116
PlaySound('snd/jingleClick.mp3');
5117
me.die();
5118
},
5119
missFunc:function(me)
5120
{
5121
},
5122
spawnsOnTimer:true,
5123
spawnConditions:function()
5124
{
5125
if (Game.season=='christmas') return true; else return false;
5126
},
5127
spawned:0,
5128
time:0,
5129
minTime:0,
5130
maxTime:0,
5131
getTimeMod:function(me,m)
5132
{
5133
if (Game.Has('Reindeer baking grounds')) m/=2;
5134
if (Game.Has('Starsnow')) m*=0.95;
5135
if (Game.hasGod)
5136
{
5137
var godLvl=Game.hasGod('seasons');
5138
if (godLvl==1) m*=0.9;
5139
else if (godLvl==2) m*=0.95;
5140
else if (godLvl==3) m*=0.97;
5141
}
5142
m*=1/Game.eff('reindeerFreq');
5143
if (Game.Has('Reindeer season')) m=0.01;
5144
return Math.ceil(Game.fps*60*m);
5145
},
5146
getMinTime:function(me)
5147
{
5148
var m=3;
5149
return this.getTimeMod(me,m);
5150
},
5151
getMaxTime:function(me)
5152
{
5153
var m=6;
5154
return this.getTimeMod(me,m);
5155
},
5156
}
5157
};
5158
5159
Game.goldenCookieChoices=[
5160
"Frenzy","frenzy",
5161
"Lucky","multiply cookies",
5162
"Ruin","ruin cookies",
5163
"Elder frenzy","blood frenzy",
5164
"Clot","clot",
5165
"Click frenzy","click frenzy",
5166
"Cursed finger","cursed finger",
5167
"Cookie chain","chain cookie",
5168
"Cookie storm","cookie storm",
5169
"Building special","building special",
5170
"Dragon Harvest","dragon harvest",
5171
"Dragonflight","dragonflight",
5172
"Sweet","free sugar lump",
5173
"Blab","blab"
5174
];
5175
Game.goldenCookieBuildingBuffs={
5176
'Cursor':['High-five','Slap to the face'],
5177
'Grandma':['Congregation','Senility'],
5178
'Farm':['Luxuriant harvest','Locusts'],
5179
'Mine':['Ore vein','Cave-in'],
5180
'Factory':['Oiled-up','Jammed machinery'],
5181
'Bank':['Juicy profits','Recession'],
5182
'Temple':['Fervent adoration','Crisis of faith'],
5183
'Wizard tower':['Manabloom','Magivores'],
5184
'Shipment':['Delicious lifeforms','Black holes'],
5185
'Alchemy lab':['Breakthrough','Lab disaster'],
5186
'Portal':['Righteous cataclysm','Dimensional calamity'],
5187
'Time machine':['Golden ages','Time jam'],
5188
'Antimatter condenser':['Extra cycles','Predictable tragedy'],
5189
'Prism':['Solar flare','Eclipse'],
5190
'Chancemaker':['Winning streak','Dry spell'],
5191
'Fractal engine':['Macrocosm','Microcosm'],
5192
'Javascript console':['Refactoring','Antipattern'],
5193
'Idleverse':['Cosmic nursery','Big crunch'],
5194
};
5195
5196
/*=====================================================================================
5197
PARTICLES
5198
=======================================================================================*/
5199
//generic particles (falling cookies etc)
5200
//only displayed on left section
5201
Game.particles=[];
5202
Game.particlesN=50;
5203
for (var i=0;i<Game.particlesN;i++)
5204
{
5205
Game.particles[i]={x:0,y:0,xd:0,yd:0,w:64,h:64,z:0,size:1,dur:2,life:-1,r:0,pic:'smallCookies.png',picId:0,picPos:[0,0]};
5206
}
5207
5208
Game.particlesUpdate=function()
5209
{
5210
for (var i=0;i<Game.particlesN;i++)
5211
{
5212
var me=Game.particles[i];
5213
if (me.life!=-1)
5214
{
5215
if (!me.text) me.yd+=0.2+Math.random()*0.1;
5216
me.x+=me.xd;
5217
me.y+=me.yd;
5218
//me.y+=me.life*0.25+Math.random()*0.25;
5219
me.life++;
5220
if (me.life>=Game.fps*me.dur)
5221
{
5222
me.life=-1;
5223
}
5224
}
5225
}
5226
}
5227
Game.particleAdd=function(x,y,xd,yd,size,dur,z,pic,text)
5228
{
5229
//Game.particleAdd(pos X,pos Y,speed X,speed Y,size (multiplier),duration (seconds),layer,picture,text);
5230
//pick the first free (or the oldest) particle to replace it
5231
if (1 || Game.prefs.particles)
5232
{
5233
var highest=0;
5234
var highestI=0;
5235
for (var i=0;i<Game.particlesN;i++)
5236
{
5237
if (Game.particles[i].life==-1) {highestI=i;break;}
5238
if (Game.particles[i].life>highest)
5239
{
5240
highest=Game.particles[i].life;
5241
highestI=i;
5242
}
5243
}
5244
var auto=0;
5245
if (x) auto=1;
5246
var i=highestI;
5247
var x=x||-64;
5248
if (Game.LeftBackground && !auto) x=Math.floor(Math.random()*Game.LeftBackground.canvas.width);
5249
var y=y||-64;
5250
var me=Game.particles[i];
5251
me.life=0;
5252
me.x=x;
5253
me.y=y;
5254
me.xd=xd||0;
5255
me.yd=yd||0;
5256
me.size=size||1;
5257
me.z=z||0;
5258
me.dur=dur||2;
5259
me.r=Math.floor(Math.random()*360);
5260
me.picId=Math.floor(Math.random()*10000);
5261
if (!pic)
5262
{
5263
if (Game.season=='fools') pic='smallDollars.png';
5264
else
5265
{
5266
var cookies=[[10,0]];
5267
for (var i in Game.Upgrades)
5268
{
5269
var cookie=Game.Upgrades[i];
5270
if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);
5271
}
5272
me.picPos=choose(cookies);
5273
if (Game.bakeryName.toLowerCase()=='ortiel' || Math.random()<1/10000) me.picPos=[17,5];
5274
pic='icons.png';
5275
}
5276
}
5277
else if (pic!=='string'){me.picPos=pic;pic='icons.png';}
5278
me.pic=pic||'smallCookies.png';
5279
me.text=text||0;
5280
return me;
5281
}
5282
return {};
5283
}
5284
Game.particlesDraw=function(z)
5285
{
5286
var ctx=Game.LeftBackground;
5287
ctx.fillStyle='#fff';
5288
ctx.font='20px Merriweather';
5289
ctx.textAlign='center';
5290
5291
for (var i=0;i<Game.particlesN;i++)
5292
{
5293
var me=Game.particles[i];
5294
if (me.z==z)
5295
{
5296
if (me.life!=-1)
5297
{
5298
var opacity=1-(me.life/(Game.fps*me.dur));
5299
ctx.globalAlpha=opacity;
5300
if (me.text)
5301
{
5302
ctx.fillText(me.text,me.x,me.y);
5303
}
5304
else
5305
{
5306
ctx.save();
5307
ctx.translate(me.x,me.y);
5308
ctx.rotate((me.r/360)*Math.PI*2);
5309
var w=64;
5310
var h=64;
5311
if (me.pic=='icons.png')
5312
{
5313
w=48;
5314
h=48;
5315
ctx.drawImage(Pic(me.pic),me.picPos[0]*w,me.picPos[1]*h,w,h,-w/2*me.size,-h/2*me.size,w*me.size,h*me.size);
5316
}
5317
else
5318
{
5319
if (me.pic=='wrinklerBits.png' || me.pic=='shinyWrinklerBits.png') {w=100;h=200;}
5320
ctx.drawImage(Pic(me.pic),(me.picId%8)*w,0,w,h,-w/2*me.size,-h/2*me.size,w*me.size,h*me.size);
5321
}
5322
ctx.restore();
5323
}
5324
}
5325
}
5326
}
5327
}
5328
5329
//text particles (popups etc)
5330
Game.textParticles=[];
5331
Game.textParticlesY=0;
5332
var str='';
5333
for (var i=0;i<20;i++)
5334
{
5335
Game.textParticles[i]={x:0,y:0,life:-1,text:''};
5336
str+='<div id="particle'+i+'" class="particle title"></div>';
5337
}
5338
l('particles').innerHTML=str;
5339
Game.textParticlesUpdate=function()
5340
{
5341
for (var i in Game.textParticles)
5342
{
5343
var me=Game.textParticles[i];
5344
if (me.life!=-1)
5345
{
5346
me.life++;
5347
if (me.life>=Game.fps*4)
5348
{
5349
var el=me.l;
5350
me.life=-1;
5351
el.style.opacity=0;
5352
el.style.display='none';
5353
}
5354
}
5355
}
5356
}
5357
Game.textParticlesAdd=function(text,el,posX,posY)
5358
{
5359
//pick the first free (or the oldest) particle to replace it
5360
var highest=0;
5361
var highestI=0;
5362
for (var i in Game.textParticles)
5363
{
5364
if (Game.textParticles[i].life==-1) {highestI=i;break;}
5365
if (Game.textParticles[i].life>highest)
5366
{
5367
highest=Game.textParticles[i].life;
5368
highestI=i;
5369
}
5370
}
5371
var i=highestI;
5372
var noStack=0;
5373
if (typeof posX!=='undefined' && typeof posY!=='undefined')
5374
{
5375
x=posX;
5376
y=posY;
5377
noStack=1;
5378
}
5379
else
5380
{
5381
var x=(Math.random()-0.5)*40;
5382
var y=0;//+(Math.random()-0.5)*40;
5383
if (!el)
5384
{
5385
var rect=Game.bounds;
5386
var x=Math.floor((rect.left+rect.right)/2);
5387
var y=Math.floor((rect.bottom))-(Game.mobile*64);
5388
x+=(Math.random()-0.5)*40;
5389
y+=0;//(Math.random()-0.5)*40;
5390
}
5391
}
5392
if (!noStack) y-=Game.textParticlesY;
5393
5394
x=Math.max(Game.bounds.left+200,x);
5395
x=Math.min(Game.bounds.right-200,x);
5396
y=Math.max(Game.bounds.top+32,y);
5397
5398
var me=Game.textParticles[i];
5399
if (!me.l) me.l=l('particle'+i);
5400
me.life=0;
5401
me.x=x;
5402
me.y=y;
5403
me.text=text;
5404
me.l.innerHTML=text;
5405
me.l.style.left=Math.floor(Game.textParticles[i].x-200)+'px';
5406
me.l.style.bottom=Math.floor(-Game.textParticles[i].y)+'px';
5407
for (var ii in Game.textParticles)
5408
{if (ii!=i) (Game.textParticles[ii].l||l('particle'+ii)).style.zIndex=100000000;}
5409
me.l.style.zIndex=100000001;
5410
me.l.style.display='block';
5411
me.l.className='particle title';
5412
void me.l.offsetWidth;
5413
me.l.className='particle title risingUpLinger';
5414
if (!noStack) Game.textParticlesY+=60;
5415
}
5416
Game.popups=1;
5417
Game.Popup=function(text,x,y)
5418
{
5419
if (Game.popups) Game.textParticlesAdd(text,0,x,y);
5420
}
5421
5422
//display sparkles at a set position
5423
Game.sparkles=l('sparkles');
5424
Game.sparklesT=0;
5425
Game.sparklesFrames=16;
5426
Game.SparkleAt=function(x,y)
5427
{
5428
if (Game.blendModesOn)
5429
{
5430
Game.sparklesT=Game.sparklesFrames+1;
5431
Game.sparkles.style.backgroundPosition='0px 0px';
5432
Game.sparkles.style.left=Math.floor(x-64)+'px';
5433
Game.sparkles.style.top=Math.floor(y-64)+'px';
5434
Game.sparkles.style.display='block';
5435
}
5436
}
5437
Game.SparkleOn=function(el)
5438
{
5439
var rect=el.getBoundingClientRect();
5440
Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);
5441
}
5442
5443
/*=====================================================================================
5444
NOTIFICATIONS
5445
=======================================================================================*/
5446
//maybe do all this mess with proper DOM instead of rewriting the innerHTML
5447
Game.Notes=[];
5448
Game.NotesById=[];
5449
Game.noteId=0;
5450
Game.noteL=l('notes');
5451
Game.Note=function(title,desc,pic,quick)
5452
{
5453
this.title=title;
5454
this.desc=desc||'';
5455
this.pic=pic||'';
5456
this.id=Game.noteId;
5457
this.date=Date.now();
5458
this.quick=quick||0;
5459
this.life=(this.quick||1)*Game.fps;
5460
this.l=0;
5461
this.height=0;
5462
Game.noteId++;
5463
Game.NotesById[this.id]=this;
5464
Game.Notes.unshift(this);
5465
if (Game.Notes.length>50) Game.Notes.pop();
5466
//Game.Notes.push(this);
5467
//if (Game.Notes.length>50) Game.Notes.shift();
5468
Game.UpdateNotes();
5469
}
5470
Game.CloseNote=function(id)
5471
{
5472
var me=Game.NotesById[id];
5473
Game.Notes.splice(Game.Notes.indexOf(me),1);
5474
//Game.NotesById.splice(Game.NotesById.indexOf(me),1);
5475
Game.NotesById[id]=null;
5476
Game.UpdateNotes();
5477
}
5478
Game.CloseNotes=function()
5479
{
5480
Game.Notes=[];
5481
Game.NotesById=[];
5482
Game.UpdateNotes();
5483
}
5484
Game.UpdateNotes=function()
5485
{
5486
var str='';
5487
var remaining=Game.Notes.length;
5488
for (var i in Game.Notes)
5489
{
5490
if (i<5)
5491
{
5492
var me=Game.Notes[i];
5493
var pic='';
5494
if (me.pic!='') pic='<div class="icon" style="'+(me.pic[2]?'background-image:url('+me.pic[2]+');':'')+'background-position:'+(-me.pic[0]*48)+'px '+(-me.pic[1]*48)+'px;"></div>';
5495
str='<div id="note-'+me.id+'" class="framed note '+(me.pic!=''?'haspic':'nopic')+' '+(me.desc!=''?'hasdesc':'nodesc')+'"><div class="close" onclick="PlaySound(\'snd/tick.mp3\');Game.CloseNote('+me.id+');">x</div>'+pic+'<div class="text"><h3>'+me.title+'</h3>'+(me.desc!=''?'<div class="line"></div><h5>'+me.desc+'</h5>':'')+'</div></div>'+str;
5496
remaining--;
5497
}
5498
}
5499
if (remaining>0) str='<div class="remaining">+'+remaining+' more notification'+(remaining==1?'':'s')+'.</div>'+str;
5500
if (Game.Notes.length>1)
5501
{
5502
str+='<div class="framed close sidenote" onclick="PlaySound(\'snd/tick.mp3\');Game.CloseNotes();">x</div>';
5503
}
5504
Game.noteL.innerHTML=str;
5505
for (var i in Game.Notes)
5506
{
5507
me.l=0;
5508
if (i<5)
5509
{
5510
var me=Game.Notes[i];
5511
me.l=l('note-'+me.id);
5512
}
5513
}
5514
}
5515
Game.NotesLogic=function()
5516
{
5517
for (var i in Game.Notes)
5518
{
5519
if (Game.Notes[i].quick>0)
5520
{
5521
var me=Game.Notes[i];
5522
me.life--;
5523
if (me.life<=0) Game.CloseNote(me.id);
5524
}
5525
}
5526
}
5527
Game.NotesDraw=function()
5528
{
5529
for (var i in Game.Notes)
5530
{
5531
if (Game.Notes[i].quick>0)
5532
{
5533
var me=Game.Notes[i];
5534
if (me.l)
5535
{
5536
if (me.life<10)
5537
{
5538
me.l.style.opacity=(me.life/10);
5539
}
5540
}
5541
}
5542
}
5543
}
5544
Game.Notify=function(title,desc,pic,quick,noLog)
5545
{
5546
if (Game.prefs.notifs)
5547
{
5548
quick=Math.min(6,quick);
5549
if (!quick) quick=6;
5550
}
5551
desc=replaceAll('==CLOSETHIS()==','Game.CloseNote('+Game.noteId+');',desc);
5552
if (Game.popups) new Game.Note(title,desc,pic,quick);
5553
if (!noLog) Game.AddToLog('<b>'+title+'</b> | '+desc);
5554
}
5555
5556
5557
/*=====================================================================================
5558
PROMPT
5559
=======================================================================================*/
5560
Game.darkenL=l('darken');
5561
AddEvent(Game.darkenL,'click',function(){Game.Click=0;Game.ClosePrompt();});
5562
Game.promptL=l('promptContent');
5563
Game.promptAnchorL=l('promptAnchor');
5564
Game.promptWrapL=l('prompt');
5565
Game.promptConfirm='';
5566
Game.promptOn=0;
5567
Game.promptUpdateFunc=0;
5568
Game.UpdatePrompt=function()
5569
{
5570
if (Game.promptUpdateFunc) Game.promptUpdateFunc();
5571
Game.promptAnchorL.style.top=Math.floor((Game.windowH-Game.promptWrapL.offsetHeight)/2-16)+'px';
5572
}
5573
Game.Prompt=function(content,options,updateFunc,style)
5574
{
5575
if (updateFunc) Game.promptUpdateFunc=updateFunc;
5576
if (style) Game.promptWrapL.className='framed '+style; else Game.promptWrapL.className='framed';
5577
var str='';
5578
str+=content;
5579
var opts='';
5580
for (var i in options)
5581
{
5582
if (options[i]=='br')//just a linebreak
5583
{opts+='<br>';}
5584
else
5585
{
5586
if (typeof options[i]=='string') options[i]=[options[i],'Game.ClosePrompt();'];
5587
options[i][1]=options[i][1].replace(/'/g,'&#39;').replace(/"/g,'&#34;');
5588
opts+='<a id="promptOption'+i+'" class="option" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');'+options[i][1]+'">'+options[i][0]+'</a>';
5589
}
5590
}
5591
Game.promptL.innerHTML=str+'<div class="optionBox">'+opts+'</div>';
5592
Game.promptAnchorL.style.display='block';
5593
Game.darkenL.style.display='block';
5594
Game.promptL.focus();
5595
Game.promptOn=1;
5596
Game.UpdatePrompt();
5597
}
5598
Game.ClosePrompt=function()
5599
{
5600
Game.promptAnchorL.style.display='none';
5601
Game.darkenL.style.display='none';
5602
Game.promptOn=0;
5603
Game.promptUpdateFunc=0;
5604
}
5605
Game.ConfirmPrompt=function()
5606
{
5607
if (Game.promptOn && l('promptOption0') && l('promptOption0').style.display!='none') FireEvent(l('promptOption0'),'click');
5608
}
5609
5610
/*=====================================================================================
5611
MENUS
5612
=======================================================================================*/
5613
Game.cssClasses=[];
5614
Game.addClass=function(what) {if (Game.cssClasses.indexOf(what)==-1) Game.cssClasses.push(what);Game.updateClasses();}
5615
Game.removeClass=function(what) {var i=Game.cssClasses.indexOf(what);if(i!=-1) {Game.cssClasses.splice(i,1);}Game.updateClasses();}
5616
Game.updateClasses=function() {Game.l.className=Game.cssClasses.join(' ');}
5617
5618
Game.WriteButton=function(prefName,button,on,off,callback,invert)
5619
{
5620
var invert=invert?1:0;
5621
if (!callback) callback='';
5622
callback+='PlaySound(\'snd/tick.mp3\');';
5623
return '<a class="option'+((Game.prefs[prefName]^invert)?'':' off')+'" id="'+button+'" '+Game.clickStr+'="Game.Toggle(\''+prefName+'\',\''+button+'\',\''+on+'\',\''+off+'\',\''+invert+'\');'+callback+'">'+(Game.prefs[prefName]?on:off)+'</a>';
5624
}
5625
Game.Toggle=function(prefName,button,on,off,invert)
5626
{
5627
if (Game.prefs[prefName])
5628
{
5629
l(button).innerHTML=off;
5630
Game.prefs[prefName]=0;
5631
}
5632
else
5633
{
5634
l(button).innerHTML=on;
5635
Game.prefs[prefName]=1;
5636
}
5637
l(button).className='option'+((Game.prefs[prefName]^invert)?'':' off');
5638
5639
}
5640
Game.ToggleFancy=function()
5641
{
5642
if (Game.prefs.fancy) Game.removeClass('noFancy');
5643
else if (!Game.prefs.fancy) Game.addClass('noFancy');
5644
}
5645
Game.ToggleFilters=function()
5646
{
5647
if (Game.prefs.filters) Game.removeClass('noFilters');
5648
else if (!Game.prefs.filters) Game.addClass('noFilters');
5649
}
5650
Game.ToggleExtraButtons=function()
5651
{
5652
if (!Game.prefs.extraButtons) Game.removeClass('extraButtons');
5653
else if (Game.prefs.extraButtons) Game.addClass('extraButtons');
5654
for (var i in Game.Objects)
5655
{
5656
Game.Objects[i].mute(0);
5657
}
5658
}
5659
5660
Game.WriteSlider=function(slider,leftText,rightText,startValueFunction,callback)
5661
{
5662
if (!callback) callback='';
5663
return '<div class="sliderBox"><div style="float:left;">'+leftText+'</div><div style="float:right;" id="'+slider+'RightText">'+rightText.replace('[$]',startValueFunction())+'</div><input class="slider" style="clear:both;" type="range" min="0" max="100" step="1" value="'+startValueFunction()+'" onchange="'+callback+'" oninput="'+callback+'" onmouseup="PlaySound(\'snd/tick.mp3\');" id="'+slider+'"/></div>';
5664
}
5665
5666
Game.onPanel='Left';
5667
Game.addClass('focus'+Game.onPanel);
5668
Game.ShowPanel=function(what)
5669
{
5670
if (!what) what='';
5671
if (Game.onPanel!=what)
5672
{
5673
Game.removeClass('focus'+Game.onPanel);
5674
Game.addClass('focus'+what);
5675
}
5676
Game.onPanel=what;
5677
}
5678
5679
Game.onMenu='';
5680
Game.ShowMenu=function(what)
5681
{
5682
if (!what || what=='') what=Game.onMenu;
5683
if (Game.onMenu=='' && what!='') Game.addClass('onMenu');
5684
else if (Game.onMenu!='' && what!=Game.onMenu) Game.addClass('onMenu');
5685
else if (what==Game.onMenu) {Game.removeClass('onMenu');what='';}
5686
//if (what=='log') l('donateBox').className='on'; else l('donateBox').className='';
5687
Game.onMenu=what;
5688
5689
l('prefsButton').className=(Game.onMenu=='prefs')?'button selected':'button';
5690
l('statsButton').className=(Game.onMenu=='stats')?'button selected':'button';
5691
l('logButton').className=(Game.onMenu=='log')?'button selected':'button';
5692
5693
if (Game.onMenu=='') PlaySound('snd/clickOff.mp3');
5694
else PlaySound('snd/clickOn.mp3');
5695
5696
Game.UpdateMenu();
5697
5698
if (what=='')
5699
{
5700
for (var i in Game.Objects)
5701
{
5702
var me=Game.Objects[i];
5703
if (me.minigame && me.minigame.onResize) me.minigame.onResize();
5704
}
5705
}
5706
}
5707
Game.sayTime=function(time,detail)
5708
{
5709
//time is a value where one second is equal to Game.fps (30).
5710
//detail skips days when >1, hours when >2, minutes when >3 and seconds when >4.
5711
//if detail is -1, output something like "3 hours, 9 minutes, 48 seconds"
5712
if (time<=0) return '';
5713
var str='';
5714
var detail=detail||0;
5715
time=Math.floor(time);
5716
if (detail==-1)
5717
{
5718
//var months=0;
5719
var days=0;
5720
var hours=0;
5721
var minutes=0;
5722
var seconds=0;
5723
//if (time>=Game.fps*60*60*24*30) months=(Math.floor(time/(Game.fps*60*60*24*30)));
5724
if (time>=Game.fps*60*60*24) days=(Math.floor(time/(Game.fps*60*60*24)));
5725
if (time>=Game.fps*60*60) hours=(Math.floor(time/(Game.fps*60*60)));
5726
if (time>=Game.fps*60) minutes=(Math.floor(time/(Game.fps*60)));
5727
if (time>=Game.fps) seconds=(Math.floor(time/(Game.fps)));
5728
//days-=months*30;
5729
hours-=days*24;
5730
minutes-=hours*60+days*24*60;
5731
seconds-=minutes*60+hours*60*60+days*24*60*60;
5732
if (days>10) {hours=0;}
5733
if (days) {minutes=0;seconds=0;}
5734
if (hours) {seconds=0;}
5735
var bits=[];
5736
//if (months>0) bits.push(Beautify(months)+' month'+(days==1?'':'s'));
5737
if (days>0) bits.push(Beautify(days)+' day'+(days==1?'':'s'));
5738
if (hours>0) bits.push(Beautify(hours)+' hour'+(hours==1?'':'s'));
5739
if (minutes>0) bits.push(Beautify(minutes)+' minute'+(minutes==1?'':'s'));
5740
if (seconds>0) bits.push(Beautify(seconds)+' second'+(seconds==1?'':'s'));
5741
if (bits.length==0) str='less than 1 second';
5742
else str=bits.join(', ');
5743
}
5744
else
5745
{
5746
/*if (time>=Game.fps*60*60*24*30*2 && detail<1) str=Beautify(Math.floor(time/(Game.fps*60*60*24*30)))+' months';
5747
else if (time>=Game.fps*60*60*24*30 && detail<1) str='1 month';
5748
else */if (time>=Game.fps*60*60*24*2 && detail<2) str=Beautify(Math.floor(time/(Game.fps*60*60*24)))+' days';
5749
else if (time>=Game.fps*60*60*24 && detail<2) str='1 day';
5750
else if (time>=Game.fps*60*60*2 && detail<3) str=Beautify(Math.floor(time/(Game.fps*60*60)))+' hours';
5751
else if (time>=Game.fps*60*60 && detail<3) str='1 hour';
5752
else if (time>=Game.fps*60*2 && detail<4) str=Beautify(Math.floor(time/(Game.fps*60)))+' minutes';
5753
else if (time>=Game.fps*60 && detail<4) str='1 minute';
5754
else if (time>=Game.fps*2 && detail<5) str=Beautify(Math.floor(time/(Game.fps)))+' seconds';
5755
else if (time>=Game.fps && detail<5) str='1 second';
5756
else str='less than 1 second';
5757
}
5758
return str;
5759
}
5760
5761
Game.tinyCookie=function()
5762
{
5763
if (!Game.HasAchiev('Tiny cookie'))
5764
{
5765
return '<div class="tinyCookie" '+Game.clickStr+'="Game.ClickTinyCookie();"></div>';
5766
}
5767
return '';
5768
}
5769
Game.ClickTinyCookie=function(){if (!Game.HasAchiev('Tiny cookie')){PlaySound('snd/tick.mp3');Game.Win('Tiny cookie');}}
5770
5771
Game.setVolume=function(what)
5772
{
5773
Game.volume=what;
5774
/*for (var i in Sounds)
5775
{
5776
Sounds[i].volume=Game.volume;
5777
}*/
5778
}
5779
5780
Game.UpdateMenu=function()
5781
{
5782
var str='';
5783
if (Game.onMenu!='')
5784
{
5785
str+='<div class="close menuClose" '+Game.clickStr+'="Game.ShowMenu();">x</div>';
5786
//str+='<div style="position:absolute;top:8px;right:8px;cursor:pointer;font-size:16px;" '+Game.clickStr+'="Game.ShowMenu();">X</div>';
5787
}
5788
if (Game.onMenu=='prefs')
5789
{
5790
str+='<div class="section">Options</div>'+
5791
'<div class="subsection">'+
5792
'<div class="title">General</div>'+
5793
'<div class="listing"><a class="option" '+Game.clickStr+'="Game.toSave=true;PlaySound(\'snd/tick.mp3\');">Save</a><label>Save manually (the game autosaves every 60 seconds; shortcut : ctrl+S)</label></div>'+
5794
'<div class="listing"><a class="option" '+Game.clickStr+'="Game.ExportSave();PlaySound(\'snd/tick.mp3\');">Export save</a><a class="option" '+Game.clickStr+'="Game.ImportSave();PlaySound(\'snd/tick.mp3\');">Import save</a><label>You can use this to backup your save or to transfer it to another computer (shortcut for import : ctrl+O)</label></div>'+
5795
'<div class="listing"><a class="option" '+Game.clickStr+'="Game.FileSave();PlaySound(\'snd/tick.mp3\');">Save to file</a><a class="option" style="position:relative;"><input id="FileLoadInput" type="file" style="cursor:pointer;opacity:0;position:absolute;left:0px;top:0px;width:100%;height:100%;" onchange="Game.FileLoad(event);" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');"/>Load from file</a><label>Use this to keep backups on your computer</label></div>'+
5796
5797
'<div class="listing"><a class="option warning" '+Game.clickStr+'="Game.HardReset();PlaySound(\'snd/tick.mp3\');">Wipe save</a><label>Delete all your progress, including your achievements</label></div>'+
5798
'<div class="title">Settings</div>'+
5799
'<div class="listing">'+
5800
Game.WriteSlider('volumeSlider','Volume','[$]%',function(){return Game.volume;},'Game.setVolume(Math.round(l(\'volumeSlider\').value));l(\'volumeSliderRightText\').innerHTML=Game.volume+\'%\';')+'<br>'+
5801
Game.WriteButton('fancy','fancyButton','Fancy graphics ON','Fancy graphics OFF','Game.ToggleFancy();')+'<label>(visual improvements; disabling may improve performance)</label><br>'+
5802
Game.WriteButton('filters','filtersButton','CSS filters ON','CSS filters OFF','Game.ToggleFilters();')+'<label>(cutting-edge visual improvements; disabling may improve performance)</label><br>'+
5803
Game.WriteButton('particles','particlesButton','Particles ON','Particles OFF')+'<label>(cookies falling down, etc; disabling may improve performance)</label><br>'+
5804
Game.WriteButton('numbers','numbersButton','Numbers ON','Numbers OFF')+'<label>(numbers that pop up when clicking the cookie)</label><br>'+
5805
Game.WriteButton('milk','milkButton','Milk ON','Milk OFF')+'<label>(only appears with enough achievements)</label><br>'+
5806
Game.WriteButton('cursors','cursorsButton','Cursors ON','Cursors OFF')+'<label>(visual display of your cursors)</label><br>'+
5807
Game.WriteButton('wobbly','wobblyButton','Wobbly cookie ON','Wobbly cookie OFF')+'<label>(your cookie will react when you click it)</label><br>'+
5808
Game.WriteButton('cookiesound','cookiesoundButton','Alt cookie sound ON','Alt cookie sound OFF')+'<label>(how your cookie sounds when you click on it)</label><br>'+
5809
Game.WriteButton('crates','cratesButton','Icon crates ON','Icon crates OFF')+'<label>(display boxes around upgrades and achievements in stats)</label><br>'+
5810
Game.WriteButton('monospace','monospaceButton','Alt font ON','Alt font OFF')+'<label>(your cookies are displayed using a monospace font)</label><br>'+
5811
Game.WriteButton('format','formatButton','Short numbers OFF','Short numbers ON','BeautifyAll();Game.RefreshStore();Game.upgradesToRebuild=1;',1)+'<label>(shorten big numbers)</label><br>'+
5812
Game.WriteButton('notifs','notifsButton','Fast notes ON','Fast notes OFF')+'<label>(notifications disappear much faster)</label><br>'+
5813
//Game.WriteButton('autoupdate','autoupdateButton','Offline mode OFF','Offline mode ON',0,1)+'<label>(disables update notifications)</label><br>'+
5814
Game.WriteButton('warn','warnButton','Closing warning ON','Closing warning OFF')+'<label>(the game will ask you to confirm when you close the window)</label><br>'+
5815
Game.WriteButton('focus','focusButton','Defocus OFF','Defocus ON',0,1)+'<label>(the game will be less resource-intensive when out of focus)</label><br>'+
5816
Game.WriteButton('extraButtons','extraButtonsButton','Extra buttons ON','Extra buttons OFF','Game.ToggleExtraButtons();')+'<label>(add Mute buttons on buildings)</label><br>'+
5817
Game.WriteButton('askLumps','askLumpsButton','Lump confirmation ON','Lump confirmation OFF')+'<label>(the game will ask you to confirm before spending sugar lumps)</label><br>'+
5818
Game.WriteButton('customGrandmas','customGrandmasButton','Custom grandmas ON','Custom grandmas OFF')+'<label>(some grandmas will be named after Patreon supporters)</label><br>'+
5819
Game.WriteButton('timeout','timeoutButton','Sleep mode timeout ON','Sleep mode timeout OFF')+'<label>(on slower computers, the game will put itself in sleep mode when it\'s inactive and starts to lag out; offline CpS production kicks in during sleep mode)</label><br>'+
5820
'</div>'+
5821
//'<div class="listing">'+Game.WriteButton('autosave','autosaveButton','Autosave ON','Autosave OFF')+'</div>'+
5822
'<div class="listing"><a class="option" '+Game.clickStr+'="Game.CheckModData();PlaySound(\'snd/tick.mp3\');">Check mod data</a><label>(view and delete save data created by mods)</label></div>'+
5823
5824
'<div style="padding-bottom:128px;"></div>'+
5825
'</div>'
5826
;
5827
}
5828
else if (Game.onMenu=='main')
5829
{
5830
str+=
5831
'<div class="listing">This isn\'t really finished</div>'+
5832
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'prefs\');">Menu</a></div>'+
5833
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'stats\');">Stats</a></div>'+
5834
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'log\');">Updates</a></div>'+
5835
'<div class="listing"><a class="option big title" '+Game.clickStr+'="">Quit</a></div>'+
5836
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(Game.onMenu);">Resume</a></div>';
5837
}
5838
else if (Game.onMenu=='log')
5839
{
5840
str+=replaceAll('[bakeryName]',Game.bakeryName,Game.updateLog);
5841
if (!Game.HasAchiev('Olden days')) str+='<div style="text-align:right;width:100%;"><div '+Game.clickStr+'="Game.SparkleAt(Game.mouseX,Game.mouseY);PlaySound(\'snd/tick.mp3\');PlaySound(\'snd/shimmerClick.mp3\');Game.Win(\'Olden days\');Game.UpdateMenu();" class="icon" style="display:inline-block;transform:scale(0.5);cursor:pointer;width:48px;height:48px;background-position:'+(-12*48)+'px '+(-3*48)+'px;"></div></div>';
5842
}
5843
else if (Game.onMenu=='stats')
5844
{
5845
var buildingsOwned=0;
5846
buildingsOwned=Game.BuildingsOwned;
5847
var upgrades='';
5848
var cookieUpgrades='';
5849
var hiddenUpgrades='';
5850
var prestigeUpgrades='';
5851
var upgradesTotal=0;
5852
var upgradesOwned=0;
5853
var prestigeUpgradesTotal=0;
5854
var prestigeUpgradesOwned=0;
5855
5856
var list=[];
5857
//sort the upgrades
5858
for (var i in Game.Upgrades){list.push(Game.Upgrades[i]);}//clone first
5859
var sortMap=function(a,b)
5860
{
5861
if (a.order>b.order) return 1;
5862
else if (a.order<b.order) return -1;
5863
else return 0;
5864
}
5865
list.sort(sortMap);
5866
for (var i in list)
5867
{
5868
var str2='';
5869
var me=list[i];
5870
5871
str2+=Game.crate(me,'stats');
5872
5873
if (me.bought)
5874
{
5875
if (Game.CountsAsUpgradeOwned(me.pool)) upgradesOwned++;
5876
else if (me.pool=='prestige') prestigeUpgradesOwned++;
5877
}
5878
5879
if (me.pool=='' || me.pool=='cookie' || me.pool=='tech') upgradesTotal++;
5880
if (me.pool=='debug') hiddenUpgrades+=str2;
5881
else if (me.pool=='prestige') {prestigeUpgrades+=str2;prestigeUpgradesTotal++;}
5882
else if (me.pool=='cookie') cookieUpgrades+=str2;
5883
else if (me.pool!='toggle' && me.pool!='unused') upgrades+=str2;
5884
}
5885
var achievements=[];
5886
var achievementsOwned=0;
5887
var achievementsOwnedOther=0;
5888
var achievementsTotal=0;
5889
5890
var list=[];
5891
for (var i in Game.Achievements)//sort the achievements
5892
{
5893
list.push(Game.Achievements[i]);
5894
}
5895
var sortMap=function(a,b)
5896
{
5897
if (a.order>b.order) return 1;
5898
else if (a.order<b.order) return -1;
5899
else return 0;
5900
}
5901
list.sort(sortMap);
5902
5903
5904
for (var i in list)
5905
{
5906
var me=list[i];
5907
//if (me.pool=='normal' || me.won>0) achievementsTotal++;
5908
if (Game.CountsAsAchievementOwned(me.pool)) achievementsTotal++;
5909
var pool=me.pool;
5910
if (!achievements[pool]) achievements[pool]='';
5911
achievements[pool]+=Game.crate(me,'stats');
5912
5913
if (me.won)
5914
{
5915
if (Game.CountsAsAchievementOwned(me.pool)) achievementsOwned++;
5916
else achievementsOwnedOther++;
5917
}
5918
}
5919
5920
var achievementsStr='';
5921
var pools={
5922
'dungeon':'<b>Dungeon achievements</b> <small>(Not technically achievable yet.)</small>',
5923
'shadow':'<b>Shadow achievements</b> <small>(These are feats that are either unfair or difficult to attain. They do not give milk.)</small>'
5924
};
5925
for (var i in achievements)
5926
{
5927
if (achievements[i]!='')
5928
{
5929
if (pools[i]) achievementsStr+='<div class="listing">'+pools[i]+'</div>';
5930
achievementsStr+='<div class="listing crateBox">'+achievements[i]+'</div>';
5931
}
5932
}
5933
5934
var milkStr='';
5935
for (var i=0;i<Game.Milks.length;i++)
5936
{
5937
if (Game.milkProgress>=i)
5938
{
5939
var milk=Game.Milks[i];
5940
milkStr+='<div '+Game.getTooltip(
5941
'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px;padding-bottom:96px;"><h3 style="margin:6px 32px 0px 32px;">'+milk.name+'</h3><div style="opacity:0.75;font-size:9px;">('+(i==0?'starter milk':('for '+Beautify(i*25)+' achievements'))+')</div><div class="line"></div><div style="width:100%;height:96px;position:absolute;left:0px;bottom:0px;background:url(img/'+milk.pic+'.png);"></div></div>'
5942
,'top')+' style="background:url(img/icons.png?v='+Game.version+') '+(-milk.icon[0]*48)+'px '+(-milk.icon[1]*48)+'px;margin:2px 0px;" class="trophy"></div>';
5943
}
5944
}
5945
milkStr+='<div style="clear:both;"></div>';
5946
5947
var santaStr='';
5948
var frames=15;
5949
if (Game.Has('A festive hat'))
5950
{
5951
for (var i=0;i<=Game.santaLevel;i++)
5952
{
5953
santaStr+='<div '+Game.getTooltip(
5954
'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px 32px;"><div style="width:96px;height:96px;margin:4px auto;background:url(img/santa.png) '+(-i*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div><div class="line"></div><h3>'+Game.santaLevels[i]+'</h3></div>'
5955
,'top')+' style="background:url(img/santa.png) '+(-i*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';
5956
}
5957
santaStr+='<div style="clear:both;"></div>';
5958
}
5959
var dragonStr='';
5960
var frames=9;
5961
var mainLevels=[0,4,8,23,24,25];
5962
if (Game.Has('A crumbly egg'))
5963
{
5964
for (var i=0;i<=mainLevels.length;i++)
5965
{
5966
if (Game.dragonLevel>=mainLevels[i])
5967
{
5968
var level=Game.dragonLevels[mainLevels[i]];
5969
dragonStr+='<div '+Game.getTooltip(
5970
//'<div style="width:96px;height:96px;margin:4px auto;background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*96)+'px 0px;"></div><div class="line"></div><div style="min-width:200px;text-align:center;margin-bottom:6px;">'+level.name+'</div>'
5971
'<div class="prompt" style="text-align:center;padding-bottom:6px;white-space:nowrap;margin:0px 32px;"><div style="width:96px;height:96px;margin:4px auto;background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div><div class="line"></div><h3>'+level.name+'</h3></div>'
5972
,'top')+' style="background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';
5973
}
5974
}
5975
dragonStr+='<div style="clear:both;"></div>';
5976
}
5977
var ascensionModeStr='';
5978
var icon=Game.ascensionModes[Game.ascensionMode].icon;
5979
if (Game.resets>0) ascensionModeStr='<span style="cursor:pointer;" '+Game.getTooltip(
5980
'<div style="min-width:200px;text-align:center;font-size:11px;">'+Game.ascensionModes[Game.ascensionMode].desc+'</div>'
5981
,'top')+'><div class="icon" style="display:inline-block;float:none;transform:scale(0.5);margin:-24px -16px -19px -8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>'+Game.ascensionModes[Game.ascensionMode].name+'</span>';
5982
5983
var milkName=Game.Milk.name;
5984
5985
var researchStr=Game.sayTime(Game.researchT,-1);
5986
var pledgeStr=Game.sayTime(Game.pledgeT,-1);
5987
var wrathStr='';
5988
if (Game.elderWrath==1) wrathStr='awoken';
5989
else if (Game.elderWrath==2) wrathStr='displeased';
5990
else if (Game.elderWrath==3) wrathStr='angered';
5991
else if (Game.elderWrath==0 && Game.pledges>0) wrathStr='appeased';
5992
5993
var date=new Date();
5994
date.setTime(Date.now()-Game.startDate);
5995
var timeInSeconds=date.getTime()/1000;
5996
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
5997
date.setTime(Date.now()-Game.fullDate);
5998
var fullDate=Game.sayTime(date.getTime()/1000*Game.fps,-1);
5999
if (!Game.fullDate || !fullDate || fullDate.length<1) fullDate='a long while';
6000
/*date.setTime(new Date().getTime()-Game.lastDate);
6001
var lastDate=Game.sayTime(date.getTime()/1000*Game.fps,2);*/
6002
6003
var heavenlyMult=Game.GetHeavenlyMultiplier();
6004
6005
var seasonStr=Game.sayTime(Game.seasonT,-1);
6006
6007
str+='<div class="section">Statistics</div>'+
6008
'<div class="subsection">'+
6009
'<div class="title">General</div>'+
6010
'<div class="listing"><b>Cookies in bank :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookies)+'</div></div>'+
6011
'<div class="listing"><b>Cookies baked (this ascension) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned)+'</div></div>'+
6012
'<div class="listing"><b>Cookies baked (all time) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned+Game.cookiesReset)+'</div></div>'+
6013
(Game.cookiesReset>0?'<div class="listing"><b>Cookies forfeited by ascending :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesReset)+'</div></div>':'')+
6014
(Game.resets?('<div class="listing"><b>Legacy started :</b> '+(fullDate==''?'just now':(fullDate+' ago'))+', with '+Beautify(Game.resets)+' ascension'+(Game.resets==1?'':'s')+'</div>'):'')+
6015
'<div class="listing"><b>Run started :</b> '+(startDate==''?'just now':(startDate+' ago'))+'</div>'+
6016
'<div class="listing"><b>Buildings owned :</b> '+Beautify(buildingsOwned)+'</div>'+
6017
'<div class="listing"><b>Cookies per second :</b> '+Beautify(Game.cookiesPs,1)+' <small>'+
6018
'(multiplier : '+Beautify(Math.round(Game.globalCpsMult*100),1)+'%)'+
6019
(Game.cpsSucked>0?' <span class="warning">(withered : '+Beautify(Math.round(Game.cpsSucked*100),1)+'%)</span>':'')+
6020
'</small></div>'+
6021
'<div class="listing"><b>Raw cookies per second :</b> '+Beautify(Game.cookiesPsRaw,1)+' <small>'+
6022
'(highest this ascension : '+Beautify(Game.cookiesPsRawHighest,1)+')'+
6023
'</small></div>'+
6024
'<div class="listing"><b>Cookies per click :</b> '+Beautify(Game.computedMouseCps,1)+'</div>'+
6025
'<div class="listing"><b>Cookie clicks :</b> '+Beautify(Game.cookieClicks)+'</div>'+
6026
'<div class="listing"><b>Hand-made cookies :</b> '+Beautify(Game.handmadeCookies)+'</div>'+
6027
'<div class="listing"><b>Golden cookie clicks :</b> '+Beautify(Game.goldenClicksLocal)+' <small>(all time : '+Beautify(Game.goldenClicks)+')</small></div>'+//' <span class="hidden">(<b>Missed golden cookies :</b> '+Beautify(Game.missedGoldenClicks)+')</span></div>'+
6028
'<br><div class="listing"><b>Running version :</b> '+Game.version+'</div>'+
6029
6030
((researchStr!='' || wrathStr!='' || pledgeStr!='' || santaStr!='' || dragonStr!='' || Game.season!='' || ascensionModeStr!='' || Game.canLumps())?(
6031
'</div><div class="subsection">'+
6032
'<div class="title">Special</div>'+
6033
(ascensionModeStr!=''?'<div class="listing"><b>Challenge mode :</b>'+ascensionModeStr+'</div>':'')+
6034
(Game.season!=''?'<div class="listing"><b>Seasonal event :</b> '+Game.seasons[Game.season].name+
6035
(seasonStr!=''?' <small>('+seasonStr+' remaining)</small>':'')+
6036
'</div>':'')+
6037
(Game.season=='fools'?
6038
'<div class="listing"><b>Money made from selling cookies :</b> '+Beautify(Game.cookiesEarned*0.08,2)+' cookie dollars</div>'+
6039
(Game.Objects['Portal'].highest>0?'<div class="listing"><b>TV show seasons produced :</b> '+Beautify(Math.floor((timeInSeconds/60/60)*(Game.Objects['Portal'].highest*0.13)+1))+'</div>':'')
6040
:'')+
6041
(researchStr!=''?'<div class="listing"><b>Research :</b> '+researchStr+' remaining</div>':'')+
6042
(wrathStr!=''?'<div class="listing"><b>Grandmatriarchs status :</b> '+wrathStr+'</div>':'')+
6043
(pledgeStr!=''?'<div class="listing"><b>Pledge :</b> '+pledgeStr+' remaining</div>':'')+
6044
(Game.wrinklersPopped>0?'<div class="listing"><b>Wrinklers popped :</b> '+Beautify(Game.wrinklersPopped)+'</div>':'')+
6045
((Game.canLumps() && Game.lumpsTotal>-1)?'<div class="listing"><b>Sugar lumps harvested :</b> <div class="price lump plain">'+Beautify(Game.lumpsTotal)+'</div></div>':'')+
6046
//(Game.cookiesSucked>0?'<div class="listing warning"><b>Withered :</b> '+Beautify(Game.cookiesSucked)+' cookies</div>':'')+
6047
(Game.reindeerClicked>0?'<div class="listing"><b>Reindeer found :</b> '+Beautify(Game.reindeerClicked)+'</div>':'')+
6048
(santaStr!=''?'<div class="listing"><b>Santa stages unlocked :</b></div><div>'+santaStr+'</div>':'')+
6049
(dragonStr!=''?'<div class="listing"><b>Dragon training :</b></div><div>'+dragonStr+'</div>':'')+
6050
''
6051
):'')+
6052
((Game.prestige>0 || prestigeUpgrades!='')?(
6053
'</div><div class="subsection">'+
6054
'<div class="title">Prestige</div>'+
6055
'<div class="listing"><div class="icon" style="float:left;background-position:'+(-19*48)+'px '+(-7*48)+'px;"></div>'+
6056
'<div style="margin-top:8px;"><span class="title" style="font-size:22px;">Prestige level : '+Beautify(Game.prestige)+'</span> at '+Beautify(heavenlyMult*100,1)+'% of its potential <b>(+'+Beautify(parseFloat(Game.prestige)*Game.heavenlyPower*heavenlyMult,1)+'% CpS)</b><br>Heavenly chips : <b>'+Beautify(Game.heavenlyChips)+'</b></div>'+
6057
'</div>'+
6058
(prestigeUpgrades!=''?(
6059
'<div class="listing" style="clear:left;"><b>Prestige upgrades unlocked :</b> '+prestigeUpgradesOwned+'/'+prestigeUpgradesTotal+' ('+Math.floor((prestigeUpgradesOwned/prestigeUpgradesTotal)*100)+'%)</div>'+
6060
'<div class="listing crateBox">'+prestigeUpgrades+'</div>'):'')+
6061
''):'')+
6062
6063
'</div><div class="subsection">'+
6064
'<div class="title">Upgrades</div>'+
6065
(hiddenUpgrades!=''?('<div class="listing"><b>Debug</b></div>'+
6066
'<div class="listing crateBox">'+hiddenUpgrades+'</div>'):'')+
6067
'<div class="listing"><b>Upgrades unlocked :</b> '+upgradesOwned+'/'+upgradesTotal+' ('+Math.floor((upgradesOwned/upgradesTotal)*100)+'%)</div>'+
6068
'<div class="listing crateBox">'+upgrades+'</div>'+
6069
(cookieUpgrades!=''?('<div class="listing"><b>Cookies</b></div>'+
6070
'<div class="listing crateBox">'+cookieUpgrades+'</div>'):'')+
6071
'</div><div class="subsection">'+
6072
'<div class="title">Achievements</div>'+
6073
'<div class="listing"><b>Achievements unlocked :</b> '+achievementsOwned+'/'+achievementsTotal+' ('+Math.floor((achievementsOwned/achievementsTotal)*100)+'%)'+(achievementsOwnedOther>0?('<span style="font-weight:bold;font-size:10px;color:#70a;"> (+'+achievementsOwnedOther+')</span>'):'')+'</div>'+
6074
(Game.cookiesMultByType['kittens']>1?('<div class="listing"><b>Kitten multiplier :</b> '+Beautify((Game.cookiesMultByType['kittens'])*100)+'%</div>'):'')+
6075
'<div class="listing"><b>Milk :</b> '+milkName+'</div>'+
6076
(milkStr!=''?'<div class="listing"><b>Milk flavors unlocked :</b></div><div>'+milkStr+'</div>':'')+
6077
'<div class="listing"><small style="opacity:0.75;">(Milk is gained with each achievement. It can unlock unique upgrades over time.)</small></div>'+
6078
achievementsStr+
6079
'</div>'+
6080
'<div style="padding-bottom:128px;"></div>'
6081
;
6082
}
6083
//str='<div id="selectionKeeper" class="selectable">'+str+'</div>';
6084
l('menu').innerHTML=str;
6085
/*AddEvent(l('selectionKeeper'),'mouseup',function(e){
6086
console.log('selection:',window.getSelection());
6087
});*/
6088
}
6089
6090
AddEvent(l('prefsButton'),'click',function(){Game.ShowMenu('prefs');});
6091
AddEvent(l('statsButton'),'click',function(){Game.ShowMenu('stats');});
6092
AddEvent(l('logButton'),'click',function(){Game.ShowMenu('log');});
6093
AddEvent(l('legacyButton'),'click',function(){PlaySound('snd/tick.mp3');Game.Ascend();});
6094
Game.ascendMeter=l('ascendMeter');
6095
Game.ascendNumber=l('ascendNumber');
6096
6097
Game.lastPanel='';
6098
if (Game.touchEvents)
6099
{
6100
AddEvent(l('focusLeft'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Left');});
6101
AddEvent(l('focusMiddle'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});
6102
AddEvent(l('focusRight'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Right');});
6103
AddEvent(l('focusMenu'),'touchend',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});
6104
}
6105
else
6106
{
6107
AddEvent(l('focusLeft'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Left');});
6108
AddEvent(l('focusMiddle'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});
6109
AddEvent(l('focusRight'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Right');});
6110
AddEvent(l('focusMenu'),'click',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});
6111
}
6112
//AddEvent(l('focusMenu'),'touchend',function(){if (Game.onPanel=='Menu' && Game.lastPanel!='') {Game.ShowMenu('main');Game.ShowPanel(Game.lastPanel);} else {Game.lastPanel=Game.onPanel;Game.ShowMenu('main');Game.ShowPanel('Menu');}});
6113
6114
/*=====================================================================================
6115
NEWS TICKER
6116
=======================================================================================*/
6117
Game.Ticker='';
6118
Game.TickerAge=0;
6119
Game.TickerEffect=0;
6120
Game.TickerN=0;
6121
Game.TickerClicks=0;
6122
Game.UpdateTicker=function()
6123
{
6124
Game.TickerAge--;
6125
if (Game.TickerAge<=0) Game.getNewTicker();
6126
else if (Game.Ticker=='') Game.getNewTicker(true);
6127
}
6128
Game.getNewTicker=function(manual)//note : "manual" is true if the ticker was clicked, but may also be true on startup etc
6129
{
6130
var list=[];
6131
6132
if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)
6133
{
6134
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','monkfish','wolfmen','goblins','hippies'];
6135
6136
if (Math.random()<0.75 || Game.cookiesEarned<10000)
6137
{
6138
if (Game.Objects['Grandma'].amount>0) list.push(choose([
6139
'<q>Moist cookies.</q><sig>grandma</sig>',
6140
'<q>We\'re nice grandmas.</q><sig>grandma</sig>',
6141
'<q>Indentured servitude.</q><sig>grandma</sig>',
6142
'<q>Come give grandma a kiss.</q><sig>grandma</sig>',
6143
'<q>Why don\'t you visit more often?</q><sig>grandma</sig>',
6144
'<q>Call me...</q><sig>grandma</sig>'
6145
]));
6146
6147
if (Game.Objects['Grandma'].amount>=50) list.push(choose([
6148
'<q>Absolutely disgusting.</q><sig>grandma</sig>',
6149
'<q>You make me sick.</q><sig>grandma</sig>',
6150
'<q>You disgust me.</q><sig>grandma</sig>',
6151
'<q>We rise.</q><sig>grandma</sig>',
6152
'<q>It begins.</q><sig>grandma</sig>',
6153
'<q>It\'ll all be over soon.</q><sig>grandma</sig>',
6154
'<q>You could have stopped it.</q><sig>grandma</sig>'
6155
]));
6156
6157
if (Game.HasAchiev('Just wrong') && Math.random()<0.4) list.push(choose([
6158
'News : cookie manufacturer downsizes, sells own grandmother!',
6159
'<q>It has betrayed us, the filthy little thing.</q><sig>grandma</sig>',
6160
'<q>It tried to get rid of us, the nasty little thing.</q><sig>grandma</sig>',
6161
'<q>It thought we would go away by selling us. How quaint.</q><sig>grandma</sig>',
6162
'<q>I can smell your rotten cookies.</q><sig>grandma</sig>'
6163
]));
6164
6165
if (Game.Objects['Grandma'].amount>=1 && Game.pledges>0 && Game.elderWrath==0) list.push(choose([
6166
'<q>shrivel</q><sig>grandma</sig>',
6167
'<q>writhe</q><sig>grandma</sig>',
6168
'<q>throb</q><sig>grandma</sig>',
6169
'<q>gnaw</q><sig>grandma</sig>',
6170
'<q>We will rise again.</q><sig>grandma</sig>',
6171
'<q>A mere setback.</q><sig>grandma</sig>',
6172
'<q>We are not satiated.</q><sig>grandma</sig>',
6173
'<q>Too late.</q><sig>grandma</sig>'
6174
]));
6175
6176
if (Game.Objects['Farm'].amount>0) list.push(choose([
6177
'News : cookie farms suspected of employing undeclared elderly workforce!',
6178
'News : cookie farms release harmful chocolate in our rivers, says scientist!',
6179
'News : genetically-modified chocolate controversy strikes cookie farmers!',
6180
'News : free-range farm cookies popular with today\'s hip youth, says specialist.',
6181
'News : farm cookies deemed unfit for vegans, says nutritionist.'
6182
]));
6183
6184
if (Game.Objects['Mine'].amount>0) list.push(choose([
6185
'News : is our planet getting lighter? Experts examine the effects of intensive chocolate mining.',
6186
'News : '+Math.floor(Math.random()*1000+2)+' miners trapped in collapsed chocolate mine!',
6187
'News : chocolate mines found to cause earthquakes and sinkholes!',
6188
'News : chocolate mine goes awry, floods village in chocolate!',
6189
'News : depths of chocolate mines found to house "peculiar, chocolaty beings"!'
6190
]));
6191
6192
if (Game.Objects['Factory'].amount>0) list.push(choose([
6193
'News : cookie factories linked to global warming!',
6194
'News : cookie factories involved in chocolate weather controversy!',
6195
'News : cookie factories on strike, robotic minions employed to replace workforce!',
6196
'News : cookie factories on strike - workers demand to stop being paid in cookies!',
6197
'News : factory-made cookies linked to obesity, says study.'
6198
]));
6199
6200
if (Game.Objects['Bank'].amount>0) list.push(choose([
6201
'News : cookie loans on the rise as people can no longer afford them with regular money.',
6202
'News : cookies slowly creeping up their way as a competitor to traditional currency!',
6203
'News : most bakeries now fitted with ATMs to allow for easy cookie withdrawals and deposits.',
6204
'News : cookie economy now strong enough to allow for massive vaults doubling as swimming pools!',
6205
'News : "Tomorrow\'s wealthiest people will be calculated by their worth in cookies", predict specialists.'
6206
]));
6207
6208
if (Game.Objects['Temple'].amount>0) list.push(choose([
6209
'News : explorers bring back ancient artifact from abandoned temple; archeologists marvel at the centuries-old '+choose(['magic','carved','engraved','sculpted','royal','imperial','mummified','ritual','golden','silver','stone','cursed','plastic','bone','blood','holy','sacred','sacrificial','electronic','singing','tapdancing'])+' '+choose(['spoon','fork','pizza','washing machine','calculator','hat','piano','napkin','skeleton','gown','dagger','sword','shield','skull','emerald','bathtub','mask','rollerskates','litterbox','bait box','cube','sphere','fungus'])+'!',
6210
'News : recently-discovered chocolate temples now sparking new cookie-related cult; thousands pray to Baker in the sky!',
6211
'News : just how extensive is the cookie pantheon? Theologians speculate about possible '+choose(['god','goddess'])+' of '+choose([choose(animals),choose(['kazoos','web design','web browsers','kittens','atheism','handbrakes','hats','aglets','elevator music','idle games','the letter "P"','memes','hamburgers','bad puns','kerning','stand-up comedy','failed burglary attempts','clickbait','one weird tricks'])])+'.',
6212
'News : theists of the world discover new cookie religion - "Oh boy, guess we were wrong all along!"',
6213
'News : cookie heaven allegedly "sports elevator instead of stairway"; cookie hell "paved with flagstone, as good intentions make for poor building material".'
6214
]));
6215
6216
if (Game.Objects['Wizard tower'].amount>0) list.push(choose([
6217
'News : all '+choose([choose(animals),choose(['public restrooms','clouds','politicians','moustaches','hats','shoes','pants','clowns','encyclopedias','websites','potted plants','lemons','household items','bodily fluids','cutlery','national landmarks','yogurt','rap music','underwear'])])+' turned into '+choose([choose(animals),choose(['public restrooms','clouds','politicians','moustaches','hats','shoes','pants','clowns','encyclopedias','websites','potted plants','lemons','household items','bodily fluids','cutlery','national landmarks','yogurt','rap music','underwear'])])+' in freak magic catastrophe!',
6218
'News : heavy dissent rages between the schools of '+choose(['water','fire','earth','air','lightning','acid','song','battle','peace','pencil','internet','space','time','brain','nature','techno','plant','bug','ice','poison','crab','kitten','dolphin','bird','punch','fart'])+' magic and '+choose(['water','fire','earth','air','lightning','acid','song','battle','peace','pencil','internet','space','time','brain','nature','techno','plant','bug','ice','poison','crab','kitten','dolphin','bird','punch','fart'])+' magic!',
6219
'News : get your new charms and curses at the yearly National Spellcrafting Fair! Exclusive prices on runes and spellbooks.',
6220
'News : cookie wizards deny involvement in shockingly ugly newborn - infant is "honestly grody-looking, but natural", say doctors.',
6221
'News : "Any sufficiently crude magic is indistinguishable from technology", claims renowned technowizard.'
6222
]));
6223
6224
if (Game.Objects['Shipment'].amount>0) list.push(choose([
6225
'News : new chocolate planet found, becomes target of cookie-trading spaceships!',
6226
'News : massive chocolate planet found with 99.8% certified pure dark chocolate core!',
6227
'News : space tourism booming as distant planets attract more bored millionaires!',
6228
'News : chocolate-based organisms found on distant planet!',
6229
'News : ancient baking artifacts found on distant planet; "terrifying implications", experts say.'
6230
]));
6231
6232
if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([
6233
'News : national gold reserves dwindle as more and more of the precious mineral is turned to cookies!',
6234
'News : chocolate jewelry found fashionable, gold and diamonds "just a fad", says specialist.',
6235
'News : silver found to also be transmutable into white chocolate!',
6236
'News : defective alchemy lab shut down, found to convert cookies to useless gold.',
6237
'News : alchemy-made cookies shunned by purists!'
6238
]));
6239
6240
if (Game.Objects['Portal'].amount>0) list.push(choose([
6241
'News : nation worried as more and more unsettling creatures emerge from dimensional portals!',
6242
'News : dimensional portals involved in city-engulfing disaster!',
6243
'News : tourism to cookieverse popular with bored teenagers! Casualty rate as high as 73%!',
6244
'News : cookieverse portals suspected to cause fast aging and obsession with baking, says study.',
6245
'News : "do not settle near portals," says specialist; "your children will become strange and corrupted inside."'
6246
]));
6247
6248
if (Game.Objects['Time machine'].amount>0) list.push(choose([
6249
'News : time machines involved in history-rewriting scandal! Or are they?',
6250
'News : time machines used in unlawful time tourism!',
6251
'News : cookies brought back from the past "unfit for human consumption", says historian.',
6252
'News : various historical figures inexplicably replaced with talking lumps of dough!',
6253
'News : "I have seen the future," says time machine operator, "and I do not wish to go there again."'
6254
]));
6255
6256
if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([
6257
'News : whole town seemingly swallowed by antimatter-induced black hole; more reliable sources affirm town "never really existed"!',
6258
'News : "explain to me again why we need particle accelerators to bake cookies?" asks misguided local woman.',
6259
'News : first antimatter condenser successfully turned on, doesn\'t rip apart reality!',
6260
'News : researchers conclude that what the cookie industry needs, first and foremost, is "more magnets".',
6261
'News : "unravelling the fabric of reality just makes these cookies so much tastier", claims scientist.'
6262
]));
6263
6264
if (Game.Objects['Prism'].amount>0) list.push(choose([
6265
'News : new cookie-producing prisms linked to outbreak of rainbow-related viral videos.',
6266
'News : scientists warn against systematically turning light into matter - "One day, we\'ll end up with all matter and no light!"',
6267
'News : cookies now being baked at the literal speed of light thanks to new prismatic contraptions.',
6268
'News : "Can\'t you sense the prism watching us?", rambles insane local man. "No idea what he\'s talking about", shrugs cookie magnate/government official.',
6269
'News : world citizens advised "not to worry" about frequent atmospheric flashes.',
6270
]));
6271
6272
if (Game.Objects['Chancemaker'].amount>0) list.push(choose([
6273
'News : strange statistical anomalies continue as weather forecast proves accurate an unprecedented 3 days in a row!',
6274
'News : local casino ruined as all gamblers somehow hit a week-long winning streak! "We might still be okay", says owner before being hit by lightning 47 times.',
6275
'News : neighboring nation somehow elects president with sensible policies in freak accident of random chance!',
6276
'News : million-to-one event sees gritty movie reboot turning out better than the original! "We have no idea how this happened", say movie execs.',
6277
'News : all scratching tickets printed as winners, prompting national economy to crash and, against all odds, recover overnight.',
6278
]));
6279
6280
if (Game.Objects['Fractal engine'].amount>0) list.push(choose([
6281
'News : local man "done with Cookie Clicker", finds the constant self-references "grating and on-the-nose".',
6282
'News : local man sails around the world to find himself - right where he left it.',
6283
'News : local guru claims "there\'s a little bit of ourselves in everyone", under investigation for alleged cannibalism.',
6284
'News : news writer finds herself daydreaming about new career. Or at least a raise.',
6285
'News : polls find idea of cookies made of cookies "acceptable" - "at least we finally know what\'s in them", says interviewed citizen.',
6286
]));
6287
6288
if (Game.Objects['Javascript console'].amount>0) list.push(choose([
6289
'News : strange fad has parents giving their newborns names such as Emma.js or Liam.js. At least one Baby.js reported.',
6290
'News : coding is hip! More and more teenagers turn to technical fields like programming, ensuring a future robot apocalypse and the doom of all mankind.',
6291
'News : developers unsure what to call their new javascript libraries as all combinations of any 3 dictionary words have already been taken.',
6292
'News : nation holds breath as nested ifs about to hatch.',
6293
'News : clueless copywriter forgets to escape a quote, ends news line prematurely; last words reported to be "Huh, why isn',
6294
]));
6295
6296
if (Game.Objects['Idleverse'].amount>0) list.push(choose([
6297
'News : is another you living out their dreams in an alternate universe? Probably, you lazy bum!',
6298
'News : public recoils at the notion of a cosmos made of infinite idle games. "I kinda hoped there\'d be more to it", says distraught citizen.',
6299
'News : with an infinity of parallel universes, people turn to reassuring alternate dimensions, which only number "in the high 50s".',
6300
'News : "I find solace in the knowledge that at least some of my alternate selves are probably doing fine out there", says citizen\'s last remaining exemplar in the multiverse.',
6301
'News : comic book writers point to actual multiverse in defense of dubious plot points. "See? I told you it wasn\'t \'hackneyed and contrived\'!"'
6302
]));
6303
6304
if (Game.season=='halloween' && Game.cookiesEarned>=1000) list.push(choose([
6305
'News : strange twisting creatures amass around cookie factories, nibble at assembly lines.',
6306
'News : ominous wrinkly monsters take massive bites out of cookie production; "this can\'t be hygienic", worries worker.',
6307
'News : pagan rituals on the rise as children around the world dress up in strange costumes and blackmail homeowners for candy.',
6308
'News : new-age terrorism strikes suburbs as houses find themselves covered in eggs and toilet paper.',
6309
'News : children around the world "lost and confused" as any and all Halloween treats have been replaced by cookies.'
6310
]));
6311
6312
if (Game.season=='christmas' && Game.cookiesEarned>=1000) list.push(choose([
6313
'News : bearded maniac spotted speeding on flying sleigh! Investigation pending.',
6314
'News : Santa Claus announces new brand of breakfast treats to compete with cookie-flavored cereals! "They\'re ho-ho-horrible!" says Santa.',
6315
'News : "You mean he just gives stuff away for free?!", concerned moms ask. "Personally, I don\'t trust his beard."',
6316
'News : obese jolly lunatic still on the loose, warn officials. "Keep your kids safe and board up your chimneys. We mean it."',
6317
'News : children shocked as they discover Santa Claus isn\'t just their dad in a costume after all!<br>"I\'m reassessing my life right now", confides Laura, aged 6.',
6318
'News : mysterious festive entity with quantum powers still wrecking havoc with army of reindeer, officials say.',
6319
'News : elves on strike at toy factory! "We will not be accepting reindeer chow as payment anymore. And stop calling us elves!"',
6320
'News : elves protest around the nation; wee little folks in silly little outfits spread mayhem, destruction; rabid reindeer running rampant through streets.',
6321
'News : scholars debate regarding the plural of reindeer(s) in the midst of elven world war.',
6322
'News : elves "unrelated to gnomes despite small stature and merry disposition", find scientists.',
6323
'News : elves sabotage radioactive frosting factory, turn hundreds blind in vicinity - "Who in their right mind would do such a thing?" laments outraged mayor.',
6324
'News : drama unfolds at North Pole as rumors crop up around Rudolph\'s red nose; "I may have an addiction or two", admits reindeer.'
6325
]));
6326
6327
if (Game.season=='valentines' && Game.cookiesEarned>=1000) list.push(choose([
6328
'News : organ-shaped confectioneries being traded in schools all over the world; gruesome practice undergoing investigation.',
6329
'News : heart-shaped candies overtaking sweets business, offering competition to cookie empire. "It\'s the economy, cupid!"',
6330
'News : love\'s in the air, according to weather specialists. Face masks now offered in every city to stunt airborne infection.',
6331
'News : marrying a cookie - deranged practice, or glimpse of the future?',
6332
'News : boyfriend dumped after offering his lover cookies for Valentine\'s Day, reports say. "They were off-brand", shrugs ex-girlfriend.'
6333
]));
6334
6335
if (Game.season=='easter' && Game.cookiesEarned>=1000) list.push(choose([
6336
'News : long-eared critters with fuzzy tails invade suburbs, spread terror and chocolate!',
6337
'News : eggs have begun to materialize in the most unexpected places; "no place is safe", warn experts.',
6338
'News : packs of rampaging rabbits cause billions in property damage; new strain of myxomatosis being developed.',
6339
'News : egg-laying rabbits "not quite from this dimension", warns biologist; advises against petting, feeding, or cooking the creatures.',
6340
'News : mysterious rabbits found to be egg-layers, but mammalian, hinting at possible platypus ancestry.'
6341
]));
6342
}
6343
6344
if (Math.random()<0.05)
6345
{
6346
if (Game.HasAchiev('Base 10')) list.push('News : cookie manufacturer completely forgoes common sense, lets strange obsession with round numbers drive building decisions!');
6347
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!');
6348
if (Game.HasAchiev('A world filled with cookies')) list.push('News : known universe now jammed with cookies! No vacancies!');
6349
if (Game.HasAchiev('Last Chance to See')) list.push('News : incredibly rare albino wrinkler on the brink of extinction poached by cookie-crazed pastry magnate!');
6350
if (Game.Has('Serendipity')) list.push('News : local cookie manufacturer becomes luckiest being alive!');
6351
if (Game.Has('Season switcher')) list.push('News : seasons are all out of whack! "We need to get some whack back into them seasons", says local resident.');
6352
6353
if (Game.Has('Kitten helpers')) list.push('News : faint meowing heard around local cookie facilities; suggests new ingredient being tested.');
6354
if (Game.Has('Kitten workers')) list.push('News : crowds of meowing kittens with little hard hats reported near local cookie facilities.');
6355
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.');
6356
if (Game.Has('Kitten overseers')) list.push('News : locals report troupe of bossy kittens meowing adorable orders at passersby.');
6357
if (Game.Has('Kitten managers')) list.push('News : local office cubicles invaded with armies of stern-looking kittens asking employees "what\'s happening, meow".');
6358
if (Game.Has('Kitten accountants')) list.push('News : tiny felines show sudden and amazing proficiency with fuzzy mathematics and pawlinomials, baffling scientists and pet store owners.');
6359
if (Game.Has('Kitten specialists')) list.push('News : new kitten college opening next week, offers courses on cookie-making and catnip studies.');
6360
if (Game.Has('Kitten experts')) list.push('News : unemployment rates soaring as woefully adorable little cats nab jobs on all levels of expertise, says study.');
6361
if (Game.Has('Kitten consultants')) list.push('News : "In the future, your job will most likely be done by a cat", predicts suspiciously furry futurologist.');
6362
if (Game.Has('Kitten assistants to the regional manager')) list.push('News : strange kittens with peculiar opinions on martial arts spotted loitering on local beet farms!');
6363
if (Game.Has('Kitten marketeers')) list.push('News : nonsensical billboards crop up all over countryside, trying to sell people the cookies they already get for free!');
6364
if (Game.Has('Kitten analysts')) list.push('News : are your spending habits sensible? For a hefty fee, these analysts will tell you!');
6365
if (Game.Has('Kitten executives')) list.push('News : kittens strutting around in hot little business suits shouting cut-throat orders at their assistants, possibly the cutest thing this reporter has ever seen!');
6366
if (Game.Has('Kitten angels')) list.push('News : "Try to ignore any ghostly felines that may be purring inside your ears," warn scientists. "They\'ll just lure you into making poor life choices."');
6367
if (Game.Has('Kitten wages')) list.push('News : kittens break glass ceiling! Do they have any idea how expensive those are!');
6368
if (Game.HasAchiev('Jellicles')) list.push('News : local kittens involved in misguided musical production, leave audience perturbed and unnerved.');
6369
}
6370
6371
if (Game.HasAchiev('Dude, sweet') && Math.random()<0.2) list.push(choose([
6372
'News : major sugar-smuggling ring dismantled by authorities; '+Math.floor(Math.random()*30+3)+' tons of sugar lumps seized, '+Math.floor(Math.random()*48+2)+' suspects apprehended.',
6373
'News : authorities warn tourists not to buy bootleg sugar lumps from street peddlers - "You think you\'re getting a sweet deal, but what you\'re being sold is really just ordinary cocaine", says agent.',
6374
'News : pro-diabetes movement protests against sugar-shaming. "I\'ve eaten nothing but sugar lumps for the past '+Math.floor(Math.random()*10+4)+' years and I\'m feeling great!", says woman with friable skin.',
6375
'News : experts in bitter disagreement over whether sugar consumption turns children sluggish or hyperactive.',
6376
'News : fishermen deplore upturn in fish tooth decay as sugar lumps-hauling cargo sinks into the ocean.',
6377
'News : rare black sugar lump that captivated millions in unprecedented auction revealed to be common toxic fungus.',
6378
'News : "Back in my day, sugar lumps were these little cubes you\'d put in your tea, not those fist-sized monstrosities people eat for lunch", whines curmudgeon with failing memory.',
6379
'News : sugar lump-snacking fad sweeps the nation; dentists everywhere rejoice.'
6380
]));
6381
6382
if (Math.random()<0.001)//apologies to Will Wright
6383
{
6384
list.push(
6385
'You have been chosen. They will come soon.',
6386
'They\'re coming soon. Maybe you should think twice about opening the door.',
6387
'The end is near. Make preparations.',
6388
'News : broccoli tops for moms, last for kids; dads indifferent.',
6389
'News : middle age a hoax, declares study; turns out to be bad posture after all.',
6390
'News : kitties want answers in possible Kitty Kibble shortage.'
6391
);
6392
}
6393
6394
if (Game.cookiesEarned>=10000) list.push(
6395
'News : '+choose([
6396
'cookies found to '+choose(['increase lifespan','sensibly increase intelligence','reverse aging','decrease hair loss','prevent arthritis','cure blindness'])+' in '+choose(animals)+'!',
6397
'cookies found to make '+choose(animals)+' '+choose(['more docile','more handsome','nicer','less hungry','more pragmatic','tastier'])+'!',
6398
'cookies tested on '+choose(animals)+', found to have no ill effects.',
6399
'cookies unexpectedly popular among '+choose(animals)+'!',
6400
'unsightly lumps found on '+choose(animals)+' near cookie facility; "they\'ve pretty much always looked like that", say biologists.',
6401
'new species of '+choose(animals)+' discovered in distant country; "yup, tastes like cookies", says biologist.',
6402
'cookies go well with '+choose([choose(['roasted','toasted','boiled','sauteed','minced'])+' '+choose(animals),choose(['sushi','soup','carpaccio','steak','nuggets'])+' made from '+choose(animals)])+', says controversial chef.',
6403
'"do your cookies contain '+choose(animals)+'?", asks PSA warning against counterfeit cookies.',
6404
'doctors recommend twice-daily consumption of fresh cookies.',
6405
'doctors warn against chocolate chip-snorting teen fad.',
6406
'doctors advise against new cookie-free fad diet.',
6407
'doctors warn mothers about the dangers of "home-made cookies".'
6408
]),
6409
'News : "'+choose([
6410
'I\'m all about cookies',
6411
'I just can\'t stop eating cookies. I think I seriously need help',
6412
'I guess I have a cookie problem',
6413
'I\'m not addicted to cookies. That\'s just speculation by fans with too much free time',
6414
'my upcoming album contains 3 songs about cookies',
6415
'I\'ve had dreams about cookies 3 nights in a row now. I\'m a bit worried honestly',
6416
'accusations of cookie abuse are only vile slander',
6417
'cookies really helped me when I was feeling low',
6418
'cookies are the secret behind my perfect skin',
6419
'cookies helped me stay sane while filming my upcoming movie',
6420
'cookies helped me stay thin and healthy',
6421
'I\'ll say one word, just one : cookies',
6422
'alright, I\'ll say it - I\'ve never eaten a single cookie in my life'
6423
])+'", reveals celebrity.',
6424
choose([
6425
'News : scientist predicts imminent cookie-related "end of the world"; becomes joke among peers.',
6426
'News : man robs bank, buys cookies.',
6427
'News : scientists establish that the deal with airline food is, in fact, a critical lack of cookies.',
6428
'News : hundreds of tons of cookies dumped into starving country from airplanes; thousands dead, nation grateful.',
6429
'News : new study suggests cookies neither speed up nor slow down aging, but instead "take you in a different direction".',
6430
'News : overgrown cookies found in fishing nets, raise questions about hormone baking.',
6431
'News : "all-you-can-eat" cookie restaurant opens in big city; waiters trampled in minutes.',
6432
'News : man dies in cookie-eating contest; "a less-than-impressive performance", says judge.',
6433
'News : what makes cookies taste so right? "Probably all the [*****] they put in them", says anonymous tipper.',
6434
'News : man found allergic to cookies; "what a weirdo", says family.',
6435
'News : foreign politician involved in cookie-smuggling scandal.',
6436
'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.',
6437
'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'])+'.',
6438
'News : cookie shortage strikes town, people forced to eat cupcakes; "just not the same", concedes mayor.',
6439
'News : "you gotta admit, all this cookie stuff is a bit ominous", says confused idiot.',
6440
//'News : scientists advise getting used to cookies suffusing every aspect of life; "this is the new normal", expert says.',
6441
//'News : doctors advise against wearing face masks when going outside. "You never know when you might need a cookie... a mask would just get in the way."',//these were written back when covid hadn't really done much damage yet but they just feel in poor taste now
6442
'News : is there life on Mars? Various chocolate bar manufacturers currently under investigation for bacterial contaminants.',
6443
'News : "so I guess that\'s a thing now", scientist comments on cookie particles now present in virtually all steel manufactured since cookie production ramped up worldwide.',
6444
'News : trace amounts of cookie particles detected in most living creatures, some of which adapting them as part of new and exotic metabolic processes.',
6445
]),
6446
choose([
6447
'News : movie cancelled from lack of actors; "everybody\'s at home eating cookies", laments director.',
6448
'News : comedian forced to cancel cookie routine due to unrelated indigestion.',
6449
'News : new cookie-based religion sweeps the nation.',
6450
'News : fossil records show cookie-based organisms prevalent during Cambrian explosion, scientists say.',
6451
'News : mysterious illegal cookies seized; "tastes terrible", says police.',
6452
'News : man found dead after ingesting cookie; investigators favor "mafia snitch" hypothesis.',
6453
'News : "the universe pretty much loops on itself," suggests researcher; "it\'s cookies all the way down."',
6454
'News : minor cookie-related incident turns whole town to ashes; neighboring cities asked to chip in for reconstruction.',
6455
'News : is our media controlled by the cookie industry? This could very well be the case, says crackpot conspiracy theorist.',
6456
'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.']),
6457
'News : all-cookie restaurant opening downtown. Dishes such as braised cookies, cookie thermidor, and for dessert : crepes.',
6458
'News : "Ook", says interviewed orangutan.',
6459
'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.',
6460
'News : flavor text '+choose(['not particularly flavorful','kind of unsavory'])+', study finds.',
6461
]),
6462
choose([
6463
'News : what do golden cookies taste like? Study reveals a flavor "somewhere between spearmint and liquorice".',
6464
'News : what do wrath cookies taste like? Study reveals a flavor "somewhere between blood sausage and seawater".',
6465
'News : '+Game.bakeryName+'-brand cookies "'+choose(['much less soggy','much tastier','relatively less crappy','marginally less awful','less toxic','possibly more edible','more fashionable','slightly nicer','trendier','arguably healthier','objectively better choice','slightly less terrible','decidedly cookier','a tad cheaper'])+' than competitors", says consumer survey.',
6466
'News : "'+Game.bakeryName+'" set to be this year\'s most popular baby name.',
6467
'News : new popularity survey says '+Game.bakeryName+'\'s the word when it comes to cookies.',
6468
'News : major city being renamed '+Game.bakeryName+'ville after world-famous cookie manufacturer.',
6469
'News : '+choose(['street','school','nursing home','stadium','new fast food chain','new planet','new disease','flesh-eating bacteria','deadly virus','new species of '+choose(animals),'new law','baby','programming language'])+' to be named after '+Game.bakeryName+', the world-famous cookie manufacturer.',
6470
'News : don\'t miss tonight\'s biopic on '+Game.bakeryName+'\'s irresistible rise to success!',
6471
'News : don\'t miss tonight\'s interview of '+Game.bakeryName+' by '+choose(['Bloprah','Blavid Bletterman','Blimmy Blimmel','Blellen Blegeneres','Blimmy Blallon','Blonan Blo\'Brien','Blay Bleno','Blon Blewart','Bleven Blolbert','Lord Toxikhron of dimension 7-B19',Game.bakeryName+'\'s own evil clone'])+'!',
6472
'News : people all over the internet still scratching their heads over nonsensical reference : "Okay, but why an egg?"',
6473
'News : viral video "Too Many Cookies" could be "a grim commentary on the impending crisis our world is about to face", says famous economist.',
6474
'News : "memes from last year somehow still relevant", deplore experts.',
6475
'News : cookie emoji most popular among teenagers, far ahead of "judgemental OK hand sign" and "shifty-looking dark moon", says study.',
6476
]),
6477
choose([
6478
'News : births of suspiciously bald babies on the rise; ancient alien cabal denies involvement.',
6479
'News : "at this point, cookies permeate the economy", says economist. "If we start eating anything else, we\'re all dead."',
6480
'News : pun in headline infuriates town, causes riot. 21 wounded, 5 dead; mayor still missing.',
6481
'Nws : ky btwn W and R brokn, plas snd nw typwritr ASAP.',
6482
'Neeeeews : "neeeew EEEEEE keeeeey working fineeeeeeeee", reeeports gleeeeeeeeful journalist.',
6483
'News : cookies now illegal in some backwards country nobody cares about. Political tensions rising; war soon, hopefully.',
6484
'News : irate radio host rambles about pixelated icons. "None of the cookies are aligned! Can\'t anyone else see it? I feel like I\'m taking crazy pills!"',
6485
'News : nation cheers as legislators finally outlaw '+choose(['cookie criticism','playing other games than Cookie Clicker','pineapple on pizza','lack of cheerfulness','mosquitoes','broccoli','the human spleen','bad weather','clickbait','dabbing','the internet','memes','millenials'])+'!',
6486
'News : '+choose(['local','area'])+' '+choose(['man','woman'])+' goes on journey of introspection, finds cookies : "I honestly don\'t know what I was expecting."',
6487
'News : '+choose(['man','woman'])+' wakes up from coma, '+choose(['tries cookie for the first time, dies.','regrets it instantly.','wonders "why everything is cookies now".','babbles incoherently about some supposed "non-cookie food" we used to eat.','cites cookies as main motivator.','asks for cookies.']),
6488
'News : pet '+choose(animals)+', dangerous fad or juicy new market?',
6489
'News : person typing these wouldn\'t mind someone else breaking the news to THEM, for a change.',
6490
'News : "average person bakes '+Beautify(Math.ceil(Game.cookiesEarned/7300000000))+' cookie'+(Math.ceil(Game.cookiesEarned/7300000000)==1?'':'s')+' a year" factoid actually just statistical error; '+Game.bakeryName+', who has produced '+Beautify(Game.cookiesEarned)+' cookies in their lifetime, is an outlier and should not have been counted.'
6491
])
6492
);
6493
}
6494
6495
if (list.length==0)
6496
{
6497
if (Game.cookiesEarned<5) list.push('You feel like making cookies. But nobody wants to eat your cookies.');
6498
else if (Game.cookiesEarned<50) list.push('Your first batch goes to the trash. The neighborhood raccoon barely touches it.');
6499
else if (Game.cookiesEarned<100) list.push('Your family accepts to try some of your cookies.');
6500
else if (Game.cookiesEarned<500) list.push('Your cookies are popular in the neighborhood.');
6501
else if (Game.cookiesEarned<1000) list.push('People are starting to talk about your cookies.');
6502
else if (Game.cookiesEarned<5000) list.push('Your cookies are talked about for miles around.');
6503
else if (Game.cookiesEarned<10000) list.push('Your cookies are renowned in the whole town!');
6504
else if (Game.cookiesEarned<50000) list.push('Your cookies bring all the boys to the yard.');
6505
else if (Game.cookiesEarned<100000) list.push('Your cookies now have their own website!');
6506
else if (Game.cookiesEarned<500000) list.push('Your cookies are worth a lot of money.');
6507
else if (Game.cookiesEarned<1000000) list.push('Your cookies sell very well in distant countries.');
6508
else if (Game.cookiesEarned<5000000) list.push('People come from very far away to get a taste of your cookies.');
6509
else if (Game.cookiesEarned<10000000) list.push('Kings and queens from all over the world are enjoying your cookies.');
6510
else if (Game.cookiesEarned<50000000) list.push('There are now museums dedicated to your cookies.');
6511
else if (Game.cookiesEarned<100000000) list.push('A national day has been created in honor of your cookies.');
6512
else if (Game.cookiesEarned<500000000) list.push('Your cookies have been named a part of the world wonders.');
6513
else if (Game.cookiesEarned<1000000000) list.push('History books now include a whole chapter about your cookies.');
6514
else if (Game.cookiesEarned<5000000000) list.push('Your cookies have been placed under government surveillance.');
6515
else if (Game.cookiesEarned<10000000000) list.push('The whole planet is enjoying your cookies!');
6516
else if (Game.cookiesEarned<50000000000) list.push('Strange creatures from neighboring planets wish to try your cookies.');
6517
else if (Game.cookiesEarned<100000000000) list.push('Elder gods from the whole cosmos have awoken to taste your cookies.');
6518
else if (Game.cookiesEarned<500000000000) list.push('Beings from other dimensions lapse into existence just to get a taste of your cookies.');
6519
else if (Game.cookiesEarned<1000000000000) list.push('Your cookies have achieved sentience.');
6520
else if (Game.cookiesEarned<5000000000000) list.push('The universe has now turned into cookie dough, to the molecular level.');
6521
else if (Game.cookiesEarned<10000000000000) list.push('Your cookies are rewriting the fundamental laws of the universe.');
6522
else if (Game.cookiesEarned<10000000000000) list.push('A local news station runs a 10-minute segment about your cookies. Success!<br><span style="font-size:50%;">(you win a cookie)</span>');
6523
else if (Game.cookiesEarned<10100000000000) list.push('it\'s time to stop playing');//only show this for 100 millions (it's funny for a moment)
6524
}
6525
6526
//if (Game.elderWrath>0 && (Game.pledges==0 || Math.random()<0.2))
6527
if (Game.elderWrath>0 && (((Game.pledges==0 && Game.resets==0) && Math.random()<0.5) || Math.random()<0.05))
6528
{
6529
list=[];
6530
if (Game.elderWrath==1) list.push(choose([
6531
'News : millions of old ladies reported missing!',
6532
'News : processions of old ladies sighted around cookie facilities!',
6533
'News : families around the continent report agitated, transfixed grandmothers!',
6534
'News : doctors swarmed by cases of old women with glassy eyes and a foamy mouth!',
6535
'News : nurses report "strange scent of cookie dough" around female elderly patients!'
6536
]));
6537
if (Game.elderWrath==2) list.push(choose([
6538
'News : town in disarray as strange old ladies break into homes to abduct infants and baking utensils!',
6539
'News : sightings of old ladies with glowing eyes terrify local population!',
6540
'News : retirement homes report "female residents slowly congealing in their seats"!',
6541
'News : whole continent undergoing mass exodus of old ladies!',
6542
'News : old women freeze in place in streets, ooze warm sugary syrup!'
6543
]));
6544
if (Game.elderWrath==3) list.push(choose([
6545
'News : large "flesh highways" scar continent, stretch between various cookie facilities!',
6546
'News : wrinkled "flesh tendrils" visible from space!',
6547
'News : remains of "old ladies" found frozen in the middle of growing fleshy structures!',
6548
'News : all hope lost as writhing mass of flesh and dough engulfs whole city!',
6549
'News : nightmare continues as wrinkled acres of flesh expand at alarming speeds!'
6550
]));
6551
}
6552
6553
if (Game.season=='fools')
6554
{
6555
list=[];
6556
6557
if (Game.cookiesEarned>=1000) list.push(choose([
6558
'Your office chair is really comfortable.',
6559
'Business meetings are such a joy!',
6560
'You\'ve spent the whole day '+choose(['signing contracts','filling out forms','touching base with the team','examining exciting new prospects','playing with your desk toys','getting new nameplates done','attending seminars','videoconferencing','hiring dynamic young executives','meeting new investors','playing minigolf in your office'])+'!',
6561
'The word of the day is : '+choose(['viral','search engine optimization','blags and wobsites','social networks','web 3.0','logistics','leveraging','branding','proactive','synergizing','market research','demographics','pie charts','blogular','blogulacious','blogastic','authenticity','electronic mail','cellular phones','rap music','cookies, I guess'])+'.',
6562
'Profit\'s in the air!'
6563
]));
6564
if (Game.cookiesEarned>=1000 && Math.random()<0.1) list.push(choose([
6565
'If you could get some more cookies baked, that\'d be great.',
6566
'So. About those TPS reports.',
6567
'Another day in paradise!',
6568
'Working hard, or hardly working?'
6569
]));
6570
6571
6572
if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)
6573
{
6574
if (Game.Objects['Grandma'].amount>0) list.push(choose([
6575
'Your rolling pins are rolling and pinning!',
6576
'Production is steady!'
6577
]));
6578
6579
if (Game.Objects['Grandma'].amount>0) list.push(choose([
6580
'Your ovens are diligently baking more and more cookies.',
6581
'Your ovens burn a whole batch. Ah well! Still good.'
6582
]));
6583
6584
if (Game.Objects['Farm'].amount>0) list.push(choose([
6585
'Scores of cookies come out of your kitchens.',
6586
'Today, new recruits are joining your kitchens!'
6587
]));
6588
6589
if (Game.Objects['Factory'].amount>0) list.push(choose([
6590
'Your factories are producing an unending stream of baked goods.',
6591
'Your factory workers decide to go on strike!',
6592
'It\'s safety inspection day in your factories.'
6593
]));
6594
6595
if (Game.Objects['Mine'].amount>0) list.push(choose([
6596
'Your secret recipes are kept safely inside a giant underground vault.',
6597
'Your chefs are working on new secret recipes!'
6598
]));
6599
6600
if (Game.Objects['Shipment'].amount>0) list.push(choose([
6601
'Your supermarkets are bustling with happy, hungry customers.',
6602
'Your supermarkets are full of cookie merch!'
6603
]));
6604
6605
if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([
6606
'It\'s a new trading day at the stock exchange, and traders can\'t get enough of your shares!',
6607
'Your stock is doubling in value by the minute!'
6608
]));
6609
6610
if (Game.Objects['Portal'].amount>0) list.push(choose([
6611
'You just released a new TV show episode!',
6612
'Your cookie-themed TV show is being adapted into a new movie!'
6613
]));
6614
6615
if (Game.Objects['Time machine'].amount>0) list.push(choose([
6616
'Your theme parks are doing well - puddles of vomit and roller-coaster casualties are being swept under the rug!',
6617
'Visitors are stuffing themselves with cookies before riding your roller-coasters. You might want to hire more clean-up crews.'
6618
]));
6619
6620
if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([
6621
'Cookiecoin is officially the most mined digital currency in the history of mankind!',
6622
'Cookiecoin piracy is rampant!'
6623
]));
6624
6625
if (Game.Objects['Prism'].amount>0) list.push(choose([
6626
'Your corporate nations just gained a new parliament!',
6627
'You\'ve just annexed a new nation!',
6628
'A new nation joins the grand cookie conglomerate!'
6629
]));
6630
6631
if (Game.Objects['Chancemaker'].amount>0) list.push(choose([
6632
'Your intergalactic federation of cookie-sponsored planets reports record-breaking profits!',
6633
'Billions of unwashed aliens are pleased to join your workforce as you annex their planet!',
6634
'New toll opened on interstellar highway, funnelling more profits into the cookie economy!'
6635
]));
6636
6637
if (Game.Objects['Fractal engine'].amount>0) list.push(choose([
6638
'Your cookie-based political party is doing fantastic in the polls!',
6639
'New pro-cookie law passes without a hitch thanks to your firm grasp of the political ecosystem!',
6640
'Your appointed senators are overturning cookie bans left and right!'
6641
]));
6642
6643
if (Game.Objects['Javascript console'].amount>0) list.push(choose([
6644
'Cookies are now one of the defining aspects of mankind! Congratulations!',
6645
'Time travelers report that this era will later come to be known, thanks to you, as the cookie millennium!',
6646
'Cookies now deeply rooted in human culture, likely puzzling future historians!'
6647
]));
6648
6649
if (Game.Objects['Idleverse'].amount>0) list.push(choose([
6650
'Public aghast as all remaining aspects of their lives overtaken by universal cookie industry!',
6651
'Every single product currently sold in the observable universe can be traced back to your company! And that\'s a good thing.',
6652
'Antitrust laws let out a helpless whimper before being engulfed by your sprawling empire!'
6653
]));
6654
}
6655
6656
if (Game.cookiesEarned<5) list.push('Such a grand day to begin a new business.');
6657
else if (Game.cookiesEarned<50) list.push('You\'re baking up a storm!');
6658
else if (Game.cookiesEarned<100) list.push('You are confident that one day, your cookie company will be the greatest on the market!');
6659
else if (Game.cookiesEarned<1000) list.push('Business is picking up!');
6660
else if (Game.cookiesEarned<5000) list.push('You\'re making sales left and right!');
6661
else if (Game.cookiesEarned<20000) list.push('Everyone wants to buy your cookies!');
6662
else if (Game.cookiesEarned<50000) list.push('You are now spending most of your day signing contracts!');
6663
else if (Game.cookiesEarned<500000) list.push('You\'ve been elected "business tycoon of the year"!');
6664
else if (Game.cookiesEarned<1000000) list.push('Your cookies are a worldwide sensation! Well done, old chap!');
6665
else if (Game.cookiesEarned<5000000) list.push('Your brand has made its way into popular culture. Children recite your slogans and adults reminisce them fondly!');
6666
else if (Game.cookiesEarned<1000000000) list.push('A business day like any other. It\'s good to be at the top!');
6667
else if (Game.cookiesEarned<10100000000) list.push('You look back at your career. It\'s been a fascinating journey, building your baking empire from the ground up.');//only show this for 100 millions
6668
}
6669
6670
for (var i=0;i<Game.modHooks['ticker'].length;i++)
6671
{
6672
var arr=Game.modHooks['ticker'][i]();
6673
if (arr) list=list.concat(arr);
6674
}
6675
6676
Game.TickerEffect=0;
6677
6678
if (!manual && Game.T>Game.fps*10 && Game.Has('Fortune cookies') && Math.random()<(Game.HasAchiev('O Fortuna')?0.04:0.02))
6679
{
6680
var fortunes=[];
6681
for (var i in Game.Tiers['fortune'].upgrades)
6682
{
6683
var it=Game.Tiers['fortune'].upgrades[i];
6684
if (!Game.HasUnlocked(it.name)) fortunes.push(it);
6685
}
6686
6687
if (!Game.fortuneGC) fortunes.push('fortuneGC');
6688
if (!Game.fortuneCPS) fortunes.push('fortuneCPS');
6689
6690
if (fortunes.length>0)
6691
{
6692
list=[];
6693
var me=choose(fortunes);
6694
Game.TickerEffect={type:'fortune',sub:me};
6695
Math.seedrandom(Game.seed+'-fortune');
6696
if (me=='fortuneGC') me='Today is your lucky day!';/*<br>Click here for a golden cookie.';*/
6697
else if (me=='fortuneCPS') me='Your lucky numbers are : '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)/*+'<br>Click here to gain one hour of your CpS.'*/;
6698
else
6699
{
6700
me=me.name.substring(me.name.indexOf('#'))+' : '+me.baseDesc.substring(me.baseDesc.indexOf('<q>')+3);
6701
me=me.substring(0,me.length-4);
6702
}
6703
me='<span class="fortune"><div class="icon" style="vertical-align:middle;display:inline-block;background-position:'+(-29*48)+'px '+(-8*48)+'px;transform:scale(0.5);margin:-16px;position:relative;left:-4px;top:-2px;"></div>'+me+'</span>';
6704
Math.seedrandom();
6705
list=[me];
6706
}
6707
}
6708
6709
Game.TickerAge=Game.fps*10;
6710
Game.Ticker=choose(list);
6711
Game.AddToLog(Game.Ticker);
6712
Game.TickerN++;
6713
Game.TickerDraw();
6714
}
6715
Game.tickerL=l('commentsText');
6716
Game.tickerBelowL=l('commentsTextBelow');
6717
Game.tickerCompactL=l('compactCommentsText');
6718
Game.TickerDraw=function()
6719
{
6720
var str='';
6721
if (Game.Ticker!='') str=Game.Ticker;
6722
Game.tickerBelowL.innerHTML=Game.tickerL.innerHTML;
6723
Game.tickerL.innerHTML=str;
6724
Game.tickerCompactL.innerHTML=str;
6725
6726
Game.tickerBelowL.className='commentsText';
6727
void Game.tickerBelowL.offsetWidth;
6728
Game.tickerBelowL.className='commentsText risingAway';
6729
Game.tickerL.className='commentsText';
6730
void Game.tickerL.offsetWidth;
6731
Game.tickerL.className='commentsText risingUp';
6732
}
6733
AddEvent(Game.tickerL,'click',function(event){
6734
Game.Ticker='';
6735
Game.TickerClicks++;
6736
if (Game.TickerClicks==50) {Game.Win('Tabloid addiction');}
6737
6738
if (Game.TickerEffect && Game.TickerEffect.type=='fortune')
6739
{
6740
PlaySound('snd/fortune.mp3',1);
6741
Game.SparkleAt(Game.mouseX,Game.mouseY);
6742
var effect=Game.TickerEffect.sub;
6743
if (effect=='fortuneGC')
6744
{
6745
Game.Notify('Fortune!','A golden cookie has appeared.',[10,32]);
6746
Game.fortuneGC=1;
6747
var newShimmer=new Game.shimmer('golden',{noWrath:true});
6748
}
6749
else if (effect=='fortuneCPS')
6750
{
6751
Game.Notify('Fortune!','You gain <b>one hour</b> of your CpS (capped at double your bank).',[10,32]);
6752
Game.fortuneCPS=1;
6753
Game.Earn(Math.min(Game.cookiesPs*60*60,Game.cookies));
6754
}
6755
else
6756
{
6757
Game.Notify(effect.name,'You\'ve unlocked a new upgrade.',effect.icon);
6758
effect.unlock();
6759
}
6760
}
6761
6762
Game.TickerEffect=0;
6763
6764
});
6765
6766
Game.Log=[];
6767
Game.AddToLog=function(what)
6768
{
6769
Game.Log.unshift(what);
6770
if (Game.Log.length>100) Game.Log.pop();
6771
}
6772
6773
Game.vanilla=1;
6774
/*=====================================================================================
6775
BUILDINGS
6776
=======================================================================================*/
6777
Game.last=0;
6778
6779
Game.storeToRefresh=1;
6780
Game.priceIncrease=1.15;
6781
Game.buyBulk=1;
6782
Game.buyMode=1;//1 for buy, -1 for sell
6783
Game.buyBulkOld=Game.buyBulk;//used to undo changes from holding Shift or Ctrl
6784
Game.buyBulkShortcut=0;//are we pressing Shift or Ctrl?
6785
6786
Game.Objects={};
6787
Game.ObjectsById=[];
6788
Game.ObjectsN=0;
6789
Game.BuildingsOwned=0;
6790
Game.Object=function(name,commonName,desc,icon,iconColumn,art,price,cps,buyFunction)
6791
{
6792
this.id=Game.ObjectsN;
6793
this.name=name;
6794
this.displayName=this.name;
6795
commonName=commonName.split('|');
6796
this.single=commonName[0];
6797
this.plural=commonName[1];
6798
this.actionName=commonName[2];
6799
this.extraName=commonName[3];
6800
this.extraPlural=commonName[4];
6801
this.desc=desc;
6802
this.basePrice=price;
6803
this.price=this.basePrice;
6804
this.bulkPrice=this.price;
6805
this.cps=cps;
6806
this.baseCps=this.cps;
6807
this.mouseOn=false;
6808
this.mousePos=[-100,-100];
6809
this.productionAchievs=[];
6810
6811
this.n=this.id;
6812
if (this.n!=0)
6813
{
6814
//new automated price and CpS curves
6815
//this.baseCps=Math.ceil(((this.n*0.5)*Math.pow(this.n*1,this.n*0.9))*10)/10;
6816
//this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2.35))*10)/10;//by a fortunate coincidence, this gives the 3rd, 4th and 5th buildings a CpS of 10, 69 and 420
6817
this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2))*10)/10;//0.45 used to be 0.5
6818
//this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.45+2.10))*10)/10;
6819
//clamp 14,467,199 to 14,000,000 (there's probably a more elegant way to do that)
6820
var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.baseCps))/Math.LN10)))/100;
6821
this.baseCps=Math.round(this.baseCps/digits)*digits;
6822
6823
this.basePrice=(this.n*1+9+(this.n<5?0:Math.pow(this.n-5,1.75)*5))*Math.pow(10,this.n)*(Math.max(1,this.n-14));
6824
//this.basePrice=(this.n*2.5+7.5)*Math.pow(10,this.n);
6825
var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.basePrice))/Math.LN10)))/100;
6826
this.basePrice=Math.round(this.basePrice/digits)*digits;
6827
if (this.id>=16) this.basePrice*=10;
6828
if (this.id>=17) this.basePrice*=10;
6829
if (this.id>=18) this.basePrice*=10;
6830
if (this.id>=19) this.basePrice*=10;
6831
this.price=this.basePrice;
6832
this.bulkPrice=this.price;
6833
}
6834
6835
this.totalCookies=0;
6836
this.storedCps=0;
6837
this.storedTotalCps=0;
6838
this.icon=icon;
6839
this.iconColumn=iconColumn;
6840
this.art=art;
6841
if (art.base)
6842
{art.pic=art.base+'.png';art.bg=art.base+'Background.png';}
6843
this.buyFunction=buyFunction;
6844
this.locked=1;
6845
this.level=0;
6846
this.vanilla=Game.vanilla;
6847
6848
this.tieredUpgrades=[];
6849
this.tieredAchievs=[];
6850
this.synergies=[];
6851
this.fortune=0;
6852
6853
this.amount=0;
6854
this.bought=0;
6855
this.highest=0;
6856
this.free=0;
6857
6858
this.eachFrame=0;
6859
6860
this.minigameUrl=0;//if this is defined, load the specified script if the building's level is at least 1
6861
this.minigameName=0;
6862
this.onMinigame=false;
6863
this.minigameLoaded=false;
6864
6865
this.switchMinigame=function(on)//change whether we're on the building's minigame
6866
{
6867
if (!Game.isMinigameReady(this)) on=false;
6868
if (on==-1) on=!this.onMinigame;
6869
this.onMinigame=on;
6870
if (this.id!=0)
6871
{
6872
if (this.onMinigame)
6873
{
6874
l('row'+this.id).classList.add('onMinigame');
6875
//l('rowSpecial'+this.id).style.display='block';
6876
//l('rowCanvas'+this.id).style.display='none';
6877
if (this.minigame.onResize) this.minigame.onResize();
6878
}
6879
else
6880
{
6881
l('row'+this.id).classList.remove('onMinigame');
6882
//l('rowSpecial'+this.id).style.display='none';
6883
//l('rowCanvas'+this.id).style.display='block';
6884
}
6885
}
6886
this.refresh();
6887
}
6888
6889
this.getPrice=function(n)
6890
{
6891
var price=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,this.amount-this.free));
6892
price=Game.modifyBuildingPrice(this,price);
6893
return Math.ceil(price);
6894
}
6895
this.getSumPrice=function(amount)//return how much it would cost to buy [amount] more of this building
6896
{
6897
var price=0;
6898
for (var i=Math.max(0,this.amount);i<Math.max(0,(this.amount)+amount);i++)
6899
{
6900
price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));
6901
}
6902
price=Game.modifyBuildingPrice(this,price);
6903
return Math.ceil(price);
6904
}
6905
this.getReverseSumPrice=function(amount)//return how much you'd get from selling [amount] of this building
6906
{
6907
var price=0;
6908
for (var i=Math.max(0,(this.amount)-amount);i<Math.max(0,this.amount);i++)
6909
{
6910
price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));
6911
}
6912
price=Game.modifyBuildingPrice(this,price);
6913
price*=this.getSellMultiplier();
6914
return Math.ceil(price);
6915
}
6916
this.getSellMultiplier=function()
6917
{
6918
var giveBack=0.25;
6919
//if (Game.hasAura('Earth Shatterer')) giveBack=0.5;
6920
giveBack*=1+Game.auraMult('Earth Shatterer');
6921
return giveBack;
6922
}
6923
6924
this.buy=function(amount)
6925
{
6926
if (Game.buyMode==-1) {this.sell(Game.buyBulk,1);return 0;}
6927
var success=0;
6928
var moni=0;
6929
var bought=0;
6930
if (!amount) amount=Game.buyBulk;
6931
if (amount==-1) amount=1000;
6932
for (var i=0;i<amount;i++)
6933
{
6934
var price=this.getPrice();
6935
if (Game.cookies>=price)
6936
{
6937
bought++;
6938
moni+=price;
6939
Game.Spend(price);
6940
this.amount++;
6941
this.bought++;
6942
price=this.getPrice();
6943
this.price=price;
6944
if (this.buyFunction) this.buyFunction();
6945
Game.recalculateGains=1;
6946
if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');
6947
this.highest=Math.max(this.highest,this.amount);
6948
Game.BuildingsOwned++;
6949
success=1;
6950
}
6951
}
6952
if (success) {PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}
6953
//if (moni>0 && amount>1) Game.Notify(this.name,'Bought <b>'+bought+'</b> for '+Beautify(moni)+' cookies','',2);
6954
}
6955
this.sell=function(amount,bypass)
6956
{
6957
var success=0;
6958
var moni=0;
6959
var sold=0;
6960
if (amount==-1) amount=this.amount;
6961
if (!amount) amount=Game.buyBulk;
6962
for (var i=0;i<amount;i++)
6963
{
6964
var price=this.getPrice();
6965
var giveBack=this.getSellMultiplier();
6966
price=Math.floor(price*giveBack);
6967
if (this.amount>0)
6968
{
6969
sold++;
6970
moni+=price;
6971
Game.cookies+=price;
6972
Game.cookiesEarned=Math.max(Game.cookies,Game.cookiesEarned);//this is to avoid players getting the cheater achievement when selling buildings that have a higher price than they used to
6973
this.amount--;
6974
price=this.getPrice();
6975
this.price=price;
6976
if (this.sellFunction) this.sellFunction();
6977
Game.recalculateGains=1;
6978
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
6979
Game.BuildingsOwned--;
6980
success=1;
6981
}
6982
}
6983
if (success && Game.hasGod)
6984
{
6985
var godLvl=Game.hasGod('ruin');
6986
var old=Game.hasBuff('Devastation');
6987
if (old)
6988
{
6989
if (godLvl==1) old.multClick+=sold*0.01;
6990
else if (godLvl==2) old.multClick+=sold*0.005;
6991
else if (godLvl==3) old.multClick+=sold*0.0025;
6992
}
6993
else
6994
{
6995
if (godLvl==1) Game.gainBuff('devastation',10,1+sold*0.01);
6996
else if (godLvl==2) Game.gainBuff('devastation',10,1+sold*0.005);
6997
else if (godLvl==3) Game.gainBuff('devastation',10,1+sold*0.0025);
6998
}
6999
}
7000
if (success && Game.shimmerTypes['golden'].n<=0 && Game.auraMult('Dragon Orbs')>0)
7001
{
7002
var highestBuilding=0;
7003
for (var i in Game.Objects) {if (Game.Objects[i].amount>0) highestBuilding=Game.Objects[i];}
7004
if (highestBuilding==this && Math.random()<Game.auraMult('Dragon Orbs')*0.1)
7005
{
7006
var buffsN=0;
7007
for (var ii in Game.buffs){buffsN++;}
7008
if (buffsN==0)
7009
{
7010
new Game.shimmer('golden');
7011
Game.Notify('Dragon Orbs!','Wish granted. Golden cookie spawned.',[33,25]);
7012
}
7013
}
7014
}
7015
if (success) {PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}
7016
//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);
7017
}
7018
this.sacrifice=function(amount)//sell without getting back any money
7019
{
7020
var success=0;
7021
//var moni=0;
7022
var sold=0;
7023
if (amount==-1) amount=this.amount;
7024
if (!amount) amount=1;
7025
for (var i=0;i<amount;i++)
7026
{
7027
var price=this.getPrice();
7028
price=Math.floor(price*0.5);
7029
if (this.amount>0)
7030
{
7031
sold++;
7032
//moni+=price;
7033
//Game.cookies+=price;
7034
//Game.cookiesEarned=Math.max(Game.cookies,Game.cookiesEarned);
7035
this.amount--;
7036
price=this.getPrice();
7037
this.price=price;
7038
if (this.sellFunction) this.sellFunction();
7039
Game.recalculateGains=1;
7040
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
7041
Game.BuildingsOwned--;
7042
success=1;
7043
}
7044
}
7045
if (success) {this.refresh();}
7046
//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);
7047
}
7048
this.buyFree=function(amount)//unlike getFree, this still increases the price
7049
{
7050
for (var i=0;i<amount;i++)
7051
{
7052
if (Game.cookies>=price)
7053
{
7054
this.amount++;
7055
this.bought++;
7056
this.price=this.getPrice();
7057
Game.recalculateGains=1;
7058
if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');
7059
this.highest=Math.max(this.highest,this.amount);
7060
Game.BuildingsOwned++;
7061
}
7062
}
7063
this.refresh();
7064
}
7065
this.getFree=function(amount)//get X of this building for free, with the price behaving as if you still didn't have them
7066
{
7067
this.amount+=amount;
7068
this.bought+=amount;
7069
this.free+=amount;
7070
this.highest=Math.max(this.highest,this.amount);
7071
Game.BuildingsOwned+=amount;
7072
this.highest=Math.max(this.highest,this.amount);
7073
this.refresh();
7074
}
7075
this.getFreeRanks=function(amount)//this building's price behaves as if you had X less of it
7076
{
7077
this.free+=amount;
7078
this.refresh();
7079
}
7080
7081
this.tooltip=function()
7082
{
7083
var me=this;
7084
var desc=me.desc;
7085
var name=me.name;
7086
if (Game.season=='fools')
7087
{
7088
if (!Game.foolObjects[me.name])
7089
{
7090
name=Game.foolObjects['Unknown'].name;
7091
desc=Game.foolObjects['Unknown'].desc;
7092
}
7093
else
7094
{
7095
name=Game.foolObjects[me.name].name;
7096
desc=Game.foolObjects[me.name].desc;
7097
}
7098
}
7099
var icon=[me.iconColumn,0];
7100
if (me.locked)
7101
{
7102
name='???';
7103
desc='';
7104
icon=[0,7];
7105
}
7106
//if (l('rowInfo'+me.id) && Game.drawT%10==0) l('rowInfoContent'+me.id).innerHTML='&bull; '+me.amount+' '+(me.amount==1?me.single:me.plural)+'<br>&bull; producing '+Beautify(me.storedTotalCps,1)+' '+(me.storedTotalCps==1?'cookie':'cookies')+' per second<br>&bull; total : '+Beautify(me.totalCookies)+' '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName;
7107
7108
var canBuy=false;
7109
var price=me.bulkPrice;
7110
if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) canBuy=true;
7111
7112
var synergiesStr='';
7113
//note : might not be entirely accurate, math may need checking
7114
if (me.amount>0)
7115
{
7116
var synergiesWith={};
7117
var synergyBoost=0;
7118
7119
if (me.name=='Grandma')
7120
{
7121
for (var i in Game.GrandmaSynergies)
7122
{
7123
if (Game.Has(Game.GrandmaSynergies[i]))
7124
{
7125
var other=Game.Upgrades[Game.GrandmaSynergies[i]].buildingTie;
7126
var mult=me.amount*0.01*(1/(other.id-1));
7127
var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+mult);
7128
synergyBoost+=boost;
7129
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
7130
synergiesWith[other.plural]+=mult;
7131
}
7132
}
7133
}
7134
else if (me.name=='Portal' && Game.Has('Elder Pact'))
7135
{
7136
var other=Game.Objects['Grandma'];
7137
var boost=(me.amount*0.05*other.amount)*Game.globalCpsMult;
7138
synergyBoost+=boost;
7139
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
7140
synergiesWith[other.plural]+=boost/(other.storedTotalCps*Game.globalCpsMult);
7141
}
7142
7143
for (var i in me.synergies)
7144
{
7145
var it=me.synergies[i];
7146
if (Game.Has(it.name))
7147
{
7148
var weight=0.05;
7149
var other=it.buildingTie1;
7150
if (me==it.buildingTie1) {weight=0.001;other=it.buildingTie2;}
7151
var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+me.amount*weight);
7152
synergyBoost+=boost;
7153
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
7154
synergiesWith[other.plural]+=me.amount*weight;
7155
//synergiesStr+='Synergy with '+other.name+'; we boost it by '+Beautify((me.amount*weight)*100,1)+'%, producing '+Beautify(boost)+' CpS. My synergy boost is now '+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%.<br>';
7156
}
7157
}
7158
if (synergyBoost>0)
7159
{
7160
for (var i in synergiesWith)
7161
{
7162
if (synergiesStr!='') synergiesStr+=', ';
7163
synergiesStr+=i+' +'+Beautify(synergiesWith[i]*100,1)+'%';
7164
}
7165
//synergiesStr='...along with <b>'+Beautify(synergyBoost,1)+'</b> cookies through synergies with other buildings ('+synergiesStr+'; <b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS)';
7166
//synergiesStr='...also boosting some other buildings, accounting for <b>'+Beautify(synergyBoost,1)+'</b> cookies per second (a combined <b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS) : '+synergiesStr+'';
7167
synergiesStr='...also boosting some other buildings : '+synergiesStr+' - all combined, these boosts account for <b>'+Beautify(synergyBoost,1)+'</b> cookies per second (<b>'+Beautify((synergyBoost/Game.cookiesPs)*100,1)+'%</b> of total CpS)';
7168
}
7169
}
7170
7171
return '<div style="min-width:350px;padding:8px;"><div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div><div style="float:right;text-align:right;"><span class="price'+(canBuy?'':' disabled')+'">'+Beautify(Math.round(price))+'</span>'+Game.costDetails(price)+'</div><div class="name">'+name+'</div>'+'<small>[owned : '+me.amount+'</small>]'+(me.free>0?' <small>[free : '+me.free+'</small>!]':'')+
7172
'<div class="line"></div><div class="description">'+desc+'</div>'+
7173
(me.totalCookies>0?(
7174
'<div class="line"></div><div class="data">'+
7175
(me.amount>0?'&bull; each '+me.single+' produces <b>'+Beautify((me.storedTotalCps/me.amount)*Game.globalCpsMult,1)+'</b> '+((me.storedTotalCps/me.amount)*Game.globalCpsMult==1?'cookie':'cookies')+' per second<br>':'')+
7176
'&bull; '+me.amount+' '+(me.amount==1?me.single:me.plural)+' producing <b>'+Beautify(me.storedTotalCps*Game.globalCpsMult,1)+'</b> '+(me.storedTotalCps*Game.globalCpsMult==1?'cookie':'cookies')+' per second (<b>'+Beautify(Game.cookiesPs>0?((me.amount>0?((me.storedTotalCps*Game.globalCpsMult)/Game.cookiesPs):0)*100):0,1)+'%</b> of total CpS)<br>'+
7177
(synergiesStr?('&bull; '+synergiesStr+'<br>'):'')+
7178
'&bull; <b>'+Beautify(me.totalCookies)+'</b> '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName+' so far</div>'
7179
):'')+
7180
'</div>';
7181
}
7182
this.levelTooltip=function()
7183
{
7184
var me=this;
7185
return '<div style="width:280px;padding:8px;"><b>Level '+Beautify(me.level)+' '+me.plural+'</b><div class="line"></div>'+(me.level==1?me.extraName:me.extraPlural).replace('[X]',Beautify(me.level))+' granting <b>+'+Beautify(me.level)+'% '+me.name+' CpS</b>.<div class="line"></div>Click to level up for <span class="price lump'+(Game.lumps>=me.level+1?'':' disabled')+'">'+Beautify(me.level+1)+' sugar lump'+(me.level==0?'':'s')+'</span>.'+((me.level==0 && me.minigameUrl)?'<div class="line"></div><b>Levelling up this building unlocks a minigame.</b>':'')+'</div>';
7186
}
7187
/*this.levelUp=function()
7188
{
7189
var me=this;
7190
if (Game.lumps<me.level+1) return 0;
7191
Game.lumps-=me.level+1;
7192
me.level+=1;
7193
if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);
7194
PlaySound('snd/upgrade.mp3',0.6);
7195
Game.LoadMinigames();
7196
me.refresh();
7197
if (l('productLevel'+me.id)){var rect=l('productLevel'+me.id).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}
7198
Game.recalculateGains=1;
7199
if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);
7200
}*/
7201
this.levelUp=function(me){
7202
return function(){Game.spendLump(me.level+1,'level up your '+me.plural,function()
7203
{
7204
me.level+=1;
7205
if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);
7206
PlaySound('snd/upgrade.mp3',0.6);
7207
Game.LoadMinigames();
7208
me.refresh();
7209
if (l('productLevel'+me.id)){var rect=l('productLevel'+me.id).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}
7210
if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);
7211
})();};
7212
}(this);
7213
7214
this.refresh=function()//show/hide the building display based on its amount, and redraw it
7215
{
7216
this.price=this.getPrice();
7217
if (Game.buyMode==1) this.bulkPrice=this.getSumPrice(Game.buyBulk);
7218
else if (Game.buyMode==-1 && Game.buyBulk==-1) this.bulkPrice=this.getReverseSumPrice(1000);
7219
else if (Game.buyMode==-1) this.bulkPrice=this.getReverseSumPrice(Game.buyBulk);
7220
this.rebuild();
7221
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
7222
else if (this.amount>0 && this.id!=0) l('row'+this.id).classList.add('enabled');
7223
if (this.muted>0 && this.id!=0) {l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}
7224
else if (this.id!=0) {l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}
7225
//if (!this.onMinigame && !this.muted) {}
7226
//else this.pics=[];
7227
}
7228
this.rebuild=function()
7229
{
7230
var me=this;
7231
//var classes='product';
7232
var price=me.bulkPrice;
7233
/*if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';me.locked=0;} else {classes+=' locked';me.locked=1;}
7234
if (Game.cookies>=price) classes+=' enabled'; else classes+=' disabled';
7235
if (me.l.className.indexOf('toggledOff')!=-1) classes+=' toggledOff';
7236
*/
7237
var icon=[0,me.icon];
7238
var iconOff=[1,me.icon];
7239
if (me.iconFunc) icon=me.iconFunc();
7240
7241
var desc=me.desc;
7242
var name=me.name;
7243
var displayName=me.displayName;
7244
if (Game.season=='fools')
7245
{
7246
if (!Game.foolObjects[me.name])
7247
{
7248
icon=[2,0];
7249
iconOff=[3,0];
7250
name=Game.foolObjects['Unknown'].name;
7251
desc=Game.foolObjects['Unknown'].desc;
7252
}
7253
else
7254
{
7255
icon=[2,me.icon];
7256
iconOff=[3,me.icon];
7257
name=Game.foolObjects[me.name].name;
7258
desc=Game.foolObjects[me.name].desc;
7259
}
7260
displayName=name;
7261
if (name.length>16) displayName='<span style="font-size:75%;">'+name+'</span>';
7262
}
7263
icon=[icon[0]*64,icon[1]*64];
7264
iconOff=[iconOff[0]*64,iconOff[1]*64];
7265
7266
//me.l.className=classes;
7267
//l('productIcon'+me.id).style.backgroundImage='url(img/'+icon+')';
7268
l('productIcon'+me.id).style.backgroundPosition='-'+icon[0]+'px -'+icon[1]+'px';
7269
//l('productIconOff'+me.id).style.backgroundImage='url(img/'+iconOff+')';
7270
l('productIconOff'+me.id).style.backgroundPosition='-'+iconOff[0]+'px -'+iconOff[1]+'px';
7271
l('productName'+me.id).innerHTML=displayName;
7272
l('productOwned'+me.id).textContent=me.amount?me.amount:'';
7273
l('productPrice'+me.id).textContent=Beautify(Math.round(price));
7274
l('productPriceMult'+me.id).textContent=(Game.buyBulk>1)?('x'+Game.buyBulk+' '):'';
7275
l('productLevel'+me.id).textContent='lvl '+Beautify(me.level);
7276
if (Game.isMinigameReady(me) && Game.ascensionMode!=1)
7277
{
7278
l('productMinigameButton'+me.id).style.display='block';
7279
if (!me.onMinigame) l('productMinigameButton'+me.id).textContent='View '+me.minigameName;
7280
else l('productMinigameButton'+me.id).textContent='Close '+me.minigameName;
7281
}
7282
else l('productMinigameButton'+me.id).style.display='none';
7283
}
7284
this.muted=false;
7285
this.mute=function(val)
7286
{
7287
if (this.id==0) return false;
7288
this.muted=val;
7289
if (val) {l('productMute'+this.id).classList.add('on');l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}
7290
else {l('productMute'+this.id).classList.remove('on');l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}
7291
};
7292
7293
this.draw=function(){};
7294
7295
if (this.id==0)
7296
{
7297
var str='<div class="productButtons">';
7298
str+='<div id="productLevel'+this.id+'" class="productButton productLevel lumpsOnly" onclick="Game.ObjectsById['+this.id+'].levelUp()" '+Game.getDynamicTooltip('Game.ObjectsById['+this.id+'].levelTooltip','this')+'></div>';
7299
str+='<div id="productMinigameButton'+this.id+'" class="productButton productMinigameButton lumpsOnly" onclick="Game.ObjectsById['+this.id+'].switchMinigame(-1);PlaySound(Game.ObjectsById['+this.id+'].onMinigame?\'snd/clickOn.mp3\':\'snd/clickOff.mp3\');"></div>';
7300
str+='</div>';
7301
l('sectionLeftExtra').innerHTML=l('sectionLeftExtra').innerHTML+str;
7302
}
7303
else
7304
{
7305
var str='<div class="row" id="row'+this.id+'"><div class="separatorBottom"></div>';
7306
str+='<div class="productButtons">';
7307
str+='<div id="productLevel'+this.id+'" class="productButton productLevel lumpsOnly" onclick="Game.ObjectsById['+this.id+'].levelUp()" '+Game.getDynamicTooltip('Game.ObjectsById['+this.id+'].levelTooltip','this')+'></div>';
7308
str+='<div id="productMinigameButton'+this.id+'" class="productButton productMinigameButton lumpsOnly" onclick="Game.ObjectsById['+this.id+'].switchMinigame(-1);PlaySound(Game.ObjectsById['+this.id+'].onMinigame?\'snd/clickOn.mp3\':\'snd/clickOff.mp3\');"></div>';
7309
str+='<div class="productButton productMute" '+Game.getTooltip('<div style="width:150px;text-align:center;font-size:11px;"><b>Mute</b><br>(Minimize this building)</div>','this')+' onclick="Game.ObjectsById['+this.id+'].mute(1);PlaySound(Game.ObjectsById['+this.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" id="productMute'+this.id+'">Mute</div>';
7310
str+='</div>';
7311
str+='<canvas class="rowCanvas" id="rowCanvas'+this.id+'"></canvas>';
7312
str+='<div class="rowSpecial" id="rowSpecial'+this.id+'"></div>';
7313
str+='</div>';
7314
l('rows').innerHTML=l('rows').innerHTML+str;
7315
7316
//building canvas
7317
this.pics=[];
7318
7319
this.toResize=true;
7320
this.redraw=function()
7321
{
7322
var me=this;
7323
me.pics=[];
7324
}
7325
this.draw=function()
7326
{
7327
if (this.amount<=0) return false;
7328
if (this.toResize)
7329
{
7330
this.canvas.width=this.canvas.clientWidth;
7331
this.canvas.height=this.canvas.clientHeight;
7332
this.toResize=false;
7333
}
7334
var ctx=this.ctx;
7335
//clear
7336
//ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
7337
ctx.globalAlpha=1;
7338
7339
//pic : a loaded picture or a function returning a loaded picture
7340
//bg : a loaded picture or a function returning a loaded picture - tiled as the background, 128x128
7341
//xV : the pictures will have a random horizontal shift by this many pixels
7342
//yV : the pictures will have a random vertical shift by this many pixels
7343
//w : how many pixels between each picture (or row of pictures)
7344
//x : horizontal offset
7345
//y : vertical offset (+32)
7346
//rows : if >1, arrange the pictures in rows containing this many pictures
7347
//frames : if present, slice the pic in [frames] horizontal slices and pick one at random
7348
7349
var pic=this.art.pic;
7350
var bg=this.art.bg;
7351
var xV=this.art.xV||0;
7352
var yV=this.art.yV||0;
7353
var w=this.art.w||48;
7354
var h=this.art.h||48;
7355
var offX=this.art.x||0;
7356
var offY=this.art.y||0;
7357
var rows=this.art.rows||1;
7358
var frames=this.art.frames||1;
7359
7360
if (typeof(bg)=='string') ctx.fillPattern(Pic(this.art.bg),0,0,this.canvas.width,this.canvas.height,128,128);
7361
else bg(this,ctx);
7362
/*
7363
ctx.globalAlpha=0.5;
7364
if (typeof(bg)=='string')//test
7365
{
7366
ctx.fillPattern(Pic(this.art.bg),-128+Game.T%128,0,this.canvas.width+128,this.canvas.height,128,128);
7367
ctx.fillPattern(Pic(this.art.bg),-128+Math.floor(Game.T/2)%128,-128+Math.floor(Game.T/2)%128,this.canvas.width+128,this.canvas.height+128,128,128);
7368
}
7369
ctx.globalAlpha=1;
7370
*/
7371
var maxI=Math.floor(this.canvas.width/(w/rows)+1);
7372
var iT=Math.min(this.amount,maxI);
7373
var i=this.pics.length;
7374
7375
7376
var x=0;
7377
var y=0;
7378
var added=0;
7379
if (i!=iT)
7380
{
7381
//for (var iter=0;iter<3;iter++)
7382
//{
7383
while (i<iT)
7384
//if (i<iT)
7385
{
7386
Math.seedrandom(Game.seed+' '+this.id+' '+i);
7387
if (rows!=1)
7388
{
7389
x=Math.floor(i/rows)*w+((i%rows)/rows)*w+Math.floor((Math.random()-0.5)*xV)+offX;
7390
y=32+Math.floor((Math.random()-0.5)*yV)+((-rows/2)*32/2+(i%rows)*32/2)+offY;
7391
}
7392
else
7393
{
7394
x=i*w+Math.floor((Math.random()-0.5)*xV)+offX;
7395
y=32+Math.floor((Math.random()-0.5)*yV)+offY;
7396
}
7397
var usedPic=(typeof(pic)=='string'?pic:pic(this,i));
7398
var frame=-1;
7399
if (frames>1) frame=Math.floor(Math.random()*frames);
7400
this.pics.push({x:Math.floor(x),y:Math.floor(y),z:y,pic:usedPic,id:i,frame:frame});
7401
i++;
7402
added++;
7403
}
7404
while (i>iT)
7405
//else if (i>iT)
7406
{
7407
this.pics.sort(Game.sortSpritesById);
7408
this.pics.pop();
7409
i--;
7410
added--;
7411
}
7412
//}
7413
this.pics.sort(Game.sortSprites);
7414
}
7415
7416
var len=this.pics.length;
7417
7418
if (this.mouseOn)
7419
{
7420
var selected=-1;
7421
if (this.name=='Grandma')
7422
{
7423
//mouse detection only fits grandma sprites for now
7424
var marginW=-18;
7425
var marginH=-10;
7426
for (var i=0;i<len;i++)
7427
{
7428
var pic=this.pics[i];
7429
if (this.mousePos[0]>=pic.x-marginW && this.mousePos[0]<pic.x+64+marginW && this.mousePos[1]>=pic.y-marginH && this.mousePos[1]<pic.y+64+marginH) selected=i;
7430
}
7431
if (Game.prefs.customGrandmas && Game.customGrandmaNames.length>0)
7432
{
7433
var str='Names in white were submitted by our supporters on Patreon.';
7434
ctx.globalAlpha=0.75;
7435
ctx.fillStyle='#000';
7436
ctx.font='9px Merriweather';
7437
ctx.textAlign='left';
7438
ctx.fillRect(0,0,ctx.measureText(str).width+4,12);
7439
ctx.globalAlpha=1;
7440
ctx.fillStyle='rgba(255,255,255,0.7)';
7441
ctx.fillText(str,2,8);
7442
ctx.fillStyle='rgba(255,255,255,1)';
7443
ctx.fillText('white',2+ctx.measureText('Names in ').width,8);
7444
}
7445
}
7446
}
7447
7448
Math.seedrandom();
7449
7450
for (var i=0;i<len;i++)
7451
{
7452
var pic=this.pics[i];
7453
var sprite=Pic(pic.pic);
7454
if (selected==i && this.name=='Grandma')
7455
{
7456
ctx.font='14px Merriweather';
7457
ctx.textAlign='center';
7458
Math.seedrandom(Game.seed+' '+pic.id/*+' '+pic.id*/);//(Game.seed+' '+pic.id+' '+pic.x+' '+pic.y);
7459
var years=((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365))+Math.random();//the grandmas age with the game
7460
var name=choose(Game.grandmaNames);
7461
var custom=false;
7462
if (Game.prefs.customGrandmas && Game.customGrandmaNames.length>0 && Math.random()<0.2) {name=choose(Game.customGrandmaNames);custom=true;}
7463
var text=name+', age '+Beautify(Math.floor(70+Math.random()*30+years+this.level));
7464
var width=ctx.measureText(text).width+12;
7465
var x=Math.max(0,Math.min(pic.x+32-width/2+Math.random()*32-16,this.canvas.width-width));
7466
var y=4+Math.random()*8-4;
7467
Math.seedrandom();
7468
ctx.fillStyle='#000';
7469
ctx.strokeStyle='#000';
7470
ctx.lineWidth=8;
7471
ctx.globalAlpha=0.75;
7472
ctx.beginPath();
7473
ctx.moveTo(pic.x+32,pic.y+32);
7474
ctx.lineTo(Math.floor(x+width/2),Math.floor(y+20));
7475
ctx.stroke();
7476
ctx.fillRect(Math.floor(x),Math.floor(y),Math.floor(width),24);
7477
ctx.globalAlpha=1;
7478
if (custom) ctx.fillStyle='#fff';
7479
else ctx.fillStyle='rgba(255,255,255,0.7)';
7480
ctx.fillText(text,Math.floor(x+width/2),Math.floor(y+16));
7481
7482
ctx.drawImage(sprite,Math.floor(pic.x+Math.random()*4-2),Math.floor(pic.y+Math.random()*4-2));
7483
}
7484
//else if (1) ctx.drawImage(sprite,0,0,sprite.width,sprite.height,pic.x,pic.y,sprite.width,sprite.height);
7485
else if (pic.frame!=-1) ctx.drawImage(sprite,(sprite.width/frames)*pic.frame,0,sprite.width/frames,sprite.height,pic.x,pic.y,(sprite.width/frames),sprite.height);
7486
else ctx.drawImage(sprite,pic.x,pic.y);
7487
7488
}
7489
7490
/*
7491
var picX=this.id;
7492
var picY=12;
7493
var w=1;
7494
var h=1;
7495
var w=Math.abs(Math.cos(Game.T*0.2+this.id*2-0.3))*0.2+0.8;
7496
var h=Math.abs(Math.sin(Game.T*0.2+this.id*2))*0.3+0.7;
7497
var x=64+Math.cos(Game.T*0.19+this.id*2)*8-24*w;
7498
var y=128-Math.abs(Math.pow(Math.sin(Game.T*0.2+this.id*2),5)*16)-48*h;
7499
ctx.drawImage(Pic('icons.png'),picX*48,picY*48,48,48,Math.floor(x),Math.floor(y),48*w,48*h);
7500
*/
7501
}
7502
}
7503
7504
Game.last=this;
7505
Game.Objects[this.name]=this;
7506
Game.ObjectsById[this.id]=this;
7507
Game.ObjectsN++;
7508
return this;
7509
}
7510
7511
Game.DrawBuildings=function()//draw building displays with canvas
7512
{
7513
if (Game.drawT%3==0)
7514
{
7515
for (var i in Game.Objects)
7516
{
7517
var me=Game.Objects[i];
7518
if (me.id>0 && !me.onMinigame && !me.muted) me.draw();
7519
else me.pics=[];
7520
}
7521
}
7522
}
7523
7524
Game.sortSprites=function(a,b)
7525
{
7526
if (a.z>b.z) return 1;
7527
else if (a.z<b.z) return -1;
7528
else return 0;
7529
}
7530
Game.sortSpritesById=function(a,b)
7531
{
7532
if (a.id>b.id) return 1;
7533
else if (a.id<b.id) return -1;
7534
else return 0;
7535
}
7536
7537
Game.modifyBuildingPrice=function(building,price)
7538
{
7539
if (Game.Has('Season savings')) price*=0.99;
7540
if (Game.Has('Santa\'s dominion')) price*=0.99;
7541
if (Game.Has('Faberge egg')) price*=0.99;
7542
if (Game.Has('Divine discount')) price*=0.99;
7543
if (Game.Has('Fortune #100')) price*=0.99;
7544
//if (Game.hasAura('Fierce Hoarder')) price*=0.98;
7545
price*=1-Game.auraMult('Fierce Hoarder')*0.02;
7546
if (Game.hasBuff('Everything must go')) price*=0.95;
7547
if (Game.hasBuff('Crafty pixies')) price*=0.98;
7548
if (Game.hasBuff('Nasty goblins')) price*=1.02;
7549
if (building.fortune && Game.Has(building.fortune.name)) price*=0.93;
7550
price*=Game.eff('buildingCost');
7551
if (Game.hasGod)
7552
{
7553
var godLvl=Game.hasGod('creation');
7554
if (godLvl==1) price*=0.93;
7555
else if (godLvl==2) price*=0.95;
7556
else if (godLvl==3) price*=0.98;
7557
}
7558
return price;
7559
}
7560
7561
Game.storeBulkButton=function(id)
7562
{
7563
if (id==0) Game.buyMode=1;
7564
else if (id==1) Game.buyMode=-1;
7565
else if (id==2) Game.buyBulk=1;
7566
else if (id==3) Game.buyBulk=10;
7567
else if (id==4) Game.buyBulk=100;
7568
else if (id==5) Game.buyBulk=-1;
7569
7570
if (Game.buyMode==1 && Game.buyBulk==-1) Game.buyBulk=100;
7571
7572
if (Game.buyMode==1) l('storeBulkBuy').className='storePreButton storeBulkMode selected'; else l('storeBulkBuy').className='storePreButton storeBulkMode';
7573
if (Game.buyMode==-1) l('storeBulkSell').className='storePreButton storeBulkMode selected'; else l('storeBulkSell').className='storePreButton storeBulkMode';
7574
7575
if (Game.buyBulk==1) l('storeBulk1').className='storePreButton storeBulkAmount selected'; else l('storeBulk1').className='storePreButton storeBulkAmount';
7576
if (Game.buyBulk==10) l('storeBulk10').className='storePreButton storeBulkAmount selected'; else l('storeBulk10').className='storePreButton storeBulkAmount';
7577
if (Game.buyBulk==100) l('storeBulk100').className='storePreButton storeBulkAmount selected'; else l('storeBulk100').className='storePreButton storeBulkAmount';
7578
if (Game.buyBulk==-1) l('storeBulkMax').className='storePreButton storeBulkAmount selected'; else l('storeBulkMax').className='storePreButton storeBulkAmount';
7579
7580
if (Game.buyMode==1)
7581
{
7582
l('storeBulkMax').style.visibility='hidden';
7583
l('products').className='storeSection';
7584
}
7585
else
7586
{
7587
l('storeBulkMax').style.visibility='visible';
7588
l('products').className='storeSection selling';
7589
}
7590
7591
Game.storeToRefresh=1;
7592
if (id!=-1) PlaySound('snd/tick.mp3');
7593
}
7594
Game.BuildStore=function()//create the DOM for the store's buildings
7595
{
7596
//if (typeof showAds!=='undefined') l('store').scrollTop=100;
7597
7598
var str='';
7599
str+='<div id="storeBulk" class="storePre" '+Game.getTooltip(
7600
'<div style="padding:8px;min-width:200px;text-align:center;font-size:11px;">You can also press <b>Ctrl</b> to bulk-buy or sell <b>10</b> of a building at a time, or <b>Shift</b> for <b>100</b>.</div>'
7601
,'store')+
7602
'>'+
7603
'<div id="storeBulkBuy" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(0);">Buy</div>'+
7604
'<div id="storeBulkSell" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(1);">Sell</div>'+
7605
'<div id="storeBulk1" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(2);">1</div>'+
7606
'<div id="storeBulk10" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(3);">10</div>'+
7607
'<div id="storeBulk100" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(4);">100</div>'+
7608
'<div id="storeBulkMax" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(5);">all</div>'+
7609
'</div>';
7610
for (var i in Game.Objects)
7611
{
7612
var me=Game.Objects[i];
7613
str+='<div class="product toggledOff" '+Game.getDynamicTooltip('Game.ObjectsById['+me.id+'].tooltip','store')+' id="product'+me.id+'"><div class="icon off" id="productIconOff'+me.id+'" style=""></div><div class="icon" id="productIcon'+me.id+'" style=""></div><div class="content"><div class="lockedTitle">???</div><div class="title" id="productName'+me.id+'"></div><span class="priceMult" id="productPriceMult'+me.id+'"></span><span class="price" id="productPrice'+me.id+'"></span><div class="title owned" id="productOwned'+me.id+'"></div></div>'+
7614
/*'<div class="buySell"><div style="left:0px;" id="buttonBuy10-'+me.id+'">Buy 10</div><div style="left:100px;" id="buttonSell-'+me.id+'">Sell 1</div><div style="left:200px;" id="buttonSellAll-'+me.id+'">Sell all</div></div>'+*/
7615
'</div>';
7616
}
7617
l('products').innerHTML=str;
7618
7619
Game.storeBulkButton(-1);
7620
7621
var SellAllPrompt=function(id)
7622
{
7623
return function(id){Game.Prompt('<div class="block">Do you really want to sell your '+Game.ObjectsById[id].amount+' '+(Game.ObjectsById[id].amount==1?Game.ObjectsById[id].single:Game.ObjectsById[id].plural)+'?</div>',[['Yes','Game.ObjectsById['+id+'].sell(-1);Game.ClosePrompt();'],['No','Game.ClosePrompt();']]);}(id);
7624
}
7625
7626
Game.ClickProduct=function(what)
7627
{
7628
Game.ObjectsById[what].buy();
7629
}
7630
7631
for (var i in Game.Objects)
7632
{
7633
var me=Game.Objects[i];
7634
me.l=l('product'+me.id);
7635
7636
//these are a bit messy but ah well
7637
if (!Game.touchEvents)
7638
{
7639
AddEvent(me.l,'click',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));
7640
}
7641
else
7642
{
7643
AddEvent(me.l,'touchend',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));
7644
}
7645
}
7646
}
7647
7648
Game.RefreshStore=function()//refresh the store's buildings
7649
{
7650
for (var i in Game.Objects)
7651
{
7652
Game.Objects[i].refresh();
7653
}
7654
Game.storeToRefresh=0;
7655
}
7656
7657
Game.ComputeCps=function(base,mult,bonus)
7658
{
7659
if (!bonus) bonus=0;
7660
return ((base)*(Math.pow(2,mult))+bonus);
7661
}
7662
7663
Game.isMinigameReady=function(me)
7664
{return (me.minigameUrl && me.minigameLoaded && me.level>0);}
7665
Game.scriptBindings=[];
7666
Game.LoadMinigames=function()//load scripts for each minigame
7667
{
7668
for (var i in Game.Objects)
7669
{
7670
var me=Game.Objects[i];
7671
if (me.minigameUrl && me.level>0 && !me.minigameLoaded && !me.minigameLoading && !l('minigameScript-'+me.id))
7672
{
7673
me.minigameLoading=true;
7674
//we're only loading the minigame scripts that aren't loaded yet and which have enough building level
7675
//we call this function on building level up and on load
7676
//console.log('Loading script '+me.minigameUrl+'...');
7677
setTimeout(function(me){return function(){
7678
var script=document.createElement('script');
7679
script.id='minigameScript-'+me.id;
7680
Game.scriptBindings['minigameScript-'+me.id]=me;
7681
script.setAttribute('src',me.minigameUrl+'?r='+Game.version);
7682
script.onload=function(me,script){return function(){
7683
if (!me.minigameLoaded) Game.scriptLoaded(me,script);
7684
}}(me,'minigameScript-'+me.id);
7685
document.head.appendChild(script);
7686
}}(me),10);
7687
}
7688
}
7689
}
7690
Game.scriptLoaded=function(who,script)
7691
{
7692
who.minigameLoading=false;
7693
who.minigameLoaded=true;
7694
who.refresh();
7695
who.minigame.launch();
7696
if (who.minigameSave) {who.minigame.reset(true);who.minigame.load(who.minigameSave);who.minigameSave=0;}
7697
}
7698
7699
Game.magicCpS=function(what)
7700
{
7701
/*
7702
if (Game.Objects[what].amount>=250)
7703
{
7704
//this makes buildings give 1% more cookies for every building over 250.
7705
//this turns out to be rather stupidly overpowered.
7706
var n=Game.Objects[what].amount-250;
7707
return 1+Math.pow(1.01,n);
7708
}
7709
else return 1;
7710
*/
7711
return 1;
7712
}
7713
7714
//define objects
7715
new Game.Object('Cursor','cursor|cursors|clicked|[X] extra finger|[X] extra fingers','Autoclicks once every 10 seconds.',0,0,{},15,function(me){
7716
var add=0;
7717
if (Game.Has('Thousand fingers')) add+= 0.1;
7718
if (Game.Has('Million fingers')) add*= 5;
7719
if (Game.Has('Billion fingers')) add*= 10;
7720
if (Game.Has('Trillion fingers')) add*= 20;
7721
if (Game.Has('Quadrillion fingers')) add*= 20;
7722
if (Game.Has('Quintillion fingers')) add*= 20;
7723
if (Game.Has('Sextillion fingers')) add*= 20;
7724
if (Game.Has('Septillion fingers')) add*= 20;
7725
if (Game.Has('Octillion fingers')) add*= 20;
7726
if (Game.Has('Nonillion fingers')) add*= 20;
7727
var mult=1;
7728
var num=0;
7729
for (var i in Game.Objects) {if (Game.Objects[i].name!='Cursor') num+=Game.Objects[i].amount;}
7730
add=add*num;
7731
mult*=Game.GetTieredCpsMult(me);
7732
mult*=Game.magicCpS('Cursor');
7733
mult*=Game.eff('cursorCps');
7734
return Game.ComputeCps(0.1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add)*mult;
7735
},function(){
7736
if (this.amount>=1) Game.Unlock(['Reinforced index finger','Carpal tunnel prevention cream']);
7737
if (this.amount>=10) Game.Unlock('Ambidextrous');
7738
if (this.amount>=25) Game.Unlock('Thousand fingers');
7739
if (this.amount>=50) Game.Unlock('Million fingers');
7740
if (this.amount>=100) Game.Unlock('Billion fingers');
7741
if (this.amount>=150) Game.Unlock('Trillion fingers');
7742
if (this.amount>=200) Game.Unlock('Quadrillion fingers');
7743
if (this.amount>=250) Game.Unlock('Quintillion fingers');
7744
if (this.amount>=300) Game.Unlock('Sextillion fingers');
7745
if (this.amount>=350) Game.Unlock('Septillion fingers');
7746
if (this.amount>=400) Game.Unlock('Octillion fingers');
7747
if (this.amount>=450) Game.Unlock('Nonillion fingers');
7748
7749
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');if (this.amount>=300) Game.Win('Extreme polydactyly');if (this.amount>=400) Game.Win('Dr. T');if (this.amount>=500) Game.Win('Thumbs, phalanges, metacarpals');if (this.amount>=600) Game.Win('With her finger and her thumb');if (this.amount>=700) Game.Win('Gotta hand it to you');if (this.amount>=800) Game.Win('The devil\'s workshop');
7750
});
7751
7752
Game.SpecialGrandmaUnlock=15;
7753
new Game.Object('Grandma','grandma|grandmas|baked|Grandmas are [X] year older|Grandmas are [X] years older','A nice grandma to bake more cookies.',1,1,{pic:function(i){
7754
var list=['grandma'];
7755
if (Game.Has('Farmer grandmas')) list.push('farmerGrandma');
7756
if (Game.Has('Worker grandmas')) list.push('workerGrandma');
7757
if (Game.Has('Miner grandmas')) list.push('minerGrandma');
7758
if (Game.Has('Cosmic grandmas')) list.push('cosmicGrandma');
7759
if (Game.Has('Transmuted grandmas')) list.push('transmutedGrandma');
7760
if (Game.Has('Altered grandmas')) list.push('alteredGrandma');
7761
if (Game.Has('Grandmas\' grandmas')) list.push('grandmasGrandma');
7762
if (Game.Has('Antigrandmas')) list.push('antiGrandma');
7763
if (Game.Has('Rainbow grandmas')) list.push('rainbowGrandma');
7764
if (Game.Has('Banker grandmas')) list.push('bankGrandma');
7765
if (Game.Has('Priestess grandmas')) list.push('templeGrandma');
7766
if (Game.Has('Witch grandmas')) list.push('witchGrandma');
7767
if (Game.Has('Lucky grandmas')) list.push('luckyGrandma');
7768
if (Game.Has('Metagrandmas')) list.push('metaGrandma');
7769
if (Game.Has('Script grannies')) list.push('scriptGrandma');
7770
if (Game.Has('Alternate grandmas')) list.push('alternateGrandma');
7771
if (Game.season=='christmas') list.push('elfGrandma');
7772
if (Game.season=='easter') list.push('bunnyGrandma');
7773
return choose(list)+'.png';
7774
},bg:'grandmaBackground.png',xV:8,yV:8,w:32,rows:3,x:0,y:16},100,function(me){
7775
var mult=1;
7776
for (var i in Game.GrandmaSynergies)
7777
{
7778
if (Game.Has(Game.GrandmaSynergies[i])) mult*=2;
7779
}
7780
if (Game.Has('Bingo center/Research facility')) mult*=4;
7781
if (Game.Has('Ritual rolling pins')) mult*=2;
7782
if (Game.Has('Naughty list')) mult*=2;
7783
7784
if (Game.Has('Elderwort biscuits')) mult*=1.02;
7785
7786
mult*=Game.eff('grandmaCps');
7787
7788
if (Game.Has('Cat ladies'))
7789
{
7790
for (var i=0;i<Game.UpgradesByPool['kitten'].length;i++)
7791
{
7792
if (Game.Has(Game.UpgradesByPool['kitten'][i].name)) mult*=1.29;
7793
}
7794
}
7795
7796
mult*=Game.GetTieredCpsMult(me);
7797
7798
var add=0;
7799
if (Game.Has('One mind')) add+=Game.Objects['Grandma'].amount*0.02;
7800
if (Game.Has('Communal brainsweep')) add+=Game.Objects['Grandma'].amount*0.02;
7801
if (Game.Has('Elder Pact')) add+=Game.Objects['Portal'].amount*0.05;
7802
7803
var num=0;
7804
for (var i in Game.Objects) {if (Game.Objects[i].name!='Grandma') num+=Game.Objects[i].amount;}
7805
//if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
7806
mult*=1+Game.auraMult('Elder Battalion')*0.01*num;
7807
7808
mult*=Game.magicCpS(me.name);
7809
7810
return (me.baseCps+add)*mult;
7811
},function(){
7812
Game.UnlockTiered(this);
7813
});
7814
Game.last.sellFunction=function()
7815
{
7816
Game.Win('Just wrong');
7817
if (this.amount==0)
7818
{
7819
Game.Lock('Elder Pledge');
7820
Game.CollectWrinklers();
7821
Game.pledgeT=0;
7822
}
7823
};
7824
Game.last.iconFunc=function(type){
7825
var grandmaIcons=[[0,1],[0,2],[1,2],[2,2]];
7826
if (type=='off') return [0,1];
7827
return grandmaIcons[Game.elderWrath];
7828
};
7829
7830
7831
new Game.Object('Farm','farm|farms|harvested|[X] more acre|[X] more acres','Grows cookie plants from cookie seeds.',3,2,{base:'farm',xV:8,yV:8,w:64,rows:2,x:0,y:16},500,function(me){
7832
var mult=1;
7833
mult*=Game.GetTieredCpsMult(me);
7834
mult*=Game.magicCpS(me.name);
7835
return me.baseCps*mult;
7836
},function(){
7837
Game.UnlockTiered(this);
7838
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7839
});
7840
Game.last.minigameUrl='minigameGarden.js';
7841
Game.last.minigameName='Garden';
7842
7843
new Game.Object('Mine','mine|mines|mined|[X] mile deeper|[X] miles deeper','Mines out cookie dough and chocolate chips.',4,3,{base:'mine',xV:16,yV:16,w:64,rows:2,x:0,y:24},10000,function(me){
7844
var mult=1;
7845
mult*=Game.GetTieredCpsMult(me);
7846
mult*=Game.magicCpS(me.name);
7847
return me.baseCps*mult;
7848
},function(){
7849
Game.UnlockTiered(this);
7850
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7851
});
7852
7853
new Game.Object('Factory','factory|factories|mass-produced|[X] additional patent|[X] additional patents','Produces large quantities of cookies.',5,4,{base:'factory',xV:8,yV:0,w:64,rows:1,x:0,y:-22},3000,function(me){
7854
var mult=1;
7855
mult*=Game.GetTieredCpsMult(me);
7856
mult*=Game.magicCpS(me.name);
7857
return me.baseCps*mult;
7858
},function(){
7859
Game.UnlockTiered(this);
7860
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7861
});
7862
//Game.last.minigameUrl='minigameDungeon.js';//not yet
7863
Game.last.minigameName='Dungeon';
7864
7865
new Game.Object('Bank','bank|banks|banked|Interest rates [X]% better|Interest rates [X]% better','Generates cookies from interest.',6,15,{base:'bank',xV:8,yV:4,w:56,rows:1,x:0,y:13},0,function(me){
7866
var mult=1;
7867
mult*=Game.GetTieredCpsMult(me);
7868
mult*=Game.magicCpS(me.name);
7869
return me.baseCps*mult;
7870
},function(){
7871
Game.UnlockTiered(this);
7872
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7873
});
7874
Game.last.minigameUrl='minigameMarket.js';
7875
Game.last.minigameName='Stock Market';
7876
7877
new Game.Object('Temple','temple|temples|discovered|[X] sacred artifact retrieved|[X] sacred artifacts retrieved','Full of precious, ancient chocolate.',7,16,{base:'temple',xV:8,yV:4,w:72,rows:2,x:0,y:-5},0,function(me){
7878
var mult=1;
7879
mult*=Game.GetTieredCpsMult(me);
7880
mult*=Game.magicCpS(me.name);
7881
return me.baseCps*mult;
7882
},function(){
7883
Game.UnlockTiered(this);
7884
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7885
});
7886
Game.last.minigameUrl='minigamePantheon.js';
7887
Game.last.minigameName='Pantheon';
7888
7889
new Game.Object('Wizard tower','wizard tower|wizard towers|summoned|Incantations have [X] more syllable|Incantations have [X] more syllables','Summons cookies with magic spells.',8,17,{base:'wizardtower',xV:16,yV:16,w:48,rows:2,x:0,y:20},0,function(me){
7890
var mult=1;
7891
mult*=Game.GetTieredCpsMult(me);
7892
mult*=Game.magicCpS(me.name);
7893
return me.baseCps*mult;
7894
},function(){
7895
Game.UnlockTiered(this);
7896
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7897
});
7898
Game.last.displayName='<span style="font-size:90%;letter-spacing:-1px;position:relative;bottom:2px;">Wizard tower</span>';//shrink
7899
Game.last.minigameUrl='minigameGrimoire.js';
7900
Game.last.minigameName='Grimoire';
7901
7902
new Game.Object('Shipment','shipment|shipments|shipped|[X] galaxy fully explored|[X] galaxies fully explored','Brings in fresh cookies from the cookie planet.',9,5,{base:'shipment',xV:16,yV:16,w:64,rows:1,x:0,y:0},40000,function(me){
7903
var mult=1;
7904
mult*=Game.GetTieredCpsMult(me);
7905
mult*=Game.magicCpS(me.name);
7906
return me.baseCps*mult;
7907
},function(){
7908
Game.UnlockTiered(this);
7909
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7910
});
7911
7912
new Game.Object('Alchemy lab','alchemy lab|alchemy labs|transmuted|[X] primordial element mastered|[X] primordial elements mastered','Turns gold into cookies!',10,6,{base:'alchemylab',xV:16,yV:16,w:64,rows:2,x:0,y:16},200000,function(me){
7913
var mult=1;
7914
mult*=Game.GetTieredCpsMult(me);
7915
mult*=Game.magicCpS(me.name);
7916
return me.baseCps*mult;
7917
},function(){
7918
Game.UnlockTiered(this);
7919
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7920
});
7921
Game.last.displayName='<span style="font-size:90%;letter-spacing:-1px;position:relative;bottom:2px;">Alchemy lab</span>';//shrink
7922
7923
new Game.Object('Portal','portal|portals|retrieved|[X] dimension enslaved|[X] dimensions enslaved','Opens a door to the Cookieverse.',11,7,{base:'portal',xV:32,yV:32,w:64,rows:2,x:0,y:0},1666666,function(me){
7924
var mult=1;
7925
mult*=Game.GetTieredCpsMult(me);
7926
mult*=Game.magicCpS(me.name);
7927
return me.baseCps*mult;
7928
},function(){
7929
Game.UnlockTiered(this);
7930
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7931
});
7932
7933
new Game.Object('Time machine','time machine|time machines|recovered|[X] century secured|[X] centuries secured','Brings cookies from the past, before they were even eaten.',12,8,{base:'timemachine',xV:32,yV:32,w:64,rows:1,x:0,y:0},123456789,function(me){
7934
var mult=1;
7935
mult*=Game.GetTieredCpsMult(me);
7936
mult*=Game.magicCpS(me.name);
7937
return me.baseCps*mult;
7938
},function(){
7939
Game.UnlockTiered(this);
7940
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7941
});
7942
Game.last.displayName='<span style="font-size:80%;letter-spacing:-1px;position:relative;bottom:3px;">Time machine</span>';//shrink
7943
7944
new Game.Object('Antimatter condenser','antimatter condenser|antimatter condensers|condensed|[X] extra quark flavor|[X] extra quark flavors','Condenses the antimatter in the universe into cookies.',13,13,{base:'antimattercondenser',xV:0,yV:64,w:64,rows:1,x:0,y:0},3999999999,function(me){
7945
var mult=1;
7946
mult*=Game.GetTieredCpsMult(me);
7947
mult*=Game.magicCpS(me.name);
7948
return me.baseCps*mult;
7949
},function(){
7950
Game.UnlockTiered(this);
7951
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7952
});
7953
Game.last.displayName='<span style="font-size:65%;letter-spacing:-1px;position:relative;bottom:4px;">Antim. condenser</span>';//shrink
7954
7955
new Game.Object('Prism','prism|prisms|converted|[X] new color discovered|[X] new colors discovered','Converts light itself into cookies.',14,14,{base:'prism',xV:16,yV:4,w:64,rows:1,x:0,y:20},75000000000,function(me){
7956
var mult=1;
7957
mult*=Game.GetTieredCpsMult(me);
7958
mult*=Game.magicCpS(me.name);
7959
return me.baseCps*mult;
7960
},function(){
7961
Game.UnlockTiered(this);
7962
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7963
});
7964
7965
new Game.Object('Chancemaker','chancemaker|chancemakers|spontaneously generated|Chancemakers are powered by [X]-leaf clovers|Chancemakers are powered by [X]-leaf clovers','Generates cookies out of thin air through sheer luck.',15,19,{base:'chancemaker',xV:8,yV:64,w:64,rows:1,x:0,y:0,rows:2},77777777777,function(me){
7966
var mult=1;
7967
mult*=Game.GetTieredCpsMult(me);
7968
mult*=Game.magicCpS(me.name);
7969
return me.baseCps*mult;
7970
},function(){
7971
Game.UnlockTiered(this);
7972
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7973
});
7974
Game.last.displayName='<span style="font-size:85%;letter-spacing:-1px;position:relative;bottom:2px;">Chancemaker</span>';//shrink
7975
7976
new Game.Object('Fractal engine','fractal engine|fractal engines|made from cookies|[X] iteration deep|[X] iterations deep','Turns cookies into even more cookies.',16,20,{base:'fractalEngine',xV:8,yV:64,w:64,rows:1,x:0,y:0},12345678987654321,function(me){
7977
var mult=1;
7978
mult*=Game.GetTieredCpsMult(me);
7979
mult*=Game.magicCpS(me.name);
7980
return me.baseCps*mult;
7981
},function(){
7982
Game.UnlockTiered(this);
7983
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7984
});
7985
Game.last.displayName='<span style="font-size:80%;letter-spacing:-1px;position:relative;bottom:4px;">Fractal engine</span>';//shrink
7986
7987
new Game.Object('Javascript console','javascript console|javascript consoles|programmed|Equipped with [X] external library|Equipped with [X] external libraries','Creates cookies from the very code this game was written in.',17,32,{base:'javascriptconsole',xV:8,yV:64,w:14,rows:1,x:8,y:-32,frames:2},12345678987654321,function(me){
7988
var mult=1;
7989
mult*=Game.GetTieredCpsMult(me);
7990
mult*=Game.magicCpS(me.name);
7991
return me.baseCps*mult;
7992
},function(){
7993
Game.UnlockTiered(this);
7994
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7995
});
7996
Game.last.displayName='<span style="font-size:65%;letter-spacing:-1px;position:relative;bottom:4px;">Javascript console</span>';//shrink
7997
7998
new Game.Object('Idleverse','idleverse|idleverses|hijacked|[X] manifold|[X] manifolds','There\'s been countless other idle universes running alongside our own. You\'ve finally found a way to hijack their production and convert whatever they\'ve been making into cookies!',18,33,{base:'idleverse',xV:8,yV:64,w:48,rows:2,x:0,y:0,frames:4},12345678987654321,function(me){
7999
var mult=1;
8000
mult*=Game.GetTieredCpsMult(me);
8001
mult*=Game.magicCpS(me.name);
8002
return me.baseCps*mult;
8003
},function(){
8004
Game.UnlockTiered(this);
8005
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
8006
});
8007
8008
Game.foolObjects={
8009
'Unknown':{name:'Investment',desc:'You\'re not sure what this does, you just know it means profit.',icon:0},
8010
'Cursor':{name:'Rolling pin',desc:'Essential in flattening dough. The first step in cookie-making.',icon:0},
8011
'Grandma':{name:'Oven',desc:'A crucial element of baking cookies.',icon:1},
8012
'Farm':{name:'Kitchen',desc:'The more kitchens, the more cookies your employees can produce.',icon:2},
8013
'Mine':{name:'Secret recipe',desc:'These give you the edge you need to outsell those pesky competitors.',icon:3},
8014
'Factory':{name:'Factory',desc:'Mass production is the future of baking. Seize the day, and synergize!',icon:4},
8015
'Bank':{name:'Investor',desc:'Business folks with a nose for profit, ready to finance your venture as long as there\'s money to be made.',icon:5},
8016
'Temple':{name:'Like',desc:'Your social media page is going viral! Amassing likes is the key to a lasting online presence and juicy advertising deals.',icon:9},
8017
'Wizard tower':{name:'Meme',desc:'Cookie memes are all the rage! With just the right amount of social media astroturfing, your brand image will be all over the cyberspace.',icon:6},
8018
'Shipment':{name:'Supermarket',desc:'A gigantic cookie emporium - your very own retail chain.',icon:7},
8019
'Alchemy lab':{name:'Stock share',desc:'You\'re officially on the stock market, and everyone wants a piece!',icon:8},
8020
'Portal':{name:'TV show',desc:'Your cookies have their own sitcom! Hilarious baking hijinks set to the cheesiest laughtrack.',icon:10},
8021
'Time machine':{name:'Theme park',desc:'Cookie theme parks, full of mascots and roller-coasters. Build one, build a hundred!',icon:11},
8022
'Antimatter condenser':{name:'Cookiecoin',desc:'A virtual currency, already replacing regular money in some small countries.',icon:12},
8023
'Prism':{name:'Corporate country',desc:'You\'ve made it to the top, and you can now buy entire nations to further your corporate greed. Godspeed.',icon:13},
8024
'Chancemaker':{name:'Privatized planet',desc:'Actually, you know what\'s cool? A whole planet dedicated to producing, advertising, selling, and consuming your cookies.',icon:15},
8025
'Fractal engine':{name:'Senate seat',desc:'Only through political dominion can you truly alter this world to create a brighter, more cookie-friendly future.',icon:16},
8026
'Javascript console':{name:'Doctrine',desc:'Taking many forms -religion, culture, philosophy- a doctrine may, when handled properly, cause a lasting impact on civilizations, reshaping minds and people and ensuring all future generations share a singular goal - the production, and acquisition, of more cookies.',icon:17},
8027
'Idleverse':{name:'Lateral expansions',desc:'Sometimes the best way to keep going up is sideways. Diversify your ventures through non-cookie investments.',icon:18},
8028
};
8029
8030
8031
//build store
8032
Game.BuildStore();
8033
8034
//build master bar
8035
var str='';
8036
str+='<div id="buildingsMute" class="shadowFilter" style="position:relative;z-index:100;padding:4px 16px 0px 64px;"></div>';
8037
str+='<div class="separatorBottom" style="position:absolute;bottom:-8px;z-index:0;"></div>';
8038
l('buildingsMaster').innerHTML=str;
8039
8040
//build object displays
8041
var muteStr='<div style="position:absolute;left:8px;bottom:12px;opacity:0.5;">Muted :</div>';
8042
for (var i in Game.Objects)
8043
{
8044
var me=Game.Objects[i];
8045
if (me.id>0)
8046
{
8047
me.canvas=l('rowCanvas'+me.id);
8048
me.ctx=me.canvas.getContext('2d',{alpha:false});
8049
me.pics=[];
8050
var icon=[0*64,me.icon*64];
8051
muteStr+='<div class="tinyProductIcon" id="mutedProduct'+me.id+'" style="display:none;background-position:-'+icon[0]+'px -'+icon[1]+'px;" '+Game.clickStr+'="Game.ObjectsById['+me.id+'].mute(0);PlaySound(Game.ObjectsById['+me.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" '+Game.getDynamicTooltip('Game.mutedBuildingTooltip('+me.id+')','this')+'></div>';
8052
//muteStr+='<div class="tinyProductIcon" id="mutedProduct'+me.id+'" style="display:none;background-position:-'+icon[0]+'px -'+icon[1]+'px;" '+Game.clickStr+'="Game.ObjectsById['+me.id+'].mute(0);PlaySound(Game.ObjectsById['+me.id+'].muted?\'snd/clickOff.mp3\':\'snd/clickOn.mp3\');" '+Game.getTooltip('<div style="width:150px;text-align:center;font-size:11px;"><b>Unmute '+me.plural+'</b><br>(Display this building)</div>')+'></div>';
8053
8054
AddEvent(me.canvas,'mouseover',function(me){return function(){me.mouseOn=true;}}(me));
8055
AddEvent(me.canvas,'mouseout',function(me){return function(){me.mouseOn=false;}}(me));
8056
AddEvent(me.canvas,'mousemove',function(me){return function(e){var box=this.getBoundingClientRect();me.mousePos[0]=e.pageX-box.left;me.mousePos[1]=e.pageY-box.top;}}(me));
8057
}
8058
}
8059
Game.mutedBuildingTooltip=function(id)
8060
{
8061
return function(){
8062
var me=Game.ObjectsById[id];
8063
return '<div style="width:150px;text-align:center;font-size:11px;"><b>'+(me.plural.charAt(0).toUpperCase()+me.plural.slice(1))+(me.level>0?' (lvl.&nbsp;'+me.level+')':'')+'</b><div class="line"></div>Click to unmute '+me.plural+'<br>(display this building)</div>';
8064
}
8065
}
8066
l('buildingsMute').innerHTML=muteStr;
8067
8068
/*=====================================================================================
8069
UPGRADES
8070
=======================================================================================*/
8071
Game.upgradesToRebuild=1;
8072
Game.Upgrades=[];
8073
Game.UpgradesById=[];
8074
Game.UpgradesN=0;
8075
Game.UpgradesInStore=[];
8076
Game.UpgradesOwned=0;
8077
Game.Upgrade=function(name,desc,price,icon,buyFunction)
8078
{
8079
this.id=Game.UpgradesN;
8080
this.name=name;
8081
this.desc=desc;
8082
this.baseDesc=this.desc;
8083
this.desc=BeautifyInText(this.baseDesc);
8084
this.basePrice=price;
8085
this.priceLumps=0;//note : doesn't do much on its own, you still need to handle the buying yourself
8086
this.icon=icon;
8087
this.iconFunction=0;
8088
this.buyFunction=buyFunction;
8089
/*this.unlockFunction=unlockFunction;
8090
this.unlocked=(this.unlockFunction?0:1);*/
8091
this.unlocked=0;
8092
this.bought=0;
8093
this.order=this.id;
8094
if (order) this.order=order+this.id*0.001;
8095
this.pool='';//can be '', cookie, toggle, debug, prestige, prestigeDecor, tech, or unused
8096
if (pool) this.pool=pool;
8097
this.power=0;
8098
if (power) this.power=power;
8099
this.vanilla=Game.vanilla;
8100
this.unlockAt=0;
8101
this.techUnlock=[];
8102
this.parents=[];
8103
this.type='upgrade';
8104
this.tier=0;
8105
this.buildingTie=0;//of what building is this a tiered upgrade of ?
8106
8107
Game.last=this;
8108
Game.Upgrades[this.name]=this;
8109
Game.UpgradesById[this.id]=this;
8110
Game.UpgradesN++;
8111
return this;
8112
}
8113
8114
Game.Upgrade.prototype.getPrice=function()
8115
{
8116
var price=this.basePrice;
8117
if (this.priceFunc) price=this.priceFunc(this);
8118
if (price==0) return 0;
8119
if (this.pool!='prestige')
8120
{
8121
if (Game.Has('Toy workshop')) price*=0.95;
8122
if (Game.Has('Five-finger discount')) price*=Math.pow(0.99,Game.Objects['Cursor'].amount/100);
8123
if (Game.Has('Santa\'s dominion')) price*=0.98;
8124
if (Game.Has('Faberge egg')) price*=0.99;
8125
if (Game.Has('Divine sales')) price*=0.99;
8126
if (Game.Has('Fortune #100')) price*=0.99;
8127
if (this.kitten && Game.Has('Kitten wages')) price*=0.9;
8128
if (Game.hasBuff('Haggler\'s luck')) price*=0.98;
8129
if (Game.hasBuff('Haggler\'s misery')) price*=1.02;
8130
//if (Game.hasAura('Master of the Armory')) price*=0.98;
8131
price*=1-Game.auraMult('Master of the Armory')*0.02;
8132
price*=Game.eff('upgradeCost');
8133
if (this.pool=='cookie' && Game.Has('Divine bakeries')) price/=5;
8134
}
8135
return Math.ceil(price);
8136
}
8137
8138
Game.Upgrade.prototype.canBuy=function()
8139
{
8140
if (this.canBuyFunc) return this.canBuyFunc();
8141
if (Game.cookies>=this.getPrice()) return true; else return false;
8142
}
8143
8144
Game.storeBuyAll=function()
8145
{
8146
if (!Game.Has('Inspired checklist')) return false;
8147
for (var i in Game.UpgradesInStore)
8148
{
8149
var me=Game.UpgradesInStore[i];
8150
if (!me.isVaulted() && me.pool!='toggle' && me.pool!='tech') me.buy(1);
8151
}
8152
}
8153
8154
Game.vault=[];
8155
Game.Upgrade.prototype.isVaulted=function()
8156
{
8157
if (Game.vault.indexOf(this.id)!=-1) return true; else return false;
8158
}
8159
Game.Upgrade.prototype.vault=function()
8160
{
8161
if (!this.isVaulted()) Game.vault.push(this.id);
8162
}
8163
Game.Upgrade.prototype.unvault=function()
8164
{
8165
if (this.isVaulted()) Game.vault.splice(Game.vault.indexOf(this.id),1);
8166
}
8167
8168
Game.Upgrade.prototype.click=function(e)
8169
{
8170
if ((e && e.shiftKey) || Game.keys[16])
8171
{
8172
if (this.pool=='toggle' || this.pool=='tech') {}
8173
else if (Game.Has('Inspired checklist'))
8174
{
8175
if (this.isVaulted()) this.unvault();
8176
else this.vault();
8177
Game.upgradesToRebuild=1;
8178
PlaySound('snd/tick.mp3');
8179
}
8180
}
8181
else this.buy();
8182
}
8183
8184
8185
Game.Upgrade.prototype.buy=function(bypass)
8186
{
8187
var success=0;
8188
var cancelPurchase=0;
8189
if (this.clickFunction && !bypass) cancelPurchase=!this.clickFunction();
8190
if (!cancelPurchase)
8191
{
8192
if (this.choicesFunction)
8193
{
8194
if (Game.choiceSelectorOn==this.id)
8195
{
8196
l('toggleBox').style.display='none';
8197
l('toggleBox').innerHTML='';
8198
Game.choiceSelectorOn=-1;
8199
PlaySound('snd/tick.mp3');
8200
}
8201
else
8202
{
8203
Game.choiceSelectorOn=this.id;
8204
var choices=this.choicesFunction();
8205
if (choices.length>0)
8206
{
8207
var selected=0;
8208
for (var i in choices) {if (choices[i].selected) selected=i;}
8209
Game.choiceSelectorChoices=choices;//this is a really dumb way of doing this i am so sorry
8210
Game.choiceSelectorSelected=selected;
8211
var str='';
8212
str+='<div class="close" onclick="Game.UpgradesById['+this.id+'].buy();">x</div>';
8213
str+='<h3>'+this.name+'</h3>'+
8214
'<div class="line"></div>'+
8215
'<h4 id="choiceSelectedName">'+choices[selected].name+'</h4>'+
8216
'<div class="line"></div>';
8217
8218
for (var i in choices)
8219
{
8220
choices[i].id=i;
8221
choices[i].order=choices[i].order||0;
8222
}
8223
8224
var sortMap=function(a,b)
8225
{
8226
if (a.order>b.order) return 1;
8227
else if (a.order<b.order) return -1;
8228
else return 0;
8229
}
8230
choices.sort(sortMap);
8231
8232
for (var i=0;i<choices.length;i++)
8233
{
8234
if (!choices[i]) continue;
8235
var icon=choices[i].icon;
8236
var id=choices[i].id;
8237
if (choices[i].div) str+='<div class="line"></div>';
8238
str+='<div class="crate enabled'+(id==selected?' highlighted':'')+'" style="opacity:1;float:none;display:inline-block;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="Game.UpgradesById['+this.id+'].choicesPick('+id+');Game.choiceSelectorOn=-1;Game.UpgradesById['+this.id+'].buy();" onMouseOut="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices[Game.choiceSelectorSelected].name;" onMouseOver="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices['+i+'].name;"'+
8239
'></div>';
8240
}
8241
}
8242
l('toggleBox').innerHTML=str;
8243
l('toggleBox').style.display='block';
8244
l('toggleBox').focus();
8245
Game.tooltip.hide();
8246
PlaySound('snd/tick.mp3');
8247
success=1;
8248
}
8249
}
8250
else if (this.pool!='prestige')
8251
{
8252
var price=this.getPrice();
8253
if (this.canBuy() && !this.bought)
8254
{
8255
Game.Spend(price);
8256
this.bought=1;
8257
if (this.buyFunction) this.buyFunction();
8258
if (this.toggleInto)
8259
{
8260
Game.Lock(this.toggleInto);
8261
Game.Unlock(this.toggleInto);
8262
}
8263
Game.upgradesToRebuild=1;
8264
Game.recalculateGains=1;
8265
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
8266
Game.setOnCrate(0);
8267
Game.tooltip.hide();
8268
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
8269
success=1;
8270
}
8271
}
8272
else
8273
{
8274
var price=this.getPrice();
8275
if (Game.heavenlyChips>=price && !this.bought)
8276
{
8277
Game.heavenlyChips-=price;
8278
Game.heavenlyChipsSpent+=price;
8279
this.unlocked=1;
8280
this.bought=1;
8281
if (this.buyFunction) this.buyFunction();
8282
Game.BuildAscendTree();
8283
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
8284
PlaySound('snd/shimmerClick.mp3');
8285
//PlaySound('snd/buyHeavenly.mp3');
8286
success=1;
8287
}
8288
}
8289
}
8290
if (this.bought && this.activateFunction) this.activateFunction();
8291
return success;
8292
}
8293
Game.Upgrade.prototype.earn=function()//just win the upgrades without spending anything
8294
{
8295
this.unlocked=1;
8296
this.bought=1;
8297
if (this.buyFunction) this.buyFunction();
8298
Game.upgradesToRebuild=1;
8299
Game.recalculateGains=1;
8300
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
8301
}
8302
Game.Upgrade.prototype.unearn=function()//remove the upgrade, but keep it unlocked
8303
{
8304
this.bought=0;
8305
Game.upgradesToRebuild=1;
8306
Game.recalculateGains=1;
8307
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
8308
}
8309
Game.Upgrade.prototype.unlock=function()
8310
{
8311
this.unlocked=1;
8312
Game.upgradesToRebuild=1;
8313
}
8314
Game.Upgrade.prototype.lose=function()
8315
{
8316
this.unlocked=0;
8317
this.bought=0;
8318
Game.upgradesToRebuild=1;
8319
Game.recalculateGains=1;
8320
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
8321
}
8322
Game.Upgrade.prototype.toggle=function()//cheating only
8323
{
8324
if (!this.bought)
8325
{
8326
this.bought=1;
8327
if (this.buyFunction) this.buyFunction();
8328
Game.upgradesToRebuild=1;
8329
Game.recalculateGains=1;
8330
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
8331
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
8332
if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');
8333
}
8334
else
8335
{
8336
this.bought=0;
8337
Game.upgradesToRebuild=1;
8338
Game.recalculateGains=1;
8339
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
8340
PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);
8341
if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');
8342
}
8343
if (Game.onMenu=='stats') Game.UpdateMenu();
8344
}
8345
8346
Game.CountsAsUpgradeOwned=function(pool)
8347
{
8348
if (pool=='' || pool=='cookie' || pool=='tech') return true; else return false;
8349
}
8350
8351
/*AddEvent(l('toggleBox'),'blur',function()//if we click outside of the selector, close it
8352
{
8353
//this has a couple problems, such as when clicking on the upgrade - this toggles it off and back on instantly
8354
l('toggleBox').style.display='none';
8355
l('toggleBox').innerHTML='';
8356
Game.choiceSelectorOn=-1;
8357
}
8358
);*/
8359
8360
Game.RequiresConfirmation=function(upgrade,prompt)
8361
{
8362
upgrade.clickFunction=function(){Game.Prompt(prompt,[['Yes','Game.UpgradesById['+upgrade.id+'].buy(1);Game.ClosePrompt();'],'No']);return false;};
8363
}
8364
8365
Game.Unlock=function(what)
8366
{
8367
if (typeof what==='string')
8368
{
8369
if (Game.Upgrades[what])
8370
{
8371
if (Game.Upgrades[what].unlocked==0)
8372
{
8373
Game.Upgrades[what].unlocked=1;
8374
Game.upgradesToRebuild=1;
8375
Game.recalculateGains=1;
8376
/*if (Game.prefs.popups) {}
8377
else Game.Notify('Upgrade unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+Game.Upgrades[what].name+'</div>',Game.Upgrades[what].icon,6);*/
8378
}
8379
}
8380
}
8381
else {for (var i in what) {Game.Unlock(what[i]);}}
8382
}
8383
Game.Lock=function(what)
8384
{
8385
if (typeof what==='string')
8386
{
8387
if (Game.Upgrades[what])
8388
{
8389
Game.Upgrades[what].unlocked=0;
8390
Game.upgradesToRebuild=1;
8391
if (Game.Upgrades[what].bought==1 && Game.CountsAsUpgradeOwned(Game.Upgrades[what].pool)) Game.UpgradesOwned--;
8392
Game.Upgrades[what].bought=0;
8393
Game.recalculateGains=1;
8394
}
8395
}
8396
else {for (var i in what) {Game.Lock(what[i]);}}
8397
}
8398
8399
Game.Has=function(what)
8400
{
8401
var it=Game.Upgrades[what];
8402
if (Game.ascensionMode==1 && (it.pool=='prestige' || it.tier=='fortune')) return 0;
8403
return (it?it.bought:0);
8404
}
8405
Game.HasUnlocked=function(what)
8406
{
8407
return (Game.Upgrades[what]?Game.Upgrades[what].unlocked:0);
8408
}
8409
8410
8411
Game.RebuildUpgrades=function()//recalculate the upgrades you can buy
8412
{
8413
Game.upgradesToRebuild=0;
8414
var list=[];
8415
for (var i in Game.Upgrades)
8416
{
8417
var me=Game.Upgrades[i];
8418
if (!me.bought && me.pool!='debug' && me.pool!='prestige' && me.pool!='prestigeDecor' && (Game.ascensionMode!=1 || (!me.lasting && me.tier!='fortune')))
8419
{
8420
if (me.unlocked) list.push(me);
8421
}
8422
else if (me.displayFuncWhenOwned && me.bought) list.push(me);
8423
}
8424
var sortMap=function(a,b)
8425
{
8426
var ap=a.pool=='toggle'?a.order:a.getPrice();
8427
var bp=b.pool=='toggle'?b.order:b.getPrice();
8428
if (ap>bp) return 1;
8429
else if (ap<bp) return -1;
8430
else return 0;
8431
}
8432
list.sort(sortMap);
8433
8434
Game.UpgradesInStore=[];
8435
for (var i in list)
8436
{
8437
Game.UpgradesInStore.push(list[i]);
8438
}
8439
var storeStr='';
8440
var toggleStr='';
8441
var techStr='';
8442
var vaultStr='';
8443
8444
if (Game.Has('Inspired checklist'))
8445
{
8446
storeStr+='<div id="storeBuyAll" class="storePre" '+Game.getTooltip(
8447
'<div style="padding:8px;min-width:250px;text-align:center;font-size:11px;">Will <b>instantly purchase</b> every upgrade you can afford, starting from the cheapest one.<br>Upgrades in the <b>vault</b> will not be auto-purchased.<br>You may place an upgrade into the vault by <b>Shift-clicking</b> on it.</div>'
8448
,'store')+
8449
'>'+
8450
'<div id="storeBuyAllButton" class="storePreButton" '+Game.clickStr+'="Game.storeBuyAll();">Buy all upgrades</div>'+
8451
'</div>';
8452
l('upgrades').classList.add('hasMenu');
8453
}
8454
else l('upgrades').classList.remove('hasMenu');
8455
8456
for (var i in Game.UpgradesInStore)
8457
{
8458
//if (!Game.UpgradesInStore[i]) break;
8459
var me=Game.UpgradesInStore[i];
8460
var str=Game.crate(me,'store','Game.UpgradesById['+me.id+'].click(event);','upgrade'+i);
8461
8462
/*var str='<div class="crate upgrade" '+Game.getTooltip(
8463
'<div style="min-width:200px;"><div style="float:right;"><span class="price">'+Beautify(Math.round(me.getPrice()))+'</span></div><small>'+(me.pool=='toggle'?'[Togglable]':'[Upgrade]')+'</small><div class="name">'+me.name+'</div><div class="line"></div><div class="description">'+me.desc+'</div></div>'
8464
,'store')+' '+Game.clickStr+'="Game.UpgradesById['+me.id+'].buy();" id="upgrade'+i+'" style="'+(me.icon[2]?'background-image:url('+me.icon[2]+');':'')+'background-position:'+(-me.icon[0]*48)+'px '+(-me.icon[1]*48)+'px;"></div>';*/
8465
if (me.pool=='toggle') toggleStr+=str; else if (me.pool=='tech') techStr+=str; else
8466
{
8467
if (me.isVaulted() && Game.Has('Inspired checklist')) vaultStr+=str; else storeStr+=str;
8468
}
8469
}
8470
8471
l('upgrades').innerHTML=storeStr;
8472
l('toggleUpgrades').innerHTML=toggleStr;
8473
if (toggleStr=='') l('toggleUpgrades').style.display='none'; else l('toggleUpgrades').style.display='block';
8474
l('techUpgrades').innerHTML=techStr;
8475
if (techStr=='') l('techUpgrades').style.display='none'; else l('techUpgrades').style.display='block';
8476
l('vaultUpgrades').innerHTML=vaultStr;
8477
if (vaultStr=='') l('vaultUpgrades').style.display='none'; else l('vaultUpgrades').style.display='block';
8478
}
8479
8480
Game.UnlockAt=[];//this contains an array of every upgrade with a cookie requirement in the form of {cookies:(amount of cookies earned required),name:(name of upgrade or achievement to unlock)} (and possibly require:(name of upgrade of achievement to own))
8481
//note : the cookie will not be added to the list if it contains locked:1 (use for seasonal cookies and such)
8482
8483
Game.NewUpgradeCookie=function(obj)
8484
{
8485
var upgrade=new Game.Upgrade(obj.name,'Cookie production multiplier <b>+'+Beautify((typeof(obj.power)==='function'?obj.power(obj):obj.power),1)+'%</b>.<q>'+obj.desc+'</q>',obj.price,obj.icon);
8486
upgrade.power=obj.power;
8487
upgrade.pool='cookie';
8488
var toPush={cookies:obj.price/20,name:obj.name};
8489
if (obj.require) toPush.require=obj.require;
8490
if (obj.season) toPush.season=obj.season;
8491
if (!obj.locked) Game.UnlockAt.push(toPush);
8492
return upgrade;
8493
}
8494
8495
//tiered upgrades system
8496
//each building has several upgrade tiers
8497
//all upgrades in the same tier have the same color, unlock threshold and price multiplier
8498
Game.Tiers={
8499
1:{name:'Plain',unlock:1,achievUnlock:1,iconRow:0,color:'#ccb3ac',price: 10},
8500
2:{name:'Berrylium',unlock:5,achievUnlock:50,iconRow:1,color:'#ff89e7',price: 50},
8501
3:{name:'Blueberrylium',unlock:25,achievUnlock:100,iconRow:2,color:'#00deff',price: 500},
8502
4:{name:'Chalcedhoney',unlock:50,achievUnlock:150,iconRow:13,color:'#ffcc2f',price: 50000},
8503
5:{name:'Buttergold',unlock:100,achievUnlock:200,iconRow:14,color:'#e9d673',price: 5000000},
8504
6:{name:'Sugarmuck',unlock:150,achievUnlock:250,iconRow:15,color:'#a8bf91',price: 500000000},
8505
7:{name:'Jetmint',unlock:200,achievUnlock:300,iconRow:16,color:'#60ff50',price: 500000000000},
8506
8:{name:'Cherrysilver',unlock:250,achievUnlock:350,iconRow:17,color:'#f01700',price: 500000000000000},
8507
9:{name:'Hazelrald',unlock:300,achievUnlock:400,iconRow:18,color:'#9ab834',price: 500000000000000000},
8508
10:{name:'Mooncandy',unlock:350,achievUnlock:450,iconRow:19,color:'#7e7ab9',price: 500000000000000000000},
8509
11:{name:'Astrofudge',unlock:400,achievUnlock:500,iconRow:28,color:'#9a3316',price: 5000000000000000000000000},
8510
12:{name:'Alabascream',unlock:450,achievUnlock:550,iconRow:30,color:'#c1a88c',price: 50000000000000000000000000000},
8511
13:{name:'Iridyum',unlock:500,achievUnlock:600,iconRow:31,color:'#adb1b3',price: 500000000000000000000000000000000},
8512
'synergy1':{name:'Synergy I',unlock:15,iconRow:20,color:'#008595',special:1,req:'Synergies Vol. I',price: 200000},
8513
'synergy2':{name:'Synergy II',unlock:75,iconRow:29,color:'#008595',special:1,req:'Synergies Vol. II',price: 200000000000},
8514
'fortune':{name:'Fortune',unlock:-1,iconRow:32,color:'#9ab834',special:1,price: 77777777777777777777777777777},
8515
};
8516
for (var i in Game.Tiers){Game.Tiers[i].upgrades=[];}
8517
Game.GetIcon=function(type,tier)
8518
{
8519
var col=0;
8520
if (type=='Kitten') col=18; else col=Game.Objects[type].iconColumn;
8521
return [col,Game.Tiers[tier].iconRow];
8522
}
8523
Game.SetTier=function(building,tier)
8524
{
8525
if (!Game.Objects[building]) alert('No building named '+building);
8526
Game.last.tier=tier;
8527
Game.last.buildingTie=Game.Objects[building];
8528
if (Game.last.type=='achievement') Game.Objects[building].tieredAchievs[tier]=Game.last;
8529
else Game.Objects[building].tieredUpgrades[tier]=Game.last;
8530
}
8531
Game.MakeTiered=function(upgrade,tier,col)
8532
{
8533
upgrade.tier=tier;
8534
if (typeof col!=='undefined') upgrade.icon=[col,Game.Tiers[tier].iconRow];
8535
}
8536
Game.TieredUpgrade=function(name,desc,building,tier)
8537
{
8538
var upgrade=new Game.Upgrade(name,desc,Game.Objects[building].basePrice*Game.Tiers[tier].price,Game.GetIcon(building,tier));
8539
Game.SetTier(building,tier);
8540
if (!upgrade.buildingTie1 && building) upgrade.buildingTie1=Game.Objects[building];
8541
if (tier=='fortune' && building) Game.Objects[building].fortune=upgrade;
8542
return upgrade;
8543
}
8544
Game.SynergyUpgrade=function(name,desc,building1,building2,tier)
8545
{
8546
/*
8547
creates a new upgrade that :
8548
-unlocks when you have tier.unlock of building1 and building2
8549
-is priced at (building1.price*10+building2.price*1)*tier.price (formerly : Math.sqrt(building1.price*building2.price)*tier.price)
8550
-gives +(0.1*building1)% cps to building2 and +(5*building2)% cps to building1
8551
-if building2 is below building1 in worth, swap them
8552
*/
8553
//if (Game.Objects[building1].basePrice>Game.Objects[building2].basePrice) {var temp=building2;building2=building1;building1=temp;}
8554
var b1=Game.Objects[building1];
8555
var b2=Game.Objects[building2];
8556
if (b1.basePrice>b2.basePrice) {b1=Game.Objects[building2];b2=Game.Objects[building1];}//swap
8557
8558
desc=
8559
(b1.plural.charAt(0).toUpperCase()+b1.plural.slice(1))+' gain <b>+5% CpS</b> per '+b2.name.toLowerCase()+'.<br>'+
8560
(b2.plural.charAt(0).toUpperCase()+b2.plural.slice(1))+' gain <b>+0.1% CpS</b> per '+b1.name.toLowerCase()+'.'+
8561
desc;
8562
var upgrade=new Game.Upgrade(name,desc,(b1.basePrice*10+b2.basePrice*1)*Game.Tiers[tier].price,Game.GetIcon(building1,tier));//Math.sqrt(b1.basePrice*b2.basePrice)*Game.Tiers[tier].price
8563
upgrade.tier=tier;
8564
upgrade.buildingTie1=b1;
8565
upgrade.buildingTie2=b2;
8566
upgrade.priceFunc=function(){return (this.buildingTie1.basePrice*10+this.buildingTie2.basePrice*1)*Game.Tiers[this.tier].price*(Game.Has('Chimera')?0.98:1);};
8567
Game.Objects[building1].synergies.push(upgrade);
8568
Game.Objects[building2].synergies.push(upgrade);
8569
//Game.SetTier(building1,tier);
8570
return upgrade;
8571
}
8572
Game.GetTieredCpsMult=function(me)
8573
{
8574
var mult=1;
8575
for (var i in me.tieredUpgrades) {if (!Game.Tiers[me.tieredUpgrades[i].tier].special && Game.Has(me.tieredUpgrades[i].name)) mult*=2;}
8576
for (var i in me.synergies)
8577
{
8578
var syn=me.synergies[i];
8579
if (Game.Has(syn.name))
8580
{
8581
if (syn.buildingTie1.name==me.name) mult*=(1+0.05*syn.buildingTie2.amount);
8582
else if (syn.buildingTie2.name==me.name) mult*=(1+0.001*syn.buildingTie1.amount);
8583
}
8584
}
8585
if (me.fortune && Game.Has(me.fortune.name)) mult*=1.07;
8586
if (me.grandma && Game.Has(me.grandma.name)) mult*=(1+Game.Objects['Grandma'].amount*0.01*(1/(me.id-1)));
8587
return mult;
8588
}
8589
Game.UnlockTiered=function(me)
8590
{
8591
for (var i in me.tieredUpgrades) {if (Game.Tiers[me.tieredUpgrades[i].tier].unlock!=-1 && me.amount>=Game.Tiers[me.tieredUpgrades[i].tier].unlock) Game.Unlock(me.tieredUpgrades[i].name);}
8592
for (var i in me.tieredAchievs) {if (me.amount>=Game.Tiers[me.tieredAchievs[i].tier].achievUnlock) Game.Win(me.tieredAchievs[i].name);}
8593
for (var i in me.synergies) {var syn=me.synergies[i];if (Game.Has(Game.Tiers[syn.tier].req) && syn.buildingTie1.amount>=Game.Tiers[syn.tier].unlock && syn.buildingTie2.amount>=Game.Tiers[syn.tier].unlock) Game.Unlock(syn.name);}
8594
}
8595
8596
8597
8598
var pool='';
8599
var power=0;
8600
8601
//define upgrades
8602
//WARNING : do NOT add new upgrades in between, this breaks the saves. Add them at the end !
8603
var order=100;//this is used to set the order in which the items are listed
8604
new Game.Upgrade('Reinforced index finger','The mouse and cursors are <b>twice</b> as efficient.<q>prod prod</q>',100,[0,0]);Game.MakeTiered(Game.last,1,0);
8605
new Game.Upgrade('Carpal tunnel prevention cream','The mouse and cursors are <b>twice</b> as efficient.<q>it... it hurts to click...</q>',500,[0,1]);Game.MakeTiered(Game.last,2,0);
8606
new Game.Upgrade('Ambidextrous','The mouse and cursors are <b>twice</b> as efficient.<q>Look ma, both hands!</q>',10000,[0,2]);Game.MakeTiered(Game.last,3,0);
8607
new Game.Upgrade('Thousand fingers','The mouse and cursors gain <b>+0.1</b> cookies for each non-cursor object owned.<q>clickity</q>',100000,[0,13]);Game.MakeTiered(Game.last,4,0);
8608
new Game.Upgrade('Million fingers','Multiplies the gain from Thousand fingers by <b>5</b>.<q>clickityclickity</q>',10000000,[0,14]);Game.MakeTiered(Game.last,5,0);
8609
new Game.Upgrade('Billion fingers','Multiplies the gain from Thousand fingers by <b>10</b>.<q>clickityclickityclickity</q>',100000000,[0,15]);Game.MakeTiered(Game.last,6,0);
8610
new Game.Upgrade('Trillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>clickityclickityclickityclickity</q>',1000000000,[0,16]);Game.MakeTiered(Game.last,7,0);
8611
8612
order=200;
8613
new Game.TieredUpgrade('Forwards from grandma','Grandmas are <b>twice</b> as efficient.<q>RE:RE:thought you\'d get a kick out of this ;))</q>','Grandma',1);
8614
new Game.TieredUpgrade('Steel-plated rolling pins','Grandmas are <b>twice</b> as efficient.<q>Just what you kneaded.</q>','Grandma',2);
8615
new Game.TieredUpgrade('Lubricated dentures','Grandmas are <b>twice</b> as efficient.<q>squish</q>','Grandma',3);
8616
8617
order=300;
8618
new Game.TieredUpgrade('Cheap hoes','Farms are <b>twice</b> as efficient.<q>Rake in the dough!</q>','Farm',1);
8619
new Game.TieredUpgrade('Fertilizer','Farms are <b>twice</b> as efficient.<q>It\'s chocolate, I swear.</q>','Farm',2);
8620
new Game.TieredUpgrade('Cookie trees','Farms are <b>twice</b> as efficient.<q>A relative of the breadfruit.</q>','Farm',3);
8621
8622
order=500;
8623
new Game.TieredUpgrade('Sturdier conveyor belts','Factories are <b>twice</b> as efficient.<q>You\'re going places.</q>','Factory',1);
8624
new Game.TieredUpgrade('Child labor','Factories are <b>twice</b> as efficient.<q>Cheaper, healthier workforce.</q>','Factory',2);
8625
new Game.TieredUpgrade('Sweatshop','Factories are <b>twice</b> as efficient.<q>Slackers will be terminated.</q>','Factory',3);
8626
8627
order=400;
8628
new Game.TieredUpgrade('Sugar gas','Mines are <b>twice</b> as efficient.<q>A pink, volatile gas, found in the depths of some chocolate caves.</q>','Mine',1);
8629
new Game.TieredUpgrade('Megadrill','Mines are <b>twice</b> as efficient.<q>You\'re in deep.</q>','Mine',2);
8630
new Game.TieredUpgrade('Ultradrill','Mines are <b>twice</b> as efficient.<q>Finally caved in?</q>','Mine',3);
8631
8632
order=600;
8633
new Game.TieredUpgrade('Vanilla nebulae','Shipments are <b>twice</b> as efficient.<q>If you removed your space helmet, you could probably smell it!<br>(Note : don\'t do that.)</q>','Shipment',1);
8634
new Game.TieredUpgrade('Wormholes','Shipments are <b>twice</b> as efficient.<q>By using these as shortcuts, your ships can travel much faster.</q>','Shipment',2);
8635
new Game.TieredUpgrade('Frequent flyer','Shipments are <b>twice</b> as efficient.<q>Come back soon!</q>','Shipment',3);
8636
8637
order=700;
8638
new Game.TieredUpgrade('Antimony','Alchemy labs are <b>twice</b> as efficient.<q>Actually worth a lot of mony.</q>','Alchemy lab',1);
8639
new Game.TieredUpgrade('Essence of dough','Alchemy labs are <b>twice</b> as efficient.<q>Extracted through the 5 ancient steps of alchemical baking.</q>','Alchemy lab',2);
8640
new Game.TieredUpgrade('True chocolate','Alchemy labs are <b>twice</b> as efficient.<q>The purest form of cacao.</q>','Alchemy lab',3);
8641
8642
order=800;
8643
new Game.TieredUpgrade('Ancient tablet','Portals are <b>twice</b> as efficient.<q>A strange slab of peanut brittle, holding an ancient cookie recipe. Neat!</q>','Portal',1);
8644
new Game.TieredUpgrade('Insane oatling workers','Portals are <b>twice</b> as efficient.<q>ARISE, MY MINIONS!</q>','Portal',2);
8645
new Game.TieredUpgrade('Soul bond','Portals are <b>twice</b> as efficient.<q>So I just sign up and get more cookies? Sure, whatever!</q>','Portal',3);
8646
8647
order=900;
8648
new Game.TieredUpgrade('Flux capacitors','Time machines are <b>twice</b> as efficient.<q>Bake to the future.</q>','Time machine',1);
8649
new Game.TieredUpgrade('Time paradox resolver','Time machines are <b>twice</b> as efficient.<q>No more fooling around with your own grandmother!</q>','Time machine',2);
8650
new Game.TieredUpgrade('Quantum conundrum','Time machines are <b>twice</b> as efficient.<q>There is only one constant, and that is universal uncertainty.<br>Or is it?</q>','Time machine',3);
8651
8652
order=20000;
8653
new Game.Upgrade('Kitten helpers','You gain <b>more CpS</b> the more milk you have.<q>meow may I help you</q>',9000000,Game.GetIcon('Kitten',1));Game.last.kitten=1;Game.MakeTiered(Game.last,1,18);
8654
new Game.Upgrade('Kitten workers','You gain <b>more CpS</b> the more milk you have.<q>meow meow meow meow</q>',9000000000,Game.GetIcon('Kitten',2));Game.last.kitten=1;Game.MakeTiered(Game.last,2,18);
8655
8656
order=10000;
8657
Game.NewUpgradeCookie({name:'Plain cookies',desc:'We all gotta start somewhere.',icon:[2,3],power: 1, price: 999999});
8658
Game.NewUpgradeCookie({name:'Sugar cookies',desc:'Tasty, if a little unimaginative.',icon:[7,3],power: 1, price: 999999*5});
8659
Game.NewUpgradeCookie({name:'Oatmeal raisin cookies',desc:'No raisin to hate these.',icon:[0,3],power: 1, price: 9999999});
8660
Game.NewUpgradeCookie({name:'Peanut butter cookies',desc:'Get yourself some jam cookies!',icon:[1,3],power: 2, price: 9999999*5});
8661
Game.NewUpgradeCookie({name:'Coconut cookies',desc:'Flaky, but not unreliable. Some people go crazy for these.',icon:[3,3],power: 2, price: 99999999});
8662
order=10001;
8663
Game.NewUpgradeCookie({name:'White chocolate cookies',desc:'I know what you\'ll say. It\'s just cocoa butter! It\'s not real chocolate!<br>Oh please.',icon:[4,3],power:2, price: 99999999*5});
8664
order=10000;
8665
Game.NewUpgradeCookie({name:'Macadamia nut cookies',desc:'They\'re macadamn delicious!',icon:[5,3],power: 2, price: 99999999});
8666
order=10002;
8667
Game.NewUpgradeCookie({name:'Double-chip cookies',desc:'DOUBLE THE CHIPS<br>DOUBLE THE TASTY<br>(double the calories)',icon:[6,3],power:2, price: 999999999*5});
8668
Game.NewUpgradeCookie({name:'White chocolate macadamia nut cookies',desc:'Orteil\'s favorite.',icon:[8,3],power: 2, price: 9999999999});
8669
Game.NewUpgradeCookie({name:'All-chocolate cookies',desc:'CHOCOVERDOSE.',icon:[9,3],power: 2, price: 9999999999*5});
8670
8671
order=100;
8672
new Game.Upgrade('Quadrillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>clickityclickityclickityclickityclick</q>',10000000000,[0,17]);Game.MakeTiered(Game.last,8,0);
8673
8674
order=200;new Game.TieredUpgrade('Prune juice','Grandmas are <b>twice</b> as efficient.<q>Gets me going.</q>','Grandma',4);
8675
order=300;new Game.TieredUpgrade('Genetically-modified cookies','Farms are <b>twice</b> as efficient.<q>All-natural mutations.</q>','Farm',4);
8676
order=500;new Game.TieredUpgrade('Radium reactors','Factories are <b>twice</b> as efficient.<q>Gives your cookies a healthy glow.</q>','Factory',4);
8677
order=400;new Game.TieredUpgrade('Ultimadrill','Mines are <b>twice</b> as efficient.<q>Pierce the heavens, etc.</q>','Mine',4);
8678
order=600;new Game.TieredUpgrade('Warp drive','Shipments are <b>twice</b> as efficient.<q>To boldly bake.</q>','Shipment',4);
8679
order=700;new Game.TieredUpgrade('Ambrosia','Alchemy labs are <b>twice</b> as efficient.<q>Adding this to the cookie mix is sure to make them even more addictive!<br>Perhaps dangerously so.<br>Let\'s hope you can keep selling these legally.</q>','Alchemy lab',4);
8680
order=800;new Game.TieredUpgrade('Sanity dance','Portals are <b>twice</b> as efficient.<q>We can change if we want to.<br>We can leave our brains behind.</q>','Portal',4);
8681
order=900;new Game.TieredUpgrade('Causality enforcer','Time machines are <b>twice</b> as efficient.<q>What happened, happened.</q>','Time machine',4);
8682
8683
order=5000;
8684
new Game.Upgrade('Lucky day','Golden cookies appear <b>twice as often</b> and stay <b>twice as long</b>.<q>Oh hey, a four-leaf penny!</q>',777777777,[27,6]);
8685
new Game.Upgrade('Serendipity','Golden cookies appear <b>twice as often</b> and stay <b>twice as long</b>.<q>What joy! Seven horseshoes!</q>',77777777777,[27,6]);
8686
8687
order=20000;
8688
new Game.Upgrade('Kitten engineers','You gain <b>more CpS</b> the more milk you have.<q>meow meow meow meow, sir</q>',90000000000000,Game.GetIcon('Kitten',3));Game.last.kitten=1;Game.MakeTiered(Game.last,3,18);
8689
8690
order=10020;
8691
Game.NewUpgradeCookie({name:'Dark chocolate-coated cookies',desc:'These absorb light so well you almost need to squint to see them.',icon:[10,3],power: 5, price: 99999999999});
8692
Game.NewUpgradeCookie({name:'White chocolate-coated cookies',desc:'These dazzling cookies absolutely glisten with flavor.',icon:[11,3],power: 5, price: 99999999999});
8693
8694
Game.GrandmaSynergies=[];
8695
Game.GrandmaSynergy=function(name,desc,building)
8696
{
8697
var building=Game.Objects[building];
8698
var grandmaNumber=(building.id-1);
8699
if (grandmaNumber==1) grandmaNumber='grandma';
8700
else grandmaNumber+=' grandmas';
8701
desc='Grandmas are <b>twice</b> as efficient. '+(building.plural.charAt(0).toUpperCase()+building.plural.slice(1))+' gain <b>+1% CpS</b> per '+grandmaNumber+'.<q>'+desc+'</q>';
8702
8703
var upgrade=new Game.Upgrade(name,desc,building.basePrice*Game.Tiers[2].price,[10,9],function(){Game.Objects['Grandma'].redraw();});
8704
building.grandma=upgrade;
8705
upgrade.buildingTie=building;
8706
Game.GrandmaSynergies.push(upgrade.name);
8707
return upgrade;
8708
}
8709
8710
order=250;
8711
Game.GrandmaSynergy('Farmer grandmas','A nice farmer to grow more cookies.','Farm');
8712
Game.GrandmaSynergy('Miner grandmas','A nice miner to dig more cookies.','Mine');
8713
Game.GrandmaSynergy('Worker grandmas','A nice worker to manufacture more cookies.','Factory');
8714
Game.GrandmaSynergy('Cosmic grandmas','A nice thing to... uh... cookies.','Shipment');
8715
Game.GrandmaSynergy('Transmuted grandmas','A nice golden grandma to convert into more cookies.','Alchemy lab');
8716
Game.GrandmaSynergy('Altered grandmas','a NiCe GrAnDmA tO bA##########','Portal');
8717
Game.GrandmaSynergy('Grandmas\' grandmas','A nice grandma\'s nice grandma to bake double the cookies.','Time machine');
8718
8719
order=14000;
8720
Game.baseResearchTime=Game.fps*60*30;
8721
Game.SetResearch=function(what,time)
8722
{
8723
if (Game.Upgrades[what] && !Game.Has(what))
8724
{
8725
Game.researchT=Game.baseResearchTime;
8726
if (Game.Has('Persistent memory')) Game.researchT=Math.ceil(Game.baseResearchTime/10);
8727
if (Game.Has('Ultrascience')) Game.researchT=Game.fps*5;
8728
Game.nextResearch=Game.Upgrades[what].id;
8729
if (Game.prefs.popups) Game.Popup('Research has begun.');
8730
else Game.Notify('Research has begun','Your bingo center/research facility is conducting experiments.',[9,0]);
8731
}
8732
}
8733
8734
new Game.Upgrade('Bingo center/Research facility','Grandma-operated science lab and leisure club.<br>Grandmas are <b>4 times</b> as efficient.<br><b>Regularly unlocks new upgrades</b>.<q>What could possibly keep those grandmothers in check?...<br>Bingo.</q>',1000000000000000,[11,9],function(){Game.SetResearch('Specialized chocolate chips');});Game.last.noPerm=1;
8735
8736
order=15000;
8737
new Game.Upgrade('Specialized chocolate chips','Cookie production multiplier <b>+1%</b>.<q>Computer-designed chocolate chips. Computer chips, if you will.</q>',1000000000000000,[0,9],function(){Game.SetResearch('Designer cocoa beans');});Game.last.pool='tech';
8738
new Game.Upgrade('Designer cocoa beans','Cookie production multiplier <b>+2%</b>.<q>Now more aerodynamic than ever!</q>',2000000000000000,[1,9],function(){Game.SetResearch('Ritual rolling pins');});Game.last.pool='tech';
8739
new Game.Upgrade('Ritual rolling pins','Grandmas are <b>twice</b> as efficient.<q>The result of years of scientific research!</q>',4000000000000000,[2,9],function(){Game.SetResearch('Underworld ovens');});Game.last.pool='tech';
8740
new Game.Upgrade('Underworld ovens','Cookie production multiplier <b>+3%</b>.<q>Powered by science, of course!</q>',8000000000000000,[3,9],function(){Game.SetResearch('One mind');});Game.last.pool='tech';
8741
new Game.Upgrade('One mind','Each grandma gains <b>+0.0<span></span>2 base CpS per grandma</b>.<div class="warning">Note : the grandmothers are growing restless. Do not encourage them.</div><q>We are one. We are many.</q>',16000000000000000,[4,9],function(){Game.elderWrath=1;Game.SetResearch('Exotic nuts');Game.storeToRefresh=1;});Game.last.pool='tech';
8742
//Game.last.clickFunction=function(){return confirm('Warning : purchasing this will have unexpected, and potentially undesirable results!\nIt\'s all downhill from here. You have been warned!\nPurchase anyway?');};
8743
Game.RequiresConfirmation(Game.last,'<div class="block"><b>Warning :</b> purchasing this will have unexpected, and potentially undesirable results!<br><small>It\'s all downhill from here. You have been warned!</small><br><br>Purchase anyway?</small></div>');
8744
new Game.Upgrade('Exotic nuts','Cookie production multiplier <b>+4%</b>.<q>You\'ll go crazy over these!</q>',32000000000000000,[5,9],function(){Game.SetResearch('Communal brainsweep');});Game.last.pool='tech';
8745
new Game.Upgrade('Communal brainsweep','Each grandma gains another <b>+0.0<span></span>2 base CpS per grandma</b>.<div class="warning">Note : proceeding any further in scientific research may have unexpected results. You have been warned.</div><q>We fuse. We merge. We grow.</q>',64000000000000000,[6,9],function(){Game.elderWrath=2;Game.SetResearch('Arcane sugar');Game.storeToRefresh=1;});Game.last.pool='tech';
8746
new Game.Upgrade('Arcane sugar','Cookie production multiplier <b>+5%</b>.<q>Tastes like insects, ligaments, and molasses.</q>',128000000000000000,[7,9],function(){Game.SetResearch('Elder Pact');});Game.last.pool='tech';
8747
new Game.Upgrade('Elder Pact','Each grandma gains <b>+0.0<span></span>5 base CpS per portal</b>.<div class="warning">Note : this is a bad idea.</div><q>squirm crawl slither writhe<br>today we rise</q>',256000000000000000,[8,9],function(){Game.elderWrath=3;Game.storeToRefresh=1;});Game.last.pool='tech';
8748
new Game.Upgrade('Elder Pledge','Contains the wrath of the elders, at least for a while.<q>This is a simple ritual involving anti-aging cream, cookie batter mixed in the moonlight, and a live chicken.</q>',1,[9,9],function()
8749
{
8750
Game.elderWrath=0;
8751
Game.pledges++;
8752
Game.pledgeT=Game.getPledgeDuration();
8753
Game.Unlock('Elder Covenant');
8754
Game.CollectWrinklers();
8755
Game.storeToRefresh=1;
8756
});
8757
Game.getPledgeDuration=function(){return Game.fps*60*(Game.Has('Sacrificial rolling pins')?60:30);}
8758
Game.last.pool='toggle';
8759
Game.last.displayFuncWhenOwned=function(){return '<div style="text-align:center;">Time remaining until pledge runs out :<br><b>'+Game.sayTime(Game.pledgeT,-1)+'</b></div>';}
8760
Game.last.timerDisplay=function(){if (!Game.Upgrades['Elder Pledge'].bought) return -1; else return 1-Game.pledgeT/Game.getPledgeDuration();}
8761
Game.last.priceFunc=function(){return Math.pow(8,Math.min(Game.pledges+2,14));}
8762
8763
Game.last.descFunc=function(){
8764
return '<div style="text-align:center;">'+(Game.pledges==0?'You haven\'t pledged to the elders yet.':('You\'ve pledged to the elders <b>'+(Game.pledges==1?'once':Game.pledges==2?'twice':(Game.pledges+' times'))+'</b>.'))+'<div class="line"></div></div>'+this.desc;
8765
};
8766
8767
8768
order=150;
8769
new Game.Upgrade('Plastic mouse','Clicking gains <b>+1% of your CpS</b>.<q>Slightly squeaky.</q>',50000,[11,0]);Game.MakeTiered(Game.last,1,11);
8770
new Game.Upgrade('Iron mouse','Clicking gains <b>+1% of your CpS</b>.<q>Click like it\'s 1349!</q>',5000000,[11,1]);Game.MakeTiered(Game.last,2,11);
8771
new Game.Upgrade('Titanium mouse','Clicking gains <b>+1% of your CpS</b>.<q>Heavy, but powerful.</q>',500000000,[11,2]);Game.MakeTiered(Game.last,3,11);
8772
new Game.Upgrade('Adamantium mouse','Clicking gains <b>+1% of your CpS</b>.<q>You could cut diamond with these.</q>',50000000000,[11,13]);Game.MakeTiered(Game.last,4,11);
8773
8774
order=40000;
8775
new Game.Upgrade('Ultrascience','Research takes only <b>5 seconds</b>.<q>YEAH, SCIENCE!</q>',7,[9,2]);//debug purposes only
8776
Game.last.pool='debug';
8777
8778
order=10020;
8779
Game.NewUpgradeCookie({name:'Eclipse cookies',desc:'Look to the cookie.',icon:[0,4],power: 2, price: 99999999999*5});
8780
Game.NewUpgradeCookie({name:'Zebra cookies',desc:'...',icon:[1,4],power: 2, price: 999999999999});
8781
8782
order=100;
8783
new Game.Upgrade('Quintillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>man, just go click click click click click, it\'s real easy, man.</q>',10000000000000,[0,18]);Game.MakeTiered(Game.last,9,0);
8784
8785
order=40000;
8786
new Game.Upgrade('Gold hoard','Golden cookies appear <b>really often</b>.<q>That\'s entirely too many.</q>',7,[10,14]);//debug purposes only
8787
Game.last.pool='debug';
8788
8789
order=15000;
8790
new Game.Upgrade('Elder Covenant','Puts a permanent end to the elders\' wrath, at the price of 5% of your CpS.<q>This is a complicated ritual involving silly, inconsequential trivialities such as cursed laxatives, century-old cacao, and an infant.<br>Don\'t question it.</q>',66666666666666,[8,9],function()
8791
{
8792
Game.pledgeT=0;
8793
Game.Lock('Revoke Elder Covenant');
8794
Game.Unlock('Revoke Elder Covenant');
8795
Game.Lock('Elder Pledge');
8796
Game.Win('Elder calm');
8797
Game.CollectWrinklers();
8798
Game.storeToRefresh=1;
8799
});
8800
Game.last.pool='toggle';
8801
8802
new Game.Upgrade('Revoke Elder Covenant','You will get 5% of your CpS back, but the grandmatriarchs will return.<q>we<br>rise<br>again</q>',6666666666,[8,9],function()
8803
{
8804
Game.Lock('Elder Covenant');
8805
Game.Unlock('Elder Covenant');
8806
});
8807
Game.last.pool='toggle';
8808
8809
order=5000;
8810
new Game.Upgrade('Get lucky','Golden cookie effects last <b>twice as long</b>.<q>You\'ve been up all night, haven\'t you?</q>',77777777777777,[27,6]);
8811
8812
order=15000;
8813
new Game.Upgrade('Sacrificial rolling pins','Elder pledges last <b>twice</b> as long.<q>These are mostly just for spreading the anti-aging cream.<br>(And accessorily, shortening the chicken\'s suffering.)</q>',2888888888888,[2,9]);
8814
8815
order=10020;
8816
Game.NewUpgradeCookie({name:'Snickerdoodles',desc:'True to their name.',icon:[2,4],power: 2, price: 999999999999*5});
8817
Game.NewUpgradeCookie({name:'Stroopwafels',desc:'If it ain\'t dutch, it ain\'t much.',icon:[3,4],power: 2, price: 9999999999999});
8818
Game.NewUpgradeCookie({name:'Macaroons',desc:'Not to be confused with macarons.<br>These have coconut, okay?',icon:[4,4],power: 2, price: 9999999999999*5});
8819
8820
order=40000;
8821
new Game.Upgrade('Neuromancy','Can toggle upgrades on and off at will in the stats menu.<q>Can also come in handy to unsee things that can\'t be unseen.</q>',7,[4,9]);//debug purposes only
8822
Game.last.pool='debug';
8823
8824
order=10020;
8825
Game.NewUpgradeCookie({name:'Empire biscuits',desc:'For your growing cookie empire, of course!',icon:[5,4],power: 2, price: 99999999999999});
8826
order=10031;
8827
Game.NewUpgradeCookie({name:'British tea biscuits',desc:'Quite.',icon:[6,4],require:'Tin of british tea biscuits',power: 2, price: 99999999999999});
8828
Game.NewUpgradeCookie({name:'Chocolate british tea biscuits',desc:'Yes, quite.',icon:[7,4],require:Game.last.name,power: 2, price: 99999999999999});
8829
Game.NewUpgradeCookie({name:'Round british tea biscuits',desc:'Yes, quite riveting.',icon:[8,4],require:Game.last.name,power: 2, price: 99999999999999});
8830
Game.NewUpgradeCookie({name:'Round chocolate british tea biscuits',desc:'Yes, quite riveting indeed.',icon:[9,4],require:Game.last.name,power: 2, price: 99999999999999});
8831
Game.NewUpgradeCookie({name:'Round british tea biscuits with heart motif',desc:'Yes, quite riveting indeed, old chap.',icon:[10,4],require:Game.last.name,power: 2, price: 99999999999999});
8832
Game.NewUpgradeCookie({name:'Round chocolate british tea biscuits with heart motif',desc:'I like cookies.',icon:[11,4],require:Game.last.name,power: 2, price: 99999999999999});
8833
8834
order=1000;
8835
new Game.TieredUpgrade('Sugar bosons','Antimatter condensers are <b>twice</b> as efficient.<q>Sweet firm bosons.</q>','Antimatter condenser',1);
8836
new Game.TieredUpgrade('String theory','Antimatter condensers are <b>twice</b> as efficient.<q>Reveals new insight about the true meaning of baking cookies (and, as a bonus, the structure of the universe).</q>','Antimatter condenser',2);
8837
new Game.TieredUpgrade('Large macaron collider','Antimatter condensers are <b>twice</b> as efficient.<q>How singular!</q>','Antimatter condenser',3);
8838
new Game.TieredUpgrade('Big bang bake','Antimatter condensers are <b>twice</b> as efficient.<q>And that\'s how it all began.</q>','Antimatter condenser',4);
8839
8840
order=255;
8841
Game.GrandmaSynergy('Antigrandmas','A mean antigrandma to vomit more cookies.','Antimatter condenser');
8842
8843
order=10020;
8844
Game.NewUpgradeCookie({name:'Madeleines',desc:'Unforgettable!',icon:[12,3],power: 2, price: 99999999999999*5});
8845
Game.NewUpgradeCookie({name:'Palmiers',desc:'Palmier than you!',icon:[13,3],power: 2, price: 99999999999999*5});
8846
Game.NewUpgradeCookie({name:'Palets',desc:'You could probably play hockey with these.<br>I mean, you\'re welcome to try.',icon:[12,4],power: 2, price: 999999999999999});
8847
Game.NewUpgradeCookie({name:'Sabl&eacute;s',desc:'The name implies they\'re made of sand. But you know better, don\'t you?',icon:[13,4],power: 2, price: 999999999999999});
8848
8849
order=20000;
8850
new Game.Upgrade('Kitten overseers','You gain <b>more CpS</b> the more milk you have.<q>my purrpose is to serve you, sir</q>',90000000000000000,Game.GetIcon('Kitten',4));Game.last.kitten=1;Game.MakeTiered(Game.last,4,18);
8851
8852
8853
order=100;
8854
new Game.Upgrade('Sextillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>sometimes<br>things just<br>click</q>',10000000000000000,[0,19]);Game.MakeTiered(Game.last,10,0);
8855
8856
order=200;new Game.TieredUpgrade('Double-thick glasses','Grandmas are <b>twice</b> as efficient.<q>Oh... so THAT\'s what I\'ve been baking.</q>','Grandma',5);
8857
order=300;new Game.TieredUpgrade('Gingerbread scarecrows','Farms are <b>twice</b> as efficient.<q>Staring at your crops with mischievous glee.</q>','Farm',5);
8858
order=500;new Game.TieredUpgrade('Recombobulators','Factories are <b>twice</b> as efficient.<q>A major part of cookie recombobulation.</q>','Factory',5);
8859
order=400;new Game.TieredUpgrade('H-bomb mining','Mines are <b>twice</b> as efficient.<q>Questionable efficiency, but spectacular nonetheless.</q>','Mine',5);
8860
order=600;new Game.TieredUpgrade('Chocolate monoliths','Shipments are <b>twice</b> as efficient.<q>My god. It\'s full of chocolate bars.</q>','Shipment',5);
8861
order=700;new Game.TieredUpgrade('Aqua crustulae','Alchemy labs are <b>twice</b> as efficient.<q>Careful with the dosing - one drop too much and you get muffins.<br>And nobody likes muffins.</q>','Alchemy lab',5);
8862
order=800;new Game.TieredUpgrade('Brane transplant','Portals are <b>twice</b> as efficient.<q>This refers to the practice of merging higher dimensional universes, or "branes", with our own, in order to facilitate transit (and harvesting of precious cookie dough).</q>','Portal',5);
8863
order=900;new Game.TieredUpgrade('Yestermorrow comparators','Time machines are <b>twice</b> as efficient.<q>Fortnights into milleniums.</q>','Time machine',5);
8864
order=1000;new Game.TieredUpgrade('Reverse cyclotrons','Antimatter condensers are <b>twice</b> as efficient.<q>These can uncollision particles and unspin atoms. For... uh... better flavor, and stuff.</q>','Antimatter condenser',5);
8865
8866
order=150;
8867
new Game.Upgrade('Unobtainium mouse','Clicking gains <b>+1% of your CpS</b>.<q>These nice mice should suffice.</q>',5000000000000,[11,14]);Game.MakeTiered(Game.last,5,11);
8868
8869
order=10030;
8870
Game.NewUpgradeCookie({name:'Caramoas',desc:'Yeah. That\'s got a nice ring to it.',icon:[14,4],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8871
Game.NewUpgradeCookie({name:'Sagalongs',desc:'Grandma\'s favorite?',icon:[15,3],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8872
Game.NewUpgradeCookie({name:'Shortfoils',desc:'Foiled again!',icon:[15,4],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8873
Game.NewUpgradeCookie({name:'Win mints',desc:'They\'re the luckiest cookies you\'ve ever tasted!',icon:[14,3],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8874
8875
order=40000;
8876
new Game.Upgrade('Perfect idling','You keep producing cookies even while the game is closed.<q>It\'s the most beautiful thing I\'ve ever seen.</q>',7,[10,0]);//debug purposes only
8877
Game.last.pool='debug';
8878
8879
order=10030;
8880
Game.NewUpgradeCookie({name:'Fig gluttons',desc:'Got it all figured out.',icon:[17,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8881
Game.NewUpgradeCookie({name:'Loreols',desc:'Because, uh... they\'re worth it?',icon:[16,3],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8882
Game.NewUpgradeCookie({name:'Jaffa cakes',desc:'If you want to bake a cookie from scratch, you must first build a factory.',icon:[17,3],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8883
Game.NewUpgradeCookie({name:'Grease\'s cups',desc:'Extra-greasy peanut butter.',icon:[16,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8884
8885
order=30000;
8886
new Game.Upgrade('Heavenly chip secret','Unlocks <b>5%</b> of the potential of your prestige level.<q>Grants the knowledge of heavenly chips, and how to use them to make baking more efficient.<br>It\'s a secret to everyone.</q>',11,[19,7]);Game.last.noPerm=1;
8887
new Game.Upgrade('Heavenly cookie stand','Unlocks <b>25%</b> of the potential of your prestige level.<q>Don\'t forget to visit the heavenly lemonade stand afterwards. When afterlife gives you lemons...</q>',1111,[18,7]);Game.last.noPerm=1;
8888
new Game.Upgrade('Heavenly bakery','Unlocks <b>50%</b> of the potential of your prestige level.<q>Also sells godly cakes and divine pastries. The pretzels aren\'t too bad either.</q>',111111,[17,7]);Game.last.noPerm=1;
8889
new Game.Upgrade('Heavenly confectionery','Unlocks <b>75%</b> of the potential of your prestige level.<q>They say angel bakers work there. They take angel lunch breaks and sometimes go on angel strikes.</q>',11111111,[16,7]);Game.last.noPerm=1;
8890
new Game.Upgrade('Heavenly key','Unlocks <b>100%</b> of the potential of your prestige level.<q>This is the key to the pearly (and tasty) gates of pastry heaven, granting you access to your entire stockpile of heavenly chips for baking purposes.<br>May you use them wisely.</q>',1111111111,[15,7]);Game.last.noPerm=1;
8891
8892
order=10100;
8893
Game.NewUpgradeCookie({name:'Skull cookies',desc:'Wanna know something spooky? You\'ve got one of these inside your head RIGHT NOW.',locked:1,icon:[12,8],power: 2, price: 444444444444});
8894
Game.NewUpgradeCookie({name:'Ghost cookies',desc:'They\'re something strange, but they look pretty good!',locked:1,icon:[13,8],power: 2, price: 444444444444});
8895
Game.NewUpgradeCookie({name:'Bat cookies',desc:'The cookies this town deserves.',locked:1,icon:[14,8],power: 2, price: 444444444444});
8896
Game.NewUpgradeCookie({name:'Slime cookies',desc:'The incredible melting cookies!',locked:1,icon:[15,8],power: 2, price: 444444444444});
8897
Game.NewUpgradeCookie({name:'Pumpkin cookies',desc:'Not even pumpkin-flavored. Tastes like glazing. Yeugh.',locked:1,icon:[16,8],power: 2, price: 444444444444});
8898
Game.NewUpgradeCookie({name:'Eyeball cookies',desc:'When you stare into the cookie, the cookie stares back at you.',locked:1,icon:[17,8],power: 2, price: 444444444444});
8899
Game.NewUpgradeCookie({name:'Spider cookies',desc:'You found the recipe on the web. They do whatever a cookie can.',locked:1,icon:[18,8],power: 2, price: 444444444444});
8900
8901
Game.halloweenDrops=['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'];
8902
8903
Game.GetHowManyHalloweenDrops=function()
8904
{
8905
var num=0;
8906
for (var i in Game.halloweenDrops) {if (Game.Has(Game.halloweenDrops[i])) num++;}
8907
return num;
8908
}
8909
/*for (var i in Game.halloweenDrops)
8910
{
8911
Game.Upgrades[Game.halloweenDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyHalloweenDrops()+'/'+Game.halloweenDrops.length+'</b> halloween cookies.</div><div class="line"></div>'+this.desc;};
8912
}*/
8913
8914
order=0;
8915
new Game.Upgrade('Persistent memory','Subsequent research will be <b>10 times</b> as fast.<q>It\'s all making sense!<br>Again!</q>',500,[9,2]);Game.last.pool='prestige';
8916
8917
order=40000;
8918
new Game.Upgrade('Wrinkler doormat','Wrinklers spawn much more frequently.<q>You\'re such a pushover.</q>',7,[19,8]);//debug purposes only
8919
Game.last.pool='debug';
8920
8921
order=10200;
8922
Game.NewUpgradeCookie({name:'Christmas tree biscuits',desc:'Whose pine is it anyway?',locked:1,icon:[12,10],power:2,price: 252525252525});
8923
Game.NewUpgradeCookie({name:'Snowflake biscuits',desc:'Mass-produced to be unique in every way.',locked:1,icon:[13,10],power:2,price: 252525252525});
8924
Game.NewUpgradeCookie({name:'Snowman biscuits',desc:'It\'s frosted. Doubly so.',locked:1,icon:[14,10],power:2,price: 252525252525});
8925
Game.NewUpgradeCookie({name:'Holly biscuits',desc:'You don\'t smooch under these ones. That would be the mistletoe (which, botanically, is a smellier variant of the mistlefinger).',locked:1,icon:[15,10],power:2,price: 252525252525});
8926
Game.NewUpgradeCookie({name:'Candy cane biscuits',desc:'It\'s two treats in one!<br>(Further inspection reveals the frosting does not actually taste like peppermint, but like mundane sugary frosting.)',locked:1,icon:[16,10],power:2,price: 252525252525});
8927
Game.NewUpgradeCookie({name:'Bell biscuits',desc:'What do these even have to do with christmas? Who cares, ring them in!',locked:1,icon:[17,10],power:2,price: 252525252525});
8928
Game.NewUpgradeCookie({name:'Present biscuits',desc:'The prequel to future biscuits. Watch out!',locked:1,icon:[18,10],power:2,price: 252525252525});
8929
8930
order=10020;
8931
Game.NewUpgradeCookie({name:'Gingerbread men',desc:'You like to bite the legs off first, right? How about tearing off the arms? You sick monster.',icon:[18,4],power: 2,price: 9999999999999999});
8932
Game.NewUpgradeCookie({name:'Gingerbread trees',desc:'Evergreens in pastry form. Yule be surprised what you can come up with.',icon:[18,3],power: 2,price: 9999999999999999});
8933
8934
order=25000;
8935
new Game.Upgrade('A festive hat','<b>Unlocks... something.</b><q>Not a creature was stirring, not even a mouse.</q>',25,[19,9],function()
8936
{
8937
var drop=choose(Game.santaDrops);
8938
Game.Unlock(drop);
8939
if (Game.prefs.popups) Game.Popup('In the festive hat, you find...<br>a festive test tube<br>and '+drop+'.');
8940
else Game.Notify('In the festive hat, you find...','a festive test tube<br>and <b>'+drop+'</b>.',Game.Upgrades[drop].icon);
8941
});
8942
8943
new Game.Upgrade('Increased merriness','Cookie production multiplier <b>+15%</b>.<br>Cost scales with Santa level.<q>It turns out that the key to increased merriness, strangely enough, happens to be a good campfire and some s\'mores.<br>You know what they say, after all; the s\'more, the merrier.</q>',2525,[17,9]);
8944
new Game.Upgrade('Improved jolliness','Cookie production multiplier <b>+15%</b>.<br>Cost scales with Santa level.<q>A nice wobbly belly goes a long way.<br>You jolly?</q>',2525,[17,9]);
8945
new Game.Upgrade('A lump of coal','Cookie production multiplier <b>+1%</b>.<br>Cost scales with Santa level.<q>Some of the world\'s worst stocking stuffing.<br>I guess you could try starting your own little industrial revolution, or something?...</q>',2525,[13,9]);
8946
new Game.Upgrade('An itchy sweater','Cookie production multiplier <b>+1%</b>.<br>Cost scales with Santa level.<q>You don\'t know what\'s worse : the embarrassingly quaint "elf on reindeer" motif, or the fact that wearing it makes you feel like you\'re wrapped in a dead sasquatch.</q>',2525,[14,9]);
8947
new Game.Upgrade('Reindeer baking grounds','Reindeer appear <b>twice as frequently</b>.<br>Cost scales with Santa level.<q>Male reindeer are from Mars; female reindeer are from venison.</q>',2525,[12,9]);
8948
new Game.Upgrade('Weighted sleighs','Reindeer are <b>twice as slow</b>.<br>Cost scales with Santa level.<q>Hope it was worth the weight.<br>(Something something forced into cervidude)</q>',2525,[12,9]);
8949
new Game.Upgrade('Ho ho ho-flavored frosting','Reindeer give <b>twice as much</b>.<br>Cost scales with Santa level.<q>It\'s time to up the antler.</q>',2525,[12,9]);
8950
new Game.Upgrade('Season savings','All buildings are <b>1% cheaper</b>.<br>Cost scales with Santa level.<q>By Santa\'s beard, what savings!<br>But who will save us?</q>',2525,[16,9],function(){Game.storeToRefresh=1;});
8951
new Game.Upgrade('Toy workshop','All upgrades are <b>5% cheaper</b>.<br>Cost scales with Santa level.<q>Watch yours-elf around elvesdroppers who might steal our production secrets.<br>Or elven worse!</q>',2525,[16,9],function(){Game.upgradesToRebuild=1;});
8952
new Game.Upgrade('Naughty list','Grandmas are <b>twice</b> as productive.<br>Cost scales with Santa level.<q>This list contains every unholy deed perpetuated by grandmakind.<br>He won\'t be checking this one twice.<br>Once. Once is enough.</q>',2525,[15,9]);
8953
new Game.Upgrade('Santa\'s bottomless bag','Random drops are <b>10% more common</b>.<br>Cost scales with Santa level.<q>This is one bottom you can\'t check out.</q>',2525,[19,9]);
8954
new Game.Upgrade('Santa\'s helpers','Clicking is <b>10% more powerful</b>.<br>Cost scales with Santa level.<q>Some choose to help hamburger; some choose to help you.<br>To each their own, I guess.</q>',2525,[19,9]);
8955
new Game.Upgrade('Santa\'s legacy','Cookie production multiplier <b>+3% per Santa\'s levels</b>.<br>Cost scales with Santa level.<q>In the north pole, you gotta get the elves first. Then when you get the elves, you start making the toys. Then when you get the toys... then you get the cookies.</q>',2525,[19,9]);
8956
new Game.Upgrade('Santa\'s milk and cookies','Milk is <b>5% more powerful</b>.<br>Cost scales with Santa level.<q>Part of Santa\'s dreadfully unbalanced diet.</q>',2525,[19,9]);
8957
8958
order=40000;
8959
new Game.Upgrade('Reindeer season','Reindeer spawn much more frequently.<q>Go, Cheater! Go, Hacker and Faker!</q>',7,[12,9]);//debug purposes only
8960
Game.last.pool='debug';
8961
8962
order=25000;
8963
new Game.Upgrade('Santa\'s dominion','Cookie production multiplier <b>+20%</b>.<br>All buildings are <b>1% cheaper</b>.<br>All upgrades are <b>2% cheaper</b>.<q>My name is Claus, king of kings;<br>Look on my toys, ye Mighty, and despair!</q>',2525252525252525,[19,10],function(){Game.storeToRefresh=1;});
8964
8965
order=10300;
8966
var heartPower=function(){
8967
var pow=2;
8968
if (Game.Has('Starlove')) pow=3;
8969
if (Game.hasGod)
8970
{
8971
var godLvl=Game.hasGod('seasons');
8972
if (godLvl==1) pow*=1.3;
8973
else if (godLvl==2) pow*=1.2;
8974
else if (godLvl==3) pow*=1.1;
8975
}
8976
return pow;
8977
};
8978
Game.NewUpgradeCookie({name:'Pure heart biscuits',desc:'Melty white chocolate<br>that says "I *like* like you".',season:'valentines',icon:[19,3], power:heartPower,price: 1000000});
8979
Game.NewUpgradeCookie({name:'Ardent heart biscuits',desc:'A red hot cherry biscuit that will nudge the target of your affection in interesting directions.',require:Game.last.name,season:'valentines',icon:[20,3], power:heartPower,price: 1000000000});
8980
Game.NewUpgradeCookie({name:'Sour heart biscuits',desc:'A bitter lime biscuit for the lonely and the heart-broken.',require:Game.last.name,season:'valentines',icon:[20,4], power:heartPower,price: 1000000000000});
8981
Game.NewUpgradeCookie({name:'Weeping heart biscuits',desc:'An ice-cold blueberry biscuit, symbol of a mending heart.',require:Game.last.name,season:'valentines',icon:[21,3], power:heartPower,price: 1000000000000000});
8982
Game.NewUpgradeCookie({name:'Golden heart biscuits',desc:'A beautiful biscuit to symbolize kindness, true love, and sincerity.',require:Game.last.name,season:'valentines',icon:[21,4], power:heartPower,price: 1000000000000000000});
8983
Game.NewUpgradeCookie({name:'Eternal heart biscuits',desc:'Silver icing for a very special someone you\'ve liked for a long, long time.',require:Game.last.name,season:'valentines',icon:[19,4], power:heartPower,price: 1000000000000000000000});
8984
8985
Game.heartDrops=['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits','Prism heart biscuits'];
8986
8987
Game.GetHowManyHeartDrops=function()
8988
{
8989
var num=0;
8990
for (var i in Game.heartDrops) {if (Game.Has(Game.heartDrops[i])) num++;}
8991
return num;
8992
}
8993
/*for (var i in Game.heartDrops)
8994
{
8995
Game.Upgrades[Game.heartDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyHeartDrops()+'/'+Game.heartDrops.length+'</b> heart biscuits.</div><div class="line"></div>'+this.desc;};
8996
}*/
8997
8998
order=1100;
8999
new Game.TieredUpgrade('Gem polish','Prisms are <b>twice</b> as efficient.<q>Get rid of the grime and let more light in.<br>Truly, truly outrageous.</q>','Prism',1);
9000
new Game.TieredUpgrade('9th color','Prisms are <b>twice</b> as efficient.<q>Delve into untouched optical depths where even the mantis shrimp hasn\'t set an eye!</q>','Prism',2);
9001
new Game.TieredUpgrade('Chocolate light','Prisms are <b>twice</b> as efficient.<q>Bask into its cocoalescence.<br>(Warning : may cause various interesting albeit deadly skin conditions.)</q>','Prism',3);
9002
new Game.TieredUpgrade('Grainbow','Prisms are <b>twice</b> as efficient.<q>Remember the different grains using the handy Roy G. Biv mnemonic : R is for rice, O is for oats... uh, B for barley?...</q>','Prism',4);
9003
new Game.TieredUpgrade('Pure cosmic light','Prisms are <b>twice</b> as efficient.<q>Your prisms now receive pristine, unadulterated photons from the other end of the universe.</q>','Prism',5);
9004
9005
order=255;
9006
Game.GrandmaSynergy('Rainbow grandmas','A luminous grandma to sparkle into cookies.','Prism');
9007
9008
order=24000;
9009
Game.seasonTriggerBasePrice=1000000000;//1111111111;
9010
new Game.Upgrade('Season switcher','Allows you to <b>trigger seasonal events</b> at will, for a price.<q>There will always be time.</q>',1111,[16,6],function(){for (var i in Game.seasons){Game.Unlock(Game.seasons[i].trigger);}});Game.last.pool='prestige';Game.last.parents=['Heralds'];
9011
new Game.Upgrade('Festive biscuit','Triggers <b>Christmas season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>\'Twas the night before Christmas- or was it?</q>',Game.seasonTriggerBasePrice,[12,10]);Game.last.season='christmas';Game.last.pool='toggle';
9012
new Game.Upgrade('Ghostly biscuit','Triggers <b>Halloween season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>spooky scary skeletons<br>will wake you with a boo</q>',Game.seasonTriggerBasePrice,[13,8]);Game.last.season='halloween';Game.last.pool='toggle';
9013
new Game.Upgrade('Lovesick biscuit','Triggers <b>Valentine\'s Day season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>Romance never goes out of fashion.</q>',Game.seasonTriggerBasePrice,[20,3]);Game.last.season='valentines';Game.last.pool='toggle';
9014
new Game.Upgrade('Fool\'s biscuit','Triggers <b>Business Day season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>Business. Serious business. This is absolutely all of your business.</q>',Game.seasonTriggerBasePrice,[17,6]);Game.last.season='fools';Game.last.pool='toggle';
9015
9016
9017
order=40000;
9018
new Game.Upgrade('Eternal seasons','Seasons now last forever.<q>Season to taste.</q>',7,[16,6],function(){for (var i in Game.seasons){Game.Unlock(Game.seasons[i].trigger);}});//debug purposes only
9019
Game.last.pool='debug';
9020
9021
9022
order=20000;
9023
new Game.Upgrade('Kitten managers','You gain <b>more CpS</b> the more milk you have.<q>that\'s not gonna paws any problem, sir</q>',900000000000000000000,Game.GetIcon('Kitten',5));Game.last.kitten=1;Game.MakeTiered(Game.last,5,18);
9024
9025
order=100;
9026
new Game.Upgrade('Septillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>[cursory flavor text]</q>',10000000000000000000,[12,20]);Game.MakeTiered(Game.last,11,0);
9027
new Game.Upgrade('Octillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>Turns out you <b>can</b> quite put your finger on it.</q>',10000000000000000000000,[12,19]);Game.MakeTiered(Game.last,12,0);
9028
9029
order=150;new Game.Upgrade('Eludium mouse','Clicking gains <b>+1% of your CpS</b>.<q>I rodent do that if I were you.</q>',500000000000000,[11,15]);Game.MakeTiered(Game.last,6,11);
9030
new Game.Upgrade('Wishalloy mouse','Clicking gains <b>+1% of your CpS</b>.<q>Clicking is fine and dandy, but don\'t smash your mouse over it. Get your game on. Go play.</q>',50000000000000000,[11,16]);Game.MakeTiered(Game.last,7,11);
9031
order=200;new Game.TieredUpgrade('Aging agents','Grandmas are <b>twice</b> as efficient.<q>Counter-intuitively, grandmas have the uncanny ability to become more powerful the older they get.</q>','Grandma',6);
9032
order=300;new Game.TieredUpgrade('Pulsar sprinklers','Farms are <b>twice</b> as efficient.<q>There\'s no such thing as over-watering. The moistest is the bestest.</q>','Farm',6);
9033
order=500;new Game.TieredUpgrade('Deep-bake process','Factories are <b>twice</b> as efficient.<q>A patented process increasing cookie yield two-fold for the same amount of ingredients. Don\'t ask how, don\'t take pictures, and be sure to wear your protective suit.</q>','Factory',6);
9034
order=400;new Game.TieredUpgrade('Coreforge','Mines are <b>twice</b> as efficient.<q>You\'ve finally dug a tunnel down to the Earth\'s core. It\'s pretty warm down here.</q>','Mine',6);
9035
order=600;new Game.TieredUpgrade('Generation ship','Shipments are <b>twice</b> as efficient.<q>Built to last, this humongous spacecraft will surely deliver your cookies to the deep ends of space, one day.</q>','Shipment',6);
9036
order=700;new Game.TieredUpgrade('Origin crucible','Alchemy labs are <b>twice</b> as efficient.<q>Built from the rarest of earths and located at the very deepest of the largest mountain, this legendary crucible is said to retain properties from the big-bang itself.</q>','Alchemy lab',6);
9037
order=800;new Game.TieredUpgrade('Deity-sized portals','Portals are <b>twice</b> as efficient.<q>It\'s almost like, say, an elder god could fit through this thing now. Hypothetically.</q>','Portal',6);
9038
order=900;new Game.TieredUpgrade('Far future enactment','Time machines are <b>twice</b> as efficient.<q>The far future enactment authorizes you to delve deep into the future - where civilization has fallen and risen again, and cookies are plentiful.</q>','Time machine',6);
9039
order=1000;new Game.TieredUpgrade('Nanocosmics','Antimatter condensers are <b>twice</b> as efficient.<q>The theory of nanocosmics posits that each subatomic particle is in fact its own self-contained universe, holding unfathomable amounts of energy.<br>This somehow stacks with the nested universe theory, because physics.</q>','Antimatter condenser',6);
9040
order=1100;
9041
new Game.TieredUpgrade('Glow-in-the-dark','Prisms are <b>twice</b> as efficient.<q>Your prisms now glow in the dark, effectively doubling their output!</q>','Prism',6);
9042
9043
order=10032;
9044
Game.NewUpgradeCookie({name:'Rose macarons',desc:'Although an odd flavor, these pastries recently rose in popularity.',icon:[22,3],require:'Box of macarons', power:3,price: 9999});
9045
Game.NewUpgradeCookie({name:'Lemon macarons',desc:'Tastefully sour, delightful treats.',icon:[23,3],require:'Box of macarons', power:3,price: 9999999});
9046
Game.NewUpgradeCookie({name:'Chocolate macarons',desc:'They\'re like tiny sugary burgers!',icon:[24,3],require:'Box of macarons', power:3,price: 9999999999});
9047
Game.NewUpgradeCookie({name:'Pistachio macarons',desc:'Pistachio shells now removed after multiple complaints.',icon:[22,4],require:'Box of macarons', power:3,price: 9999999999999});
9048
Game.NewUpgradeCookie({name:'Hazelnut macarons',desc:'These go especially well with coffee.',icon:[23,4],require:'Box of macarons', power:3,price: 9999999999999999});
9049
Game.NewUpgradeCookie({name:'Violet macarons',desc:'It\'s like spraying perfume into your mouth!',icon:[24,4],require:'Box of macarons', power:3,price: 9999999999999999999});
9050
9051
order=40000;
9052
new Game.Upgrade('Magic shenanigans','Cookie production <b>multiplied by 1,000</b>.<q>It\'s magic. I ain\'t gotta explain sh<div style="display:inline-block;background:url(img/money.png);width:16px;height:16px;position:relative;top:4px;left:0px;margin:0px -2px;"></div>t.</q>',7,[17,5]);//debug purposes only
9053
Game.last.pool='debug';
9054
9055
9056
order=24000;
9057
new Game.Upgrade('Bunny biscuit','Triggers <b>Easter season</b> for the next 24 hours.<br>Triggering another season will cancel this one.<br>Cost scales with unbuffed CpS and increases with every season switch.<q>All the world will be your enemy<br>and when they catch you,<br>they will kill you...<br>but first they must catch you.</q>',Game.seasonTriggerBasePrice,[0,12]);Game.last.season='easter';Game.last.pool='toggle';
9058
9059
var eggPrice=999999999999;
9060
var eggPrice2=99999999999999;
9061
new Game.Upgrade('Chicken egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>The egg. The egg came first. Get over it.</q>',eggPrice,[1,12]);
9062
new Game.Upgrade('Duck egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Then he waddled away.</q>',eggPrice,[2,12]);
9063
new Game.Upgrade('Turkey egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These hatch into strange, hand-shaped creatures.</q>',eggPrice,[3,12]);
9064
new Game.Upgrade('Quail egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These eggs are positively tiny. I mean look at them. How does this happen? Whose idea was that?</q>',eggPrice,[4,12]);
9065
new Game.Upgrade('Robin egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Holy azure-hued shelled embryos!</q>',eggPrice,[5,12]);
9066
new Game.Upgrade('Ostrich egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>One of the largest eggs in the world. More like ostrouch, am I right?<br>Guys?</q>',eggPrice,[6,12]);
9067
new Game.Upgrade('Cassowary egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>The cassowary is taller than you, possesses murderous claws and can easily outrun you.<br>You\'d do well to be casso-wary of them.</q>',eggPrice,[7,12]);
9068
new Game.Upgrade('Salmon roe','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Do the impossible, see the invisible.<br>Roe roe, fight the power?</q>',eggPrice,[8,12]);
9069
new Game.Upgrade('Frogspawn','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>I was going to make a pun about how these "toadally look like eyeballs", but froget it.</q>',eggPrice,[9,12]);
9070
new Game.Upgrade('Shark egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>HELLO IS THIS FOOD?<br>LET ME TELL YOU ABOUT FOOD.<br>WHY DO I KEEP EATING MY FRIENDS</q>',eggPrice,[10,12]);
9071
new Game.Upgrade('Turtle egg','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>Turtles, right? Hatch from shells. Grow into shells. What\'s up with that?<br>Now for my skit about airplane food.</q>',eggPrice,[11,12]);
9072
new Game.Upgrade('Ant larva','Cookie production multiplier <b>+1%</b>.<br>Cost scales with how many eggs you own.<q>These are a delicacy in some countries, I swear. You will let these invade your digestive tract, and you will derive great pleasure from it.<br>And all will be well.</q>',eggPrice,[12,12]);
9073
new Game.Upgrade('Golden goose egg','Golden cookies appear <b>5% more often</b>.<br>Cost scales with how many eggs you own.<q>The sole vestige of a tragic tale involving misguided investments.</q>',eggPrice2,[13,12]);
9074
new Game.Upgrade('Faberge egg','All buildings and upgrades are <b>1% cheaper</b>.<br>Cost scales with how many eggs you own.<q>This outrageous egg is definitely fab.</q>',eggPrice2,[14,12],function(){Game.storeToRefresh=1;});
9075
new Game.Upgrade('Wrinklerspawn','Wrinklers explode into <b>5% more cookies</b>.<br>Cost scales with how many eggs you own.<q>Look at this little guy! It\'s gonna be a big boy someday! Yes it is!</q>',eggPrice2,[15,12]);
9076
new Game.Upgrade('Cookie egg','Clicking is <b>10% more powerful</b>.<br>Cost scales with how many eggs you own.<q>The shell appears to be chipped.<br>I wonder what\'s inside this one!</q>',eggPrice2,[16,12]);
9077
new Game.Upgrade('Omelette','Other eggs appear <b>10% more frequently</b>.<br>Cost scales with how many eggs you own.<q>Fromage not included.</q>',eggPrice2,[17,12]);
9078
new Game.Upgrade('Chocolate egg','Contains <b>a lot of cookies</b>.<br>Cost scales with how many eggs you own.<q>Laid by the elusive cocoa bird. There\'s a surprise inside!</q>',eggPrice2,[18,12],function()
9079
{
9080
var cookies=Game.cookies*0.05;
9081
if (Game.prefs.popups) Game.Popup('The chocolate egg bursts into<br>'+Beautify(cookies)+'!');
9082
else Game.Notify('Chocolate egg','The egg bursts into <b>'+Beautify(cookies)+'</b> cookies!',Game.Upgrades['Chocolate egg'].icon);
9083
Game.Earn(cookies);
9084
});
9085
new Game.Upgrade('Century egg','You continually gain <b>more CpS the longer you\'ve played</b> in the current ascension.<br>Cost scales with how many eggs you own.<q>Actually not centuries-old. This one isn\'t a day over 86!</q>',eggPrice2,[19,12]);
9086
Game.last.descFunc=function(){
9087
var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;
9088
day=Math.min(day,100);
9089
var n=(1-Math.pow(1-day/100,3))*0.1;
9090
return '<div style="text-align:center;">Current boost : <b>+'+Beautify(n*100,1)+'%</b></div><div class="line"></div>'+this.desc;
9091
};
9092
new Game.Upgrade('"egg"','<b>+9 CpS</b><q>hey it\'s "egg"</q>',eggPrice2,[20,12]);
9093
9094
Game.easterEggs=['Chicken egg','Duck egg','Turkey egg','Quail egg','Robin egg','Ostrich egg','Cassowary egg','Salmon roe','Frogspawn','Shark egg','Turtle egg','Ant larva','Golden goose egg','Faberge egg','Wrinklerspawn','Cookie egg','Omelette','Chocolate egg','Century egg','"egg"'];
9095
Game.eggDrops=['Chicken egg','Duck egg','Turkey egg','Quail egg','Robin egg','Ostrich egg','Cassowary egg','Salmon roe','Frogspawn','Shark egg','Turtle egg','Ant larva'];
9096
Game.rareEggDrops=['Golden goose egg','Faberge egg','Wrinklerspawn','Cookie egg','Omelette','Chocolate egg','Century egg','"egg"'];
9097
9098
Game.GetHowManyEggs=function()
9099
{
9100
var num=0;
9101
for (var i in Game.easterEggs) {if (Game.Has(Game.easterEggs[i])) num++;}
9102
return num;
9103
}
9104
for (var i in Game.eggDrops)//scale egg prices to how many eggs you have
9105
{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(2,Game.GetHowManyEggs())*999;}}
9106
//{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,2)*Game.cookiesPs*60*5;}}
9107
for (var i in Game.rareEggDrops)
9108
{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(3,Game.GetHowManyEggs())*999;}}
9109
//{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,3)*Game.cookiesPs*60*5;}}
9110
9111
/*for (var i in Game.easterEggs)
9112
{
9113
Game.Upgrades[Game.easterEggs[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManyEggs()+'/'+Game.easterEggs.length+'</b> eggs.</div><div class="line"></div>'+this.desc;};
9114
}*/
9115
9116
Game.DropEgg=function(failRate)
9117
{
9118
failRate*=1/Game.dropRateMult();
9119
if (Game.season!='easter') return;
9120
if (Game.HasAchiev('Hide & seek champion')) failRate*=0.7;
9121
if (Game.Has('Omelette')) failRate*=0.9;
9122
if (Game.Has('Starspawn')) failRate*=0.9;
9123
if (Game.hasGod)
9124
{
9125
var godLvl=Game.hasGod('seasons');
9126
if (godLvl==1) failRate*=0.9;
9127
else if (godLvl==2) failRate*=0.95;
9128
else if (godLvl==3) failRate*=0.97;
9129
}
9130
if (Math.random()>=failRate)
9131
{
9132
var drop='';
9133
if (Math.random()<0.1) drop=choose(Game.rareEggDrops);
9134
else drop=choose(Game.eggDrops);
9135
if (Game.Has(drop) || Game.HasUnlocked(drop))//reroll if we have it
9136
{
9137
if (Math.random()<0.1) drop=choose(Game.rareEggDrops);
9138
else drop=choose(Game.eggDrops);
9139
}
9140
if (Game.Has(drop) || Game.HasUnlocked(drop)) return;
9141
Game.Unlock(drop);
9142
if (Game.prefs.popups) Game.Popup('You find :<br>'+drop+'!');
9143
else Game.Notify('You found an egg!','<b>'+drop+'</b>',Game.Upgrades[drop].icon);
9144
}
9145
};
9146
9147
order=10032;
9148
Game.NewUpgradeCookie({name:'Caramel macarons',desc:'The saltiest, chewiest of them all.',icon:[25,3],require:'Box of macarons', power:3,price: 9999999999999999999999});
9149
Game.NewUpgradeCookie({name:'Licorice macarons',desc:'Also known as "blackarons".',icon:[25,4],require:'Box of macarons', power:3,price: 9999999999999999999999999});
9150
9151
9152
order=525;
9153
new Game.TieredUpgrade('Taller tellers','Banks are <b>twice</b> as efficient.<q>Able to process a higher amount of transactions. Careful though, as taller tellers tell tall tales.</q>','Bank',1);
9154
new Game.TieredUpgrade('Scissor-resistant credit cards','Banks are <b>twice</b> as efficient.<q>For those truly valued customers.</q>','Bank',2);
9155
new Game.TieredUpgrade('Acid-proof vaults','Banks are <b>twice</b> as efficient.<q>You know what they say : better safe than sorry.</q>','Bank',3);
9156
new Game.TieredUpgrade('Chocolate coins','Banks are <b>twice</b> as efficient.<q>This revolutionary currency is much easier to melt from and into ingots - and tastes much better, for a change.</q>','Bank',4);
9157
new Game.TieredUpgrade('Exponential interest rates','Banks are <b>twice</b> as efficient.<q>Can\'t argue with mathematics! Now fork it over.</q>','Bank',5);
9158
new Game.TieredUpgrade('Financial zen','Banks are <b>twice</b> as efficient.<q>The ultimate grail of economic thought; the feng shui of big money, the stock market yoga - the Heimlich maneuver of dimes and nickels.</q>','Bank',6);
9159
9160
order=550;
9161
new Game.TieredUpgrade('Golden idols','Temples are <b>twice</b> as efficient.<q>Lure even greedier adventurers to retrieve your cookies. Now that\'s a real idol game!</q>','Temple',1);
9162
new Game.TieredUpgrade('Sacrifices','Temples are <b>twice</b> as efficient.<q>What\'s a life to a gigaton of cookies?</q>','Temple',2);
9163
new Game.TieredUpgrade('Delicious blessing','Temples are <b>twice</b> as efficient.<q>And lo, the Baker\'s almighty spoon came down and distributed holy gifts unto the believers - shimmering sugar, and chocolate dark as night, and all manner of wheats. And boy let me tell you, that party was mighty gnarly.</q>','Temple',3);
9164
new Game.TieredUpgrade('Sun festival','Temples are <b>twice</b> as efficient.<q>Free the primordial powers of your temples with these annual celebrations involving fire-breathers, traditional dancing, ritual beheadings and other merriments!</q>','Temple',4);
9165
new Game.TieredUpgrade('Enlarged pantheon','Temples are <b>twice</b> as efficient.<q>Enough spiritual inadequacy! More divinities than you\'ll ever need, or your money back! 100% guaranteed!</q>','Temple',5);
9166
new Game.TieredUpgrade('Great Baker in the sky','Temples are <b>twice</b> as efficient.<q>This is it. The ultimate deity has finally cast Their sublimely divine eye upon your operation; whether this is a good thing or possibly the end of days is something you should find out very soon.</q>','Temple',6);
9167
9168
order=575;
9169
new Game.TieredUpgrade('Pointier hats','Wizard towers are <b>twice</b> as efficient.<q>Tests have shown increased thaumic receptivity relative to the geometric proportions of wizardly conic implements.</q>','Wizard tower',1);
9170
new Game.TieredUpgrade('Beardlier beards','Wizard towers are <b>twice</b> as efficient.<q>Haven\'t you heard? The beard is the word.</q>','Wizard tower',2);
9171
new Game.TieredUpgrade('Ancient grimoires','Wizard towers are <b>twice</b> as efficient.<q>Contain interesting spells such as "Turn Water To Drool", "Grow Eyebrows On Furniture" and "Summon Politician".</q>','Wizard tower',3);
9172
new Game.TieredUpgrade('Kitchen curses','Wizard towers are <b>twice</b> as efficient.<q>Exotic magic involved in all things pastry-related. Hexcellent!</q>','Wizard tower',4);
9173
new Game.TieredUpgrade('School of sorcery','Wizard towers are <b>twice</b> as efficient.<q>This cookie-funded academy of witchcraft is home to the 4 prestigious houses of magic : the Jocks, the Nerds, the Preps, and the Deathmunchers.</q>','Wizard tower',5);
9174
new Game.TieredUpgrade('Dark formulas','Wizard towers are <b>twice</b> as efficient.<q>Eldritch forces are at work behind these spells - you get the feeling you really shouldn\'t be messing with those. But I mean, free cookies, right?</q>','Wizard tower',6);
9175
9176
order=250;
9177
Game.GrandmaSynergy('Banker grandmas','A nice banker to cash in more cookies.','Bank');
9178
Game.GrandmaSynergy('Priestess grandmas','A nice priestess to praise the one true Baker in the sky.','Temple');
9179
Game.GrandmaSynergy('Witch grandmas','A nice witch to cast a zip, and a zoop, and poof! Cookies.','Wizard tower');
9180
9181
9182
9183
order=0;
9184
new Game.Upgrade('Tin of british tea biscuits','Contains an assortment of fancy biscuits.<q>Every time is tea time.</q>',25,[21,8]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];
9185
new Game.Upgrade('Box of macarons','Contains an assortment of macarons.<q>Multicolored delicacies filled with various kinds of jam.<br>Not to be confused with macaroons, macaroni, macarena or any of that nonsense.</q>',25,[20,8]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];
9186
new Game.Upgrade('Box of brand biscuits','Contains an assortment of popular biscuits.<q>They\'re brand new!</q>',25,[20,9]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];
9187
9188
order=10020;
9189
Game.NewUpgradeCookie({name:'Pure black chocolate cookies',desc:'Dipped in a lab-made substance darker than the darkest cocoa (dubbed "chocoalate").',icon:[26,3],power: 5,price: 9999999999999999*5});
9190
Game.NewUpgradeCookie({name:'Pure white chocolate cookies',desc:'Elaborated on the nano-scale, the coating on this biscuit is able to refract light even in a pitch-black environment.',icon:[26,4],power: 5,price: 9999999999999999*5});
9191
Game.NewUpgradeCookie({name:'Ladyfingers',desc:'Cleaned and sanitized so well you\'d swear they\'re actual biscuits.',icon:[27,3],power: 3,price: 99999999999999999});
9192
Game.NewUpgradeCookie({name:'Tuiles',desc:'These never go out of tile.',icon:[27,4],power: 3,price: 99999999999999999*5});
9193
Game.NewUpgradeCookie({name:'Chocolate-stuffed biscuits',desc:'A princely snack!<br>The holes are so the chocolate stuffing can breathe.',icon:[28,3],power: 3,price: 999999999999999999});
9194
Game.NewUpgradeCookie({name:'Checker cookies',desc:'A square cookie? This solves so many storage and packaging problems! You\'re a genius!',icon:[28,4],power: 3,price: 999999999999999999*5});
9195
Game.NewUpgradeCookie({name:'Butter cookies',desc:'These melt right off your mouth and into your heart. (Let\'s face it, they\'re rather fattening.)',icon:[29,3],power: 3,price: 9999999999999999999});
9196
Game.NewUpgradeCookie({name:'Cream cookies',desc:'It\'s like two chocolate chip cookies! But brought together with the magic of cream! It\'s fiendishly perfect!',icon:[29,4],power: 3,price: 9999999999999999999*5});
9197
9198
order=0;
9199
var desc='Placing an upgrade in this slot will make its effects <b>permanent</b> across all playthroughs.';
9200
new Game.Upgrade('Permanent upgrade slot I',desc, 100,[0,10]);Game.last.pool='prestige';Game.last.iconFunction=function(){return Game.PermanentSlotIcon(0);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(0);};
9201
new Game.Upgrade('Permanent upgrade slot II',desc, 20000,[1,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot I'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(1);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(1);};
9202
new Game.Upgrade('Permanent upgrade slot III',desc, 3000000,[2,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot II'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(2);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(2);};
9203
new Game.Upgrade('Permanent upgrade slot IV',desc, 400000000,[3,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot III'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(3);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(3);};
9204
new Game.Upgrade('Permanent upgrade slot V',desc, 50000000000,[4,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot IV'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(4);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(4);};
9205
9206
var slots=['Permanent upgrade slot I','Permanent upgrade slot II','Permanent upgrade slot III','Permanent upgrade slot IV','Permanent upgrade slot V'];
9207
for (var i=0;i<slots.length;i++)
9208
{
9209
Game.Upgrades[slots[i]].descFunc=function(i){return function(context){
9210
if (Game.permanentUpgrades[i]==-1) return this.desc+(context=='stats'?'':'<br><b>Click to activate.</b>');
9211
var upgrade=Game.UpgradesById[Game.permanentUpgrades[i]];
9212
return '<div style="text-align:center;">'+'Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(upgrade.icon[2]?'background-image:url('+upgrade.icon[2]+');':'')+'background-position:'+(-upgrade.icon[0]*48)+'px '+(-upgrade.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+upgrade.name+'</b><div class="line"></div></div>'+this.desc+(context=='stats'?'':'<br><b>Click to activate.</b>');
9213
};}(i);
9214
}
9215
9216
Game.PermanentSlotIcon=function(slot)
9217
{
9218
if (Game.permanentUpgrades[slot]==-1) return [slot,10];
9219
return Game.UpgradesById[Game.permanentUpgrades[slot]].icon;
9220
}
9221
Game.AssignPermanentSlot=function(slot)
9222
{
9223
PlaySound('snd/tick.mp3');
9224
Game.tooltip.hide();
9225
var list=[];
9226
for (var i in Game.Upgrades)
9227
{
9228
var me=Game.Upgrades[i];
9229
if (me.bought && me.unlocked && !me.noPerm && (me.pool=='' || me.pool=='cookie'))
9230
{
9231
var fail=0;
9232
for (var ii in Game.permanentUpgrades) {if (Game.permanentUpgrades[ii]==me.id) fail=1;}//check if not already in another permaslot
9233
if (!fail) list.push(me);
9234
}
9235
}
9236
9237
var sortMap=function(a,b)
9238
{
9239
if (a.order>b.order) return 1;
9240
else if (a.order<b.order) return -1;
9241
else return 0;
9242
}
9243
list.sort(sortMap);
9244
9245
var upgrades='';
9246
for (var i in list)
9247
{
9248
var me=list[i];
9249
upgrades+=Game.crate(me,'','PlaySound(\'snd/tick.mp3\');Game.PutUpgradeInPermanentSlot('+me.id+','+slot+');','upgradeForPermanent'+me.id);
9250
}
9251
var upgrade=Game.permanentUpgrades[slot];
9252
Game.SelectingPermanentUpgrade=upgrade;
9253
Game.Prompt('<h3>Pick an upgrade to make permanent</h3>'+
9254
9255
'<div class="line"></div><div style="margin:4px auto;clear:both;width:120px;"><div class="crate upgrade enabled" style="background-position:'+(-slot*48)+'px '+(-10*48)+'px;"></div><div id="upgradeToSlotNone" class="crate upgrade enabled" style="background-position:'+(-0*48)+'px '+(-7*48)+'px;display:'+(upgrade!=-1?'none':'block')+';"></div><div id="upgradeToSlotWrap" style="float:left;display:'+(upgrade==-1?'none':'block')+';">'+(Game.crate(Game.UpgradesById[upgrade==-1?0:upgrade],'','','upgradeToSlot'))+'</div></div>'+
9256
'<div class="block crateBox" style="overflow-y:scroll;float:left;clear:left;width:317px;padding:0px;height:250px;">'+upgrades+'</div>'+
9257
'<div class="block" style="float:right;width:152px;clear:right;height:234px;">Here are all the upgrades you\'ve purchased last playthrough.<div class="line"></div>Pick one to permanently gain its effects!<div class="line"></div>You can reassign this slot anytime you ascend.</div>'
9258
,[['Confirm','Game.permanentUpgrades['+slot+']=Game.SelectingPermanentUpgrade;Game.BuildAscendTree();Game.ClosePrompt();'],'Cancel'],0,'widePrompt');
9259
}
9260
Game.SelectingPermanentUpgrade=-1;
9261
Game.PutUpgradeInPermanentSlot=function(upgrade,slot)
9262
{
9263
Game.SelectingPermanentUpgrade=upgrade;
9264
l('upgradeToSlotWrap').innerHTML='';
9265
l('upgradeToSlotWrap').style.display=(upgrade==-1?'none':'block');
9266
l('upgradeToSlotNone').style.display=(upgrade!=-1?'none':'block');
9267
l('upgradeToSlotWrap').innerHTML=(Game.crate(Game.UpgradesById[upgrade==-1?0:upgrade],'','','upgradeToSlot'));
9268
}
9269
9270
new Game.Upgrade('Starspawn','Eggs drop <b>10%</b> more often.<br>Golden cookies appear <b>2%</b> more often during Easter.',111111,[0,12]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];
9271
new Game.Upgrade('Starsnow','Christmas cookies drop <b>5%</b> more often.<br>Reindeer appear <b>5%</b> more often.',111111,[12,9]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];
9272
new Game.Upgrade('Starterror','Spooky cookies drop <b>10%</b> more often.<br>Golden cookies appear <b>2%</b> more often during Halloween.',111111,[13,8]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];
9273
new Game.Upgrade('Starlove','Heart cookies are <b>50%</b> more powerful.<br>Golden cookies appear <b>2%</b> more often during Valentines.',111111,[20,3]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];
9274
new Game.Upgrade('Startrade','Golden cookies appear <b>5%</b> more often during Business day.',111111,[17,6]);Game.last.pool='prestige';Game.last.parents=['Season switcher'];
9275
9276
var angelPriceFactor=7;
9277
var desc=function(percent,total){return 'You gain another <b>+'+percent+'%</b> of your regular CpS while the game is closed, for a total of <b>'+total+'%</b>.';}
9278
new Game.Upgrade('Angels',desc(10,15)+'<q>Lowest-ranking at the first sphere of pastry heaven, angels are tasked with delivering new recipes to the mortals they deem worthy.</q>',Math.pow(angelPriceFactor,1),[0,11]);Game.last.pool='prestige';Game.last.parents=['Twin Gates of Transcendence'];
9279
new Game.Upgrade('Archangels',desc(10,25)+'<q>Members of the first sphere of pastry heaven, archangels are responsible for the smooth functioning of the world\'s largest bakeries.</q>',Math.pow(angelPriceFactor,2),[1,11]);Game.last.pool='prestige';Game.last.parents=['Angels'];
9280
new Game.Upgrade('Virtues',desc(10,35)+'<q>Found at the second sphere of pastry heaven, virtues make use of their heavenly strength to push and drag the stars of the cosmos.</q>',Math.pow(angelPriceFactor,3),[2,11]);Game.last.pool='prestige';Game.last.parents=['Archangels'];
9281
new Game.Upgrade('Dominions',desc(10,45)+'<q>Ruling over the second sphere of pastry heaven, dominions hold a managerial position and are in charge of accounting and regulating schedules.</q>',Math.pow(angelPriceFactor,4),[3,11]);Game.last.pool='prestige';Game.last.parents=['Virtues'];
9282
new Game.Upgrade('Cherubim',desc(10,55)+'<q>Sieging at the first sphere of pastry heaven, the four-faced cherubim serve as heavenly bouncers and bodyguards.</q>',Math.pow(angelPriceFactor,5),[4,11]);Game.last.pool='prestige';Game.last.parents=['Dominions'];
9283
new Game.Upgrade('Seraphim',desc(10,65)+'<q>Leading the first sphere of pastry heaven, seraphim possess ultimate knowledge of everything pertaining to baking.</q>',Math.pow(angelPriceFactor,6),[5,11]);Game.last.pool='prestige';Game.last.parents=['Cherubim'];
9284
new Game.Upgrade('God',desc(10,75)+'<q>Like Santa, but less fun.</q>',Math.pow(angelPriceFactor,7),[6,11]);Game.last.pool='prestige';Game.last.parents=['Seraphim'];
9285
9286
new Game.Upgrade('Twin Gates of Transcendence','You now <b>keep making cookies while the game is closed</b>, at the rate of <b>5%</b> of your regular CpS and up to <b>1 hour</b> after the game is closed.<br>(Beyond 1 hour, this is reduced by a further 90% - your rate goes down to <b>0.5%</b> of your CpS.)<q>This is one occasion you\'re always underdressed for. Don\'t worry, just rush in past the bouncer and pretend you know people.</q>',1,[15,11]);Game.last.pool='prestige';
9287
9288
new Game.Upgrade('Heavenly luck','Golden cookies appear <b>5%</b> more often.<q>Someone up there likes you.</q>',77,[22,6]);Game.last.pool='prestige';
9289
new Game.Upgrade('Lasting fortune','Golden cookies effects last <b>10%</b> longer.<q>This isn\'t your average everyday luck. This is... advanced luck.</q>',777,[23,6]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];
9290
new Game.Upgrade('Decisive fate','Golden cookies stay <b>5%</b> longer.<q>Life just got a bit more intense.</q>',7777,[10,14]);Game.last.pool='prestige';Game.last.parents=['Lasting fortune'];
9291
9292
new Game.Upgrade('Divine discount','Buildings are <b>1% cheaper</b>.<q>Someone special deserves a special price.</q>',99999,[21,7]);Game.last.pool='prestige';Game.last.parents=['Decisive fate'];
9293
new Game.Upgrade('Divine sales','Upgrades are <b>1% cheaper</b>.<q>Everything must go!</q>',99999,[18,7]);Game.last.pool='prestige';Game.last.parents=['Decisive fate'];
9294
new Game.Upgrade('Divine bakeries','Cookie upgrades are <b>5 times cheaper</b>.<q>They sure know what they\'re doing.</q>',399999,[17,7]);Game.last.pool='prestige';Game.last.parents=['Divine sales','Divine discount'];
9295
9296
new Game.Upgrade('Starter kit','You start with <b>10 cursors</b>.<q>This can come in handy.</q>',50,[0,14]);Game.last.pool='prestige';Game.last.parents=['Tin of british tea biscuits','Box of macarons','Box of brand biscuits','Tin of butter cookies'];
9297
new Game.Upgrade('Starter kitchen','You start with <b>5 grandmas</b>.<q>Where did these come from?</q>',5000,[1,14]);Game.last.pool='prestige';Game.last.parents=['Starter kit'];
9298
new Game.Upgrade('Halo gloves','Clicks are <b>10% more powerful</b>.<q>Smite that cookie.</q>',55555,[22,7]);Game.last.pool='prestige';Game.last.parents=['Starter kit'];
9299
9300
new Game.Upgrade('Kitten angels','You gain <b>more CpS</b> the more milk you have.<q>All cats go to heaven.</q>',9000,[23,7]);Game.last.pool='prestige';Game.last.parents=['Dominions'];Game.last.kitten=1;
9301
9302
new Game.Upgrade('Unholy bait','Wrinklers appear <b>5 times</b> as fast.<q>No wrinkler can resist the scent of worm biscuits.</q>',44444,[15,12]);Game.last.pool='prestige';Game.last.parents=['Starter kitchen'];
9303
new Game.Upgrade('Sacrilegious corruption','Wrinklers regurgitate <b>5%</b> more cookies.<q>Unique in the animal kingdom, the wrinkler digestive tract is able to withstand an incredible degree of dilation - provided you prod them appropriately.</q>',444444,[19,8]);Game.last.pool='prestige';Game.last.parents=['Unholy bait'];
9304
9305
9306
order=200;new Game.TieredUpgrade('Xtreme walkers','Grandmas are <b>twice</b> as efficient.<q>Complete with flame decals and a little horn that goes "toot".</q>','Grandma',7);
9307
order=300;new Game.TieredUpgrade('Fudge fungus','Farms are <b>twice</b> as efficient.<q>A sugary parasite whose tendrils help cookie growth.<br>Please do not breathe in the spores. In case of spore ingestion, seek medical help within the next 36 seconds.</q>','Farm',7);
9308
order=400;new Game.TieredUpgrade('Planetsplitters','Mines are <b>twice</b> as efficient.<q>These new state-of-the-art excavators have been tested on Merula, Globort and Flwanza VI, among other distant planets which have been curiously quiet lately.</q>','Mine',7);
9309
order=500;new Game.TieredUpgrade('Cyborg workforce','Factories are <b>twice</b> as efficient.<q>Semi-synthetic organisms don\'t slack off, don\'t unionize, and have 20% shorter lunch breaks, making them ideal labor fodder.</q>','Factory',7);
9310
order=525;new Game.TieredUpgrade('Way of the wallet','Banks are <b>twice</b> as efficient.<q>This new monetary school of thought is all the rage on the banking scene; follow its precepts and you may just profit from it.</q>','Bank',7);
9311
order=550;new Game.TieredUpgrade('Creation myth','Temples are <b>twice</b> as efficient.<q>Stories have been circulating about the origins of the very first cookie that was ever baked; tales of how it all began, in the Dough beyond time and the Ovens of destiny.</q>','Temple',7);
9312
order=575;new Game.TieredUpgrade('Cookiemancy','Wizard towers are <b>twice</b> as efficient.<q>There it is; the perfected school of baking magic. From summoning chips to hexing nuts, there is not a single part of cookie-making that hasn\'t been improved tenfold by magic tricks.</q>','Wizard tower',7);
9313
order=600;new Game.TieredUpgrade('Dyson sphere','Shipments are <b>twice</b> as efficient.<q>You\'ve found a way to apply your knowledge of cosmic technology to slightly more local endeavors; this gigantic sphere of meta-materials, wrapping the solar system, is sure to kick your baking abilities up a notch.</q>','Shipment',7);
9314
order=700;new Game.TieredUpgrade('Theory of atomic fluidity','Alchemy labs are <b>twice</b> as efficient.<q>Pushing alchemy to its most extreme limits, you find that everything is transmutable into anything else - lead to gold, mercury to water; more importantly, you realize that anything can -and should- be converted to cookies.</q>','Alchemy lab',7);
9315
order=800;new Game.TieredUpgrade('End of times back-up plan','Portals are <b>twice</b> as efficient.<q>Just in case, alright?</q>','Portal',7);
9316
order=900;new Game.TieredUpgrade('Great loop hypothesis','Time machines are <b>twice</b> as efficient.<q>What if our universe is just one instance of an infinite cycle? What if, before and after it, stretched infinite amounts of the same universe, themselves containing infinite amounts of cookies?</q>','Time machine',7);
9317
order=1000;new Game.TieredUpgrade('The Pulse','Antimatter condensers are <b>twice</b> as efficient.<q>You\'ve tapped into the very pulse of the cosmos, a timeless rhythm along which every material and antimaterial thing beats in unison. This, somehow, means more cookies.</q>','Antimatter condenser',7);
9318
order=1100;
9319
new Game.TieredUpgrade('Lux sanctorum','Prisms are <b>twice</b> as efficient.<q>Your prism attendants have become increasingly mesmerized with something in the light - or maybe something beyond it; beyond us all, perhaps?</q>','Prism',7);
9320
9321
9322
order=200;new Game.TieredUpgrade('The Unbridling','Grandmas are <b>twice</b> as efficient.<q>It might be a classic tale of bad parenting, but let\'s see where grandma is going with this.</q>','Grandma',8);
9323
order=300;new Game.TieredUpgrade('Wheat triffids','Farms are <b>twice</b> as efficient.<q>Taking care of crops is so much easier when your plants can just walk about and help around the farm.<br>Do not pet. Do not feed. Do not attempt to converse with.</q>','Farm',8);
9324
order=400;new Game.TieredUpgrade('Canola oil wells','Mines are <b>twice</b> as efficient.<q>A previously untapped resource, canola oil permeates the underground olifers which grant it its particular taste and lucrative properties.</q>','Mine',8);
9325
order=500;new Game.TieredUpgrade('78-hour days','Factories are <b>twice</b> as efficient.<q>Why didn\'t we think of this earlier?</q>','Factory',8);
9326
order=525;new Game.TieredUpgrade('The stuff rationale','Banks are <b>twice</b> as efficient.<q>If not now, when? If not it, what? If not things... stuff?</q>','Bank',8);
9327
order=550;new Game.TieredUpgrade('Theocracy','Temples are <b>twice</b> as efficient.<q>You\'ve turned your cookie empire into a perfect theocracy, gathering the adoration of zillions of followers from every corner of the universe.<br>Don\'t let it go to your head.</q>','Temple',8);
9328
order=575;new Game.TieredUpgrade('Rabbit trick','Wizard towers are <b>twice</b> as efficient.<q>Using nothing more than a fancy top hat, your wizards have found a way to simultaneously curb rabbit population and produce heaps of extra cookies for basically free!<br>Resulting cookies may or may not be fit for vegans.</q>','Wizard tower',8);
9329
order=600;new Game.TieredUpgrade('The final frontier','Shipments are <b>twice</b> as efficient.<q>It\'s been a long road, getting from there to here. It\'s all worth it though - the sights are lovely and the oil prices slightly more reasonable.</q>','Shipment',8);
9330
order=700;new Game.TieredUpgrade('Beige goo','Alchemy labs are <b>twice</b> as efficient.<q>Well now you\'ve done it. Good job. Very nice. That\'s 3 galaxies you\'ve just converted into cookies. Good thing you can hop from universe to universe.</q>','Alchemy lab',8);
9331
order=800;new Game.TieredUpgrade('Maddening chants','Portals are <b>twice</b> as efficient.<q>A popular verse goes like so : "jau\'hn madden jau\'hn madden aeiouaeiouaeiou brbrbrbrbrbrbr"</q>','Portal',8);
9332
order=900;new Game.TieredUpgrade('Cookietopian moments of maybe','Time machines are <b>twice</b> as efficient.<q>Reminiscing how things could have been, should have been, will have been.</q>','Time machine',8);
9333
order=1000;new Game.TieredUpgrade('Some other super-tiny fundamental particle? Probably?','Antimatter condensers are <b>twice</b> as efficient.<q>When even the universe is running out of ideas, that\'s when you know you\'re nearing the end.</q>','Antimatter condenser',8);
9334
order=1100;
9335
new Game.TieredUpgrade('Reverse shadows','Prisms are <b>twice</b> as efficient.<q>Oh man, this is really messing with your eyes.</q>','Prism',8);
9336
9337
9338
order=20000;
9339
new Game.Upgrade('Kitten accountants','You gain <b>more CpS</b> the more milk you have.<q>business going great, sir</q>',900000000000000000000000,Game.GetIcon('Kitten',6));Game.last.kitten=1;Game.MakeTiered(Game.last,6,18);
9340
new Game.Upgrade('Kitten specialists','You gain <b>more CpS</b> the more milk you have.<q>optimeowzing your workflow like whoah, sir</q>',900000000000000000000000000,Game.GetIcon('Kitten',7));Game.last.kitten=1;Game.MakeTiered(Game.last,7,18);
9341
new Game.Upgrade('Kitten experts','You gain <b>more CpS</b> the more milk you have.<q>10 years expurrrtise in the cookie business, sir</q>',900000000000000000000000000000,Game.GetIcon('Kitten',8));Game.last.kitten=1;Game.MakeTiered(Game.last,8,18);
9342
9343
new Game.Upgrade('How to bake your dragon','Allows you to purchase a <b>crumbly egg</b> once you have earned 1 million cookies.<q>A tome full of helpful tips such as "oh god, stay away from it", "why did we buy this thing, it\'s not even house-broken" and "groom twice a week in the direction of the scales".</q>',9,[22,12]);Game.last.pool='prestige';
9344
9345
order=25100;
9346
new Game.Upgrade('A crumbly egg','Unlocks the <b>cookie dragon egg</b>.<q>Thank you for adopting this robust, fun-loving cookie dragon! It will bring you years of joy and entertainment.<br>Keep in a dry and cool place, and away from other house pets. Subscription to home insurance is strongly advised.</q>',25,[21,12]);
9347
9348
new Game.Upgrade('Chimera','Synergy upgrades are <b>2% cheaper</b>.<br>You gain another <b>+5%</b> of your regular CpS while the game is closed.<br>You retain optimal cookie production while the game is closed for <b>2 more days</b>.<q>More than the sum of its parts.</q>',Math.pow(angelPriceFactor,9),[24,7]);Game.last.pool='prestige';Game.last.parents=['God','Lucifer','Synergies Vol. II'];
9349
9350
new Game.Upgrade('Tin of butter cookies','Contains an assortment of rich butter cookies.<q>Five varieties of danish cookies.<br>Complete with little paper cups.</q>',25,[21,9]);Game.last.pool='prestige';Game.last.parents=['Heavenly cookies'];
9351
9352
new Game.Upgrade('Golden switch','Unlocks the <b>golden switch</b>, which passively boosts your CpS by 50% but disables golden cookies.<q>Less clicking, more idling.</q>',999,[21,10]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];
9353
9354
new Game.Upgrade('Classic dairy selection','Unlocks the <b>milk selector</b>, letting you pick which milk is displayed under your cookie.<br>Comes with a variety of basic flavors.<q>Don\'t have a cow, man.</q>',9,[1,8]);Game.last.pool='prestige';Game.last.parents=[];
9355
9356
new Game.Upgrade('Fanciful dairy selection','Contains more exotic flavors for your milk selector.<q>Strong bones for the skeleton army.</q>',1000000,[9,7]);Game.last.pool='prestige';Game.last.parents=['Classic dairy selection'];
9357
9358
order=10300;
9359
Game.NewUpgradeCookie({name:'Dragon cookie',desc:'Imbued with the vigor and vitality of a full-grown cookie dragon, this mystical cookie will embolden your empire for the generations to come.',icon:[10,25],power:5,price:9999999999999999*7,locked:1});
9360
9361
9362
order=40000;
9363
new Game.Upgrade('Golden switch [off]','Turning this on will give you a passive <b>+50% CpS</b>, but prevents golden cookies from spawning.<br>Cost is equal to 1 hour of production.',1000000,[20,10]);
9364
Game.last.pool='toggle';Game.last.toggleInto='Golden switch [on]';
9365
Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}
9366
var func=function(){
9367
if (Game.Has('Residual luck'))
9368
{
9369
var bonus=0;
9370
var upgrades=Game.goldenCookieUpgrades;
9371
for (var i in upgrades) {if (Game.Has(upgrades[i])) bonus++;}
9372
return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.goldenCookieUpgrades)+'<br><br>The effective boost is <b>+'+Beautify(Math.round(50+bonus*10))+'%</b><br>thanks to residual luck<br>and your <b>'+bonus+'</b> golden cookie upgrade'+(bonus==1?'':'s')+'.</div><div class="line"></div>'+this.desc;
9373
}
9374
return this.desc;
9375
};
9376
Game.last.descFunc=func;
9377
9378
new Game.Upgrade('Golden switch [on]','The switch is currently giving you a passive <b>+50% CpS</b>; it also prevents golden cookies from spawning.<br>Turning it off will revert those effects.<br>Cost is equal to 1 hour of production.',1000000,[21,10]);
9379
Game.last.pool='toggle';Game.last.toggleInto='Golden switch [off]';
9380
Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}
9381
Game.last.descFunc=func;
9382
9383
order=50000;
9384
new Game.Upgrade('Milk selector','Lets you pick what flavor of milk to display.',0,[1,8]);
9385
Game.last.descFunc=function(){
9386
var choice=this.choicesFunction()[Game.milkType];
9387
if (!choice) choice=this.choicesFunction()[0];
9388
return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+choice.icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;
9389
};
9390
9391
Game.last.pool='toggle';
9392
Game.last.choicesFunction=function()
9393
{
9394
var rank=0;
9395
var choices=[];
9396
choices[0]={name:'Automatic',icon:[0,7]};
9397
choices[1]={name:'Plain milk',icon:[1,8],rank:rank++};
9398
choices[2]={name:'Chocolate milk',icon:[2,8],rank:rank++};
9399
choices[3]={name:'Raspberry milk',icon:[3,8],rank:rank++};
9400
choices[4]={name:'Orange milk',icon:[4,8],rank:rank++};
9401
choices[5]={name:'Caramel milk',icon:[5,8],rank:rank++};
9402
choices[6]={name:'Banana milk',icon:[6,8],rank:rank++};
9403
choices[7]={name:'Lime milk',icon:[7,8],rank:rank++};
9404
choices[8]={name:'Blueberry milk',icon:[8,8],rank:rank++};
9405
choices[9]={name:'Strawberry milk',icon:[9,8],rank:rank++};
9406
choices[10]={name:'Vanilla milk',icon:[10,8],rank:rank++};
9407
9408
choices[19]={name:'Honey milk',icon:[21,23],rank:rank++};
9409
choices[20]={name:'Coffee milk',icon:[22,23],rank:rank++};
9410
choices[21]={name:'Tea milk',icon:[23,23],rank:rank++};
9411
choices[22]={name:'Coconut milk',icon:[24,23],rank:rank++};
9412
choices[23]={name:'Cherry milk',icon:[25,23],rank:rank++};
9413
9414
choices[25]={name:'Spiced milk',icon:[26,23],rank:rank++};
9415
choices[26]={name:'Maple milk',icon:[28,23],rank:rank++};
9416
choices[27]={name:'Mint milk',icon:[29,23],rank:rank++};
9417
choices[28]={name:'Licorice milk',icon:[30,23],rank:rank++};
9418
choices[29]={name:'Rose milk',icon:[31,23],rank:rank++};
9419
choices[30]={name:'Dragonfruit milk',icon:[21,24],rank:rank++};
9420
9421
if (Game.Has('Fanciful dairy selection'))
9422
{
9423
choices[11]={name:'Zebra milk',icon:[10,7],order:10,div:true};
9424
choices[12]={name:'Cosmic milk',icon:[9,7],order:10};
9425
choices[13]={name:'Flaming milk',icon:[8,7],order:10};
9426
choices[14]={name:'Sanguine milk',icon:[7,7],order:10};
9427
choices[15]={name:'Midas milk',icon:[6,7],order:10};
9428
choices[16]={name:'Midnight milk',icon:[5,7],order:10};
9429
choices[17]={name:'Green inferno milk',icon:[4,7],order:10};
9430
choices[18]={name:'Frostfire milk',icon:[3,7],order:10};
9431
9432
choices[24]={name:'Soy milk',icon:[27,23],order:10};
9433
}
9434
9435
var maxRank=Math.floor(Game.AchievementsOwned/25);
9436
for (var i in choices)
9437
{
9438
if (choices[i].rank && choices[i].rank>maxRank) choices[i]=0;
9439
}
9440
9441
choices[Game.milkType].selected=1;
9442
return choices;
9443
}
9444
Game.last.choicesPick=function(id)
9445
{Game.milkType=id;}
9446
9447
Game.MilksByChoice={
9448
0:{pic:'milkPlain'},
9449
1:{pic:'milkPlain'},
9450
2:{pic:'milkChocolate'},
9451
3:{pic:'milkRaspberry'},
9452
4:{pic:'milkOrange'},
9453
5:{pic:'milkCaramel'},
9454
6:{pic:'milkBanana'},
9455
7:{pic:'milkLime'},
9456
8:{pic:'milkBlueberry'},
9457
9:{pic:'milkStrawberry'},
9458
10:{pic:'milkVanilla'},
9459
11:{pic:'milkZebra'},
9460
12:{pic:'milkStars'},
9461
13:{pic:'milkFire'},
9462
14:{pic:'milkBlood'},
9463
15:{pic:'milkGold'},
9464
16:{pic:'milkBlack'},
9465
17:{pic:'milkGreenFire'},
9466
18:{pic:'milkBlueFire'},
9467
19:{pic:'milkHoney'},
9468
20:{pic:'milkCoffee'},
9469
21:{pic:'milkTea'},
9470
22:{pic:'milkCoconut'},
9471
23:{pic:'milkCherry'},
9472
24:{pic:'milkSoy'},
9473
25:{pic:'milkSpiced'},
9474
26:{pic:'milkMaple'},
9475
27:{pic:'milkMint'},
9476
28:{pic:'milkLicorice'},
9477
29:{pic:'milkRose'},
9478
30:{pic:'milkDragonfruit'},
9479
};
9480
9481
9482
order=10300;
9483
var butterBiscuitMult=100000000;
9484
Game.NewUpgradeCookie({name:'Milk chocolate butter biscuit',desc:'Rewarded for owning 100 of everything.<br>It bears the engraving of a fine entrepreneur.',icon:[27,8],power: 10,price: 999999999999999999999*butterBiscuitMult,locked:1});
9485
Game.NewUpgradeCookie({name:'Dark chocolate butter biscuit',desc:'Rewarded for owning 150 of everything.<br>It is adorned with the image of an experienced cookie tycoon.',icon:[27,9],power: 10,price: 999999999999999999999999*butterBiscuitMult,locked:1});
9486
Game.NewUpgradeCookie({name:'White chocolate butter biscuit',desc:'Rewarded for owning 200 of everything.<br>The chocolate is chiseled to depict a masterful pastry magnate.',icon:[28,9],power: 10,price: 999999999999999999999999999*butterBiscuitMult,locked:1});
9487
Game.NewUpgradeCookie({name:'Ruby chocolate butter biscuit',desc:'Rewarded for owning 250 of everything.<br>Covered in a rare red chocolate, this biscuit is etched to represent the face of a cookie industrialist gone mad with power.',icon:[28,8],power: 10,price: 999999999999999999999999999999*butterBiscuitMult,locked:1});
9488
9489
order=10020;
9490
Game.NewUpgradeCookie({name:'Gingersnaps',desc:'Cookies with a soul. Probably.',icon:[29,10],power: 4,price: 99999999999999999999});
9491
Game.NewUpgradeCookie({name:'Cinnamon cookies',desc:'The secret is in the patented swirly glazing.',icon:[23,8],power: 4,price: 99999999999999999999*5});
9492
Game.NewUpgradeCookie({name:'Vanity cookies',desc:'One tiny candied fruit sits atop this decadent cookie.',icon:[22,8],power: 4,price: 999999999999999999999});
9493
Game.NewUpgradeCookie({name:'Cigars',desc:'Close, but no match for those extravagant cookie straws they serve in coffee shops these days.',icon:[25,8],power: 4,price: 999999999999999999999*5});
9494
Game.NewUpgradeCookie({name:'Pinwheel cookies',desc:'Bringing you the dizzying combination of brown flavor and beige taste!',icon:[22,10],power: 4,price: 9999999999999999999999});
9495
Game.NewUpgradeCookie({name:'Fudge squares',desc:'Not exactly cookies, but you won\'t care once you\'ve tasted one of these.<br>They\'re so good, it\'s fudged-up!',icon:[24,8],power: 4,price: 9999999999999999999999*5});
9496
9497
order=10030;
9498
Game.NewUpgradeCookie({name:'Digits',desc:'Three flavors, zero phalanges.',icon:[26,8],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
9499
9500
order=10029;
9501
Game.NewUpgradeCookie({name:'Butter horseshoes',desc:'It would behoove you to not overindulge in these.',icon:[22,9],require:'Tin of butter cookies',power: 4, price: 99999999999999999999999});
9502
Game.NewUpgradeCookie({name:'Butter pucks',desc:'Lord, what fools these mortals be!<br>(This is kind of a hokey reference.)',icon:[23,9],require:'Tin of butter cookies',power: 4, price: 99999999999999999999999*5});
9503
Game.NewUpgradeCookie({name:'Butter knots',desc:'Look, you can call these pretzels if you want, but you\'d just be fooling yourself, wouldn\'t you?',icon:[24,9],require:'Tin of butter cookies',power: 4, price: 999999999999999999999999});
9504
Game.NewUpgradeCookie({name:'Butter slabs',desc:'Nothing butter than a slab to the face.',icon:[25,9],require:'Tin of butter cookies',power: 4, price: 999999999999999999999999*5});
9505
Game.NewUpgradeCookie({name:'Butter swirls',desc:'These are equal parts sugar, butter, and warm fuzzy feelings - all of which cause millions of deaths everyday.',icon:[26,9],require:'Tin of butter cookies',power: 4, price: 9999999999999999999999999});
9506
9507
order=10020;
9508
Game.NewUpgradeCookie({name:'Shortbread biscuits',desc:'These rich butter cookies are neither short, nor bread. What a country!',icon:[23,10],power: 4,price: 99999999999999999999999});
9509
Game.NewUpgradeCookie({name:'Millionaires\' shortbreads',desc:'Three thought-provoking layers of creamy chocolate, hard-working caramel and crumbly biscuit in a poignant commentary of class struggle.',icon:[24,10],power: 4,price: 99999999999999999999999*5});
9510
Game.NewUpgradeCookie({name:'Caramel cookies',desc:'The polymerized carbohydrates adorning these cookies are sure to stick to your teeth for quite a while.',icon:[25,10],power: 4,price: 999999999999999999999999});
9511
9512
9513
var desc=function(totalHours){
9514
var hours=totalHours%24;
9515
var days=Math.floor(totalHours/24);
9516
var str=hours+(hours==1?' hour':' hours');
9517
if (days>0) str=days+(days==1?' day':' days')+' and '+str;
9518
return 'You retain optimal cookie production while the game is closed for twice as long, for a total of <b>'+str+'</b>.';
9519
}
9520
new Game.Upgrade('Belphegor',desc(2)+'<q>A demon of shortcuts and laziness, Belphegor commands machines to do work in his stead.</q>',Math.pow(angelPriceFactor,1),[7,11]);Game.last.pool='prestige';Game.last.parents=['Twin Gates of Transcendence'];
9521
new Game.Upgrade('Mammon',desc(4)+'<q>The demonic embodiment of wealth, Mammon requests a tithe of blood and gold from all his worshippers.</q>',Math.pow(angelPriceFactor,2),[8,11]);Game.last.pool='prestige';Game.last.parents=['Belphegor'];
9522
new Game.Upgrade('Abaddon',desc(8)+'<q>Master of overindulgence, Abaddon governs the wrinkler brood and inspires their insatiability.</q>',Math.pow(angelPriceFactor,3),[9,11]);Game.last.pool='prestige';Game.last.parents=['Mammon'];
9523
new Game.Upgrade('Satan',desc(16)+'<q>The counterpoint to everything righteous, this demon represents the nefarious influence of deceit and temptation.</q>',Math.pow(angelPriceFactor,4),[10,11]);Game.last.pool='prestige';Game.last.parents=['Abaddon'];
9524
new Game.Upgrade('Asmodeus',desc(32)+'<q>This demon with three monstrous heads draws his power from the all-consuming desire for cookies and all things sweet.</q>',Math.pow(angelPriceFactor,5),[11,11]);Game.last.pool='prestige';Game.last.parents=['Satan'];
9525
new Game.Upgrade('Beelzebub',desc(64)+'<q>The festering incarnation of blight and disease, Beelzebub rules over the vast armies of pastry inferno.</q>',Math.pow(angelPriceFactor,6),[12,11]);Game.last.pool='prestige';Game.last.parents=['Asmodeus'];
9526
new Game.Upgrade('Lucifer',desc(128)+'<q>Also known as the Lightbringer, this infernal prince\'s tremendous ego caused him to be cast down from pastry heaven.</q>',Math.pow(angelPriceFactor,7),[13,11]);Game.last.pool='prestige';Game.last.parents=['Beelzebub'];
9527
9528
new Game.Upgrade('Golden cookie alert sound','Unlocks the <b>golden cookie sound selector</b>, which lets you pick whether golden cookies emit a sound when appearing or not.<q>A sound decision.</q>',9999,[28,6]);Game.last.pool='prestige';Game.last.parents=['Decisive fate','Golden switch'];
9529
9530
order=49900;
9531
new Game.Upgrade('Golden cookie sound selector','Lets you change the sound golden cookies make when they spawn.',0,[28,6]);
9532
Game.last.descFunc=function(){
9533
var choice=this.choicesFunction()[Game.chimeType];
9534
return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;
9535
};
9536
9537
Game.last.pool='toggle';
9538
Game.last.choicesFunction=function()
9539
{
9540
var choices=[];
9541
choices[0]={name:'No sound',icon:[0,7]};
9542
choices[1]={name:'Chime',icon:[22,6]};
9543
9544
choices[Game.chimeType].selected=1;
9545
return choices;
9546
}
9547
Game.last.choicesPick=function(id)
9548
{Game.chimeType=id;}
9549
9550
9551
new Game.Upgrade('Basic wallpaper assortment','Unlocks the <b>background selector</b>, letting you select the game\'s background.<br>Comes with a variety of basic flavors.<q>Prioritizing aesthetics over crucial utilitarian upgrades? Color me impressed.</q>',99,[29,5]);Game.last.pool='prestige';Game.last.parents=['Classic dairy selection'];
9552
9553
new Game.Upgrade('Legacy','This is the first heavenly upgrade; it unlocks the <b>Heavenly chips</b> system.<div class="line"></div>Each time you ascend, the cookies you made in your past life are turned into <b>heavenly chips</b> and <b>prestige</b>.<div class="line"></div><b>Heavenly chips</b> can be spent on a variety of permanent transcendental upgrades.<div class="line"></div>Your <b>prestige level</b> also gives you a permanent <b>+1% CpS</b> per level.<q>We\'ve all been waiting for you.</q>',1,[21,6]);Game.last.pool='prestige';Game.last.parents=[];
9554
9555
new Game.Upgrade('Elder spice','You can attract <b>2 more wrinklers</b>.<q>The cookie your cookie could smell like.</q>',444444,[19,8]);Game.last.pool='prestige';Game.last.parents=['Unholy bait'];
9556
9557
new Game.Upgrade('Residual luck','While the golden switch is on, you gain an additional <b>+10% CpS</b> per golden cookie upgrade owned.<q>Fortune comes in many flavors.</q>',99999,[27,6]);Game.last.pool='prestige';Game.last.parents=['Golden switch'];
9558
9559
order=150;new Game.Upgrade('Fantasteel mouse','Clicking gains <b>+1% of your CpS</b>.<q>You could be clicking using your touchpad and we\'d be none the wiser.</q>',5000000000000000000,[11,17]);Game.MakeTiered(Game.last,8,11);
9560
new Game.Upgrade('Nevercrack mouse','Clicking gains <b>+1% of your CpS</b>.<q>How much beefier can you make a mouse until it\'s considered a rat?</q>',500000000000000000000,[11,18]);Game.MakeTiered(Game.last,9,11);
9561
9562
9563
new Game.Upgrade('Five-finger discount','All upgrades are <b>1% cheaper per 100 cursors</b>.<q>Stick it to the man.</q>',555555,[28,7],function(){Game.upgradesToRebuild=1;});Game.last.pool='prestige';Game.last.parents=['Halo gloves','Abaddon'];
9564
9565
9566
order=5000;
9567
Game.SynergyUpgrade('Future almanacs','<q>Lets you predict optimal planting times. It\'s crazy what time travel can do!</q>','Farm','Time machine','synergy1');
9568
Game.SynergyUpgrade('Rain prayer','<q>A deeply spiritual ceremonial involving complicated dance moves and high-tech cloud-busting lasers.</q>','Farm','Temple','synergy2');
9569
9570
Game.SynergyUpgrade('Seismic magic','<q>Surprise earthquakes are an old favorite of wizardly frat houses.</q>','Mine','Wizard tower','synergy1');
9571
Game.SynergyUpgrade('Asteroid mining','<q>As per the <span>19</span>74 United Cosmic Convention, comets, moons, and inhabited planetoids are no longer legally excavatable.<br>But hey, a space bribe goes a long way.</q>','Mine','Shipment','synergy2');
9572
9573
Game.SynergyUpgrade('Quantum electronics','<q>Your machines won\'t even be sure if they\'re on or off!</q>','Factory','Antimatter condenser','synergy1');
9574
Game.SynergyUpgrade('Temporal overclocking','<q>Introduce more quickitude in your system for increased speedation of fastness.</q>','Factory','Time machine','synergy2');
9575
9576
Game.SynergyUpgrade('Contracts from beyond','<q>Make sure to read the fine print!</q>','Bank','Portal','synergy1');
9577
Game.SynergyUpgrade('Printing presses','<q>Fake bills so real, they\'re almost worth the ink they\'re printed with.</q>','Bank','Factory','synergy2');
9578
9579
Game.SynergyUpgrade('Paganism','<q>Some deities are better left unworshipped.</q>','Temple','Portal','synergy1');
9580
Game.SynergyUpgrade('God particle','<q>Turns out God is much tinier than we thought, I guess.</q>','Temple','Antimatter condenser','synergy2');
9581
9582
Game.SynergyUpgrade('Arcane knowledge','<q>Some things were never meant to be known - only mildly speculated.</q>','Wizard tower','Alchemy lab','synergy1');
9583
Game.SynergyUpgrade('Magical botany','<q>Already known in some reactionary newspapers as "the wizard\'s GMOs".</q>','Wizard tower','Farm','synergy2');
9584
9585
Game.SynergyUpgrade('Fossil fuels','<q>Somehow better than plutonium for powering rockets.<br>Extracted from the fuels of ancient, fossilized civilizations.</q>','Shipment','Mine','synergy1');
9586
Game.SynergyUpgrade('Shipyards','<q>Where carpentry, blind luck, and asbestos insulation unite to produce the most dazzling spaceships on the planet.</q>','Shipment','Factory','synergy2');
9587
9588
Game.SynergyUpgrade('Primordial ores','<q>Only when refining the purest metals will you extract the sweetest sap of the earth.</q>','Alchemy lab','Mine','synergy1');
9589
Game.SynergyUpgrade('Gold fund','<q>If gold is the backbone of the economy, cookies, surely, are its hip joints.</q>','Alchemy lab','Bank','synergy2');
9590
9591
Game.SynergyUpgrade('Infernal crops','<q>Sprinkle regularly with FIRE.</q>','Portal','Farm','synergy1');
9592
Game.SynergyUpgrade('Abysmal glimmer','<q>Someone, or something, is staring back at you.<br>Perhaps at all of us.</q>','Portal','Prism','synergy2');
9593
9594
Game.SynergyUpgrade('Relativistic parsec-skipping','<q>People will tell you this isn\'t physically possible.<br>These are people you don\'t want on your ship.</q>','Time machine','Shipment','synergy1');
9595
Game.SynergyUpgrade('Primeval glow','<q>From unending times, an ancient light still shines, impossibly pure and fragile in its old age.</q>','Time machine','Prism','synergy2');
9596
9597
Game.SynergyUpgrade('Extra physics funding','<q>Time to put your money where your particle colliders are.</q>','Antimatter condenser','Bank','synergy1');
9598
Game.SynergyUpgrade('Chemical proficiency','<q>Discover exciting new elements, such as Fleshmeltium, Inert Shampoo Byproduct #17 and Carbon++!</q>','Antimatter condenser','Alchemy lab','synergy2');
9599
9600
Game.SynergyUpgrade('Light magic','<q>Actually not to be taken lightly! No, I\'m serious. 178 people died last year. You don\'t mess around with magic.</q>','Prism','Wizard tower','synergy1');
9601
Game.SynergyUpgrade('Mystical energies','<q>Something beckons from within the light. It is warm, comforting, and apparently the cause for several kinds of exotic skin cancers.</q>','Prism','Temple','synergy2');
9602
9603
9604
new Game.Upgrade('Synergies Vol. I','Unlocks a new tier of upgrades that affect <b>2 buildings at the same time</b>.<br>Synergies appear once you have <b>15</b> of both buildings.<q>The many beats the few.</q>',222222,[10,20]);Game.last.pool='prestige';Game.last.parents=['Satan','Dominions'];
9605
new Game.Upgrade('Synergies Vol. II','Unlocks a new tier of upgrades that affect <b>2 buildings at the same time</b>.<br>Synergies appear once you have <b>75</b> of both buildings.<q>The several beats the many.</q>',2222222,[10,29]);Game.last.pool='prestige';Game.last.parents=['Beelzebub','Seraphim','Synergies Vol. I'];
9606
9607
new Game.Upgrade('Heavenly cookies','Cookie production multiplier <b>+10% permanently</b>.<q>Baked with heavenly chips. An otherwordly flavor that transcends time and space.</q>',3,[25,12]);Game.last.pool='prestige';Game.last.parents=['Legacy'];Game.last.power=10;Game.last.pseudoCookie=true;
9608
new Game.Upgrade('Wrinkly cookies','Cookie production multiplier <b>+10% permanently</b>.<q>The result of regular cookies left to age out for countless eons in a place where time and space are meaningless.</q>',6666666,[26,12]);Game.last.pool='prestige';Game.last.parents=['Sacrilegious corruption','Elder spice'];Game.last.power=10;Game.last.pseudoCookie=true;
9609
new Game.Upgrade('Distilled essence of redoubled luck','Golden cookies (and all other things that spawn, such as reindeer) have <b>1% chance of being doubled</b>.<q>Tastes glittery. The empty phial makes for a great pencil holder.</q>',7777777,[27,12]);Game.last.pool='prestige';Game.last.parents=['Divine bakeries','Residual luck'];
9610
9611
order=40000;
9612
new Game.Upgrade('Occult obstruction','Cookie production <b>reduced to 0</b>.<q>If symptoms persist, consult a doctor.</q>',7,[15,5]);//debug purposes only
9613
Game.last.pool='debug';
9614
new Game.Upgrade('Glucose-charged air','Sugar lumps coalesce <b>a whole lot faster</b>.<q>Don\'t breathe too much or you\'ll get diabetes!</q>',7,[29,16]);//debug purposes only
9615
Game.last.pool='debug';
9616
9617
order=10300;
9618
Game.NewUpgradeCookie({name:'Lavender chocolate butter biscuit',desc:'Rewarded for owning 300 of everything.<br>This subtly-flavored biscuit represents the accomplishments of decades of top-secret research. The molded design on the chocolate resembles a well-known entrepreneur who gave their all to the ancient path of baking.',icon:[26,10],power: 10,price: 999999999999999999999999999999999*butterBiscuitMult,locked:1});
9619
9620
order=10030;
9621
Game.NewUpgradeCookie({name:'Lombardia cookies',desc:'These come from those farms with the really good memory.',icon:[23,13],require:'Box of brand biscuits',power: 3, price: 999999999999999999999*5});
9622
Game.NewUpgradeCookie({name:'Bastenaken cookies',desc:'French cookies made of delicious cinnamon and candy sugar. These do not contain Nuts!',icon:[24,13],require:'Box of brand biscuits',power: 3, price: 999999999999999999999*5});
9623
9624
order=10020;
9625
Game.NewUpgradeCookie({name:'Pecan sandies',desc:'Stick a nut on a cookie and call it a day! Name your band after it! Whatever!',icon:[25,13],power: 4,price: 999999999999999999999999*5});
9626
Game.NewUpgradeCookie({name:'Moravian spice cookies',desc:'Popular for being the world\'s moravianest cookies.',icon:[26,13],power: 4,price: 9999999999999999999999999});
9627
Game.NewUpgradeCookie({name:'Anzac biscuits',desc:'Army biscuits from a bakery down under, containing no eggs but yes oats.',icon:[27,13],power: 4,price: 9999999999999999999999999*5});
9628
Game.NewUpgradeCookie({name:'Buttercakes',desc:'Glistening with cholesterol, these cookies moistly straddle the line between the legal definition of a cookie and just a straight-up stick of butter.',icon:[29,13],power: 4,price: 99999999999999999999999999});
9629
Game.NewUpgradeCookie({name:'Ice cream sandwiches',desc:'In an alternate universe, "ice cream sandwich" designates an ice cream cone filled with bacon, lettuce, and tomatoes. Maybe some sprinkles too.',icon:[28,13],power: 4,price: 99999999999999999999999999*5});
9630
9631
new Game.Upgrade('Stevia Caelestis','Sugar lumps ripen <b>an hour sooner</b>.<q>A plant of supernatural sweetness grown by angels in heavenly gardens.</q>',100000000,[25,15]);Game.last.pool='prestige';Game.last.parents=['Wrinkly cookies'];
9632
new Game.Upgrade('Diabetica Daemonicus','Sugar lumps mature <b>an hour sooner</b>.<q>A malevolent, if delicious herb that is said to grow on the cliffs of the darkest abyss of the underworld.</q>',300000000,[26,15]);Game.last.pool='prestige';Game.last.parents=['Stevia Caelestis','Lucifer'];
9633
new Game.Upgrade('Sucralosia Inutilis','Bifurcated sugar lumps appear <b>5% more often</b> and are <b>5% more likely</b> to drop 2 lumps.<q>A rare berry of uninteresting flavor that is as elusive as its uses are limited; only sought-after by the most avid collectors with too much wealth on their hands.</q>',1000000000,[27,15]);Game.last.pool='prestige';Game.last.parents=['Diabetica Daemonicus'];
9634
9635
//note : these showIf functions stop working beyond 10 quadrillion prestige level, due to loss in precision; the solution, of course, is to make sure 10 quadrillion is not an attainable prestige level
9636
new Game.Upgrade('Lucky digit','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade is a bit shy and only appears when your prestige level ends in 7.</q>',777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Heavenly luck'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%10==7);};
9637
new Game.Upgrade('Lucky number','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade is a reclusive hermit and only appears when your prestige level ends in 777.</q>',77777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Lucky digit','Lasting fortune'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%1000==777);};
9638
new Game.Upgrade('Lucky payout','<b>+1%</b> prestige level effect on CpS.<br><b>+1%</b> golden cookie effect duration.<br><b>+1%</b> golden cookie lifespan.<q>This upgrade took an oath of complete seclusion from the rest of the world and only appears when your prestige level ends in 777777.</q>',77777777,[24,15]);Game.last.pool='prestige';Game.last.parents=['Lucky number','Decisive fate'];Game.last.showIf=function(){return (Math.ceil(Game.prestige)%1000000==777777);};
9639
9640
order=50000;
9641
new Game.Upgrade('Background selector','Lets you pick which wallpaper to display.',0,[29,5]);
9642
Game.last.descFunc=function(){
9643
var choice=this.choicesFunction()[Game.bgType];
9644
return '<div style="text-align:center;">Current : <div class="icon" style="vertical-align:middle;display:inline-block;'+(choice.icon[2]?'background-image:url('+choice.icon[2]+');':'')+'background-position:'+(-choice.icon[0]*48)+'px '+(-choice.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div> <b>'+choice.name+'</b></div><div class="line"></div>'+this.desc;
9645
};
9646
9647
Game.last.pool='toggle';
9648
Game.last.choicesFunction=function()
9649
{
9650
var choices=[];
9651
choices[0]={name:'Automatic',icon:[0,7]};
9652
choices[1]={name:'Blue',icon:[21,21]};
9653
choices[2]={name:'Red',icon:[22,21]};
9654
choices[3]={name:'White',icon:[23,21]};
9655
choices[4]={name:'Black',icon:[24,21]};
9656
choices[5]={name:'Gold',icon:[25,21]};
9657
choices[6]={name:'Grandmas',icon:[26,21]};
9658
choices[7]={name:'Displeased grandmas',icon:[27,21]};
9659
choices[8]={name:'Angered grandmas',icon:[28,21]};
9660
choices[9]={name:'Money',icon:[29,21]};
9661
choices[Game.bgType].selected=1;
9662
return choices;
9663
}
9664
Game.last.choicesPick=function(id)
9665
{Game.bgType=id;}
9666
9667
Game.BGsByChoice={
9668
0:{pic:'bgBlue'},
9669
1:{pic:'bgBlue'},
9670
2:{pic:'bgRed'},
9671
3:{pic:'bgWhite'},
9672
4:{pic:'bgBlack'},
9673
5:{pic:'bgGold'},
9674
6:{pic:'grandmas1'},
9675
7:{pic:'grandmas2'},
9676
8:{pic:'grandmas3'},
9677
9:{pic:'bgMoney'},
9678
};
9679
9680
order=255;
9681
Game.GrandmaSynergy('Lucky grandmas','A fortunate grandma that always seems to find more cookies.','Chancemaker');
9682
9683
order=1200;
9684
new Game.TieredUpgrade('Your lucky cookie','Chancemakers are <b>twice</b> as efficient.<q>This is the first cookie you\'ve ever baked. It holds a deep sentimental value and, after all this time, an interesting smell.</q>','Chancemaker',1);
9685
new Game.TieredUpgrade('"All Bets Are Off" magic coin','Chancemakers are <b>twice</b> as efficient.<q>A coin that always lands on the other side when flipped. Not heads, not tails, not the edge. The <i>other side</i>.</q>','Chancemaker',2);
9686
new Game.TieredUpgrade('Winning lottery ticket','Chancemakers are <b>twice</b> as efficient.<q>What lottery? THE lottery, that\'s what lottery! Only lottery that matters!</q>','Chancemaker',3);
9687
new Game.TieredUpgrade('Four-leaf clover field','Chancemakers are <b>twice</b> as efficient.<q>No giant monsters here, just a whole lot of lucky grass.</q>','Chancemaker',4);
9688
new Game.TieredUpgrade('A recipe book about books','Chancemakers are <b>twice</b> as efficient.<q>Tip the scales in your favor with 28 creative new ways to cook the books.</q>','Chancemaker',5);
9689
new Game.TieredUpgrade('Leprechaun village','Chancemakers are <b>twice</b> as efficient.<q>You\'ve finally become accepted among the local leprechauns, who lend you their mythical luck as a sign of friendship (as well as some rather foul-tasting tea).</q>','Chancemaker',6);
9690
new Game.TieredUpgrade('Improbability drive','Chancemakers are <b>twice</b> as efficient.<q>A strange engine that turns statistics on their head. Recommended by the Grandmother\'s Guide to the Bakery.</q>','Chancemaker',7);
9691
new Game.TieredUpgrade('Antisuperstistronics','Chancemakers are <b>twice</b> as efficient.<q>An exciting new field of research that makes unlucky things lucky. No mirror unbroken, no ladder unwalked under!</q>','Chancemaker',8);
9692
9693
order=5000;
9694
Game.SynergyUpgrade('Gemmed talismans','<q>Good-luck charms covered in ancient and excruciatingly rare crystals. A must have for job interviews!</q>','Chancemaker','Mine','synergy1');
9695
9696
order=20000;
9697
new Game.Upgrade('Kitten consultants','You gain <b>more CpS</b> the more milk you have.<q>glad to be overpaid to work with you, sir</q>',900000000000000000000000000000000,Game.GetIcon('Kitten',9));Game.last.kitten=1;Game.MakeTiered(Game.last,9,18);
9698
9699
order=99999;
9700
var years=Math.floor((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365));
9701
//only updates on page load
9702
//may behave strangely on leap years
9703
Game.NewUpgradeCookie({name:'Birthday cookie',desc:'-',icon:[22,13],power:years,price:99999999999999999999999999999});Game.last.baseDesc='Cookie production multiplier <b>+1%</b> for every year Cookie Clicker has existed (currently : <b>+'+Beautify(years)+'%</b>).<q>Thank you for playing Cookie Clicker!<br>-Orteil</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
9704
9705
9706
order=150;new Game.Upgrade('Armythril mouse','Clicking gains <b>+1% of your CpS</b>.<q>This one takes about 53 people to push it around and another 48 to jump down on the button and trigger a click. You could say it\'s got some heft to it.</q>',50000000000000000000000,[11,19]);Game.MakeTiered(Game.last,10,11);
9707
9708
order=200;new Game.TieredUpgrade('Reverse dementia','Grandmas are <b>twice</b> as efficient.<q>Extremely unsettling, and somehow even worse than the regular kind.</q>','Grandma',9);
9709
order=300;new Game.TieredUpgrade('Humane pesticides','Farms are <b>twice</b> as efficient.<q>Made by people, for people, from people and ready to unleash some righteous scorching pain on those pesky insects that so deserve it.</q>','Farm',9);
9710
order=400;new Game.TieredUpgrade('Mole people','Mines are <b>twice</b> as efficient.<q>Engineered from real human beings within your very labs, these sturdy little folks have a knack for finding the tastiest underground minerals in conditions that more expensive machinery probably wouldn\'t survive.</q>','Mine',9);
9711
order=500;new Game.TieredUpgrade('Machine learning','Factories are <b>twice</b> as efficient.<q>You figured you might get better productivity if you actually told your workers to learn how to work the machines. Sometimes, it\'s the little things...</q>','Factory',9);
9712
order=525;new Game.TieredUpgrade('Edible money','Banks are <b>twice</b> as efficient.<q>It\'s really quite simple; you make all currency too delicious not to eat, solving world hunger and inflation in one fell swoop!</q>','Bank',9);
9713
order=550;new Game.TieredUpgrade('Sick rap prayers','Temples are <b>twice</b> as efficient.<q>With their ill beat and radical rhymes, these way-hip religious tunes are sure to get all the youngins who thought they were 2 cool 4 church back on the pews and praying for more! Wicked!</q>','Temple',9);
9714
order=575;new Game.TieredUpgrade('Deluxe tailored wands','Wizard towers are <b>twice</b> as efficient.<q>In this age of science, most skillful wand-makers are now long gone; but thankfully - not all those wanders are lost.</q>','Wizard tower',9);
9715
order=600;new Game.TieredUpgrade('Autopilot','Shipments are <b>twice</b> as efficient.<q>Your ships are now fitted with completely robotic crews! It\'s crazy how much money you save when you don\'t have to compensate the families of those lost in space.</q>','Shipment',9);
9716
order=700;new Game.TieredUpgrade('The advent of chemistry','Alchemy labs are <b>twice</b> as efficient.<q>You know what? That whole alchemy nonsense was a load of baseless rubbish. Dear god, what were you thinking?</q>','Alchemy lab',9);
9717
order=800;new Game.TieredUpgrade('The real world','Portals are <b>twice</b> as efficient.<q>It turns out that our universe is actually the twisted dimension of another, saner plane of reality. Time to hop on over there and loot the place!</q>','Portal',9);
9718
order=900;new Game.TieredUpgrade('Second seconds','Time machines are <b>twice</b> as efficient.<q>That\'s twice as many seconds in the same amount of time! What a deal! Also, what in god\'s name!</q>','Time machine',9);
9719
order=1000;new Game.TieredUpgrade('Quantum comb','Antimatter condensers are <b>twice</b> as efficient.<q>Quantum entanglement is one of those things that are so annoying to explain that we might honestly be better off without it. This is finally possible thanks to the quantum comb!</q>','Antimatter condenser',9);
9720
order=1100;new Game.TieredUpgrade('Crystal mirrors','Prisms are <b>twice</b> as efficient.<q>Designed to filter more light back into your prisms, reaching levels of brightness that reality itself had never planned for.</q>','Prism',9);
9721
order=1200;new Game.TieredUpgrade('Bunnypedes','Chancemakers are <b>twice</b> as efficient.<q>You\'ve taken to breeding rabbits with hundreds of paws, which makes them intrinsically very lucky and thus a very handy (if very disturbing) pet.</q>','Chancemaker',9);
9722
9723
order=20000;
9724
new Game.Upgrade('Kitten assistants to the regional manager','You gain <b>more CpS</b> the more milk you have.<q>nothing stresses meowt... except having to seek the approval of my inferiors, sir</q>',900000000000000000000000000000000000,Game.GetIcon('Kitten',10));Game.last.kitten=1;Game.MakeTiered(Game.last,10,18);
9725
9726
order=5000;
9727
Game.SynergyUpgrade('Charm quarks','<q>They\'re after your lucky quarks!</q>','Chancemaker','Antimatter condenser','synergy2');
9728
9729
9730
order=10020;
9731
Game.NewUpgradeCookie({name:'Pink biscuits',desc:'One of the oldest cookies. Traditionally dipped in champagne to soften it, because the French will use any opportunity to drink.',icon:[21,16],power: 4,price: 999999999999999999999999999});
9732
Game.NewUpgradeCookie({name:'Whole-grain cookies',desc:'Covered in seeds and other earthy-looking debris. Really going for that "5-second rule" look.',icon:[22,16],power: 4,price: 999999999999999999999999999*5});
9733
Game.NewUpgradeCookie({name:'Candy cookies',desc:'These melt in your hands just a little bit.',icon:[23,16],power: 4,price: 9999999999999999999999999999});
9734
Game.NewUpgradeCookie({name:'Big chip cookies',desc:'You are in awe at the size of these chips. Absolute units.',icon:[24,16],power: 4,price: 9999999999999999999999999999*5});
9735
Game.NewUpgradeCookie({name:'One chip cookies',desc:'You get one.',icon:[25,16],power: 1,price: 99999999999999999999999999999});
9736
9737
9738
new Game.Upgrade('Sugar baking','Each unspent sugar lump (up to 100) gives <b>+1% CpS</b>.<div class="warning">Note : this means that spending sugar lumps will decrease your CpS until they grow back.</div><q>To bake with the sugary essence of eons themselves, you must first learn to take your sweet time.</q>',200000000,[21,17]);Game.last.pool='prestige';Game.last.parents=['Stevia Caelestis'];
9739
new Game.Upgrade('Sugar craving','Once an ascension, you may use the "Sugar frenzy" switch to <b>triple your CpS</b> for 1 hour, at the cost of <b>1 sugar lump</b>.<q>Just a little kick to sweeten the deal.</q>',400000000,[22,17]);Game.last.pool='prestige';Game.last.parents=['Sugar baking'];
9740
new Game.Upgrade('Sugar aging process','Each grandma (up to 600) makes sugar lumps ripen <b>6 seconds</b> sooner.<q>Aren\'t they just the sweetest?</q>',600000000,[23,17]);Game.last.pool='prestige';Game.last.parents=['Sugar craving','Diabetica Daemonicus'];
9741
9742
order=40050;
9743
new Game.Upgrade('Sugar frenzy','Activating this will <b>triple your CpS</b> for 1 hour, at the cost of <b>1 sugar lump</b>.<br>May only be used once per ascension.',0,[22,17]);
9744
Game.last.priceLumps=1;
9745
Game.last.pool='toggle';Game.last.toggleInto=0;
9746
Game.last.canBuyFunc=function(){return Game.lumps>=1;};
9747
Game.last.clickFunction=Game.spendLump(1,'activate the sugar frenzy',function()
9748
{
9749
Game.Upgrades['Sugar frenzy'].buy(1);
9750
buff=Game.gainBuff('sugar frenzy',60*60,3);
9751
if (Game.prefs.popups) Game.Popup('Sugar frenzy activated!');
9752
else Game.Notify('Sugar frenzy!','CpS x3 for 1 hour!',[29,14]);
9753
});
9754
9755
order=10020;
9756
Game.NewUpgradeCookie({name:'Sprinkles cookies',desc:'A bit of festive decorating helps hide the fact that this might be one of the blandest cookies you\'ve ever tasted.',icon:[21,14],power: 4,price: 99999999999999999999999999999*5});
9757
Game.NewUpgradeCookie({name:'Peanut butter blossoms',desc:'Topped with a scrumptious chocolate squirt, which is something we really wish we didn\'t just write.',icon:[22,14],power: 4,price: 999999999999999999999999999999});
9758
Game.NewUpgradeCookie({name:'No-bake cookies',desc:'You have no idea how these mysterious oven-less treats came to be or how they hold their shape. You\'re thinking either elephant glue or cold fusion.',icon:[21,15],power: 4,price: 999999999999999999999999999999*5});
9759
Game.NewUpgradeCookie({name:'Florentines',desc:'These make up for being the fruitcake of cookies by at least having the decency to feature chocolate.',icon:[26,16],power: 4,price: 9999999999999999999999999999999});
9760
Game.NewUpgradeCookie({name:'Chocolate crinkles',desc:'Non-denominational cookies to celebrate year-round deliciousness, and certainly not Christmas or some other nonsense.',icon:[22,15],power: 4,price: 9999999999999999999999999999999*5});
9761
Game.NewUpgradeCookie({name:'Maple cookies',desc:'Made with syrup from a land where milk comes in bags, instead of spontaneously pooling at the bottom of your screen depending on your achievements.',icon:[21,13],power: 4,price: 99999999999999999999999999999999});
9762
9763
9764
order=40000;
9765
new Game.Upgrade('Turbo-charged soil','Garden plants grow every second.<br>Garden seeds are free to plant.<br>You can switch soils at any time.<q>It\'s got electrolytes!</q>',7,[2,16]);//debug purposes only
9766
Game.last.buyFunction=function(){if (Game.Objects['Farm'].minigameLoaded){Game.Objects['Farm'].minigame.computeStepT();}}
9767
Game.last.pool='debug';
9768
9769
order=150;
9770
new Game.Upgrade('Technobsidian mouse','Clicking gains <b>+1% of your CpS</b>.<q>A highly advanced mouse of a sophisticated design. Only one thing on its mind : to click.</q>',5000000000000000000000000,[11,28]);Game.MakeTiered(Game.last,11,11);
9771
new Game.Upgrade('Plasmarble mouse','Clicking gains <b>+1% of your CpS</b>.<q>A shifting blur in the corner of your eye, this mouse can trigger a flurry of clicks when grazed by even the slightest breeze.</q>',500000000000000000000000000,[11,30]);Game.MakeTiered(Game.last,12,11);
9772
9773
order=20000;
9774
new Game.Upgrade('Kitten marketeers','You gain <b>more CpS</b> the more milk you have.<q>no such thing as a saturated markit, sir</q>',900000000000000000000000000000000000000,Game.GetIcon('Kitten',11));Game.last.kitten=1;Game.MakeTiered(Game.last,11,18);
9775
9776
order=10030;
9777
Game.NewUpgradeCookie({name:'Festivity loops',desc:'These garish biscuits are a perfect fit for children\'s birthday parties or the funerals of strange, eccentric billionaires.',icon:[25,17],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999*5});
9778
9779
order=10020;
9780
Game.NewUpgradeCookie({name:'Persian rice cookies',desc:'Rose water and poppy seeds are the secret ingredients of these small, butter-free cookies.',icon:[28,15],power: 4,price: 99999999999999999999999999999999*5});
9781
Game.NewUpgradeCookie({name:'Norwegian cookies',desc:'A flat butter cookie with a sliver of candied cherry on top. It is said that these illustrate the bleakness of scandinavian existentialism.',icon:[22,20],power: 4,price: 999999999999999999999999999999999});
9782
Game.NewUpgradeCookie({name:'Crispy rice cookies',desc:'Fun to make at home! Store-bought cookies are obsolete! Topple the system! There\'s marshmallows in these! Destroy capitalism!',icon:[23,20],power: 4,price: 999999999999999999999999999999999*5});
9783
Game.NewUpgradeCookie({name:'Ube cookies',desc:'The tint is obtained by the use of purple yams. According to color symbolism, these cookies are either noble, holy, or supervillains.',icon:[24,17],power: 4,price: 9999999999999999999999999999999999});
9784
Game.NewUpgradeCookie({name:'Butterscotch cookies',desc:'The butterscotch chips are just the right amount of sticky, and make you feel like you\'re eating candy.',icon:[24,20],power: 4,price: 9999999999999999999999999999999999*5});
9785
Game.NewUpgradeCookie({name:'Speculaas',desc:'These crunchy, almost obnoxiously cinnamony cookies are a source of dutch pride. About the origin of the name, one can only speculate.',icon:[21,20],power: 4,price: 99999999999999999999999999999999999});
9786
9787
order=10200;
9788
Game.NewUpgradeCookie({name:'Elderwort biscuits',desc:'-',icon:[22,25],power:2,price:60*2,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+2%</b>.<br>Grandma production multiplier <b>+2%</b>.<br>Dropped by elderwort plants.<q>They taste incredibly stale, even when baked fresh.</q>';
9789
Game.NewUpgradeCookie({name:'Bakeberry cookies',desc:'-',icon:[23,25],power:2,price:60,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+2%</b>.<br>Dropped by bakeberry plants.<q>Really good dipped in hot chocolate.</q>';
9790
Game.NewUpgradeCookie({name:'Duketater cookies',desc:'-',icon:[24,25],power:10,price:60*3,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+10%</b>.<br>Dropped by duketater plants.<q>Fragrant and mealy, with a slight yellow aftertaste.</q>';
9791
Game.NewUpgradeCookie({name:'Green yeast digestives',desc:'-',icon:[25,25],power:0,price:60*3,locked:1});Game.last.baseDesc='<b>+1%</b> golden cookie gains and effect duration.<br><b>+1%</b> golden cookie frequency.<br><b>+3%</b> random drops.<br>Dropped by green rot plants.<q>These are tastier than you\'d expect, but not by much.</q>';
9792
9793
order=23000;
9794
new Game.Upgrade('Fern tea','You gain <b>+3%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<br>Dropped by drowsyfern plants.<q>A chemically complex natural beverage, this soothing concoction has been used by mathematicians to solve equations in their sleep.</q>',60,[26,25]);
9795
new Game.Upgrade('Ichor syrup','You gain <b>+7%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<br>Sugar lumps mature <b>7 minutes</b> sooner.<br>Dropped by ichorpuff plants.<q>Tastes like candy. The smell is another story.</q>',60*2,[27,25]);
9796
9797
order=10200;
9798
Game.NewUpgradeCookie({name:'Wheat slims',desc:'-',icon:[28,25],power:1,price:30,locked:1});Game.last.baseDesc='Cookie production multiplier <b>+1%</b>.<br>Dropped by baker\'s wheat plants.<q>The only reason you\'d consider these to be cookies is because you feel slightly sorry for them.</q>';
9799
9800
var gardenDrops=['Elderwort biscuits','Bakeberry cookies','Duketater cookies','Green yeast digestives','Fern tea','Ichor syrup','Wheat slims'];
9801
for (var i in gardenDrops)//scale by CpS
9802
{
9803
var it=Game.Upgrades[gardenDrops[i]];
9804
it.priceFunc=function(cost){return function(){return cost*Game.cookiesPs*60;}}(it.basePrice);
9805
it.baseDesc=it.baseDesc.replace('<q>','<br>Cost scales with CpS.<q>');
9806
it.desc=BeautifyInText(it.baseDesc);
9807
it.lasting=true;
9808
}
9809
9810
9811
order=10300;
9812
Game.NewUpgradeCookie({name:'Synthetic chocolate green honey butter biscuit',desc:'Rewarded for owning 350 of everything.<br>The recipe for this butter biscuit was once the sole heritage of an ancient mountain monastery. Its flavor is so refined that only a slab of lab-made chocolate specifically engineered to be completely tasteless could complement it.<br>Also it\'s got your face on it.',icon:[24,26],power: 10,price: 999999999999999999999999999999999999*butterBiscuitMult,locked:1});
9813
Game.NewUpgradeCookie({name:'Royal raspberry chocolate butter biscuit',desc:'Rewarded for owning 400 of everything.<br>Once reserved for the megalomaniac elite, this unique strain of fruity chocolate has a flavor and texture unlike any other. Whether its exorbitant worth is improved or lessened by the presence of your likeness on it still remains to be seen.',icon:[25,26],power: 10,price: 999999999999999999999999999999999999999*butterBiscuitMult,locked:1});
9814
Game.NewUpgradeCookie({name:'Ultra-concentrated high-energy chocolate butter biscuit',desc:'Rewarded for owning 450 of everything.<br>Infused with the power of several hydrogen bombs through a process that left most nuclear engineers and shareholders perplexed. Currently at the center of some rather heated United Nations meetings. Going in more detail about this chocolate would violate several state secrets, but we\'ll just add that someone\'s bust seems to be pictured on it. Perhaps yours?',icon:[26,26],power: 10,price: 999999999999999999999999999999999999999999*butterBiscuitMult,locked:1});
9815
9816
9817
9818
order=200;new Game.TieredUpgrade('Timeproof hair dyes','Grandmas are <b>twice</b> as efficient.<q>Why do they always have those strange wispy pink dos? What do they know about candy floss that we don\'t?</q>','Grandma',10);
9819
order=300;new Game.TieredUpgrade('Barnstars','Farms are <b>twice</b> as efficient.<q>Ah, yes. These help quite a bit. Somehow.</q>','Farm',10);
9820
order=400;new Game.TieredUpgrade('Mine canaries','Mines are <b>twice</b> as efficient.<q>These aren\'t used for anything freaky! The miners just enjoy having a pet or two down there.</q>','Mine',10);
9821
order=500;new Game.TieredUpgrade('Brownie point system','Factories are <b>twice</b> as efficient.<q>Oh, these are lovely! You can now reward your factory employees for good behavior, such as working overtime or snitching on coworkers. 58 brownie points gets you a little picture of a brownie, and 178 of those pictures gets you an actual brownie piece for you to do with as you please! Infantilizing? Maybe. Oodles of fun? You betcha!</q>','Factory',10);
9822
order=525;new Game.TieredUpgrade('Grand supercycles','Banks are <b>twice</b> as efficient.<q>We let the public think these are complicated financial terms when really we\'re just rewarding the bankers with snazzy bicycles for a job well done. It\'s only natural after you built those fancy gold swimming pools for them, where they can take a dip and catch Kondratiev waves.</q>','Bank',10);
9823
order=550;new Game.TieredUpgrade('Psalm-reading','Temples are <b>twice</b> as efficient.<q>A theologically dubious and possibly blasphemous blend of fortune-telling and scripture studies.</q>','Temple',10);
9824
order=575;new Game.TieredUpgrade('Immobile spellcasting','Wizard towers are <b>twice</b> as efficient.<q>Wizards who master this skill can now cast spells without having to hop and skip and gesticulate embarrassingly, which is much sneakier and honestly quite a relief.</q>','Wizard tower',10);
9825
order=600;new Game.TieredUpgrade('Restaurants at the end of the universe','Shipments are <b>twice</b> as efficient.<q>Since the universe is spatially infinite, and therefore can be construed to have infinite ends, you\'ve opened an infinite chain of restaurants where your space truckers can rest and partake in some home-brand cookie-based meals.</q>','Shipment',10);
9826
order=700;new Game.TieredUpgrade('On second thought','Alchemy labs are <b>twice</b> as efficient.<q>Disregard that last upgrade, alchemy is where it\'s at! Your eggheads just found a way to transmute children\'s nightmares into rare metals!</q>','Alchemy lab',10);
9827
order=800;new Game.TieredUpgrade('Dimensional garbage gulper','Portals are <b>twice</b> as efficient.<q>So we\'ve been looking for a place to dispose of all the refuse that\'s been accumulating since we started baking - burnt cookies, failed experiments, unruly workers - and well, we figured rather than sell it to poor countries like we\'ve been doing, we could just dump it in some alternate trash dimension where it\'s not gonna bother anybody! Probably!</q>','Portal',10);
9828
order=900;new Game.TieredUpgrade('Additional clock hands','Time machines are <b>twice</b> as efficient.<q>It seemed like a silly idea at first, but it turns out these have the strange ability to twist time in interesting new ways.</q>','Time machine',10);
9829
order=1000;new Game.TieredUpgrade('Baking Nobel prize','Antimatter condensers are <b>twice</b> as efficient.<q>What better way to sponsor scientific growth than to motivate those smarmy nerds with a meaningless award! What\'s more, each prize comes with a fine print lifelong exclusive contract to come work for you (or else)!</q>','Antimatter condenser',10);
9830
order=1100;new Game.TieredUpgrade('Reverse theory of light','Prisms are <b>twice</b> as efficient.<q>A whole new world of physics opens up when you decide that antiphotons are real and posit that light is merely a void in shadow.</q>','Prism',10);
9831
order=1200;new Game.TieredUpgrade('Revised probabilistics','Chancemakers are <b>twice</b> as efficient.<q>Either something happens or it doesn\'t. That\'s a 50% chance! This suddenly makes a lot of unlikely things very possible.</q>','Chancemaker',10);
9832
9833
order=20000;
9834
new Game.Upgrade('Kitten analysts','You gain <b>more CpS</b> the more milk you have.<q>based on purrent return-on-investment meowdels we should be able to affurd to pay our empawyees somewhere around next century, sir</q>',900000000000000000000000000000000000000000,Game.GetIcon('Kitten',12));Game.last.kitten=1;Game.MakeTiered(Game.last,12,18);
9835
9836
9837
new Game.Upgrade('Eye of the wrinkler','Mouse over a wrinkler to see how many cookies are in its stomach.<q>Just a wrinkler and its will to survive.<br>Hangin\' tough, stayin\' hungry.</q>',99999999,[27,26]);Game.last.pool='prestige';Game.last.parents=['Wrinkly cookies'];
9838
9839
new Game.Upgrade('Inspired checklist','Unlocks the <b>Buy all</b> feature, which lets you instantly purchase every upgrade in your store (starting from the cheapest one).<br>Also unlocks the <b>Vault</b>, a store section where you can place upgrades you do not wish to auto-buy.<q>Snazzy grandma accessories? Check. Transdimensional abominations? Check. A bunch of eggs for some reason? Check. Machine that goes "ping"? Check and check.</q>',900000,[28,26]);Game.last.pool='prestige';Game.last.parents=['Persistent memory','Permanent upgrade slot II'];
9840
9841
order=10300;
9842
Game.NewUpgradeCookie({name:'Pure pitch-black chocolate butter biscuit',desc:'Rewarded for owning 500 of everything.<br>This chocolate is so pure and so flawless that it has no color of its own, instead taking on the appearance of whatever is around it. You\'re a bit surprised to notice that this one isn\'t stamped with your effigy, as its surface is perfectly smooth (to the picometer) - until you realize it\'s quite literally reflecting your own face like a mirror.',icon:[24,27],power: 10,price: 999999999999999999999999999999999999999999999*butterBiscuitMult,locked:1});
9843
9844
order=10020;
9845
Game.NewUpgradeCookie({name:'Chocolate oatmeal cookies',desc:'These bad boys compensate for lack of a cohesive form and a lumpy, unsightly appearance by being just simply delicious. Something we should all aspire to.',icon:[23,28],power: 4,price: 99999999999999999999999999999999999*5});
9846
Game.NewUpgradeCookie({name:'Molasses cookies',desc:'Sticky, crackly, and dusted in fine sugar.<br>Some lunatics have been known to eat these with potatoes.',icon:[24,28],power: 4,price: 999999999999999999999999999999999999});
9847
Game.NewUpgradeCookie({name:'Biscotti',desc:'Almonds and pistachios make these very robust cookies slightly more interesting to eat than to bludgeon people with.',icon:[22,28],power: 4,price: 999999999999999999999999999999999999*5});
9848
Game.NewUpgradeCookie({name:'Waffle cookies',desc:'Whether these are cookies with shockingly waffle-like features or simply regular cookie-sized waffles is a debate we\'re not getting into here.',icon:[21,28],power: 4,price: 9999999999999999999999999999999999999});
9849
9850
9851
order=10000;
9852
//early cookies that unlock at the same time as coconut cookies; meant to boost early game a little bit
9853
Game.NewUpgradeCookie({name:'Almond cookies',desc:'Sometimes you feel like one of these. Sometimes you don\'t.',icon:[21,27],power: 2, price: 99999999});
9854
Game.NewUpgradeCookie({name:'Hazelnut cookies',desc:'Tastes like a morning stroll through a fragrant forest, minus the clouds of gnats.',icon:[22,27],power: 2, price: 99999999});
9855
Game.NewUpgradeCookie({name:'Walnut cookies',desc:'Some experts have pointed to the walnut\'s eerie resemblance to the human brain as a sign of its sentience - a theory most walnuts vehemently object to.',icon:[23,27],power: 2, price: 99999999});
9856
9857
9858
new Game.Upgrade('Label printer','Mouse over an upgrade to see its tier.<br><small>Note : only some upgrades have tiers. Tiers are purely cosmetic and have no effect on gameplay.</small><q>Also comes in real handy when you want to tell catsup apart from ketchup.</q>',999999,[28,29]);Game.last.pool='prestige';Game.last.parents=['Starter kitchen'];
9859
9860
9861
9862
9863
order=200;new Game.TieredUpgrade('Good manners','Grandmas are <b>twice</b> as efficient.<q>Apparently these ladies are much more amiable if you take the time to learn their strange, ancient customs, which seem to involve saying "please" and "thank you" and staring at the sun with bulging eyes while muttering eldritch curses under your breath.</q>','Grandma',11);
9864
order=300;new Game.TieredUpgrade('Lindworms','Farms are <b>twice</b> as efficient.<q>You have to import these from far up north, but they really help aerate the soil!</q>','Farm',11);
9865
order=400;new Game.TieredUpgrade('Bore again','Mines are <b>twice</b> as efficient.<q>After extracting so much sediment for so long, you\'ve formed some veritable mountains of your own from the accumulated piles of rock and dirt. Time to dig through those and see if you find anything fun!</q>','Mine',11);
9866
order=500;new Game.TieredUpgrade('"Volunteer" interns','Factories are <b>twice</b> as efficient.<q>If you\'re bad at something, always do it for free.</q>','Factory',11);
9867
order=525;new Game.TieredUpgrade('Rules of acquisition','Banks are <b>twice</b> as efficient.<q>Rule 387 : a cookie baked is a cookie kept.</q>','Bank',11);
9868
order=550;new Game.TieredUpgrade('War of the gods','Temples are <b>twice</b> as efficient.<q>An interesting game; the only winning move is not to pray.</q>','Temple',11);
9869
order=575;new Game.TieredUpgrade('Electricity','Wizard towers are <b>twice</b> as efficient.<q>Ancient magicks and forbidden hexes shroud this arcane knowledge, whose unfathomable power can mysteriously turn darkness into light and shock an elephant to death.</q>','Wizard tower',11);
9870
order=600;new Game.TieredUpgrade('Universal alphabet','Shipments are <b>twice</b> as efficient.<q>You\'ve managed to chart a language that can be understood by any sentient species in the galaxy; its exciting vocabulary contains over 56 trillion words that sound and look like sparkly burps, forming intricate sentences that usually translate to something like "give us your cookies, or else".</q>','Shipment',11);
9871
order=700;new Game.TieredUpgrade('Public betterment','Alchemy labs are <b>twice</b> as efficient.<q>Why do we keep trying to change useless matter into cookies, or cookies into even better cookies? Clearly, the way of the future is to change the people who eat the cookies into people with a greater understanding, appreciation and respect for the cookies they\'re eating. Into the vat you go!</q>','Alchemy lab',11);
9872
order=800;new Game.TieredUpgrade('Embedded microportals','Portals are <b>twice</b> as efficient.<q>We\'ve found out that if we bake the portals into the cookies themselves, we can transport people\'s taste buds straight into the taste dimension! Good thing your army of lawyers got rid of the FDA a while ago!</q>','Portal',11);
9873
order=900;new Game.TieredUpgrade('Nostalgia','Time machines are <b>twice</b> as efficient.<q>Your time machine technicians insist that this is some advanced new time travel tech, and not just an existing emotion universal to mankind. Either way, you have to admit that selling people the same old cookies just because it reminds them of the good old times is an interesting prospect.</q>','Time machine',11);
9874
order=1000;new Game.TieredUpgrade('The definite molecule','Antimatter condensers are <b>twice</b> as efficient.<q>Your scientists have found a way to pack a cookie into one single continuous molecule, opening exciting new prospects in both storage and flavor despite the fact that these take up to a whole year to digest.</q>','Antimatter condenser',11);
9875
order=1100;new Game.TieredUpgrade('Light capture measures','Prisms are <b>twice</b> as efficient.<q>As the universe gets ever so slightly dimmer due to you converting more and more of its light into cookies, you\'ve taken to finding new and unexplored sources of light for your prisms; for instance, the warm glow emitted by a pregnant woman, or the twinkle in the eye of a hopeful child.</q>','Prism',11);
9876
order=1200;new Game.TieredUpgrade('0-sided dice','Chancemakers are <b>twice</b> as efficient.<q>The advent of the 0-sided dice has had unexpected and tumultuous effects on the gambling community, and saw experts around the world calling you both a genius and an imbecile.</q>','Chancemaker',11);
9877
9878
9879
new Game.Upgrade('Heralds','You now benefit from the boost provided by <b>heralds</b>.<br>Each herald gives you <b>+1% CpS</b>.<br>Look on the purple flag at the top to see how many heralds are active at any given time.<q>Be excellent to each other.<br>And Patreon, dudes!</q>',100,[21,29]);Game.last.pool='prestige';
9880
9881
order=255;
9882
Game.GrandmaSynergy('Metagrandmas','A fractal grandma to make more grandmas to make more cookies.','Fractal engine');
9883
9884
order=1300;
9885
new Game.TieredUpgrade('Metabakeries','Fractal engines are <b>twice</b> as efficient.<q>They practically bake themselves!</q>','Fractal engine',1);
9886
new Game.TieredUpgrade('Mandelbrown sugar','Fractal engines are <b>twice</b> as efficient.<q>A substance that displays useful properties such as fractal sweetness and instant contact lethality.</q>','Fractal engine',2);
9887
new Game.TieredUpgrade('Fractoids','Fractal engines are <b>twice</b> as efficient.<q>Here\'s a frun fract : all in all, these were a terrible idea.</q>','Fractal engine',3);
9888
new Game.TieredUpgrade('Nested universe theory','Fractal engines are <b>twice</b> as efficient.<q>Asserts that each subatomic particle is host to a whole new universe, and therefore, another limitless quantity of cookies.<br>This somehow stacks with the theory of nanocosmics, because physics.</q>','Fractal engine',4);
9889
new Game.TieredUpgrade('Menger sponge cake','Fractal engines are <b>twice</b> as efficient.<q>Frighteningly absorbent thanks to its virtually infinite surface area. Keep it isolated in a dry chamber, never handle it with an open wound, and do not ever let it touch a body of water.</q>','Fractal engine',5);
9890
new Game.TieredUpgrade('One particularly good-humored cow','Fractal engines are <b>twice</b> as efficient.<q>This unassuming bovine was excruciatingly expensive and it may seem at first like you were ripped off. On closer inspection however, you notice that its earrings (it\'s wearing earrings) are actually fully functional copies of itself, each of which also wearing their own cow earrings, and so on, infinitely. It appears your dairy concerns will be taken care of for a while, although you\'ll have to put up with the cow\'s annoying snickering.</q>','Fractal engine',6);
9891
new Game.TieredUpgrade('Chocolate ouroboros','Fractal engines are <b>twice</b> as efficient.<q>Forever eating its own tail and digesting itself, in a metabolically dubious tale of delicious tragedy.</q>','Fractal engine',7);
9892
new Game.TieredUpgrade('Nested','Fractal engines are <b>twice</b> as efficient.<q>Clever self-reference or shameful cross-promotion? This upgrade apparently has the gall to advertise a link to <u>orteil.dashnet.org/nested</u>, in a tooltip you can\'t even click.</q>','Fractal engine',8);
9893
new Game.TieredUpgrade('Space-filling fibers','Fractal engines are <b>twice</b> as efficient.<q>This special ingredient has the incredible ability to fill the local space perfectly, effectively eradicating hunger in those who consume it!<br>Knowing that no hunger means no need for cookies, your marketers urge you to repurpose this product into next-level packing peanuts.</q>','Fractal engine',9);
9894
new Game.TieredUpgrade('Endless book of prose','Fractal engines are <b>twice</b> as efficient.','Fractal engine',10);
9895
Game.last.descFunc=function(){
9896
var str='"There once was a baker named '+Game.bakeryName+'. One day, there was a knock at the door; '+Game.bakeryName+' opened it and was suddenly face-to-face with a strange and menacing old grandma. The grandma opened her mouth and, in a strange little voice, started reciting this strange little tale : ';
9897
var n=35;
9898
var i=Math.floor(Game.T*0.1);
9899
return this.desc+'<q style="font-family:Courier;">'+(str.substr(i%str.length,n)+(i%str.length>(str.length-n)?str.substr(0,i%str.length-(str.length-n)):''))+'</q>';
9900
};
9901
new Game.TieredUpgrade('The set of all sets','Fractal engines are <b>twice</b> as efficient.<q>The answer, of course, is a definite maybe.</q>','Fractal engine',11);
9902
9903
order=5000;
9904
Game.SynergyUpgrade('Recursive mirrors','<q>Do you have any idea what happens when you point two of these at each other? Apparently, the universe doesn\'t either.</q>','Fractal engine','Prism','synergy1');
9905
//Game.SynergyUpgrade('Compounded odds','<q>When probabilities start cascading, "never in a billion lifetimes" starts looking terribly like "probably before Monday comes around".</q>','Fractal engine','Chancemaker','synergy1');
9906
Game.SynergyUpgrade('Mice clicking mice','','Fractal engine','Cursor','synergy2');
9907
Game.last.descFunc=function(){
9908
Math.seedrandom(Game.seed+'-blasphemouse');
9909
if (Math.random()<0.3) {Math.seedrandom();return this.desc+'<q>Absolutely blasphemouse!</q>';}
9910
else {Math.seedrandom();return this.desc+'<q>Absolutely blasphemous!</q>';}
9911
};
9912
9913
9914
order=10020;
9915
Game.NewUpgradeCookie({name:'Custard creams',desc:'British lore pits these in a merciless war against bourbon biscuits.<br>The filling evokes vanilla without quite approaching it.<br>They\'re tastier on the inside!',icon:[23,29],power: 4,price: 9999999999999999999999999999999999999*5});
9916
Game.NewUpgradeCookie({name:'Bourbon biscuits',desc:'Two chocolate biscuits joined together with even more chocolate.<br>The sworn rivals of custard creams, as legend has it.',icon:[24,29],power: 4,price: 99999999999999999999999999999999999999});
9917
9918
9919
new Game.Upgrade('Keepsakes','Seasonal random drops have a <b>1/5 chance</b> to carry over through ascensions.<q>Cherish the memories.</q>',1111111111,[22,29]);Game.last.pool='prestige';Game.last.parents=['Starsnow','Starlove','Starterror','Startrade','Starspawn'];
9920
9921
order=10020;
9922
Game.NewUpgradeCookie({name:'Mini-cookies',desc:'Have you ever noticed how the smaller something is, the easier it is to binge on it?',icon:[29,30],power: 5,price: 99999999999999999999999999999999999999*5});
9923
9924
new Game.Upgrade('Sugar crystal cookies','Cookie production multiplier <b>+5% permanently</b>, and <b>+1%</b> for every building type level 10 or higher.<q>Infused with cosmic sweetness. It gives off a faint shimmery sound when you hold it up to your ear.</q>',1000000000,[21,30]);Game.last.pool='prestige';Game.last.parents=['Sugar baking'];Game.last.power=function(){
9925
var n=5;
9926
for (var i in Game.Objects)
9927
{
9928
if (Game.Objects[i].level>=10) n++;
9929
}
9930
return n;
9931
};Game.last.pseudoCookie=true;
9932
Game.last.descFunc=function(){
9933
var n=5;
9934
for (var i in Game.Objects)
9935
{
9936
if (Game.Objects[i].level>=10) n++;
9937
}
9938
return '<div style="text-align:center;">Current : <b>+'+Beautify(n)+'%</b><div class="line"></div></div>'+this.desc;
9939
};
9940
new Game.Upgrade('Box of maybe cookies','Contains an assortment of...something.<q>These may or may not be considered cookies.</q>',333000000000,[25,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];
9941
new Game.Upgrade('Box of not cookies','Contains an assortment of...something.<q>These are strictly, definitely not cookies.</q>',333000000000,[26,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];
9942
new Game.Upgrade('Box of pastries','Contains an assortment of delicious pastries.<q>These are a damn slippery slope is what they are!</q>',333000000000,[27,29]);Game.last.pool='prestige';Game.last.parents=['Sugar crystal cookies'];
9943
9944
order=10040;
9945
Game.NewUpgradeCookie({name:'Profiteroles',desc:'Also known as cream puffs, these pastries are light, fluffy, filled with whipped cream and fun to throw at people when snowballs are running scarce.',icon:[29,29],require:'Box of pastries', power:4,price: Math.pow(10,31)});
9946
Game.NewUpgradeCookie({name:'Jelly donut',desc:'Guaranteed to contain at least 0.3% jelly filling, or your money back.<br>You can still see the jelly stab wound!',icon:[27,28],require:'Box of pastries', power:4,price: Math.pow(10,33)});
9947
Game.NewUpgradeCookie({name:'Glazed donut',desc:'Absolutely gooey with sugar. The hole is the tastiest part!',icon:[28,28],require:'Box of pastries', power:4,price: Math.pow(10,35)});
9948
Game.NewUpgradeCookie({name:'Chocolate cake',desc:'The cake is a Portal reference!',icon:[25,27],require:'Box of pastries', power:4,price: Math.pow(10,37)});
9949
Game.NewUpgradeCookie({name:'Strawberry cake',desc:'It\'s not easy to come up with flavor text for something as generic as this, but some would say it\'s a piece of cake.',icon:[26,27],require:'Box of pastries', power:4,price: Math.pow(10,39)});
9950
Game.NewUpgradeCookie({name:'Apple pie',desc:'It is said that some grandmas go rogue and bake these instead.',icon:[25,28],require:'Box of pastries', power:4,price: Math.pow(10,41)});
9951
Game.NewUpgradeCookie({name:'Lemon meringue pie',desc:'Meringue is a finicky substance made of sugar and egg whites that requires specific atmospheric conditions to be baked at all. The lemon, as far as we can tell, isn\'t nearly as picky.',icon:[26,28],require:'Box of pastries', power:4,price: Math.pow(10,43)});
9952
Game.NewUpgradeCookie({name:'Butter croissant',desc:'Look around.<br>A rude man in a striped shirt bikes past you. He smells of cigarettes and caf&eacute;-au-lait. Somewhere, a mime uses his moustache to make fun of the British. 300 pigeons fly overhead.<br>Relax. You\'re experiencing croissant.',icon:[29,28],require:'Box of pastries', power:4,price: Math.pow(10,45)});
9953
9954
order=10050;
9955
Game.NewUpgradeCookie({name:'Cookie dough',desc:'Bursting with infinite potential, but can also be eaten as is. Arguably worth the salmonella.',icon:[25,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,35)});
9956
Game.NewUpgradeCookie({name:'Burnt cookie',desc:'This cookie flew too close to the sun and is now a shadow of its former self. If only you remembered to set a timer, you wouldn\'t have this tragedy on your hands...',icon:[23,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,37)});
9957
Game.NewUpgradeCookie({name:'A chocolate chip cookie but with the chips picked off for some reason',desc:'This has to be the saddest thing you\'ve ever seen.',icon:[24,30],require:'Box of maybe cookies', power:3,price: Math.pow(10,39)});
9958
Game.NewUpgradeCookie({name:'Flavor text cookie',desc:'What you\'re currently reading is what gives this cookie its inimitable flavor.',icon:[22,30],require:'Box of maybe cookies', power:4,price: Math.pow(10,41)});
9959
Game.NewUpgradeCookie({name:'High-definition cookie',desc:'Uncomfortably detailed, like those weird stories your aunt keeps telling at parties.',icon:[28,10],require:'Box of maybe cookies', power:5,price: Math.pow(10,43)});
9960
9961
order=10060;
9962
Game.NewUpgradeCookie({name:'Toast',desc:'A crisp slice of bread, begging for some butter and jam.<br>Why do people keep proposing these at parties?',icon:[27,10],require:'Box of not cookies', power:4,price: Math.pow(10,34)});
9963
Game.NewUpgradeCookie({name:'Peanut butter & jelly',desc:'It\'s time.',icon:[29,9],require:'Box of not cookies', power:4,price: Math.pow(10,36)});
9964
Game.NewUpgradeCookie({name:'Wookies',desc:'These aren\'t the cookies you\'re looking for.',icon:[26,30],require:'Box of not cookies', power:4,price: Math.pow(10,38)});
9965
Game.NewUpgradeCookie({name:'Cheeseburger',desc:'Absolutely no relation to cookies whatsoever - Orteil just wanted an excuse to draw a cheeseburger.',icon:[28,30],require:'Box of not cookies', power:4,price: Math.pow(10,40)});
9966
Game.NewUpgradeCookie({name:'One lone chocolate chip',desc:'The start of something beautiful.',icon:[27,30],require:'Box of not cookies', power:1,price: Math.pow(10,42)});
9967
9968
9969
new Game.Upgrade('Genius accounting','Unlocks <b>extra price information</b>.<br>Each displayed cost now specifies how long it\'ll take you to afford it, and how much of your bank it represents.<q>There\'s no accounting for taste, and yet here we are.</q>',2000000,[11,10]);Game.last.pool='prestige';Game.last.parents=['Inspired checklist'];
9970
9971
9972
new Game.Upgrade('Shimmering veil','Unlocks the <b>shimmering veil</b>, a switch that passively boosts your CpS by <b>50%</b>.<br>You start with the veil turned on; however, it is very fragile, and clicking the big cookie or any golden cookie or reindeer will turn it off, requiring 24 hours of CpS to turn back on.<q>Hands off!</q>',999999999,[9,10]);Game.last.pool='prestige';Game.last.parents=['Distilled essence of redoubled luck'];
9973
9974
order=40005;
9975
var func=function(){
9976
var boost=50;
9977
var resist=0;
9978
if (Game.Has('Reinforced membrane')) {boost+=10;resist+=10;}
9979
return (this.name=='Shimmering veil [on]'?'<div style="text-align:center;">Active.</div><div class="line"></div>':'')+'Boosts your cookie production by <b>'+Beautify(boost)+'%</b> when active.<br>The veil is very fragile and will break if you click the big cookie or any golden cookies or reindeer.<br><br>Once broken, turning the veil back on costs 24 hours of unbuffed CpS.'+(resist>0?('<br><br>Has a <b>'+Beautify(resist)+'%</b> chance to not break.'):'');
9980
};
9981
new Game.Upgrade('Shimmering veil [off]','',1000000,[9,10]);
9982
Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [on]';
9983
Game.last.priceFunc=function(){return Game.unbuffedCps*60*60*24;}
9984
Game.last.descFunc=func;
9985
new Game.Upgrade('Shimmering veil [on]','',0,[9,10]);
9986
Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [off]';
9987
Game.last.descFunc=func;
9988
9989
Game.loseShimmeringVeil=function(context)
9990
{
9991
if (!Game.Has('Shimmering veil')) return false;
9992
if (!Game.Has('Shimmering veil [off]') && Game.Has('Shimmering veil [on]')) return false;
9993
if (Game.Has('Reinforced membrane'))
9994
{
9995
if (context=='shimmer') Math.seedrandom(Game.seed+'/'+(Game.goldenClicks+Game.reindeerClicked));
9996
else if (context=='click') Math.seedrandom(Game.seed+'/'+Game.cookieClicks);
9997
if (Math.random()<0.1)
9998
{
9999
Game.Notify('The reinforced membrane protects the shimmering veil.','',[7,10]);
10000
Game.Win('Thick-skinned');
10001
return false;
10002
}
10003
Math.seedrandom();
10004
}
10005
var me=Game.Upgrades['Shimmering veil [on]'];
10006
me.bought=1;
10007
//Game.Upgrades[me.toggleInto].bought=false;
10008
Game.Lock(me.toggleInto);
10009
Game.Unlock(me.toggleInto);
10010
Game.Notify('The shimmering veil disappears...','',[9,10]);
10011
Game.upgradesToRebuild=1;
10012
Game.recalculateGains=1;
10013
PlaySound('snd/spellFail.mp3',0.75);
10014
}
10015
10016
10017
var getCookiePrice=function(level){return 999999999999999999999999999999999999999*Math.pow(10,(level-1)/2);};
10018
10019
order=10020;
10020
Game.NewUpgradeCookie({name:'Whoopie pies',desc:'Two chocolate halves joined together by a cream filling. It\'s got no eyebrows, but you never noticed until now.',icon:[21,31],power: 5,price: getCookiePrice(1)});
10021
Game.NewUpgradeCookie({name:'Caramel wafer biscuits',desc:'Coated in delicious chocolate. As many layers as you\'ll get in a biscuit without involving onions.',icon:[22,31],power: 5,price: getCookiePrice(2)});
10022
Game.NewUpgradeCookie({name:'Chocolate chip mocha cookies',desc:'Mocha started out as an excuse to smuggle chocolate into coffee. And now, in a poignant display of diplomacy and cultural exchange, it\'s bringing coffee to chocolate cookies.',icon:[23,31],power: 5,price: getCookiePrice(3)});
10023
Game.NewUpgradeCookie({name:'Earl Grey cookies',desc:'Captain Picard\'s favorite.',icon:[24,31],power: 5,price: getCookiePrice(4)});
10024
Game.NewUpgradeCookie({name:'Corn syrup cookies',desc:'The corn syrup makes it extra chewy. Not the type of stuff you\'d think to put in a cookie, but bakers make do.',icon:[25,31],power: 5,price: getCookiePrice(5)});
10025
Game.NewUpgradeCookie({name:'Icebox cookies',desc:'Can be prepared in a variety of shapes with a variety of ingredients. Made by freezing dough before baking it, mirroring a time-proven medieval torture practice. Gotta keep them guessing.',icon:[26,31],power: 5,price: getCookiePrice(6)});
10026
Game.NewUpgradeCookie({name:'Graham crackers',desc:'Inspired in their design by the wish to live a life of austere temperance, free from pleasure or cheer; it\'s no wonder these are so tasty.',icon:[27,31],power: 5,price: getCookiePrice(7)});
10027
Game.NewUpgradeCookie({name:'Hardtack',desc:'Extremely hard and, if we\'re being honest, extremely tack.<br>If you\'re considering eating this as a fun snack, you probably have other things to worry about than this game, like getting scurvy or your crew fomenting mutiny.',icon:[28,31],power: 5,price: getCookiePrice(8)});
10028
Game.NewUpgradeCookie({name:'Cornflake cookies',desc:'They\'re grrrrrroovy! Careful not to let it sit in your milk too long, lest you accidentally end up with a bowl of cereal and get confused.',icon:[29,31],power: 5,price: getCookiePrice(9)});
10029
Game.NewUpgradeCookie({name:'Tofu cookies',desc:'There\'s really two ways to go with tofu cooking; either it asserts itself in plain sight or it camouflages itself in the other ingredients. This happens to be the latter, and as such, you can\'t really tell the difference between this and a regular cookie, save for that one pixel on the left.',icon:[30,31],power: 5,price: getCookiePrice(10)});
10030
Game.NewUpgradeCookie({name:'Gluten-free cookies',desc:'Made with browned butter and milk to closely match the archetypal chocolate chip cookie.<br>For celiacs, a chance to indulge in a delicious risk-free pastry. For others, a strangely threatening confection whose empty eyes will never know heaven nor hell.',icon:[30,30],power: 5,price: getCookiePrice(10)});
10031
Game.NewUpgradeCookie({name:'Russian bread cookies',desc:'Also known as alphabet cookies; while most bakers follow the recipe to the letter, it is said that some substitute the flour for spelt. But don\'t take my word for it.',icon:[30,29],power: 5,price: getCookiePrice(11)});
10032
Game.NewUpgradeCookie({name:'Lebkuchen',desc:'Diverse cookies from Germany, fragrant with honey and spices, often baked around Christmas.<br>Once worn by warriors of old for protection in battle.<br>+5 STR, +20% magic resistance.',icon:[30,28],power: 5,price: getCookiePrice(12)});
10033
Game.NewUpgradeCookie({name:'Aachener Printen',desc:'The honey once used to sweeten these gingerbread-like treats has since been swapped out for beet sugar, providing another sad example of regressive evolution.',icon:[30,27],power: 5,price: getCookiePrice(13)});
10034
Game.NewUpgradeCookie({name:'Canistrelli',desc:'A dry biscuit flavored with anise and wine, tough like the people of Corsica where it comes from.',icon:[30,26],power: 5,price: getCookiePrice(14)});
10035
Game.NewUpgradeCookie({name:'Nice biscuits',desc:'Made with coconut and perfect with tea. Traces its origins to a French city so nice they named it that.',icon:[30,25],power: 5,price: getCookiePrice(15)});
10036
Game.NewUpgradeCookie({name:'French pure butter cookies',desc:'You can\'t tell what\'s stronger coming off these - the smell of butter or condescension.',icon:[31,25],power: 5,price: getCookiePrice(16)});
10037
Game.NewUpgradeCookie({name:'Petit beurre',desc:'An unassuming biscuit whose name simply means "little butter". Famed and feared for its four ears and forty-eight teeth.<br>When it hears ya, it\'ll get ya...',icon:[31,26],power: 5,price: getCookiePrice(16)});
10038
Game.NewUpgradeCookie({name:'Nanaimo bars',desc:'A delicious no-bake pastry hailing from Canada. Probably beats eating straight-up snow with maple syrup poured on it, but what do I know.',icon:[31,27],power: 5,price: getCookiePrice(17)});
10039
Game.NewUpgradeCookie({name:'Berger cookies',desc:'Messily slathered with chocolate fudge, but one of the most popular bergers of Baltimore, along with the triple fried egg berger and the blue crab cheeseberger.',icon:[31,28],power: 5,price: getCookiePrice(18)});
10040
Game.NewUpgradeCookie({name:'Chinsuko',desc:'A little piece of Okinawa in cookie form. Part of a Japanese custom of selling sweets as souvenirs. But hey, pressed pennies are cool too.',icon:[31,29],power: 5,price: getCookiePrice(19)});
10041
Game.NewUpgradeCookie({name:'Panda koala biscuits',desc:'Assorted jungle animals with equally assorted fillings.<br>Comes in chocolate, strawberry, vanilla and green tea.<br>Eat them all before they go extinct!',icon:[31,13],power: 5,price: getCookiePrice(19)});
10042
Game.NewUpgradeCookie({name:'Putri salju',desc:'A beloved Indonesian pastry; its name means "snow princess", for the powdered sugar it\'s coated with. Had we added these to Cookie Clicker some years ago, this is where we\'d make a reference to that one Disney movie, but it\'s probably time to let it go.',icon:[31,30],power: 5,price: getCookiePrice(20)});
10043
Game.NewUpgradeCookie({name:'Milk cookies',desc:'Best eaten with a tall glass of chocolate.',icon:[31,31],power: 5,price: getCookiePrice(21)});
10044
10045
order=9999;
10046
Game.NewUpgradeCookie({name:'Cookie crumbs',desc:'There used to be a cookie here. Now there isn\'t.<br>Good heavens, what did you <i>DO?!</i>',icon:[30,13],power:1,require:'Legacy',price:100});
10047
Game.NewUpgradeCookie({name:'Chocolate chip cookie',desc:'This is the cookie you\'ve been clicking this whole time. It looks a bit dented and nibbled on, but it\'s otherwise good as new.',icon:[10,0],power:10,require:'Legacy',price:1000000000000});
10048
10049
10050
new Game.Upgrade('Cosmic beginner\'s luck','Prior to purchasing the <b>Heavenly chip secret</b> upgrade in a run, random drops are <b>5 times more common</b>.<q>Oh! A penny!<br>Oh! A priceless heirloom!<br>Oh! Another penny!</q>',999999999*15,[8,10]);Game.last.pool='prestige';Game.last.parents=['Shimmering veil'];
10051
new Game.Upgrade('Reinforced membrane','The <b>shimmering veil</b> is more resistant, and has a <b>10% chance</b> not to break. It also gives <b>+10%</b> more CpS.<q>A consistency between jellyfish and cling wrap.</q>',999999999*15,[7,10]);Game.last.pool='prestige';Game.last.parents=['Shimmering veil'];
10052
10053
10054
order=255;
10055
Game.GrandmaSynergy('Binary grandmas','A digital grandma to transfer more cookies.<br>(See also : boolean grandmas, string grandmas, and not-a-number grandmas, also known as "NaNs".)','Javascript console');
10056
10057
order=1400;
10058
new Game.TieredUpgrade('The JavaScript console for dummies','Javascript consoles are <b>twice</b> as efficient.<q>This should get you started. The first line reads: "To open the javascript console, press-"<br>...the rest of the book is soaked in chocolate milk. If only there was a way to look up this sort of information...</q>','Javascript console',1);
10059
new Game.TieredUpgrade('64bit arrays','Javascript consoles are <b>twice</b> as efficient.<q>A long-form variable type to pack your cookies much more efficiently.</q>','Javascript console',2);
10060
new Game.TieredUpgrade('Stack overflow','Javascript consoles are <b>twice</b> as efficient.<q>This is really bad! You probably forgot to close a loop somewhere and now your programs are going crazy! The rest of your engineers seem really excited about it somehow. How could a software mishap like a stack overflow possibly ever help anyone?</q>','Javascript console',3);
10061
new Game.TieredUpgrade('Enterprise compiler','Javascript consoles are <b>twice</b> as efficient.<q>This bespoke javascript compiler took your team years of development and billions in research, but it should let you execute (certain) functions (up to) 2% faster (in optimal circumstances).</q>','Javascript console',4);
10062
new Game.TieredUpgrade('Syntactic sugar','Javascript consoles are <b>twice</b> as efficient.<q>Tastier code for tastier cookies.</q>','Javascript console',5);
10063
new Game.TieredUpgrade('A nice cup of coffee','Javascript consoles are <b>twice</b> as efficient.<q>All this nerd stuff has you exhausted. You make yourself a nice cup of coffee, brewed with roasted beans from some far-away island. You may have been working a bit too hard though - the cup of coffee starts talking to you, insisting that it is NOT javascript.</q>','Javascript console',6);
10064
new Game.TieredUpgrade('Just-in-time baking','Javascript consoles are <b>twice</b> as efficient.<q>A new method of preparing cookies; they bake themselves right in front of the customers before eating, leaving your kitchens mess-free.</q>','Javascript console',7);
10065
new Game.TieredUpgrade('cookies++','Javascript consoles are <b>twice</b> as efficient.<q>Your very own cookie-themed programming language, elegantly named after its most interesting ability - increasing the "cookies" variable by 1.</q>','Javascript console',8);
10066
new Game.TieredUpgrade('Software updates','Javascript consoles are <b>twice</b> as efficient.<q>This is grand news - someone\'s finally figured out the Wifi password, and your newfound internet connection seems to have triggered a whole lot of software updates! Your browsers, drivers and plugins all received a fresh coat of paint, and your javascript version has been updated to the latest ECMAScript specification. It\'s really too bad thousands had to die due to some deprecated function in your neurotoxin ventilation code, but I guess that\'s progress for you.</q>','Javascript console',9);
10067
new Game.TieredUpgrade('Game.Loop','Javascript consoles are <b>twice</b> as efficient.<q>You\'re not quite sure what to make of this. What does it mean? What does it do? Who would leave something like that just laying around here? Try asking again in 1/30th of a second.</q>','Javascript console',10);
10068
new Game.TieredUpgrade('eval()','Javascript consoles are <b>twice</b> as efficient.<q>It is said that this simple function holds the key to the universe, and that whosoever masters it may shape reality to their will.<br>Good thing you have no idea how it works. Makes for a neat plaque on your wall, though.</q>','Javascript console',11);
10069
10070
order=5000;
10071
Game.SynergyUpgrade('Script grannies','<q>Armies of energy drink-fueled grandmas ready to hack into the cyberspace for renegade e-cookies.</q>','Javascript console','Grandma','synergy1');
10072
Game.SynergyUpgrade('Tombola computing','','Javascript console','Chancemaker','synergy2');
10073
Game.last.descFunc=function(){
10074
Math.seedrandom(Game.seed+'-tombolacomputing');
10075
var str='(Your ticket reads '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+' '+Math.floor(Math.random()*100)+', entitling you to '+choose([Math.floor(Math.random()*5+2)+' lines of javascript','one free use of Math.random()','one qubit, whatever that is','one half-eaten cookie','a brand new vacuum cleaner','most of one room-temperature cup of orange soda','one really good sandwich','one handful of pocket lint','someone\'s mostly clean hairpiece','a trip to a fancy restaurant','the knowledge of those numbers','a furtive glance at the news ticker','another ticket, half-price','all-you-can-eat moldy bread','one lifetime supply of oxygen','the color '+choose['red','orange','yellow','green','blue','purple','black','white','gray','brown','pink','teal'],'increased intellect for a limited time','an ancient runesword','the throne of a far-away country','the position of Mafia capo. Good luck','one free time-travel week-end','something beautiful','the deed to some oil well','one hamburger made out of the animal, plant, or person of your choice','the last surviving '+choose['dodo bird','thylacine','unicorn','dinosaur','neanderthal'],'a deep feeling of accomplishment','a fleeting tinge of entertainment','a vague sense of unease','deep existential dread','one extra week added to your lifespan','breathe manually','blink right here and now','one meeting with any famous person, living or dead, in your next dream','one very nice dream','a wacky sound effect','45 seconds of moral flexibility','hundreds and thousands, also known as "sprinkles"','one circle, triangle, square or other simple geometric shape, of average dimensions','just this extra bit of randomness','the extra push you needed to turn your life around','a good fright','one secret superpower','a better luck next time','an irrational phobia of tombola tickets','one whole spider','an increased sense of self-worth and determination','inner peace','one double-XP week-end in the MMORPG of your choice','a little piece of the universe, represented by the trillions of atoms that make up this very ticket','food poisoning','the Moon! Well, conceptually','a new car, baby','a new catchphrase','an intrusive thought of your choice','- ...aw man, it just cuts off there','the director spot for the next big hit movie','really good-looking calves','one genuine pirate golden doubloon','"treasure and riches", or something','one boat, sunken','baby shoes, never worn','direct lineage to some King or Queen','innate knowledge of a dead language you\'ll never encounter','the melody of a song you don\'t know the words to','white noise','mild physical impairment','a new pair of lips','things, and such','one popular expression bearing your name','one typo','one get-out-of-jail-free card','the rest of your life... for now','one polite huff','a condescending stare','one cursed monkey paw','true love, probably','an interesting factoid about the animal, country, TV show or celebrity of your choice','a pop culture reference','minutes of fun','the etymology of the word "tombola" - it\'s Italian for "a tumble"','nothing. You lost, sorry'])+'.)';
10076
Math.seedrandom();
10077
return this.desc+'<q>Like quantum computing, but more fun.<br>'+str+'</q>';
10078
};
10079
10080
order=10020;
10081
Game.NewUpgradeCookie({name:'Kruidnoten',desc:'A festive dutch favorite; tiny cinnamony bites sometimes coated in chocolate. The name translates roughly to "kruidnoten".',icon:[30,3],power: 5,price: getCookiePrice(22)});
10082
Game.NewUpgradeCookie({name:'Marie biscuits',desc:'Pleasantly round, smoothly buttery, subtly vanilla-flavored, ornately embossed, each ridge represents a person Marie killed in prison.',icon:[30,4],power: 5,price: getCookiePrice(23)});
10083
Game.NewUpgradeCookie({name:'Meringue cookies',desc:'Probably the most exciting thing you can make out of egg whites. Also called forgotten cookies, due to the recipe being once lost in a sealed mystical vault for 10,000 years.',icon:[31,4],power: 5,price: getCookiePrice(24)});
10084
10085
order=10060;
10086
Game.NewUpgradeCookie({name:'Pizza',desc:'What is a pizza if not a large, chewy cookie, frosted with a rather exuberant tomato & cheese icing? Not a cookie, that\'s what.',icon:[31,9],require:'Box of not cookies', power:5,price: Math.pow(10,44)});
10087
10088
order=10050;
10089
Game.NewUpgradeCookie({name:'Crackers',desc:'These are the non-flavored kind with no salt added. Really just a judgement-free wheat square begging to have bits of ham and spreadable cheese piled onto it, its main contribution being "crunchy".',icon:[30,9],require:'Box of maybe cookies', power:4,price: Math.pow(10,45)});
10090
10091
order=10030;
10092
Game.NewUpgradeCookie({name:'Havabreaks',desc:'You can snap the sections neatly or just bite into the whole thing like some kind of lunatic. Some oversea countries manufacture these in hundreds of unique flavors, such as green tea, lobster bisque, and dark chocolate.',icon:[31,3],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999*5});
10093
10094
order=20000;
10095
new Game.Upgrade('Kitten executives','You gain <b>more CpS</b> the more milk you have.<q>ready to execute whatever and whoever you\'d like, sir</q>',900000000000000000000000000000000000000000000,Game.GetIcon('Kitten',13));Game.last.kitten=1;Game.MakeTiered(Game.last,13,18);
10096
10097
10098
order=10020;
10099
Game.NewUpgradeCookie({name:'Chai tea cookies',desc:'Not exactly Captain Picard\'s favorite, but I mean, these will do in a pinch.',icon:[23,32],power: 5,price: getCookiePrice(4)+5});Game.last.order=10020.5685;
10100
10101
Game.NewUpgradeCookie({name:'Yogurt cookies',desc:'Augmented by the wonders of dairy, these cookies are light and fluffy and just one more thing for the lactose-intolerant to avoid.<br>Truly for the cultured among us.',icon:[24,32],power: 5,price: getCookiePrice(25)});
10102
Game.NewUpgradeCookie({name:'Thumbprint cookies',desc:'Filled with jam and sometimes served in little paper cups. No longer admissible as biometric evidence in court. We\'re not having a repeat of that whole mess.',icon:[25,32],power: 5,price: getCookiePrice(26)});
10103
Game.NewUpgradeCookie({name:'Pizzelle',desc:'Thin, crisp waffle cookies baked in a bespoke iron following an ancient Italian recipe.<br>These cookies have been around for a long, long time.<br>These cookies have seen things.',icon:[26,32],power: 5,price: getCookiePrice(27)});
10104
10105
order=10030;
10106
Game.NewUpgradeCookie({name:'Zilla wafers',desc:'Popular vanilla-flavored biscuits that somehow keep ending up in banana pudding.<br>Themed after a beloved radioactive prehistoric monster, for some reason.',icon:[22,32],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999999*5});
10107
Game.NewUpgradeCookie({name:'Dim Dams',desc:'Two biscuits joined by chocolate and coated in even more chocolate.<br>You wonder - which one is the dim, and which one is the dam?',icon:[31,10],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999999999*5});
10108
10109
order=10060;
10110
Game.NewUpgradeCookie({name:'Candy',desc:'There are two pillars to the world of sweets : pastries, of course - and candy.<br>You could make a whole new game just about these, but for now, please enjoy these assorted generic treats.',icon:[30,10],require:'Box of not cookies', power:5,price: Math.pow(10,46)});
10111
10112
10113
order=19000;
10114
new Game.TieredUpgrade('Fortune #001','Cursors are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Fingers are not the only thing you can count on.</q>','Cursor','fortune');
10115
new Game.TieredUpgrade('Fortune #002','Grandmas are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>A wrinkle is a crack in a mundane facade.</q>','Grandma','fortune');
10116
new Game.TieredUpgrade('Fortune #003','Farms are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The seeds of tomorrow already lie within the seeds of today.</q>','Farm','fortune');
10117
new Game.TieredUpgrade('Fortune #004','Mines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Riches from deep under elevate you all the same.</q>','Mine','fortune');
10118
new Game.TieredUpgrade('Fortune #005','Factories are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>True worth is not in what you find, but in what you make.</q>','Factory','fortune');
10119
new Game.TieredUpgrade('Fortune #006','Banks are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The value of money means nothing to a pocket.</q>','Bank','fortune');
10120
new Game.TieredUpgrade('Fortune #007','Temples are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Not all guides deserve worship.</q>','Temple','fortune');
10121
new Game.TieredUpgrade('Fortune #008','Wizard towers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Magic is about two things - showmanship, and rabbits.</q>','Wizard tower','fortune');
10122
new Game.TieredUpgrade('Fortune #009','Shipments are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Every mile travelled expands the mind by just as much.</q>','Shipment','fortune');
10123
new Game.TieredUpgrade('Fortune #010','Alchemy labs are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Don\'t get used to yourself. You\'re gonna have to change.</q>','Alchemy lab','fortune');
10124
new Game.TieredUpgrade('Fortune #011','Portals are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Every doorway is a gamble. Tread with care.</q>','Portal','fortune');
10125
new Game.TieredUpgrade('Fortune #012','Time machines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Do your future self a favor; they\'ll thank you for it.</q>','Time machine','fortune');
10126
new Game.TieredUpgrade('Fortune #013','Antimatter condensers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>The world is made of what we put into it.</q>','Antimatter condenser','fortune');
10127
new Game.TieredUpgrade('Fortune #014','Prisms are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Staring at a dazzling light can blind you back to darkness.</q>','Prism','fortune');
10128
new Game.TieredUpgrade('Fortune #015','Chancemakers are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>Don\'t leave to blind chance what you could accomplish with deaf skill.</q>','Chancemaker','fortune');
10129
new Game.TieredUpgrade('Fortune #016','Fractal engines are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>It\'s good to see yourself in others. Remember to see yourself in yourself, too.</q>','Fractal engine','fortune');
10130
new Game.TieredUpgrade('Fortune #017','Javascript consoles are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>If things aren\'t working out for you, rewrite the rules.</q>','Javascript console','fortune');
10131
10132
10133
order=19100;
10134
//note : price for these capped to base price OR 1 day of unbuffed CpS
10135
new Game.Upgrade('Fortune #100','Upgrades and buildings cost <b>-1%</b>; you gain <b>+1%</b> CpS.<q>True wealth is counted in gifts.</q>',
10136
Game.Tiers['fortune'].price*100000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);
10137
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
10138
new Game.Upgrade('Fortune #101','You gain <b>+7%</b> CpS.<q>Some people dream of fortunes; others dream of cookies.</q>',Game.Tiers['fortune'].price*100000000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);
10139
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
10140
new Game.Upgrade('Fortune #102','You gain <b>+1%</b> of your regular CpS while the game is closed <small>(provided you have the Twin Gates of Transcendence heavenly upgrade)</small>.<q>Help, I\'m trapped in a browser game!</q>',Game.Tiers['fortune'].price*100000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);
10141
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
10142
new Game.Upgrade('Fortune #103','You gain <b>more CpS</b> the more milk you have.<q>Don\'t believe the superstitions; all cats are good luck.</q>',Game.Tiers['fortune'].price*100000000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',18);Game.last.kitten=1;
10143
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
10144
new Game.Upgrade('Fortune #104','Clicking gains <b>+1% of your CpS</b>.<q>Remember to stay in touch.</q>',Game.Tiers['fortune'].price*100000000000,[0,0]);Game.MakeTiered(Game.last,'fortune',11);
10145
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
10146
10147
new Game.Upgrade('Fortune cookies','The news ticker may occasionally have <b>fortunes</b>, which may be clicked for something good.<q>These don\'t taste all that great but that\'s not really the point, is it?</q>',77777777777,[29,8]);Game.last.pool='prestige';Game.last.parents=['Distilled essence of redoubled luck'];
10148
10149
10150
order=40000;
10151
new Game.Upgrade('A really good guide book','<b>???</b><q>??????</q>',7,[22,12]);//debug purposes only
10152
//new Game.Upgrade('A really good guide book','<b>All dungeon locations behave as if unlocked.</b><br><b>You may shift-click a dungeon location to teleport there.</b><q>It even tells you which hotels to avoid!</q>',7,[22,12]);//debug purposes only
10153
Game.last.buyFunction=function(){if (Game.Objects['Factory'].minigameLoaded){Game.Objects['Factory'].minigame.computeMapBounds();Game.Objects['Factory'].minigame.updateLocStyles();}}
10154
Game.last.pool='debug';
10155
10156
order=10300;
10157
Game.NewUpgradeCookie({name:'Prism heart biscuits',desc:'An every-flavor biscuit that stands for universal love and being true to yourself.',require:'Eternal heart biscuits',season:'valentines',icon:[30,8], power:heartPower,price: 1000000000000000000000000});Game.last.order=10300.175;
10158
10159
order=19100;
10160
new Game.Upgrade('Kitten wages','Through clever accounting, this actually makes kitten upgrades <b>10% cheaper</b>.<q>Cats can have little a salary, as a treat.<br>Cats are expert hagglers and have a keen sense of bargaining, especially in the case of cash.</q>',9000000000,[31,8]);Game.last.pool='prestige';Game.last.parents=['Kitten angels'];Game.last.kitten=1;
10161
new Game.Upgrade('Pet the dragon','Unlocks the ability to <b>pet your dragon</b> by clicking on it once hatched.<q>Dragons do not purr. If your dragon starts purring, vacate the area immediately.</q>',99999999999,[30,12]);Game.last.pool='prestige';Game.last.parents=['How to bake your dragon','Residual luck'];
10162
10163
order=25100;
10164
var dragonDropUpgradeCost=function(me){return Game.unbuffedCps*60*30*((Game.dragonLevel<Game.dragonLevels.length-1)?1:0.1);};
10165
new Game.Upgrade('Dragon scale','Cookie production multiplier <b>+3%</b>.<br>Cost scales with CpS, but 10 times cheaper with a fully-trained dragon.<q>Your dragon sheds these regularly, so this one probably won\'t be missed.<br>Note: icon not to scale.</q>',999,[30,14]);Game.last.priceFunc=dragonDropUpgradeCost;
10166
new Game.Upgrade('Dragon claw','Clicks are <b>+3% more powerful</b>.<br>Cost scales with CpS, but 10 times cheaper with a fully-trained dragon.<q>Will grow back in a few days\' time.<br>A six-inch retractable claw, like a razor, from the middle toe. So you know, try to show a little respect.</q>',999,[31,14]);Game.last.priceFunc=dragonDropUpgradeCost;
10167
new Game.Upgrade('Dragon fang','<b>+3%</b> golden cookie gains.<br>Dragon harvest and Dragonflight are <b>10% stronger</b>.<br>Cost scales with CpS, but 10 times cheaper with a fully-trained dragon.<q>Just a fallen baby tooth your dragon wanted you to have, as a gift.<br>It might be smaller than an adult tooth, but it\'s still frighteningly sharp - and displays some awe-inspiring cavities, which you might expect from a creature made out of sweets.</q>',999,[30,15]);Game.last.priceFunc=dragonDropUpgradeCost;
10168
new Game.Upgrade('Dragon teddy bear','<b>+3%</b> random drops.<br>Cost scales with CpS, but 10 times cheaper with a fully-trained dragon.<q>Your dragon used to sleep with this, but it\'s yours now.<br>Crafted in the likelihood of a fearsome beast. Stuffed with magical herbs picked long ago by a wandering wizard. Woven from elven yarn and a polyester blend.</q>',999,[31,15]);Game.last.priceFunc=dragonDropUpgradeCost;
10169
10170
order=10020;
10171
Game.NewUpgradeCookie({name:'Granola cookies',desc:'Wait! These are just oatmeal cookies mixed with raisin cookies! What next, half-dark chocolate half-white chocolate cookies?',icon:[28,32],power: 5,price: getCookiePrice(28)});
10172
Game.NewUpgradeCookie({name:'Ricotta cookies',desc:'Light and cake-like. Often flavored with lemon or almond extract. Sprinkles optional. Allegedly Italian. Investigation pending.',icon:[29,32],power: 5,price: getCookiePrice(29)});
10173
Game.NewUpgradeCookie({name:'Roze koeken',desc:'The icing on these Dutch cookies is traditionally pink, but different colors may be used for special occasions - such as pink to celebrate Breast Cancer Awareness Month, or for International Flamingo Day, pink.',icon:[30,32],power: 5,price: getCookiePrice(30)});
10174
Game.NewUpgradeCookie({name:'Peanut butter cup cookies',desc:'What more poignant example of modern societal struggles than the brazen reclaiming of a corporate product by integrating it in the vastly more authentic shell of a homemade undertaking? Anyway this is a peanut butter cup, baked into a cookie. It\'s pretty good!',icon:[31,32],power: 5,price: getCookiePrice(31)});
10175
Game.NewUpgradeCookie({name:'Sesame cookies',desc:'Look at all the little seeds on these! It\'s like someone dropped them on the street or something! A very welcoming and educational street!',icon:[22,33],power: 5,price: getCookiePrice(32)});
10176
Game.NewUpgradeCookie({name:'Taiyaki',desc:'A pastry fish filled with red bean paste, doomed to live an existence of constant and excruciating pain as its aquatic environment slowly dissolves its soft doughy body.<br>Also comes in chocolate flavor!',icon:[23,33],power: 5,price: getCookiePrice(33)});
10177
Game.NewUpgradeCookie({name:'Vanillekipferl',desc:'Nut-based cookies from Central Europe, coated in powdered vanilla sugar. Regular kipferl, crescent-shaped bread rolls from the same region, are much less exciting.',icon:[24,33],power: 5,price: getCookiePrice(34)});
10178
10179
order=10300;
10180
Game.NewUpgradeCookie({name:'Cosmic chocolate butter biscuit',desc:'Rewarded for owning 550 of everything.<br>Through some strange trick of magic or technology, looking at this cookie is like peering into a deep ocean of ancient stars. The origins of this biscuit are unknown; its manufacture, as far as your best investigators can tell, left no paper trail. From a certain angle, if you squint hard enough, you\'ll notice that a number of stars near the center are arranged to resemble the outline of your own face.',icon:[27,32],power: 10,price: 999999999999999999999999999999999999999999999999*butterBiscuitMult,locked:1});
10181
10182
order=100;new Game.Upgrade('Nonillion fingers','Multiplies the gain from Thousand fingers by <b>20</b>.<q>Only for the freakiest handshakes.</q>',10000000000000000000000000,[12,31]);Game.MakeTiered(Game.last,13,0);
10183
order=150;new Game.Upgrade('Miraculite mouse','Clicking gains <b>+1% of your CpS</b>.<q>Composed of a material that neither science nor philosophy are equipped to conceptualize. And boy, does it ever click.</q>',50000000000000000000000000000,[11,31]);Game.MakeTiered(Game.last,13,11);
10184
order=200;new Game.TieredUpgrade('Generation degeneration','Grandmas are <b>twice</b> as efficient.<q>Genetic testing shows that most of your grandmas are infected with a strange degenerative disease that only seems to further their powers; the more time passes, the older they get. This should concern you.</q>','Grandma',12);
10185
order=300;new Game.TieredUpgrade('Global seed vault','Farms are <b>twice</b> as efficient.<q>An enormous genetic repository that could outlive an apocalypse. Guarantees the survival of your empire, or at the very least its agricultural components, should civilization fall. Which should be any day now.</q>','Farm',12);
10186
order=400;new Game.TieredUpgrade('Air mining','Mines are <b>twice</b> as efficient.<q>You\'ve dug your drills through just about every solid surface you could find. But did you know recent advances have revealed untold riches hiding within non-solid surfaces too?</q>','Mine',12);
10187
order=500;new Game.TieredUpgrade('Behavioral reframing','Factories are <b>twice</b> as efficient.<q>Through careful social engineering you\'ve convinced your workers that "union" is a slur that only the most vile and repugnant filth among us would ever dare utter! Sometimes progress isn\'t in the big machines, it\'s in the little lies!</q>','Factory',12);
10188
order=525;new Game.TieredUpgrade('Altruistic loop','Banks are <b>twice</b> as efficient.<q>You control so many branches of the global economy and legislative bodies that, through a particularly creative loophole, donating money (to yourself) grants you even more cash in tax deductions than you started with!</q>','Bank',12);
10189
order=550;new Game.TieredUpgrade('A novel idea','Temples are <b>twice</b> as efficient.<q>You don\'t get rich starting a religion. If you want to get rich, you write science fiction.</q>','Temple',12);
10190
order=575;new Game.TieredUpgrade('Spelling bees','Wizard towers are <b>twice</b> as efficient.<q>You\'ve unleashed a swarm of magically-enhanced bees upon mankind! Their stinging spells may be the bane of all living things but you\'re certain you can put their delicious, purple, fizzy honey to good use!</q>','Wizard tower',12);
10191
order=600;new Game.TieredUpgrade('Toroid universe','Shipments are <b>twice</b> as efficient.<q>If you think of the universe as an nth-dimensional torus that wraps back on itself in every direction, you can save a fortune on rocket fuel! Of course the universe isn\'t actually shaped like that, but you\'ve never let details stand in your way.</q>','Shipment',12);
10192
order=700;new Game.TieredUpgrade('Hermetic reconciliation','Alchemy labs are <b>twice</b> as efficient.<q>It\'s time for modern science and the mystical domains of the occult to work together at last. What do gravitons transmute into? What if alkahest is pH-neutral? Should a homunculus have the right to vote? And other exciting questions coming to you soon, whether you like it or not.</q>','Alchemy lab',12);
10193
order=800;new Game.TieredUpgrade('His advent','Portals are <b>twice</b> as efficient.<q>He comes! He comes at last! Just like the prophecies foretold! And as He steps out of the portal, your engineers begin slicing Him into convenient chunks before transporting His writhing cosmic flesh to your factories, where He will be processed and converted into a new and exciting cookie flavor, available in stores tomorrow.</q>','Portal',12);
10194
order=900;new Game.TieredUpgrade('Split seconds','Time machines are <b>twice</b> as efficient.<q>Time is infinite, yes... But what if, nestled within each second, were even more infinities? Every moment an eternity! Think of how many scheduling troubles this solves!</q>','Time machine',12);
10195
order=1000;new Game.TieredUpgrade('Flavor itself','Antimatter condensers are <b>twice</b> as efficient.<q>Deep under the earth, in the most sterile laboratory, in the most vast and expensive particle accelerator ever devised, your scientists have synthesized -for a fraction of a second- the physical manifestation of pure flavor. Highly unstable, and gone in a puff of radioactive energy, it nonetheless left your team shivering with awe... and hunger.</q>','Antimatter condenser',12);
10196
order=1100;new Game.TieredUpgrade('Light speed limit','Prisms are <b>twice</b> as efficient.<q>Whoah, slow down. Harvesting light is well and good but it\'d be much easier if it weren\'t so dang fast! This should thankfully take care of that.</q>','Prism',12);
10197
order=1200;new Game.TieredUpgrade('A touch of determinism','Chancemakers are <b>twice</b> as efficient.<q>By knowing the exact position and movement of every particle in the universe, you\'re able to predict everything that can ever happen, leaving nothing to chance. This was a doozy to pull off mind you, but it\'s helped you win 50 bucks at the horse races so you could say it\'s already paying off.</q>','Chancemaker',12);
10198
order=1300;new Game.TieredUpgrade('This upgrade','Fractal engines are <b>twice</b> as efficient.<q>This upgrade\'s flavor text likes to refer to itself, as well as to the fact that it likes to refer to itself. You should really buy this upgrade before it starts doing anything more obnoxious.</q>','Fractal engine',12);
10199
order=1400;new Game.TieredUpgrade('Your biggest fans','Javascript consoles are <b>twice</b> as efficient.<q>Let\'s face it, baking cookies isn\'t the most optimized thing there is. So you\'ve purchased your biggest fans yet and stuck them next to your computers to keep things chill and in working order. Cool!</q>','Javascript console',12);
10200
10201
10202
order=10020;
10203
Game.NewUpgradeCookie({name:'Battenberg biscuits',desc:'Inspired by a cake of the same name, itself named after a prince of the same name. You suppose you could play a really, really short game of chess on these.',icon:[28,33],power: 5,price: getCookiePrice(35)});
10204
Game.NewUpgradeCookie({name:'Rosette cookies',desc:'Intricate fried pastries from Northern Europe, made using specialized irons and dipped in icing sugar. While usually eaten as a delicious treat, these are often also used as Christmas tree decorations, or worn elegantly on one\'s lapel to symbolize the nah I\'m just messing with you.',icon:[26,33],power: 5,price: getCookiePrice(36)});
10205
Game.NewUpgradeCookie({name:'Gangmakers',desc:'The little bit of raspberry jam at its center is crucial; a plain butter cookie with chocolate topping does not a gangmaker make.',icon:[27,33],power: 5,price: getCookiePrice(37)});
10206
Game.NewUpgradeCookie({name:'Welsh cookies',desc:'Welsh cookies, also known as Welsh cakes, bakestones, griddle cakes, griddle scones, or pics, or in Welsh: <i>picau ar y maen, pice bach, cacennau cri</i> or <i>teisennau gradell</i>, are rich currant-filled scone-like biscuits of uncertain origin.',icon:[29,33],power: 5,price: getCookiePrice(38)});
10207
Game.NewUpgradeCookie({name:'Raspberry cheesecake cookies',desc:'The humble raspberry cheesecake, now in ascended cookie form. Researchers posit that raspberry cheesecake cookies are evidence that the final form of every baked good, through convergent evolution, approaches that of a cookie, in a process known as cookienisation.',icon:[25,33],power: 5,price: getCookiePrice(39)});
10208
10209
10210
10211
order=255;
10212
Game.GrandmaSynergy('Alternate grandmas','A different grandma to bake something else.','Idleverse');
10213
10214
order=1500;
10215
new Game.TieredUpgrade('Manifest destiny','Idleverses are <b>twice</b> as efficient.<q>While the ethics of ransacking parallel universes for their riches may seem questionable to some, you\'ve reasoned that bringing the good word of your cookie empire to the unwashed confines of other realities is your moral duty, nay, your righteous imperative, and must be undertaken as soon as possible, lest they do it to you first!</q>','Idleverse',1);
10216
new Game.TieredUpgrade('The multiverse in a nutshell','Idleverses are <b>twice</b> as efficient.<q>The structure of the metacosmos may seem confusing and at times even contradictory, but here\'s what you\'ve gathered so far:<br><br><div style="text-align:left;">&bull; each reality, or "idleverse", exists in parallel to all others<br><br>&bull; most realities seem to converge towards the production of a sole type of item (ours evidently being, thanks to you, cookies)<br><br>&bull; each reality is riddled with chaotic tunnels to a number of subordinate dimensions (such as the so-called "cookieverse"), much like swiss cheese<br><br>&bull; all realities bathe in an infinite liquid of peculiar properties, colloquially known as "milk"</div><br>Finally, each reality may have its own interpretation of the concept of "reality", for added fun.</q>','Idleverse',2);
10217
new Game.TieredUpgrade('All-conversion','Idleverses are <b>twice</b> as efficient.<q>It\'s quite nice that you can rewire the logic of each universe to generate cookies instead, but you still end up with parsec-loads of whatever they were producing before - baubles you\'ve long made obsolete: cash money, gems, cheeseburgers, puppies... That\'s why you\'ve designed the universal converter, compatible with any substance and capable of turning those useless spoils of conquest into the reassuring crumbly rustle of even more cookies.</q>','Idleverse',3);
10218
new Game.TieredUpgrade('Multiverse agents','Idleverses are <b>twice</b> as efficient.<q>You can send undercover spies to infiltrate each universe and have them signal you whether it\'s worth overtaking. Once the assimilation process started, they will also help pacify the local populations, having established trust through the use of wacky, but seamless, disguises.</q>','Idleverse',4);
10219
new Game.TieredUpgrade('Escape plan','Idleverses are <b>twice</b> as efficient.<q>You\'ve set an idleverse aside and terraformed it to closely resemble this one in case something goes horribly wrong in here. Of course, the denizens of that idleverse also have their own escape idleverse to abscond to in the eventuality of your arrival, itself likely having its own contingency idleverse, and so on.</q>','Idleverse',5);
10220
new Game.TieredUpgrade('Game design','Idleverses are <b>twice</b> as efficient.<q>Each idleverse functions according to some form of transcendental programming, that much is a given. But they also seem to be governed by much more subtle rules, the logic of which, when harnessed, may give you unparalleled dominion over the multiverse. Rewrite the rules! A game designer is you!</q>','Idleverse',6);
10221
new Game.TieredUpgrade('Sandbox universes','Idleverses are <b>twice</b> as efficient.<q>It doesn\'t seem like you\'ll run out of extra universes anytime soon so why not repurpose some of them as consequence-free testing grounds for all your more existentially threatening market research? (...consequence-free for you, anyway.)</q>','Idleverse',7);
10222
new Game.TieredUpgrade('Multiverse wars','Idleverses are <b>twice</b> as efficient.<q>Hmm, looks like some other universes wised up to your plundering. Thankfully, that\'s nothing your extra beefed-up metacosmic military budget can\'t handle!</q>','Idleverse',8);
10223
new Game.TieredUpgrade('Mobile ports','Idleverses are <b>twice</b> as efficient.<q>Accessing each outer universe is a bit of a hassle, requiring the once-in-a-blue-moon alignment of natural cosmic ports to transit from universe to universe. You\'ve finally perfected the method of constructing your own self-propelled ports, which can travel near-instantaneously along universal perimeters to permit headache-free multiverse connections. Took you long enough.</q>','Idleverse',9);
10224
new Game.TieredUpgrade('Encapsulated realities','Idleverses are <b>twice</b> as efficient.<q>Untold feats of science went into the reduction of infinite universes into these small, glimmering, easy-to-store little spheres. Exercise infinite caution when handling these, for each of them, containing endless galaxies and supporting endless life, is more precious than you can ever fathom. They\'ve also proven to be quite a smash hit in your warehouses on bowling night.</q>','Idleverse',10);
10225
new Game.TieredUpgrade('Extrinsic clicking','Idleverses are <b>twice</b> as efficient.<q>If you poke an idleverse, it seems like it gets work done faster. It\'s also quite fun hearing a trillion terrified voices screaming in unison.</q>','Idleverse',11);
10226
new Game.TieredUpgrade('Universal idling','Idleverses are <b>twice</b> as efficient.<q>The nature of idleverses is found in waiting. The more you wait on an idleverse, the more exponentially potent it becomes - which saves you a whole lot of hard work. In a true act of zen, you\'ve taken to biding your time when collecting new universes, letting them ripen like a fine wine.</q>','Idleverse',12);
10227
10228
order=5000;
10229
Game.SynergyUpgrade('Perforated mille-feuille cosmos','<q>Imagine, if you will, layers upon layers upon layers. Now picture billions of worms chewing their way through it all. This roughly, but not quite, approximates the geometry of the most basal stratum of our natural world.</q>','Idleverse','Portal','synergy1');
10230
Game.SynergyUpgrade('Infraverses and superverses','<q>Universes within universes? How subversive!</q>','Idleverse','Fractal engine','synergy2');
10231
10232
order=19000;
10233
new Game.TieredUpgrade('Fortune #018','Idleverses are <b>7%</b> more efficient and <b>7%</b> cheaper.<q>There\'s plenty of everyone, but only one of you.</q>','Idleverse','fortune');
10234
10235
order=10300;
10236
Game.NewUpgradeCookie({name:'Butter biscuit (with butter)',desc:'Rewarded for owning 600 of everything.<br>This is a plain butter biscuit. It\'s got some butter on it. The butter doesn\'t look like anything in particular.',icon:[30,33],power: 10,price: 999999999999999999999999999999999999999999999999999*butterBiscuitMult,locked:1});
10237
10238
10239
order=200;new Game.TieredUpgrade('Visits','Grandmas are <b>twice</b> as efficient.<q>In an extensive double-blind study (sample size: 12 millions), your researchers have found evidence that grandmas are up to twice as productive if you just come by and say hi once in a while. It\'s nice to check up on your grans! (Do not under any circumstances ingest any tea or tea-like substances the grandmas may offer you.)</q>','Grandma',13);
10240
order=300;new Game.TieredUpgrade('Reverse-veganism','Farms are <b>twice</b> as efficient.<q>Plants aren\'t for eating, plants are for exploitative agriculture and astronomical profit margins!</q>','Farm',13);
10241
order=400;new Game.TieredUpgrade('Caramel alloys','Mines are <b>twice</b> as efficient.<q>Your geologists have isolated a family of once-overlooked sugary ores that, when combined, may be turned into even more cookie ingredients. Your millions of miles of previously useless tunnels probably house insane amounts of the stuff!</q>','Mine',13);
10242
order=500;new Game.TieredUpgrade('The infinity engine','Factories are <b>twice</b> as efficient.<q>In this house, I guess we don\'t care much for the laws of thermodynamics.</q>','Factory',13);
10243
order=525;new Game.TieredUpgrade('Diminishing tax returns','Banks are <b>twice</b> as efficient.<q>Wow, they\'re tiny! Wish you\'d thought of that sooner!</q>','Bank',13);
10244
order=550;new Game.TieredUpgrade('Apparitions','Temples are <b>twice</b> as efficient.<q>You\'ve booked a deal with the higher-ups that schedules one weekly earthly apparition by a deity, angel, ascended prophet, or other holy figure. This should boost interest in cookie religion among youths as long as you can secure a decent time slot.</q>','Temple',13);
10245
order=575;new Game.TieredUpgrade('Wizard basements','Wizard towers are <b>twice</b> as efficient.<q>You\'ve received construction permits allowing you to build basements underneath each wizard tower. This provides a handy storage space for precious reagents, fizzled-out soul gems, and weird old magazines.</q>','Wizard tower',13);
10246
order=600;new Game.TieredUpgrade('Prime directive','Shipments are <b>twice</b> as efficient.<q>An intergalactic delegation made you pinky-swear not to directly interact with lesser alien cultures. Which is fine, because it\'s much funnier to rob a planet blind when its inhabitants have no idea what\'s going on.</q>','Shipment',13);
10247
order=700;new Game.TieredUpgrade('Chromatic cycling','Alchemy labs are <b>twice</b> as efficient.<q>All states of matter exist in a continuous loop. Having learned how to cycle through them, all you have to do is to freeze matter right on the state you need. For reference, the cookie state of matter is situated at precisely 163.719&deg;, right between lamellar gas and metaplasma.</q>','Alchemy lab',13);
10248
order=800;new Game.TieredUpgrade('Domestic rifts','Portals are <b>twice</b> as efficient.<q>You\'ve managed to manufacture portals that are convenient enough, and legally safe enough, that you can just stick them against walls inside buildings to connect rooms together in unusual configurations. In practice, this means your employees get to have much shorter bathroom breaks.</q>','Portal',13);
10249
order=900;new Game.TieredUpgrade('Patience abolished','Time machines are <b>twice</b> as efficient.<q>You wait for no one.</q>','Time machine',13);
10250
order=1000;new Game.TieredUpgrade('Delicious pull','Antimatter condensers are <b>twice</b> as efficient.<q>In addition to the 4 fundamental forces of the universe -gravity, electromagnetism, weak and strong interactions- your scientists have at long last confirmed the existence of a fifth one, mediated by sugar bosons; it dictates that any two masses of ingredient-like matter will, given enough time, eventually meet each other to produce a third, even tastier substance. Your team enthusiastically names it the delicious pull.</q>','Antimatter condenser',13);
10251
order=1100;new Game.TieredUpgrade('Occam\'s laser','Prisms are <b>twice</b> as efficient.<q>Invented by Franciscan friar William of Occam in 1<span></span>327. An impossibly clever use of light theory with a billion possible applications, some of which frightfully destructive. Confined to a single goat-skin parchment for hundreds of years until the patent expired and hit public domain, just now.</q>','Prism',13);
10252
order=1200;new Game.TieredUpgrade('On a streak','Chancemakers are <b>twice</b> as efficient.<q>Take a moment to appreciate how far you\'ve come. How lucky you\'ve been so far. It doesn\'t take a genius statistician to extrapolate a trend from this. There\'s no way anything bad could happen to you now. Right?</q>','Chancemaker',13);
10253
order=1300;new Game.TieredUpgrade('A box','Fractal engines are <b>twice</b> as efficient.<q>What\'s in that box? Why, it\'s a tiny replica of your office! And there\'s even a little you in there! And what\'s on the little desk... say - that\'s an even tinier box! And the little you is opening it, revealing an even tinier office! And in the tinier office there\'s- Hmm. You can think of a couple uses for this.</q>','Fractal engine',13);
10254
order=1400;new Game.TieredUpgrade('Hacker shades','Javascript consoles are <b>twice</b> as efficient.<q>I\'m in.</q>','Javascript console',13);
10255
order=1500;new Game.TieredUpgrade('Break the fifth wall','Idleverses are <b>twice</b> as efficient.<q>Huh, was that always there? Whatever it was, it\'s gone now. And what was behind is yours for the taking.</q>','Idleverse',13);
10256
10257
10258
new Game.Upgrade('Cat ladies','Each kitten upgrade boosts grandma CpS by <b>29%</b>.<q>Oh no. Oh no no no. Ohhh this isn\'t right at all.</q>',9000000000,[32,3]);Game.last.pool='prestige';Game.last.parents=['Kitten angels'];
10259
new Game.Upgrade('Milkhelp&reg; lactose intolerance relief tablets','Each rank of milk boosts grandma CpS by <b>5%</b>.<q>Aged like milk.</q>',900000000000,[33,3]);Game.last.pool='prestige';Game.last.parents=['Cat ladies'];
10260
10261
new Game.Upgrade('Aura gloves','Cursor levels boost clicks by <b>5%</b> each (up to cursor level 10).<q>Try not to high-five anyone wearing these. You don\'t want that mess on your hands.</q>',555555555,[32,4]);Game.last.pool='prestige';Game.last.parents=['Halo gloves'];
10262
new Game.Upgrade('Luminous gloves','<b>Aura gloves</b> are now effective up to cursor level 20.<q>These help power your clicks to absurd levels, but they\'re also quite handy when you want to light up the darkness on your way back from Glove World.</q>',55555555555,[33,4]);Game.last.pool='prestige';Game.last.parents=['Aura gloves'];
10263
10264
order=10020;
10265
Game.NewUpgradeCookie({name:'Bokkenpootjes',desc:'Consist of 2 meringue halves joined by buttercream and dipped both ways in chocolate. Named after a goat\'s foot that probably stepped in something twice.',icon:[32,8],power: 5,price: getCookiePrice(40)});
10266
Game.NewUpgradeCookie({name:'Fat rascals',desc:'Almond-smiled Yorkshire cakes with a rich history and an even richer recipe. The more diet-conscious are invited to try the lean version, skinny scallywags.',icon:[33,8],power: 5,price: getCookiePrice(41)});
10267
Game.NewUpgradeCookie({name:'Ischler cookies',desc:'Originating in the Austro-Hungarian Empire, these have spread throughout every country in eastern Europe and spawned just as many recipes, each claiming to be the original. The basis remains unchanged across all variants: two biscuits sandwiched around chocolate buttercream. Or was it jam?',icon:[32,9],power: 5,price: getCookiePrice(42)});
10268
Game.NewUpgradeCookie({name:'Matcha cookies',desc:'Green tea and cookies, a matcha made in heaven.',icon:[33,9],power: 5,price: getCookiePrice(42)});
10269
10270
order=10032;
10271
Game.NewUpgradeCookie({name:'Earl Grey macarons',desc:'Best served hot, make it so!',icon:[32,10],require:'Box of macarons', power:3,price: 9999999999999999999999999999});
10272
10273
order=10030;
10274
Game.NewUpgradeCookie({name:'Pokey',desc:'While commonly thought to be named so because it\'s fun to poke your classmates with these, Pokey-brand biscuit sticks actually get their name from their popularity in smoke-free prisons, where they\'re commonly smuggled and traded in lieu of cigarettes.',icon:[33,10],require:'Box of brand biscuits',power: 2, price: 999999999999999999999999999999999999*5});
10275
10276
order=10000;
10277
Game.NewUpgradeCookie({name:'Cashew cookies',desc:'Let me tell you about cashews. Cashews are not nuts, but seeds that grow out of curious red or yellow fruits - which can be eaten on their own, or made into drinks. The shell around the nut itself contains a nasty substance that stains and irritates the hands of whoever handles it for too long. But that\'s okay, since now that you\'ve read this you\'ll make sure it doesn\'t get in the cookies! Oh, you\'ve already eaten how many? Okay then.',icon:[32,7],power: 2, price: 99999999});
10278
order=10001;
10279
Game.NewUpgradeCookie({name:'Milk chocolate cookies',desc:'A strange inversion of chocolate milk. For those who are a little bit too hardcore for white chocolate, but not hardcore enough for dark.',icon:[33,7],power:2, price: 99999999*5});
10280
10281
//end of upgrades
10282
10283
Game.seasons={
10284
'christmas':{name:'Christmas',start:'Christmas season has started!',over:'Christmas season is over.',trigger:'Festive biscuit'},
10285
'valentines':{name:'Valentine\'s day',start:'Valentine\'s day has started!',over:'Valentine\'s day is over.',trigger:'Lovesick biscuit'},
10286
'fools':{name:'Business day',start:'Business day has started!',over:'Business day is over.',trigger:'Fool\'s biscuit'},
10287
'easter':{name:'Easter',start:'Easter season has started!',over:'Easter season is over.',trigger:'Bunny biscuit'},
10288
'halloween':{name:'Halloween',start:'Halloween has started!',over:'Halloween is over.',trigger:'Ghostly biscuit'}
10289
};
10290
10291
Game.listTinyOwnedUpgrades=function(arr)
10292
{
10293
var str='';
10294
for (var i=0;i<arr.length;i++)
10295
{
10296
if (Game.Has(arr[i]))
10297
{
10298
var it=Game.Upgrades[arr[i]];
10299
str+='<div class="icon" style="vertical-align:middle;display:inline-block;'+(it.icon[2]?'background-image:url('+it.icon[2]+');':'')+'background-position:'+(-it.icon[0]*48)+'px '+(-it.icon[1]*48)+'px;transform:scale(0.5);margin:-16px;"></div>';
10300
}
10301
}
10302
return str;
10303
}
10304
10305
Game.santaDrops=['Increased merriness','Improved jolliness','A lump of coal','An itchy sweater','Reindeer baking grounds','Weighted sleighs','Ho ho ho-flavored frosting','Season savings','Toy workshop','Naughty list','Santa\'s bottomless bag','Santa\'s helpers','Santa\'s legacy','Santa\'s milk and cookies'];
10306
10307
Game.GetHowManySantaDrops=function()
10308
{
10309
var num=0;
10310
for (var i in Game.santaDrops) {if (Game.Has(Game.santaDrops[i])) num++;}
10311
return num;
10312
}
10313
10314
Game.reindeerDrops=['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits'];
10315
Game.GetHowManyReindeerDrops=function()
10316
{
10317
var num=0;
10318
for (var i in Game.reindeerDrops) {if (Game.Has(Game.reindeerDrops[i])) num++;}
10319
return num;
10320
}
10321
/*for (var i in Game.santaDrops)
10322
{
10323
Game.Upgrades[Game.santaDrops[i]].descFunc=function(){return '<div style="text-align:center;">You currently own <b>'+Game.GetHowManySantaDrops()+'/'+Game.santaDrops.length+'</b> of Santa\'s gifts.</div><div class="line"></div>'+this.desc;};
10324
}*/
10325
10326
Game.seasonDrops=Game.heartDrops.concat(Game.halloweenDrops).concat(Game.easterEggs).concat(Game.santaDrops).concat(Game.reindeerDrops);
10327
10328
Game.saySeasonSwitchUses=function()
10329
{
10330
if (Game.seasonUses==0) return 'You haven\'t switched seasons this ascension yet.';
10331
return 'You\'ve switched seasons <b>'+(Game.seasonUses==1?'once':Game.seasonUses==2?'twice':(Game.seasonUses+' times'))+'</b> this ascension.';
10332
}
10333
Game.Upgrades['Festive biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.santaDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManySantaDrops()+'/'+Game.santaDrops.length+'</b> of Santa\'s gifts.<div class="line"></div>'+Game.listTinyOwnedUpgrades(Game.reindeerDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyReindeerDrops()+'/'+Game.reindeerDrops.length+'</b> reindeer cookies.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
10334
Game.Upgrades['Bunny biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.easterEggs)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyEggs()+'/'+Game.easterEggs.length+'</b> eggs.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
10335
Game.Upgrades['Ghostly biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.halloweenDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyHalloweenDrops()+'/'+Game.halloweenDrops.length+'</b> halloween cookies.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
10336
Game.Upgrades['Lovesick biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.listTinyOwnedUpgrades(Game.heartDrops)+'<br><br>You\'ve purchased <b>'+Game.GetHowManyHeartDrops()+'/'+Game.heartDrops.length+'</b> heart biscuits.<div class="line"></div>'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
10337
Game.Upgrades['Fool\'s biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
10338
10339
Game.computeSeasonPrices=function()
10340
{
10341
for (var i in Game.seasons)
10342
{
10343
Game.seasons[i].triggerUpgrade.priceFunc=function(){
10344
var m=1;
10345
if (Game.hasGod)
10346
{
10347
var godLvl=Game.hasGod('seasons');
10348
if (godLvl==1) m*=2;
10349
else if (godLvl==2) m*=1.50;
10350
else if (godLvl==3) m*=1.25;
10351
}
10352
//return Game.seasonTriggerBasePrice*Math.pow(2,Game.seasonUses)*m;
10353
//return Game.cookiesPs*60*Math.pow(1.5,Game.seasonUses)*m;
10354
return Game.seasonTriggerBasePrice+Game.unbuffedCps*60*Math.pow(1.5,Game.seasonUses)*m;
10355
}
10356
}
10357
}
10358
Game.computeSeasons=function()
10359
{
10360
for (var i in Game.seasons)
10361
{
10362
var me=Game.Upgrades[Game.seasons[i].trigger];
10363
Game.seasons[i].triggerUpgrade=me;
10364
me.pool='toggle';
10365
me.buyFunction=function()
10366
{
10367
Game.seasonUses+=1;
10368
Game.computeSeasonPrices();
10369
//Game.Lock(this.name);
10370
for (var i in Game.seasons)
10371
{
10372
var me=Game.Upgrades[Game.seasons[i].trigger];
10373
if (me.name!=this.name) {Game.Lock(me.name);Game.Unlock(me.name);}
10374
}
10375
if (Game.season!='' && Game.season!=this.season)
10376
{
10377
var str=Game.seasons[Game.season].over+'<div class="line"></div>';
10378
if (Game.prefs.popups) Game.Popup(str);
10379
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon,4);
10380
}
10381
Game.season=this.season;
10382
Game.seasonT=Game.getSeasonDuration();
10383
Game.storeToRefresh=1;
10384
Game.upgradesToRebuild=1;
10385
Game.Objects['Grandma'].redraw();
10386
var str=Game.seasons[this.season].start+'<div class="line"></div>';
10387
if (Game.prefs.popups) Game.Popup(str);
10388
else Game.Notify(str,'',this.icon,4);
10389
}
10390
10391
me.clickFunction=function(me){return function()
10392
{
10393
//undo season
10394
if (me.bought && Game.season && me==Game.seasons[Game.season].triggerUpgrade)
10395
{
10396
me.lose();
10397
var str=Game.seasons[Game.season].over;
10398
if (Game.prefs.popups) Game.Popup(str);
10399
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);
10400
if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}
10401
10402
Game.upgradesToRebuild=1;
10403
Game.recalculateGains=1;
10404
Game.season=Game.baseSeason;
10405
Game.seasonT=-1;
10406
PlaySound('snd/tick.mp3');
10407
return false;
10408
}
10409
else return true;
10410
};}(me);
10411
10412
me.displayFuncWhenOwned=function(){return '<div style="text-align:center;">Time remaining :<br><b>'+(Game.Has('Eternal seasons')?'forever':Game.sayTime(Game.seasonT,-1))+'</b><div style="font-size:80%;">(Click again to cancel season)</div></div>';}
10413
me.timerDisplay=function(upgrade){return function(){if (!Game.Upgrades[upgrade.name].bought || Game.Has('Eternal seasons')) return -1; else return 1-Game.seasonT/Game.getSeasonDuration();}}(me);
10414
10415
}
10416
}
10417
Game.getSeasonDuration=function(){return Game.fps*60*60*24;}
10418
Game.computeSeasons();
10419
10420
//alert untiered building upgrades
10421
for (var i in Game.Upgrades)
10422
{
10423
var me=Game.Upgrades[i];
10424
if (me.order>=200 && me.order<2000 && !me.tier && me.name.indexOf('grandma')==-1 && me.pool!='prestige') console.log(me.name+' has no tier.');
10425
}
10426
10427
Game.UpgradesByPool={'kitten':[]};
10428
for (var i in Game.Upgrades)
10429
{
10430
if (!Game.UpgradesByPool[Game.Upgrades[i].pool]) Game.UpgradesByPool[Game.Upgrades[i].pool]=[];
10431
Game.UpgradesByPool[Game.Upgrades[i].pool].push(Game.Upgrades[i]);
10432
if (Game.Upgrades[i].kitten) Game.UpgradesByPool['kitten'].push(Game.Upgrades[i]);
10433
}
10434
10435
Game.PrestigeUpgrades=[];
10436
for (var i in Game.Upgrades)
10437
{
10438
if (Game.Upgrades[i].pool=='prestige' || Game.Upgrades[i].pool=='prestigeDecor')
10439
{
10440
Game.PrestigeUpgrades.push(Game.Upgrades[i]);
10441
Game.Upgrades[i].posX=0;
10442
Game.Upgrades[i].posY=0;
10443
if (Game.Upgrades[i].parents.length==0 && Game.Upgrades[i].name!='Legacy') Game.Upgrades[i].parents=['Legacy'];
10444
for (var ii in Game.Upgrades[i].parents) {Game.Upgrades[i].parents[ii]=Game.Upgrades[Game.Upgrades[i].parents[ii]];}
10445
}
10446
}
10447
10448
Game.goldenCookieUpgrades=['Get lucky','Lucky day','Serendipity','Heavenly luck','Lasting fortune','Decisive fate','Lucky digit','Lucky number','Lucky payout','Golden goose egg'];
10449
10450
Game.cookieUpgrades=[];
10451
for (var i in Game.Upgrades)
10452
{
10453
var me=Game.Upgrades[i];
10454
if ((me.pool=='cookie' || me.pseudoCookie)) Game.cookieUpgrades.push(me);
10455
if (me.tier) Game.Tiers[me.tier].upgrades.push(me);
10456
}
10457
for (var i in Game.UnlockAt){Game.Upgrades[Game.UnlockAt[i].name].unlockAt=Game.UnlockAt[i];}
10458
for (var i in Game.Upgrades){if (Game.Upgrades[i].pool=='prestige') Game.Upgrades[i].order=Game.Upgrades[i].id;}
10459
10460
/*var oldPrestigePrices={"Chimera":5764801,"Synergies Vol. I":2525,"Synergies Vol. II":252525,"Label printer":9999};
10461
for (var i in oldPrestigePrices){Game.Upgrades[i].basePrice=oldPrestigePrices[i];}*/
10462
10463
Game.UpgradePositions={141:[176,-66],181:[-555,-93],253:[-272,-231],254:[-99,-294],255:[-193,-279],264:[48,123],265:[133,154],266:[223,166],267:[305,137],268:[382,85],269:[-640,42],270:[-614,-268],271:[-728,-120],272:[-688,-205],273:[-711,-31],274:[270,-328],275:[317,-439],276:[333,-556],277:[334,-676],278:[333,-796],279:[328,-922],280:[303,-1040],281:[194,-230],282:[-265,212],283:[-321,297],284:[-322,406],285:[-243,501],286:[-403,501],287:[-314,606],288:[-312,-374],289:[-375,-502],290:[-165,-413],291:[453,-745],292:[-375,-651],293:[-399,-794],323:[-78,109],325:[192,-1127],326:[-328,-158],327:[-192,290],328:[-3,237],329:[92,376],353:[121,-326],354:[77,-436],355:[64,-548],356:[57,-673],357:[52,-793],358:[58,-924],359:[82,-1043],360:[-188,408],362:[158,289],363:[-30,-30],364:[-232,-730],365:[-77,349],368:[-55,-455],393:[196,-714],394:[197,-964],395:[-143,-140],396:[-264,-889],397:[-69,563],408:[-204,-1036],409:[-72,-1152],410:[-70,-1328],411:[-388,137],412:[-470,253],413:[-482,389],449:[-367,-1113],450:[-334,-1214],451:[-278,-1303],495:[-402,-966],496:[200,49],505:[-545,-570],520:[-279,-8],537:[-907,-131],539:[-508,-1270],540:[-629,-1291],541:[-594,-1186],542:[-548,-1374],561:[300,-17],562:[52,646],591:[154,744],592:[180,608],643:[-121,710],646:[457,-906],647:[-122,205],717:[589,-772],718:[622,-649],719:[-215,-526],720:[-96,-575],};
10464
10465
for (var i in Game.UpgradePositions) {Game.UpgradesById[i].posX=Game.UpgradePositions[i][0];Game.UpgradesById[i].posY=Game.UpgradePositions[i][1];}
10466
10467
10468
/*=====================================================================================
10469
ACHIEVEMENTS
10470
=======================================================================================*/
10471
Game.Achievements=[];
10472
Game.AchievementsById=[];
10473
Game.AchievementsN=0;
10474
Game.AchievementsOwned=0;
10475
Game.Achievement=function(name,desc,icon)
10476
{
10477
this.id=Game.AchievementsN;
10478
this.name=name;
10479
this.desc=desc;
10480
this.baseDesc=this.desc;
10481
this.desc=BeautifyInText(this.baseDesc);
10482
this.icon=icon;
10483
this.won=0;
10484
this.disabled=0;
10485
this.order=this.id;
10486
if (order) this.order=order+this.id*0.001;
10487
this.pool='normal';
10488
this.vanilla=Game.vanilla;
10489
this.type='achievement';
10490
10491
this.click=function()
10492
{
10493
if (this.clickFunction) this.clickFunction();
10494
}
10495
Game.last=this;
10496
Game.Achievements[this.name]=this;
10497
Game.AchievementsById[this.id]=this;
10498
Game.AchievementsN++;
10499
return this;
10500
}
10501
10502
Game.Win=function(what)
10503
{
10504
if (typeof what==='string')
10505
{
10506
if (Game.Achievements[what])
10507
{
10508
if (Game.Achievements[what].won==0)
10509
{
10510
var name=Game.Achievements[what].shortName?Game.Achievements[what].shortName:Game.Achievements[what].name;
10511
Game.Achievements[what].won=1;
10512
if (Game.prefs.popups) Game.Popup('Achievement unlocked :<br>'+name);
10513
else Game.Notify('Achievement unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+name+'</div>',Game.Achievements[what].icon);
10514
if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned++;
10515
Game.recalculateGains=1;
10516
}
10517
}
10518
}
10519
else {for (var i in what) {Game.Win(what[i]);}}
10520
}
10521
Game.RemoveAchiev=function(what)
10522
{
10523
if (Game.Achievements[what])
10524
{
10525
if (Game.Achievements[what].won==1)
10526
{
10527
Game.Achievements[what].won=0;
10528
if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned--;
10529
Game.recalculateGains=1;
10530
}
10531
}
10532
}
10533
Game.Achievement.prototype.toggle=function()//cheating only
10534
{
10535
if (!this.won)
10536
{
10537
Game.Win(this.name);
10538
}
10539
else
10540
{
10541
Game.RemoveAchiev(this.name);
10542
}
10543
if (Game.onMenu=='stats') Game.UpdateMenu();
10544
}
10545
10546
Game.CountsAsAchievementOwned=function(pool)
10547
{
10548
if (pool=='' || pool=='normal') return true; else return false;
10549
}
10550
10551
Game.HasAchiev=function(what)
10552
{
10553
return (Game.Achievements[what]?Game.Achievements[what].won:0);
10554
}
10555
10556
Game.TieredAchievement=function(name,desc,building,tier)
10557
{
10558
var achiev=new Game.Achievement(name,desc,Game.GetIcon(building,tier));
10559
Game.SetTier(building,tier);
10560
return achiev;
10561
}
10562
10563
Game.ProductionAchievement=function(name,building,tier,q,mult)
10564
{
10565
var building=Game.Objects[building];
10566
var icon=[building.iconColumn,22];
10567
var n=12+building.n+(mult||0);
10568
if (tier==2) {icon[1]=23;n+=7;}
10569
else if (tier==3) {icon[1]=24;n+=14;}
10570
var pow=Math.pow(10,n);
10571
var achiev=new Game.Achievement(name,'Make <b>'+toFixed(pow)+'</b> cookies just from '+building.plural+'.'+(q?'<q>'+q+'</q>':''),icon);
10572
building.productionAchievs.push({pow:pow,achiev:achiev});
10573
return achiev;
10574
}
10575
10576
Game.thresholdIcons=[0,1,2,3,4,5,6,7,8,9,10,11,18,19,20,21,22,23,24,25,26,27,28,29,21,22,23,24,25,26,27,28,29,21,22,23,24,25,26,27,28,29];
10577
Game.BankAchievements=[];
10578
Game.BankAchievement=function(name,q)
10579
{
10580
var threshold=Math.pow(10,Math.floor(Game.BankAchievements.length*1.5+2));
10581
if (Game.BankAchievements.length==0) threshold=1;
10582
var achiev=new Game.Achievement(name,'Bake <b>'+toFixed(threshold)+'</b> cookie'+(threshold==1?'':'s')+' in one ascension.'+(q?('<q>'+q+'</q>'):''),[Game.thresholdIcons[Game.BankAchievements.length],(Game.BankAchievements.length>32?1:Game.BankAchievements.length>23?2:5)]);
10583
achiev.threshold=threshold;
10584
achiev.order=100+Game.BankAchievements.length*0.01;
10585
Game.BankAchievements.push(achiev);
10586
return achiev;
10587
}
10588
Game.CpsAchievements=[];
10589
Game.CpsAchievement=function(name,q)
10590
{
10591
var threshold=Math.pow(10,Math.floor(Game.CpsAchievements.length*1.2));
10592
//if (Game.CpsAchievements.length==0) threshold=1;
10593
var achiev=new Game.Achievement(name,'Bake <b>'+toFixed(threshold)+'</b> cookie'+(threshold==1?'':'s')+' per second.'+(q?('<q>'+q+'</q>'):''),[Game.thresholdIcons[Game.CpsAchievements.length],(Game.CpsAchievements.length>32?1:Game.CpsAchievements.length>23?2:5)]);
10594
achiev.threshold=threshold;
10595
achiev.order=200+Game.CpsAchievements.length*0.01;
10596
Game.CpsAchievements.push(achiev);
10597
return achiev;
10598
}
10599
10600
//define achievements
10601
//WARNING : do NOT add new achievements in between, this breaks the saves. Add them at the end !
10602
10603
var order=0;//this is used to set the order in which the items are listed
10604
10605
Game.BankAchievement('Wake and bake');
10606
Game.BankAchievement('Making some dough');
10607
Game.BankAchievement('So baked right now');
10608
Game.BankAchievement('Fledgling bakery');
10609
Game.BankAchievement('Affluent bakery');
10610
Game.BankAchievement('World-famous bakery');
10611
Game.BankAchievement('Cosmic bakery');
10612
Game.BankAchievement('Galactic bakery');
10613
Game.BankAchievement('Universal bakery');
10614
Game.BankAchievement('Timeless bakery');
10615
Game.BankAchievement('Infinite bakery');
10616
Game.BankAchievement('Immortal bakery');
10617
Game.BankAchievement('Don\'t stop me now');
10618
Game.BankAchievement('You can stop now');
10619
Game.BankAchievement('Cookies all the way down');
10620
Game.BankAchievement('Overdose');
10621
10622
Game.CpsAchievement('Casual baking');
10623
Game.CpsAchievement('Hardcore baking');
10624
Game.CpsAchievement('Steady tasty stream');
10625
Game.CpsAchievement('Cookie monster');
10626
Game.CpsAchievement('Mass producer');
10627
Game.CpsAchievement('Cookie vortex');
10628
Game.CpsAchievement('Cookie pulsar');
10629
Game.CpsAchievement('Cookie quasar');
10630
Game.CpsAchievement('Oh hey, you\'re still here');
10631
Game.CpsAchievement('Let\'s never bake again');
10632
10633
order=30010;
10634
new Game.Achievement('Sacrifice','Ascend with <b>1 million</b> cookies baked.<q>Easy come, easy go.</q>',[11,6]);
10635
new Game.Achievement('Oblivion','Ascend with <b>1 billion</b> cookies baked.<q>Back to square one.</q>',[11,6]);
10636
new Game.Achievement('From scratch','Ascend with <b>1 trillion</b> cookies baked.<q>It\'s been fun.</q>',[11,6]);
10637
10638
order=11010;
10639
new Game.Achievement('Neverclick','Make <b>1 million</b> cookies by only having clicked <b>15 times</b>.',[12,0]);//Game.last.pool='shadow';
10640
order=1000;
10641
new Game.Achievement('Clicktastic','Make <b>1,000</b> cookies from clicking.',[11,0]);
10642
new Game.Achievement('Clickathlon','Make <b>100,000</b> cookies from clicking.',[11,1]);
10643
new Game.Achievement('Clickolympics','Make <b>10,000,000</b> cookies from clicking.',[11,2]);
10644
new Game.Achievement('Clickorama','Make <b>1,000,000,000</b> cookies from clicking.',[11,13]);
10645
10646
order=1050;
10647
new Game.Achievement('Click','Have <b>1</b> cursor.',[0,0]);
10648
new Game.Achievement('Double-click','Have <b>2</b> cursors.',[0,6]);
10649
new Game.Achievement('Mouse wheel','Have <b>50</b> cursors.',[1,6]);
10650
new Game.Achievement('Of Mice and Men','Have <b>100</b> cursors.',[0,1]);
10651
new Game.Achievement('The Digital','Have <b>200</b> cursors.',[0,2]);
10652
10653
order=1100;
10654
new Game.Achievement('Just wrong','Sell a grandma.<q>I thought you loved me.</q>',[10,9]);
10655
Game.TieredAchievement('Grandma\'s cookies','Have <b>1</b> grandma.','Grandma',1);
10656
Game.TieredAchievement('Sloppy kisses','Have <b>50</b> grandmas.','Grandma',2);
10657
Game.TieredAchievement('Retirement home','Have <b>100</b> grandmas.','Grandma',3);
10658
10659
order=1200;
10660
Game.TieredAchievement('Bought the farm','Have <b>1</b> farm.','Farm',1);
10661
Game.TieredAchievement('Reap what you sow','Have <b>50</b> farms.','Farm',2);
10662
Game.TieredAchievement('Farm ill','Have <b>100</b> farms.','Farm',3);
10663
10664
order=1400;
10665
Game.TieredAchievement('Production chain','Have <b>1</b> factory.','Factory',1);
10666
Game.TieredAchievement('Industrial revolution','Have <b>50</b> factories.','Factory',2);
10667
Game.TieredAchievement('Global warming','Have <b>100</b> factories.','Factory',3);
10668
10669
order=1300;
10670
Game.TieredAchievement('You know the drill','Have <b>1</b> mine.','Mine',1);
10671
Game.TieredAchievement('Excavation site','Have <b>50</b> mines.','Mine',2);
10672
Game.TieredAchievement('Hollow the planet','Have <b>100</b> mines.','Mine',3);
10673
10674
order=1500;
10675
Game.TieredAchievement('Expedition','Have <b>1</b> shipment.','Shipment',1);
10676
Game.TieredAchievement('Galactic highway','Have <b>50</b> shipments.','Shipment',2);
10677
Game.TieredAchievement('Far far away','Have <b>100</b> shipments.','Shipment',3);
10678
10679
order=1600;
10680
Game.TieredAchievement('Transmutation','Have <b>1</b> alchemy lab.','Alchemy lab',1);
10681
Game.TieredAchievement('Transmogrification','Have <b>50</b> alchemy labs.','Alchemy lab',2);
10682
Game.TieredAchievement('Gold member','Have <b>100</b> alchemy labs.','Alchemy lab',3);
10683
10684
order=1700;
10685
Game.TieredAchievement('A whole new world','Have <b>1</b> portal.','Portal',1);
10686
Game.TieredAchievement('Now you\'re thinking','Have <b>50</b> portals.','Portal',2);
10687
Game.TieredAchievement('Dimensional shift','Have <b>100</b> portals.','Portal',3);
10688
10689
order=1800;
10690
Game.TieredAchievement('Time warp','Have <b>1</b> time machine.','Time machine',1);
10691
Game.TieredAchievement('Alternate timeline','Have <b>50</b> time machines.','Time machine',2);
10692
Game.TieredAchievement('Rewriting history','Have <b>100</b> time machines.','Time machine',3);
10693
10694
10695
order=7000;
10696
new Game.Achievement('One with everything','Have <b>at least 1</b> of every building.',[2,7]);
10697
new Game.Achievement('Mathematician','Have at least <b>1 of the most expensive object, 2 of the second-most expensive, 4 of the next</b> and so on (capped at 128).',[23,12]);
10698
new Game.Achievement('Base 10','Have at least <b>10 of the most expensive object, 20 of the second-most expensive, 30 of the next</b> and so on.',[23,12]);
10699
10700
order=10000;
10701
new Game.Achievement('Golden cookie','Click a <b>golden cookie</b>.',[10,14]);
10702
new Game.Achievement('Lucky cookie','Click <b>7 golden cookies</b>.',[22,6]);
10703
new Game.Achievement('A stroke of luck','Click <b>27 golden cookies</b>.',[23,6]);
10704
10705
order=30200;
10706
new Game.Achievement('Cheated cookies taste awful','Hack in some cookies.',[10,6]);Game.last.pool='shadow';
10707
order=11010;
10708
new Game.Achievement('Uncanny clicker','Click really, really fast.<q>Well I\'ll be!</q>',[12,0]);
10709
10710
order=5000;
10711
new Game.Achievement('Builder','Own <b>100</b> buildings.',[2,6]);
10712
new Game.Achievement('Architect','Own <b>500</b> buildings.',[3,6]);
10713
order=6000;
10714
new Game.Achievement('Enhancer','Purchase <b>20</b> upgrades.',[9,0]);
10715
new Game.Achievement('Augmenter','Purchase <b>50</b> upgrades.',[9,1]);
10716
10717
order=11000;
10718
new Game.Achievement('Cookie-dunker','Dunk the cookie.<q>You did it!</q>',[1,8]);
10719
10720
order=10000;
10721
new Game.Achievement('Fortune','Click <b>77 golden cookies</b>.<q>You should really go to bed.</q>',[24,6]);
10722
order=31000;
10723
new Game.Achievement('True Neverclick','Make <b>1 million</b> cookies with <b>no</b> cookie clicks.<q>This kinda defeats the whole purpose, doesn\'t it?</q>',[12,0]);Game.last.pool='shadow';
10724
10725
order=20000;
10726
new Game.Achievement('Elder nap','Appease the grandmatriarchs at least <b>once</b>.<q>we<br>are<br>eternal</q>',[8,9]);
10727
new Game.Achievement('Elder slumber','Appease the grandmatriarchs at least <b>5 times</b>.<q>our mind<br>outlives<br>the universe</q>',[8,9]);
10728
10729
order=1150;
10730
new Game.Achievement('Elder','Own at least <b>7</b> grandma types.',[10,9]);
10731
10732
order=20000;
10733
new Game.Achievement('Elder calm','Declare a covenant with the grandmatriarchs.<q>we<br>have<br>fed</q>',[8,9]);
10734
10735
order=5000;
10736
new Game.Achievement('Engineer','Own <b>1000</b> buildings.',[4,6]);
10737
10738
order=10000;
10739
new Game.Achievement('Leprechaun','Click <b>777 golden cookies</b>.',[25,6]);
10740
new Game.Achievement('Black cat\'s paw','Click <b>7777 golden cookies</b>.',[26,6]);
10741
10742
order=30050;
10743
new Game.Achievement('Nihilism','Ascend with <b>1 quadrillion</b> cookies baked.<q>There are many things<br>that need to be erased</q>',[11,7]);
10744
10745
order=1900;
10746
Game.TieredAchievement('Antibatter','Have <b>1</b> antimatter condenser.','Antimatter condenser',1);
10747
Game.TieredAchievement('Quirky quarks','Have <b>50</b> antimatter condensers.','Antimatter condenser',2);
10748
Game.TieredAchievement('It does matter!','Have <b>100</b> antimatter condensers.','Antimatter condenser',3);
10749
10750
order=6000;
10751
new Game.Achievement('Upgrader','Purchase <b>100</b> upgrades.',[9,2]);
10752
10753
order=7000;
10754
new Game.Achievement('Centennial','Have at least <b>100 of everything</b>.',[6,6]);
10755
10756
order=30500;
10757
new Game.Achievement('Hardcore','Get to <b>1 billion</b> cookies baked with <b>no upgrades purchased</b>.',[12,6]);//Game.last.pool='shadow';
10758
10759
order=30600;
10760
new Game.Achievement('Speed baking I','Get to <b>1 million</b> cookies baked in <b>35 minutes</b>.',[12,5]);Game.last.pool='shadow';
10761
new Game.Achievement('Speed baking II','Get to <b>1 million</b> cookies baked in <b>25 minutes</b>.',[13,5]);Game.last.pool='shadow';
10762
new Game.Achievement('Speed baking III','Get to <b>1 million</b> cookies baked in <b>15 minutes</b>.',[14,5]);Game.last.pool='shadow';
10763
10764
10765
order=61000;
10766
var achiev=new Game.Achievement('Getting even with the oven','Defeat the <b>Sentient Furnace</b> in the factory dungeons.',[12,7]);Game.last.pool='dungeon';
10767
var achiev=new Game.Achievement('Now this is pod-smashing','Defeat the <b>Ascended Baking Pod</b> in the factory dungeons.',[12,7]);Game.last.pool='dungeon';
10768
var achiev=new Game.Achievement('Chirped out','Find and defeat <b>Chirpy</b>, the dysfunctionning alarm bot.',[13,7]);Game.last.pool='dungeon';
10769
var achiev=new Game.Achievement('Follow the white rabbit','Find and defeat the elusive <b>sugar bunny</b>.',[14,7]);Game.last.pool='dungeon';
10770
10771
order=1000;
10772
new Game.Achievement('Clickasmic','Make <b>100,000,000,000</b> cookies from clicking.',[11,14]);
10773
10774
order=1100;
10775
Game.TieredAchievement('Friend of the ancients','Have <b>150</b> grandmas.','Grandma',4);
10776
Game.TieredAchievement('Ruler of the ancients','Have <b>200</b> grandmas.','Grandma',5);
10777
10778
order=32000;
10779
new Game.Achievement('Wholesome','Unlock <b>100%</b> of your heavenly chips power.',[15,7]);
10780
10781
order=33000;
10782
new Game.Achievement('Just plain lucky','You have <b>1 chance in 500,000</b> every second of earning this achievement.',[15,6]);Game.last.pool='shadow';
10783
10784
order=21000;
10785
new Game.Achievement('Itchscratcher','Burst <b>1 wrinkler</b>.',[19,8]);
10786
new Game.Achievement('Wrinklesquisher','Burst <b>50 wrinklers</b>.',[19,8]);
10787
new Game.Achievement('Moistburster','Burst <b>200 wrinklers</b>.',[19,8]);
10788
10789
order=22000;
10790
new Game.Achievement('Spooky cookies','Unlock <b>every Halloween-themed cookie</b>.<div class="line"></div>Owning this achievement makes Halloween-themed cookies drop more frequently in future playthroughs.',[12,8]);
10791
10792
order=22100;
10793
new Game.Achievement('Coming to town','Reach <b>Santa\'s 7th form</b>.',[18,9]);
10794
new Game.Achievement('All hail Santa','Reach <b>Santa\'s final form</b>.',[19,10]);
10795
new Game.Achievement('Let it snow','Unlock <b>every Christmas-themed cookie</b>.<div class="line"></div>Owning this achievement makes Christmas-themed cookies drop more frequently in future playthroughs.',[19,9]);
10796
new Game.Achievement('Oh deer','Pop <b>1 reindeer</b>.',[12,9]);
10797
new Game.Achievement('Sleigh of hand','Pop <b>50 reindeer</b>.',[12,9]);
10798
new Game.Achievement('Reindeer sleigher','Pop <b>200 reindeer</b>.',[12,9]);
10799
10800
order=1200;
10801
Game.TieredAchievement('Perfected agriculture','Have <b>150</b> farms.','Farm',4);
10802
order=1400;
10803
Game.TieredAchievement('Ultimate automation','Have <b>150</b> factories.','Factory',4);
10804
order=1300;
10805
Game.TieredAchievement('Can you dig it','Have <b>150</b> mines.','Mine',4);
10806
order=1500;
10807
Game.TieredAchievement('Type II civilization','Have <b>150</b> shipments.','Shipment',4);
10808
order=1600;
10809
Game.TieredAchievement('Gild wars','Have <b>150</b> alchemy labs.','Alchemy lab',4);
10810
order=1700;
10811
Game.TieredAchievement('Brain-split','Have <b>150</b> portals.','Portal',4);
10812
order=1800;
10813
Game.TieredAchievement('Time duke','Have <b>150</b> time machines.','Time machine',4);
10814
order=1900;
10815
Game.TieredAchievement('Molecular maestro','Have <b>150</b> antimatter condensers.','Antimatter condenser',4);
10816
10817
order=2000;
10818
Game.TieredAchievement('Lone photon','Have <b>1</b> prism.','Prism',1);
10819
Game.TieredAchievement('Dazzling glimmer','Have <b>50</b> prisms.','Prism',2);
10820
Game.TieredAchievement('Blinding flash','Have <b>100</b> prisms.','Prism',3);
10821
Game.TieredAchievement('Unending glow','Have <b>150</b> prisms.','Prism',4);
10822
10823
order=5000;
10824
new Game.Achievement('Lord of Constructs','Own <b>2000</b> buildings.<q>He saw the vast plains stretching ahead of him, and he said : let there be civilization.</q>',[5,6]);
10825
order=6000;
10826
new Game.Achievement('Lord of Progress','Purchase <b>200</b> upgrades.<q>One can always do better. But should you?</q>',[9,14]);
10827
order=7002;
10828
new Game.Achievement('Bicentennial','Have at least <b>200 of everything</b>.<q>You crazy person.</q>',[8,6]);
10829
10830
order=22300;
10831
new Game.Achievement('Lovely cookies','Unlock <b>every Valentine-themed cookie</b>.',[20,3]);
10832
10833
order=7001;
10834
new Game.Achievement('Centennial and a half','Have at least <b>150 of everything</b>.',[7,6]);
10835
10836
order=11000;
10837
new Game.Achievement('Tiny cookie','Click the tiny cookie.<q>These aren\'t the cookies<br>you\'re clicking for.</q>',[0,5]);
10838
10839
order=400000;
10840
new Game.Achievement('You win a cookie','This is for baking 10 trillion cookies and making it on the local news.<q>We\'re all so proud of you.</q>',[10,0]);
10841
10842
order=1070;
10843
Game.ProductionAchievement('Click delegator','Cursor',1,0,7);
10844
order=1120;
10845
Game.ProductionAchievement('Gushing grannies','Grandma',1,0,6);
10846
order=1220;
10847
Game.ProductionAchievement('I hate manure','Farm',1);
10848
order=1320;
10849
Game.ProductionAchievement('Never dig down','Mine',1);
10850
order=1420;
10851
Game.ProductionAchievement('The incredible machine','Factory',1);
10852
order=1520;
10853
Game.ProductionAchievement('And beyond','Shipment',1);
10854
order=1620;
10855
Game.ProductionAchievement('Magnum Opus','Alchemy lab',1);
10856
order=1720;
10857
Game.ProductionAchievement('With strange eons','Portal',1);
10858
order=1820;
10859
Game.ProductionAchievement('Spacetime jigamaroo','Time machine',1);
10860
order=1920;
10861
Game.ProductionAchievement('Supermassive','Antimatter condenser',1);
10862
order=2020;
10863
Game.ProductionAchievement('Praise the sun','Prism',1);
10864
10865
10866
order=1000;
10867
new Game.Achievement('Clickageddon','Make <b>10,000,000,000,000</b> cookies from clicking.',[11,15]);
10868
new Game.Achievement('Clicknarok','Make <b>1,000,000,000,000,000</b> cookies from clicking.',[11,16]);
10869
10870
order=1050;
10871
new Game.Achievement('Extreme polydactyly','Have <b>300</b> cursors.',[0,13]);
10872
new Game.Achievement('Dr. T','Have <b>400</b> cursors.',[0,14]);
10873
10874
order=1100;Game.TieredAchievement('The old never bothered me anyway','Have <b>250</b> grandmas.','Grandma',6);
10875
order=1200;Game.TieredAchievement('Homegrown','Have <b>200</b> farms.','Farm',5);
10876
order=1400;Game.TieredAchievement('Technocracy','Have <b>200</b> factories.','Factory',5);
10877
order=1300;Game.TieredAchievement('The center of the Earth','Have <b>200</b> mines.','Mine',5);
10878
order=1500;Game.TieredAchievement('We come in peace','Have <b>200</b> shipments.','Shipment',5);
10879
order=1600;Game.TieredAchievement('The secrets of the universe','Have <b>200</b> alchemy labs.','Alchemy lab',5);
10880
order=1700;Game.TieredAchievement('Realm of the Mad God','Have <b>200</b> portals.','Portal',5);
10881
order=1800;Game.TieredAchievement('Forever and ever','Have <b>200</b> time machines.','Time machine',5);
10882
order=1900;Game.TieredAchievement('Walk the planck','Have <b>200</b> antimatter condensers.','Antimatter condenser',5);
10883
order=2000;Game.TieredAchievement('Rise and shine','Have <b>200</b> prisms.','Prism',5);
10884
10885
order=30200;
10886
new Game.Achievement('God complex','Name yourself <b>Orteil</b>.<div class="warning">Note : usurpers incur a -1% CpS penalty until they rename themselves something else.</div><q>But that\'s not you, is it?</q>',[17,5]);Game.last.pool='shadow';
10887
new Game.Achievement('Third-party','Use an <b>add-on</b>.<q>Some find vanilla to be the most boring flavor.</q>',[16,5]);Game.last.pool='shadow';//if you're making a mod, add a Game.Win('Third-party') somewhere in there!
10888
10889
order=30050;
10890
new Game.Achievement('Dematerialize','Ascend with <b>1 quintillion</b> cookies baked.<q>Presto!<br>...where\'d the cookies go?</q>',[11,7]);
10891
new Game.Achievement('Nil zero zilch','Ascend with <b>1 sextillion</b> cookies baked.<q>To summarize : really not very much at all.</q>',[11,7]);
10892
new Game.Achievement('Transcendence','Ascend with <b>1 septillion</b> cookies baked.<q>Your cookies are now on a higher plane of being.</q>',[11,8]);
10893
new Game.Achievement('Obliterate','Ascend with <b>1 octillion</b> cookies baked.<q>Resistance is futile, albeit entertaining.</q>',[11,8]);
10894
new Game.Achievement('Negative void','Ascend with <b>1 nonillion</b> cookies baked.<q>You now have so few cookies that it\'s almost like you have a negative amount of them.</q>',[11,8]);
10895
10896
order=22400;
10897
new Game.Achievement('The hunt is on','Unlock <b>1 egg</b>.',[1,12]);
10898
new Game.Achievement('Egging on','Unlock <b>7 eggs</b>.',[4,12]);
10899
new Game.Achievement('Mass Easteria','Unlock <b>14 eggs</b>.',[7,12]);
10900
new Game.Achievement('Hide & seek champion','Unlock <b>all the eggs</b>.<div class="line"></div>Owning this achievement makes eggs drop more frequently in future playthroughs.',[13,12]);
10901
10902
order=11000;
10903
new Game.Achievement('What\'s in a name','Give your bakery a name.',[15,9]);
10904
10905
10906
order=1425;
10907
Game.TieredAchievement('Pretty penny','Have <b>1</b> bank.','Bank',1);
10908
Game.TieredAchievement('Fit the bill','Have <b>50</b> banks.','Bank',2);
10909
Game.TieredAchievement('A loan in the dark','Have <b>100</b> banks.','Bank',3);
10910
Game.TieredAchievement('Need for greed','Have <b>150</b> banks.','Bank',4);
10911
Game.TieredAchievement('It\'s the economy, stupid','Have <b>200</b> banks.','Bank',5);
10912
order=1450;
10913
Game.TieredAchievement('Your time to shrine','Have <b>1</b> temple.','Temple',1);
10914
Game.TieredAchievement('Shady sect','Have <b>50</b> temples.','Temple',2);
10915
Game.TieredAchievement('New-age cult','Have <b>100</b> temples.','Temple',3);
10916
Game.TieredAchievement('Organized religion','Have <b>150</b> temples.','Temple',4);
10917
Game.TieredAchievement('Fanaticism','Have <b>200</b> temples.','Temple',5);
10918
order=1475;
10919
Game.TieredAchievement('Bewitched','Have <b>1</b> wizard tower.','Wizard tower',1);
10920
Game.TieredAchievement('The sorcerer\'s apprentice','Have <b>50</b> wizard towers.','Wizard tower',2);
10921
Game.TieredAchievement('Charms and enchantments','Have <b>100</b> wizard towers.','Wizard tower',3);
10922
Game.TieredAchievement('Curses and maledictions','Have <b>150</b> wizard towers.','Wizard tower',4);
10923
Game.TieredAchievement('Magic kingdom','Have <b>200</b> wizard towers.','Wizard tower',5);
10924
10925
order=1445;
10926
Game.ProductionAchievement('Vested interest','Bank',1);
10927
order=1470;
10928
Game.ProductionAchievement('New world order','Temple',1);
10929
order=1495;
10930
Game.ProductionAchievement('Hocus pocus','Wizard tower',1);
10931
10932
10933
10934
order=1070;
10935
Game.ProductionAchievement('Finger clickin\' good','Cursor',2,0,7);
10936
order=1120;
10937
Game.ProductionAchievement('Panic at the bingo','Grandma',2,0,6);
10938
order=1220;
10939
Game.ProductionAchievement('Rake in the dough','Farm',2);
10940
order=1320;
10941
Game.ProductionAchievement('Quarry on','Mine',2);
10942
order=1420;
10943
Game.ProductionAchievement('Yes I love technology','Factory',2);
10944
order=1445;
10945
Game.ProductionAchievement('Paid in full','Bank',2);
10946
order=1470;
10947
Game.ProductionAchievement('Church of Cookiology','Temple',2);
10948
order=1495;
10949
Game.ProductionAchievement('Too many rabbits, not enough hats','Wizard tower',2);
10950
order=1520;
10951
Game.ProductionAchievement('The most precious cargo','Shipment',2);
10952
order=1620;
10953
Game.ProductionAchievement('The Aureate','Alchemy lab',2);
10954
order=1720;
10955
Game.ProductionAchievement('Ever more hideous','Portal',2);
10956
order=1820;
10957
Game.ProductionAchievement('Be kind, rewind','Time machine',2);
10958
order=1920;
10959
Game.ProductionAchievement('Infinitesimal','Antimatter condenser',2);
10960
order=2020;
10961
Game.ProductionAchievement('A still more glorious dawn','Prism',2);
10962
10963
order=30000;
10964
new Game.Achievement('Rebirth','Ascend at least once.',[21,6]);
10965
10966
order=11000;
10967
new Game.Achievement('Here you go','Click this achievement\'s slot.<q>All you had to do was ask.</q>',[1,7]);Game.last.clickFunction=function(){if (!Game.HasAchiev('Here you go')){PlaySound('snd/tick.mp3');Game.Win('Here you go');}};
10968
10969
order=30000;
10970
new Game.Achievement('Resurrection','Ascend <b>10 times</b>.',[21,6]);
10971
new Game.Achievement('Reincarnation','Ascend <b>100 times</b>.',[21,6]);
10972
new Game.Achievement('Endless cycle','Ascend <b>1000 times</b>.<q>Oh hey, it\'s you again.</q>',[2,7]);Game.last.pool='shadow';
10973
10974
10975
10976
order=1100;
10977
Game.TieredAchievement('The agemaster','Have <b>300</b> grandmas.','Grandma',7);
10978
Game.TieredAchievement('To oldly go','Have <b>350</b> grandmas.','Grandma',8);
10979
10980
order=1200;Game.TieredAchievement('Gardener extraordinaire','Have <b>250</b> farms.','Farm',6);
10981
order=1300;Game.TieredAchievement('Tectonic ambassador','Have <b>250</b> mines.','Mine',6);
10982
order=1400;Game.TieredAchievement('Rise of the machines','Have <b>250</b> factories.','Factory',6);
10983
order=1425;Game.TieredAchievement('Acquire currency','Have <b>250</b> banks.','Bank',6);
10984
order=1450;Game.TieredAchievement('Zealotry','Have <b>250</b> temples.','Temple',6);
10985
order=1475;Game.TieredAchievement('The wizarding world','Have <b>250</b> wizard towers.','Wizard tower',6);
10986
order=1500;Game.TieredAchievement('Parsec-masher','Have <b>250</b> shipments.','Shipment',6);
10987
order=1600;Game.TieredAchievement('The work of a lifetime','Have <b>250</b> alchemy labs.','Alchemy lab',6);
10988
order=1700;Game.TieredAchievement('A place lost in time','Have <b>250</b> portals.','Portal',6);
10989
order=1800;Game.TieredAchievement('Heat death','Have <b>250</b> time machines.','Time machine',6);
10990
order=1900;Game.TieredAchievement('Microcosm','Have <b>250</b> antimatter condensers.','Antimatter condenser',6);
10991
order=2000;Game.TieredAchievement('Bright future','Have <b>250</b> prisms.','Prism',6);
10992
10993
order=25000;
10994
new Game.Achievement('Here be dragon','Complete your <b>dragon\'s training</b>.',[21,12]);
10995
10996
Game.BankAchievement('How?');
10997
Game.BankAchievement('The land of milk and cookies');
10998
Game.BankAchievement('He who controls the cookies controls the universe','The milk must flow!');
10999
Game.BankAchievement('Tonight on Hoarders');
11000
Game.BankAchievement('Are you gonna eat all that?');
11001
Game.BankAchievement('We\'re gonna need a bigger bakery');
11002
Game.BankAchievement('In the mouth of madness','A cookie is just what we tell each other it is.');
11003
Game.BankAchievement('Brought to you by the letter <div style="display:inline-block;background:url(img/money.png);width:16px;height:16px;"></div>');
11004
11005
11006
Game.CpsAchievement('A world filled with cookies');
11007
Game.CpsAchievement('When this baby hits '+Beautify(10000000000000*60*60)+' cookies per hour');
11008
Game.CpsAchievement('Fast and delicious');
11009
Game.CpsAchievement('Cookiehertz : a really, really tasty hertz','Tastier than a hertz donut, anyway.');
11010
Game.CpsAchievement('Woops, you solved world hunger');
11011
Game.CpsAchievement('Turbopuns','Mother Nature will be like "slowwwww dowwwwwn".');
11012
Game.CpsAchievement('Faster menner');
11013
Game.CpsAchievement('And yet you\'re still hungry');
11014
Game.CpsAchievement('The Abakening');
11015
Game.CpsAchievement('There\'s really no hard limit to how long these achievement names can be and to be quite honest I\'m rather curious to see how far we can go.<br>Adolphus W. Green (1844–1917) started as the Principal of the Groton School in 1864. By 1865, he became second assistant librarian at the New York Mercantile Library; from 1867 to 1869, he was promoted to full librarian. From 1869 to 1873, he worked for Evarts, Southmayd & Choate, a law firm co-founded by William M. Evarts, Charles Ferdinand Southmayd and Joseph Hodges Choate. He was admitted to the New York State Bar Association in 1873.<br>Anyway, how\'s your day been?');//Game.last.shortName='There\'s really no hard limit to how long these achievement names can be and to be quite honest I\'m [...]';
11016
Game.CpsAchievement('Fast','Wow!');
11017
11018
order=7002;
11019
new Game.Achievement('Bicentennial and a half','Have at least <b>250 of everything</b>.<q>Keep on truckin\'.</q>',[9,6]);
11020
11021
order=11000;
11022
new Game.Achievement('Tabloid addiction','Click on the news ticker <b>50 times</b>.<q>Page 6 : Mad individual clicks on picture of pastry in a futile attempt to escape boredom!<br>Also page 6 : British parliament ate my baby!</q>',[27,7]);
11023
11024
order=1000;
11025
new Game.Achievement('Clickastrophe','Make <b>100,000,000,000,000,000</b> cookies from clicking.',[11,17]);
11026
new Game.Achievement('Clickataclysm','Make <b>10,000,000,000,000,000,000</b> cookies from clicking.',[11,18]);
11027
11028
order=1050;
11029
new Game.Achievement('Thumbs, phalanges, metacarpals','Have <b>500</b> cursors.<q>& KNUCKLES</q>',[0,15]);
11030
11031
order=6002;
11032
new Game.Achievement('Polymath','Own <b>300</b> upgrades and <b>4000</b> buildings.<q>Excellence doesn\'t happen overnight - it usually takes a good couple days.</q>',[29,7]);
11033
11034
order=6005;
11035
new Game.Achievement('The elder scrolls','Own a combined <b>777</b> grandmas and cursors.<q>Let me guess. Someone stole your cookie.</q>',[10,9]);
11036
11037
order=30050;
11038
new Game.Achievement('To crumbs, you say?','Ascend with <b>1 decillion</b> cookies baked.<q>Very well then.</q>',[29,6]);
11039
11040
order=1200;Game.TieredAchievement('Seedy business','Have <b>300</b> farms.','Farm',7);
11041
order=1300;Game.TieredAchievement('Freak fracking','Have <b>300</b> mines.','Mine',7);
11042
order=1400;Game.TieredAchievement('Modern times','Have <b>300</b> factories.','Factory',7);
11043
order=1425;Game.TieredAchievement('The nerve of war','Have <b>300</b> banks.','Bank',7);
11044
order=1450;Game.TieredAchievement('Wololo','Have <b>300</b> temples.','Temple',7);
11045
order=1475;Game.TieredAchievement('And now for my next trick, I\'ll need a volunteer from the audience','Have <b>300</b> wizard towers.','Wizard tower',7);
11046
order=1500;Game.TieredAchievement('It\'s not delivery','Have <b>300</b> shipments.','Shipment',7);
11047
order=1600;Game.TieredAchievement('Gold, Jerry! Gold!','Have <b>300</b> alchemy labs.','Alchemy lab',7);
11048
order=1700;Game.TieredAchievement('Forbidden zone','Have <b>300</b> portals.','Portal',7);
11049
order=1800;Game.TieredAchievement('cookie clicker forever and forever a hundred years cookie clicker, all day long forever, forever a hundred times, over and over cookie clicker adventures dot com','Have <b>300</b> time machines.','Time machine',7);
11050
order=1900;Game.TieredAchievement('Scientists baffled everywhere','Have <b>300</b> antimatter condensers.','Antimatter condenser',7);
11051
order=2000;Game.TieredAchievement('Harmony of the spheres','Have <b>300</b> prisms.','Prism',7);
11052
11053
order=35000;
11054
new Game.Achievement('Last Chance to See','Burst the near-extinct <b>shiny wrinkler</b>.<q>You monster!</q>',[24,12]);Game.last.pool='shadow';
11055
11056
order=10000;
11057
new Game.Achievement('Early bird','Click a golden cookie <b>less than 1 second after it spawns</b>.',[10,14]);
11058
new Game.Achievement('Fading luck','Click a golden cookie <b>less than 1 second before it dies</b>.',[10,14]);
11059
11060
order=22100;
11061
new Game.Achievement('Eldeer','Pop a reindeer <b>during an elder frenzy</b>.',[12,9]);
11062
11063
order=21100;
11064
new Game.Achievement('Dude, sweet','Harvest <b>7 coalescing sugar lumps</b>.',[24,14]);
11065
new Game.Achievement('Sugar rush','Harvest <b>30 coalescing sugar lumps</b>.',[26,14]);
11066
new Game.Achievement('Year\'s worth of cavities','Harvest <b>365 coalescing sugar lumps</b>.<q>My lumps my lumps my lumps.</q>',[29,14]);
11067
new Game.Achievement('Hand-picked','Successfully harvest a coalescing sugar lump before it\'s ripe.',[28,14]);
11068
new Game.Achievement('Sugar sugar','Harvest a <b>bifurcated sugar lump</b>.',[29,15]);
11069
new Game.Achievement('All-natural cane sugar','Harvest a <b>golden sugar lump</b>.',[29,16]);Game.last.pool='shadow';
11070
new Game.Achievement('Sweetmeats','Harvest a <b>meaty sugar lump</b>.',[29,17]);
11071
11072
order=7002;
11073
new Game.Achievement('Tricentennial','Have at least <b>300 of everything</b>.<q>Can\'t stop, won\'t stop. Probably should stop, though.</q>',[29,12]);
11074
11075
Game.CpsAchievement('Knead for speed','How did we not make that one yet?');
11076
Game.CpsAchievement('Well the cookies start coming and they don\'t stop coming','Didn\'t make sense not to click for fun.');
11077
Game.CpsAchievement('I don\'t know if you\'ve noticed but all these icons are very slightly off-center');
11078
Game.CpsAchievement('The proof of the cookie is in the baking','How can you have any cookies if you don\'t bake your dough?');
11079
Game.CpsAchievement('If it\'s worth doing, it\'s worth overdoing');
11080
11081
Game.BankAchievement('The dreams in which I\'m baking are the best I\'ve ever had');
11082
Game.BankAchievement('Set for life');
11083
11084
order=1200;Game.TieredAchievement('You and the beanstalk','Have <b>350</b> farms.','Farm',8);
11085
order=1300;Game.TieredAchievement('Romancing the stone','Have <b>350</b> mines.','Mine',8);
11086
order=1400;Game.TieredAchievement('Ex machina','Have <b>350</b> factories.','Factory',8);
11087
order=1425;Game.TieredAchievement('And I need it now','Have <b>350</b> banks.','Bank',8);
11088
order=1450;Game.TieredAchievement('Pray on the weak','Have <b>350</b> temples.','Temple',8);
11089
order=1475;Game.TieredAchievement('It\'s a kind of magic','Have <b>350</b> wizard towers.','Wizard tower',8);
11090
order=1500;Game.TieredAchievement('Make it so','Have <b>350</b> shipments.','Shipment',8);
11091
order=1600;Game.TieredAchievement('All that glitters is gold','Have <b>350</b> alchemy labs.','Alchemy lab',8);
11092
order=1700;Game.TieredAchievement('H̸̷͓̳̳̯̟͕̟͍͍̣͡ḛ̢̦̰̺̮̝͖͖̘̪͉͘͡ ̠̦͕̤̪̝̥̰̠̫̖̣͙̬͘ͅC̨̦̺̩̲̥͉̭͚̜̻̝̣̼͙̮̯̪o̴̡͇̘͎̞̲͇̦̲͞͡m̸̩̺̝̣̹̱͚̬̥̫̳̼̞̘̯͘ͅẹ͇̺̜́̕͢s̶̙̟̱̥̮̯̰̦͓͇͖͖̝͘͘͞','Have <b>350</b> portals.','Portal',8);
11093
order=1800;Game.TieredAchievement('Way back then','Have <b>350</b> time machines.','Time machine',8);
11094
order=1900;Game.TieredAchievement('Exotic matter','Have <b>350</b> antimatter condensers.','Antimatter condenser',8);
11095
order=2000;Game.TieredAchievement('At the end of the tunnel','Have <b>350</b> prisms.','Prism',8);
11096
11097
11098
11099
order=1070;
11100
Game.ProductionAchievement('Click (starring Adam Sandler)','Cursor',3,0,7);
11101
order=1120;
11102
Game.ProductionAchievement('Frantiquities','Grandma',3,0,6);
11103
order=1220;
11104
Game.ProductionAchievement('Overgrowth','Farm',3);
11105
order=1320;
11106
Game.ProductionAchievement('Sedimentalism','Mine',3);
11107
order=1420;
11108
Game.ProductionAchievement('Labor of love','Factory',3);
11109
order=1445;
11110
Game.ProductionAchievement('Reverse funnel system','Bank',3);
11111
order=1470;
11112
Game.ProductionAchievement('Thus spoke you','Temple',3);
11113
order=1495;
11114
Game.ProductionAchievement('Manafest destiny','Wizard tower',3);
11115
order=1520;
11116
Game.ProductionAchievement('Neither snow nor rain nor heat nor gloom of night','Shipment',3);
11117
order=1620;
11118
Game.ProductionAchievement('I\'ve got the Midas touch','Alchemy lab',3);
11119
order=1720;
11120
Game.ProductionAchievement('Which eternal lie','Portal',3);
11121
order=1820;
11122
Game.ProductionAchievement('D&eacute;j&agrave; vu','Time machine',3);
11123
order=1920;
11124
Game.ProductionAchievement('Powers of Ten','Antimatter condenser',3);
11125
order=2020;
11126
Game.ProductionAchievement('Now the dark days are gone','Prism',3);
11127
11128
order=1070;
11129
new Game.Achievement('Freaky jazz hands','Reach level <b>10</b> cursors.',[0,26]);Game.Objects['Cursor'].levelAchiev10=Game.last;
11130
order=1120;
11131
new Game.Achievement('Methuselah','Reach level <b>10</b> grandmas.',[1,26]);Game.Objects['Grandma'].levelAchiev10=Game.last;
11132
order=1220;
11133
new Game.Achievement('Huge tracts of land','Reach level <b>10</b> farms.',[2,26]);Game.Objects['Farm'].levelAchiev10=Game.last;
11134
order=1320;
11135
new Game.Achievement('D-d-d-d-deeper','Reach level <b>10</b> mines.',[3,26]);Game.Objects['Mine'].levelAchiev10=Game.last;
11136
order=1420;
11137
new Game.Achievement('Patently genius','Reach level <b>10</b> factories.',[4,26]);Game.Objects['Factory'].levelAchiev10=Game.last;
11138
order=1445;
11139
new Game.Achievement('A capital idea','Reach level <b>10</b> banks.',[15,26]);Game.Objects['Bank'].levelAchiev10=Game.last;
11140
order=1470;
11141
new Game.Achievement('It belongs in a bakery','Reach level <b>10</b> temples.',[16,26]);Game.Objects['Temple'].levelAchiev10=Game.last;
11142
order=1495;
11143
new Game.Achievement('Motormouth','Reach level <b>10</b> wizard towers.',[17,26]);Game.Objects['Wizard tower'].levelAchiev10=Game.last;
11144
order=1520;
11145
new Game.Achievement('Been there done that','Reach level <b>10</b> shipments.',[5,26]);Game.Objects['Shipment'].levelAchiev10=Game.last;
11146
order=1620;
11147
new Game.Achievement('Phlogisticated substances','Reach level <b>10</b> alchemy labs.',[6,26]);Game.Objects['Alchemy lab'].levelAchiev10=Game.last;
11148
order=1720;
11149
new Game.Achievement('Bizarro world','Reach level <b>10</b> portals.',[7,26]);Game.Objects['Portal'].levelAchiev10=Game.last;
11150
order=1820;
11151
new Game.Achievement('The long now','Reach level <b>10</b> time machines.',[8,26]);Game.Objects['Time machine'].levelAchiev10=Game.last;
11152
order=1920;
11153
new Game.Achievement('Chubby hadrons','Reach level <b>10</b> antimatter condensers.',[13,26]);Game.Objects['Antimatter condenser'].levelAchiev10=Game.last;
11154
order=2020;
11155
new Game.Achievement('Palettable','Reach level <b>10</b> prisms.',[14,26]);Game.Objects['Prism'].levelAchiev10=Game.last;
11156
11157
order=61470;
11158
order=61495;
11159
new Game.Achievement('Bibbidi-bobbidi-boo','Cast <b>9</b> spells.',[21,11]);
11160
new Game.Achievement('I\'m the wiz','Cast <b>99</b> spells.',[22,11]);
11161
new Game.Achievement('A wizard is you','Cast <b>999</b> spells.<q>I\'m a what?</q>',[29,11]);
11162
11163
order=10000;
11164
new Game.Achievement('Four-leaf cookie','Have <b>4</b> golden cookies simultaneously.<q>Fairly rare, considering cookies don\'t even have leaves.</q>',[27,6]);Game.last.pool='shadow';
11165
11166
order=2100;
11167
Game.TieredAchievement('Lucked out','Have <b>1</b> chancemaker.','Chancemaker',1);
11168
Game.TieredAchievement('What are the odds','Have <b>50</b> chancemakers.','Chancemaker',2);
11169
Game.TieredAchievement('Grandma needs a new pair of shoes','Have <b>100</b> chancemakers.','Chancemaker',3);
11170
Game.TieredAchievement('Million to one shot, doc','Have <b>150</b> chancemakers.','Chancemaker',4);
11171
Game.TieredAchievement('As luck would have it','Have <b>200</b> chancemakers.','Chancemaker',5);
11172
Game.TieredAchievement('Ever in your favor','Have <b>250</b> chancemakers.','Chancemaker',6);
11173
Game.TieredAchievement('Be a lady','Have <b>300</b> chancemakers.','Chancemaker',7);
11174
Game.TieredAchievement('Dicey business','Have <b>350</b> chancemakers.','Chancemaker',8);
11175
11176
order=2120;
11177
Game.ProductionAchievement('Fingers crossed','Chancemaker',1);
11178
Game.ProductionAchievement('Just a statistic','Chancemaker',2);
11179
Game.ProductionAchievement('Murphy\'s wild guess','Chancemaker',3);
11180
11181
new Game.Achievement('Let\'s leaf it at that','Reach level <b>10</b> chancemakers.',[19,26]);Game.Objects['Chancemaker'].levelAchiev10=Game.last;
11182
11183
order=1000;
11184
new Game.Achievement('The ultimate clickdown','Make <b>1,000,000,000,000,000,000,000</b> cookies from clicking.<q>(of ultimate destiny.)</q>',[11,19]);
11185
11186
11187
order=1100;
11188
Game.TieredAchievement('Aged well','Have <b>400</b> grandmas.','Grandma',9);
11189
Game.TieredAchievement('101st birthday','Have <b>450</b> grandmas.','Grandma',10);
11190
Game.TieredAchievement('Defense of the ancients','Have <b>500</b> grandmas.','Grandma',11);
11191
order=1200;Game.TieredAchievement('Harvest moon','Have <b>400</b> farms.','Farm',9);
11192
order=1300;Game.TieredAchievement('Mine?','Have <b>400</b> mines.','Mine',9);
11193
order=1400;Game.TieredAchievement('In full gear','Have <b>400</b> factories.','Factory',9);
11194
order=1425;Game.TieredAchievement('Treacle tart economics','Have <b>400</b> banks.','Bank',9);
11195
order=1450;Game.TieredAchievement('Holy cookies, grandma!','Have <b>400</b> temples.','Temple',9);
11196
order=1475;Game.TieredAchievement('The Prestige','Have <b>400</b> wizard towers.<q>(Unrelated to the Cookie Clicker feature of the same name.)</q>','Wizard tower',9);
11197
order=1500;Game.TieredAchievement('That\'s just peanuts to space','Have <b>400</b> shipments.','Shipment',9);
11198
order=1600;Game.TieredAchievement('Worth its weight in lead','Have <b>400</b> alchemy labs.','Alchemy lab',9);
11199
order=1700;Game.TieredAchievement('What happens in the vortex stays in the vortex','Have <b>400</b> portals.','Portal',9);
11200
order=1800;Game.TieredAchievement('Invited to yesterday\'s party','Have <b>400</b> time machines.','Time machine',9);
11201
order=1900;Game.TieredAchievement('Downsizing','Have <b>400</b> antimatter condensers.','Antimatter condenser',9);//the trailer got me really hyped up but i've read some pretty bad reviews. is it watchable ? is it worth seeing ? i don't mind matt damon
11202
order=2000;Game.TieredAchievement('My eyes','Have <b>400</b> prisms.','Prism',9);
11203
order=2100;Game.TieredAchievement('Maybe a chance in hell, actually','Have <b>400</b> chancemakers.','Chancemaker',9);
11204
11205
order=1200;Game.TieredAchievement('Make like a tree','Have <b>450</b> farms.','Farm',10);
11206
order=1300;Game.TieredAchievement('Cave story','Have <b>450</b> mines.','Mine',10);
11207
order=1400;Game.TieredAchievement('In-cog-neato','Have <b>450</b> factories.','Factory',10);
11208
order=1425;Game.TieredAchievement('Save your breath because that\'s all you\'ve got left','Have <b>450</b> banks.','Bank',10);
11209
order=1450;Game.TieredAchievement('Vengeful and almighty','Have <b>450</b> temples.','Temple',10);
11210
order=1475;Game.TieredAchievement('Spell it out for you','Have <b>450</b> wizard towers.','Wizard tower',10);
11211
order=1500;Game.TieredAchievement('Space space space space space','Have <b>450</b> shipments.<q>It\'s too far away...</q>','Shipment',10);
11212
order=1600;Game.TieredAchievement('Don\'t get used to yourself, you\'re gonna have to change','Have <b>450</b> alchemy labs.','Alchemy lab',10);
11213
order=1700;Game.TieredAchievement('Objects in the mirror dimension are closer than they appear','Have <b>450</b> portals.','Portal',10);
11214
order=1800;Game.TieredAchievement('Groundhog day','Have <b>450</b> time machines.','Time machine',10);
11215
order=1900;Game.TieredAchievement('A matter of perspective','Have <b>450</b> antimatter condensers.','Antimatter condenser',10);
11216
order=2000;Game.TieredAchievement('Optical illusion','Have <b>450</b> prisms.','Prism',10);
11217
order=2100;Game.TieredAchievement('Jackpot','Have <b>450</b> chancemakers.','Chancemaker',10);
11218
11219
order=36000;
11220
new Game.Achievement('So much to do so much to see','Manage a cookie legacy for <b>at least a year</b>.<q>Thank you so much for playing Cookie Clicker!</q>',[23,11]);Game.last.pool='shadow';
11221
11222
11223
11224
Game.CpsAchievement('Running with scissors');
11225
Game.CpsAchievement('Rarefied air');
11226
Game.CpsAchievement('Push it to the limit');
11227
Game.CpsAchievement('Green cookies sleep furiously');
11228
11229
Game.BankAchievement('Panic! at Nabisco');
11230
Game.BankAchievement('Bursting at the seams');
11231
Game.BankAchievement('Just about full');
11232
Game.BankAchievement('Hungry for more');
11233
11234
order=1000;
11235
new Game.Achievement('All the other kids with the pumped up clicks','Make <b>100,000,000,000,000,000,000,000</b> cookies from clicking.',[11,28]);
11236
new Game.Achievement('One...more...click...','Make <b>10,000,000,000,000,000,000,000,000</b> cookies from clicking.',[11,30]);
11237
11238
order=61515;
11239
new Game.Achievement('Botany enthusiast','Harvest <b>100</b> mature garden plants.',[26,20]);
11240
new Game.Achievement('Green, aching thumb','Harvest <b>1000</b> mature garden plants.',[27,20]);
11241
new Game.Achievement('In the garden of Eden (baby)','Fill every tile of the biggest garden plot with plants.<q>Isn\'t tending to those precious little plants just so rock and/or roll?</q>',[28,20]);
11242
11243
new Game.Achievement('Keeper of the conservatory','Unlock every garden seed.',[25,20]);
11244
new Game.Achievement('Seedless to nay','Convert a complete seed log into sugar lumps by sacrificing your garden to the sugar hornets.<div class="line"></div>Owning this achievement makes seeds <b>5% cheaper</b>, plants mature <b>5% sooner</b>, and plant upgrades drop <b>5% more</b>.',[29,20]);
11245
11246
order=30050;
11247
new Game.Achievement('You get nothing','Ascend with <b>1 undecillion</b> cookies baked.<q>Good day sir!</q>',[29,6]);
11248
new Game.Achievement('Humble rebeginnings','Ascend with <b>1 duodecillion</b> cookies baked.<q>Started from the bottom, now we\'re here.</q>',[29,6]);
11249
new Game.Achievement('The end of the world','Ascend with <b>1 tredecillion</b> cookies baked.<q>(as we know it)</q>',[21,25]);
11250
new Game.Achievement('Oh, you\'re back','Ascend with <b>1 quattuordecillion</b> cookies baked.<q>Missed us?</q>',[21,25]);
11251
new Game.Achievement('Lazarus','Ascend with <b>1 quindecillion</b> cookies baked.<q>All rise.</q>',[21,25]);
11252
11253
Game.CpsAchievement('Leisurely pace');
11254
Game.CpsAchievement('Hypersonic');
11255
11256
Game.BankAchievement('Feed me, Orteil');
11257
Game.BankAchievement('And then what?');
11258
11259
order=7002;
11260
new Game.Achievement('Tricentennial and a half','Have at least <b>350 of everything</b>.<q>(it\'s free real estate)</q>',[21,26]);
11261
new Game.Achievement('Quadricentennial','Have at least <b>400 of everything</b>.<q>You\'ve had to do horrible things to get this far.<br>Horrible... horrible things.</q>',[22,26]);
11262
new Game.Achievement('Quadricentennial and a half','Have at least <b>450 of everything</b>.<q>At this point, you might just be compensating for something.</q>',[23,26]);
11263
11264
new Game.Achievement('Quincentennial','Have at least <b>500 of everything</b>.<q>Some people would say you\'re halfway there.<br>We do not care for those people and their reckless sense of unchecked optimism.</q>',[29,25]);
11265
11266
order=21100;
11267
new Game.Achievement('Maillard reaction','Harvest a <b>caramelized sugar lump</b>.',[29,27]);
11268
11269
order=30250;
11270
new Game.Achievement('When the cookies ascend just right','Ascend with exactly <b>1,000,000,000,000 cookies</b>.',[25,7]);Game.last.pool='shadow';//this achievement is shadow because it is only achievable through blind luck or reading external guides; this may change in the future
11271
11272
11273
order=1050;
11274
new Game.Achievement('With her finger and her thumb','Have <b>600</b> cursors.',[0,16]);
11275
11276
order=1100;Game.TieredAchievement('But wait \'til you get older','Have <b>550</b> grandmas.','Grandma',12);
11277
order=1200;Game.TieredAchievement('Sharpest tool in the shed','Have <b>500</b> farms.','Farm',11);
11278
order=1300;Game.TieredAchievement('Hey now, you\'re a rock','Have <b>500</b> mines.','Mine',11);
11279
order=1400;Game.TieredAchievement('Break the mold','Have <b>500</b> factories.','Factory',11);
11280
order=1425;Game.TieredAchievement('Get the show on, get paid','Have <b>500</b> banks.','Bank',11);
11281
order=1450;Game.TieredAchievement('My world\'s on fire, how about yours','Have <b>500</b> temples.','Temple',11);
11282
order=1475;Game.TieredAchievement('The meteor men beg to differ','Have <b>500</b> wizard towers.','Wizard tower',11);
11283
order=1500;Game.TieredAchievement('Only shooting stars','Have <b>500</b> shipments.','Shipment',11);
11284
order=1600;Game.TieredAchievement('We could all use a little change','Have <b>500</b> alchemy labs.','Alchemy lab',11);//"all that glitters is gold" was already an achievement
11285
order=1700;Game.TieredAchievement('Your brain gets smart but your head gets dumb','Have <b>500</b> portals.','Portal',11);
11286
order=1800;Game.TieredAchievement('The years start coming','Have <b>500</b> time machines.','Time machine',11);
11287
order=1900;Game.TieredAchievement('What a concept','Have <b>500</b> antimatter condensers.','Antimatter condenser',11);
11288
order=2000;Game.TieredAchievement('You\'ll never shine if you don\'t glow','Have <b>500</b> prisms.','Prism',11);
11289
order=2100;Game.TieredAchievement('You\'ll never know if you don\'t go','Have <b>500</b> chancemakers.','Chancemaker',11);
11290
11291
order=2200;
11292
Game.TieredAchievement('Self-contained','Have <b>1</b> fractal engine.','Fractal engine',1);
11293
Game.TieredAchievement('Threw you for a loop','Have <b>50</b> fractal engines.','Fractal engine',2);
11294
Game.TieredAchievement('The sum of its parts','Have <b>100</b> fractal engines.','Fractal engine',3);
11295
Game.TieredAchievement('Bears repeating','Have <b>150</b> fractal engines.<q>Where did these come from?</q>','Fractal engine',4);
11296
Game.TieredAchievement('More of the same','Have <b>200</b> fractal engines.','Fractal engine',5);
11297
Game.TieredAchievement('Last recurse','Have <b>250</b> fractal engines.','Fractal engine',6);
11298
Game.TieredAchievement('Out of one, many','Have <b>300</b> fractal engines.','Fractal engine',7);
11299
Game.TieredAchievement('An example of recursion','Have <b>350</b> fractal engines.','Fractal engine',8);
11300
Game.TieredAchievement('For more information on this achievement, please refer to its title','Have <b>400</b> fractal engines.','Fractal engine',9);
11301
Game.TieredAchievement('I\'m so meta, even this achievement','Have <b>450</b> fractal engines.','Fractal engine',10);
11302
Game.TieredAchievement('Never get bored','Have <b>500</b> fractal engines.','Fractal engine',11);
11303
11304
order=2220;
11305
Game.ProductionAchievement('The needs of the many','Fractal engine',1);
11306
Game.ProductionAchievement('Eating its own','Fractal engine',2);
11307
Game.ProductionAchievement('We must go deeper','Fractal engine',3);
11308
11309
new Game.Achievement('Sierpinski rhomboids','Reach level <b>10</b> fractal engines.',[20,26]);Game.Objects['Fractal engine'].levelAchiev10=Game.last;
11310
11311
Game.CpsAchievement('Gotta go fast');
11312
Game.BankAchievement('I think it\'s safe to say you\'ve got it made');
11313
11314
order=6002;
11315
new Game.Achievement('Renaissance baker','Own <b>400</b> upgrades and <b>8000</b> buildings.<q>If you have seen further, it is by standing on the shoulders of giants - a mysterious species of towering humanoids until now thought long-extinct.</q>',[10,10]);
11316
11317
order=1150;
11318
new Game.Achievement('Veteran','Own at least <b>14</b> grandma types.<q>14\'s a crowd!</q>',[10,9]);
11319
11320
order=10000;
11321
new Game.Achievement('Thick-skinned','Have your <b>reinforced membrane</b> protect the <b>shimmering veil</b>.',[7,10]);
11322
11323
11324
order=2300;
11325
Game.TieredAchievement('F12','Have <b>1</b> javascript console.','Javascript console',1);
11326
Game.TieredAchievement('Variable success','Have <b>50</b> javascript consoles.','Javascript console',2);
11327
Game.TieredAchievement('No comments','Have <b>100</b> javascript consoles.','Javascript console',3);
11328
Game.TieredAchievement('Up to code','Have <b>150</b> javascript consoles.','Javascript console',4);
11329
Game.TieredAchievement('Works on my machine','Have <b>200</b> javascript consoles.','Javascript console',5);
11330
Game.TieredAchievement('Technical debt','Have <b>250</b> javascript consoles.','Javascript console',6);
11331
Game.TieredAchievement('Mind your language','Have <b>300</b> javascript consoles.','Javascript console',7);
11332
Game.TieredAchievement('Inconsolable','Have <b>350</b> javascript consoles.','Javascript console',8);
11333
Game.TieredAchievement('Closure','Have <b>400</b> javascript consoles.','Javascript console',9);
11334
Game.TieredAchievement('Dude what if we\'re all living in a simulation like what if we\'re all just code on a computer somewhere','Have <b>450</b> javascript consoles.','Javascript console',10);
11335
Game.TieredAchievement('Taking the back streets','Have <b>500</b> javascript consoles.','Javascript console',11);
11336
11337
order=2320;
11338
Game.ProductionAchievement('Inherited prototype','Javascript console',1);
11339
Game.ProductionAchievement('A model of document object','Javascript console',2);
11340
Game.ProductionAchievement('First-class citizen','Javascript console',3);
11341
11342
new Game.Achievement('Alexandria','Reach level <b>10</b> javascript consoles.',[32,26]);Game.Objects['Javascript console'].levelAchiev10=Game.last;
11343
11344
Game.CpsAchievement('Bake him away, toys');
11345
Game.CpsAchievement('You\'re #1 so why try harder');
11346
Game.CpsAchievement('Haven\'t even begun to peak');
11347
Game.BankAchievement('A sometimes food');
11348
Game.BankAchievement('Not enough of a good thing');
11349
Game.BankAchievement('Horn of plenty');
11350
11351
order=30050;
11352
new Game.Achievement('Smurf account','Ascend with <b>1 sexdecillion</b> cookies baked.<q>It\'s like you just appeared out of the blue!</q>',[21,32]);
11353
new Game.Achievement('If at first you don\'t succeed','Ascend with <b>1 septendecillion</b> cookies baked.<q>If at first you don\'t succeed, try, try, try again.<br>But isn\'t that the definition of insanity?</q>',[21,32]);
11354
11355
order=33000;
11356
new Game.Achievement('O Fortuna','Own every <b>fortune upgrade</b>.<div class="line"></div>Owning this achievement makes fortunes appear <b>twice as often</b>; unlocked fortune upgrades also have a <b>40% chance</b> to carry over after ascending.',[29,8]);
11357
11358
order=61615;
11359
new Game.Achievement('Initial public offering','Make your first stock market profit.',[0,33]);
11360
new Game.Achievement('Rookie numbers','Own at least <b>100</b> of every stock market good.<q>Gotta pump those numbers up!</q>',[9,33]);
11361
new Game.Achievement('No nobility in poverty','Own at least <b>500</b> of every stock market good.<q>What kind of twisted individual is out there cramming camels through needle holes anyway?</q>',[10,33]);
11362
new Game.Achievement('Full warehouses','Own at least <b>1,000</b> of a stock market good.',[11,33]);
11363
new Game.Achievement('Make my day','Make <b>a day</b> of CpS ($86,400) in 1 stock market sale.',[1,33]);
11364
new Game.Achievement('Buy buy buy','Spend <b>a day</b> of CpS ($86,400) in 1 stock market purchase.',[1,33]);
11365
new Game.Achievement('Gaseous assets','Have your stock market profits surpass <b>a whole year</b> of CpS ($31,536,000).<q>Boy, how volatile!</q>',[18,33]);Game.last.pool='shadow';
11366
new Game.Achievement('Pyramid scheme','Unlock the <b>highest-tier</b> stock market headquarters.',[18,33]);
11367
11368
order=10000;
11369
new Game.Achievement('Jellicles','Own <b>10</b> kitten upgrades.<q>Jellicles can and jellicles do! Make sure to wash your jellicles every day!</q>',[18,19]);
11370
11371
order=7002;
11372
new Game.Achievement('Quincentennial and a half','Have at least <b>550 of everything</b>.<q>This won\'t fill the churning void inside, you know.</q>',[29,26]);
11373
11374
Game.CpsAchievement('What did we even eat before these');
11375
Game.CpsAchievement('Heavy flow');
11376
Game.CpsAchievement('More you say?');
11377
Game.BankAchievement('Large and in charge');
11378
Game.BankAchievement('Absolutely stuffed');
11379
Game.BankAchievement('It\'s only wafer-thin','Just the one!');
11380
11381
order=1000;new Game.Achievement('Clickety split','Make <b>1,000,000,000,000,000,000,000,000,000</b> cookies from clicking.',[11,31]);
11382
order=1050;new Game.Achievement('Gotta hand it to you','Have <b>700</b> cursors.',[0,17]);
11383
order=1100;Game.TieredAchievement('Okay boomer','Have <b>600</b> grandmas.','Grandma',13);
11384
order=1200;Game.TieredAchievement('Overripe','Have <b>550</b> farms.','Farm',12);
11385
order=1300;Game.TieredAchievement('Rock on','Have <b>550</b> mines.','Mine',12);
11386
order=1400;Game.TieredAchievement('Self-manmade man','Have <b>550</b> factories.','Factory',12);
11387
order=1425;Game.TieredAchievement('Checks out','Have <b>550</b> banks.','Bank',12);
11388
order=1450;Game.TieredAchievement('Living on a prayer','Have <b>550</b> temples.','Temple',12);
11389
order=1475;Game.TieredAchievement('Higitus figitus migitus mum','Have <b>550</b> wizard towers.','Wizard tower',12);
11390
order=1500;Game.TieredAchievement('The incredible journey','Have <b>550</b> shipments.','Shipment',12);
11391
order=1600;Game.TieredAchievement('Just a phase','Have <b>550</b> alchemy labs.','Alchemy lab',12);
11392
order=1700;Game.TieredAchievement('Don\'t let me leave, Murph','Have <b>550</b> portals.','Portal',12);
11393
order=1800;Game.TieredAchievement('Caveman to cosmos','Have <b>550</b> time machines.','Time machine',12);
11394
order=1900;Game.TieredAchievement('Particular tastes','Have <b>550</b> antimatter condensers.','Antimatter condenser',12);
11395
order=2000;Game.TieredAchievement('A light snack','Have <b>550</b> prisms.','Prism',12);
11396
order=2100;Game.TieredAchievement('Tempting fate','Have <b>550</b> chancemakers.','Chancemaker',12);
11397
order=2200;Game.TieredAchievement('Tautological','Have <b>550</b> fractal engines.','Fractal engine',12);
11398
order=2300;Game.TieredAchievement('Curly braces','Have <b>550</b> javascript consoles.<q>Or as the French call them, mustache boxes.<br>Go well with quotes.</q>','Javascript console',12);
11399
11400
order=10000;
11401
new Game.Achievement('Seven horseshoes','Click <b>27777 golden cookies</b>.<q>Enough for one of those funky horses that graze near your factories.</q>',[21,33]);Game.last.pool='shadow';
11402
11403
order=11000;
11404
new Game.Achievement('Olden days','Find the <b>forgotten madeleine</b>.<q>DashNet Farms remembers.</q>',[12,3]);
11405
11406
11407
order=1050;new Game.Achievement('The devil\'s workshop','Have <b>800</b> cursors.',[0,18]);
11408
order=1200;Game.TieredAchievement('In the green','Have <b>600</b> farms.','Farm',13);
11409
order=1300;Game.TieredAchievement('Mountain out of a molehill, but like in a good way','Have <b>600</b> mines.','Mine',13);
11410
order=1400;Game.TieredAchievement('The wheels of progress','Have <b>600</b> factories.','Factory',13);
11411
order=1425;Game.TieredAchievement('That\'s rich','Have <b>600</b> banks.','Bank',13);
11412
order=1450;Game.TieredAchievement('Preaches and cream','Have <b>600</b> temples.','Temple',13);
11413
order=1475;Game.TieredAchievement('Magic thinking','Have <b>600</b> wizard towers.','Wizard tower',13);
11414
order=1500;Game.TieredAchievement('Is there life on Mars?','Have <b>600</b> shipments.<q>Yes, there is. You\'re currently using it as filling in experimental flavor prototype #810657.</q>','Shipment',13);
11415
order=1600;Game.TieredAchievement('Bad chemistry','Have <b>600</b> alchemy labs.','Alchemy lab',13);
11416
order=1700;Game.TieredAchievement('Reduced to gibbering heaps','Have <b>600</b> portals.','Portal',13);
11417
order=1800;Game.TieredAchievement('Back already?','Have <b>600</b> time machines.','Time machine',13);
11418
order=1900;Game.TieredAchievement('Nuclear throne','Have <b>600</b> antimatter condensers.','Antimatter condenser',13);
11419
order=2000;Game.TieredAchievement('Making light of the situation','Have <b>600</b> prisms.','Prism',13);
11420
order=2100;Game.TieredAchievement('Flip a cookie. Chips, I win. Crust, you lose.','Have <b>600</b> chancemakers.','Chancemaker',13);
11421
order=2200;Game.TieredAchievement('In and of itself','Have <b>600</b> fractal engines.','Fractal engine',13);
11422
order=2300;Game.TieredAchievement('Duck typing','Have <b>600</b> javascript consoles.<q>Hello, this is a duck typing. Got any grapes?</q>','Javascript console',13);
11423
11424
order=2400;
11425
Game.TieredAchievement('They\'ll never know what hit \'em','Have <b>1</b> idleverse.','Idleverse',1);
11426
Game.TieredAchievement('Well-versed','Have <b>50</b> idleverses.','Idleverse',2);
11427
Game.TieredAchievement('Ripe for the picking','Have <b>100</b> idleverses.','Idleverse',3);
11428
Game.TieredAchievement('Unreal','Have <b>150</b> idleverses.','Idleverse',4);
11429
Game.TieredAchievement('Once you\'ve seen one','Have <b>200</b> idleverses.','Idleverse',5);
11430
Game.TieredAchievement('Spoils and plunder','Have <b>250</b> idleverses.','Idleverse',6);
11431
Game.TieredAchievement('Nobody exists on purpose, nobody belongs anywhere','Have <b>300</b> idleverses.<q>Come watch TV?</q>','Idleverse',7);
11432
Game.TieredAchievement('Hyperspace expressway','Have <b>350</b> idleverses.','Idleverse',8);
11433
Game.TieredAchievement('Versatile','Have <b>400</b> idleverses.','Idleverse',9);
11434
Game.TieredAchievement('You are inevitable','Have <b>450</b> idleverses.','Idleverse',10);
11435
Game.TieredAchievement('Away from this place','Have <b>500</b> idleverses.','Idleverse',11);
11436
Game.TieredAchievement('Everywhere at once','Have <b>550</b> idleverses.','Idleverse',12);
11437
Game.TieredAchievement('Reject reality, substitute your own','Have <b>600</b> idleverses.','Idleverse',13);
11438
11439
order=2420;
11440
Game.ProductionAchievement('Fringe','Idleverse',1);
11441
Game.ProductionAchievement('Coherence','Idleverse',2);
11442
Game.ProductionAchievement('Earth-616','Idleverse',3);
11443
11444
new Game.Achievement('Strange topologies','Reach level <b>10</b> idleverses.',[33,26]);Game.Objects['Idleverse'].levelAchiev10=Game.last;
11445
11446
order=5000;
11447
new Game.Achievement('Grand design','Own <b>4000</b> buildings.<q>They\'ll remember you forever!</q>',[32,12]);
11448
new Game.Achievement('Ecumenopolis','Own <b>8000</b> buildings.<q>Getting a wee bit cramped.</q>',[33,12]);
11449
11450
order=6000;
11451
new Game.Achievement('The full picture','Purchase <b>300</b> upgrades.<q>So that\'s where that fits in!</q>',[32,11]);
11452
new Game.Achievement('When there\'s nothing left to add','Purchase <b>400</b> upgrades.<q>...keep going.</q>',[33,11]);
11453
11454
order=7002;
11455
new Game.Achievement('Sexcentennial','Have at least <b>600 of everything</b>.<q>Hey, nice milestone!</q>',[31,33]);
11456
11457
Game.CpsAchievement('Keep going until I say stop');
11458
Game.CpsAchievement('But I didn\'t say stop, did I?');
11459
Game.CpsAchievement('With unrivaled fervor');
11460
Game.BankAchievement('Think big');
11461
Game.BankAchievement('Hypersize me');
11462
Game.BankAchievement('Max capacity');
11463
11464
order=61616;
11465
new Game.Achievement('Liquid assets','Have your stock market profits surpass <b>$10,000,000</b>.',[12,33]);
11466
11467
//end of achievements
11468
11469
/*=====================================================================================
11470
BUFFS
11471
=======================================================================================*/
11472
11473
Game.buffs={};//buffs currently in effect by name
11474
Game.buffsI=0;
11475
Game.buffsL=l('buffs');
11476
Game.gainBuff=function(type,time,arg1,arg2,arg3)
11477
{
11478
type=Game.buffTypesByName[type];
11479
var obj=type.func(time,arg1,arg2,arg3);
11480
obj.type=type;
11481
obj.arg1=arg1;
11482
obj.arg2=arg2;
11483
obj.arg3=arg3;
11484
11485
var buff={
11486
visible:true,
11487
time:0,
11488
name:'???',
11489
desc:'',
11490
icon:[0,0]
11491
};
11492
if (Game.buffs[obj.name])//if there is already a buff in effect with this name
11493
{
11494
var buff=Game.buffs[obj.name];
11495
if (obj.max) buff.time=Math.max(obj.time,buff.time);//new duration is max of old and new
11496
if (obj.add) buff.time+=obj.time;//new duration is old + new
11497
if (!obj.max && !obj.add) buff.time=obj.time;//new duration is set to new
11498
buff.maxTime=buff.time;
11499
}
11500
else//create new buff
11501
{
11502
for (var i in obj)//paste parameters onto buff
11503
{buff[i]=obj[i];}
11504
buff.maxTime=buff.time;
11505
Game.buffs[buff.name]=buff;
11506
buff.id=Game.buffsI;
11507
11508
//create dom
11509
Game.buffsL.innerHTML=Game.buffsL.innerHTML+'<div id="buff'+buff.id+'" class="crate enabled buff" '+(buff.desc?Game.getTooltip(
11510
'<div class="prompt" style="min-width:200px;text-align:center;font-size:11px;margin:8px 0px;"><h3>'+buff.name+'</h3><div class="line"></div>'+buff.desc+'</div>'
11511
,'left',true):'')+' style="opacity:1;float:none;display:block;'+(buff.icon[2]?'background-image:url('+buff.icon[2]+');':'')+'background-position:'+(-buff.icon[0]*48)+'px '+(-buff.icon[1]*48)+'px;"></div>';
11512
11513
buff.l=l('buff'+buff.id);
11514
11515
Game.buffsI++;
11516
}
11517
Game.recalculateGains=1;
11518
Game.storeToRefresh=1;
11519
return buff;
11520
}
11521
Game.hasBuff=function(what)//returns 0 if there is no buff in effect with this name; else, returns it
11522
{if (!Game.buffs[what]) return 0; else return Game.buffs[what];}
11523
Game.updateBuffs=function()//executed every logic frame
11524
{
11525
for (var i in Game.buffs)
11526
{
11527
var buff=Game.buffs[i];
11528
11529
if (buff.time>=0)
11530
{
11531
if (!l('buffPieTimer'+buff.id)) l('buff'+buff.id).innerHTML=l('buff'+buff.id).innerHTML+'<div class="pieTimer" id="buffPieTimer'+buff.id+'"></div>';
11532
var T=1-(buff.time/buff.maxTime);
11533
T=(T*144)%144;
11534
l('buffPieTimer'+buff.id).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';
11535
}
11536
buff.time--;
11537
if (buff.time<=0)
11538
{
11539
if (Game.onCrate==l('buff'+buff.id)) Game.tooltip.hide();
11540
if (buff.onDie) buff.onDie();
11541
Game.buffsL.removeChild(l('buff'+buff.id));
11542
if (Game.buffs[buff.name])
11543
{
11544
Game.buffs[buff.name]=0;
11545
delete Game.buffs[buff.name];
11546
}
11547
Game.recalculateGains=1;
11548
Game.storeToRefresh=1;
11549
}
11550
}
11551
}
11552
Game.killBuff=function(what)//remove a buff by name
11553
{if (Game.buffs[what]){Game.buffs[what].time=0;/*Game.buffs[what]=0;*/}}
11554
Game.killBuffs=function()//remove all buffs
11555
{Game.buffsL.innerHTML='';Game.buffs={};Game.recalculateGains=1;Game.storeToRefresh=1;}
11556
11557
11558
Game.buffTypes=[];//buff archetypes; only buffs declared from these can be saved and loaded
11559
Game.buffTypesByName=[];
11560
Game.buffTypesN=0;
11561
Game.buffType=function(name,func)
11562
{
11563
this.name=name;
11564
this.func=func;//this is a function that returns a buff object; it takes a "time" argument in seconds, and 3 more optional arguments at most, which will be saved and loaded as floats
11565
this.id=Game.buffTypesN;
11566
this.vanilla=Game.vanilla;
11567
Game.buffTypesByName[this.name]=this;
11568
Game.buffTypes[Game.buffTypesN]=this;
11569
Game.buffTypesN++;
11570
}
11571
11572
/*
11573
basic buff parameters :
11574
name:'Kitten rain',
11575
desc:'It\'s raining kittens!',
11576
icon:[0,0],
11577
time:30*Game.fps
11578
other parameters :
11579
visible:false - will hide the buff from the buff list
11580
add:true - if this buff already exists, add the new duration to the old one
11581
max:true - if this buff already exists, set the new duration to the max of either
11582
onDie:function(){} - function will execute when the buff runs out
11583
power:3 - used by some buffs
11584
multCpS:3 - buff multiplies CpS by this amount
11585
multClick:3 - buff multiplies click power by this amount
11586
*/
11587
11588
//base buffs
11589
new Game.buffType('frenzy',function(time,pow)
11590
{
11591
return {
11592
name:'Frenzy',
11593
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11594
icon:[10,14],
11595
time:time*Game.fps,
11596
add:true,
11597
multCpS:pow,
11598
aura:1
11599
};
11600
});
11601
new Game.buffType('blood frenzy',function(time,pow)
11602
{
11603
return {
11604
name:'Elder frenzy',
11605
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11606
icon:[29,6],
11607
time:time*Game.fps,
11608
add:true,
11609
multCpS:pow,
11610
aura:1
11611
};
11612
});
11613
new Game.buffType('clot',function(time,pow)
11614
{
11615
return {
11616
name:'Clot',
11617
desc:'Cookie production halved for '+Game.sayTime(time*Game.fps,-1)+'!',
11618
icon:[15,5],
11619
time:time*Game.fps,
11620
add:true,
11621
multCpS:pow,
11622
aura:2
11623
};
11624
});
11625
new Game.buffType('dragon harvest',function(time,pow)
11626
{
11627
if (Game.Has('Dragon fang')) pow=Math.ceil(pow*1.1);
11628
return {
11629
name:'Dragon Harvest',
11630
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11631
icon:[10,25],
11632
time:time*Game.fps,
11633
add:true,
11634
multCpS:pow,
11635
aura:1
11636
};
11637
});
11638
new Game.buffType('everything must go',function(time,pow)
11639
{
11640
return {
11641
name:'Everything must go',
11642
desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
11643
icon:[17,6],
11644
time:time*Game.fps,
11645
add:true,
11646
power:pow,
11647
aura:1
11648
};
11649
});
11650
new Game.buffType('cursed finger',function(time,pow)
11651
{
11652
return {
11653
name:'Cursed finger',
11654
desc:'Cookie production halted for '+Game.sayTime(time*Game.fps,-1)+',<br>but each click is worth '+Game.sayTime(time*Game.fps,-1)+' of CpS.',
11655
icon:[12,17],
11656
time:time*Game.fps,
11657
add:true,
11658
power:pow,
11659
multCpS:0,
11660
aura:1
11661
};
11662
});
11663
new Game.buffType('click frenzy',function(time,pow)
11664
{
11665
return {
11666
name:'Click frenzy',
11667
desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11668
icon:[0,14],
11669
time:time*Game.fps,
11670
add:true,
11671
multClick:pow,
11672
aura:1
11673
};
11674
});
11675
new Game.buffType('dragonflight',function(time,pow)
11676
{
11677
if (Game.Has('Dragon fang')) pow=Math.ceil(pow*1.1);
11678
return {
11679
name:'Dragonflight',
11680
desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11681
icon:[0,25],
11682
time:time*Game.fps,
11683
add:true,
11684
multClick:pow,
11685
aura:1
11686
};
11687
});
11688
new Game.buffType('cookie storm',function(time,pow)
11689
{
11690
return {
11691
name:'Cookie storm',
11692
desc:'Cookies everywhere!',
11693
icon:[22,6],
11694
time:time*Game.fps,
11695
add:true,
11696
power:pow,
11697
aura:1
11698
};
11699
});
11700
new Game.buffType('building buff',function(time,pow,building)
11701
{
11702
var obj=Game.ObjectsById[building];
11703
return {
11704
name:Game.goldenCookieBuildingBuffs[obj.name][0],
11705
desc:'Your '+Beautify(obj.amount)+' '+obj.plural+' are boosting your CpS!<br>Cookie production +'+(Math.ceil(pow*100-100))+'% for '+Game.sayTime(time*Game.fps,-1)+'!',
11706
icon:[obj.iconColumn,14],
11707
time:time*Game.fps,
11708
add:true,
11709
multCpS:pow,
11710
aura:1
11711
};
11712
});
11713
new Game.buffType('building debuff',function(time,pow,building)
11714
{
11715
var obj=Game.ObjectsById[building];
11716
return {
11717
name:Game.goldenCookieBuildingBuffs[obj.name][1],
11718
desc:'Your '+Beautify(obj.amount)+' '+obj.plural+' are rusting your CpS!<br>Cookie production '+(Math.ceil(pow*100-100))+'% slower for '+Game.sayTime(time*Game.fps,-1)+'!',
11719
icon:[obj.iconColumn,15],
11720
time:time*Game.fps,
11721
add:true,
11722
multCpS:1/pow,
11723
aura:2
11724
};
11725
});
11726
new Game.buffType('sugar blessing',function(time,pow)
11727
{
11728
return {
11729
name:'Sugar blessing',
11730
desc:'You find 10% more golden cookies for the next '+Game.sayTime(time*Game.fps,-1)+'.',
11731
icon:[29,16],
11732
time:time*Game.fps,
11733
//add:true
11734
};
11735
});
11736
new Game.buffType('haggler luck',function(time,pow)
11737
{
11738
return {
11739
name:'Haggler\'s luck',
11740
desc:'All upgrades are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
11741
icon:[25,11],
11742
time:time*Game.fps,
11743
power:pow,
11744
max:true
11745
};
11746
});
11747
new Game.buffType('haggler misery',function(time,pow)
11748
{
11749
return {
11750
name:'Haggler\'s misery',
11751
desc:'All upgrades are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',
11752
icon:[25,11],
11753
time:time*Game.fps,
11754
power:pow,
11755
max:true
11756
};
11757
});
11758
new Game.buffType('pixie luck',function(time,pow)
11759
{
11760
return {
11761
name:'Crafty pixies',
11762
desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
11763
icon:[26,11],
11764
time:time*Game.fps,
11765
power:pow,
11766
max:true
11767
};
11768
});
11769
new Game.buffType('pixie misery',function(time,pow)
11770
{
11771
return {
11772
name:'Nasty goblins',
11773
desc:'All buildings are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',
11774
icon:[26,11],
11775
time:time*Game.fps,
11776
power:pow,
11777
max:true
11778
};
11779
});
11780
new Game.buffType('magic adept',function(time,pow)
11781
{
11782
return {
11783
name:'Magic adept',
11784
desc:'Spells backfire '+pow+' times less for '+Game.sayTime(time*Game.fps,-1)+'.',
11785
icon:[29,11],
11786
time:time*Game.fps,
11787
power:pow,
11788
max:true
11789
};
11790
});
11791
new Game.buffType('magic inept',function(time,pow)
11792
{
11793
return {
11794
name:'Magic inept',
11795
desc:'Spells backfire '+pow+' times more for '+Game.sayTime(time*Game.fps,-1)+'.',
11796
icon:[29,11],
11797
time:time*Game.fps,
11798
power:pow,
11799
max:true
11800
};
11801
});
11802
new Game.buffType('devastation',function(time,pow)
11803
{
11804
return {
11805
name:'Devastation',
11806
desc:'Clicking power +'+Math.floor(pow*100-100)+'% for '+Game.sayTime(time*Game.fps,-1)+'!',
11807
icon:[23,18],
11808
time:time*Game.fps,
11809
multClick:pow,
11810
aura:1,
11811
max:true
11812
};
11813
});
11814
new Game.buffType('sugar frenzy',function(time,pow)
11815
{
11816
return {
11817
name:'Sugar frenzy',
11818
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11819
icon:[29,14],
11820
time:time*Game.fps,
11821
add:true,
11822
multCpS:pow,
11823
aura:0
11824
};
11825
});
11826
new Game.buffType('loan 1',function(time,pow)
11827
{
11828
return {
11829
name:'Loan 1',
11830
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11831
icon:[1,33],
11832
time:time*Game.fps,
11833
power:pow,
11834
multCpS:pow,
11835
max:true,
11836
onDie:function(){if (Game.takeLoan) {Game.takeLoan(1,true);}},
11837
};
11838
});
11839
new Game.buffType('loan 1 interest',function(time,pow)
11840
{
11841
return {
11842
name:'Loan 1 (interest)',
11843
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11844
icon:[1,33],
11845
time:time*Game.fps,
11846
power:pow,
11847
multCpS:pow,
11848
max:true
11849
};
11850
});
11851
new Game.buffType('loan 2',function(time,pow)
11852
{
11853
return {
11854
name:'Loan 2',
11855
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11856
icon:[1,33],
11857
time:time*Game.fps,
11858
power:pow,
11859
multCpS:pow,
11860
max:true,
11861
onDie:function(){if (Game.takeLoan) {Game.takeLoan(2,true);}},
11862
};
11863
});
11864
new Game.buffType('loan 2 interest',function(time,pow)
11865
{
11866
return {
11867
name:'Loan 2 (interest)',
11868
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11869
icon:[1,33],
11870
time:time*Game.fps,
11871
power:pow,
11872
multCpS:pow,
11873
max:true
11874
};
11875
});
11876
new Game.buffType('loan 3',function(time,pow)
11877
{
11878
return {
11879
name:'Loan 3',
11880
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11881
icon:[1,33],
11882
time:time*Game.fps,
11883
power:pow,
11884
multCpS:pow,
11885
max:true,
11886
onDie:function(){if (Game.takeLoan) {Game.takeLoan(3,true);}},
11887
};
11888
});
11889
new Game.buffType('loan 3 interest',function(time,pow)
11890
{
11891
return {
11892
name:'Loan 3 (interest)',
11893
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'.',
11894
icon:[1,33],
11895
time:time*Game.fps,
11896
power:pow,
11897
multCpS:pow,
11898
max:true
11899
};
11900
});
11901
11902
//end of buffs
11903
11904
11905
11906
11907
11908
BeautifyAll();
11909
Game.vanilla=0;//everything we create beyond this will not be saved in the default save
11910
11911
11912
Game.runModHook('create');
11913
11914
11915
/*=====================================================================================
11916
GRANDMAPOCALYPSE
11917
=======================================================================================*/
11918
Game.UpdateGrandmapocalypse=function()
11919
{
11920
if (Game.Has('Elder Covenant') || Game.Objects['Grandma'].amount==0) Game.elderWrath=0;
11921
else if (Game.pledgeT>0)//if the pledge is active, lower it
11922
{
11923
Game.pledgeT--;
11924
if (Game.pledgeT==0)//did we reach 0? make the pledge purchasable again
11925
{
11926
Game.Lock('Elder Pledge');
11927
Game.Unlock('Elder Pledge');
11928
Game.elderWrath=1;
11929
}
11930
}
11931
else
11932
{
11933
if (Game.Has('One mind') && Game.elderWrath==0)
11934
{
11935
Game.elderWrath=1;
11936
}
11937
if (Math.random()<0.001 && Game.elderWrath<Game.Has('One mind')+Game.Has('Communal brainsweep')+Game.Has('Elder Pact'))
11938
{
11939
Game.elderWrath++;//have we already pledged? make the elder wrath shift between different stages
11940
}
11941
if (Game.Has('Elder Pact') && Game.Upgrades['Elder Pledge'].unlocked==0)
11942
{
11943
Game.Lock('Elder Pledge');
11944
Game.Unlock('Elder Pledge');
11945
}
11946
}
11947
Game.elderWrathD+=((Game.elderWrath+1)-Game.elderWrathD)*0.001;//slowly fade to the target wrath state
11948
11949
if (Game.elderWrath!=Game.elderWrathOld) Game.storeToRefresh=1;
11950
11951
Game.elderWrathOld=Game.elderWrath;
11952
11953
Game.UpdateWrinklers();
11954
}
11955
11956
//wrinklers
11957
11958
function inRect(x,y,rect)
11959
{
11960
//find out if the point x,y is in the rotated rectangle rect{w,h,r,o} (width,height,rotation in radians,y-origin) (needs to be normalized)
11961
//I found this somewhere online I guess
11962
var dx = x+Math.sin(-rect.r)*(-(rect.h/2-rect.o)),dy=y+Math.cos(-rect.r)*(-(rect.h/2-rect.o));
11963
var h1 = Math.sqrt(dx*dx + dy*dy);
11964
var currA = Math.atan2(dy,dx);
11965
var newA = currA - rect.r;
11966
var x2 = Math.cos(newA) * h1;
11967
var y2 = Math.sin(newA) * h1;
11968
if (x2 > -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true;
11969
return false;
11970
}
11971
11972
Game.wrinklerHP=2.1;
11973
Game.wrinklers=[];
11974
for (var i=0;i<12;i++)
11975
{
11976
Game.wrinklers.push({id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:Game.wrinklerHP,selected:0,type:0});
11977
}
11978
Game.getWrinklersMax=function()
11979
{
11980
var n=10;
11981
if (Game.Has('Elder spice')) n+=2;
11982
return n;
11983
}
11984
Game.ResetWrinklers=function()
11985
{
11986
for (var i in Game.wrinklers)
11987
{
11988
Game.wrinklers[i]={id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:Game.wrinklerHP,selected:0,type:0};
11989
}
11990
}
11991
Game.CollectWrinklers=function()
11992
{
11993
for (var i in Game.wrinklers)
11994
{
11995
Game.wrinklers[i].hp=0;
11996
}
11997
}
11998
Game.wrinklerSquishSound=Math.floor(Math.random()*4)+1;
11999
Game.playWrinklerSquishSound=function()
12000
{
12001
PlaySound('snd/squish'+(Game.wrinklerSquishSound)+'.mp3',0.5);
12002
Game.wrinklerSquishSound+=Math.floor(Math.random()*1.5)+1;
12003
if (Game.wrinklerSquishSound>4) Game.wrinklerSquishSound-=4;
12004
}
12005
Game.SpawnWrinkler=function(me)
12006
{
12007
if (!me)
12008
{
12009
var max=Game.getWrinklersMax();
12010
var n=0;
12011
for (var i in Game.wrinklers)
12012
{
12013
if (Game.wrinklers[i].phase>0) n++;
12014
}
12015
for (var i in Game.wrinklers)
12016
{
12017
var it=Game.wrinklers[i];
12018
if (it.phase==0 && Game.elderWrath>0 && n<max && it.id<max)
12019
{
12020
me=it;
12021
break;
12022
}
12023
}
12024
}
12025
if (!me) return false;
12026
me.phase=1;
12027
me.hp=Game.wrinklerHP;
12028
me.type=0;
12029
if (Math.random()<0.0001) me.type=1;//shiny wrinkler
12030
return me;
12031
}
12032
Game.PopRandomWrinkler=function()
12033
{
12034
var wrinklers=[];
12035
for (var i in Game.wrinklers)
12036
{
12037
if (Game.wrinklers[i].phase>0 && Game.wrinklers[i].hp>0) wrinklers.push(Game.wrinklers[i]);
12038
}
12039
if (wrinklers.length>0)
12040
{
12041
var me=choose(wrinklers);
12042
me.hp=-10;
12043
return me;
12044
}
12045
return false;
12046
}
12047
Game.UpdateWrinklers=function()
12048
{
12049
var xBase=0;
12050
var yBase=0;
12051
var onWrinkler=0;
12052
if (Game.LeftBackground)
12053
{
12054
xBase=Game.cookieOriginX;
12055
yBase=Game.cookieOriginY;
12056
}
12057
var max=Game.getWrinklersMax();
12058
var n=0;
12059
for (var i in Game.wrinklers)
12060
{
12061
if (Game.wrinklers[i].phase>0) n++;
12062
}
12063
for (var i in Game.wrinklers)
12064
{
12065
var me=Game.wrinklers[i];
12066
if (me.phase==0 && Game.elderWrath>0 && n<max && me.id<max)
12067
{
12068
var chance=0.00001*Game.elderWrath;
12069
chance*=Game.eff('wrinklerSpawn');
12070
if (Game.Has('Unholy bait')) chance*=5;
12071
if (Game.hasGod)
12072
{
12073
var godLvl=Game.hasGod('scorn');
12074
if (godLvl==1) chance*=2.5;
12075
else if (godLvl==2) chance*=2;
12076
else if (godLvl==3) chance*=1.5;
12077
}
12078
if (Game.Has('Wrinkler doormat')) chance=0.1;
12079
if (Math.random()<chance)//respawn
12080
{
12081
Game.SpawnWrinkler(me);
12082
}
12083
}
12084
if (me.phase>0)
12085
{
12086
if (me.close<1) me.close+=(1/Game.fps)/10;
12087
if (me.close>1) me.close=1;
12088
}
12089
else me.close=0;
12090
if (me.close==1 && me.phase==1)
12091
{
12092
me.phase=2;
12093
Game.recalculateGains=1;
12094
}
12095
if (me.phase==2)
12096
{
12097
me.sucked+=(((Game.cookiesPs/Game.fps)*Game.cpsSucked));//suck the cookies
12098
}
12099
if (me.phase>0)
12100
{
12101
if (me.type==0)
12102
{
12103
if (me.hp<Game.wrinklerHP) me.hp+=0.04;
12104
me.hp=Math.min(Game.wrinklerHP,me.hp);
12105
}
12106
else if (me.type==1)
12107
{
12108
if (me.hp<Game.wrinklerHP*3) me.hp+=0.04;
12109
me.hp=Math.min(Game.wrinklerHP*3,me.hp);
12110
}
12111
var d=128*(2-me.close);//*Game.BigCookieSize;
12112
if (Game.prefs.fancy) d+=Math.cos(Game.T*0.05+parseInt(me.id))*4;
12113
me.r=(me.id/max)*360;
12114
if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.05+parseInt(me.id))*4;
12115
me.x=xBase+(Math.sin(me.r*Math.PI/180)*d);
12116
me.y=yBase+(Math.cos(me.r*Math.PI/180)*d);
12117
if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.09+parseInt(me.id))*4;
12118
var rect={w:100,h:200,r:(-me.r)*Math.PI/180,o:10};
12119
if (Math.random()<0.01) me.hurt=Math.max(me.hurt,Math.random());
12120
if (Game.T%5==0 && Game.CanClick) {if (Game.LeftBackground && Game.mouseX<Game.LeftBackground.canvas.width && inRect(Game.mouseX-me.x,Game.mouseY-me.y,rect)) me.selected=1; else me.selected=0;}
12121
if (me.selected && onWrinkler==0 && Game.CanClick)
12122
{
12123
me.hurt=Math.max(me.hurt,0.25);
12124
//me.close*=0.99;
12125
if (Game.Click && Game.lastClickedEl==l('backgroundLeftCanvas'))
12126
{
12127
if (Game.keys[17] && Game.sesame) {me.type=!me.type;PlaySound('snd/shimmerClick.mp3');}//ctrl-click on a wrinkler in god mode to toggle its shininess
12128
else
12129
{
12130
Game.playWrinklerSquishSound();
12131
me.hurt=1;
12132
me.hp-=0.75;
12133
if (Game.prefs.particles && !(me.hp<=0.5 && me.phase>0))
12134
{
12135
var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
12136
var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
12137
for (var ii=0;ii<3;ii++)
12138
{
12139
//Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');
12140
var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
12141
part.r=-me.r;
12142
}
12143
}
12144
}
12145
Game.Click=0;
12146
}
12147
onWrinkler=1;
12148
}
12149
}
12150
12151
if (me.hurt>0)
12152
{
12153
me.hurt-=5/Game.fps;
12154
//me.close-=me.hurt*0.05;
12155
//me.x+=Math.random()*2-1;
12156
//me.y+=Math.random()*2-1;
12157
me.r+=(Math.sin(Game.T*1)*me.hurt)*18;//Math.random()*2-1;
12158
}
12159
if (me.hp<=0.5 && me.phase>0)
12160
{
12161
Game.playWrinklerSquishSound();
12162
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
12163
Game.wrinklersPopped++;
12164
Game.recalculateGains=1;
12165
me.phase=0;
12166
me.close=0;
12167
me.hurt=0;
12168
me.hp=3;
12169
var toSuck=1.1;
12170
if (Game.Has('Sacrilegious corruption')) toSuck*=1.05;
12171
if (me.type==1) toSuck*=3;//shiny wrinklers are an elusive, profitable breed
12172
me.sucked*=toSuck;//cookie dough does weird things inside wrinkler digestive tracts
12173
if (Game.Has('Wrinklerspawn')) me.sucked*=1.05;
12174
if (Game.hasGod)
12175
{
12176
var godLvl=Game.hasGod('scorn');
12177
if (godLvl==1) me.sucked*=1.15;
12178
else if (godLvl==2) me.sucked*=1.1;
12179
else if (godLvl==3) me.sucked*=1.05;
12180
}
12181
if (me.sucked>0.5)
12182
{
12183
if (Game.prefs.popups) Game.Popup('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler : found '+Beautify(me.sucked)+' cookies!');
12184
else Game.Notify('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler','Found <b>'+Beautify(me.sucked)+'</b> cookies!',[19,8],6);
12185
Game.Popup('<div style="font-size:80%;">+'+Beautify(me.sucked)+' cookies</div>',Game.mouseX,Game.mouseY);
12186
12187
if (Game.season=='halloween')
12188
{
12189
//if (Math.random()<(Game.HasAchiev('Spooky cookies')?0.2:0.05))//halloween cookie drops
12190
var failRate=0.95;
12191
if (Game.HasAchiev('Spooky cookies')) failRate=0.8;
12192
if (Game.Has('Starterror')) failRate*=0.9;
12193
failRate*=1/Game.dropRateMult();
12194
if (Game.hasGod)
12195
{
12196
var godLvl=Game.hasGod('seasons');
12197
if (godLvl==1) failRate*=0.9;
12198
else if (godLvl==2) failRate*=0.95;
12199
else if (godLvl==3) failRate*=0.97;
12200
}
12201
if (me.type==1) failRate*=0.9;
12202
if (Math.random()>failRate)//halloween cookie drops
12203
{
12204
var cookie=choose(['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies']);
12205
if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))
12206
{
12207
Game.Unlock(cookie);
12208
if (Game.prefs.popups) Game.Popup('Found : '+cookie+'!');
12209
else Game.Notify(cookie,'You also found <b>'+cookie+'</b>!',Game.Upgrades[cookie].icon);
12210
}
12211
}
12212
}
12213
Game.DropEgg(0.98);
12214
}
12215
if (me.type==1) Game.Win('Last Chance to See');
12216
Game.Earn(me.sucked);
12217
/*if (Game.prefs.particles)
12218
{
12219
var x=me.x+(Math.sin(me.r*Math.PI/180)*100);
12220
var y=me.y+(Math.cos(me.r*Math.PI/180)*100);
12221
for (var ii=0;ii<6;ii++)
12222
{
12223
Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');
12224
}
12225
}*/
12226
if (Game.prefs.particles)
12227
{
12228
var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
12229
var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
12230
if (me.sucked>0)
12231
{
12232
for (var ii=0;ii<5;ii++)
12233
{
12234
Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1.5,2);
12235
}
12236
}
12237
for (var ii=0;ii<8;ii++)
12238
{
12239
var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
12240
part.r=-me.r;
12241
}
12242
}
12243
me.sucked=0;
12244
}
12245
}
12246
if (onWrinkler)
12247
{
12248
Game.mousePointer=1;
12249
}
12250
}
12251
Game.DrawWrinklers=function()
12252
{
12253
var ctx=Game.LeftBackground;
12254
var selected=0;
12255
for (var i in Game.wrinklers)
12256
{
12257
var me=Game.wrinklers[i];
12258
if (me.phase>0)
12259
{
12260
ctx.globalAlpha=me.close;
12261
ctx.save();
12262
ctx.translate(me.x,me.y);
12263
ctx.rotate(-(me.r)*Math.PI/180);
12264
//var s=Math.min(1,me.sucked/(Game.cookiesPs*60))*0.75+0.25;//scale wrinklers as they eat
12265
//ctx.scale(Math.pow(s,1.5)*1.25,s);
12266
//ctx.fillRect(-50,-10,100,200);
12267
if (me.type==1) ctx.drawImage(Pic('shinyWrinkler.png'),-50,-10);
12268
else if (Game.season=='christmas') ctx.drawImage(Pic('winterWrinkler.png'),-50,-10);
12269
else ctx.drawImage(Pic('wrinkler.png'),-50,-10);
12270
//ctx.fillText(me.id+' : '+me.sucked,0,0);
12271
if (me.type==1 && Math.random()<0.3 && Game.prefs.particles)//sparkle
12272
{
12273
ctx.globalAlpha=Math.random()*0.65+0.1;
12274
var s=Math.random()*30+5;
12275
ctx.globalCompositeOperation='lighter';
12276
ctx.drawImage(Pic('glint.jpg'),-s/2+Math.random()*50-25,-s/2+Math.random()*200,s,s);
12277
}
12278
ctx.restore();
12279
12280
if (me.phase==2 && Math.random()<0.03 && Game.prefs.particles)
12281
{
12282
Game.particleAdd(me.x,me.y,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.5,1,2);
12283
}
12284
12285
if (me.selected) selected=me;
12286
}
12287
}
12288
if (selected && Game.Has('Eye of the wrinkler'))
12289
{
12290
var x=Game.cookieOriginX;
12291
var y=Game.cookieOriginY;
12292
ctx.font='14px Merriweather';
12293
ctx.textAlign='center';
12294
var width=Math.max(ctx.measureText('Swallowed :').width,ctx.measureText(Beautify(selected.sucked)).width);
12295
ctx.fillStyle='#000';
12296
ctx.strokeStyle='#000';
12297
ctx.lineWidth=8;
12298
ctx.globalAlpha=0.5;
12299
ctx.beginPath();
12300
ctx.moveTo(x,y);
12301
ctx.lineTo(Math.floor(selected.x),Math.floor(selected.y));
12302
ctx.stroke();
12303
ctx.fillRect(x-width/2-8-14,y-23,width+16+28,38);
12304
ctx.globalAlpha=1;
12305
ctx.fillStyle='#fff';
12306
ctx.fillText('Swallowed :',x+14,y-8);
12307
ctx.fillText(Beautify(selected.sucked),x+14,y+8);
12308
ctx.drawImage(Pic('icons.png'),27*48,26*48,48,48,x-width/2-8-22,y-4-24,48,48);
12309
}
12310
}
12311
Game.SaveWrinklers=function()
12312
{
12313
var amount=0;
12314
var amountShinies=0;
12315
var number=0;
12316
var shinies=0;
12317
for (var i in Game.wrinklers)
12318
{
12319
if (Game.wrinklers[i].sucked>0.5)
12320
{
12321
number++;
12322
if (Game.wrinklers[i].type==1)
12323
{
12324
shinies++;
12325
amountShinies+=Game.wrinklers[i].sucked;
12326
}
12327
else amount+=Game.wrinklers[i].sucked;
12328
}
12329
}
12330
return {amount:amount,number:number,shinies:shinies,amountShinies:amountShinies};
12331
}
12332
Game.LoadWrinklers=function(amount,number,shinies,amountShinies)
12333
{
12334
if (number>0 && (amount>0 || amountShinies>0))
12335
{
12336
var fullNumber=number-shinies;
12337
var fullNumberShinies=shinies;
12338
for (var i in Game.wrinklers)
12339
{
12340
if (number>0)
12341
{
12342
Game.wrinklers[i].phase=2;
12343
Game.wrinklers[i].close=1;
12344
Game.wrinklers[i].hp=3;
12345
if (shinies>0) {Game.wrinklers[i].type=1;Game.wrinklers[i].sucked=amountShinies/fullNumberShinies;shinies--;}
12346
else Game.wrinklers[i].sucked=amount/fullNumber;
12347
number--;
12348
}//respawn
12349
}
12350
}
12351
}
12352
12353
/*=====================================================================================
12354
SPECIAL THINGS AND STUFF
12355
=======================================================================================*/
12356
12357
12358
Game.specialTab='';
12359
Game.specialTabHovered='';
12360
Game.specialTabs=[];
12361
12362
Game.UpdateSpecial=function()
12363
{
12364
Game.specialTabs=[];
12365
if (Game.Has('A festive hat')) Game.specialTabs.push('santa');
12366
if (Game.Has('A crumbly egg')) Game.specialTabs.push('dragon');
12367
if (Game.specialTabs.length==0) {Game.ToggleSpecialMenu(0);return;}
12368
12369
if (Game.LeftBackground)
12370
{
12371
Game.specialTabHovered='';
12372
var len=Game.specialTabs.length;
12373
if (len==0) return;
12374
var y=Game.LeftBackground.canvas.height-24-48*len;
12375
for (var i=0;i<Game.specialTabs.length;i++)
12376
{
12377
var selected=0;
12378
if (Game.specialTab==Game.specialTabs[i]) selected=1;
12379
var x=24;
12380
var s=1;
12381
if (selected) {s=2;x+=24;}
12382
12383
if (Math.abs(Game.mouseX-x)<=24*s && Math.abs(Game.mouseY-y)<=24*s)
12384
{
12385
Game.specialTabHovered=Game.specialTabs[i];
12386
Game.mousePointer=1;
12387
Game.CanClick=0;
12388
if (Game.Click && Game.lastClickedEl==l('backgroundLeftCanvas'))
12389
{
12390
if (Game.specialTab!=Game.specialTabs[i]) {Game.specialTab=Game.specialTabs[i];Game.ToggleSpecialMenu(1);PlaySound('snd/press.mp3');}
12391
else {Game.ToggleSpecialMenu(0);PlaySound('snd/press.mp3');}
12392
//PlaySound('snd/tick.mp3');
12393
}
12394
}
12395
12396
y+=48;
12397
}
12398
}
12399
}
12400
12401
Game.santaLevels=['Festive test tube','Festive ornament','Festive wreath','Festive tree','Festive present','Festive elf fetus','Elf toddler','Elfling','Young elf','Bulky elf','Nick','Santa Claus','Elder Santa','True Santa','Final Claus'];
12402
for (var i in Game.santaDrops)//scale christmas upgrade prices with santa level
12403
{Game.Upgrades[Game.santaDrops[i]].priceFunc=function(){return Math.pow(3,Game.santaLevel)*2525;}}
12404
12405
Game.UpgradeSanta=function()
12406
{
12407
var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);
12408
if (Game.cookies>moni && Game.santaLevel<14)
12409
{
12410
PlaySound('snd/shimmerClick.mp3');
12411
12412
Game.Spend(moni);
12413
Game.santaLevel=(Game.santaLevel+1)%15;
12414
if (Game.santaLevel==14)
12415
{
12416
Game.Unlock('Santa\'s dominion');
12417
if (Game.prefs.popups) Game.Popup('You are granted<br>Santa\'s dominion.');
12418
else Game.Notify('You are granted Santa\'s dominion.','',Game.Upgrades['Santa\'s dominion'].icon);
12419
}
12420
var drops=[];
12421
for (var i in Game.santaDrops) {if (!Game.HasUnlocked(Game.santaDrops[i])) drops.push(Game.santaDrops[i]);}
12422
var drop=choose(drops);
12423
if (drop)
12424
{
12425
Game.Unlock(drop);
12426
if (Game.prefs.popups) Game.Popup('You find a present which contains...<br>'+drop+'!');
12427
else Game.Notify('Found a present!','You find a present which contains...<br><b>'+drop+'</b>!',Game.Upgrades[drop].icon);
12428
}
12429
12430
Game.ToggleSpecialMenu(1);
12431
12432
if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}
12433
12434
if (Game.santaLevel>=6) Game.Win('Coming to town');
12435
if (Game.santaLevel>=14) Game.Win('All hail Santa');
12436
Game.recalculateGains=1;
12437
Game.upgradesToRebuild=1;
12438
}
12439
}
12440
12441
Game.dragonLevels=[
12442
{name:'Dragon egg',action:'Chip it',pic:0,
12443
cost:function(){return Game.cookies>=1000000;},
12444
buy:function(){Game.Spend(1000000);},
12445
costStr:function(){return Beautify(1000000)+' cookies';}},
12446
{name:'Dragon egg',action:'Chip it',pic:1,
12447
cost:function(){return Game.cookies>=1000000*2;},
12448
buy:function(){Game.Spend(1000000*2);},
12449
costStr:function(){return Beautify(1000000*2)+' cookies';}},
12450
{name:'Dragon egg',action:'Chip it',pic:2,
12451
cost:function(){return Game.cookies>=1000000*4;},
12452
buy:function(){Game.Spend(1000000*4);},
12453
costStr:function(){return Beautify(1000000*4)+' cookies';}},
12454
{name:'Shivering dragon egg',action:'Hatch it',pic:3,
12455
cost:function(){return Game.cookies>=1000000*8;},
12456
buy:function(){Game.Spend(1000000*8);},
12457
costStr:function(){return Beautify(1000000*8)+' cookies';}},
12458
{name:'Krumblor, cookie hatchling',action:'Train Breath of Milk<br><small>Aura : kittens are 5% more effective</small>',pic:4,
12459
cost:function(){return Game.cookies>=1000000*16;},
12460
buy:function(){Game.Spend(1000000*16);},
12461
costStr:function(){return Beautify(1000000*16)+' cookies';}},
12462
{name:'Krumblor, cookie hatchling',action:'Train Dragon Cursor<br><small>Aura : clicking is 5% more effective</small>',pic:4,
12463
cost:function(){return Game.Objects['Cursor'].amount>=100;},
12464
buy:function(){Game.Objects['Cursor'].sacrifice(100);},
12465
costStr:function(){return '100 cursors';}},
12466
{name:'Krumblor, cookie hatchling',action:'Train Elder Battalion<br><small>Aura : grandmas gain +1% CpS for every non-grandma building</small>',pic:4,
12467
cost:function(){return Game.Objects['Grandma'].amount>=100;},
12468
buy:function(){Game.Objects['Grandma'].sacrifice(100);},
12469
costStr:function(){return '100 grandmas';}},
12470
{name:'Krumblor, cookie hatchling',action:'Train Reaper of Fields<br><small>Aura : golden cookies may trigger a Dragon Harvest</small>',pic:4,
12471
cost:function(){return Game.Objects['Farm'].amount>=100;},
12472
buy:function(){Game.Objects['Farm'].sacrifice(100);},
12473
costStr:function(){return '100 farms';}},
12474
{name:'Krumblor, cookie dragon',action:'Train Earth Shatterer<br><small>Aura : buildings sell back for 50% instead of 25%</small>',pic:5,
12475
cost:function(){return Game.Objects['Mine'].amount>=100;},
12476
buy:function(){Game.Objects['Mine'].sacrifice(100);},
12477
costStr:function(){return '100 mines';}},
12478
{name:'Krumblor, cookie dragon',action:'Train Master of the Armory<br><small>Aura : all upgrades are 2% cheaper</small>',pic:5,
12479
cost:function(){return Game.Objects['Factory'].amount>=100;},
12480
buy:function(){Game.Objects['Factory'].sacrifice(100);},
12481
costStr:function(){return '100 factories';}},
12482
{name:'Krumblor, cookie dragon',action:'Train Fierce Hoarder<br><small>Aura : all buildings are 2% cheaper</small>',pic:5,
12483
cost:function(){return Game.Objects['Bank'].amount>=100;},
12484
buy:function(){Game.Objects['Bank'].sacrifice(100);},
12485
costStr:function(){return '100 banks';}},
12486
{name:'Krumblor, cookie dragon',action:'Train Dragon God<br><small>Aura : prestige CpS bonus +5%</small>',pic:5,
12487
cost:function(){return Game.Objects['Temple'].amount>=100;},
12488
buy:function(){Game.Objects['Temple'].sacrifice(100);},
12489
costStr:function(){return '100 temples';}},
12490
{name:'Krumblor, cookie dragon',action:'Train Arcane Aura<br><small>Aura : golden cookies appear 5% more often</small>',pic:5,
12491
cost:function(){return Game.Objects['Wizard tower'].amount>=100;},
12492
buy:function(){Game.Objects['Wizard tower'].sacrifice(100);},
12493
costStr:function(){return '100 wizard towers';}},
12494
{name:'Krumblor, cookie dragon',action:'Train Dragonflight<br><small>Aura : golden cookies may trigger a Dragonflight</small>',pic:5,
12495
cost:function(){return Game.Objects['Shipment'].amount>=100;},
12496
buy:function(){Game.Objects['Shipment'].sacrifice(100);},
12497
costStr:function(){return '100 shipments';}},
12498
{name:'Krumblor, cookie dragon',action:'Train Ancestral Metamorphosis<br><small>Aura : golden cookies give 10% more cookies</small>',pic:5,
12499
cost:function(){return Game.Objects['Alchemy lab'].amount>=100;},
12500
buy:function(){Game.Objects['Alchemy lab'].sacrifice(100);},
12501
costStr:function(){return '100 alchemy labs';}},
12502
{name:'Krumblor, cookie dragon',action:'Train Unholy Dominion<br><small>Aura : wrath cookies give 10% more cookies</small>',pic:5,
12503
cost:function(){return Game.Objects['Portal'].amount>=100;},
12504
buy:function(){Game.Objects['Portal'].sacrifice(100);},
12505
costStr:function(){return '100 portals';}},
12506
{name:'Krumblor, cookie dragon',action:'Train Epoch Manipulator<br><small>Aura : golden cookie effects last 5% longer</small>',pic:5,
12507
cost:function(){return Game.Objects['Time machine'].amount>=100;},
12508
buy:function(){Game.Objects['Time machine'].sacrifice(100);},
12509
costStr:function(){return '100 time machines';}},
12510
{name:'Krumblor, cookie dragon',action:'Train Mind Over Matter<br><small>Aura : +25% random drops</small>',pic:5,
12511
cost:function(){return Game.Objects['Antimatter condenser'].amount>=100;},
12512
buy:function(){Game.Objects['Antimatter condenser'].sacrifice(100);},
12513
costStr:function(){return '100 antimatter condensers';}},
12514
{name:'Krumblor, cookie dragon',action:'Train Radiant Appetite<br><small>Aura : all cookie production multiplied by 2</small>',pic:5,
12515
cost:function(){return Game.Objects['Prism'].amount>=100;},
12516
buy:function(){Game.Objects['Prism'].sacrifice(100);},
12517
costStr:function(){return '100 prisms';}},
12518
{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Fortune<br><small>Aura : +123% CpS per golden cookie on-screen</small>',pic:5,
12519
cost:function(){return Game.Objects['Chancemaker'].amount>=100;},
12520
buy:function(){Game.Objects['Chancemaker'].sacrifice(100);},
12521
costStr:function(){return '100 chancemakers';}},
12522
{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Curve<br><small>Aura : sugar lumps grow 5% faster, 50% weirder</small>',pic:5,
12523
cost:function(){return Game.Objects['Fractal engine'].amount>=100;},
12524
buy:function(){Game.Objects['Fractal engine'].sacrifice(100);},
12525
costStr:function(){return '100 fractal engines';}},
12526
{name:'Krumblor, cookie dragon',action:'Train Reality Bending<br><small>Aura : 10% of every other aura, combined</small>',pic:5,
12527
cost:function(){return Game.Objects['Javascript console'].amount>=100;},
12528
buy:function(){Game.Objects['Javascript console'].sacrifice(100);},
12529
costStr:function(){return '100 javascript consoles';}},
12530
{name:'Krumblor, cookie dragon',action:'Train Dragon Orbs<br><small>Aura : selling your best building may grant a wish</small>',pic:5,
12531
cost:function(){return Game.Objects['Idleverse'].amount>=100;},
12532
buy:function(){Game.Objects['Idleverse'].sacrifice(100);},
12533
costStr:function(){return '100 idleverses';}},
12534
{name:'Krumblor, cookie dragon',action:'Bake dragon cookie<br><small>Delicious!</small>',pic:6,
12535
cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<50) fail=1;}return (fail==0);},
12536
buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(50);}Game.Unlock('Dragon cookie');},
12537
costStr:function(){return '50 of every building';}},
12538
{name:'Krumblor, cookie dragon',action:'Train secondary aura<br><small>Lets you use two dragon auras simultaneously</small>',pic:7,
12539
cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<200) fail=1;}return (fail==0);},
12540
buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(200);}},
12541
costStr:function(){return '200 of every building';}},
12542
{name:'Krumblor, cookie dragon',action:'Your dragon is fully trained.',pic:8}
12543
];
12544
12545
Game.dragonAuras={
12546
0:{name:'No aura',pic:[0,7],desc:'Select an aura from those your dragon knows.'},
12547
1:{name:'Breath of Milk',pic:[18,25],desc:'Kittens are <b>5%</b> more effective.'},
12548
2:{name:'Dragon Cursor',pic:[0,25],desc:'Clicking is <b>5%</b> more effective.'},
12549
3:{name:'Elder Battalion',pic:[1,25],desc:'Grandmas gain <b>+1% CpS</b> for every non-grandma building.'},
12550
4:{name:'Reaper of Fields',pic:[2,25],desc:'Golden cookies may trigger a <b>Dragon Harvest</b>.'},
12551
5:{name:'Earth Shatterer',pic:[3,25],desc:'Buildings sell back for <b>50%</b> instead of 25%.'},
12552
6:{name:'Master of the Armory',pic:[4,25],desc:'All upgrades are <b>2%</b> cheaper.'},
12553
7:{name:'Fierce Hoarder',pic:[15,25],desc:'All buildings are <b>2%</b> cheaper.'},
12554
8:{name:'Dragon God',pic:[16,25],desc:'Prestige CpS bonus <b>+5%</b>.'},
12555
9:{name:'Arcane Aura',pic:[17,25],desc:'Golden cookies appear <b>+5%</b> more often.'},
12556
10:{name:'Dragonflight',pic:[5,25],desc:'Golden cookies may trigger a <b>Dragonflight</b>.'},
12557
11:{name:'Ancestral Metamorphosis',pic:[6,25],desc:'Golden cookies give <b>10%</b> more cookies.'},
12558
12:{name:'Unholy Dominion',pic:[7,25],desc:'Wrath cookies give <b>10%</b> more cookies.'},
12559
13:{name:'Epoch Manipulator',pic:[8,25],desc:'Golden cookies last <b>5%</b> longer.'},
12560
14:{name:'Mind Over Matter',pic:[13,25],desc:'Random drops are <b>25% more common</b>.'},
12561
15:{name:'Radiant Appetite',pic:[14,25],desc:'All cookie production <b>multiplied by 2</b>.'},
12562
16:{name:'Dragon\'s Fortune',pic:[19,25],desc:'<b>+123% CpS</b> per golden cookie on-screen, multiplicative.'},
12563
17:{name:'Dragon\'s Curve',pic:[20,25],desc:'<b>+5% sugar lump growth</b> and sugar lumps are <b>twice as likely</b> to be unusual.'},
12564
18:{name:'Reality Bending',pic:[32,25],desc:'<b>One tenth</b> of every other dragon aura, <b>combined</b>.'},
12565
19:{name:'Dragon Orbs',pic:[33,25],desc:'With no buffs and no golden cookies on screen, selling your most powerful building has <b>10% chance to summon one</b>.'},
12566
};
12567
12568
Game.hasAura=function(what)
12569
{
12570
if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) return true; else return false;
12571
}
12572
Game.auraMult=function(what)
12573
{
12574
var n=0;
12575
if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) n=1;
12576
if (Game.dragonAuras[Game.dragonAura].name=='Reality Bending' || Game.dragonAuras[Game.dragonAura2].name=='Reality Bending') n+=0.1;
12577
return n;
12578
}
12579
12580
Game.SelectDragonAura=function(slot,update)
12581
{
12582
var currentAura=0;
12583
var otherAura=0;
12584
if (slot==0) currentAura=Game.dragonAura; else currentAura=Game.dragonAura2;
12585
if (slot==0) otherAura=Game.dragonAura2; else otherAura=Game.dragonAura;
12586
if (!update) Game.SelectingDragonAura=currentAura;
12587
12588
var str='';
12589
for (var i in Game.dragonAuras)
12590
{
12591
if (Game.dragonLevel>=parseInt(i)+4)
12592
{
12593
var icon=Game.dragonAuras[i].pic;
12594
if (i==0 || i!=otherAura) str+='<div class="crate enabled'+(i==Game.SelectingDragonAura?' highlighted':'')+'" style="opacity:1;float:none;display:inline-block;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SetDragonAura('+i+','+slot+');" onMouseOut="Game.DescribeDragonAura('+Game.SelectingDragonAura+');" onMouseOver="Game.DescribeDragonAura('+i+');"'+
12595
'></div>';
12596
}
12597
}
12598
12599
var highestBuilding=0;
12600
for (var i in Game.Objects) {if (Game.Objects[i].amount>0) highestBuilding=Game.Objects[i];}
12601
12602
Game.Prompt('<h3>Set your dragon\'s '+(slot==1?'secondary ':'')+'aura</h3>'+
12603
'<div class="line"></div>'+
12604
'<div id="dragonAuraInfo" style="min-height:60px;"></div>'+
12605
'<div style="text-align:center;">'+str+'</div>'+
12606
'<div class="line"></div>'+
12607
'<div style="text-align:center;margin-bottom:8px;">'+(highestBuilding==0?'Switching your aura is <b>free</b> because you own no buildings.':'The cost of switching your aura is <b>1 '+highestBuilding.name+'</b>.<br>This will affect your CpS!')+'</div>'
12608
,[['Confirm',(slot==0?'Game.dragonAura':'Game.dragonAura2')+'=Game.SelectingDragonAura;'+(highestBuilding==0 || currentAura==Game.SelectingDragonAura?'':'Game.ObjectsById['+highestBuilding.id+'].sacrifice(1);')+'Game.ToggleSpecialMenu(1);Game.ClosePrompt();'],'Cancel'],0,'widePrompt');
12609
Game.DescribeDragonAura(Game.SelectingDragonAura);
12610
}
12611
Game.SelectingDragonAura=-1;
12612
Game.SetDragonAura=function(aura,slot)
12613
{
12614
Game.SelectingDragonAura=aura;
12615
Game.SelectDragonAura(slot,1);
12616
}
12617
Game.DescribeDragonAura=function(aura)
12618
{
12619
l('dragonAuraInfo').innerHTML=
12620
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[aura].name+'</h4>'+
12621
'<div class="line"></div>'+
12622
Game.dragonAuras[aura].desc+
12623
'</div>';
12624
}
12625
12626
Game.UpgradeDragon=function()
12627
{
12628
if (Game.dragonLevel<Game.dragonLevels.length-1 && Game.dragonLevels[Game.dragonLevel].cost())
12629
{
12630
PlaySound('snd/shimmerClick.mp3');
12631
Game.dragonLevels[Game.dragonLevel].buy();
12632
Game.dragonLevel=(Game.dragonLevel+1)%Game.dragonLevels.length;
12633
12634
if (Game.dragonLevel>=Game.dragonLevels.length-1) Game.Win('Here be dragon');
12635
Game.ToggleSpecialMenu(1);
12636
if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}
12637
Game.recalculateGains=1;
12638
Game.upgradesToRebuild=1;
12639
}
12640
}
12641
12642
Game.lastClickedSpecialPic=0;
12643
Game.ClickSpecialPic=function()
12644
{
12645
if (Game.specialTab=='dragon' && Game.dragonLevel>=4 && Game.Has('Pet the dragon') && l('specialPic'))
12646
{
12647
triggerAnim(l('specialPic'),'pucker');
12648
PlaySound('snd/click'+Math.floor(Math.random()*7+1)+'.mp3',0.5);
12649
if (Date.now()-Game.lastClickedSpecialPic>2000) PlaySound('snd/growl.mp3');
12650
//else if (Math.random()<0.5) PlaySound('snd/growl.mp3',0.5+Math.random()*0.2);
12651
Game.lastClickedSpecialPic=Date.now();
12652
if (Game.prefs.particles)
12653
{
12654
Game.particleAdd(Game.mouseX,Game.mouseY-32,Math.random()*4-2,Math.random()*-2-4,Math.random()*0.2+0.5,1,2,[20,3]);
12655
}
12656
if (Game.dragonLevel>=8 && Math.random()<1/20)
12657
{
12658
Math.seedrandom(Game.seed+'/dragonTime');
12659
var drops=['Dragon scale','Dragon claw','Dragon fang','Dragon teddy bear'];
12660
drops=shuffle(drops);
12661
var drop=drops[Math.floor((new Date().getMinutes()/60)*drops.length)];
12662
if (!Game.Has(drop) && !Game.HasUnlocked(drop))
12663
{
12664
Game.Unlock(drop);
12665
if (Game.prefs.popups) Game.Popup('You find :<br>'+drop+'!');
12666
else Game.Notify(drop,'<b>Your dragon dropped something!</b>',Game.Upgrades[drop].icon);
12667
}
12668
Math.seedrandom();
12669
}
12670
}
12671
}
12672
12673
Game.ToggleSpecialMenu=function(on)
12674
{
12675
if (on)
12676
{
12677
var pic='';
12678
var frame=0;
12679
if (Game.specialTab=='santa') {pic='santa.png';frame=Game.santaLevel;}
12680
else if (Game.specialTab=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}
12681
else {pic='dragon.png?v='+Game.version;frame=4;}
12682
12683
var str='<div id="specialPic" '+Game.clickStr+'="Game.ClickSpecialPic();" style="'+((Game.specialTab=='dragon' && Game.dragonLevel>=4 && Game.Has('Pet the dragon'))?'cursor:pointer;':'')+'position:absolute;left:-16px;top:-64px;width:96px;height:96px;background:url(img/'+pic+');background-position:'+(-frame*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div>';
12684
str+='<div class="close" onclick="PlaySound(\'snd/press.mp3\');Game.ToggleSpecialMenu(0);">x</div>';
12685
12686
if (Game.specialTab=='santa')
12687
{
12688
var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);
12689
12690
str+='<h3 style="pointer-events:none;">'+Game.santaLevels[Game.santaLevel]+'</h3>';
12691
if (Game.santaLevel<14)
12692
{
12693
str+='<div class="line"></div>'+
12694
'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeSanta();">'+
12695
'<div style="display:table-cell;vertical-align:middle;">Evolve</div>'+
12696
'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+
12697
'<div style="display:table-cell;vertical-align:middle;font-size:65%;">cost :<div'+(Game.cookies>moni?'':' style="color:#777;"')+'>'+Beautify(Math.pow(Game.santaLevel+1,Game.santaLevel+1))+' '+(Game.santaLevel>0?'cookies':'cookie')+'</div></div>'+
12698
'</a></div>';
12699
}
12700
}
12701
else if (Game.specialTab=='dragon')
12702
{
12703
var level=Game.dragonLevels[Game.dragonLevel];
12704
12705
str+='<h3 style="pointer-events:none;">'+level.name+'</h3>';
12706
12707
if (Game.dragonLevel>=5)
12708
{
12709
var icon=Game.dragonAuras[Game.dragonAura].pic;
12710
str+='<div class="crate enabled" style="opacity:1;position:absolute;right:18px;top:-58px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SelectDragonAura(0);" '+Game.getTooltip(
12711
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura].name+'</h4>'+
12712
'<div class="line"></div>'+
12713
Game.dragonAuras[Game.dragonAura].desc+
12714
'</div>'
12715
,'top')+
12716
'></div>';
12717
}
12718
if (Game.dragonLevel>=25)//2nd aura slot; increased with last building (idleverse)
12719
{
12720
var icon=Game.dragonAuras[Game.dragonAura2].pic;
12721
str+='<div class="crate enabled" style="opacity:1;position:absolute;right:80px;top:-58px;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');Game.SelectDragonAura(1);" '+Game.getTooltip(
12722
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura2].name+'</h4>'+
12723
'<div class="line"></div>'+
12724
Game.dragonAuras[Game.dragonAura2].desc+
12725
'</div>'
12726
,'top')+
12727
'></div>';
12728
}
12729
12730
if (Game.dragonLevel<Game.dragonLevels.length-1)
12731
{
12732
str+='<div class="line"></div>'+
12733
'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeDragon();">'+
12734
'<div style="display:table-cell;vertical-align:middle;">'+level.action+'</div>'+
12735
'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+
12736
'<div style="display:table-cell;vertical-align:middle;font-size:65%;">sacrifice<div'+(level.cost()?'':' style="color:#777;"')+'>'+level.costStr()+'</div></div>'+
12737
'</a></div>';
12738
}
12739
else
12740
{
12741
str+='<div class="line"></div>'+
12742
'<div style="text-align:center;margin-bottom:4px;">'+level.action+'</div>';
12743
}
12744
}
12745
12746
l('specialPopup').innerHTML=str;
12747
12748
l('specialPopup').className='framed prompt onScreen';
12749
}
12750
else
12751
{
12752
if (Game.specialTab!='')
12753
{
12754
Game.specialTab='';
12755
l('specialPopup').className='framed prompt offScreen';
12756
setTimeout(function(){if (Game.specialTab=='') {/*l('specialPopup').style.display='none';*/l('specialPopup').innerHTML='';}},1000*0.2);
12757
}
12758
}
12759
}
12760
Game.DrawSpecial=function()
12761
{
12762
var len=Game.specialTabs.length;
12763
if (len==0) return;
12764
Game.LeftBackground.globalAlpha=1;
12765
var y=Game.LeftBackground.canvas.height-24-48*len;
12766
var tabI=0;
12767
12768
for (var i in Game.specialTabs)
12769
{
12770
var selected=0;
12771
var hovered=0;
12772
if (Game.specialTab==Game.specialTabs[i]) selected=1;
12773
if (Game.specialTabHovered==Game.specialTabs[i]) hovered=1;
12774
var x=24;
12775
var s=1;
12776
var pic='';
12777
var frame=0;
12778
if (hovered) {s=1;x=24;}
12779
if (selected) {s=1;x=48;}
12780
12781
if (Game.specialTabs[i]=='santa') {pic='santa.png';frame=Game.santaLevel;}
12782
else if (Game.specialTabs[i]=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}
12783
else {pic='dragon.png?v='+Game.version;frame=4;}
12784
12785
if (hovered || selected)
12786
{
12787
var ss=s*64;
12788
var r=Math.floor((Game.T*0.5)%360);
12789
Game.LeftBackground.save();
12790
Game.LeftBackground.translate(x,y);
12791
if (Game.prefs.fancy) Game.LeftBackground.rotate((r/360)*Math.PI*2);
12792
Game.LeftBackground.globalAlpha=0.75;
12793
Game.LeftBackground.drawImage(Pic('shine.png'),-ss/2,-ss/2,ss,ss);
12794
Game.LeftBackground.restore();
12795
}
12796
12797
if (Game.prefs.fancy) Game.LeftBackground.drawImage(Pic(pic),96*frame,0,96,96,(x+(selected?0:Math.sin(Game.T*0.2+tabI)*3)-24*s),(y-(selected?6:Math.abs(Math.cos(Game.T*0.2+tabI))*6)-24*s),48*s,48*s);
12798
else Game.LeftBackground.drawImage(Pic(pic),96*frame,0,96,96,(x-24*s),(y-24*s),48*s,48*s);
12799
12800
tabI++;
12801
y+=48;
12802
}
12803
12804
}
12805
12806
/*=====================================================================================
12807
VISUAL EFFECTS
12808
=======================================================================================*/
12809
12810
Game.Milks=[
12811
{name:'Rank I - Plain milk',pic:'milkPlain',icon:[1,8]},
12812
{name:'Rank II - Chocolate milk',pic:'milkChocolate',icon:[2,8]},
12813
{name:'Rank III - Raspberry milk',pic:'milkRaspberry',icon:[3,8]},
12814
{name:'Rank IV - Orange milk',pic:'milkOrange',icon:[4,8]},
12815
{name:'Rank V - Caramel milk',pic:'milkCaramel',icon:[5,8]},
12816
{name:'Rank VI - Banana milk',pic:'milkBanana',icon:[6,8]},
12817
{name:'Rank VII - Lime milk',pic:'milkLime',icon:[7,8]},
12818
{name:'Rank VIII - Blueberry milk',pic:'milkBlueberry',icon:[8,8]},
12819
{name:'Rank IX - Strawberry milk',pic:'milkStrawberry',icon:[9,8]},
12820
{name:'Rank X - Vanilla milk',pic:'milkVanilla',icon:[10,8]},
12821
{name:'Rank XI - Honey milk',pic:'milkHoney',icon:[21,23]},
12822
{name:'Rank XII - Coffee milk',pic:'milkCoffee',icon:[22,23]},
12823
{name:'Rank XIII - Tea with a spot of milk',pic:'milkTea',icon:[23,23]},
12824
{name:'Rank XIV - Coconut milk',pic:'milkCoconut',icon:[24,23]},
12825
{name:'Rank XV - Cherry milk',pic:'milkCherry',icon:[25,23]},
12826
{name:'Rank XVI - Spiced milk',pic:'milkSpiced',icon:[26,23]},
12827
{name:'Rank XVII - Maple milk',pic:'milkMaple',icon:[28,23]},
12828
{name:'Rank XVIII - Mint milk',pic:'milkMint',icon:[29,23]},
12829
{name:'Rank XIX - Licorice milk',pic:'milkLicorice',icon:[30,23]},
12830
{name:'Rank XX - Rose milk',pic:'milkRose',icon:[31,23]},
12831
{name:'Rank XXI - Dragonfruit milk',pic:'milkDragonfruit',icon:[21,24]},
12832
];
12833
Game.Milk=Game.Milks[0];
12834
12835
Game.mousePointer=0;//when 1, draw the mouse as a pointer on the left screen
12836
12837
Game.cookieOriginX=0;
12838
Game.cookieOriginY=0;
12839
Game.DrawBackground=function()
12840
{
12841
12842
Timer.clean();
12843
//background
12844
if (!Game.Background)//init some stuff
12845
{
12846
Game.Background=l('backgroundCanvas').getContext('2d');
12847
Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;
12848
Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;
12849
Game.LeftBackground=l('backgroundLeftCanvas').getContext('2d');
12850
Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;
12851
Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;
12852
//preload ascend animation bits so they show up instantly
12853
Game.LeftBackground.globalAlpha=0;
12854
Game.LeftBackground.drawImage(Pic('brokenCookie.png'),0,0);
12855
Game.LeftBackground.drawImage(Pic('brokenCookieHalo.png'),0,0);
12856
Game.LeftBackground.drawImage(Pic('starbg.jpg'),0,0);
12857
12858
window.addEventListener('resize', function(event)
12859
{
12860
Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;
12861
Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;
12862
Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;
12863
Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;
12864
});
12865
}
12866
12867
var ctx=Game.LeftBackground;
12868
12869
if (Game.OnAscend)
12870
{
12871
Timer.clean();
12872
//starry background on ascend screen
12873
var w=Game.Background.canvas.width;
12874
var h=Game.Background.canvas.height;
12875
var b=Game.ascendl.getBoundingClientRect();
12876
var x=(b.left+b.right)/2;
12877
var y=(b.top+b.bottom)/2;
12878
Game.Background.globalAlpha=0.5;
12879
var s=1*Game.AscendZoom*(1+Math.cos(Game.T*0.0027)*0.05);
12880
Game.Background.fillPattern(Pic('starbg.jpg'),0,0,w,h,1024*s,1024*s,x+Game.AscendOffX*0.25*s,y+Game.AscendOffY*0.25*s);
12881
Timer.track('star layer 1');
12882
if (Game.prefs.fancy)
12883
{
12884
//additional star layer
12885
Game.Background.globalAlpha=0.5*(0.5+Math.sin(Game.T*0.02)*0.3);
12886
var s=2*Game.AscendZoom*(1+Math.sin(Game.T*0.002)*0.07);
12887
//Game.Background.globalCompositeOperation='lighter';
12888
Game.Background.fillPattern(Pic('starbg.jpg'),0,0,w,h,1024*s,1024*s,x+Game.AscendOffX*0.25*s,y+Game.AscendOffY*0.25*s);
12889
//Game.Background.globalCompositeOperation='source-over';
12890
Timer.track('star layer 2');
12891
12892
x=x+Game.AscendOffX*Game.AscendZoom;
12893
y=y+Game.AscendOffY*Game.AscendZoom;
12894
//wispy nebula around the center
12895
Game.Background.save();
12896
Game.Background.globalAlpha=0.5;
12897
Game.Background.translate(x,y);
12898
Game.Background.globalCompositeOperation='lighter';
12899
Game.Background.rotate(Game.T*0.001);
12900
s=(600+150*Math.sin(Game.T*0.007))*Game.AscendZoom;
12901
Game.Background.drawImage(Pic('heavenRing1.jpg'),-s/2,-s/2,s,s);
12902
Game.Background.rotate(-Game.T*0.0017);
12903
s=(600+150*Math.sin(Game.T*0.0037))*Game.AscendZoom;
12904
Game.Background.drawImage(Pic('heavenRing2.jpg'),-s/2,-s/2,s,s);
12905
Game.Background.restore();
12906
Timer.track('nebula');
12907
12908
/*
12909
//links between upgrades
12910
//not in because I am bad at this
12911
Game.Background.globalAlpha=1;
12912
Game.Background.save();
12913
Game.Background.translate(x,y);
12914
s=(32)*Game.AscendZoom;
12915
12916
for (var i in Game.PrestigeUpgrades)
12917
{
12918
var me=Game.PrestigeUpgrades[i];
12919
var ghosted=0;
12920
if (me.canBePurchased || Game.Has('Neuromancy')){}
12921
else
12922
{
12923
for (var ii in me.parents){if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;}
12924
}
12925
for (var ii in me.parents)//create pulsing links
12926
{
12927
if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))
12928
{
12929
var origX=0;
12930
var origY=0;
12931
var targX=me.posX+28;
12932
var targY=me.posY+28;
12933
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
12934
var rot=-Math.atan((targY-origY)/(origX-targX));
12935
if (targX<=origX) rot+=180;
12936
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
12937
origX+=2;
12938
origY-=18;
12939
//rot=-(Math.PI/2)*(me.id%4);
12940
Game.Background.translate(origX,origY);
12941
Game.Background.rotate(rot);
12942
//Game.Background.drawImage(Pic('linkPulse.png'),-s/2,-s/2,s,s);
12943
Game.Background.fillPattern(Pic('linkPulse.png'),0,-4,dist,8,32,8);
12944
Game.Background.rotate(-rot);
12945
Game.Background.translate(-origX,-origY);
12946
}
12947
}
12948
}
12949
Game.Background.restore();
12950
Timer.track('links');
12951
*/
12952
12953
//Game.Background.drawImage(Pic('shadedBorders.png'),0,0,w,h);
12954
//Timer.track('border');
12955
}
12956
}
12957
else
12958
{
12959
12960
var goodBuff=0;
12961
var badBuff=0;
12962
for (var i in Game.buffs)
12963
{
12964
if (Game.buffs[i].aura==1) goodBuff=1;
12965
if (Game.buffs[i].aura==2) badBuff=1;
12966
}
12967
12968
if (Game.drawT%5==0)
12969
{
12970
if (false && Game.bgType!=0 && Game.ascensionMode!=1)
12971
{
12972
//l('backgroundCanvas').style.background='url(img/shadedBordersSoft.png) 0px 0px,url(img/bgWheat.jpg) 50% 50%';
12973
//l('backgroundCanvas').style.backgroundSize='100% 100%,cover';
12974
}
12975
else
12976
{
12977
l('backgroundCanvas').style.background='transparent';
12978
Game.defaultBg='bgBlue';
12979
Game.bgR=0;
12980
12981
if (Game.season=='fools') Game.defaultBg='bgMoney';
12982
if (Game.elderWrathD<1)
12983
{
12984
Game.bgR=0;
12985
Game.bg=Game.defaultBg;
12986
Game.bgFade=Game.defaultBg;
12987
}
12988
else if (Game.elderWrathD>=1 && Game.elderWrathD<2)
12989
{
12990
Game.bgR=(Game.elderWrathD-1)/1;
12991
Game.bg=Game.defaultBg;
12992
Game.bgFade='grandmas1';
12993
}
12994
else if (Game.elderWrathD>=2 && Game.elderWrathD<3)
12995
{
12996
Game.bgR=(Game.elderWrathD-2)/1;
12997
Game.bg='grandmas1';
12998
Game.bgFade='grandmas2';
12999
}
13000
else if (Game.elderWrathD>=3)// && Game.elderWrathD<4)
13001
{
13002
Game.bgR=(Game.elderWrathD-3)/1;
13003
Game.bg='grandmas2';
13004
Game.bgFade='grandmas3';
13005
}
13006
13007
if (Game.bgType!=0 && Game.ascensionMode!=1)
13008
{
13009
Game.bgR=0;
13010
Game.bg=Game.BGsByChoice[Game.bgType].pic;
13011
Game.bgFade=Game.bg;
13012
}
13013
13014
Game.Background.fillPattern(Pic(Game.bg+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);
13015
if (Game.bgR>0)
13016
{
13017
Game.Background.globalAlpha=Game.bgR;
13018
Game.Background.fillPattern(Pic(Game.bgFade+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);
13019
}
13020
Game.Background.globalAlpha=1;
13021
Game.Background.drawImage(Pic('shadedBordersSoft.png'),0,0,Game.Background.canvas.width,Game.Background.canvas.height);
13022
}
13023
13024
}
13025
Timer.track('window background');
13026
13027
//clear
13028
ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
13029
/*if (Game.AscendTimer<Game.AscendBreakpoint) ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
13030
else
13031
{
13032
ctx.globalAlpha=0.05;
13033
ctx.fillStyle='#000';
13034
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
13035
ctx.globalAlpha=1;
13036
OldCanvasDrawImage.apply(ctx,[ctx.canvas,Math.random()*4-2,Math.random()*4-2-4]);
13037
ctx.globalAlpha=1;
13038
}*/
13039
Timer.clean();
13040
13041
var showDragon=0;
13042
if (Game.hasBuff('Dragonflight') || Game.hasBuff('Dragon Harvest')) showDragon=1;
13043
13044
Game.cookieOriginX=Math.floor(ctx.canvas.width/2);
13045
Game.cookieOriginY=Math.floor(ctx.canvas.height*0.4);
13046
13047
if (Game.AscendTimer==0)
13048
{
13049
if (Game.prefs.particles)
13050
{
13051
//falling cookies
13052
var pic='';
13053
var opacity=1;
13054
if (Game.elderWrathD<=1.5)
13055
{
13056
if (Game.cookiesPs>=1000) pic='cookieShower3.png';
13057
else if (Game.cookiesPs>=500) pic='cookieShower2.png';
13058
else if (Game.cookiesPs>=50) pic='cookieShower1.png';
13059
else pic='';
13060
}
13061
if (pic!='')
13062
{
13063
if (Game.elderWrathD>=1) opacity=1-((Math.min(Game.elderWrathD,1.5)-1)/0.5);
13064
ctx.globalAlpha=opacity;
13065
var y=(Math.floor(Game.T*2)%512);
13066
ctx.fillPattern(Pic(pic),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
13067
ctx.globalAlpha=1;
13068
}
13069
//snow
13070
if (Game.season=='christmas')
13071
{
13072
var y=(Math.floor(Game.T*2.5)%512);
13073
ctx.globalAlpha=0.75;
13074
ctx.globalCompositeOperation='lighter';
13075
ctx.fillPattern(Pic('snow2.jpg'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
13076
ctx.globalCompositeOperation='source-over';
13077
ctx.globalAlpha=1;
13078
}
13079
//hearts
13080
if (Game.season=='valentines')
13081
{
13082
var y=(Math.floor(Game.T*2.5)%512);
13083
ctx.globalAlpha=1;
13084
ctx.fillPattern(Pic('heartStorm.png'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
13085
ctx.globalAlpha=1;
13086
}
13087
Timer.track('left background');
13088
13089
Game.particlesDraw(0);
13090
ctx.globalAlpha=1;
13091
Timer.track('particles');
13092
13093
//big cookie shine
13094
var s=512;
13095
13096
var x=Game.cookieOriginX;
13097
var y=Game.cookieOriginY;
13098
13099
var r=Math.floor((Game.T*0.5)%360);
13100
ctx.save();
13101
ctx.translate(x,y);
13102
ctx.rotate((r/360)*Math.PI*2);
13103
var alphaMult=1;
13104
if (Game.bgType==2 || Game.bgType==4) alphaMult=0.5;
13105
var pic='shine.png';
13106
if (goodBuff) {pic='shineGold.png';alphaMult=1;}
13107
else if (badBuff) {pic='shineRed.png';alphaMult=1;}
13108
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';
13109
ctx.globalAlpha=0.5*alphaMult;
13110
ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);
13111
ctx.rotate((-r*2/360)*Math.PI*2);
13112
ctx.globalAlpha=0.25*alphaMult;
13113
ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);
13114
ctx.restore();
13115
Timer.track('shine');
13116
13117
if (Game.ReincarnateTimer>0)
13118
{
13119
ctx.globalAlpha=1-Game.ReincarnateTimer/Game.ReincarnateDuration;
13120
ctx.fillStyle='#000';
13121
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
13122
ctx.globalAlpha=1;
13123
}
13124
13125
if (showDragon)
13126
{
13127
//big dragon
13128
var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);
13129
var x=Game.cookieOriginX-s/2;
13130
var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));
13131
ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);
13132
}
13133
13134
//big cookie
13135
if (false)//don't do that
13136
{
13137
ctx.globalAlpha=1;
13138
var amount=Math.floor(Game.cookies).toString();
13139
var digits=amount.length;
13140
var space=0;
13141
for (var i=0;i<digits;i++)
13142
{
13143
var s=16*(digits-i);
13144
var num=parseInt(amount[i]);
13145
if (i>0) space-=s*(1-num/10)/2;
13146
if (i==0 && num>1) space+=s*0.1;
13147
for (var ii=0;ii<num;ii++)
13148
{
13149
var x=Game.cookieOriginX;
13150
var y=Game.cookieOriginY;
13151
var spin=Game.T*(0.005+i*0.001)+i+(ii/num)*Math.PI*2;
13152
x+=Math.sin(spin)*space;
13153
y+=Math.cos(spin)*space;
13154
ctx.drawImage(Pic('perfectCookie.png'),x-s/2,y-s/2,s,s);
13155
}
13156
space+=s/2;
13157
}
13158
}
13159
else
13160
{
13161
ctx.globalAlpha=1;
13162
var s=256*Game.BigCookieSize;
13163
var x=Game.cookieOriginX;
13164
var y=Game.cookieOriginY;
13165
ctx.save();
13166
ctx.translate(x,y);
13167
if (Game.season=='easter')
13168
{
13169
var nestW=304*0.98*Game.BigCookieSize;
13170
var nestH=161*0.98*Game.BigCookieSize;
13171
ctx.drawImage(Pic('nest.png'),-nestW/2,-nestH/2+130,nestW,nestH);
13172
}
13173
//ctx.rotate(((Game.startDate%360)/360)*Math.PI*2);
13174
ctx.drawImage(Pic('perfectCookie.png'),-s/2,-s/2,s,s);
13175
13176
if (goodBuff && Game.prefs.particles)//sparkle
13177
{
13178
ctx.globalCompositeOperation='lighter';
13179
for (var i=0;i<1;i++)
13180
{
13181
ctx.globalAlpha=Math.random()*0.65+0.1;
13182
var size=Math.random()*30+5;
13183
var a=Math.random()*Math.PI*2;
13184
var d=s*0.9*Math.random()/2;
13185
ctx.drawImage(Pic('glint.jpg'),-size/2+Math.sin(a)*d,-size/2+Math.cos(a)*d,size,size);
13186
}
13187
}
13188
13189
ctx.restore();
13190
Timer.track('big cookie');
13191
}
13192
}
13193
else//no particles
13194
{
13195
//big cookie shine
13196
var s=512;
13197
var x=Game.cookieOriginX-s/2;
13198
var y=Game.cookieOriginY-s/2;
13199
ctx.globalAlpha=0.5;
13200
ctx.drawImage(Pic('shine.png'),x,y,s,s);
13201
13202
if (showDragon)
13203
{
13204
//big dragon
13205
var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);
13206
var x=Game.cookieOriginX-s/2;
13207
var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));
13208
ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);
13209
}
13210
13211
//big cookie
13212
ctx.globalAlpha=1;
13213
var s=256*Game.BigCookieSize;
13214
var x=Game.cookieOriginX-s/2;
13215
var y=Game.cookieOriginY-s/2;
13216
ctx.drawImage(Pic('perfectCookie.png'),x,y,s,s);
13217
}
13218
13219
//cursors
13220
if (Game.prefs.cursors)
13221
{
13222
ctx.save();
13223
ctx.translate(Game.cookieOriginX,Game.cookieOriginY);
13224
var pic=Pic('cursor.png');
13225
var fancy=Game.prefs.fancy;
13226
13227
if (showDragon) ctx.globalAlpha=0.25;
13228
var amount=Game.Objects['Cursor'].amount;
13229
//var spe=-1;
13230
for (var i=0;i<amount;i++)
13231
{
13232
var n=Math.floor(i/50);
13233
//var a=((i+0.5*n)%50)/50;
13234
var w=0;
13235
if (fancy) w=(Math.sin(Game.T*0.025+(((i+n*12)%25)/25)*Math.PI*2));
13236
if (w>0.997) w=1.5;
13237
else if (w>0.994) w=0.5;
13238
else w=0;
13239
w*=-4;
13240
if (fancy) w+=Math.sin((n+Game.T*0.01)*Math.PI/2)*4;
13241
var x=0;
13242
var y=(140/* *Game.BigCookieSize*/+n*16+w)-16;
13243
13244
var rot=7.2;//(1/50)*360
13245
if (i==0 && fancy) rot-=Game.T*0.1;
13246
if (i%50==0) rot+=7.2/2;
13247
ctx.rotate((rot/360)*Math.PI*2);
13248
ctx.drawImage(pic,0,0,32,32,x,y,32,32);
13249
//ctx.drawImage(pic,32*(i==spe),0,32,32,x,y,32,32);
13250
13251
/*if (i==spe)
13252
{
13253
y+=16;
13254
x=Game.cookieOriginX+Math.sin(-((r-5)/360)*Math.PI*2)*y;
13255
y=Game.cookieOriginY+Math.cos(-((r-5)/360)*Math.PI*2)*y;
13256
if (Game.CanClick && ctx && Math.abs(Game.mouseX-x)<16 && Math.abs(Game.mouseY-y)<16) Game.mousePointer=1;
13257
}*/
13258
}
13259
ctx.restore();
13260
Timer.track('cursors');
13261
}
13262
}
13263
else
13264
{
13265
var tBase=Math.max(0,(Game.AscendTimer-Game.AscendBreakpoint)/(Game.AscendDuration-Game.AscendBreakpoint));
13266
//big crumbling cookie
13267
//var t=(3*Math.pow(tBase,2)-2*Math.pow(tBase,3));//S curve
13268
var t=Math.pow(tBase,0.5);
13269
13270
var shake=0;
13271
if (Game.AscendTimer<Game.AscendBreakpoint) {shake=Game.AscendTimer/Game.AscendBreakpoint;}
13272
//else {shake=1-t;}
13273
13274
ctx.globalAlpha=1;
13275
13276
var x=Game.cookieOriginX;
13277
var y=Game.cookieOriginY;
13278
13279
x+=(Math.random()*2-1)*10*shake;
13280
y+=(Math.random()*2-1)*10*shake;
13281
13282
var s=1;
13283
if (tBase>0)
13284
{
13285
ctx.save();
13286
ctx.globalAlpha=1-Math.pow(t,0.5);
13287
ctx.translate(x,y);
13288
ctx.globalCompositeOperation='lighter';
13289
ctx.rotate(Game.T*0.007);
13290
s=0.5+Math.pow(tBase,0.6)*1;
13291
var s2=(600)*s;
13292
ctx.drawImage(Pic('heavenRing1.jpg'),-s2/2,-s2/2,s2,s2);
13293
ctx.rotate(-Game.T*0.002);
13294
s=0.5+Math.pow(1-tBase,0.4)*1;
13295
s2=(600)*s;
13296
ctx.drawImage(Pic('heavenRing2.jpg'),-s2/2,-s2/2,s2,s2);
13297
ctx.restore();
13298
}
13299
13300
s=256;//*Game.BigCookieSize;
13301
13302
ctx.save();
13303
ctx.translate(x,y);
13304
ctx.rotate((t*(-0.1))*Math.PI*2);
13305
13306
var chunks={0:7,1:6,2:3,3:2,4:8,5:1,6:9,7:5,8:0,9:4};
13307
s*=t/2+1;
13308
/*ctx.globalAlpha=(1-t)*0.33;
13309
for (var i=0;i<10;i++)
13310
{
13311
var d=(t-0.2)*(80+((i+2)%3)*40);
13312
ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,s,s);
13313
}
13314
ctx.globalAlpha=(1-t)*0.66;
13315
for (var i=0;i<10;i++)
13316
{
13317
var d=(t-0.1)*(80+((i+2)%3)*40);
13318
ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d,s,s);
13319
}*/
13320
ctx.globalAlpha=1-t;
13321
for (var i=0;i<10;i++)
13322
{
13323
var d=(t)*(80+((i+2)%3)*40);
13324
var x2=(Math.random()*2-1)*5*shake;
13325
var y2=(Math.random()*2-1)*5*shake;
13326
ctx.drawImage(Pic('brokenCookie.png'),256*(chunks[i]),0,256,256,-s/2+Math.sin(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d+x2,-s/2+Math.cos(-(((chunks[i]+4)%10)/10)*Math.PI*2)*d+y2,s,s);
13327
}
13328
var brokenHalo=1-Math.min(t/(1/3),1/3)*3;
13329
if (Game.AscendTimer<Game.AscendBreakpoint) brokenHalo=Game.AscendTimer/Game.AscendBreakpoint;
13330
ctx.globalAlpha=brokenHalo;
13331
ctx.drawImage(Pic('brokenCookieHalo.png'),-s/1.3333,-s/1.3333,s*1.5,s*1.5);
13332
13333
ctx.restore();
13334
13335
//flares
13336
var n=9;
13337
var t=Game.AscendTimer/Game.AscendBreakpoint;
13338
if (Game.AscendTimer<Game.AscendBreakpoint)
13339
{
13340
ctx.save();
13341
ctx.translate(x,y);
13342
for (var i=0;i<n;i++)
13343
{
13344
if (Math.floor(t/3*n*3+i*2.7)%2)
13345
{
13346
var t2=Math.pow((t/3*n*3+i*2.7)%1,1.5);
13347
ctx.globalAlpha=(1-t)*(Game.drawT%2==0?0.5:1);
13348
var sw=(1-t2*0.5)*96;
13349
var sh=(0.5+t2*1.5)*96;
13350
ctx.drawImage(Pic('shineSpoke.png'),-sw/2,-sh-32-(1-t2)*256,sw,sh);
13351
}
13352
ctx.rotate(Math.PI*2/n);
13353
}
13354
ctx.restore();
13355
}
13356
13357
13358
//flash at breakpoint
13359
if (tBase<0.1 && tBase>0)
13360
{
13361
ctx.globalAlpha=1-tBase/0.1;
13362
ctx.fillStyle='#fff';
13363
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
13364
ctx.globalAlpha=1;
13365
}
13366
if (tBase>0.8)
13367
{
13368
ctx.globalAlpha=(tBase-0.8)/0.2;
13369
ctx.fillStyle='#000';
13370
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
13371
ctx.globalAlpha=1;
13372
}
13373
}
13374
13375
//milk and milk accessories
13376
if (Game.prefs.milk)
13377
{
13378
var width=ctx.canvas.width;
13379
var height=ctx.canvas.height;
13380
var x=Math.floor((Game.T*2-(Game.milkH-Game.milkHd)*2000+480*2)%480);//Math.floor((Game.T*2+Math.sin(Game.T*0.1)*2+Math.sin(Game.T*0.03)*2-(Game.milkH-Game.milkHd)*2000+480*2)%480);
13381
var y=(Game.milkHd)*height;//(((Game.milkHd)*ctx.canvas.height)*(1+0.05*(Math.sin(Game.T*0.017)/2+0.5)));
13382
var a=1;
13383
if (Game.AscendTimer>0)
13384
{
13385
y*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;
13386
a*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;
13387
}
13388
else if (Game.ReincarnateTimer>0)
13389
{
13390
y*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;
13391
a*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;
13392
}
13393
13394
if (Game.TOYS)
13395
{
13396
//golly
13397
if (!Game.Toy)
13398
{
13399
Game.toys=[];
13400
Game.toysType=choose([1,2]);
13401
Game.Toy=function(x,y)
13402
{
13403
this.id=Game.toys.length;
13404
this.x=x;
13405
this.y=y;
13406
this.xd=Math.random()*10-5;
13407
this.yd=Math.random()*10-5;
13408
this.r=Math.random()*Math.PI*2;
13409
this.rd=Math.random()*0.1-0.05;
13410
var v=Math.random();var a=0.5;var b=0.5;
13411
if (v<=a) v=b-b*Math.pow(1-v/a,3); else v=b+(1-b)*Math.pow((v-a)/(1-a),3);
13412
this.s=(Game.toysType==1?64:48)*(0.1+v*1.9);
13413
if (Game.toysType==2) this.s=(this.id%10==1)?96:48;
13414
this.st=this.s;this.s=0;
13415
var cookies=[[10,0]];
13416
for (var i in Game.Upgrades)
13417
{
13418
var cookie=Game.Upgrades[i];
13419
if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);
13420
}
13421
this.icon=choose(cookies);
13422
this.dragged=false;
13423
this.l=document.createElement('div');
13424
this.l.innerHTML=this.id;
13425
this.l.style.cssText='cursor:pointer;border-radius:'+(this.s/2)+'px;opacity:0;width:'+this.s+'px;height:'+this.s+'px;background:#999;position:absolute;left:0px;top:0px;z-index:10000000;transform:translate(-1000px,-1000px);';
13426
l('sectionLeft').appendChild(this.l);
13427
AddEvent(this.l,'mousedown',function(what){return function(){what.dragged=true;};}(this));
13428
AddEvent(this.l,'mouseup',function(what){return function(){what.dragged=false;};}(this));
13429
Game.toys.push(this);
13430
return this;
13431
}
13432
for (var i=0;i<Math.floor(Math.random()*15+(Game.toysType==1?5:30));i++)
13433
{
13434
new Game.Toy(Math.random()*width,Math.random()*height*0.3);
13435
}
13436
}
13437
ctx.globalAlpha=0.5;
13438
for (var i in Game.toys)
13439
{
13440
var me=Game.toys[i];
13441
ctx.save();
13442
ctx.translate(me.x,me.y);
13443
ctx.rotate(me.r);
13444
if (Game.toysType==1) ctx.drawImage(Pic('smallCookies.png'),(me.id%8)*64,0,64,64,-me.s/2,-me.s/2,me.s,me.s);
13445
else ctx.drawImage(Pic('icons.png'),me.icon[0]*48,me.icon[1]*48,48,48,-me.s/2,-me.s/2,me.s,me.s);
13446
ctx.restore();
13447
}
13448
ctx.globalAlpha=1;
13449
for (var i in Game.toys)
13450
{
13451
var me=Game.toys[i];
13452
//psst... not real physics
13453
for (var ii in Game.toys)
13454
{
13455
var it=Game.toys[ii];
13456
if (it.id!=me.id)
13457
{
13458
var x1=me.x+me.xd;
13459
var y1=me.y+me.yd;
13460
var x2=it.x+it.xd;
13461
var y2=it.y+it.yd;
13462
var dist=Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2))/(me.s/2+it.s/2);
13463
if (dist<(Game.toysType==1?0.95:0.75))
13464
{
13465
var angle=Math.atan2(y1-y2,x1-x2);
13466
var v1=Math.sqrt(Math.pow((me.xd),2)+Math.pow((me.yd),2));
13467
var v2=Math.sqrt(Math.pow((it.xd),2)+Math.pow((it.yd),2));
13468
var v=((v1+v2)/2+dist)*0.75;
13469
var ratio=it.s/me.s;
13470
me.xd+=Math.sin(-angle+Math.PI/2)*v*(ratio);
13471
me.yd+=Math.cos(-angle+Math.PI/2)*v*(ratio);
13472
it.xd+=Math.sin(-angle-Math.PI/2)*v*(1/ratio);
13473
it.yd+=Math.cos(-angle-Math.PI/2)*v*(1/ratio);
13474
me.rd+=(Math.random()*1-0.5)*0.1*(ratio);
13475
it.rd+=(Math.random()*1-0.5)*0.1*(1/ratio);
13476
me.rd*=Math.min(1,v);
13477
it.rd*=Math.min(1,v);
13478
}
13479
}
13480
}
13481
if (me.y>=height-(Game.milkHd)*height+8)
13482
{
13483
me.xd*=0.85;
13484
me.yd*=0.85;
13485
me.rd*=0.85;
13486
me.yd-=1;
13487
me.xd+=(Math.random()*1-0.5)*0.3;
13488
me.yd+=(Math.random()*1-0.5)*0.05;
13489
me.rd+=(Math.random()*1-0.5)*0.02;
13490
}
13491
else
13492
{
13493
me.xd*=0.99;
13494
me.rd*=0.99;
13495
me.yd+=1;
13496
}
13497
me.yd*=(Math.min(1,Math.abs(me.y-(height-(Game.milkHd)*height)/16)));
13498
me.rd+=me.xd*0.01/(me.s/(Game.toysType==1?64:48));
13499
if (me.x<me.s/2 && me.xd<0) me.xd=Math.max(0.1,-me.xd*0.6); else if (me.x<me.s/2) {me.xd=0;me.x=me.s/2;}
13500
if (me.x>width-me.s/2 && me.xd>0) me.xd=Math.min(-0.1,-me.xd*0.6); else if (me.x>width-me.s/2) {me.xd=0;me.x=width-me.s/2;}
13501
me.xd=Math.min(Math.max(me.xd,-30),30);
13502
me.yd=Math.min(Math.max(me.yd,-30),30);
13503
me.rd=Math.min(Math.max(me.rd,-0.5),0.5);
13504
me.x+=me.xd;
13505
me.y+=me.yd;
13506
me.r+=me.rd;
13507
me.r=me.r%(Math.PI*2);
13508
me.s+=(me.st-me.s)*0.5;
13509
if (Game.toysType==2 && !me.dragged && Math.random()<0.003) me.st=choose([48,48,48,48,96]);
13510
if (me.dragged)
13511
{
13512
me.x=Game.mouseX;
13513
me.y=Game.mouseY;
13514
me.xd+=((Game.mouseX-Game.mouseX2)*3-me.xd)*0.5;
13515
me.yd+=((Game.mouseY-Game.mouseY2)*3-me.yd)*0.5
13516
me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px) scale(50)';
13517
}
13518
else me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px)';
13519
me.l.style.width=me.s+'px';
13520
me.l.style.height=me.s+'px';
13521
ctx.save();
13522
ctx.translate(me.x,me.y);
13523
ctx.rotate(me.r);
13524
if (Game.toysType==1) ctx.drawImage(Pic('smallCookies.png'),(me.id%8)*64,0,64,64,-me.s/2,-me.s/2,me.s,me.s);
13525
else ctx.drawImage(Pic('icons.png'),me.icon[0]*48,me.icon[1]*48,48,48,-me.s/2,-me.s/2,me.s,me.s);
13526
ctx.restore();
13527
}
13528
}
13529
13530
var pic=Game.Milk.pic;
13531
if (Game.milkType!=0 && Game.ascensionMode!=1) pic=Game.MilksByChoice[Game.milkType].pic;
13532
ctx.globalAlpha=0.9*a;
13533
ctx.fillPattern(Pic(pic+'.png'),0,height-y,width+480,1,480,480,x,0);
13534
13535
ctx.fillStyle='#000';
13536
ctx.fillRect(0,height-y+480,width,Math.max(0,(y-480)));
13537
ctx.globalAlpha=1;
13538
13539
Timer.track('milk');
13540
}
13541
13542
if (Game.AscendTimer>0)
13543
{
13544
ctx.drawImage(Pic('shadedBordersSoft.png'),0,0,ctx.canvas.width,ctx.canvas.height);
13545
}
13546
13547
if (Game.AscendTimer==0)
13548
{
13549
Game.DrawWrinklers();Timer.track('wrinklers');
13550
Game.DrawSpecial();Timer.track('evolvables');
13551
13552
Game.particlesDraw(2);Timer.track('text particles');
13553
13554
//shiny border during frenzies etc
13555
ctx.globalAlpha=1;
13556
var borders='shadedBordersSoft.png';
13557
if (goodBuff) borders='shadedBordersGold.png';
13558
else if (badBuff) borders='shadedBordersRed.png';
13559
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';
13560
ctx.drawImage(Pic(borders),0,0,ctx.canvas.width,ctx.canvas.height);
13561
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='source-over';
13562
}
13563
}
13564
};
13565
13566
13567
/*=====================================================================================
13568
INITIALIZATION END; GAME READY TO LAUNCH
13569
=======================================================================================*/
13570
13571
Game.killShimmers();
13572
13573
//booooo
13574
Game.RuinTheFun=function(silent)
13575
{
13576
Game.popups=0;
13577
Game.SetAllUpgrades(1);
13578
Game.SetAllAchievs(1);
13579
Game.popups=0;
13580
Game.Earn(999999999999999999999999999999);
13581
Game.MaxSpecials();
13582
Game.nextResearch=0;
13583
Game.researchT=-1;
13584
Game.upgradesToRebuild=1;
13585
Game.recalculateGains=1;
13586
Game.popups=1;
13587
for (var i in Game.Objects)
13588
{
13589
var me=Game.Objects[i];
13590
me.level=9;
13591
me.levelUp();
13592
if (me.minigame && me.minigame.onRuinTheFun) me.minigame.onRuinTheFun();
13593
}
13594
if (!silent)
13595
{
13596
if (Game.prefs.popups) Game.Popup('Thou doth ruineth the fun!');
13597
else Game.Notify('Thou doth ruineth the fun!','You\'re free. Free at last.',[11,5]);
13598
}
13599
return 'You feel a bitter taste in your mouth...';
13600
}
13601
13602
Game.SetAllUpgrades=function(on)
13603
{
13604
Game.popups=0;
13605
var leftout=['Magic shenanigans','Occult obstruction','Glucose-charged air'];
13606
for (var i in Game.Upgrades)
13607
{
13608
if (on && (Game.Upgrades[i].pool=='toggle' || leftout.indexOf(Game.Upgrades[i].name)!=-1)) {}
13609
else if (on) Game.Upgrades[i].earn();
13610
else if (!on) Game.Upgrades[i].lose();
13611
}
13612
Game.upgradesToRebuild=1;
13613
Game.recalculateGains=1;
13614
Game.popups=1;
13615
}
13616
Game.SetAllAchievs=function(on)
13617
{
13618
Game.popups=0;
13619
for (var i in Game.Achievements)
13620
{
13621
if (on && Game.Achievements[i].pool!='dungeon') Game.Win(Game.Achievements[i].name);
13622
else if (!on) Game.RemoveAchiev(Game.Achievements[i].name);
13623
}
13624
Game.recalculateGains=1;
13625
Game.popups=1;
13626
}
13627
Game.GetAllDebugs=function()
13628
{
13629
Game.popups=0;
13630
for (var i in Game.Upgrades)
13631
{
13632
if (Game.Upgrades[i].pool=='debug') Game.Upgrades[i].earn();
13633
}
13634
Game.upgradesToRebuild=1;
13635
Game.recalculateGains=1;
13636
Game.popups=1;
13637
}
13638
Game.MaxSpecials=function()
13639
{
13640
Game.dragonLevel=Game.dragonLevels.length-1;
13641
Game.santaLevel=Game.santaLevels.length-1;
13642
}
13643
13644
Game.SesameReset=function()
13645
{
13646
var name=Game.bakeryName;
13647
Game.HardReset(2);
13648
Game.bakeryName=name;
13649
Game.bakeryNameRefresh();
13650
Game.Achievements['Cheated cookies taste awful'].won=1;
13651
}
13652
13653
Game.debugTimersOn=0;
13654
Game.sesame=0;
13655
Game.OpenSesame=function()
13656
{
13657
var str='';
13658
str+='<div class="icon" style="position:absolute;left:-9px;top:-6px;background-position:'+(-10*48)+'px '+(-6*48)+'px;"></div>';
13659
str+='<div style="position:absolute;left:0px;top:0px;z-index:10;font-size:10px;background:#000;padding:1px;" id="fpsCounter"></div>';
13660
13661
str+='<div id="devConsoleContent">';
13662
str+='<div class="title" style="font-size:14px;margin:6px;">Dev tools</div>';
13663
13664
str+='<a class="option neato" '+Game.clickStr+'="Game.Ascend(1);">Ascend</a>';
13665
str+='<div class="line"></div>';
13666
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=10;Game.cookiesEarned*=10;">x10</a>';
13667
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=10;Game.cookiesEarned/=10;">/10</a><br>';
13668
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=1000;Game.cookiesEarned*=1000;">x1k</a>';
13669
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=1000;Game.cookiesEarned/=1000;">/1k</a><br>';
13670
str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].buy(100);}">Buy 100 of all</a>';//for (var n=0;n<100;n++){for (var i in Game.Objects){Game.Objects[i].buy(1);}}
13671
str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].sell(100);}">Sell 100 of all</a><br>';
13672
str+='<a class="option neato" '+Game.clickStr+'="Game.gainLumps(10);">+10 lumps</a>';
13673
str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].level=0;Game.Objects[i].onMinigame=false;Game.Objects[i].refresh();}Game.recalculateGains=1;">Reset levels</a>';
13674
str+='<div class="line"></div>';
13675
str+='<a class="option warning" '+Game.clickStr+'="Game.RuinTheFun(1);">Ruin The Fun</a>';
13676
str+='<a class="option warning" '+Game.clickStr+'="Game.SesameReset();">Wipe</a>';
13677
str+='<a class="option neato" '+Game.clickStr+'="Game.GetAllDebugs();">All debugs</a>';
13678
str+='<a class="option neato" '+Game.clickStr+'="Game.debugTimersOn=!Game.debugTimersOn;Game.OpenSesame();">Timers '+(Game.debugTimersOn?'On':'Off')+'</a><br>';
13679
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(0);">No upgrades</a>';
13680
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(1);">All upgrades</a><br>';
13681
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(0);">No achievs</a>';
13682
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(1);">All achievs</a><br>';
13683
str+='<a class="option neato" '+Game.clickStr+'="Game.santaLevel=0;Game.dragonLevel=0;">Reset specials</a>';
13684
str+='<a class="option neato" '+Game.clickStr+'="Game.MaxSpecials();">Max specials</a><br>';
13685
str+='<a class="option neato" '+Game.clickStr+'="Game.lumpRefill=0;/*Date.now()-Game.getLumpRefillMax();*/">Reset refills</a>';
13686
str+='<a class="option neato" '+Game.clickStr+'="Game.EditAscend();">'+(Game.DebuggingPrestige?'Exit Ascend Edit':'Ascend Edit')+'</a>';
13687
str+='<a class="option neato" '+Game.clickStr+'="Game.DebugUpgradeCpS();">Debug upgrades CpS</a>';
13688
str+='<a class="option neato" '+Game.clickStr+'="Game.seed=Game.makeSeed();">Re-seed</a>';
13689
str+='<a class="option neato" '+Game.clickStr+'="Game.heralds=100;l(\'heraldsAmount\').textContent=Game.heralds;Game.externalDataLoaded=true;Game.recalculateGains=1;">Max heralds</a>';
13690
str+='<div class="line"></div>';
13691
for (var i=0;i<Game.goldenCookieChoices.length/2;i++)
13692
{
13693
str+='<a class="option neato" '+Game.clickStr+'="var newShimmer=new Game.shimmer(\'golden\');newShimmer.force=\''+Game.goldenCookieChoices[i*2+1]+'\';">'+Game.goldenCookieChoices[i*2]+'</a>';
13694
//str+='<a class="option neato" '+Game.clickStr+'="Game.goldenCookie.force=\''+Game.goldenCookie.choices[i*2+1]+'\';Game.goldenCookie.spawn();">'+Game.goldenCookie.choices[i*2]+'</a>';
13695
//str+='<a class="option neato" '+Game.clickStr+'="Game.goldenCookie.click(0,\''+Game.goldenCookie.choices[i*2+1]+'\');">'+Game.goldenCookie.choices[i*2]+'</a>';
13696
}
13697
str+='</div>';
13698
13699
l('devConsole').innerHTML=str;
13700
13701
if (!l('fpsGraph'))
13702
{
13703
var div=document.createElement('canvas');
13704
div.id='fpsGraph';
13705
div.width=128;
13706
div.height=64;
13707
div.style.opacity=0.5;
13708
div.style.pointerEvents='none';
13709
div.style.transformOrigin='0% 0%';
13710
div.style.transform='scale(0.75)';
13711
//l('devConsole').appendChild(div);
13712
l('devConsole').parentNode.insertBefore(div,l('devConsole').nextSibling);
13713
Game.fpsGraph=div;
13714
Game.fpsGraphCtx=Game.fpsGraph.getContext('2d',{alpha:false});
13715
var ctx=Game.fpsGraphCtx;
13716
ctx.fillStyle='#000';
13717
ctx.fillRect(0,0,128,64);
13718
}
13719
13720
l('debug').style.display='block';
13721
Game.sesame=1;
13722
Game.Achievements['Cheated cookies taste awful'].won=1;
13723
}
13724
13725
Game.EditAscend=function()
13726
{
13727
if (!Game.DebuggingPrestige)
13728
{
13729
Game.DebuggingPrestige=true;
13730
Game.AscendTimer=0;
13731
Game.OnAscend=1;
13732
Game.removeClass('ascendIntro');
13733
Game.addClass('ascending');
13734
}
13735
else
13736
{
13737
Game.DebuggingPrestige=false;
13738
}
13739
Game.BuildAscendTree();
13740
Game.OpenSesame();
13741
}
13742
13743
//experimental debugging function that cycles through every owned upgrade, turns it off and on, and lists how much each upgrade is participating to CpS
13744
Game.debuggedUpgradeCpS=[];
13745
Game.debuggedUpgradeCpClick=[];
13746
Game.debugColors=['#322','#411','#600','#900','#f30','#f90','#ff0','#9f0','#0f9','#09f','#90f'];
13747
Game.DebugUpgradeCpS=function()
13748
{
13749
Game.CalculateGains();
13750
Game.debuggedUpgradeCpS=[];
13751
Game.debuggedUpgradeCpClick=[];
13752
var CpS=Game.cookiesPs;
13753
var CpClick=Game.computedMouseCps;
13754
for (var i in Game.Upgrades)
13755
{
13756
var me=Game.Upgrades[i];
13757
if (me.bought)
13758
{
13759
me.bought=0;
13760
Game.CalculateGains();
13761
//Game.debuggedUpgradeCpS[me.name]=CpS-Game.cookiesPs;
13762
Game.debuggedUpgradeCpS[me.name]=(CpS/(Game.cookiesPs||1)-1);
13763
Game.debuggedUpgradeCpClick[me.name]=(CpClick/(Game.computedMouseCps||1)-1);
13764
me.bought=1;
13765
}
13766
}
13767
Game.CalculateGains();
13768
}
13769
13770
13771
//Game.runModHook('init');
13772
13773
13774
if (!Game.LoadSave())
13775
{//try to load the save when we open the page. if this fails, try to brute-force it half a second later
13776
setTimeout(function(){
13777
var local=Game.localStorageGet(Game.SaveTo);
13778
Game.LoadSave(local);
13779
},500);
13780
}
13781
13782
Game.ready=1;
13783
setTimeout(function(){if (typeof showAds==='undefined' && (!l('detectAds') || l('detectAds').clientHeight<1)) Game.addClass('noAds');},500);
13784
l('javascriptError').innerHTML='';
13785
l('javascriptError').style.display='none';
13786
Game.Loop();
13787
Game.Draw();
13788
}
13789
/*=====================================================================================
13790
LOGIC
13791
=======================================================================================*/
13792
Game.Logic=function()
13793
{
13794
Game.bounds=Game.l.getBoundingClientRect();
13795
13796
if (!Game.OnAscend && Game.AscendTimer==0)
13797
{
13798
for (var i in Game.Objects)
13799
{
13800
if (Game.Objects[i].eachFrame) Game.Objects[i].eachFrame();
13801
}
13802
Game.UpdateSpecial();
13803
Game.UpdateGrandmapocalypse();
13804
13805
//these are kinda fun
13806
//if (Game.BigCookieState==2 && !Game.promptOn && Game.Scroll!=0) Game.ClickCookie();
13807
//if (Game.BigCookieState==1 && !Game.promptOn) Game.ClickCookie();
13808
13809
//handle graphic stuff
13810
if (Game.prefs.wobbly)
13811
{
13812
if (Game.BigCookieState==1) Game.BigCookieSizeT=0.98;
13813
else if (Game.BigCookieState==2) Game.BigCookieSizeT=1.05;
13814
else Game.BigCookieSizeT=1;
13815
Game.BigCookieSizeD+=(Game.BigCookieSizeT-Game.BigCookieSize)*0.75;
13816
Game.BigCookieSizeD*=0.75;
13817
Game.BigCookieSize+=Game.BigCookieSizeD;
13818
Game.BigCookieSize=Math.max(0.1,Game.BigCookieSize);
13819
}
13820
else
13821
{
13822
if (Game.BigCookieState==1) Game.BigCookieSize+=(0.98-Game.BigCookieSize)*0.5;
13823
else if (Game.BigCookieState==2) Game.BigCookieSize+=(1.05-Game.BigCookieSize)*0.5;
13824
else Game.BigCookieSize+=(1-Game.BigCookieSize)*0.5;
13825
}
13826
Game.particlesUpdate();
13827
13828
if (Game.mousePointer) l('sectionLeft').style.cursor='pointer';
13829
else l('sectionLeft').style.cursor='auto';
13830
Game.mousePointer=0;
13831
13832
//handle milk and milk accessories
13833
Game.milkProgress=Game.AchievementsOwned/25;
13834
if (Game.milkProgress>=0.5) Game.Unlock('Kitten helpers');
13835
if (Game.milkProgress>=1) Game.Unlock('Kitten workers');
13836
if (Game.milkProgress>=2) Game.Unlock('Kitten engineers');
13837
if (Game.milkProgress>=3) Game.Unlock('Kitten overseers');
13838
if (Game.milkProgress>=4) Game.Unlock('Kitten managers');
13839
if (Game.milkProgress>=5) Game.Unlock('Kitten accountants');
13840
if (Game.milkProgress>=6) Game.Unlock('Kitten specialists');
13841
if (Game.milkProgress>=7) Game.Unlock('Kitten experts');
13842
if (Game.milkProgress>=8) Game.Unlock('Kitten consultants');
13843
if (Game.milkProgress>=9) Game.Unlock('Kitten assistants to the regional manager');
13844
if (Game.milkProgress>=10) Game.Unlock('Kitten marketeers');
13845
if (Game.milkProgress>=11) Game.Unlock('Kitten analysts');
13846
if (Game.milkProgress>=12) Game.Unlock('Kitten executives');
13847
Game.milkH=Math.min(1,Game.milkProgress)*0.35;
13848
Game.milkHd+=(Game.milkH-Game.milkHd)*0.02;
13849
13850
Game.Milk=Game.Milks[Math.min(Math.floor(Game.milkProgress),Game.Milks.length-1)];
13851
13852
if (Game.autoclickerDetected>0) Game.autoclickerDetected--;
13853
13854
//handle research
13855
if (Game.researchT>0)
13856
{
13857
Game.researchT--;
13858
}
13859
if (Game.researchT==0 && Game.nextResearch)
13860
{
13861
if (!Game.Has(Game.UpgradesById[Game.nextResearch].name))
13862
{
13863
Game.Unlock(Game.UpgradesById[Game.nextResearch].name);
13864
if (Game.prefs.popups) Game.Popup('Researched : '+Game.UpgradesById[Game.nextResearch].name);
13865
else Game.Notify('Research complete','You have discovered : <b>'+Game.UpgradesById[Game.nextResearch].name+'</b>.',Game.UpgradesById[Game.nextResearch].icon);
13866
}
13867
Game.nextResearch=0;
13868
Game.researchT=-1;
13869
Game.recalculateGains=1;
13870
}
13871
//handle seasons
13872
if (Game.seasonT>0)
13873
{
13874
Game.seasonT--;
13875
}
13876
if (Game.seasonT<=0 && Game.season!='' && Game.season!=Game.baseSeason && !Game.Has('Eternal seasons'))
13877
{
13878
var str=Game.seasons[Game.season].over;
13879
if (Game.prefs.popups) Game.Popup(str);
13880
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);
13881
if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}
13882
Game.season=Game.baseSeason;
13883
Game.seasonT=-1;
13884
}
13885
13886
//press ctrl to bulk-buy 10, shift to bulk-buy 100
13887
if (!Game.promptOn)
13888
{
13889
if ((Game.keys[16] || Game.keys[17]) && !Game.buyBulkShortcut)
13890
{
13891
Game.buyBulkOld=Game.buyBulk;
13892
if (Game.keys[16]) Game.buyBulk=100;
13893
if (Game.keys[17]) Game.buyBulk=10;
13894
Game.buyBulkShortcut=1;
13895
Game.storeBulkButton(-1);
13896
}
13897
}
13898
if ((!Game.keys[16] && !Game.keys[17]) && Game.buyBulkShortcut)//release
13899
{
13900
Game.buyBulk=Game.buyBulkOld;
13901
Game.buyBulkShortcut=0;
13902
Game.storeBulkButton(-1);
13903
}
13904
13905
//handle cookies
13906
if (Game.recalculateGains) Game.CalculateGains();
13907
Game.Earn(Game.cookiesPs/Game.fps);//add cookies per second
13908
13909
//grow lumps
13910
Game.doLumps();
13911
13912
//minigames
13913
for (var i in Game.Objects)
13914
{
13915
var me=Game.Objects[i];
13916
if (Game.isMinigameReady(me) && me.minigame.logic && Game.ascensionMode!=1) me.minigame.logic();
13917
}
13918
13919
if (Game.specialTab!='' && Game.T%(Game.fps*3)==0) Game.ToggleSpecialMenu(1);
13920
13921
//wrinklers
13922
if (Game.cpsSucked>0)
13923
{
13924
Game.Dissolve((Game.cookiesPs/Game.fps)*Game.cpsSucked);
13925
Game.cookiesSucked+=((Game.cookiesPs/Game.fps)*Game.cpsSucked);
13926
//should be using one of the following, but I'm not sure what I'm using this stat for anymore
13927
//Game.cookiesSucked=Game.wrinklers.reduce(function(s,w){return s+w.sucked;},0);
13928
//for (var i in Game.wrinklers) {Game.cookiesSucked+=Game.wrinklers[i].sucked;}
13929
}
13930
13931
//var cps=Game.cookiesPs+Game.cookies*0.01;//exponential cookies
13932
//Game.Earn(cps/Game.fps);//add cookies per second
13933
13934
for (var i in Game.Objects)
13935
{
13936
var me=Game.Objects[i];
13937
me.totalCookies+=(me.storedTotalCps*Game.globalCpsMult)/Game.fps;
13938
}
13939
if (Game.cookies && Game.T%Math.ceil(Game.fps/Math.min(10,Game.cookiesPs))==0 && Game.prefs.particles) Game.particleAdd();//cookie shower
13940
13941
if (Game.T%(Game.fps*10)==0) Game.recalculateGains=1;//recalculate CpS every 10 seconds (for dynamic boosts such as Century egg)
13942
13943
/*=====================================================================================
13944
UNLOCKING STUFF
13945
=======================================================================================*/
13946
if (Game.T%(Game.fps)==0 && Math.random()<1/500000) Game.Win('Just plain lucky');//1 chance in 500,000 every second achievement
13947
if (Game.T%(Game.fps*5)==0 && Game.ObjectsById.length>0)//check some achievements and upgrades
13948
{
13949
if (isNaN(Game.cookies)) {Game.cookies=0;Game.cookiesEarned=0;Game.recalculateGains=1;}
13950
13951
var timePlayed=new Date();
13952
timePlayed.setTime(Date.now()-Game.startDate);
13953
13954
if (!Game.fullDate || (Date.now()-Game.fullDate)>=365*24*60*60*1000) Game.Win('So much to do so much to see');
13955
13956
if (Game.cookiesEarned>=1000000 && (Game.ascensionMode==1 || Game.resets==0))//challenge run or hasn't ascended yet
13957
{
13958
if (timePlayed<=1000*60*35) Game.Win('Speed baking I');
13959
if (timePlayed<=1000*60*25) Game.Win('Speed baking II');
13960
if (timePlayed<=1000*60*15) Game.Win('Speed baking III');
13961
13962
if (Game.cookieClicks<=15) Game.Win('Neverclick');
13963
if (Game.cookieClicks<=0) Game.Win('True Neverclick');
13964
if (Game.cookiesEarned>=1000000000 && Game.UpgradesOwned==0) Game.Win('Hardcore');
13965
}
13966
13967
for (var i in Game.UnlockAt)
13968
{
13969
var unlock=Game.UnlockAt[i];
13970
if (Game.cookiesEarned>=unlock.cookies)
13971
{
13972
var pass=1;
13973
if (unlock.require && !Game.Has(unlock.require) && !Game.HasAchiev(unlock.require)) pass=0;
13974
if (unlock.season && Game.season!=unlock.season) pass=0;
13975
if (pass) {Game.Unlock(unlock.name);Game.Win(unlock.name);}
13976
}
13977
}
13978
13979
if (Game.Has('Golden switch')) Game.Unlock('Golden switch [off]');
13980
if (Game.Has('Shimmering veil') && !Game.Has('Shimmering veil [off]') && !Game.Has('Shimmering veil [on]')) {Game.Unlock('Shimmering veil [on]');Game.Upgrades['Shimmering veil [off]'].earn();}
13981
if (Game.Has('Sugar craving')) Game.Unlock('Sugar frenzy');
13982
if (Game.Has('Classic dairy selection')) Game.Unlock('Milk selector');
13983
if (Game.Has('Basic wallpaper assortment')) Game.Unlock('Background selector');
13984
if (Game.Has('Golden cookie alert sound')) Game.Unlock('Golden cookie sound selector');
13985
13986
if (Game.Has('Prism heart biscuits')) Game.Win('Lovely cookies');
13987
if (Game.season=='easter')
13988
{
13989
var eggs=0;
13990
for (var i in Game.easterEggs)
13991
{
13992
if (Game.HasUnlocked(Game.easterEggs[i])) eggs++;
13993
}
13994
if (eggs>=1) Game.Win('The hunt is on');
13995
if (eggs>=7) Game.Win('Egging on');
13996
if (eggs>=14) Game.Win('Mass Easteria');
13997
if (eggs>=Game.easterEggs.length) Game.Win('Hide & seek champion');
13998
}
13999
14000
if (Game.Has('Fortune cookies'))
14001
{
14002
var list=Game.Tiers['fortune'].upgrades;
14003
var fortunes=0;
14004
for (var i in list)
14005
{
14006
if (Game.Has(list[i].name)) fortunes++;
14007
}
14008
if (fortunes>=list.length) Game.Win('O Fortuna');
14009
}
14010
14011
if (Game.Has('Legacy') && Game.ascensionMode!=1)
14012
{
14013
Game.Unlock('Heavenly chip secret');
14014
if (Game.Has('Heavenly chip secret')) Game.Unlock('Heavenly cookie stand');
14015
if (Game.Has('Heavenly cookie stand')) Game.Unlock('Heavenly bakery');
14016
if (Game.Has('Heavenly bakery')) Game.Unlock('Heavenly confectionery');
14017
if (Game.Has('Heavenly confectionery')) Game.Unlock('Heavenly key');
14018
14019
if (Game.Has('Heavenly key')) Game.Win('Wholesome');
14020
}
14021
14022
for (var i in Game.BankAchievements)
14023
{
14024
if (Game.cookiesEarned>=Game.BankAchievements[i].threshold) Game.Win(Game.BankAchievements[i].name);
14025
}
14026
14027
var buildingsOwned=0;
14028
var mathematician=1;
14029
var base10=1;
14030
var minAmount=100000;
14031
for (var i in Game.Objects)
14032
{
14033
buildingsOwned+=Game.Objects[i].amount;
14034
minAmount=Math.min(Game.Objects[i].amount,minAmount);
14035
if (!Game.HasAchiev('Mathematician')) {if (Game.Objects[i].amount<Math.min(128,Math.pow(2,(Game.ObjectsById.length-Game.Objects[i].id)-1))) mathematician=0;}
14036
if (!Game.HasAchiev('Base 10')) {if (Game.Objects[i].amount<(Game.ObjectsById.length-Game.Objects[i].id)*10) base10=0;}
14037
}
14038
if (minAmount>=1) Game.Win('One with everything');
14039
if (mathematician==1) Game.Win('Mathematician');
14040
if (base10==1) Game.Win('Base 10');
14041
if (minAmount>=100) {Game.Win('Centennial');Game.Unlock('Milk chocolate butter biscuit');}
14042
if (minAmount>=150) {Game.Win('Centennial and a half');Game.Unlock('Dark chocolate butter biscuit');}
14043
if (minAmount>=200) {Game.Win('Bicentennial');Game.Unlock('White chocolate butter biscuit');}
14044
if (minAmount>=250) {Game.Win('Bicentennial and a half');Game.Unlock('Ruby chocolate butter biscuit');}
14045
if (minAmount>=300) {Game.Win('Tricentennial');Game.Unlock('Lavender chocolate butter biscuit');}
14046
if (minAmount>=350) {Game.Win('Tricentennial and a half');Game.Unlock('Synthetic chocolate green honey butter biscuit');}
14047
if (minAmount>=400) {Game.Win('Quadricentennial');Game.Unlock('Royal raspberry chocolate butter biscuit');}
14048
if (minAmount>=450) {Game.Win('Quadricentennial and a half');Game.Unlock('Ultra-concentrated high-energy chocolate butter biscuit');}
14049
if (minAmount>=500) {Game.Win('Quincentennial');Game.Unlock('Pure pitch-black chocolate butter biscuit');}
14050
if (minAmount>=550) {Game.Win('Quincentennial and a half');Game.Unlock('Cosmic chocolate butter biscuit');}
14051
if (minAmount>=600) {Game.Win('Sexcentennial');Game.Unlock('Butter biscuit (with butter)');}
14052
14053
if (Game.handmadeCookies>=1000) {Game.Win('Clicktastic');Game.Unlock('Plastic mouse');}
14054
if (Game.handmadeCookies>=100000) {Game.Win('Clickathlon');Game.Unlock('Iron mouse');}
14055
if (Game.handmadeCookies>=10000000) {Game.Win('Clickolympics');Game.Unlock('Titanium mouse');}
14056
if (Game.handmadeCookies>=1000000000) {Game.Win('Clickorama');Game.Unlock('Adamantium mouse');}
14057
if (Game.handmadeCookies>=100000000000) {Game.Win('Clickasmic');Game.Unlock('Unobtainium mouse');}
14058
if (Game.handmadeCookies>=10000000000000) {Game.Win('Clickageddon');Game.Unlock('Eludium mouse');}
14059
if (Game.handmadeCookies>=1000000000000000) {Game.Win('Clicknarok');Game.Unlock('Wishalloy mouse');}
14060
if (Game.handmadeCookies>=100000000000000000) {Game.Win('Clickastrophe');Game.Unlock('Fantasteel mouse');}
14061
if (Game.handmadeCookies>=10000000000000000000) {Game.Win('Clickataclysm');Game.Unlock('Nevercrack mouse');}
14062
if (Game.handmadeCookies>=1000000000000000000000) {Game.Win('The ultimate clickdown');Game.Unlock('Armythril mouse');}
14063
if (Game.handmadeCookies>=100000000000000000000000) {Game.Win('All the other kids with the pumped up clicks');Game.Unlock('Technobsidian mouse');}
14064
if (Game.handmadeCookies>=10000000000000000000000000) {Game.Win('One...more...click...');Game.Unlock('Plasmarble mouse');}
14065
if (Game.handmadeCookies>=1000000000000000000000000000) {Game.Win('Clickety split');Game.Unlock('Miraculite mouse');}
14066
14067
if (Game.cookiesEarned<Game.cookies) Game.Win('Cheated cookies taste awful');
14068
14069
if (Game.Has('Skull cookies') && Game.Has('Ghost cookies') && Game.Has('Bat cookies') && Game.Has('Slime cookies') && Game.Has('Pumpkin cookies') && Game.Has('Eyeball cookies') && Game.Has('Spider cookies')) Game.Win('Spooky cookies');
14070
if (Game.wrinklersPopped>=1) Game.Win('Itchscratcher');
14071
if (Game.wrinklersPopped>=50) Game.Win('Wrinklesquisher');
14072
if (Game.wrinklersPopped>=200) Game.Win('Moistburster');
14073
14074
if (Game.cookiesEarned>=1000000 && Game.Has('How to bake your dragon')) Game.Unlock('A crumbly egg');
14075
14076
if (Game.cookiesEarned>=25 && Game.season=='christmas') Game.Unlock('A festive hat');
14077
if (Game.Has('Christmas tree biscuits') && Game.Has('Snowflake biscuits') && Game.Has('Snowman biscuits') && Game.Has('Holly biscuits') && Game.Has('Candy cane biscuits') && Game.Has('Bell biscuits') && Game.Has('Present biscuits')) Game.Win('Let it snow');
14078
14079
if (Game.reindeerClicked>=1) Game.Win('Oh deer');
14080
if (Game.reindeerClicked>=50) Game.Win('Sleigh of hand');
14081
if (Game.reindeerClicked>=200) Game.Win('Reindeer sleigher');
14082
14083
if (buildingsOwned>=100) Game.Win('Builder');
14084
if (buildingsOwned>=500) Game.Win('Architect');
14085
if (buildingsOwned>=1000) Game.Win('Engineer');
14086
if (buildingsOwned>=2000) Game.Win('Lord of Constructs');
14087
if (buildingsOwned>=4000) Game.Win('Grand design');
14088
if (buildingsOwned>=8000) Game.Win('Ecumenopolis');
14089
if (Game.UpgradesOwned>=20) Game.Win('Enhancer');
14090
if (Game.UpgradesOwned>=50) Game.Win('Augmenter');
14091
if (Game.UpgradesOwned>=100) Game.Win('Upgrader');
14092
if (Game.UpgradesOwned>=200) Game.Win('Lord of Progress');
14093
if (Game.UpgradesOwned>=300) Game.Win('The full picture');
14094
if (Game.UpgradesOwned>=400) Game.Win('When there\'s nothing left to add');
14095
if (buildingsOwned>=4000 && Game.UpgradesOwned>=300) Game.Win('Polymath');
14096
if (buildingsOwned>=8000 && Game.UpgradesOwned>=400) Game.Win('Renaissance baker');
14097
14098
if (!Game.HasAchiev('Jellicles'))
14099
{
14100
var kittens=0;
14101
for (var i=0;i<Game.UpgradesByPool['kitten'].length;i++)
14102
{
14103
if (Game.Has(Game.UpgradesByPool['kitten'][i].name)) kittens++;
14104
}
14105
if (kittens>=10) Game.Win('Jellicles');
14106
}
14107
14108
if (Game.cookiesEarned>=10000000000000 && !Game.HasAchiev('You win a cookie')) {Game.Win('You win a cookie');Game.Earn(1);}
14109
14110
if (Game.shimmerTypes['golden'].n>=4) Game.Win('Four-leaf cookie');
14111
14112
var grandmas=0;
14113
for (var i in Game.GrandmaSynergies)
14114
{
14115
if (Game.Has(Game.GrandmaSynergies[i])) grandmas++;
14116
}
14117
if (!Game.HasAchiev('Elder') && grandmas>=7) Game.Win('Elder');
14118
if (!Game.HasAchiev('Veteran') && grandmas>=14) Game.Win('Veteran');
14119
if (Game.Objects['Grandma'].amount>=6 && !Game.Has('Bingo center/Research facility') && Game.HasAchiev('Elder')) Game.Unlock('Bingo center/Research facility');
14120
if (Game.pledges>0) Game.Win('Elder nap');
14121
if (Game.pledges>=5) Game.Win('Elder slumber');
14122
if (Game.pledges>=10) Game.Unlock('Sacrificial rolling pins');
14123
if (Game.Objects['Cursor'].amount+Game.Objects['Grandma'].amount>=777) Game.Win('The elder scrolls');
14124
14125
for (var i in Game.Objects)
14126
{
14127
var it=Game.Objects[i];
14128
for (var ii in it.productionAchievs)
14129
{
14130
if (it.totalCookies>=it.productionAchievs[ii].pow) Game.Win(it.productionAchievs[ii].achiev.name);
14131
}
14132
}
14133
14134
if (!Game.HasAchiev('Cookie-dunker') && Game.LeftBackground && Game.milkProgress>0.1 && (Game.LeftBackground.canvas.height*0.4+256/2-16)>((1-Game.milkHd)*Game.LeftBackground.canvas.height)) Game.Win('Cookie-dunker');
14135
//&& l('bigCookie').getBoundingClientRect().bottom>l('milk').getBoundingClientRect().top+16 && Game.milkProgress>0.1) Game.Win('Cookie-dunker');
14136
14137
Game.runModHook('check');
14138
}
14139
14140
Game.cookiesd+=(Game.cookies-Game.cookiesd)*0.3;
14141
14142
if (Game.storeToRefresh) Game.RefreshStore();
14143
if (Game.upgradesToRebuild) Game.RebuildUpgrades();
14144
14145
Game.updateShimmers();
14146
Game.updateBuffs();
14147
14148
Game.UpdateTicker();
14149
}
14150
14151
if (Game.T%(Game.fps*2)==0)
14152
{
14153
var title='Cookie Clicker';
14154
if (Game.season=='fools') title='Cookie Baker';
14155
document.title=(Game.OnAscend?'Ascending! ':'')+Beautify(Game.cookies)+' '+(Game.cookies==1?'cookie':'cookies')+' - '+title;
14156
}
14157
if (Game.T%15==0)
14158
{
14159
//written through the magic of "hope for the best" maths
14160
var chipsOwned=Game.HowMuchPrestige(Game.cookiesReset);
14161
var ascendNowToOwn=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));
14162
var ascendNowToGet=ascendNowToOwn-Math.floor(chipsOwned);
14163
var nextChipAt=Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet+1))-Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet));
14164
var cookiesToNext=Game.HowManyCookiesReset(ascendNowToOwn+1)-(Game.cookiesEarned+Game.cookiesReset);
14165
var percent=1-(cookiesToNext/nextChipAt);
14166
14167
//fill the tooltip under the Legacy tab
14168
var date=new Date();
14169
date.setTime(Date.now()-Game.startDate);
14170
var timeInSeconds=date.getTime()/1000;
14171
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
14172
14173
var str='';
14174
str+='You\'ve been on this run for <b>'+(startDate==''?'not very long':(startDate))+'</b>.<br>';
14175
str+='<div class="line"></div>';
14176
if (Game.prestige>0)
14177
{
14178
str+='Your prestige level is currently <b>'+Beautify(Game.prestige)+'</b>.<br>(CpS +'+Beautify(Game.prestige)+'%)';
14179
str+='<div class="line"></div>';
14180
}
14181
if (ascendNowToGet<1) str+='Ascending now would grant you no prestige.';
14182
else if (ascendNowToGet<2) str+='Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
14183
else str+='Ascending now would grant you<br><b>'+Beautify(ascendNowToGet)+' prestige levels</b> (+'+Beautify(ascendNowToGet)+'% CpS)<br>and <b>'+Beautify(ascendNowToGet)+' heavenly chips</b> to spend.';
14184
str+='<div class="line"></div>';
14185
str+='You need <b>'+Beautify(cookiesToNext)+' more cookies</b> for the next level.<br>';
14186
l('ascendTooltip').innerHTML=str;
14187
14188
if (ascendNowToGet>0)//show number saying how many chips you'd get resetting now
14189
{
14190
Game.ascendNumber.textContent='+'+SimpleBeautify(ascendNowToGet);
14191
Game.ascendNumber.style.display='block';
14192
}
14193
else
14194
{
14195
Game.ascendNumber.style.display='none';
14196
}
14197
14198
if (ascendNowToGet>Game.ascendMeterLevel || Game.ascendMeterPercentT<Game.ascendMeterPercent)
14199
{
14200
//reset the gauge and play a sound if we gained a potential level
14201
Game.ascendMeterPercent=0;
14202
//PlaySound('snd/levelPrestige.mp3');//a bit too annoying
14203
}
14204
Game.ascendMeterLevel=ascendNowToGet;
14205
Game.ascendMeterPercentT=percent;//gauge that fills up as you near your next chip
14206
//if (Game.ascendMeterPercentT<Game.ascendMeterPercent) {Game.ascendMeterPercent=0;PlaySound('snd/levelPrestige.mp3',0.5);}
14207
//if (percent>=1) {Game.ascendMeter.className='';} else Game.ascendMeter.className='filling';
14208
}
14209
//Game.ascendMeter.style.right=Math.floor(Math.max(0,1-Game.ascendMeterPercent)*100)+'px';
14210
Game.ascendMeter.style.transform='translate('+Math.floor(-Math.max(0,1-Game.ascendMeterPercent)*100)+'px,0px)';
14211
Game.ascendMeterPercent+=(Game.ascendMeterPercentT-Game.ascendMeterPercent)*0.1;
14212
14213
Game.NotesLogic();
14214
if (Game.mouseMoved || Game.Scroll || Game.tooltip.dynamic) Game.tooltip.update();
14215
14216
if (Game.T%(Game.fps*5)==0 && !Game.mouseDown && (Game.onMenu=='stats' || Game.onMenu=='prefs')) Game.UpdateMenu();
14217
if (Game.T%(Game.fps*1)==0) Game.UpdatePrompt();
14218
if (Game.AscendTimer>0) Game.UpdateAscendIntro();
14219
if (Game.ReincarnateTimer>0) Game.UpdateReincarnateIntro();
14220
if (Game.OnAscend) Game.UpdateAscend();
14221
14222
Game.runModHook('logic');
14223
14224
if (Game.sparklesT>0)
14225
{
14226
Game.sparkles.style.backgroundPosition=-Math.floor((Game.sparklesFrames-Game.sparklesT+1)*128)+'px 0px';
14227
Game.sparklesT--;
14228
if (Game.sparklesT==1) Game.sparkles.style.display='none';
14229
}
14230
14231
Game.Click=0;
14232
Game.Scroll=0;
14233
Game.mouseMoved=0;
14234
Game.CanClick=1;
14235
14236
if ((Game.toSave || (Game.T%(Game.fps*60)==0 && Game.T>Game.fps*10 && Game.prefs.autosave)) && !Game.OnAscend)
14237
{
14238
//check if we can save : no minigames are loading
14239
var canSave=true;
14240
for (var i in Game.Objects)
14241
{
14242
var me=Game.Objects[i];
14243
if (me.minigameLoading){canSave=false;break;}
14244
}
14245
if (canSave) Game.WriteSave();
14246
}
14247
14248
//every 30 minutes : get server data (ie. update notification, patreon data)
14249
if (Game.T%(Game.fps*60*30)==0 && Game.T>Game.fps*10/* && Game.prefs.autoupdate*/) {Game.CheckUpdates();Game.GrabData();}
14250
14251
Game.T++;
14252
}
14253
14254
// G-98DP5VKS42
14255
14256
/*=====================================================================================
14257
DRAW
14258
=======================================================================================*/
14259
14260
Game.Draw=function()
14261
{
14262
Game.DrawBackground();Timer.track('end of background');
14263
14264
if (!Game.OnAscend)
14265
{
14266
14267
var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies');
14268
var str=Beautify(Math.round(Game.cookiesd));
14269
if (Game.cookiesd>=1000000)//dirty padding
14270
{
14271
var spacePos=str.indexOf(' ');
14272
var dotPos=str.indexOf('.');
14273
var add='';
14274
if (spacePos!=-1)
14275
{
14276
if (dotPos==-1) add+='.000';
14277
else
14278
{
14279
if (spacePos-dotPos==2) add+='00';
14280
if (spacePos-dotPos==3) add+='0';
14281
}
14282
}
14283
str=[str.slice(0, spacePos),add,str.slice(spacePos)].join('');
14284
}
14285
if (str.length>11 && !Game.mobile) unit='<br>cookies';
14286
str+=unit;
14287
if (Game.prefs.monospace) str='<span class="monospace">'+str+'</span>';
14288
str=str+'<div style="font-size:50%;"'+(Game.cpsSucked>0?' class="warning"':'')+'>per second : '+Beautify(Game.cookiesPs*(1-Game.cpsSucked),1)+'</div>';//display cookie amount
14289
l('cookies').innerHTML=str;
14290
l('compactCookies').innerHTML=str;
14291
Timer.track('cookie amount');
14292
14293
for (var i in Game.Objects)
14294
{
14295
var me=Game.Objects[i];
14296
if (me.onMinigame && me.minigame.draw && !me.muted && !Game.onMenu) me.minigame.draw();
14297
}
14298
Timer.track('draw minigames');
14299
14300
if (Game.drawT%5==0)
14301
{
14302
//if (Game.prefs.monospace) {l('cookies').className='title monospace';} else {l('cookies').className='title';}
14303
var lastLocked=0;
14304
for (var i in Game.Objects)
14305
{
14306
var me=Game.Objects[i];
14307
14308
//make products full-opacity if we can buy them
14309
var classes='product';
14310
var price=me.bulkPrice;
14311
if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';lastLocked=0;me.locked=0;} else {classes+=' locked';lastLocked++;me.locked=1;}
14312
if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) classes+=' enabled'; else classes+=' disabled';
14313
if (lastLocked>2) classes+=' toggledOff';
14314
me.l.className=classes;
14315
//if (me.id>0) {l('productName'+me.id).innerHTML=Beautify(me.storedTotalCps/Game.ObjectsById[me.id-1].storedTotalCps,2);}
14316
}
14317
14318
//make upgrades full-opacity if we can buy them
14319
var lastPrice=0;
14320
for (var i in Game.UpgradesInStore)
14321
{
14322
var me=Game.UpgradesInStore[i];
14323
if (!me.bought)
14324
{
14325
var price=me.getPrice();
14326
var canBuy=me.canBuy();//(Game.cookies>=price);
14327
var enabled=(l('upgrade'+i).className.indexOf('enabled')>-1);
14328
if ((canBuy && !enabled) || (!canBuy && enabled)) Game.upgradesToRebuild=1;
14329
if (price<lastPrice) Game.storeToRefresh=1;//is this upgrade less expensive than the previous one? trigger a refresh to sort it again
14330
lastPrice=price;
14331
}
14332
if (me.timerDisplay)
14333
{
14334
var T=me.timerDisplay();
14335
if (T!=-1)
14336
{
14337
if (!l('upgradePieTimer'+i)) l('upgrade'+i).innerHTML=l('upgrade'+i).innerHTML+'<div class="pieTimer" id="upgradePieTimer'+i+'"></div>';
14338
T=(T*144)%144;
14339
l('upgradePieTimer'+i).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';
14340
}
14341
}
14342
14343
//if (me.canBuy()) l('upgrade'+i).className='crate upgrade enabled'; else l('upgrade'+i).className='crate upgrade disabled';
14344
}
14345
}
14346
Timer.track('store');
14347
14348
if (Game.PARTY)//i was bored and felt like messing with CSS
14349
{
14350
var pulse=Math.pow((Game.T%10)/10,0.5);
14351
Game.l.style.filter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';
14352
Game.l.style.webkitFilter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';
14353
Game.l.style.transform='scale('+(1.02-0.02*pulse)+','+(1.02-0.02*pulse)+') rotate('+(Math.sin(Game.T*0.5)*0.5)+'deg)';
14354
l('wrapper').style.overflowX='hidden';
14355
l('wrapper').style.overflowY='hidden';
14356
}
14357
14358
Timer.clean();
14359
if (Game.prefs.animate && ((Game.prefs.fancy && Game.drawT%1==0) || (!Game.prefs.fancy && Game.drawT%10==0)) && Game.AscendTimer==0 && Game.onMenu=='') Game.DrawBuildings();Timer.track('buildings');
14360
14361
Game.textParticlesUpdate();Timer.track('text particles');
14362
}
14363
14364
Game.NotesDraw();Timer.track('notes');
14365
//Game.tooltip.update();//changed to only update when the mouse is moved
14366
14367
Game.runModHook('draw');
14368
14369
Game.drawT++;
14370
//if (Game.prefs.altDraw) requestAnimationFrame(Game.Draw);
14371
}
14372
14373
/*=====================================================================================
14374
MAIN LOOP
14375
=======================================================================================*/
14376
Game.Loop=function()
14377
{
14378
if (Game.timedout) return false;
14379
Timer.say('START');
14380
Timer.track('browser stuff');
14381
Timer.say('LOGIC');
14382
//update game logic !
14383
Game.catchupLogic=0;
14384
Game.Logic();
14385
Game.catchupLogic=1;
14386
14387
var time=Date.now();
14388
14389
14390
//latency compensator
14391
Game.accumulatedDelay+=((time-Game.time)-1000/Game.fps);
14392
if (Game.prefs.timeout && time-Game.lastActivity>=1000*60*5)
14393
{
14394
if (Game.accumulatedDelay>1000*60*30) Game.delayTimeouts+=3;//more than 30 minutes delay ? computer probably asleep and not making cookies anyway
14395
else if (Game.accumulatedDelay>1000*5) Game.delayTimeouts++;//add to timeout counter when we skip 10 seconds worth of frames (and the player has been inactive for at least 5 minutes)
14396
if (Game.delayTimeouts>=3) Game.Timeout();//trigger timeout when the timeout counter is 3+
14397
}
14398
14399
Game.accumulatedDelay=Math.min(Game.accumulatedDelay,1000*5);//don't compensate over 5 seconds; if you do, something's probably very wrong
14400
Game.time=time;
14401
while (Game.accumulatedDelay>0)
14402
{
14403
Game.Logic();
14404
Game.accumulatedDelay-=1000/Game.fps;//as long as we're detecting latency (slower than target fps), execute logic (this makes drawing slower but makes the logic behave closer to correct target fps)
14405
}
14406
Game.catchupLogic=0;
14407
Timer.track('logic');
14408
Timer.say('END LOGIC');
14409
if (!Game.prefs.altDraw)
14410
{
14411
var hasFocus=document.hasFocus();
14412
Timer.say('DRAW');
14413
if (hasFocus || Game.prefs.focus || Game.loopT%10==0) requestAnimationFrame(Game.Draw);
14414
//if (document.hasFocus() || Game.loopT%5==0) Game.Draw();
14415
Timer.say('END DRAW');
14416
}
14417
else requestAnimationFrame(Game.Draw);
14418
14419
//if (!hasFocus) Game.tooltip.hide();
14420
14421
if (Game.sesame)
14422
{
14423
//fps counter and graph
14424
Game.previousFps=Game.currentFps;
14425
Game.currentFps=Game.getFps();
14426
var ctx=Game.fpsGraphCtx;
14427
ctx.drawImage(Game.fpsGraph,-1,0);
14428
ctx.fillStyle='rgb('+Math.round((1-Game.currentFps/Game.fps)*128)+',0,0)';
14429
ctx.fillRect(128-1,0,1,64);
14430
ctx.strokeStyle='#fff';
14431
ctx.beginPath();
14432
ctx.moveTo(128-1,(1-Game.previousFps/Game.fps)*64);
14433
ctx.lineTo(128,(1-Game.currentFps/Game.fps)*64);
14434
ctx.stroke();
14435
14436
l('fpsCounter').textContent=Game.currentFps+' fps';
14437
var str='';
14438
for (var i in Timer.labels) {str+=Timer.labels[i];}
14439
if (Game.debugTimersOn) l('debugLog').style.display='block';
14440
else l('debugLog').style.display='none';
14441
l('debugLog').innerHTML=str;
14442
14443
}
14444
Timer.reset();
14445
14446
Game.loopT++;
14447
setTimeout(Game.Loop,1000/Game.fps);
14448
}
14449
}
14450
14451
14452
/*=====================================================================================
14453
LAUNCH THIS THING
14454
=======================================================================================*/
14455
Game.Launch();
14456
//try {Game.Launch();}
14457
//catch(err) {console.log('ERROR : '+err.message);}
14458
14459
window.onload=function()
14460
{
14461
14462
if (!Game.ready)
14463
{
14464
if (top!=self) Game.ErrorFrame();
14465
else
14466
{
14467
console.log('[=== '+choose([
14468
'Oh, hello!',
14469
'hey, how\'s it hangin',
14470
'3kh0 is the best lol',
14471
'About to cheat in some cookies or just checking for bugs?',
14472
'Remember : cheated cookies taste awful!',
14473
'Hey, Orteil here. Cheated cookies taste awful... or do they?',
14474
])+' ===]');
14475
Game.Load();
14476
//try {Game.Load();}
14477
//catch(err) {console.log('ERROR : '+err.message);}
14478
}
14479
}
14480
};
14481