Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TheGameCenter
GitHub Repository: TheGameCenter/TheGameCenter.github.io
Path: blob/main/assets/javascript/cookieclicker/main.js
15352 views
1
var VERSION=2.021;
2
var BETA=1;
3
4
5
/*=====================================================================================
6
MISC HELPER FUNCTIONS
7
=======================================================================================*/
8
function l(what) {return document.getElementById(what);}
9
function choose(arr) {return arr[Math.floor(Math.random()*arr.length)];}
10
11
function escapeRegExp(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");}
12
function replaceAll(find,replace,str){return str.replace(new RegExp(escapeRegExp(find),'g'),replace);}
13
14
//disable sounds coming from soundjay.com (sorry)
15
var realAudio=Audio;//backup real audio
16
Audio=function(src){
17
if (src && src.indexOf('soundjay')>-1) {Game.Popup('Sorry, no sounds hotlinked from soundjay.com.');this.play=function(){};}
18
else return new realAudio(src);
19
};
20
21
if(!Array.prototype.indexOf) {
22
Array.prototype.indexOf = function(needle) {
23
for(var i = 0; i < this.length; i++) {
24
if(this[i] === needle) {return i;}
25
}
26
return -1;
27
};
28
}
29
30
function randomFloor(x) {if ((x%1)<Math.random()) return Math.floor(x); else return Math.ceil(x);}
31
32
function shuffle(array)
33
{
34
var counter = array.length, temp, index;
35
// While there are elements in the array
36
while (counter--)
37
{
38
// Pick a random index
39
index = (Math.random() * counter) | 0;
40
41
// And swap the last element with it
42
temp = array[counter];
43
array[counter] = array[index];
44
array[index] = temp;
45
}
46
return array;
47
}
48
49
var sinArray=[];
50
for (var i=0;i<360;i++)
51
{
52
//let's make a lookup table
53
sinArray[i]=Math.sin(i/360*Math.PI*2);
54
}
55
function quickSin(x)
56
{
57
//oh man this isn't all that fast actually
58
//why do I do this. why
59
var sign=x<0?-1:1;
60
return sinArray[Math.round(
61
(Math.abs(x)*360/Math.PI/2)%360
62
)]*sign;
63
}
64
65
/*function ajax(url,callback){
66
var ajaxRequest;
67
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;}}}
68
if (callback){ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){callback(ajaxRequest.responseText);}}}
69
ajaxRequest.open('GET',url+'&nocache='+(new Date().getTime()),true);ajaxRequest.send(null);
70
}*/
71
72
var ajax=function(url,callback)
73
{
74
var httpRequest=new XMLHttpRequest();
75
if (!httpRequest){return false;}
76
httpRequest.onreadystatechange=function()
77
{
78
try{
79
if (httpRequest.readyState===XMLHttpRequest.DONE && httpRequest.status===200)
80
{
81
callback(httpRequest.responseText);
82
}
83
}catch(e){}
84
}
85
//httpRequest.onerror=function(e){console.log('ERROR',e);}
86
if (url.indexOf('?')==-1) url+='?'; else url+='&';
87
url+='nocache='+Date.now();
88
httpRequest.open('GET',url);
89
httpRequest.setRequestHeader('Content-Type','text/plain');
90
httpRequest.overrideMimeType('text/plain');
91
httpRequest.send();
92
return true;
93
}
94
95
96
//Beautify and number-formatting adapted from the Frozen Cookies add-on (http://cookieclicker.wikia.com/wiki/Frozen_Cookies_%28JavaScript_Add-on%29)
97
function formatEveryThirdPower(notations)
98
{
99
return function (value)
100
{
101
var base = 0,
102
notationValue = '';
103
if (!isFinite(value)) return 'Infinity';
104
if (value >= 1000000)
105
{
106
value /= 1000;
107
while(Math.round(value) >= 1000)
108
{
109
value /= 1000;
110
base++;
111
}
112
if (base >= notations.length) {return 'Infinity';} else {notationValue = notations[base];}
113
}
114
return ( Math.round(value * 1000) / 1000 ) + notationValue;
115
};
116
}
117
118
function rawFormatter(value) {return Math.round(value * 1000) / 1000;}
119
120
var formatLong=[' thousand',' million',' billion',' trillion',' quadrillion',' quintillion',' sextillion',' septillion',' octillion',' nonillion'];
121
var prefixes=['','un','duo','tre','quattuor','quin','sex','septen','octo','novem'];
122
var suffixes=['decillion','vigintillion','trigintillion','quadragintillion','quinquagintillion','sexagintillion','septuagintillion','octogintillion','nonagintillion'];
123
for (var i in suffixes)
124
{
125
for (var ii in prefixes)
126
{
127
formatLong.push(' '+prefixes[ii]+suffixes[i]);
128
}
129
}
130
131
var formatShort=['k','M','B','T','Qa','Qi','Sx','Sp','Oc','No'];
132
var prefixes=['','Un','Do','Tr','Qa','Qi','Sx','Sp','Oc','No'];
133
var suffixes=['D','V','T','Qa','Qi','Sx','Sp','O','N'];
134
for (var i in suffixes)
135
{
136
for (var ii in prefixes)
137
{
138
formatShort.push(' '+prefixes[ii]+suffixes[i]);
139
}
140
}
141
formatShort[10]='Dc';
142
143
144
var numberFormatters =
145
[
146
formatEveryThirdPower(formatShort),
147
formatEveryThirdPower(formatLong),
148
rawFormatter
149
];
150
function Beautify(value,floats)
151
{
152
var negative=(value<0);
153
var decimal='';
154
var fixed=value.toFixed(floats);
155
if (Math.abs(value)<1000 && floats>0 && Math.floor(fixed)!=fixed) decimal='.'+(fixed.toString()).split('.')[1];
156
value=Math.floor(Math.abs(value));
157
if (floats>0 && fixed==value+1) value++;
158
var formatter=numberFormatters[Game.prefs.format?2:1];
159
var output=formatter(value).toString().replace(/\B(?=(\d{3})+(?!\d))/g,',');
160
if (output=='0') negative=false;
161
return negative?'-'+output:output+decimal;
162
}
163
function shortenNumber(value)
164
{
165
//if no scientific notation, return as is, else :
166
//keep only the 5 first digits (plus dot), round the rest
167
//may or may not work properly
168
if (value >= 1000000 && isFinite(value))
169
{
170
var num=value.toString();
171
var ind=num.indexOf('e+');
172
if (ind==-1) return value;
173
var str='';
174
for (var i=0;i<ind;i++)
175
{
176
str+=(i<6?num[i]:'0');
177
}
178
str+='e+';
179
str+=num.split('e+')[1];
180
return parseFloat(str);
181
}
182
return value;
183
}
184
185
186
var beautifyInTextFilter=/(([\d]+[,]*)+)/g;//new regex
187
var a=/\d\d?\d?(?:,\d\d\d)*/g;//old regex
188
function BeautifyInTextFunction(str){return Beautify(parseInt(str.replace(/,/g,''),10));};
189
function BeautifyInText(str) {return str.replace(beautifyInTextFilter,BeautifyInTextFunction);}//reformat every number inside a string
190
function BeautifyAll()//run through upgrades and achievements to reformat the numbers
191
{
192
var func=function(what){what.desc=BeautifyInText(what.baseDesc);}
193
Game.UpgradesById.forEach(func);
194
Game.AchievementsById.forEach(func);
195
}
196
197
//these are faulty, investigate later
198
//function utf8_to_b64(str){return btoa(str);}
199
//function b64_to_utf8(str){return atob(str);}
200
201
function utf8_to_b64( str ) {
202
try{return Base64.encode(unescape(encodeURIComponent( str )));}
203
catch(err)
204
{return '';}
205
}
206
207
function b64_to_utf8( str ) {
208
try{return decodeURIComponent(escape(Base64.decode( str )));}
209
catch(err)
210
{return '';}
211
}
212
213
function CompressBin(arr)//compress a sequence like [0,1,1,0,1,0]... into a number like 54.
214
{
215
var str='';
216
var arr2=arr.slice(0);
217
arr2.unshift(1);
218
arr2.push(1);
219
arr2.reverse();
220
for (var i in arr2)
221
{
222
str+=arr2[i];
223
}
224
str=parseInt(str,2);
225
return str;
226
}
227
228
function UncompressBin(num)//uncompress a number like 54 to a sequence like [0,1,1,0,1,0].
229
{
230
var arr=num.toString(2);
231
arr=arr.split('');
232
arr.reverse();
233
arr.shift();
234
arr.pop();
235
return arr;
236
}
237
238
function CompressLargeBin(arr)//we have to compress in smaller chunks to avoid getting into scientific notation
239
{
240
var arr2=arr.slice(0);
241
var thisBit=[];
242
var bits=[];
243
for (var i in arr2)
244
{
245
thisBit.push(arr2[i]);
246
if (thisBit.length>=50)
247
{
248
bits.push(CompressBin(thisBit));
249
thisBit=[];
250
}
251
}
252
if (thisBit.length>0) bits.push(CompressBin(thisBit));
253
arr2=bits.join(';');
254
return arr2;
255
}
256
257
function UncompressLargeBin(arr)
258
{
259
var arr2=arr.split(';');
260
var bits=[];
261
for (var i in arr2)
262
{
263
bits.push(UncompressBin(parseInt(arr2[i])));
264
}
265
arr2=[];
266
for (var i in bits)
267
{
268
for (var ii in bits[i]) arr2.push(bits[i][ii]);
269
}
270
return arr2;
271
}
272
273
274
function pack(bytes) {
275
var chars = [];
276
var len=bytes.length;
277
for(var i = 0, n = len; i < n;) {
278
chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));
279
}
280
return String.fromCharCode.apply(null, chars);
281
}
282
283
function unpack(str) {
284
var bytes = [];
285
var len=str.length;
286
for(var i = 0, n = len; i < n; i++) {
287
var char = str.charCodeAt(i);
288
bytes.push(char >>> 8, char & 0xFF);
289
}
290
return bytes;
291
}
292
293
//modified from http://www.smashingmagazine.com/2011/10/19/optimizing-long-lists-of-yesno-values-with-javascript/
294
function pack2(/* string */ values) {
295
var chunks = values.match(/.{1,14}/g), packed = '';
296
for (var i=0; i < chunks.length; i++) {
297
packed += String.fromCharCode(parseInt('1'+chunks[i], 2));
298
}
299
return packed;
300
}
301
302
function unpack2(/* string */ packed) {
303
var values = '';
304
for (var i=0; i < packed.length; i++) {
305
values += packed.charCodeAt(i).toString(2).substring(1);
306
}
307
return values;
308
}
309
310
function pack3(values){
311
//too many save corruptions, darn it to heck
312
return values;
313
}
314
315
316
//file save function from https://github.com/eligrey/FileSaver.js
317
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})}
318
319
320
//seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html
321
(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);
322
323
function bind(scope,fn)
324
{
325
//use : bind(this,function(){this.x++;}) - returns a function where "this" refers to the scoped this
326
return function() {fn.apply(scope,arguments);};
327
}
328
329
var grabProps=function(arr,prop)
330
{
331
if (!arr) return [];
332
arr2=[];
333
for (var i=0;i<arr.length;i++)
334
{
335
arr2.push(arr[i][prop]);
336
}
337
return arr2;
338
}
339
340
CanvasRenderingContext2D.prototype.fillPattern=function(img,X,Y,W,H,iW,iH,offX,offY)
341
{
342
//for when built-in patterns aren't enough
343
if (img.alt!='blank')
344
{
345
var offX=offX||0;
346
var offY=offY||0;
347
if (offX<0) {offX=offX-Math.floor(offX/iW)*iW;} if (offX>0) {offX=(offX%iW)-iW;}
348
if (offY<0) {offY=offY-Math.floor(offY/iH)*iH;} if (offY>0) {offY=(offY%iH)-iH;}
349
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);}}
350
}
351
}
352
353
var OldCanvasDrawImage=CanvasRenderingContext2D.prototype.drawImage;
354
CanvasRenderingContext2D.prototype.drawImage=function()
355
{
356
//only draw the image if it's loaded
357
if (arguments[0].alt!='blank') OldCanvasDrawImage.apply(this,arguments);
358
}
359
360
361
if (!document.hasFocus) document.hasFocus=function(){return document.hidden;};//for Opera
362
363
function AddEvent(html_element, event_name, event_function)
364
{
365
if(html_element.attachEvent) html_element.attachEvent("on" + event_name, function() {event_function.call(html_element);});
366
else if(html_element.addEventListener) html_element.addEventListener(event_name, event_function, false);
367
}
368
369
function FireEvent(el, etype)
370
{
371
if (el.fireEvent)
372
{el.fireEvent('on'+etype);}
373
else
374
{
375
var evObj=document.createEvent('Events');
376
evObj.initEvent(etype,true,false);
377
el.dispatchEvent(evObj);
378
}
379
}
380
381
var Loader=function()//asset-loading system
382
{
383
this.loadingN=0;
384
this.assetsN=0;
385
this.assets=[];
386
this.assetsLoading=[];
387
this.assetsLoaded=[];
388
this.domain='';
389
this.loaded=0;//callback
390
this.doneLoading=0;
391
392
this.blank=document.createElement('canvas');
393
this.blank.width=8;
394
this.blank.height=8;
395
this.blank.alt='blank';
396
397
this.Load=function(assets)
398
{
399
for (var i in assets)
400
{
401
this.loadingN++;
402
this.assetsN++;
403
if (!this.assetsLoading[assets[i]] && !this.assetsLoaded[assets[i]])
404
{
405
var img=new Image();
406
img.src=this.domain+assets[i];
407
img.alt=assets[i];
408
img.onload=bind(this,this.onLoad);
409
this.assets[assets[i]]=img;
410
this.assetsLoading.push(assets[i]);
411
}
412
}
413
}
414
this.Replace=function(old,newer)
415
{
416
if (this.assets[old])
417
{
418
var img=new Image();
419
if (newer.indexOf('http')!=-1) img.src=newer;
420
else img.src=this.domain+newer;
421
img.alt=newer;
422
img.onload=bind(this,this.onLoad);
423
this.assets[old]=img;
424
}
425
}
426
this.onLoadReplace=function()
427
{
428
}
429
this.onLoad=function(e)
430
{
431
this.assetsLoaded.push(e.target.alt);
432
this.assetsLoading.splice(this.assetsLoading.indexOf(e.target.alt),1);
433
this.loadingN--;
434
if (this.doneLoading==0 && this.loadingN<=0 && this.loaded!=0)
435
{
436
this.doneLoading=1;
437
this.loaded();
438
}
439
}
440
this.getProgress=function()
441
{
442
return (1-this.loadingN/this.assetsN);
443
}
444
}
445
446
var Pic=function(what)
447
{
448
if (Game.Loader.assetsLoaded.indexOf(what)!=-1) return Game.Loader.assets[what];
449
else if (Game.Loader.assetsLoading.indexOf(what)==-1) Game.Loader.Load([what]);
450
return Game.Loader.blank;
451
}
452
453
var Sounds=[];
454
var OldPlaySound=function(url,vol)
455
{
456
var volume=1;
457
if (vol!==undefined) volume=vol;
458
if (!Game.volume || volume==0) return 0;
459
if (!Sounds[url]) {Sounds[url]=new Audio(url);Sounds[url].onloadeddata=function(e){e.target.volume=Math.pow(volume*Game.volume/100,2);}}
460
else if (Sounds[url].readyState>=2) {Sounds[url].currentTime=0;Sounds[url].volume=Math.pow(volume*Game.volume/100,2);}
461
Sounds[url].play();
462
}
463
var SoundInsts=[];
464
var SoundI=0;
465
for (var i=0;i<12;i++){SoundInsts[i]=new Audio();}
466
var pitchSupport=false;
467
//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
468
//if (SoundInsts[0].preservesPitch || SoundInsts[0].mozPreservesPitch || SoundInsts[0].webkitPreservesPitch) pitchSupport=true;
469
470
var PlaySound=function(url,vol,pitchVar)
471
{
472
//url : the url of the sound to play (will be cached so it only loads once)
473
//vol : volume between 0 and 1 (multiplied by game volume setting); defaults to 1 (full volume)
474
//(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)
475
var volume=1;
476
var pitchVar=(typeof pitchVar==='undefined')?0.05:pitchVar;
477
var rate=1+(Math.random()*2-1)*pitchVar;
478
if (typeof vol!=='undefined') volume=vol;
479
if (!Game.volume || volume==0) return 0;
480
if (!Sounds[url])
481
{
482
//sound isn't loaded, cache it
483
Sounds[url]=new Audio(url);
484
Sounds[url].onloadeddata=function(e){PlaySound(url,vol,pitchVar);}
485
}
486
else if (Sounds[url].readyState>=2)
487
{
488
var sound=SoundInsts[SoundI];
489
SoundI++;
490
if (SoundI>=12) SoundI=0;
491
sound.src=Sounds[url].src;
492
//sound.currentTime=0;
493
sound.volume=Math.pow(volume*Game.volume/100,2);
494
if (pitchSupport && rate!=0)
495
{
496
sound.preservesPitch=false;
497
sound.mozPreservesPitch=false;
498
sound.webkitPreservesPitch=false;
499
sound.playbackRate=rate;
500
}
501
sound.play();
502
}
503
}
504
505
if (!Date.now){Date.now=function now() {return new Date().getTime();};}
506
507
triggerAnim=function(element,anim)
508
{
509
if (!element) return;
510
element.classList.remove(anim);
511
void element.offsetWidth;
512
element.classList.add(anim);
513
};
514
515
var debugStr='';
516
var Debug=function(what)
517
{
518
if (!debugStr) debugStr=what;
519
else debugStr+='; '+what;
520
}
521
522
var Timer={};
523
Timer.t=Date.now();
524
Timer.labels=[];
525
Timer.smoothed=[];
526
Timer.reset=function()
527
{
528
Timer.labels=[];
529
Timer.t=Date.now();
530
}
531
Timer.track=function(label)
532
{
533
if (!Game.sesame) return;
534
var now=Date.now();
535
if (!Timer.smoothed[label]) Timer.smoothed[label]=0;
536
Timer.smoothed[label]+=((now-Timer.t)-Timer.smoothed[label])*0.1;
537
Timer.labels[label]='<div style="padding-left:8px;">'+label+' : '+Math.round(Timer.smoothed[label])+'ms</div>';
538
Timer.t=now;
539
}
540
Timer.clean=function()
541
{
542
if (!Game.sesame) return;
543
var now=Date.now();
544
Timer.t=now;
545
}
546
Timer.say=function(label)
547
{
548
if (!Game.sesame) return;
549
Timer.labels[label]='<div style="border-top:1px solid #ccc;">'+label+'</div>';
550
}
551
552
553
/*=====================================================================================
554
GAME INITIALIZATION
555
=======================================================================================*/
556
var Game={};
557
558
Game.Launch=function()
559
{
560
Game.version=VERSION;
561
Game.beta=BETA;
562
if (window.location.href.indexOf('/beta')>-1) Game.beta=1;
563
Game.https=(location.protocol!='https:')?false:true;
564
Game.mobile=0;
565
Game.touchEvents=0;
566
//if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) Game.mobile=1;
567
//if (Game.mobile) Game.touchEvents=1;
568
//if ('ontouchstart' in document.documentElement) Game.touchEvents=1;
569
570
var css=document.createElement('style');
571
css.type='text/css';
572
css.innerHTML='body .icon,body .crate,body .usesIcon{background-image:url(img/icons.png?v='+Game.version+');}';
573
document.head.appendChild(css);
574
575
Game.baseSeason='';//halloween, christmas, valentines, fools, easter
576
//automatic season detection (might not be 100% accurate)
577
var day=Math.floor((new Date()-new Date(new Date().getFullYear(),0,0))/(1000*60*60*24));
578
if (day>=41 && day<=46) Game.baseSeason='valentines';
579
else if (day>=90 && day<=92) Game.baseSeason='fools';
580
else if (day>=304-7 && day<=304) Game.baseSeason='halloween';
581
else if (day>=349 && day<=365) Game.baseSeason='christmas';
582
else
583
{
584
//easter is a pain goddamn
585
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);}(new Date().getFullYear());
586
easterDay=Math.floor((easterDay-new Date(easterDay.getFullYear(),0,0))/(1000*60*60*24));
587
if (day>=easterDay-7 && day<=easterDay) Game.baseSeason='easter';
588
}
589
590
Game.updateLog=
591
'<div class="selectable">'+
592
'<div class="section">Info</div>'+
593
'<div class="subsection">'+
594
'<div class="title">About</div>'+
595
'<div class="listing">Cookie Clicker is a javascript game by <a href="http://orteil.dashnet.org" target="_blank">Orteil</a> and <a href="http://dashnet.org" target="_blank">Opti</a>.</div>'+
596
//'<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>; '+
597
'<div class="listing">We have an <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord</a>; '+
598
'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> '+
599
'or the <a href="http://cookieclicker.wikia.com/wiki/Cookie_Clicker_Wiki" target="_blank">wiki</a>.</div>'+
600
'<div class="listing">News and teasers are usually posted on my <a href="http://orteil42.tumblr.com/" target="_blank">tumblr</a> and <a href="http://twitter.com/orteil42" target="_blank">twitter</a>.</div>'+
601
'<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%;">'+
602
'<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>'+
603
'<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'+
604
'<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>'+
605
'<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>'+
606
'<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>'+
607
608
'</div><div class="subsection">'+
609
'<div class="title">Version history</div>'+
610
611
'</div><div class="subsection update">'+
612
'<div class="title">16/09/2019 - going off-script</div>'+
613
'<div class="listing">&bull; added a new building</div>'+
614
'<div class="listing">&bull; added fortune cookies (a new heavenly upgrade)</div>'+
615
'<div class="listing">&bull; more upgrades, achievements etc</div>'+
616
'<div class="listing">&bull; updated the Russian bread cookies icon to better reflect their cyrillic origins</div>'+
617
'<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>'+
618
619
'</div><div class="subsection update small">'+
620
'<div class="title">01/04/2019 - 2.019 (the "this year" update)</div>'+
621
'<div class="listing">&bull; game has been renamed to "Cookie Clicker" to avoid confusion</div>'+
622
'<div class="listing">&bull; can now click the big cookie to generate cookies for free</div>'+
623
'<div class="listing">&bull; removed fall damage</div>'+
624
//'<div class="listing">&bull; fixed various typos : player\'s name is now correctly spelled as "[bakeryName]"</div>'+
625
'<div class="listing">&bull; removed all references to computer-animated movie <i style="font-style:italic;">Hoodwinked!</i> (2005)</div>'+
626
'<div class="listing">&bull; went back in time and invented cookies and computer mice, ensuring Cookie Clicker would one day come to exist</div>'+
627
'<div class="listing">&bull; game now fully compliant with Geneva Conventions</div>'+
628
'<div class="listing">&bull; dropped support for TI-84 version</div>'+
629
'<div class="listing">&bull; released a low-res retro version of the game, playable here : <a href="http://orteil.dashnet.org/experiments/cookie/" target="_blank">orteil.dashnet.org/experiments/cookie</a></div>'+
630
'<div class="listing">&bull; updated version number</div>'+
631
632
'</div><div class="subsection update small">'+
633
'<div class="title">05/03/2019 - cookies for days</div>'+
634
'<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>'+
635
'<div class="listing">&bull; added 2 heavenly upgrades</div>'+
636
'<div class="listing">&bull; the Golden goose egg now counts as a golden cookie upgrade for Residual luck purposes</div>'+
637
'<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>'+
638
'<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>'+
639
'<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>'+
640
'<div class="listing">&bull; vaulting upgrades is now done with shift-click, as ctrl-click was posing issues for Mac browsers</div>'+
641
'<div class="listing">&bull; made tooltips for building CpS boosts from synergies hopefully clearer</div>'+
642
'<div class="listing">&bull; fixed an exploit with gambler\'s fever dream working across exports and ascensions</div>'+
643
'<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>'+
644
'<div class="listing">&bull; fixed a bug with golden cookies/reindeer not disappearing properly in some circumstances</div>'+
645
'<div class="listing">&bull; the Dragon\'s Curve aura should now properly make sugar lumps twice as weird</div>'+
646
'<div class="listing">&bull; the ctrl key should less often register incorrectly as pressed</div>'+
647
'<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>'+
648
'<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>'+
649
'<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>'+
650
651
'</div><div class="subsection update">'+
652
'<div class="title">25/10/2018 - feedback loop</div>'+
653
'<div class="listing">&bull; added a new building</div>'+
654
'<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>'+
655
'<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>'+
656
'<div class="listing">&bull; when hovering over grandmas, you can now see their names and ages</div>'+
657
'<div class="listing">&bull; "make X cookies just from Y" requirements are now higher</div>'+
658
'<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>'+
659
'<div class="listing">&bull; building tooltips now display what % of CpS they contribute through synergy upgrades</div>'+
660
'<div class="listing">&bull; queenbeets now give up to 4% of bank, down from 6%</div>'+
661
'<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>'+
662
'<div class="listing">&bull; season switches have reworked prices</div>'+
663
'<div class="listing">&bull; season switches can now be cancelled by clicking them again</div>'+
664
'<div class="listing">&bull; can no longer accidentally click wrinklers through other elements</div>'+
665
'<div class="listing">&bull; sugar frenzy now triples your CpS for an hour instead of doubling it</div>'+
666
'<div class="listing">&bull; this text is now selectable</div>'+
667
'<div class="listing">&bull; progress on dungeons minigame is still very much ongoing</div>'+
668
669
'</div><div class="subsection update small">'+
670
'<div class="title">08/08/2018 - hey now</div>'+
671
'<div class="listing">&bull; Cookie Clicker somehow turns 5, going against doctors\' most optimistic estimates</div>'+
672
'<div class="listing">&bull; added a new tier of building achievements, all named after Smash Mouth\'s classic 1999 hit "All Star"</div>'+
673
'<div class="listing">&bull; added a new tier of building upgrades, all named after nothing in particular</div>'+
674
'<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>'+
675
'<div class="listing">&bull; resumed work on the dungeons minigame</div>'+
676
677
'</div><div class="subsection update small">'+
678
'<div class="title">01/08/2018 - buy buy buy</div>'+
679
'<div class="listing">&bull; added a heavenly upgrade that lets you buy all your upgrades instantly</div>'+
680
'<div class="listing">&bull; added a heavenly upgrade that lets you see upgrade tiers (feature was previously removed due to being confusing)</div>'+
681
'<div class="listing">&bull; added a new wrinkler-related heavenly upgrade</div>'+
682
'<div class="listing">&bull; added a new upgrade tier</div>'+
683
'<div class="listing">&bull; added a couple new cookies and achievements</div>'+
684
'<div class="listing">&bull; new "extra buttons" setting; turning it on adds buttons that let you minimize buildings</div>'+
685
'<div class="listing">&bull; new "lump confirmation" setting; turning it on will show a confirmation prompt when you spend sugar lumps</div>'+
686
'<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>'+
687
'<div class="listing">&bull; farm soils now unlock correctly based on current amount of farms</div>'+
688
'<div class="listing">&bull; cheapcaps have a new exciting nerf</div>'+
689
'<div class="listing">&bull; wrinklegill spawns a bunch more</div>'+
690
'<div class="listing">&bull; can now ctrl-shift-click on "Harvest all" to only harvest mature, non-immortal plants</div>'+
691
'<div class="listing">&bull; added a new rare type of sugar lump</div>'+
692
693
'</div><div class="subsection update small">'+
694
'<div class="title">20/04/2018 - weeding out some bugs</div>'+
695
'<div class="listing">&bull; golden clovers and wrinklegills should spawn a bit more often</div>'+
696
'<div class="listing">&bull; cronerice matures a lot sooner</div>'+
697
'<div class="listing">&bull; mature elderworts stay mature after reloading</div>'+
698
'<div class="listing">&bull; garden interface occupies space more intelligently</div>'+
699
'<div class="listing">&bull; seed price displays should be better behaved with short numbers disabled</div>'+
700
'<div class="listing">&bull; minigame animations are now turned off if using the "Fancy graphics" option is disabled</div>'+
701
'<div class="listing">&bull; CpS achievement requirements were dialed down a wee tad</div>'+
702
703
'</div><div class="subsection update small">'+
704
'<div class="title">19/04/2018 - garden patch</div>'+
705
'<div class="listing">&bull; upgrades dropped by garden plants now stay unlocked forever (but drop much more rarely)</div>'+
706
'<div class="listing">&bull; garden sugar lump refill now also makes plants spread and mutate 3 times more during the bonus tick</div>'+
707
'<div class="listing">&bull; a few new upgrades</div>'+
708
'<div class="listing">&bull; a couple bug fixes and rephrasings</div>'+
709
710
'</div><div class="subsection update">'+
711
'<div class="title">18/04/2018 - your garden-variety update</div>'+
712
'<div class="listing">&bull; added the garden, a minigame unlocked by having at least level 1 farms</div>'+
713
'<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>'+
714
'<div class="listing">&bull; new cookies, milk flavors and achievements</div>'+
715
'<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>'+
716
'<div class="listing">&bull; sugar lump type now saves correctly</div>'+
717
'<div class="listing">&bull; minigame sugar lump refills can now only be done every 15 minutes (timer shared across all minigames)</div>'+
718
'<div class="listing">&bull; CpS achievements now have steeper requirements</div>'+
719
'<div class="listing">&bull; golden cookies now last 5% shorter for every other golden cookie on the screen</div>'+
720
'<div class="listing">&bull; the game now remembers which minigames are closed or open</div>'+
721
'<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>'+
722
'<div class="listing">&bull; permanent upgrade slots now show a tooltip for the selected upgrade</div>'+
723
'<div class="listing">&bull; finally fixed the save corruption bug, hopefully</div>'+
724
725
'</div><div class="subsection update small">'+
726
'<div class="title">24/02/2018 - sugar coating</div>'+
727
'<div class="listing">&bull; added link to <a href="https://discordapp.com/invite/cookie" target="_blank">official Discord server</a></div>'+
728
'<div class="listing">&bull; felt weird about pushing an update without content so :</div>'+
729
'<div class="listing">&bull; added a handful of new cookies</div>'+
730
'<div class="listing">&bull; added 3 new heavenly upgrades</div>'+
731
'<div class="listing">&bull; short numbers should now be displayed up to novemnonagintillions</div>'+
732
'<div class="listing">&bull; cookie chains no longer spawn from the Force the Hand of Fate spell</div>'+
733
'<div class="listing">&bull; bigger, better Cookie Clicker content coming later this year</div>'+
734
735
'</div><div class="subsection update">'+
736
'<div class="title">08/08/2017 - 4 more years</div>'+
737
'<div class="listing">&bull; new building : Chancemakers</div>'+
738
'<div class="listing">&bull; new milk, new kittens, new dragon aura, new cookie, new upgrade tier</div>'+
739
'<div class="listing">&bull; buffs no longer affect offline CpS</div>'+
740
'<div class="listing">&bull; Godzamok\'s hunger was made less potent (this is a nerf, very sorry)</div>'+
741
'<div class="listing">&bull; grimoire spell costs and maximum magic work differently</div>'+
742
'<div class="listing">&bull; Spontaneous Edifice has been reworked</div>'+
743
'<div class="listing">&bull; changed unlock levels and prices for some cursor upgrades</div>'+
744
'<div class="listing">&bull; fixed buggy pantheon slots, hopefully</div>'+
745
'<div class="listing">&bull; fixed "Legacy started a long while ago" showing as "a few seconds ago"</div>'+
746
'<div class="listing">&bull; Cookie Clicker just turned 4. Thank you for sticking with us this long!</div>'+
747
748
'</div><div class="subsection update">'+
749
'<div class="title">15/07/2017 - the spiritual update</div>'+
750
'<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>'+
751
'<div class="listing">&bull; buildings can now level up by using sugar lumps in the main buildings display, permanently boosting their CpS</div>'+
752
'<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>'+
753
'<div class="listing">&bull; active buffs are now saved</div>'+
754
'<div class="listing">&bull; the background selector upgrade is now functional</div>'+
755
'<div class="listing">&bull; the top menu no longer scrolls with the rest</div>'+
756
'<div class="listing">&bull; timespans are written nicer</div>'+
757
'<div class="listing">&bull; Dragonflights now tend to supercede Click frenzies, you will rarely have both at the same time</div>'+
758
'<div class="listing">&bull; some old bugs were phased out and replaced by new ones</div>'+
759
760
'</div><div class="subsection update small">'+
761
'<div class="title">24/07/2016 - golden cookies overhaul</div>'+
762
'<div class="listing">&bull; golden cookies and reindeer now follow a new system involving explicitly defined buffs</div>'+
763
'<div class="listing">&bull; a bunch of new golden cookie effects have been added</div>'+
764
'<div class="listing">&bull; CpS gains from eggs are now multiplicative</div>'+
765
'<div class="listing">&bull; shiny wrinklers are now saved</div>'+
766
'<div class="listing">&bull; reindeer have been rebalanced ever so slightly</div>'+
767
'<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>'+
768
'<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>'+
769
770
'</div><div class="subsection update">'+
771
'<div class="title">08/02/2016 - legacy</div>'+
772
'<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>'+
773
'<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>'+
774
'<div class="listing">&bull; the ascension system has been redone from scratch, with a new heavenly upgrade tree</div>'+
775
'<div class="listing">&bull; mysterious new features such as angel-powered offline progression, challenge runs, and a cookie dragon</div>'+
776
'<div class="listing">&bull; sounds have been added (can be disabled in the options)</div>'+
777
'<div class="listing">&bull; heaps of rebalancing and bug fixes</div>'+
778
'<div class="listing">&bull; a couple more upgrades and achievements, probably</div>'+
779
'<div class="listing">&bull; fresh new options to further customize your cookie-clicking experience</div>'+
780
'<div class="listing">&bull; quality-of-life improvements : better bulk-buy, better switches etc</div>'+
781
'<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 */
782
'<div class="listing">&bull; tons of other little things we can\'t even remember right now</div>'+
783
'<div class="listing">Miss the old version? Your old save was automatically exported <a href="http://orteil.dashnet.org/cookieclicker/v10466/" target="_blank">here</a>!</div>'+
784
785
'</div><div class="subsection update small">'+
786
'<div class="title">05/02/2016 - legacy beta, more fixes</div>'+
787
'<div class="listing">&bull; added challenge modes, which can be selected when ascending (only 1 for now : "Born again")</div>'+
788
'<div class="listing">&bull; changed the way bulk-buying and bulk-selling works</div>'+
789
'<div class="listing">&bull; more bugs ironed out</div>'+
790
791
'</div><div class="subsection update">'+
792
'<div class="title">03/02/2016 - legacy beta, part III</div>'+
793
'<div class="listing warning">&bull; Not all bugs have been fixed, but everything should be much less broken.</div>'+
794
'<div class="listing">&bull; Additions'+
795
'<div style="opacity:0.8;margin-left:12px;">'+
796
'-a few more achievements<br>'+
797
'-new option for neat, but slow CSS effects (disabled by default)<br>'+
798
'-new option for a less grating cookie sound (enabled by default)<br>'+
799
'-new option to bring back the boxes around icons in the stats screen<br>'+
800
'-new buttons for saving and loading your game to a text file<br>'+
801
'</div>'+
802
'</div>'+
803
'<div class="listing">&bull; Changes'+
804
'<div style="opacity:0.8;margin-left:12px;">'+
805
'-early game should be a bit faster and very late game was kindly asked to tone it down a tad<br>'+
806
'-dragonflight should be somewhat less ridiculously overpowered<br>'+
807
'-please let me know if the rebalancing was too heavy or not heavy enough<br>'+
808
'-santa and easter upgrades now depend on Santa level and amount of eggs owned, respectively, instead of costing several minutes worth of CpS<br>'+
809
'-cookie upgrades now stack multiplicatively rather than additively<br>'+
810
'-golden switch now gives +50% CpS, and residual luck is +10% CpS per golden cookie upgrade (up from +25% and +1%, respectively)<br>'+
811
'-lucky cookies and cookie chain payouts have been modified a bit, possibly for the better, who knows!<br>'+
812
'-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>'+
813
/*'-all animations are now handled by requestAnimationFrame(), which should hopefully help make the game less resource-intensive<br>'+*/
814
'-an ascension now only counts for achievement purposes if you earned at least 1 prestige level from it<br>'+
815
'-the emblematic Cookie Clicker font (Kavoon) was bugged in Firefox, and has been replaced with a new font (Merriweather)<br>'+
816
'-the mysterious wrinkly creature is now even rarer, but has a shadow achievement tied to it<br>'+
817
'</div>'+
818
'</div>'+
819
'<div class="listing">&bull; Fixes'+
820
'<div style="opacity:0.8;margin-left:12px;">'+
821
'-prestige now grants +1% CpS per level as intended, instead of +100%<br>'+
822
'-heavenly chips should no longer add up like crazy when you ascend<br>'+
823
'-upgrades in the store should no longer randomly go unsorted<br>'+
824
'-window can be resized to any size again<br>'+
825
'-the "Stats" and "Options" buttons have been swapped again<br>'+
826
'-the golden cookie sound should be somewhat clearer<br>'+
827
'-the ascend screen should be less CPU-hungry<br>'+
828
'</div>'+
829
'</div>'+
830
831
'</div><div class="subsection update">'+
832
'<div class="title">20/12/2015 - legacy beta, part II</div>'+
833
'<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>'+
834
'<div class="listing warning">&bull; importing your save from the live version is also fine</div>'+
835
'<div class="listing">&bull; we took so long to make this update, Cookie Clicker turned 2 years old in the meantime! Hurray!</div>'+
836
'<div class="listing">&bull; heaps of new upgrades and achievements</div>'+
837
'<div class="listing">&bull; fixed a whole bunch of bugs</div>'+
838
'<div class="listing">&bull; did a lot of rebalancing</div>'+
839
'<div class="listing">&bull; reworked heavenly chips and heavenly cookies (still experimenting, will probably rebalance things further)</div>'+
840
'<div class="listing">&bull; you may now unlock a dragon friend</div>'+
841
'<div class="listing">&bull; switches and season triggers now have their own store section</div>'+
842
'<div class="listing">&bull; ctrl-s and ctrl-o now save the game and open the import menu, respectively</div>'+
843
'<div class="listing">&bull; added some quick sounds, just as a test</div>'+
844
'<div class="listing">&bull; a couple more options</div>'+
845
'<div class="listing">&bull; even more miscellaneous changes and additions</div>'+
846
847
'</div><div class="subsection update">'+
848
'<div class="title">25/08/2014 - legacy beta, part I</div>'+
849
'<div class="listing">&bull; 3 new buildings</div>'+
850
'<div class="listing">&bull; price and CpS curves revamped</div>'+
851
'<div class="listing">&bull; CpS calculations revamped; cookie upgrades now stack multiplicatively</div>'+
852
'<div class="listing">&bull; prestige system redone from scratch, with a whole new upgrade tree</div>'+
853
'<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>'+
854
'<div class="listing">&bull; tons of other miscellaneous fixes and additions</div>'+
855
'<div class="listing">&bull; Cookie Clicker is now 1 year old! (Thank you guys for all the support!)</div>'+
856
'<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>'+
857
858
'</div><div class="subsection update small">'+
859
'<div class="title">18/05/2014 - better late than easter</div>'+
860
'<div class="listing">&bull; bunnies and eggs, somehow</div>'+
861
'<div class="listing">&bull; prompts now have keyboard shortcuts like system prompts would</div>'+
862
'<div class="listing">&bull; naming your bakery? you betcha</div>'+
863
'<div class="listing">&bull; "Fast notes" option to make all notifications close faster; new button to close all notifications</div>'+
864
'<div class="listing">&bull; the dungeons beta is now available on <a href="http://orteil.dashnet.org/cookieclicker/betadungeons" target="_blank">/betadungeons</a></div>'+
865
866
'</div><div class="subsection update small">'+
867
'<div class="title">09/04/2014 - nightmare in heaven</div>'+
868
'<div class="listing">&bull; broke a thing; heavenly chips were corrupted for some people</div>'+
869
'<div class="listing">&bull; will probably update to /beta first in the future</div>'+
870
'<div class="listing">&bull; sorry again</div>'+
871
872
'</div><div class="subsection update small">'+
873
'<div class="title">09/04/2014 - quality of life</div>'+
874
'<div class="listing">&bull; new upgrade and achievement tier</div>'+
875
'<div class="listing">&bull; popups and prompts are much nicer</div>'+
876
'<div class="listing">&bull; tooltips on buildings are more informative</div>'+
877
'<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>'+
878
'<div class="listing">&bull; you can now buy 10 and sell all of a building at a time</div>'+
879
'<div class="listing">&bull; tons of optimizations and subtler changes</div>'+
880
'<div class="listing">&bull; you can now <a href="http://orteil.dashnet.org/cookies2cash/" target="_blank">convert your cookies to cash</a>!</div>'+
881
882
'</div><div class="subsection update small">'+
883
'<div class="title">05/04/2014 - pity the fool</div>'+
884
'<div class="listing">&bull; wrinklers should now be saved so you don\'t have to pop them everytime you refresh the game</div>'+
885
'<div class="listing">&bull; you now properly win 1 cookie upon reaching 10 billion cookies and making it on the local news</div>'+
886
'<div class="listing">&bull; miscellaneous fixes and tiny additions</div>'+
887
'<div class="listing">&bull; added a few very rudimentary mod hooks</div>'+
888
'<div class="listing">&bull; the game should work again in Opera</div>'+
889
'<div class="listing">&bull; don\'t forget to check out <a href="http://orteil.dashnet.org/randomgen/" target="_blank">RandomGen</a>, our all-purpose random generator maker!</div>'+
890
891
'</div><div class="subsection update small">'+
892
'<div class="title">01/04/2014 - fooling around</div>'+
893
'<div class="listing">&bull; it\'s about time : Cookie Clicker has turned into the much more realistic Cookie Baker</div>'+
894
'<div class="listing">&bull; season triggers are cheaper and properly unlock again when they run out</div>'+
895
'<div class="listing">&bull; buildings should properly unlock (reminder : building unlocking is completely cosmetic and does not change the gameplay)</div>'+
896
897
'</div><div class="subsection update small">'+
898
'<div class="title">14/02/2014 - lovely rainbowcalypse</div>'+
899
'<div class="listing">&bull; new building (it\'s been a while). More to come!</div>'+
900
'<div class="listing">&bull; you can now trigger seasonal events to your heart\'s content (upgrade unlocks at 5000 heavenly chips)</div>'+
901
'<div class="listing">&bull; new ultra-expensive batch of seasonal cookie upgrades you\'ll love to hate</div>'+
902
'<div class="listing">&bull; new timer bars for golden cookie buffs</div>'+
903
'<div class="listing">&bull; buildings are now hidden when you start out and appear as they become available</div>'+
904
'<div class="listing">&bull; technical stuff : the game is now saved through localstorage instead of browser cookies, therefore ruining a perfectly good pun</div>'+
905
906
'</div><div class="subsection update small">'+
907
'<div class="title">22/12/2013 - merry fixmas</div>'+
908
'<div class="listing">&bull; some issues with the christmas upgrades have been fixed</div>'+
909
'<div class="listing">&bull; reindeer cookie drops are now more common</div>'+
910
'<div class="listing">&bull; reindeers are now reindeer</div>'+
911
912
'</div><div class="subsection update">'+
913
'<div class="title">20/12/2013 - Christmas is here</div>'+
914
'<div class="listing">&bull; there is now a festive new evolving upgrade in store</div>'+
915
'<div class="listing">&bull; reindeer are running amok (catch them if you can!)</div>'+
916
'<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>'+
917
'<div class="listing">&bull; also added a separate option for displaying cursors</div>'+
918
'<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>'+
919
'<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>'+
920
921
'</div><div class="subsection update small">'+
922
'<div class="title">29/10/2013 - spooky update</div>'+
923
'<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>'+
924
'<div class="listing">&bull; wrath cookie now 27% spookier</div>'+
925
'<div class="listing">&bull; some other stuff</div>'+
926
'<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>'+
927
928
'</div><div class="subsection update small">'+
929
'<div class="title">15/10/2013 - it\'s a secret</div>'+
930
'<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>'+
931
'<div class="listing">&bull; golden cookie chains should now work properly</div>'+
932
933
'</div><div class="subsection update small">'+
934
'<div class="title">15/10/2013 - player-friendly</div>'+
935
'<div class="listing">&bull; heavenly upgrades are now way, way cheaper</div>'+
936
'<div class="listing">&bull; tier 5 building upgrades are 5 times cheaper</div>'+
937
'<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>'+
938
'<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>'+
939
940
'</div><div class="subsection update small">'+
941
'<div class="title">15/10/2013 - a couple fixes</div>'+
942
'<div class="listing">&bull; golden cookies should no longer spawn embarrassingly often</div>'+
943
'<div class="listing">&bull; cursors now stop moving if Fancy Graphics is turned off</div>'+
944
945
'</div><div class="subsection update small">'+
946
'<div class="title">14/10/2013 - going for the gold</div>'+
947
'<div class="listing">&bull; golden cookie chains work a bit differently</div>'+
948
'<div class="listing">&bull; golden cookie spawns are more random</div>'+
949
'<div class="listing">&bull; CpS achievements are no longer affected by golden cookie frenzies</div>'+
950
'<div class="listing">&bull; revised cookie-baking achievement requirements</div>'+
951
'<div class="listing">&bull; heavenly chips now require upgrades to function at full capacity</div>'+
952
'<div class="listing">&bull; added 4 more cookie upgrades, unlocked after reaching certain amounts of Heavenly Chips</div>'+
953
'<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>'+
954
'<div class="listing">&bull; made good progress on the mobile port</div>'+
955
956
'</div><div class="subsection update small">'+
957
'<div class="title">01/10/2013 - smoothing it out</div>'+
958
'<div class="listing">&bull; some visual effects have been completely rewritten and should now run more smoothly (and be less CPU-intensive)</div>'+
959
'<div class="listing">&bull; new upgrade tier</div>'+
960
'<div class="listing">&bull; new milk tier</div>'+
961
'<div class="listing">&bull; cookie chains have different capping mechanics</div>'+
962
'<div class="listing">&bull; antimatter condensers are back to their previous price</div>'+
963
'<div class="listing">&bull; heavenly chips now give +2% CpS again (they will be extensively reworked in the future)</div>'+
964
'<div class="listing">&bull; farms have been buffed a bit (to popular demand)</div>'+
965
'<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="http://orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">the beta</a>)</div>'+
966
967
'</div><div class="subsection update">'+
968
'<div class="title">28/09/2013 - dungeon beta</div>'+
969
'<div class="listing">&bull; from now on, big updates will come through a beta stage first (you can <a href="http://orteil.dashnet.org/cookieclicker/betadungeons/" target="_blank">try it here</a>)</div>'+
970
'<div class="listing">&bull; first dungeons! (you need 50 factories to unlock them!)</div>'+
971
'<div class="listing">&bull; cookie chains can be longer</div>'+
972
'<div class="listing">&bull; antimatter condensers are a bit more expensive</div>'+
973
'<div class="listing">&bull; heavenly chips now only give +1% cps each (to account for all the cookies made from condensers)</div>'+
974
'<div class="listing">&bull; added flavor text on all upgrades</div>'+
975
976
'</div><div class="subsection update small">'+
977
'<div class="title">15/09/2013 - anticookies</div>'+
978
'<div class="listing">&bull; ran out of regular matter to make your cookies? Try our new antimatter condensers!</div>'+
979
'<div class="listing">&bull; renamed Hard-reset to "Wipe save" to avoid confusion</div>'+
980
'<div class="listing">&bull; reset achievements are now regular achievements and require cookies baked all time, not cookies in bank</div>'+
981
'<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>'+
982
'<div class="listing">&bull; golden cookie clicks are no longer reset by soft-resets</div>'+
983
'<div class="listing">&bull; you can now see how long you\'ve been playing in the stats</div>'+
984
985
'</div><div class="subsection update small">'+
986
'<div class="title">08/09/2013 - everlasting cookies</div>'+
987
'<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>'+
988
'<div class="listing">&bull; save format has been slightly modified to take less space</div>'+
989
'<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>'+
990
'<div class="listing">&bull; clicking frenzy is now x777</div>'+
991
992
'</div><div class="subsection update small">'+
993
'<div class="title">04/09/2013 - smarter cookie</div>'+
994
'<div class="listing">&bull; golden cookies only have 20% chance of giving the same outcome twice in a row now</div>'+
995
'<div class="listing">&bull; added a golden cookie upgrade</div>'+
996
'<div class="listing">&bull; added an upgrade that makes pledges last twice as long (requires having pledged 10 times)</div>'+
997
'<div class="listing">&bull; Quintillion fingers is now twice as efficient</div>'+
998
'<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>'+
999
1000
'</div><div class="subsection update small">'+
1001
'<div class="title">02/09/2013 - a better way out</div>'+
1002
'<div class="listing">&bull; Elder Covenant is even cheaper, and revoking it is cheaper still (also added a new achievement for getting it)</div>'+
1003
'<div class="listing">&bull; each grandma upgrade now requires 15 of the matching building</div>'+
1004
'<div class="listing">&bull; the dreaded bottom cursor has been fixed with a new cursor display style</div>'+
1005
'<div class="listing">&bull; added an option for faster, cheaper graphics</div>'+
1006
'<div class="listing">&bull; base64 encoding has been redone; this might make saving possible again on some older browsers</div>'+
1007
'<div class="listing">&bull; shadow achievements now have their own section</div>'+
1008
'<div class="listing">&bull; raspberry juice is now named raspberry milk, despite raspberry juice being delicious and going unquestionably well with cookies</div>'+
1009
'<div class="listing">&bull; HOTFIX : cursors now click; fancy graphics button renamed; cookies amount now more visible against cursors</div>'+
1010
1011
'</div><div class="subsection update small">'+
1012
'<div class="title">01/09/2013 - sorting things out</div>'+
1013
'<div class="listing">&bull; upgrades and achievements are properly sorted in the stats screen</div>'+
1014
'<div class="listing">&bull; made Elder Covenant much cheaper and less harmful</div>'+
1015
'<div class="listing">&bull; importing from the first version has been disabled, as promised</div>'+
1016
'<div class="listing">&bull; "One mind" now actually asks you to confirm the upgrade</div>'+
1017
1018
'</div><div class="subsection update small">'+
1019
'<div class="title">31/08/2013 - hotfixes</div>'+
1020
'<div class="listing">&bull; added a way to permanently stop the grandmapocalypse</div>'+
1021
'<div class="listing">&bull; Elder Pledge price is now capped</div>'+
1022
'<div class="listing">&bull; One Mind and other grandma research upgrades are now a little more powerful, if not 100% accurate</div>'+
1023
'<div class="listing">&bull; "golden" cookie now appears again during grandmapocalypse; Elder Pledge-related achievements are now unlockable</div>'+
1024
1025
'</div><div class="subsection update">'+
1026
'<div class="title">31/08/2013 - too many grandmas</div>'+
1027
'<div class="listing">&bull; the grandmapocalypse is back, along with more grandma types</div>'+
1028
'<div class="listing">&bull; added some upgrades that boost your clicking power and make it scale with your cps</div>'+
1029
'<div class="listing">&bull; clicking achievements made harder; Neverclick is now a shadow achievement; Uncanny clicker should now truly be a world record</div>'+
1030
1031
'</div><div class="subsection update small">'+
1032
'<div class="title">28/08/2013 - over-achiever</div>'+
1033
'<div class="listing">&bull; added a few more achievements</div>'+
1034
'<div class="listing">&bull; reworked the "Bake X cookies" achievements so they take longer to achieve</div>'+
1035
1036
'</div><div class="subsection update small">'+
1037
'<div class="title">27/08/2013 - a bad idea</div>'+
1038
'<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>'+
1039
'<div class="listing">&bull; made some achievements hidden for added mystery</div>'+
1040
1041
'</div><div class="subsection update">'+
1042
'<div class="title">27/08/2013 - a sense of achievement</div>'+
1043
'<div class="listing">&bull; added achievements (and milk)</div>'+
1044
'<div class="listing"><i>(this is a big update, please don\'t get too mad if you lose some data!)</i></div>'+
1045
1046
'</div><div class="subsection update small">'+
1047
'<div class="title">26/08/2013 - new upgrade tier</div>'+
1048
'<div class="listing">&bull; added some more upgrades (including a couple golden cookie-related ones)</div>'+
1049
'<div class="listing">&bull; added clicking stats</div>'+
1050
1051
'</div><div class="subsection update small">'+
1052
'<div class="title">26/08/2013 - more tweaks</div>'+
1053
'<div class="listing">&bull; tweaked a couple cursor upgrades</div>'+
1054
'<div class="listing">&bull; made time machines less powerful</div>'+
1055
'<div class="listing">&bull; added offline mode option</div>'+
1056
1057
'</div><div class="subsection update small">'+
1058
'<div class="title">25/08/2013 - tweaks</div>'+
1059
'<div class="listing">&bull; rebalanced progression curve (mid- and end-game objects cost more and give more)</div>'+
1060
'<div class="listing">&bull; added some more cookie upgrades</div>'+
1061
'<div class="listing">&bull; added CpS for cursors</div>'+
1062
'<div class="listing">&bull; added sell button</div>'+
1063
'<div class="listing">&bull; made golden cookie more useful</div>'+
1064
1065
'</div><div class="subsection update small">'+
1066
'<div class="title">24/08/2013 - hotfixes</div>'+
1067
'<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>'+
1068
'<div class="listing">&bull; upgrade store now has unlimited slots (just hover over it), due to popular demand</div>'+
1069
'<div class="listing">&bull; added update log</div>'+
1070
1071
'</div><div class="subsection update">'+
1072
'<div class="title">24/08/2013 - big update!</div>'+
1073
'<div class="listing">&bull; revamped the whole game (new graphics, new game mechanics)</div>'+
1074
'<div class="listing">&bull; added upgrades</div>'+
1075
'<div class="listing">&bull; much safer saving</div>'+
1076
1077
'</div><div class="subsection update">'+
1078
'<div class="title">08/08/2013 - game launch</div>'+
1079
'<div class="listing">&bull; made the game in a couple hours, for laughs</div>'+
1080
'<div class="listing">&bull; kinda starting to regret it</div>'+
1081
'<div class="listing">&bull; ah well</div>'+
1082
'</div>'+
1083
'</div>'
1084
;
1085
1086
Game.ready=0;
1087
1088
Game.Load=function()
1089
{
1090
//l('javascriptError').innerHTML='<div style="padding:64px 128px;"><div class="title">Loading...</div></div>';
1091
Game.Loader=new Loader();
1092
Game.Loader.domain='img/';
1093
Game.Loader.loaded=Game.Init;
1094
Game.Loader.Load(['filler.png']);
1095
}
1096
Game.ErrorFrame=function()
1097
{
1098
l('javascriptError').innerHTML=
1099
'<div class="title">Oops. Wrong address!</div>'+
1100
'<div>It looks like you\'re accessing Cookie Clicker from another URL than the official one.<br>'+
1101
'You can <a href="http://orteil.dashnet.org/cookieclicker/" target="_blank">play Cookie Clicker over here</a>!<br>'+
1102
'<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>';
1103
}
1104
Game.timedout=false;
1105
Game.Timeout=function()
1106
{
1107
Game.WriteSave();
1108
Game.killShimmers();
1109
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>';
1110
l('javascriptError').style.display='block';
1111
Game.timedout=true;
1112
console.log('[=== Game timed out and has been put in sleep mode. Data was saved. ===]');
1113
}
1114
Game.Resume=function()
1115
{
1116
l('javascriptError').innerHTML='';
1117
l('javascriptError').style.display='none';
1118
Game.timedout=false;
1119
Game.time=Date.now();
1120
Game.accumulatedDelay=0;
1121
Game.delayTimeouts=0;
1122
Game.lastActivity=Date.now();
1123
Game.Loop();
1124
Game.LoadSave();
1125
console.log('[=== Game resumed! Data was loaded. ===]');
1126
}
1127
1128
1129
Game.Init=function()
1130
{
1131
Game.ready=1;
1132
1133
/*=====================================================================================
1134
VARIABLES AND PRESETS
1135
=======================================================================================*/
1136
Game.T=0;
1137
Game.drawT=0;
1138
Game.loopT=0;
1139
Game.fps=30;
1140
1141
Game.season=Game.baseSeason;
1142
1143
Game.l=l('game');
1144
Game.bounds=0;//rectangle defining screen limits (right,left,bottom,top) updated every logic frame
1145
1146
if (Game.mobile==1)
1147
{
1148
l('wrapper').className='mobile';
1149
}
1150
Game.clickStr=Game.touchEvents?'ontouchend':'onclick';
1151
1152
Game.SaveTo='CookieClickerGame';
1153
if (Game.beta) Game.SaveTo='CookieClickerGameBeta';
1154
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>':'');
1155
1156
if (Game.beta) {var me=l('linkVersionBeta');me.parentNode.removeChild(me);}
1157
else if (Game.version==1.0466) {var me=l('linkVersionOld');me.parentNode.removeChild(me);}
1158
else {var me=l('linkVersionLive');me.parentNode.removeChild(me);}
1159
1160
//l('links').innerHTML=(Game.beta?'<a href="../" target="blank">Live version</a> | ':'<a href="beta" target="blank">Try the beta!</a> | ')+'<a href="http://orteil.dashnet.org/experiments/cookie/" target="blank">Classic</a>';
1161
//l('links').innerHTML='<a href="http://orteil.dashnet.org/experiments/cookie/" target="blank">Cookie Clicker Classic</a>';
1162
1163
Game.lastActivity=Date.now();//reset on mouse move, key press or click
1164
1165
//latency compensator stuff
1166
Game.time=Date.now();
1167
Game.accumulatedDelay=0;
1168
Game.delayTimeouts=0;//how many times we've gone over the timeout delay
1169
Game.catchupLogic=0;
1170
Game.fpsStartTime=0;
1171
Game.frameNumber=0;
1172
Game.currentFps=Game.fps;
1173
Game.previousFps=Game.currentFps;
1174
Game.getFps=function()
1175
{
1176
Game.frameNumber++;
1177
var currentTime=(Date.now()-Game.fpsStartTime )/1000;
1178
var result=Math.floor((Game.frameNumber/currentTime));
1179
if (currentTime>1)
1180
{
1181
Game.fpsStartTime=Date.now();
1182
Game.frameNumber=0;
1183
}
1184
return result;
1185
}
1186
1187
Game.cookiesEarned=0;//all cookies earned during gameplay
1188
Game.cookies=0;//cookies
1189
Game.cookiesd=0;//cookies display
1190
Game.cookiesPs=1;//cookies per second (to recalculate with every new purchase)
1191
Game.cookiesReset=0;//cookies lost to resetting (used to determine prestige and heavenly chips)
1192
Game.cookieClicks=0;//+1 for each click on the cookie
1193
Game.goldenClicks=0;//+1 for each golden cookie clicked (all time)
1194
Game.goldenClicksLocal=0;//+1 for each golden cookie clicked (this game only)
1195
Game.missedGoldenClicks=0;//+1 for each golden cookie missed
1196
Game.handmadeCookies=0;//all the cookies made from clicking the cookie
1197
Game.milkProgress=0;//you gain a little bit for each achievement. Each increment of 1 is a different milk displayed.
1198
Game.milkH=Game.milkProgress/2;//milk height, between 0 and 1 (although should never go above 0.5)
1199
Game.milkHd=0;//milk height display
1200
Game.milkType=0;//custom milk
1201
Game.bgType=0;//custom background
1202
Game.chimeType=0;//golden cookie chime
1203
Game.prestige=0;//prestige level (recalculated depending on Game.cookiesReset)
1204
Game.heavenlyChips=0;//heavenly chips the player currently has
1205
Game.heavenlyChipsDisplayed=0;//ticks up or down to match Game.heavenlyChips
1206
Game.heavenlyChipsSpent=0;//heavenly chips spent on cookies, upgrades and such
1207
Game.heavenlyCookies=0;//how many cookies have we baked from chips (unused)
1208
Game.permanentUpgrades=[-1,-1,-1,-1,-1];
1209
Game.ascensionMode=0;//type of challenge run if any
1210
Game.resets=0;//reset counter
1211
Game.lumps=-1;//sugar lumps
1212
Game.lumpsTotal=-1;//sugar lumps earned across all playthroughs (-1 means they haven't even started yet)
1213
Game.lumpT=Date.now();//time when the current lump started forming
1214
Game.lumpRefill=0;//time when we last used a sugar lump (on minigame refills etc)
1215
1216
Game.makeSeed=function()
1217
{
1218
var chars='abcdefghijklmnopqrstuvwxyz'.split('');
1219
var str='';
1220
for (var i=0;i<5;i++){str+=choose(chars);}
1221
return str;
1222
}
1223
Game.seed=Game.makeSeed();//each run has its own seed, used for deterministic random stuff
1224
1225
Game.volume=50;//sound volume
1226
1227
Game.elderWrath=0;
1228
Game.elderWrathOld=0;
1229
Game.elderWrathD=0;
1230
Game.pledges=0;
1231
Game.pledgeT=0;
1232
Game.researchT=0;
1233
Game.nextResearch=0;
1234
Game.cookiesSucked=0;//cookies sucked by wrinklers
1235
Game.cpsSucked=0;//percent of CpS being sucked by wrinklers
1236
Game.wrinklersPopped=0;
1237
Game.santaLevel=0;
1238
Game.reindeerClicked=0;
1239
Game.seasonT=0;
1240
Game.seasonUses=0;
1241
Game.dragonLevel=0;
1242
Game.dragonAura=0;
1243
Game.dragonAura2=0;
1244
1245
Game.fortuneGC=0;
1246
Game.fortuneCPS=0;
1247
1248
Game.blendModesOn=(document.createElement('detect').style.mixBlendMode==='');
1249
1250
Game.bg='';//background (grandmas and such)
1251
Game.bgFade='';//fading to background
1252
Game.bgR=0;//ratio (0 - not faded, 1 - fully faded)
1253
Game.bgRd=0;//ratio displayed
1254
1255
Game.windowW=window.innerWidth;
1256
Game.windowH=window.innerHeight;
1257
1258
window.addEventListener('resize',function(event)
1259
{
1260
Game.windowW=window.innerWidth;
1261
Game.windowH=window.innerHeight;
1262
1263
for (var i in Game.Objects)
1264
{
1265
var me=Game.Objects[i];
1266
me.toResize=true;
1267
if (me.minigame && me.minigame.onResize) me.minigame.onResize();
1268
}
1269
});
1270
1271
Game.startDate=parseInt(Date.now());//when we started playing
1272
Game.fullDate=parseInt(Date.now());//when we started playing (carries over with resets)
1273
Game.lastDate=parseInt(Date.now());//when we last saved the game (used to compute "cookies made since we closed the game" etc)
1274
1275
Game.prefs=[];
1276
Game.DefaultPrefs=function()
1277
{
1278
Game.prefs.particles=1;//particle effects : falling cookies etc
1279
Game.prefs.numbers=1;//numbers that pop up when clicking the cookie
1280
Game.prefs.autosave=1;//save the game every minute or so
1281
Game.prefs.autoupdate=1;//send an AJAX request to the server every 30 minutes (note : ignored)
1282
Game.prefs.milk=1;//display milk
1283
Game.prefs.fancy=1;//CSS shadow effects (might be heavy on some browsers)
1284
Game.prefs.warn=0;//warn before closing the window
1285
Game.prefs.cursors=1;//display cursors
1286
Game.prefs.focus=1;//make the game refresh less frequently when off-focus
1287
Game.prefs.popups=0;//use old-style popups
1288
Game.prefs.format=0;//shorten numbers
1289
Game.prefs.notifs=0;//notifications fade faster
1290
Game.prefs.animate=1;//animate buildings
1291
Game.prefs.wobbly=1;//wobbly cookie
1292
Game.prefs.monospace=0;//alt monospace font for cookies
1293
Game.prefs.filters=0;//CSS filter effects (might be heavy on some browsers)
1294
Game.prefs.cookiesound=1;//use new cookie click sound
1295
Game.prefs.crates=0;//show crates around icons in stats
1296
Game.prefs.altDraw=0;//use requestAnimationFrame to update drawing instead of fixed 30 fps setTimeout
1297
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
1298
Game.prefs.extraButtons=1;//if true, show Mute buttons and the building master bar
1299
Game.prefs.askLumps=0;//if true, show a prompt before spending lumps
1300
Game.prefs.customGrandmas=1;//if true, show patreon names for grandmas
1301
Game.prefs.timeout=0;//if true, game may show pause screen when timed out
1302
}
1303
Game.DefaultPrefs();
1304
1305
window.onbeforeunload=function(event)
1306
{
1307
if (Game.prefs && Game.prefs.warn)
1308
{
1309
if (typeof event=='undefined') event=window.event;
1310
if (event) event.returnValue='Are you sure you want to close Cookie Clicker?';
1311
}
1312
}
1313
1314
Game.Mobile=function()
1315
{
1316
if (!Game.mobile)
1317
{
1318
l('wrapper').className='mobile';
1319
Game.mobile=1;
1320
}
1321
else
1322
{
1323
l('wrapper').className='';
1324
Game.mobile=0;
1325
}
1326
}
1327
1328
Game.showBackupWarning=function()
1329
{
1330
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]);
1331
}
1332
1333
/*=====================================================================================
1334
MOD HOOKS (will be subject to change, probably shouldn't be used yet)
1335
=======================================================================================*/
1336
//really primitive custom mods support - might not be of any use at all (could theoretically be used for custom upgrades and achievements I guess?)
1337
Game.customChecks=[];//push functions into this to add them to the "check for upgrade/achievement conditions" that happens every few seconds
1338
Game.customInit=[];//add to the initialization call
1339
Game.customLogic=[];//add to the logic calls
1340
Game.customDraw=[];//add to the draw calls
1341
Game.customSave=[];//add to the save write calls (save to your own localstorage key)
1342
Game.customLoad=[];//add to the save load calls
1343
Game.customReset=[];//add to the reset calls
1344
Game.customTickers=[];//add to the random tickers (functions should return arrays of text)
1345
Game.customCps=[];//add to the CpS computation (functions should return something to add to the multiplier ie. 0.1 for an addition of 10 to the CpS multiplier)
1346
Game.customCpsMult=[];//add to the CpS multiplicative computation (functions should return something to multiply by the multiplier ie. 1.05 for a 5% increase of the multiplier)
1347
Game.customMouseCps=[];//add to the cookies earned per click computation (functions should return something to add to the multiplier ie. 0.1 for an addition of 10 to the CpS multiplier)
1348
Game.customMouseCpsMult=[];//add to the cookies earned per click multiplicative computation (functions should return something to multiply by the multiplier ie. 1.05 for a 5% increase of the multiplier)
1349
Game.customCookieClicks=[];//add to the cookie click calls
1350
Game.customCreate=[];//create your new upgrades and achievements in there
1351
1352
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")
1353
{
1354
var js=document.createElement('script');
1355
var id=url.split('/');id=id[id.length-1].split('.')[0];
1356
js.setAttribute('type','text/javascript');
1357
js.setAttribute('id','modscript_'+id);
1358
js.setAttribute('src',url);
1359
document.head.appendChild(js);
1360
console.log('Loaded the mod '+url+', '+id+'.');
1361
}
1362
1363
//replacing an existing canvas picture with a new one at runtime : Game.Loader.Replace('perfectCookie.png','imperfectCookie.png');
1364
//upgrades and achievements can use other pictures than icons.png; declare their icon with [posX,posY,'http://example.com/myIcons.png']
1365
//check out the "UNLOCKING STUFF" section to see how unlocking achievs and upgrades is done (queue yours in Game.customChecks)
1366
//if you're making a mod, don't forget to add a Game.Win('Third-party') somewhere in there!
1367
1368
//IMPORTANT : all of the above is susceptible to heavy change, proper modding API in the works
1369
1370
1371
1372
1373
/*=====================================================================================
1374
BAKERY NAME
1375
=======================================================================================*/
1376
Game.RandomBakeryName=function()
1377
{
1378
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']);
1379
}
1380
Game.GetBakeryName=function() {return Game.RandomBakeryName();}
1381
Game.bakeryName=Game.GetBakeryName();
1382
Game.bakeryNameL=l('bakeryName');
1383
Game.bakeryNameL.innerHTML=Game.bakeryName+'\'s bakery';
1384
Game.bakeryNameSet=function(what)
1385
{
1386
Game.bakeryName=what.replace(/\W+/g,' ');
1387
Game.bakeryName=Game.bakeryName.substring(0,28);
1388
Game.bakeryNameRefresh();
1389
}
1390
Game.bakeryNameRefresh=function()
1391
{
1392
var name=Game.bakeryName;
1393
if (name.slice(-1).toLowerCase()=='s') name+='\' bakery'; else name+='\'s bakery';
1394
Game.bakeryNameL.innerHTML=name;
1395
name=Game.bakeryName.toLowerCase();
1396
if (name=='orteil') Game.Win('God complex');
1397
if (name.indexOf('saysopensesame',name.length-('saysopensesame').length)>0 && !Game.sesame) Game.OpenSesame();
1398
Game.recalculateGains=1;
1399
}
1400
Game.bakeryNamePrompt=function()
1401
{
1402
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']);
1403
l('bakeryNameInput').focus();
1404
l('bakeryNameInput').select();
1405
}
1406
Game.bakeryNamePromptRandom=function()
1407
{
1408
l('bakeryNameInput').value=Game.RandomBakeryName();
1409
}
1410
AddEvent(Game.bakeryNameL,'click',Game.bakeryNamePrompt);
1411
1412
1413
/*=====================================================================================
1414
TOOLTIP
1415
=======================================================================================*/
1416
Game.tooltip={text:'',x:0,y:0,origin:'',on:0,tt:l('tooltip'),tta:l('tooltipAnchor'),shouldHide:1,dynamic:0,from:0};
1417
Game.tooltip.draw=function(from,text,origin)
1418
{
1419
this.shouldHide=0;
1420
this.text=text;
1421
this.from=from;
1422
//this.x=x;
1423
//this.y=y;
1424
this.origin=origin;
1425
var tt=this.tt;
1426
var tta=this.tta;
1427
tt.style.left='auto';
1428
tt.style.top='auto';
1429
tt.style.right='auto';
1430
tt.style.bottom='auto';
1431
if (typeof this.text==='function')
1432
{
1433
var text=this.text();
1434
if (text=='') tta.style.opacity='0';
1435
else
1436
{
1437
tt.innerHTML=unescape(text);
1438
tta.style.opacity='1';
1439
}
1440
}
1441
else tt.innerHTML=unescape(this.text);
1442
//tt.innerHTML=(typeof this.text==='function')?unescape(this.text()):unescape(this.text);
1443
tta.style.display='block';
1444
tta.style.visibility='hidden';
1445
Game.tooltip.update();
1446
tta.style.visibility='visible';
1447
this.on=1;
1448
}
1449
Game.tooltip.update=function()
1450
{
1451
var X=0;
1452
var Y=0;
1453
var width=this.tt.offsetWidth;
1454
var height=this.tt.offsetHeight;
1455
if (this.origin=='store')
1456
{
1457
X=Game.windowW-332-width;
1458
Y=Game.mouseY-32;
1459
if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-42;
1460
Y=Math.max(0,Math.min(Game.windowH-height-44,Y));
1461
/*this.tta.style.right='308px';//'468px';
1462
this.tta.style.left='auto';
1463
if (Game.onCrate) Y=Game.onCrate.getBoundingClientRect().top-2;
1464
this.tta.style.top=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y-48))+'px';*/
1465
}
1466
else
1467
{
1468
if (Game.onCrate)
1469
{
1470
var rect=Game.onCrate.getBoundingClientRect();
1471
rect={left:rect.left,top:rect.top,right:rect.right,bottom:rect.bottom};
1472
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)
1473
{return false;/*rect.left=Game.mouseX-24;rect.right=Game.mouseX+24;rect.top=Game.mouseY-24;rect.bottom=Game.mouseY+24;*/}
1474
if (this.origin=='left')
1475
{
1476
X=rect.left-width-16;
1477
Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;
1478
Y=Math.max(0,Math.min(Game.windowH-height-19,Y));
1479
if (X<0) X=rect.right;
1480
}
1481
else
1482
{
1483
X=rect.left+(rect.right-rect.left)/2-width/2-8;
1484
Y=rect.top-height-48;
1485
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1486
if (Y<0) Y=rect.bottom-32;
1487
}
1488
}
1489
else if (this.origin=='bottom-right')
1490
{
1491
X=Game.mouseX+8;
1492
Y=Game.mouseY-32;
1493
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1494
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1495
}
1496
else if (this.origin=='bottom')
1497
{
1498
X=Game.mouseX-width/2-8;
1499
Y=Game.mouseY+24;
1500
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1501
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1502
}
1503
else if (this.origin=='left')
1504
{
1505
X=Game.mouseX-width-24;
1506
Y=Game.mouseY-height/2-8;
1507
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1508
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1509
}
1510
else if (this.origin=='this' && this.from)
1511
{
1512
var rect=this.from.getBoundingClientRect();
1513
X=(rect.left+rect.right)/2-width/2-8;
1514
Y=(rect.top)-this.tt.clientHeight-48;
1515
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1516
//Y=Math.max(0,Math.min(Game.windowH-this.tt.clientHeight-64,Y));
1517
if (Y<0) Y=(rect.bottom-24);
1518
if (Y+height+40>Game.windowH)
1519
{
1520
X=rect.right+8;
1521
Y=rect.top+(rect.bottom-rect.top)/2-height/2-38;
1522
Y=Math.max(0,Math.min(Game.windowH-height-19,Y));
1523
}
1524
}
1525
else
1526
{
1527
X=Game.mouseX-width/2-8;
1528
Y=Game.mouseY-height-32;
1529
X=Math.max(0,Math.min(Game.windowW-width-16,X));
1530
Y=Math.max(0,Math.min(Game.windowH-height-64,Y));
1531
}
1532
}
1533
this.tta.style.left=X+'px';
1534
this.tta.style.right='auto';
1535
this.tta.style.top=Y+'px';
1536
this.tta.style.bottom='auto';
1537
if (this.shouldHide) {this.hide();this.shouldHide=0;}
1538
else if (Game.drawT%10==0 && typeof(this.text)=='function')
1539
{
1540
var text=this.text();
1541
if (text=='') this.tta.style.opacity='0';
1542
else
1543
{
1544
this.tt.innerHTML=unescape(text);
1545
this.tta.style.opacity='1';
1546
}
1547
}
1548
}
1549
Game.tooltip.hide=function()
1550
{
1551
this.tta.style.display='none';
1552
this.dynamic=0;
1553
this.on=0;
1554
}
1555
Game.getTooltip=function(text,origin,isCrate)
1556
{
1557
origin=(origin?origin:'middle');
1558
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();}"';
1559
else return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=0;Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');Game.tooltip.wobble();"';
1560
}
1561
Game.getDynamicTooltip=function(func,origin,isCrate)
1562
{
1563
origin=(origin?origin:'middle');
1564
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();}"';
1565
return 'onMouseOut="Game.tooltip.shouldHide=1;" onMouseOver="Game.tooltip.dynamic=1;Game.tooltip.draw(this,'+'function(){return '+func+'();}'+',\''+origin+'\');Game.tooltip.wobble();"';
1566
}
1567
Game.attachTooltip=function(el,func,origin)
1568
{
1569
if (typeof func==='string')
1570
{
1571
var str=func;
1572
func=function(str){return function(){return str;};}(str);
1573
}
1574
origin=(origin?origin:'middle');
1575
AddEvent(el,'mouseover',function(func,el,origin){return function(){Game.tooltip.dynamic=1;Game.tooltip.draw(el,func,origin);};}(func,el,origin));
1576
AddEvent(el,'mouseout',function(){return function(){Game.tooltip.shouldHide=1;};}());
1577
}
1578
Game.tooltip.wobble=function()
1579
{
1580
//disabled because this effect doesn't look good with the slight slowdown it might or might not be causing.
1581
if (false)
1582
{
1583
this.tt.className='framed';
1584
void this.tt.offsetWidth;
1585
this.tt.className='framed wobbling';
1586
}
1587
}
1588
1589
1590
/*=====================================================================================
1591
UPDATE CHECKER
1592
=======================================================================================*/
1593
Game.CheckUpdates=function()
1594
{
1595
ajax('server.php?q=checkupdate',Game.CheckUpdatesResponse);
1596
}
1597
Game.CheckUpdatesResponse=function(response)
1598
{
1599
var r=response.split('|');
1600
var str='';
1601
if (r[0]=='alert')
1602
{
1603
if (r[1]) str=r[1];
1604
}
1605
else if (parseFloat(r[0])>Game.version)
1606
{
1607
str='<b>New version available : v. '+r[0]+'!</b>';
1608
if (r[1]) str+='<br><small>Update note : "'+r[1]+'"</small>';
1609
str+='<br><b>Refresh to get it!</b>';
1610
}
1611
if (str!='')
1612
{
1613
l('alert').innerHTML=str;
1614
l('alert').style.display='block';
1615
}
1616
}
1617
1618
/*=====================================================================================
1619
DATA GRABBER
1620
=======================================================================================*/
1621
1622
Game.externalDataLoaded=false;
1623
1624
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'];
1625
Game.customGrandmaNames=[];
1626
Game.heralds=0;
1627
1628
Game.GrabData=function()
1629
{
1630
ajax('/patreon/grab.php',Game.GrabDataResponse);
1631
}
1632
Game.GrabDataResponse=function(response)
1633
{
1634
/*
1635
response should be formatted as
1636
{"herald":3,"grandma":"a|b|c|...}
1637
*/
1638
var r={};
1639
try{
1640
r=JSON.parse(response);
1641
if (typeof r['herald']!=='undefined')
1642
{
1643
Game.heralds=parseInt(r['herald']);
1644
Game.heralds=Math.max(0,Math.min(100,Game.heralds));
1645
}
1646
if (typeof r['grandma']!=='undefined' && r['grandma']!='')
1647
{
1648
Game.customGrandmaNames=r['grandma'].split('|');
1649
Game.customGrandmaNames=Game.customGrandmaNames.filter(function(el){return el!='';});
1650
}
1651
1652
l('heraldsAmount').innerHTML=Game.heralds;
1653
Game.externalDataLoaded=true;
1654
}catch(e){}
1655
}
1656
1657
1658
1659
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');
1660
AddEvent(l('httpsSwitch'),'click',function(){
1661
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
1662
if (location.protocol=='https:') location.href='http:'+window.location.href.substring(window.location.protocol.length);
1663
else if (location.protocol=='http:') location.href='https:'+window.location.href.substring(window.location.protocol.length);
1664
});
1665
1666
Game.attachTooltip(l('topbarOrteil'),'<div style="padding:8px;width:250px;text-align:center;">Back to Orteil\'s subdomain!<br>Lots of other games in there!</div>','this');
1667
Game.attachTooltip(l('topbarDashnet'),'<div style="padding:8px;width:250px;text-align:center;">Back to our homepage!</div>','this');
1668
Game.attachTooltip(l('topbarTwitter'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s twitter, which frequently features game updates.</div>','this');
1669
Game.attachTooltip(l('topbarTumblr'),'<div style="padding:8px;width:250px;text-align:center;">Orteil\'s tumblr, which frequently features game updates.</div>','this');
1670
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');
1671
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');
1672
Game.attachTooltip(l('topbarMerch'),'<div style="padding:8px;width:250px;text-align:center;">Cookie Clicker shirts, hoodies and stickers!</div>','this');
1673
Game.attachTooltip(l('topbarMobileCC'),'<div style="padding:8px;width:250px;text-align:center;">Play Cookie Clicker on your phone!<br>(Currently in beta, Android only; iOS version will be released later)</div>','this');
1674
Game.attachTooltip(l('topbarRandomgen'),'<div style="padding:8px;width:250px;text-align:center;">A thing we made that lets you write random generators.</div>','this');
1675
Game.attachTooltip(l('topbarIGM'),'<div style="padding:8px;width:250px;text-align:center;">A thing we made that lets you create your own idle games using a simple scripting language.</div>','this');
1676
1677
Game.attachTooltip(l('heralds'),function(){
1678
var str='';
1679
1680
if (!Game.externalDataLoaded) str+='Heralds couldn\'t be loaded. There may be an issue with our servers, or you are playing the game locally.';
1681
else
1682
{
1683
if (Game.heralds==0) str+='There are no heralds at the moment. Please consider <b style="color:#bc3aff;">donating to our Patreon</b>!';
1684
else
1685
{
1686
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>.';
1687
str+='<div class="line"></div>';
1688
if (Game.ascensionMode==1) str+='You are in a <b>Born again</b> run, and are not currently benefiting from heralds.';
1689
else if (Game.Has('Heralds')) str+='You own the <b>Heralds</b> upgrade, and therefore benefit from the production boost.';
1690
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.';
1691
}
1692
}
1693
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>';
1694
1695
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>';
1696
1697
return '<div style="padding:8px;width:300px;text-align:center;" class="prompt"><h3>Heralds</h3><div class="block">'+str+'</div></div>';
1698
},'this');
1699
l('heraldsAmount').innerHTML='?';
1700
l('heralds').style.display='inline-block';
1701
1702
Game.GrabData();
1703
1704
1705
Game.useLocalStorage=1;
1706
Game.localStorageGet=function(key)
1707
{
1708
var local=0;
1709
try {local=window.localStorage.getItem(key);} catch (exception) {}
1710
return local;
1711
}
1712
Game.localStorageSet=function(key,str)
1713
{
1714
var local=0;
1715
try {local=window.localStorage.setItem(key,str);} catch (exception) {}
1716
return local;
1717
}
1718
//window.localStorage.clear();//won't switch back to cookie-based if there is localStorage info
1719
1720
/*=====================================================================================
1721
SAVE
1722
=======================================================================================*/
1723
Game.ExportSave=function()
1724
{
1725
Game.prefs.showBackupWarning=0;
1726
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));
1727
l('textareaPrompt').focus();l('textareaPrompt').select();
1728
}
1729
Game.ImportSave=function()
1730
{
1731
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.','');
1732
l('textareaPrompt').focus();
1733
}
1734
Game.ImportSaveCode=function(save)
1735
{
1736
if (save && save!='') Game.LoadSave(save);
1737
}
1738
1739
Game.FileSave=function()
1740
{
1741
Game.prefs.showBackupWarning=0;
1742
var filename=Game.bakeryName.replace(/[^a-zA-Z0-9]+/g,'')+'Bakery';
1743
var text=Game.WriteSave(1);
1744
var blob=new Blob([text],{type:'text/plain;charset=utf-8'});
1745
saveAs(blob,filename+'.txt');
1746
}
1747
Game.FileLoad=function(e)
1748
{
1749
if (e.target.files.length==0) return false;
1750
var file=e.target.files[0];
1751
var reader=new FileReader();
1752
reader.onload=function(e)
1753
{
1754
Game.ImportSaveCode(e.target.result);
1755
}
1756
reader.readAsText(file);
1757
}
1758
1759
Game.toSave=false;
1760
Game.WriteSave=function(type)
1761
{
1762
Game.toSave=false;
1763
//type : none is default, 1=return string only, 2=return uncompressed string, 3=return uncompressed, commented string
1764
Game.lastDate=parseInt(Game.time);
1765
var str='';
1766
if (type==3) str+='\nGame version\n';
1767
str+=Game.version+'|';
1768
str+='|';//just in case we need some more stuff here
1769
if (type==3) str+='\n\nRun details';
1770
str+=//save stats
1771
(type==3?'\n run start date : ':'')+parseInt(Game.startDate)+';'+
1772
(type==3?'\n legacy start date : ':'')+parseInt(Game.fullDate)+';'+
1773
(type==3?'\n date when we last opened the game : ':'')+parseInt(Game.lastDate)+';'+
1774
(type==3?'\n bakery name : ':'')+(Game.bakeryName)+';'+
1775
(type==3?'\n seed : ':'')+(Game.seed)+
1776
'|';
1777
if (type==3) str+='\n\nPacked preferences bitfield\n ';
1778
var str2=//prefs
1779
(Game.prefs.particles?'1':'0')+
1780
(Game.prefs.numbers?'1':'0')+
1781
(Game.prefs.autosave?'1':'0')+
1782
(Game.prefs.autoupdate?'1':'0')+
1783
(Game.prefs.milk?'1':'0')+
1784
(Game.prefs.fancy?'1':'0')+
1785
(Game.prefs.warn?'1':'0')+
1786
(Game.prefs.cursors?'1':'0')+
1787
(Game.prefs.focus?'1':'0')+
1788
(Game.prefs.format?'1':'0')+
1789
(Game.prefs.notifs?'1':'0')+
1790
(Game.prefs.wobbly?'1':'0')+
1791
(Game.prefs.monospace?'1':'0')+
1792
(Game.prefs.filters?'1':'0')+
1793
(Game.prefs.cookiesound?'1':'0')+
1794
(Game.prefs.crates?'1':'0')+
1795
(Game.prefs.showBackupWarning?'1':'0')+
1796
(Game.prefs.extraButtons?'1':'0')+
1797
(Game.prefs.askLumps?'1':'0')+
1798
(Game.prefs.customGrandmas?'1':'0')+
1799
(Game.prefs.timeout?'1':'0')+
1800
'';
1801
str2=pack3(str2);
1802
str+=str2+'|';
1803
if (type==3) str+='\n\nMisc game data';
1804
str+=
1805
(type==3?'\n cookies : ':'')+parseFloat(Game.cookies).toString()+';'+
1806
(type==3?'\n total cookies earned : ':'')+parseFloat(Game.cookiesEarned).toString()+';'+
1807
(type==3?'\n cookie clicks : ':'')+parseInt(Math.floor(Game.cookieClicks))+';'+
1808
(type==3?'\n golden cookie clicks : ':'')+parseInt(Math.floor(Game.goldenClicks))+';'+
1809
(type==3?'\n cookies made by clicking : ':'')+parseFloat(Game.handmadeCookies).toString()+';'+
1810
(type==3?'\n golden cookies missed : ':'')+parseInt(Math.floor(Game.missedGoldenClicks))+';'+
1811
(type==3?'\n background type : ':'')+parseInt(Math.floor(Game.bgType))+';'+
1812
(type==3?'\n milk type : ':'')+parseInt(Math.floor(Game.milkType))+';'+
1813
(type==3?'\n cookies from past runs : ':'')+parseFloat(Game.cookiesReset).toString()+';'+
1814
(type==3?'\n elder wrath : ':'')+parseInt(Math.floor(Game.elderWrath))+';'+
1815
(type==3?'\n pledges : ':'')+parseInt(Math.floor(Game.pledges))+';'+
1816
(type==3?'\n pledge time left : ':'')+parseInt(Math.floor(Game.pledgeT))+';'+
1817
(type==3?'\n currently researching : ':'')+parseInt(Math.floor(Game.nextResearch))+';'+
1818
(type==3?'\n research time left : ':'')+parseInt(Math.floor(Game.researchT))+';'+
1819
(type==3?'\n ascensions : ':'')+parseInt(Math.floor(Game.resets))+';'+
1820
(type==3?'\n golden cookie clicks (this run) : ':'')+parseInt(Math.floor(Game.goldenClicksLocal))+';'+
1821
(type==3?'\n cookies sucked by wrinklers : ':'')+parseFloat(Game.cookiesSucked).toString()+';'+
1822
(type==3?'\n wrinkles popped : ':'')+parseInt(Math.floor(Game.wrinklersPopped))+';'+
1823
(type==3?'\n santa level : ':'')+parseInt(Math.floor(Game.santaLevel))+';'+
1824
(type==3?'\n reindeer clicked : ':'')+parseInt(Math.floor(Game.reindeerClicked))+';'+
1825
(type==3?'\n season time left : ':'')+parseInt(Math.floor(Game.seasonT))+';'+
1826
(type==3?'\n season switcher uses : ':'')+parseInt(Math.floor(Game.seasonUses))+';'+
1827
(type==3?'\n current season : ':'')+(Game.season?Game.season:'')+';';
1828
var wrinklers=Game.SaveWrinklers();
1829
str+=
1830
(type==3?'\n amount of cookies contained in wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amount))+';'+
1831
(type==3?'\n number of wrinklers : ':'')+parseInt(Math.floor(wrinklers.number))+';'+
1832
(type==3?'\n prestige level : ':'')+parseFloat(Game.prestige).toString()+';'+
1833
(type==3?'\n heavenly chips : ':'')+parseFloat(Game.heavenlyChips).toString()+';'+
1834
(type==3?'\n heavenly chips spent : ':'')+parseFloat(Game.heavenlyChipsSpent).toString()+';'+
1835
(type==3?'\n heavenly cookies : ':'')+parseFloat(Game.heavenlyCookies).toString()+';'+
1836
(type==3?'\n ascension mode : ':'')+parseInt(Math.floor(Game.ascensionMode))+';'+
1837
(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]))+';'+
1838
(type==3?'\n dragon level : ':'')+parseInt(Math.floor(Game.dragonLevel))+';'+
1839
(type==3?'\n dragon aura : ':'')+parseInt(Math.floor(Game.dragonAura))+';'+
1840
(type==3?'\n dragon aura 2 : ':'')+parseInt(Math.floor(Game.dragonAura2))+';'+
1841
(type==3?'\n chime type : ':'')+parseInt(Math.floor(Game.chimeType))+';'+
1842
(type==3?'\n volume : ':'')+parseInt(Math.floor(Game.volume))+';'+
1843
(type==3?'\n number of shiny wrinklers : ':'')+parseInt(Math.floor(wrinklers.shinies))+';'+
1844
(type==3?'\n amount of cookies contained in shiny wrinklers : ':'')+parseFloat(Math.floor(wrinklers.amountShinies))+';'+
1845
(type==3?'\n current amount of sugar lumps : ':'')+parseFloat(Math.floor(Game.lumps))+';'+
1846
(type==3?'\n total amount of sugar lumps made : ':'')+parseFloat(Math.floor(Game.lumpsTotal))+';'+
1847
(type==3?'\n time when current sugar lump started : ':'')+parseFloat(Math.floor(Game.lumpT))+';'+
1848
(type==3?'\n time when last refilled a minigame with a sugar lump : ':'')+parseFloat(Math.floor(Game.lumpRefill))+';'+
1849
(type==3?'\n sugar lump type : ':'')+parseInt(Math.floor(Game.lumpCurrentType))+';'+
1850
(type==3?'\n vault : ':'')+Game.vault.join(',')+';'+
1851
(type==3?'\n heralds : ':'')+parseInt(Game.heralds)+';'+
1852
(type==3?'\n golden cookie fortune : ':'')+parseInt(Game.fortuneGC)+';'+
1853
(type==3?'\n CpS fortune : ':'')+parseInt(Game.fortuneCPS)+';'+
1854
'|';//cookies and lots of other stuff
1855
1856
if (type==3) str+='\n\nBuildings : amount, bought, cookies produced, level, minigame data';
1857
for (var i in Game.Objects)//buildings
1858
{
1859
var me=Game.Objects[i];
1860
if (type==3) str+='\n '+me.name+' : ';
1861
if (me.vanilla)
1862
{
1863
str+=me.amount+','+me.bought+','+parseFloat(Math.floor(me.totalCookies))+','+parseInt(me.level);
1864
if (Game.isMinigameReady(me)) str+=','+me.minigame.save(); else str+=',';
1865
str+=','+(me.muted?'1':'0');
1866
str+=';';
1867
}
1868
}
1869
str+='|';
1870
if (type==3) str+='\n\nPacked upgrades bitfield (unlocked and bought)\n ';
1871
var toCompress=[];
1872
for (var i in Game.UpgradesById)//upgrades
1873
{
1874
var me=Game.UpgradesById[i];
1875
if (me.vanilla) toCompress.push(Math.min(me.unlocked,1),Math.min(me.bought,1));
1876
};
1877
1878
toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);
1879
1880
str+=toCompress;
1881
str+='|';
1882
if (type==3) str+='\n\nPacked achievements bitfield (won)\n ';
1883
var toCompress=[];
1884
for (var i in Game.AchievementsById)//achievements
1885
{
1886
var me=Game.AchievementsById[i];
1887
if (me.vanilla) toCompress.push(Math.min(me.won));
1888
}
1889
toCompress=pack3(toCompress.join(''));//toCompress=pack(toCompress);//CompressLargeBin(toCompress);
1890
str+=toCompress;
1891
1892
str+='|';
1893
if (type==3) str+='\n\nBuffs : type, maxTime, time, arg1, arg2, arg3';
1894
for (var i in Game.buffs)
1895
{
1896
var me=Game.buffs[i];
1897
if (me.type)
1898
{
1899
if (type==3) str+='\n '+me.type.name+' : ';
1900
if (me.type.vanilla)
1901
{
1902
str+=me.type.id+','+me.maxTime+','+me.time;
1903
if (typeof me.arg1!=='undefined') str+=','+parseFloat(me.arg1);
1904
if (typeof me.arg2!=='undefined') str+=','+parseFloat(me.arg2);
1905
if (typeof me.arg3!=='undefined') str+=','+parseFloat(me.arg3);
1906
str+=';';
1907
}
1908
}
1909
}
1910
1911
1912
if (type==3) str+='\n';
1913
1914
for (var i in Game.customSave) {Game.customSave[i]();}
1915
1916
if (type==2 || type==3)
1917
{
1918
return str;
1919
}
1920
else if (type==1)
1921
{
1922
str=escape(utf8_to_b64(str)+'!END!');
1923
return str;
1924
}
1925
else
1926
{
1927
if (Game.useLocalStorage)
1928
{
1929
//so we used to save the game using browser cookies, which was just really neat considering the game's name
1930
//we're using localstorage now, which is more efficient but not as cool
1931
//a moment of silence for our fallen puns
1932
str=utf8_to_b64(str)+'!END!';
1933
if (str.length<10)
1934
{
1935
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Purchasing an upgrade might fix this.');
1936
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.');
1937
}
1938
else
1939
{
1940
str=escape(str);
1941
Game.localStorageSet(Game.SaveTo,str);//aaand save
1942
if (!Game.localStorageGet(Game.SaveTo))
1943
{
1944
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');
1945
else Game.Notify('Error while saving','Export your save instead!');
1946
}
1947
else if (document.hasFocus())
1948
{
1949
if (Game.prefs.popups) Game.Popup('Game saved');
1950
else Game.Notify('Game saved','','',1,1);
1951
}
1952
}
1953
}
1954
else//legacy system
1955
{
1956
//that's right
1957
//we're using cookies
1958
//yeah I went there
1959
var now=new Date();//we storin dis for 5 years, people
1960
now.setFullYear(now.getFullYear()+5);//mmh stale cookies
1961
str=utf8_to_b64(str)+'!END!';
1962
Game.saveData=escape(str);
1963
str=Game.SaveTo+'='+escape(str)+'; expires='+now.toUTCString()+';';
1964
document.cookie=str;//aaand save
1965
if (document.cookie.indexOf(Game.SaveTo)<0)
1966
{
1967
if (Game.prefs.popups) Game.Popup('Error while saving.<br>Export your save instead!');
1968
else Game.Notify('Error while saving','Export your save instead!','',0,1);
1969
}
1970
else if (document.hasFocus())
1971
{
1972
if (Game.prefs.popups) Game.Popup('Game saved');
1973
else Game.Notify('Game saved','','',1,1);
1974
}
1975
}
1976
}
1977
}
1978
1979
/*=====================================================================================
1980
LOAD
1981
=======================================================================================*/
1982
Game.salvageSave=function()
1983
{
1984
//for when Cookie Clicker won't load and you need your save
1985
console.log('===================================================');
1986
console.log('This is your save data. Copypaste it (without quotation marks) into another version using the "Import save" feature.');
1987
console.log(Game.localStorageGet(Game.SaveTo));
1988
}
1989
Game.LoadSave=function(data)
1990
{
1991
var str='';
1992
if (data) str=unescape(data);
1993
else
1994
{
1995
if (Game.useLocalStorage)
1996
{
1997
var local=Game.localStorageGet(Game.SaveTo);
1998
if (!local)//no localstorage save found? let's get the cookie one last time
1999
{
2000
if (document.cookie.indexOf(Game.SaveTo)>=0)
2001
{
2002
str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);
2003
document.cookie=Game.SaveTo+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
2004
}
2005
else return false;
2006
}
2007
else
2008
{
2009
str=unescape(local);
2010
}
2011
}
2012
else//legacy system
2013
{
2014
if (document.cookie.indexOf(Game.SaveTo)>=0) str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);//get cookie here
2015
else return false;
2016
}
2017
}
2018
if (str!='')
2019
{
2020
var version=0;
2021
var oldstr=str.split('|');
2022
if (oldstr[0]<1) {}
2023
else
2024
{
2025
str=str.split('!END!')[0];
2026
str=b64_to_utf8(str);
2027
}
2028
if (str!='')
2029
{
2030
var spl='';
2031
str=str.split('|');
2032
version=parseFloat(str[0]);
2033
2034
if (isNaN(version) || str.length<5)
2035
{
2036
if (Game.prefs.popups) Game.Popup('Oops, looks like the import string is all wrong!');
2037
else Game.Notify('Error importing save','Oops, looks like the import string is all wrong!','',6,1);
2038
return false;
2039
}
2040
if (version>=1 && version>Game.version)
2041
{
2042
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+').');
2043
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);
2044
return false;
2045
}
2046
if (version==1.0501)//prompt if we loaded from the 2014 beta
2047
{
2048
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);
2049
return false;
2050
}
2051
else if (version<1.0501)//prompt if we loaded from the 2014 live version
2052
{
2053
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);
2054
}
2055
if (version>=1)
2056
{
2057
Game.T=0;
2058
2059
spl=str[2].split(';');//save stats
2060
Game.startDate=parseInt(spl[0]);
2061
Game.fullDate=parseInt(spl[1]);
2062
Game.lastDate=parseInt(spl[2]);
2063
Game.bakeryName=spl[3]?spl[3]:Game.GetBakeryName();
2064
Game.seed=spl[4]?spl[4]:Game.makeSeed();
2065
//prefs
2066
if (version<1.0503) spl=str[3].split('');
2067
else if (version<2.0046) spl=unpack2(str[3]).split('');
2068
else spl=(str[3]).split('');
2069
Game.prefs.particles=parseInt(spl[0]);
2070
Game.prefs.numbers=parseInt(spl[1]);
2071
Game.prefs.autosave=parseInt(spl[2]);
2072
Game.prefs.autoupdate=spl[3]?parseInt(spl[3]):1;
2073
Game.prefs.milk=spl[4]?parseInt(spl[4]):1;
2074
Game.prefs.fancy=parseInt(spl[5]);if (Game.prefs.fancy) Game.removeClass('noFancy'); else if (!Game.prefs.fancy) Game.addClass('noFancy');
2075
Game.prefs.warn=spl[6]?parseInt(spl[6]):0;
2076
Game.prefs.cursors=spl[7]?parseInt(spl[7]):0;
2077
Game.prefs.focus=spl[8]?parseInt(spl[8]):0;
2078
Game.prefs.format=spl[9]?parseInt(spl[9]):0;
2079
Game.prefs.notifs=spl[10]?parseInt(spl[10]):0;
2080
Game.prefs.wobbly=spl[11]?parseInt(spl[11]):0;
2081
Game.prefs.monospace=spl[12]?parseInt(spl[12]):0;
2082
Game.prefs.filters=parseInt(spl[13]);if (Game.prefs.filters) Game.removeClass('noFilters'); else if (!Game.prefs.filters) Game.addClass('noFilters');
2083
Game.prefs.cookiesound=spl[14]?parseInt(spl[14]):1;
2084
Game.prefs.crates=spl[15]?parseInt(spl[15]):0;
2085
Game.prefs.showBackupWarning=spl[16]?parseInt(spl[16]):1;
2086
Game.prefs.extraButtons=spl[17]?parseInt(spl[17]):1;if (!Game.prefs.extraButtons) Game.removeClass('extraButtons'); else if (Game.prefs.extraButtons) Game.addClass('extraButtons');
2087
Game.prefs.askLumps=spl[18]?parseInt(spl[18]):0;
2088
Game.prefs.customGrandmas=spl[19]?parseInt(spl[19]):1;
2089
Game.prefs.timeout=spl[20]?parseInt(spl[20]):0;
2090
BeautifyAll();
2091
spl=str[4].split(';');//cookies and lots of other stuff
2092
Game.cookies=parseFloat(spl[0]);
2093
Game.cookiesEarned=parseFloat(spl[1]);
2094
Game.cookieClicks=spl[2]?parseInt(spl[2]):0;
2095
Game.goldenClicks=spl[3]?parseInt(spl[3]):0;
2096
Game.handmadeCookies=spl[4]?parseFloat(spl[4]):0;
2097
Game.missedGoldenClicks=spl[5]?parseInt(spl[5]):0;
2098
Game.bgType=spl[6]?parseInt(spl[6]):0;
2099
Game.milkType=spl[7]?parseInt(spl[7]):0;
2100
Game.cookiesReset=spl[8]?parseFloat(spl[8]):0;
2101
Game.elderWrath=spl[9]?parseInt(spl[9]):0;
2102
Game.pledges=spl[10]?parseInt(spl[10]):0;
2103
Game.pledgeT=spl[11]?parseInt(spl[11]):0;
2104
Game.nextResearch=spl[12]?parseInt(spl[12]):0;
2105
Game.researchT=spl[13]?parseInt(spl[13]):0;
2106
Game.resets=spl[14]?parseInt(spl[14]):0;
2107
Game.goldenClicksLocal=spl[15]?parseInt(spl[15]):0;
2108
Game.cookiesSucked=spl[16]?parseFloat(spl[16]):0;
2109
Game.wrinklersPopped=spl[17]?parseInt(spl[17]):0;
2110
Game.santaLevel=spl[18]?parseInt(spl[18]):0;
2111
Game.reindeerClicked=spl[19]?parseInt(spl[19]):0;
2112
Game.seasonT=spl[20]?parseInt(spl[20]):0;
2113
Game.seasonUses=spl[21]?parseInt(spl[21]):0;
2114
Game.season=spl[22]?spl[22]:Game.baseSeason;
2115
var wrinklers={amount:spl[23]?parseFloat(spl[23]):0,number:spl[24]?parseInt(spl[24]):0};
2116
Game.prestige=spl[25]?parseFloat(spl[25]):0;
2117
Game.heavenlyChips=spl[26]?parseFloat(spl[26]):0;
2118
Game.heavenlyChipsSpent=spl[27]?parseFloat(spl[27]):0;
2119
Game.heavenlyCookies=spl[28]?parseFloat(spl[28]):0;
2120
Game.ascensionMode=spl[29]?parseInt(spl[29]):0;
2121
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;
2122
//if (version<1.05) {Game.heavenlyChipsEarned=Game.HowMuchPrestige(Game.cookiesReset);Game.heavenlyChips=Game.heavenlyChipsEarned;}
2123
Game.dragonLevel=spl[35]?parseInt(spl[35]):0;
2124
if (version<2.0041 && Game.dragonLevel==Game.dragonLevels.length-2) {Game.dragonLevel=Game.dragonLevels.length-1;}
2125
Game.dragonAura=spl[36]?parseInt(spl[36]):0;
2126
Game.dragonAura2=spl[37]?parseInt(spl[37]):0;
2127
Game.chimeType=spl[38]?parseInt(spl[38]):0;
2128
Game.volume=spl[39]?parseInt(spl[39]):50;
2129
wrinklers.shinies=spl[40]?parseInt(spl[40]):0;
2130
wrinklers.amountShinies=spl[41]?parseFloat(spl[41]):0;
2131
Game.lumps=spl[42]?parseFloat(spl[42]):-1;
2132
Game.lumpsTotal=spl[43]?parseFloat(spl[43]):-1;
2133
Game.lumpT=spl[44]?parseInt(spl[44]):Date.now();
2134
Game.lumpRefill=spl[45]?parseInt(spl[45]):0;
2135
Game.lumpCurrentType=spl[46]?parseInt(spl[46]):0;
2136
Game.vault=spl[47]?spl[47].split(','):[];
2137
for (var i in Game.vault){Game.vault[i]=parseInt(Game.vault[i]);}
2138
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
2139
Game.heralds=spl[48]?parseInt(spl[48]):Game.heralds;
2140
Game.fortuneGC=spl[49]?parseInt(spl[49]):0;
2141
Game.fortuneCPS=spl[50]?parseInt(spl[50]):0;
2142
2143
spl=str[5].split(';');//buildings
2144
Game.BuildingsOwned=0;
2145
for (var i in Game.ObjectsById)
2146
{
2147
var me=Game.ObjectsById[i];
2148
me.switchMinigame(false);
2149
me.pics=[];
2150
if (spl[i])
2151
{
2152
var mestr=spl[i].toString().split(',');
2153
me.amount=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);me.totalCookies=parseFloat(mestr[2]);me.level=parseInt(mestr[3]||0);
2154
if (me.minigame && me.minigameLoaded && me.minigame.reset) {me.minigame.reset(true);me.minigame.load(mestr[4]||'');} else me.minigameSave=(mestr[4]||0);
2155
me.muted=parseInt(mestr[5])||0;
2156
Game.BuildingsOwned+=me.amount;
2157
if (version<2.003) me.level=0;
2158
}
2159
else
2160
{
2161
me.amount=0;me.unlocked=0;me.bought=0;me.totalCookies=0;me.level=0;
2162
}
2163
}
2164
2165
Game.LoadMinigames();
2166
2167
if (version<1.035)//old non-binary algorithm
2168
{
2169
spl=str[6].split(';');//upgrades
2170
Game.UpgradesOwned=0;
2171
for (var i in Game.UpgradesById)
2172
{
2173
var me=Game.UpgradesById[i];
2174
if (spl[i])
2175
{
2176
var mestr=spl[i].split(',');
2177
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2178
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2179
}
2180
else
2181
{
2182
me.unlocked=0;me.bought=0;
2183
}
2184
}
2185
if (str[7]) spl=str[7].split(';'); else spl=[];//achievements
2186
Game.AchievementsOwned=0;
2187
for (var i in Game.AchievementsById)
2188
{
2189
var me=Game.AchievementsById[i];
2190
if (spl[i])
2191
{
2192
var mestr=spl[i].split(',');
2193
me.won=parseInt(mestr[0]);
2194
}
2195
else
2196
{
2197
me.won=0;
2198
}
2199
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2200
}
2201
}
2202
else if (version<1.0502)//old awful packing system
2203
{
2204
if (str[6]) spl=str[6]; else spl=[];//upgrades
2205
if (version<1.05) spl=UncompressLargeBin(spl);
2206
else spl=unpack(spl);
2207
Game.UpgradesOwned=0;
2208
for (var i in Game.UpgradesById)
2209
{
2210
var me=Game.UpgradesById[i];
2211
if (spl[i*2])
2212
{
2213
var mestr=[spl[i*2],spl[i*2+1]];
2214
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2215
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2216
}
2217
else
2218
{
2219
me.unlocked=0;me.bought=0;
2220
}
2221
}
2222
if (str[7]) spl=str[7]; else spl=[];//achievements
2223
if (version<1.05) spl=UncompressLargeBin(spl);
2224
else spl=unpack(spl);
2225
Game.AchievementsOwned=0;
2226
for (var i in Game.AchievementsById)
2227
{
2228
var me=Game.AchievementsById[i];
2229
if (spl[i])
2230
{
2231
var mestr=[spl[i]];
2232
me.won=parseInt(mestr[0]);
2233
}
2234
else
2235
{
2236
me.won=0;
2237
}
2238
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2239
}
2240
}
2241
else
2242
{
2243
if (str[6]) spl=str[6]; else spl=[];//upgrades
2244
if (version<2.0046) spl=unpack2(spl).split('');
2245
else spl=(spl).split('');
2246
Game.UpgradesOwned=0;
2247
for (var i in Game.UpgradesById)
2248
{
2249
var me=Game.UpgradesById[i];
2250
if (spl[i*2])
2251
{
2252
var mestr=[spl[i*2],spl[i*2+1]];
2253
me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);
2254
if (me.bought && Game.CountsAsUpgradeOwned(me.pool)) Game.UpgradesOwned++;
2255
}
2256
else
2257
{
2258
me.unlocked=0;me.bought=0;
2259
}
2260
}
2261
if (str[7]) spl=str[7]; else spl=[];//achievements
2262
if (version<2.0046) spl=unpack2(spl).split('');
2263
else spl=(spl).split('');
2264
Game.AchievementsOwned=0;
2265
for (var i in Game.AchievementsById)
2266
{
2267
var me=Game.AchievementsById[i];
2268
if (spl[i])
2269
{
2270
var mestr=[spl[i]];
2271
me.won=parseInt(mestr[0]);
2272
}
2273
else
2274
{
2275
me.won=0;
2276
}
2277
if (me.won && Game.CountsAsAchievementOwned(me.pool)) Game.AchievementsOwned++;
2278
}
2279
}
2280
2281
Game.killBuffs();
2282
var buffsToLoad=[];
2283
spl=(str[8]||'').split(';');//buffs
2284
for (var i in spl)
2285
{
2286
if (spl[i])
2287
{
2288
var mestr=spl[i].toString().split(',');
2289
buffsToLoad.push(mestr);
2290
}
2291
}
2292
2293
2294
for (var i in Game.ObjectsById)
2295
{
2296
var me=Game.ObjectsById[i];
2297
if (me.buyFunction) me.buyFunction();
2298
me.refresh();
2299
if (me.id>0)
2300
{
2301
if (me.muted) me.mute(1);
2302
}
2303
}
2304
2305
if (version<1.0503)//upgrades that used to be regular, but are now heavenly
2306
{
2307
var me=Game.Upgrades['Persistent memory'];me.unlocked=0;me.bought=0;
2308
var me=Game.Upgrades['Season switcher'];me.unlocked=0;me.bought=0;
2309
}
2310
2311
if (Game.bgType==-1) Game.bgType=0;
2312
if (Game.milkType==-1) Game.milkType=0;
2313
2314
2315
//advance timers
2316
var framesElapsed=Math.ceil(((Date.now()-Game.lastDate)/1000)*Game.fps);
2317
if (Game.pledgeT>0) Game.pledgeT=Math.max(Game.pledgeT-framesElapsed,1);
2318
if (Game.seasonT>0) Game.seasonT=Math.max(Game.seasonT-framesElapsed,1);
2319
if (Game.researchT>0) Game.researchT=Math.max(Game.researchT-framesElapsed,1);
2320
2321
2322
Game.ResetWrinklers();
2323
Game.LoadWrinklers(wrinklers.amount,wrinklers.number,wrinklers.shinies,wrinklers.amountShinies);
2324
2325
//recompute season trigger prices
2326
if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}
2327
Game.computeSeasonPrices();
2328
2329
//recompute prestige
2330
Game.prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
2331
//if ((Game.heavenlyChips+Game.heavenlyChipsSpent)<Game.prestige)
2332
//{Game.heavenlyChips=Game.prestige;Game.heavenlyChipsSpent=0;}//chips owned and spent don't add up to total prestige? set chips owned to prestige
2333
2334
2335
2336
2337
if (version==1.037 && Game.beta)//are we opening the new beta? if so, save the old beta to /betadungeons
2338
{
2339
window.localStorage.setItem('CookieClickerGameBetaDungeons',window.localStorage.getItem('CookieClickerGameBeta'));
2340
Game.Notify('Beta save data','Your beta save data has been safely exported to /betadungeons.',20);
2341
}
2342
else if (version==1.0501 && Game.beta)//are we opening the newer beta? if so, save the old beta to /oldbeta
2343
{
2344
window.localStorage.setItem('CookieClickerGameOld',window.localStorage.getItem('CookieClickerGameBeta'));
2345
//Game.Notify('Beta save data','Your beta save data has been safely exported to /oldbeta.',20);
2346
}
2347
if (version<=1.0466 && !Game.beta)//export the old 2014 version to /v10466
2348
{
2349
window.localStorage.setItem('CookieClickerGamev10466',window.localStorage.getItem('CookieClickerGame'));
2350
//Game.Notify('Beta save data','Your save data has been safely exported to /v10466.',20);
2351
}
2352
if (version==1.9)//are we importing from the 1.9 beta? remove all heavenly upgrades and refund heavenly chips
2353
{
2354
for (var i in Game.UpgradesById)
2355
{
2356
var me=Game.UpgradesById[i];
2357
if (me.bought && me.pool=='prestige')
2358
{
2359
me.unlocked=0;
2360
me.bought=0;
2361
}
2362
}
2363
Game.heavenlyChips=Game.prestige;
2364
Game.heavenlyChipsSpent=0;
2365
2366
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);
2367
}
2368
if (version<=1.0466)//are we loading from the old live version? reset HCs
2369
{
2370
Game.heavenlyChips=Game.prestige;
2371
Game.heavenlyChipsSpent=0;
2372
}
2373
2374
if (Game.ascensionMode!=1)
2375
{
2376
if (Game.Has('Starter kit')) Game.Objects['Cursor'].free=10;
2377
if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].free=5;
2378
}
2379
2380
Game.CalculateGains();
2381
2382
if (Math.random()<1/10000) Game.TOYS=1;//teehee!
2383
2384
var timeOffline=(Date.now()-Game.lastDate)/1000;
2385
2386
Game.loadLumps(timeOffline);
2387
2388
//compute cookies earned while the game was closed
2389
if (Game.mobile || Game.Has('Perfect idling') || Game.Has('Twin Gates of Transcendence'))
2390
{
2391
if (Game.Has('Perfect idling'))
2392
{
2393
var maxTime=60*60*24*1000000000;
2394
var percent=100;
2395
}
2396
else
2397
{
2398
var maxTime=60*60;
2399
if (Game.Has('Belphegor')) maxTime*=2;
2400
if (Game.Has('Mammon')) maxTime*=2;
2401
if (Game.Has('Abaddon')) maxTime*=2;
2402
if (Game.Has('Satan')) maxTime*=2;
2403
if (Game.Has('Asmodeus')) maxTime*=2;
2404
if (Game.Has('Beelzebub')) maxTime*=2;
2405
if (Game.Has('Lucifer')) maxTime*=2;
2406
2407
var percent=5;
2408
if (Game.Has('Angels')) percent+=10;
2409
if (Game.Has('Archangels')) percent+=10;
2410
if (Game.Has('Virtues')) percent+=10;
2411
if (Game.Has('Dominions')) percent+=10;
2412
if (Game.Has('Cherubim')) percent+=10;
2413
if (Game.Has('Seraphim')) percent+=10;
2414
if (Game.Has('God')) percent+=10;
2415
2416
if (Game.Has('Chimera')) {maxTime+=60*60*24*2;percent+=5;}
2417
2418
if (Game.Has('Fern tea')) percent+=3;
2419
if (Game.Has('Ichor syrup')) percent+=7;
2420
if (Game.Has('Fortune #102')) percent+=1;
2421
}
2422
2423
var timeOfflineOptimal=Math.min(timeOffline,maxTime);
2424
var timeOfflineReduced=Math.max(0,timeOffline-timeOfflineOptimal);
2425
var amount=(timeOfflineOptimal+timeOfflineReduced*0.1)*Game.cookiesPs*(percent/100);
2426
2427
if (amount>0)
2428
{
2429
if (Game.prefs.popups) Game.Popup('Earned '+Beautify(amount)+' cookie'+(Math.floor(amount)==1?'':'s')+' while you were away');
2430
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]);
2431
Game.Earn(amount);
2432
}
2433
}
2434
2435
//we load buffs after everything as we do not want them to interfer with offline CpS
2436
for (var i in buffsToLoad)
2437
{
2438
var mestr=buffsToLoad[i];
2439
var type=Game.buffTypes[parseInt(mestr[0])];
2440
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]);
2441
}
2442
2443
2444
Game.bakeryNameRefresh();
2445
2446
}
2447
else//importing old version save
2448
{
2449
Game.Notify('Error importing save','Sorry, you can\'t import saves from the old version anymore.','',6,1);
2450
return false;
2451
}
2452
2453
2454
Game.RebuildUpgrades();
2455
2456
Game.TickerAge=0;
2457
Game.TickerEffect=0;
2458
2459
Game.elderWrathD=0;
2460
Game.recalculateGains=1;
2461
Game.storeToRefresh=1;
2462
Game.upgradesToRebuild=1;
2463
2464
Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);
2465
2466
Game.specialTab='';
2467
Game.ToggleSpecialMenu(0);
2468
2469
Game.killShimmers();
2470
2471
if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie
2472
{
2473
Game.ReincarnateTimer=1;
2474
Game.addClass('reincarnating');
2475
Game.BigCookieSize=0;
2476
}
2477
2478
if (version<Game.version) l('logButton').classList.add('hasUpdate');
2479
2480
if (Game.season!='' && Game.season==Game.baseSeason)
2481
{
2482
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);
2483
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);
2484
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);
2485
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);
2486
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);
2487
}
2488
2489
Game.heralds=actualHeralds;
2490
2491
if (Game.prefs.popups) Game.Popup('Game loaded');
2492
else Game.Notify('Game loaded','','',1,1);
2493
2494
if (Game.prefs.showBackupWarning==1) Game.showBackupWarning();
2495
}
2496
}
2497
else return false;
2498
return true;
2499
}
2500
2501
/*=====================================================================================
2502
RESET
2503
=======================================================================================*/
2504
Game.Reset=function(hard)
2505
{
2506
Game.T=0;
2507
2508
var cookiesForfeited=Game.cookiesEarned;
2509
if (!hard)
2510
{
2511
if (cookiesForfeited>=1000000) Game.Win('Sacrifice');
2512
if (cookiesForfeited>=1000000000) Game.Win('Oblivion');
2513
if (cookiesForfeited>=1000000000000) Game.Win('From scratch');
2514
if (cookiesForfeited>=1000000000000000) Game.Win('Nihilism');
2515
if (cookiesForfeited>=1000000000000000000) Game.Win('Dematerialize');
2516
if (cookiesForfeited>=1000000000000000000000) Game.Win('Nil zero zilch');
2517
if (cookiesForfeited>=1000000000000000000000000) Game.Win('Transcendence');
2518
if (cookiesForfeited>=1000000000000000000000000000) Game.Win('Obliterate');
2519
if (cookiesForfeited>=1000000000000000000000000000000) Game.Win('Negative void');
2520
if (cookiesForfeited>=1000000000000000000000000000000000) Game.Win('To crumbs, you say?');
2521
if (cookiesForfeited>=1000000000000000000000000000000000000) Game.Win('You get nothing');
2522
if (cookiesForfeited>=1000000000000000000000000000000000000000) Game.Win('Humble rebeginnings');
2523
if (cookiesForfeited>=1000000000000000000000000000000000000000000) Game.Win('The end of the world');
2524
if (cookiesForfeited>=1000000000000000000000000000000000000000000000) Game.Win('Oh, you\'re back');
2525
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000) Game.Win('Lazarus');
2526
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000) Game.Win('Smurf account');
2527
if (cookiesForfeited>=1000000000000000000000000000000000000000000000000000000) Game.Win('If at first you don\'t succeed');
2528
2529
if (Math.round(Game.cookies)==1000000000000) Game.Win('When the cookies ascend just right');
2530
}
2531
2532
Game.killBuffs();
2533
2534
Game.seed=Game.makeSeed();
2535
2536
Game.cookiesReset+=Game.cookiesEarned;
2537
Game.cookies=0;
2538
Game.cookiesEarned=0;
2539
Game.cookieClicks=0;
2540
Game.goldenClicksLocal=0;
2541
//Game.goldenClicks=0;
2542
//Game.missedGoldenClicks=0;
2543
Game.handmadeCookies=0;
2544
if (hard)
2545
{
2546
Game.bgType=0;
2547
Game.milkType=0;
2548
Game.chimeType=0;
2549
2550
Game.vault=[];
2551
}
2552
Game.pledges=0;
2553
Game.pledgeT=0;
2554
Game.elderWrath=0;
2555
Game.nextResearch=0;
2556
Game.researchT=0;
2557
Game.seasonT=0;
2558
Game.seasonUses=0;
2559
Game.season=Game.baseSeason;
2560
Game.computeSeasonPrices();
2561
2562
Game.startDate=parseInt(Date.now());
2563
Game.lastDate=parseInt(Date.now());
2564
2565
Game.cookiesSucked=0;
2566
Game.wrinklersPopped=0;
2567
Game.ResetWrinklers();
2568
2569
Game.santaLevel=0;
2570
Game.reindeerClicked=0;
2571
2572
Game.dragonLevel=0;
2573
Game.dragonAura=0;
2574
Game.dragonAura2=0;
2575
2576
Game.fortuneGC=0;
2577
Game.fortuneCPS=0;
2578
2579
if (Game.gainedPrestige>0) Game.resets++;
2580
if (!hard && Game.canLumps() && Game.ascensionMode!=1) Game.addClass('lumpsOn');
2581
else Game.removeClass('lumpsOn');
2582
Game.gainedPrestige=0;
2583
2584
for (var i in Game.ObjectsById)
2585
{
2586
var me=Game.ObjectsById[i];
2587
me.amount=0;me.bought=0;me.free=0;me.totalCookies=0;
2588
me.switchMinigame(false);
2589
if (hard) {me.muted=0;}
2590
me.pics=[];
2591
me.refresh();
2592
}
2593
for (var i in Game.UpgradesById)
2594
{
2595
var me=Game.UpgradesById[i];
2596
if (hard || me.pool!='prestige') me.bought=0;
2597
if (hard) me.unlocked=0;
2598
if (me.pool!='prestige' && !me.lasting)
2599
{
2600
if (Game.Has('Keepsakes') && Game.seasonDrops.indexOf(me.name)!=-1 && Math.random()<1/5){}
2601
else if (Game.HasAchiev('O Fortuna') && me.tier=='fortune' && Math.random()<0.4){}
2602
else me.unlocked=0;
2603
}
2604
}
2605
2606
Game.BuildingsOwned=0;
2607
Game.UpgradesOwned=0;
2608
2609
Game.cookiesPsByType={};
2610
Game.cookiesMultByType={};
2611
2612
if (!hard)
2613
{
2614
if (Game.ascensionMode!=1)
2615
{
2616
for (var i in Game.permanentUpgrades)
2617
{
2618
if (Game.permanentUpgrades[i]!=-1)
2619
{Game.UpgradesById[Game.permanentUpgrades[i]].earn();}
2620
}
2621
if (Game.Has('Season switcher')) {for (var i in Game.seasons) {Game.Unlock(Game.seasons[i].trigger);}}
2622
2623
if (Game.Has('Starter kit')) Game.Objects['Cursor'].getFree(10);
2624
if (Game.Has('Starter kitchen')) Game.Objects['Grandma'].getFree(5);
2625
}
2626
}
2627
2628
/*for (var i in Game.AchievementsById)
2629
{
2630
var me=Game.AchievementsById[i];
2631
me.won=0;
2632
}*/
2633
//Game.DefaultPrefs();
2634
BeautifyAll();
2635
2636
Game.RebuildUpgrades();
2637
Game.TickerAge=0;
2638
Game.TickerEffect=0;
2639
Game.recalculateGains=1;
2640
Game.storeToRefresh=1;
2641
Game.upgradesToRebuild=1;
2642
Game.killShimmers();
2643
2644
Game.buyBulk=1;Game.buyMode=1;Game.storeBulkButton(-1);
2645
2646
Game.LoadMinigames();
2647
for (var i in Game.ObjectsById)
2648
{
2649
var me=Game.ObjectsById[i];
2650
if (hard && me.minigame && me.minigame.launch) {me.minigame.launch();me.minigame.reset(true);}
2651
else if (!hard && me.minigame && me.minigame.reset) me.minigame.reset();
2652
}
2653
2654
l('toggleBox').style.display='none';
2655
l('toggleBox').innerHTML='';
2656
Game.choiceSelectorOn=-1;
2657
Game.specialTab='';
2658
Game.ToggleSpecialMenu(0);
2659
2660
l('logButton').classList.remove('hasUpdate');
2661
2662
for (var i in Game.customReset) {Game.customReset[i]();}
2663
2664
if (hard)
2665
{
2666
if (Game.T>Game.fps*5 && Game.ReincarnateTimer==0)//fade out of black and pop the cookie
2667
{
2668
Game.ReincarnateTimer=1;
2669
Game.addClass('reincarnating');
2670
Game.BigCookieSize=0;
2671
}
2672
if (Game.prefs.popups) Game.Popup('Game reset');
2673
else Game.Notify('Game reset','So long, cookies.',[21,6],6);
2674
}
2675
}
2676
Game.HardReset=function(bypass)
2677
{
2678
if (!bypass)
2679
{
2680
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']);
2681
}
2682
else if (bypass==1)
2683
{
2684
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']);
2685
}
2686
else
2687
{
2688
for (var i in Game.AchievementsById)
2689
{
2690
var me=Game.AchievementsById[i];
2691
me.won=0;
2692
}
2693
for (var i in Game.ObjectsById)
2694
{
2695
var me=Game.ObjectsById[i];
2696
me.level=0;
2697
}
2698
2699
Game.AchievementsOwned=0;
2700
Game.goldenClicks=0;
2701
Game.missedGoldenClicks=0;
2702
Game.Reset(1);
2703
Game.resets=0;
2704
Game.fullDate=parseInt(Date.now());
2705
Game.bakeryName=Game.GetBakeryName();
2706
Game.bakeryNameRefresh();
2707
Game.cookiesReset=0;
2708
Game.prestige=0;
2709
Game.heavenlyChips=0;
2710
Game.heavenlyChipsSpent=0;
2711
Game.heavenlyCookies=0;
2712
Game.permanentUpgrades=[-1,-1,-1,-1,-1];
2713
Game.ascensionMode=0;
2714
Game.lumps=-1;
2715
Game.lumpsTotal=-1;
2716
Game.lumpT=Date.now();
2717
Game.lumpRefill=0;
2718
Game.removeClass('lumpsOn');
2719
}
2720
}
2721
2722
2723
2724
Game.onCrate=0;
2725
Game.setOnCrate=function(what)
2726
{
2727
Game.onCrate=what;
2728
}
2729
Game.crate=function(me,context,forceClickStr,id)
2730
{
2731
//produce a crate with associated tooltip for an upgrade or achievement
2732
//me is an object representing the upgrade or achievement
2733
//context can be "store", "ascend", "stats" or undefined
2734
//forceClickStr changes what is done when the crate is clicked
2735
//id is the resulting div's desired id
2736
2737
var classes='crate';
2738
var enabled=0;
2739
var noFrame=0;
2740
var attachment='top';
2741
var neuromancy=0;
2742
if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
2743
var mysterious=0;
2744
var clickStr='';
2745
2746
if (me.type=='upgrade')
2747
{
2748
var canBuy=(context=='store'?me.canBuy():true);
2749
if (context=='stats' && me.bought==0 && !Game.Has('Neuromancy') && (!Game.sesame || me.pool!='debug')) return '';
2750
else if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
2751
else if (context=='store' && !canBuy) enabled=0;
2752
else if (context=='ascend' && me.bought==0) enabled=0;
2753
else enabled=1;
2754
if (me.bought>0) enabled=1;
2755
2756
if (context=='stats' && !Game.prefs.crates) noFrame=1;
2757
2758
classes+=' upgrade';
2759
if (me.pool=='prestige') classes+=' heavenly';
2760
2761
2762
if (neuromancy) clickStr='Game.UpgradesById['+me.id+'].toggle();';
2763
}
2764
else if (me.type=='achievement')
2765
{
2766
if (context=='stats' && me.won==0 && me.pool!='normal') return '';
2767
else if (context!='stats') enabled=1;
2768
2769
if (context=='stats' && !Game.prefs.crates) noFrame=1;
2770
2771
classes+=' achievement';
2772
if (me.pool=='shadow') classes+=' shadow';
2773
if (me.won>0) enabled=1;
2774
else mysterious=1;
2775
if (!enabled) clickStr='Game.AchievementsById['+me.id+'].click();';
2776
2777
if (neuromancy) clickStr='Game.AchievementsById['+me.id+'].toggle();';
2778
}
2779
2780
if (context=='store') attachment='store';
2781
2782
if (forceClickStr) clickStr=forceClickStr;
2783
2784
if (me.choicesFunction) classes+=' selector';
2785
2786
2787
var icon=me.icon;
2788
if (mysterious) icon=[0,7];
2789
2790
if (me.iconFunction) icon=me.iconFunction();
2791
2792
if (me.bought && context=='store') enabled=0;
2793
2794
if (enabled) classes+=' enabled';// else classes+=' disabled';
2795
if (noFrame) classes+=' noFrame';
2796
2797
var text=[];
2798
if (Game.sesame)
2799
{
2800
if (Game.debuggedUpgradeCpS[me.name] || Game.debuggedUpgradeCpClick[me.name])
2801
{
2802
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)))]);
2803
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)))]);
2804
}
2805
if (Game.extraInfo) {text.push(Math.floor(me.order)+(me.power?'<br>P:'+me.power:''));text.push('#fff');}
2806
}
2807
var textStr='';
2808
for (var i=0;i<text.length;i+=2)
2809
{
2810
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>';
2811
}
2812
2813
return '<div'+
2814
(clickStr!=''?(' '+Game.clickStr+'="'+clickStr+'"'):'')+
2815
' class="'+classes+'" '+
2816
Game.getDynamicTooltip(
2817
'function(){return Game.crateTooltip(Game.'+(me.type=='upgrade'?'Upgrades':'Achievements')+'ById['+me.id+'],'+(context?'\''+context+'\'':'')+');}',
2818
attachment,true
2819
)+
2820
(id?'id="'+id+'" ':'')+
2821
'style="'+(mysterious?
2822
'background-position:'+(-0*48)+'px '+(-7*48)+'px':
2823
(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px')+';'+
2824
((context=='ascend' && me.pool=='prestige')?'position:absolute;left:'+me.posX+'px;top:'+me.posY+'px;':'')+
2825
'">'+
2826
textStr+
2827
(me.choicesFunction?'<div class="selectorCorner"></div>':'')+
2828
'</div>';
2829
}
2830
Game.crateTooltip=function(me,context)
2831
{
2832
var tags=[];
2833
mysterious=0;
2834
var neuromancy=0;
2835
var price='';
2836
if (context=='stats' && (Game.Has('Neuromancy') || (Game.sesame && me.pool=='debug'))) neuromancy=1;
2837
2838
if (me.type=='upgrade')
2839
{
2840
if (me.pool=='prestige') tags.push('Heavenly','#efa438');
2841
else if (me.pool=='tech') tags.push('Tech','#36a4ff');
2842
else if (me.pool=='cookie') tags.push('Cookie',0);
2843
else if (me.pool=='debug') tags.push('Debug','#00c462');
2844
else if (me.pool=='toggle') tags.push('Switch',0);
2845
else tags.push('Upgrade',0);
2846
2847
if (me.tier!=0 && Game.Has('Label printer')) tags.push('Tier : '+Game.Tiers[me.tier].name,Game.Tiers[me.tier].color);
2848
if (me.name=='Label printer' && Game.Has('Label printer')) tags.push('Tier : Self-referential','#ff00ea');
2849
2850
if (me.isVaulted()) tags.push('Vaulted','#4e7566');
2851
2852
if (me.bought>0)
2853
{
2854
if (me.pool=='tech') tags.push('Researched',0);
2855
else if (me.kitten) tags.push('Purrchased',0);
2856
else tags.push('Purchased',0);
2857
}
2858
2859
if (me.lasting && me.unlocked) tags.push('Unlocked forever','#f2ff87');
2860
2861
if (neuromancy && me.bought==0) tags.push('Click to learn!','#00c462');
2862
else if (neuromancy && me.bought>0) tags.push('Click to unlearn!','#00c462');
2863
2864
var canBuy=(context=='store'?me.canBuy():true);
2865
var cost=me.getPrice();
2866
if (me.priceLumps>0) cost=me.priceLumps;
2867
2868
if (me.priceLumps==0 && cost==0) price='';
2869
else
2870
{
2871
price='<div style="float:right;text-align:right;"><span class="price'+
2872
(me.priceLumps>0?(' lump'):'')+
2873
(me.pool=='prestige'?((me.bought || Game.heavenlyChips>=cost)?' heavenly':' heavenly disabled'):'')+
2874
(context=='store'?(canBuy?'':' disabled'):'')+
2875
'">'+Beautify(Math.round(cost))+'</span>'+((me.pool!='prestige' && me.priceLumps==0)?Game.costDetails(cost):'')+'</div>';
2876
}
2877
}
2878
else if (me.type=='achievement')
2879
{
2880
if (me.pool=='shadow') tags.push('Shadow Achievement','#9700cf');
2881
else tags.push('Achievement',0);
2882
if (me.won>0) tags.push('Unlocked',0);
2883
else {tags.push('Locked',0);mysterious=1;}
2884
2885
if (neuromancy && me.won==0) tags.push('Click to win!','#00c462');
2886
else if (neuromancy && me.won>0) tags.push('Click to lose!','#00c462');
2887
}
2888
2889
var tagsStr='';
2890
for (var i=0;i<tags.length;i+=2)
2891
{
2892
if (i%2==0) tagsStr+=' <div class="tag" style="color:'+(tags[i+1]==0?'#fff':tags[i+1])+';">['+tags[i]+']</div>';
2893
}
2894
tagsStr=tagsStr.substring(1);
2895
2896
var icon=me.icon;
2897
if (mysterious) icon=[0,7];
2898
2899
if (me.iconFunction) icon=me.iconFunction();
2900
2901
2902
var tip='';
2903
if (context=='store')
2904
{
2905
if (me.pool!='toggle' && me.pool!='tech')
2906
{
2907
if (Game.Has('Inspired checklist'))
2908
{
2909
if (me.isVaulted()) tip='Upgrade is vaulted and will not be auto-purchased.<br>Click to purchase. Shift-click to unvault.';
2910
else tip='Click to purchase. Shift-click to vault.';
2911
if (Game.keys[16]) tip+='<br>(You are holding Shift.)';
2912
else tip+='<br>(You are not holding Shift.)';
2913
}
2914
else tip='Click to purchase.';
2915
}
2916
else if (me.pool=='toggle' && me.choicesFunction) tip='Click to open selector.';
2917
else if (me.pool=='toggle') tip='Click to toggle.';
2918
else if (me.pool=='tech') tip='Click to research.';
2919
}
2920
2921
var desc=me.desc;
2922
if (me.descFunc) desc=me.descFunc();
2923
if (me.bought && context=='store' && me.displayFuncWhenOwned) desc=me.displayFuncWhenOwned()+'<div class="line"></div>'+desc;
2924
if (me.unlockAt)
2925
{
2926
if (me.unlockAt.require)
2927
{
2928
var it=Game.Upgrades[me.unlockAt.require];
2929
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;
2930
}
2931
/*else if (me.unlockAt.season)
2932
{
2933
var it=Game.seasons[me.unlockAt.season];
2934
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;
2935
}*/
2936
else if (me.unlockAt.text)
2937
{
2938
var it=Game.Upgrades[me.unlockAt.require];
2939
desc='<div style="font-size:80%;text-align:center;">From <b>'+text+'</b></div><div class="line"></div>'+desc;
2940
}
2941
}
2942
2943
return '<div style="padding:8px 4px;min-width:350px;">'+
2944
'<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>'+
2945
(me.bought && context=='store'?'':price)+
2946
'<div class="name">'+(mysterious?'???':me.name)+'</div>'+
2947
tagsStr+
2948
'<div class="line"></div><div class="description">'+(mysterious?'???':desc)+'</div></div>'+
2949
(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>'):'')+
2950
(Game.sesame?('<div style="font-size:9px;">Id : '+me.id+' | Order : '+Math.floor(me.order)+(me.tier?' | Tier : '+me.tier:'')+'</div>'):'');
2951
}
2952
2953
Game.costDetails=function(cost)
2954
{
2955
if (!Game.Has('Genius accounting')) return '';
2956
if (!cost) return '';
2957
var priceInfo='';
2958
var cps=Game.cookiesPs*(1-Game.cpsSucked);
2959
if (cost>Game.cookies) priceInfo+='in '+Game.sayTime(((cost-Game.cookies)/cps+1)*Game.fps)+'<br>';
2960
priceInfo+=Game.sayTime((cost/cps+1)*Game.fps)+' worth<br>';
2961
priceInfo+=Beautify((cost/Game.cookies)*100,1)+'% of bank<br>';
2962
return '<div style="font-size:80%;opacity:0.7;line-height:90%;">'+priceInfo+'</div>';
2963
}
2964
2965
2966
/*=====================================================================================
2967
PRESTIGE
2968
=======================================================================================*/
2969
2970
Game.HCfactor=3;
2971
Game.HowMuchPrestige=function(cookies)//how much prestige [cookies] should land you
2972
{
2973
return Math.pow(cookies/1000000000000,1/Game.HCfactor);
2974
}
2975
Game.HowManyCookiesReset=function(chips)//how many cookies [chips] are worth
2976
{
2977
//this must be the inverse of the above function (ie. if cookies=chips^2, chips=cookies^(1/2) )
2978
return Math.pow(chips,Game.HCfactor)*1000000000000;
2979
}
2980
Game.gainedPrestige=0;
2981
Game.EarnHeavenlyChips=function(cookiesForfeited)
2982
{
2983
//recalculate prestige and chips owned
2984
var prestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+cookiesForfeited));
2985
if (prestige>Game.prestige)//did we gain prestige levels?
2986
{
2987
var prestigeDifference=prestige-Game.prestige;
2988
Game.gainedPrestige=prestigeDifference;
2989
Game.heavenlyChips+=prestigeDifference;
2990
Game.prestige=prestige;
2991
if (Game.prefs.popups) Game.Popup('You gain '+Beautify(prestigeDifference)+' prestige level'+(prestigeDifference==1?'':'s')+'!');
2992
else Game.Notify('You forfeit your '+Beautify(cookiesForfeited)+' cookies.','You gain <b>'+Beautify(prestigeDifference)+'</b> prestige level'+(prestigeDifference==1?'':'s')+'!',[19,7]);
2993
}
2994
}
2995
2996
Game.GetHeavenlyMultiplier=function()
2997
{
2998
var heavenlyMult=0;
2999
if (Game.Has('Heavenly chip secret')) heavenlyMult+=0.05;
3000
if (Game.Has('Heavenly cookie stand')) heavenlyMult+=0.20;
3001
if (Game.Has('Heavenly bakery')) heavenlyMult+=0.25;
3002
if (Game.Has('Heavenly confectionery')) heavenlyMult+=0.25;
3003
if (Game.Has('Heavenly key')) heavenlyMult+=0.25;
3004
//if (Game.hasAura('Dragon God')) heavenlyMult*=1.05;
3005
heavenlyMult*=1+Game.auraMult('Dragon God')*0.05;
3006
if (Game.Has('Lucky digit')) heavenlyMult*=1.01;
3007
if (Game.Has('Lucky number')) heavenlyMult*=1.01;
3008
if (Game.Has('Lucky payout')) heavenlyMult*=1.01;
3009
if (Game.hasGod)
3010
{
3011
var godLvl=Game.hasGod('creation');
3012
if (godLvl==1) heavenlyMult*=0.7;
3013
else if (godLvl==2) heavenlyMult*=0.8;
3014
else if (godLvl==3) heavenlyMult*=0.9;
3015
}
3016
return heavenlyMult;
3017
}
3018
3019
Game.ascensionModes={
3020
0:{name:'None',desc:'No special modifiers.',icon:[10,0]},
3021
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]}/*,
3022
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]}*/
3023
};
3024
3025
Game.ascendMeterPercent=0;
3026
Game.ascendMeterPercentT=0;
3027
Game.ascendMeterLevel=100000000000000000000000000000;
3028
3029
Game.nextAscensionMode=0;
3030
Game.UpdateAscensionModePrompt=function()
3031
{
3032
var icon=Game.ascensionModes[Game.nextAscensionMode].icon;
3033
var name=Game.ascensionModes[Game.nextAscensionMode].name;
3034
l('ascendModeButton').innerHTML=
3035
'<div class="crate noFrame enabled" '+Game.clickStr+'="Game.PickAscensionMode();" '+Game.getTooltip(
3036
'<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>'
3037
,'bottom-right')+' style="opacity:1;float:none;display:block;background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;"></div>';
3038
}
3039
Game.PickAscensionMode=function()
3040
{
3041
PlaySound('snd/tick.mp3');
3042
Game.tooltip.hide();
3043
3044
var str='';
3045
for (var i in Game.ascensionModes)
3046
{
3047
var icon=Game.ascensionModes[i].icon;
3048
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;"'+
3049
'></div>';
3050
}
3051
Game.Prompt('<h3>Select a challenge mode</h3>'+
3052
'<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>'
3053
,[['Confirm','Game.UpdateAscensionModePrompt();Game.ClosePrompt();']],0,'widePrompt');
3054
}
3055
3056
Game.UpdateLegacyPrompt=function()
3057
{
3058
if (!l('legacyPromptData')) return 0;
3059
var date=new Date();
3060
date.setTime(Date.now()-Game.startDate);
3061
var timeInSeconds=date.getTime()/1000;
3062
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
3063
3064
var ascendNowToGet=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)-Game.HowMuchPrestige(Game.cookiesReset));
3065
var cookiesToNext=Math.floor(Game.HowManyCookiesReset(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)+1)-Game.cookiesReset-Game.cookiesEarned);
3066
l('legacyPromptData').innerHTML=''+
3067
'<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>'+
3068
'<div class="listing"><b>Run duration :</b> '+(startDate==''?'tiny':(startDate))+'</div>'+
3069
//'<div class="listing">Earned : '+Beautify(Game.cookiesEarned)+', Reset : '+Beautify(Game.cookiesReset)+'</div>'+
3070
'<div class="listing"><b>Prestige level :</b> '+Beautify(Game.prestige)+'</div>'+
3071
'<div class="listing"><b>Heavenly chips :</b> '+Beautify(Game.heavenlyChips)+'</div>'+
3072
(ascendNowToGet>=1?('<div class="listing"><b>Ascending now will produce :</b> '+Beautify(ascendNowToGet)+' heavenly chip'+((ascendNowToGet)==1?'':'s')+'</div>'):
3073
('<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>'))+
3074
'';
3075
if (1 || ascendNowToGet>=1) l('promptOption0').style.display='inline-block'; else l('promptOption0').style.display='none';
3076
}
3077
3078
l('ascendOverlay').innerHTML=
3079
'<div id="ascendBox">'+
3080
'<div class="ascendData smallFramed prompt" '+Game.getTooltip(
3081
'<div style="min-width:200px;text-align:center;font-size:11px;">Each prestige level grants you a permanent +1% CpS.<br>The more levels you have, the more cookies they require.</div>'
3082
,'bottom-right')+' style="margin-top:8px;"><h3 id="ascendPrestige"></h3></div>'+
3083
'<div class="ascendData smallFramed prompt" '+Game.getTooltip(
3084
'<div style="min-width:200px;text-align:center;font-size:11px;">Heavenly chips are used to buy heavenly upgrades.<br>You gain 1 chip every time you gain a prestige level.</div>'
3085
,'bottom-right')+'><h3 id="ascendHCs"></h3></div>'+
3086
'<a id="ascendButton" class="option framed large red" '+Game.getTooltip(
3087
'<div style="min-width:200px;text-align:center;font-size:11px;">Click this once you\'ve bought<br>everything you need!</div>'
3088
,'bottom-right')+' style="font-size:16px;margin-top:0px;"><span class="fancyText" style="font-size:20px;">Reincarnate</span></a>'+
3089
'<div id="ascendModeButton" style="position:absolute;right:34px;bottom:25px;display:none;"></div>'+
3090
'<input type="text" style="display:block;" id="upgradePositions"/></div>'+
3091
3092
'<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>';
3093
3094
Game.UpdateAscensionModePrompt();
3095
3096
AddEvent(l('ascendButton'),'click',function(){
3097
PlaySound('snd/tick.mp3');
3098
Game.Reincarnate();
3099
});
3100
3101
Game.ascendl=l('ascend');
3102
Game.ascendContentl=l('ascendContent');
3103
Game.ascendZoomablel=l('ascendZoomable');
3104
Game.ascendUpgradesl=l('ascendUpgrades');
3105
Game.OnAscend=0;
3106
Game.AscendTimer=0;//how far we are into the ascend animation
3107
Game.AscendDuration=Game.fps*5;//how long the ascend animation is
3108
Game.AscendBreakpoint=Game.AscendDuration*0.5;//at which point the cookie explodes during the ascend animation
3109
Game.UpdateAscendIntro=function()
3110
{
3111
if (Game.AscendTimer==1) PlaySound('snd/charging.mp3');
3112
if (Game.AscendTimer==Math.floor(Game.AscendBreakpoint)) PlaySound('snd/thud.mp3');
3113
Game.AscendTimer++;
3114
if (Game.AscendTimer>Game.AscendDuration)//end animation and launch ascend screen
3115
{
3116
PlaySound('snd/cymbalRev.mp3',0.5);
3117
PlaySound('snd/choir.mp3');
3118
Game.EarnHeavenlyChips(Game.cookiesEarned);
3119
Game.AscendTimer=0;
3120
Game.OnAscend=1;Game.removeClass('ascendIntro');
3121
Game.addClass('ascending');
3122
Game.BuildAscendTree();
3123
Game.heavenlyChipsDisplayed=Game.heavenlyChips;
3124
Game.nextAscensionMode=0;
3125
Game.ascensionMode=0;
3126
Game.UpdateAscensionModePrompt();
3127
}
3128
}
3129
Game.ReincarnateTimer=0;//how far we are into the reincarnation animation
3130
Game.ReincarnateDuration=Game.fps*1;//how long the reincarnation animation is
3131
Game.UpdateReincarnateIntro=function()
3132
{
3133
if (Game.ReincarnateTimer==1) PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
3134
Game.ReincarnateTimer++;
3135
if (Game.ReincarnateTimer>Game.ReincarnateDuration)//end animation and launch regular game
3136
{
3137
Game.ReincarnateTimer=0;
3138
Game.removeClass('reincarnating');
3139
}
3140
}
3141
Game.Reincarnate=function(bypass)
3142
{
3143
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']);
3144
else
3145
{
3146
Game.ascendUpgradesl.innerHTML='';
3147
Game.ascensionMode=Game.nextAscensionMode;
3148
Game.nextAscensionMode=0;
3149
Game.Reset();
3150
if (Game.HasAchiev('Rebirth'))
3151
{
3152
if (Game.prefs.popups) Game.Popup('Reincarnated');
3153
else Game.Notify('Reincarnated','Hello, cookies!',[10,0],4);
3154
}
3155
if (Game.resets>=1000) Game.Win('Endless cycle');
3156
if (Game.resets>=100) Game.Win('Reincarnation');
3157
if (Game.resets>=10) Game.Win('Resurrection');
3158
if (Game.resets>=1) Game.Win('Rebirth');
3159
Game.removeClass('ascending');
3160
Game.OnAscend=0;
3161
//trigger the reincarnate animation
3162
Game.ReincarnateTimer=1;
3163
Game.addClass('reincarnating');
3164
Game.BigCookieSize=0;
3165
}
3166
}
3167
Game.GiveUpAscend=function(bypass)
3168
{
3169
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']);
3170
else
3171
{
3172
if (Game.prefs.popups) Game.Popup('Game reset');
3173
else Game.Notify('Gave up','Let\'s try this again!',[0,5],4);
3174
Game.Reset();
3175
}
3176
}
3177
Game.Ascend=function(bypass)
3178
{
3179
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']);
3180
else
3181
{
3182
if (Game.prefs.popups) Game.Popup('Ascending');
3183
else Game.Notify('Ascending','So long, cookies.',[20,7],4);
3184
Game.OnAscend=0;Game.removeClass('ascending');
3185
Game.addClass('ascendIntro');
3186
//trigger the ascend animation
3187
Game.AscendTimer=1;
3188
Game.killShimmers();
3189
l('toggleBox').style.display='none';
3190
l('toggleBox').innerHTML='';
3191
Game.choiceSelectorOn=-1;
3192
Game.ToggleSpecialMenu(0);
3193
Game.AscendOffX=0;
3194
Game.AscendOffY=0;
3195
Game.AscendOffXT=0;
3196
Game.AscendOffYT=0;
3197
Game.AscendZoomT=1;
3198
Game.AscendZoom=0.2;
3199
}
3200
}
3201
3202
Game.DebuggingPrestige=0;
3203
Game.AscendDragX=0;
3204
Game.AscendDragY=0;
3205
Game.AscendOffX=0;
3206
Game.AscendOffY=0;
3207
Game.AscendZoom=1;
3208
Game.AscendOffXT=0;
3209
Game.AscendOffYT=0;
3210
Game.AscendZoomT=1;
3211
Game.AscendDragging=0;
3212
Game.AscendGridSnap=24;
3213
Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};
3214
Game.UpdateAscend=function()
3215
{
3216
if (Game.keys[37]) Game.AscendOffXT+=16*(1/Game.AscendZoomT);
3217
if (Game.keys[38]) Game.AscendOffYT+=16*(1/Game.AscendZoomT);
3218
if (Game.keys[39]) Game.AscendOffXT-=16*(1/Game.AscendZoomT);
3219
if (Game.keys[40]) Game.AscendOffYT-=16*(1/Game.AscendZoomT);
3220
3221
if (Game.AscendOffXT>-Game.heavenlyBounds.left) Game.AscendOffXT=-Game.heavenlyBounds.left;
3222
if (Game.AscendOffXT<-Game.heavenlyBounds.right) Game.AscendOffXT=-Game.heavenlyBounds.right;
3223
if (Game.AscendOffYT>-Game.heavenlyBounds.top) Game.AscendOffYT=-Game.heavenlyBounds.top;
3224
if (Game.AscendOffYT<-Game.heavenlyBounds.bottom) Game.AscendOffYT=-Game.heavenlyBounds.bottom;
3225
Game.AscendOffX+=(Game.AscendOffXT-Game.AscendOffX)*0.5;
3226
Game.AscendOffY+=(Game.AscendOffYT-Game.AscendOffY)*0.5;
3227
Game.AscendZoom+=(Game.AscendZoomT-Game.AscendZoom)*0.25;
3228
if (Math.abs(Game.AscendZoomT-Game.AscendZoom)<0.005) Game.AscendZoom=Game.AscendZoomT;
3229
3230
if (Game.DebuggingPrestige)
3231
{
3232
for (var i in Game.PrestigeUpgrades)
3233
{
3234
var me=Game.PrestigeUpgrades[i];
3235
AddEvent(l('heavenlyUpgrade'+me.id),'mousedown',function(me){return function(){
3236
if (!Game.DebuggingPrestige) return;
3237
Game.SelectedHeavenlyUpgrade=me;
3238
}}(me));
3239
AddEvent(l('heavenlyUpgrade'+me.id),'mouseup',function(me){return function(){
3240
if (Game.SelectedHeavenlyUpgrade==me) {Game.SelectedHeavenlyUpgrade=0;Game.BuildAscendTree();}
3241
}}(me));
3242
}
3243
}
3244
3245
if (Game.mouseDown && !Game.promptOn)
3246
{
3247
if (!Game.AscendDragging)
3248
{
3249
Game.AscendDragX=Game.mouseX;
3250
Game.AscendDragY=Game.mouseY;
3251
}
3252
Game.AscendDragging=1;
3253
3254
if (Game.DebuggingPrestige)
3255
{
3256
if (Game.SelectedHeavenlyUpgrade)
3257
{
3258
Game.tooltip.hide();
3259
//drag upgrades around
3260
var me=Game.SelectedHeavenlyUpgrade;
3261
me.posX+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);
3262
me.posY+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);
3263
var posX=me.posX;//Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;
3264
var posY=me.posY;//Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;
3265
l('heavenlyUpgrade'+me.id).style.left=Math.floor(posX)+'px';
3266
l('heavenlyUpgrade'+me.id).style.top=Math.floor(posY)+'px';
3267
for (var ii in me.parents)
3268
{
3269
var origX=0;
3270
var origY=0;
3271
var targX=me.posX+28;
3272
var targY=me.posY+28;
3273
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
3274
var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;
3275
if (targX<=origX) rot+=180;
3276
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
3277
//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;';
3278
l('heavenlyLink'+me.id+'-'+ii).style='width:'+dist+'px;transform:rotate('+rot+'deg);left:'+(origX)+'px;top:'+(origY)+'px;';
3279
}
3280
}
3281
}
3282
if (!Game.SelectedHeavenlyUpgrade)
3283
{
3284
Game.AscendOffXT+=(Game.mouseX-Game.AscendDragX)*(1/Game.AscendZoomT);
3285
Game.AscendOffYT+=(Game.mouseY-Game.AscendDragY)*(1/Game.AscendZoomT);
3286
}
3287
Game.AscendDragX=Game.mouseX;
3288
Game.AscendDragY=Game.mouseY;
3289
}
3290
else
3291
{
3292
/*if (Game.SelectedHeavenlyUpgrade)
3293
{
3294
var me=Game.SelectedHeavenlyUpgrade;
3295
me.posX=Math.round(me.posX/Game.AscendGridSnap)*Game.AscendGridSnap;
3296
me.posY=Math.round(me.posY/Game.AscendGridSnap)*Game.AscendGridSnap;
3297
l('heavenlyUpgrade'+me.id).style.left=me.posX+'px';
3298
l('heavenlyUpgrade'+me.id).style.top=me.posY+'px';
3299
}*/
3300
Game.AscendDragging=0;
3301
Game.SelectedHeavenlyUpgrade=0;
3302
}
3303
if (Game.Click || Game.promptOn)
3304
{
3305
Game.AscendDragging=0;
3306
}
3307
3308
//Game.ascendl.style.backgroundPosition=Math.floor(Game.AscendOffX/2)+'px '+Math.floor(Game.AscendOffY/2)+'px';
3309
//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';
3310
//Game.ascendContentl.style.left=Math.floor(Game.AscendOffX)+'px';
3311
//Game.ascendContentl.style.top=Math.floor(Game.AscendOffY)+'px';
3312
Game.ascendContentl.style.webkitTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3313
Game.ascendContentl.style.msTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3314
Game.ascendContentl.style.oTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3315
Game.ascendContentl.style.mozTransform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3316
Game.ascendContentl.style.transform='translate('+Math.floor(Game.AscendOffX)+'px,'+Math.floor(Game.AscendOffY)+'px)';
3317
Game.ascendZoomablel.style.webkitTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3318
Game.ascendZoomablel.style.msTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3319
Game.ascendZoomablel.style.oTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3320
Game.ascendZoomablel.style.mozTransform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3321
Game.ascendZoomablel.style.transform='scale('+(Game.AscendZoom)+','+(Game.AscendZoom)+')';
3322
3323
//if (Game.Scroll!=0) Game.ascendContentl.style.transformOrigin=Math.floor(Game.windowW/2-Game.mouseX)+'px '+Math.floor(Game.windowH/2-Game.mouseY)+'px';
3324
if (Game.Scroll<0 && !Game.promptOn) {Game.AscendZoomT=0.5;}
3325
if (Game.Scroll>0 && !Game.promptOn) {Game.AscendZoomT=1;}
3326
3327
if (Game.T%2==0)
3328
{
3329
l('ascendPrestige').innerHTML='Prestige level :<br>'+Beautify(Game.prestige);
3330
l('ascendHCs').innerHTML='Heavenly chips :<br><span class="price heavenly">'+Beautify(Math.round(Game.heavenlyChipsDisplayed))+'</span>';
3331
if (Game.prestige>0) l('ascendModeButton').style.display='block';
3332
else l('ascendModeButton').style.display='none';
3333
}
3334
Game.heavenlyChipsDisplayed+=(Game.heavenlyChips-Game.heavenlyChipsDisplayed)*0.4;
3335
3336
if (Game.DebuggingPrestige && Game.T%10==0)
3337
{
3338
var str='';
3339
for (var i in Game.PrestigeUpgrades)
3340
{
3341
var me=Game.PrestigeUpgrades[i];
3342
str+=me.id+':['+Math.floor(me.posX)+','+Math.floor(me.posY)+'],';
3343
}
3344
l('upgradePositions').value='Game.UpgradePositions={'+str+'};';
3345
}
3346
//if (Game.T%5==0) Game.BuildAscendTree();
3347
}
3348
Game.AscendRefocus=function()
3349
{
3350
Game.AscendOffX=0;
3351
Game.AscendOffY=0;
3352
Game.ascendl.className='';
3353
}
3354
3355
Game.SelectedHeavenlyUpgrade=0;
3356
Game.PurchaseHeavenlyUpgrade=function(what)
3357
{
3358
//if (Game.Has('Neuromancy')) Game.UpgradesById[what].toggle(); else
3359
if (Game.UpgradesById[what].buy())
3360
{
3361
if (l('heavenlyUpgrade'+what)){var rect=l('heavenlyUpgrade'+what).getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);}
3362
//Game.BuildAscendTree();
3363
}
3364
}
3365
Game.BuildAscendTree=function()
3366
{
3367
var str='';
3368
Game.heavenlyBounds={left:0,right:0,top:0,bottom:0};
3369
3370
if (Game.DebuggingPrestige) l('upgradePositions').style.display='block'; else l('upgradePositions').style.display='none';
3371
3372
for (var i in Game.PrestigeUpgrades)
3373
{
3374
var me=Game.PrestigeUpgrades[i];
3375
me.canBePurchased=1;
3376
if (!me.bought && !Game.DebuggingPrestige)
3377
{
3378
if (me.showIf && !me.showIf()) me.canBePurchased=0;
3379
else
3380
{
3381
for (var ii in me.parents)
3382
{
3383
if (me.parents[ii]!=-1 && !me.parents[ii].bought) me.canBePurchased=0;
3384
}
3385
}
3386
}
3387
}
3388
str+='<div class="crateBox" style="filter:none;-webkit-filter:none;">';//chrome is still bad at these
3389
for (var i in Game.PrestigeUpgrades)
3390
{
3391
var me=Game.PrestigeUpgrades[i];
3392
3393
var ghosted=0;
3394
if (me.canBePurchased || Game.Has('Neuromancy'))
3395
{
3396
str+=Game.crate(me,'ascend','Game.PurchaseHeavenlyUpgrade('+me.id+');','heavenlyUpgrade'+me.id);
3397
}
3398
else
3399
{
3400
for (var ii in me.parents)
3401
{
3402
if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;
3403
}
3404
if (me.showIf && !me.showIf()) ghosted=0;
3405
if (ghosted)
3406
{
3407
//maybe replace this with Game.crate()
3408
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>';
3409
}
3410
}
3411
if (me.canBePurchased || Game.Has('Neuromancy') || ghosted)
3412
{
3413
if (me.posX<Game.heavenlyBounds.left) Game.heavenlyBounds.left=me.posX;
3414
if (me.posX>Game.heavenlyBounds.right) Game.heavenlyBounds.right=me.posX;
3415
if (me.posY<Game.heavenlyBounds.top) Game.heavenlyBounds.top=me.posY;
3416
if (me.posY>Game.heavenlyBounds.bottom) Game.heavenlyBounds.bottom=me.posY;
3417
}
3418
for (var ii in me.parents)//create pulsing links
3419
{
3420
if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))
3421
{
3422
var origX=0;
3423
var origY=0;
3424
var targX=me.posX+28;
3425
var targY=me.posY+28;
3426
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
3427
var rot=-(Math.atan((targY-origY)/(origX-targX))/Math.PI)*180;
3428
if (targX<=origX) rot+=180;
3429
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
3430
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>';
3431
}
3432
}
3433
}
3434
Game.heavenlyBounds.left-=128;
3435
Game.heavenlyBounds.top-=128;
3436
Game.heavenlyBounds.right+=128+64;
3437
Game.heavenlyBounds.bottom+=128+64;
3438
//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>';
3439
str+='</div>';
3440
Game.ascendUpgradesl.innerHTML=str;
3441
}
3442
3443
3444
/*=====================================================================================
3445
COALESCING SUGAR LUMPS
3446
=======================================================================================*/
3447
Game.lumpMatureAge=1;
3448
Game.lumpRipeAge=1;
3449
Game.lumpOverripeAge=1;
3450
Game.lumpCurrentType=0;
3451
l('comments').innerHTML=l('comments').innerHTML+
3452
'<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>';
3453
Game.lumpTooltip=function()
3454
{
3455
var str='<div style="padding:8px;width:400px;font-size:11px;text-align:center;">'+
3456
'You have <span class="price lump">'+Beautify(Game.lumps)+' sugar lump'+(Game.lumps==1?'':'s')+'</span>.'+
3457
'<div class="line"></div>'+
3458
'A <b>sugar lump</b> is coalescing here, attracted by your accomplishments.';
3459
3460
var age=Date.now()-Game.lumpT;
3461
str+='<div class="line"></div>';
3462
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.';
3463
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>.';
3464
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>.';
3465
3466
var phase=(age/Game.lumpOverripeAge)*7;
3467
if (phase>=3)
3468
{
3469
if (Game.lumpCurrentType!=0) str+='<div class="line"></div>';
3470
if (Game.lumpCurrentType==1) str+='This sugar lump grew to be <b>bifurcated</b>; harvesting it has a 50% chance of yielding two lumps.';
3471
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.';
3472
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.';
3473
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.';
3474
}
3475
3476
str+='<div class="line"></div>';
3477
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>.';
3478
3479
str+='<div class="line"></div>'+
3480
'&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.';
3481
3482
str+='</div>';
3483
return str;
3484
}
3485
Game.computeLumpTimes=function()
3486
{
3487
var hour=1000*60*60;
3488
Game.lumpMatureAge=hour*20;
3489
Game.lumpRipeAge=hour*23;
3490
if (Game.Has('Stevia Caelestis')) Game.lumpRipeAge-=hour;
3491
if (Game.Has('Diabetica Daemonicus')) Game.lumpMatureAge-=hour;
3492
if (Game.Has('Ichor syrup')) Game.lumpMatureAge-=1000*60*7;
3493
if (Game.Has('Sugar aging process')) Game.lumpRipeAge-=6000*Math.min(600,Game.Objects['Grandma'].amount);//capped at 600 grandmas
3494
if (Game.hasGod && Game.BuildingsOwned%10==0)
3495
{
3496
var godLvl=Game.hasGod('order');
3497
if (godLvl==1) Game.lumpRipeAge-=hour;
3498
else if (godLvl==2) Game.lumpRipeAge-=(hour/3)*2;
3499
else if (godLvl==3) Game.lumpRipeAge-=(hour/3);
3500
}
3501
//if (Game.hasAura('Dragon\'s Curve')) {Game.lumpMatureAge/=1.05;Game.lumpRipeAge/=1.05;}
3502
Game.lumpMatureAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;Game.lumpRipeAge/=1+Game.auraMult('Dragon\'s Curve')*0.05;
3503
Game.lumpOverripeAge=Game.lumpRipeAge+hour;
3504
if (Game.Has('Glucose-charged air')) {Game.lumpMatureAge/=2000;Game.lumpRipeAge/=2000;Game.lumpOverripeAge/=2000;}
3505
}
3506
Game.loadLumps=function(time)
3507
{
3508
Game.computeLumpTimes();
3509
//Game.computeLumpType();
3510
if (!Game.canLumps()) Game.removeClass('lumpsOn');
3511
else
3512
{
3513
if (Game.ascensionMode!=1) Game.addClass('lumpsOn');
3514
Game.lumpT=Math.min(Date.now(),Game.lumpT);
3515
var age=Math.max(Date.now()-Game.lumpT,0);
3516
var amount=Math.floor(age/Game.lumpOverripeAge);//how many lumps did we harvest since we closed the game?
3517
if (amount>=1)
3518
{
3519
Game.harvestLumps(1,true);
3520
Game.lumpCurrentType=0;//all offline lumps after the first one have a normal type
3521
if (amount>1) Game.harvestLumps(amount-1,true);
3522
if (Game.prefs.popups) Game.Popup('Harvested '+Beautify(amount)+' sugar lump'+(amount==1?'':'s')+' while you were away');
3523
else Game.Notify('','You harvested <b>'+Beautify(amount)+'</b> sugar lump'+(amount==1?'':'s')+' while you were away.',[29,14]);
3524
Game.lumpT=Date.now()-(age-amount*Game.lumpOverripeAge);
3525
Game.computeLumpType();
3526
}
3527
}
3528
}
3529
Game.gainLumps=function(total)
3530
{
3531
if (Game.lumpsTotal==-1){Game.lumpsTotal=0;Game.lumps=0;}
3532
Game.lumps+=total;
3533
Game.lumpsTotal+=total;
3534
3535
if (Game.lumpsTotal>=7) Game.Win('Dude, sweet');
3536
if (Game.lumpsTotal>=30) Game.Win('Sugar rush');
3537
if (Game.lumpsTotal>=365) Game.Win('Year\'s worth of cavities');
3538
}
3539
Game.clickLump=function()
3540
{
3541
if (!Game.canLumps()) return;
3542
var age=Date.now()-Game.lumpT;
3543
if (age<Game.lumpMatureAge) {}
3544
else if (age<Game.lumpRipeAge)
3545
{
3546
var amount=choose([0,1]);
3547
if (amount!=0) Game.Win('Hand-picked');
3548
Game.harvestLumps(amount);
3549
Game.computeLumpType();
3550
}
3551
else if (age<Game.lumpOverripeAge)
3552
{
3553
Game.harvestLumps(1);
3554
Game.computeLumpType();
3555
}
3556
}
3557
Game.harvestLumps=function(amount,silent)
3558
{
3559
if (!Game.canLumps()) return;
3560
Game.lumpT=Date.now();
3561
var total=amount;
3562
if (Game.lumpCurrentType==1 && Game.Has('Sucralosia Inutilis') && Math.random()<0.05) total*=2;
3563
else if (Game.lumpCurrentType==1) total*=choose([1,2]);
3564
else if (Game.lumpCurrentType==2)
3565
{
3566
total*=choose([2,3,4,5,6,7]);
3567
Game.gainBuff('sugar blessing',24*60*60,1);
3568
Game.Earn(Math.min(Game.cookiesPs*60*60*24,Game.cookies));
3569
if (Game.prefs.popups) Game.Popup('Sugar blessing activated!');
3570
else Game.Notify('Sugar blessing activated!','Your cookies have been doubled.<br>+10% golden cookies for the next 24 hours.',[29,16]);
3571
}
3572
else if (Game.lumpCurrentType==3) total*=choose([0,0,1,2,2]);
3573
else if (Game.lumpCurrentType==4)
3574
{
3575
total*=choose([1,2,3]);
3576
Game.lumpRefill=Date.now()-Game.getLumpRefillMax();
3577
if (Game.prefs.popups) Game.Popup('Sugar lump cooldowns cleared!');
3578
else Game.Notify('Sugar lump cooldowns cleared!','',[29,27]);
3579
}
3580
total=Math.floor(total);
3581
Game.gainLumps(total);
3582
if (Game.lumpCurrentType==1) Game.Win('Sugar sugar');
3583
else if (Game.lumpCurrentType==2) Game.Win('All-natural cane sugar');
3584
else if (Game.lumpCurrentType==3) Game.Win('Sweetmeats');
3585
else if (Game.lumpCurrentType==4) Game.Win('Maillard reaction');
3586
3587
if (!silent)
3588
{
3589
var rect=l('lumpsIcon2').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);
3590
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);
3591
else Game.Popup('<small>Botched harvest!</small>',(rect.left+rect.right)/2,(rect.top+rect.bottom)/2-48);
3592
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
3593
}
3594
Game.computeLumpTimes();
3595
}
3596
Game.computeLumpType=function()
3597
{
3598
Math.seedrandom(Game.seed+'/'+Game.lumpT);
3599
var types=[0];
3600
var loop=1;
3601
//if (Game.hasAura('Dragon\'s Curve')) loop=2;
3602
loop+=Game.auraMult('Dragon\'s Curve');
3603
loop=randomFloor(loop);
3604
for (var i=0;i<loop;i++)
3605
{
3606
if (Math.random()<(Game.Has('Sucralosia Inutilis')?0.15:0.1)) types.push(1);//bifurcated
3607
if (Math.random()<3/1000) types.push(2);//golden
3608
if (Math.random()<0.1*Game.elderWrath) types.push(3);//meaty
3609
if (Math.random()<1/50) types.push(4);//caramelized
3610
}
3611
Game.lumpCurrentType=choose(types);
3612
Math.seedrandom();
3613
}
3614
3615
Game.canLumps=function()//grammatically pleasing function name
3616
{
3617
if (Game.lumpsTotal>-1 || (Game.ascensionMode!=1 && (Game.cookiesEarned+Game.cookiesReset)>=1000000000)) return true;
3618
return false;
3619
}
3620
3621
Game.getLumpRefillMax=function()
3622
{
3623
return 1000*60*15;//15 minutes
3624
}
3625
Game.getLumpRefillRemaining=function()
3626
{
3627
return Game.getLumpRefillMax()-(Date.now()-Game.lumpRefill);
3628
}
3629
Game.canRefillLump=function()
3630
{
3631
return ((Date.now()-Game.lumpRefill)>=Game.getLumpRefillMax());
3632
}
3633
Game.refillLump=function(n,func)
3634
{
3635
if (Game.lumps>=n && Game.canRefillLump())
3636
{
3637
Game.spendLump(n,'refill',function()
3638
{
3639
if (!Game.sesame) Game.lumpRefill=Date.now();
3640
func();
3641
})();
3642
}
3643
}
3644
Game.spendLump=function(n,str,func)
3645
{
3646
//ask if we want to spend N lumps
3647
return function()
3648
{
3649
if (Game.lumps<n) return false;
3650
if (Game.prefs.askLumps)
3651
{
3652
PlaySound('snd/tick.mp3');
3653
Game.promptConfirmFunc=func;//bit dumb
3654
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']);
3655
return false;
3656
}
3657
else
3658
{
3659
Game.lumps-=n;
3660
func();
3661
Game.recalculateGains=1;
3662
}
3663
}
3664
}
3665
3666
Game.doLumps=function()
3667
{
3668
if (!Game.canLumps()) {Game.removeClass('lumpsOn');return;}
3669
if (Game.lumpsTotal==-1)
3670
{
3671
//first time !
3672
if (Game.ascensionMode!=1) Game.addClass('lumpsOn');
3673
Game.lumpT-Date.now();
3674
Game.lumpsTotal=0;
3675
Game.lumps=0;
3676
Game.computeLumpType();
3677
3678
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]);
3679
}
3680
var age=Date.now()-Game.lumpT;
3681
if (age>Game.lumpOverripeAge)
3682
{
3683
age=0;
3684
Game.harvestLumps(1);
3685
Game.computeLumpType();
3686
}
3687
3688
var phase=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7));
3689
var phase2=Math.min(6,Math.floor((age/Game.lumpOverripeAge)*7)+1);
3690
var row=14;
3691
var row2=14;
3692
var type=Game.lumpCurrentType;
3693
if (type==1)//double
3694
{
3695
//if (phase>=6) row=15;
3696
if (phase2>=6) row2=15;
3697
}
3698
else if (type==2)//golden
3699
{
3700
if (phase>=4) row=16;
3701
if (phase2>=4) row2=16;
3702
}
3703
else if (type==3)//meaty
3704
{
3705
if (phase>=4) row=17;
3706
if (phase2>=4) row2=17;
3707
}
3708
else if (type==4)//caramelized
3709
{
3710
if (phase>=4) row=27;
3711
if (phase2>=4) row2=27;
3712
}
3713
var icon=[23+Math.min(phase,5),row];
3714
var icon2=[23+phase2,row2];
3715
var opacity=Math.min(6,(age/Game.lumpOverripeAge)*7)%1;
3716
if (phase>=6) {opacity=1;}
3717
l('lumpsIcon').style.backgroundPosition=(-icon[0]*48)+'px '+(-icon[1]*48)+'px';
3718
l('lumpsIcon2').style.backgroundPosition=(-icon2[0]*48)+'px '+(-icon2[1]*48)+'px';
3719
l('lumpsIcon2').style.opacity=opacity;
3720
l('lumpsAmount').innerHTML=Beautify(Game.lumps);
3721
}
3722
3723
/*=====================================================================================
3724
COOKIE ECONOMICS
3725
=======================================================================================*/
3726
Game.Earn=function(howmuch)
3727
{
3728
Game.cookies+=howmuch;
3729
Game.cookiesEarned+=howmuch;
3730
}
3731
Game.Spend=function(howmuch)
3732
{
3733
Game.cookies-=howmuch;
3734
}
3735
Game.Dissolve=function(howmuch)
3736
{
3737
Game.cookies-=howmuch;
3738
Game.cookiesEarned-=howmuch;
3739
Game.cookies=Math.max(0,Game.cookies);
3740
Game.cookiesEarned=Math.max(0,Game.cookiesEarned);
3741
}
3742
Game.mouseCps=function()
3743
{
3744
var add=0;
3745
if (Game.Has('Thousand fingers')) add+= 0.1;
3746
if (Game.Has('Million fingers')) add+= 0.5;
3747
if (Game.Has('Billion fingers')) add+= 5;
3748
if (Game.Has('Trillion fingers')) add+= 50;
3749
if (Game.Has('Quadrillion fingers')) add+= 500;
3750
if (Game.Has('Quintillion fingers')) add+= 5000;
3751
if (Game.Has('Sextillion fingers')) add+= 50000;
3752
if (Game.Has('Septillion fingers')) add+= 500000;
3753
if (Game.Has('Octillion fingers')) add+= 5000000;
3754
var num=0;
3755
for (var i in Game.Objects) {num+=Game.Objects[i].amount;}
3756
num-=Game.Objects['Cursor'].amount;
3757
add=add*num;
3758
if (Game.Has('Plastic mouse')) add+=Game.cookiesPs*0.01;
3759
if (Game.Has('Iron mouse')) add+=Game.cookiesPs*0.01;
3760
if (Game.Has('Titanium mouse')) add+=Game.cookiesPs*0.01;
3761
if (Game.Has('Adamantium mouse')) add+=Game.cookiesPs*0.01;
3762
if (Game.Has('Unobtainium mouse')) add+=Game.cookiesPs*0.01;
3763
if (Game.Has('Eludium mouse')) add+=Game.cookiesPs*0.01;
3764
if (Game.Has('Wishalloy mouse')) add+=Game.cookiesPs*0.01;
3765
if (Game.Has('Fantasteel mouse')) add+=Game.cookiesPs*0.01;
3766
if (Game.Has('Nevercrack mouse')) add+=Game.cookiesPs*0.01;
3767
if (Game.Has('Armythril mouse')) add+=Game.cookiesPs*0.01;
3768
if (Game.Has('Technobsidian mouse')) add+=Game.cookiesPs*0.01;
3769
if (Game.Has('Plasmarble mouse')) add+=Game.cookiesPs*0.01;
3770
3771
if (Game.Has('Fortune #104')) add+=Game.cookiesPs*0.01;
3772
var mult=1;
3773
3774
for (var i in Game.customMouseCps) {mult+=Game.customMouseCps[i]();}
3775
3776
if (Game.Has('Santa\'s helpers')) mult*=1.1;
3777
if (Game.Has('Cookie egg')) mult*=1.1;
3778
if (Game.Has('Halo gloves')) mult*=1.1;
3779
3780
mult*=Game.eff('click');
3781
3782
if (Game.hasGod)
3783
{
3784
var godLvl=Game.hasGod('labor');
3785
if (godLvl==1) mult*=1.15;
3786
else if (godLvl==2) mult*=1.1;
3787
else if (godLvl==3) mult*=1.05;
3788
}
3789
3790
for (var i in Game.buffs)
3791
{
3792
if (typeof Game.buffs[i].multClick != 'undefined') mult*=Game.buffs[i].multClick;
3793
}
3794
3795
//if (Game.hasAura('Dragon Cursor')) mult*=1.05;
3796
mult*=1+Game.auraMult('Dragon Cursor')*0.05;
3797
3798
for (var i in Game.customMouseCpsMult) {mult*=Game.customMouseCpsMult[i]();}
3799
3800
var out=mult*Game.ComputeCps(1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add);
3801
3802
if (Game.hasBuff('Cursed finger')) out=Game.buffs['Cursed finger'].power;
3803
return out;
3804
}
3805
Game.computedMouseCps=1;
3806
Game.globalCpsMult=1;
3807
Game.unbuffedCps=0;
3808
Game.lastClick=0;
3809
Game.CanClick=1;
3810
Game.autoclickerDetected=0;
3811
Game.BigCookieState=0;//0 = normal, 1 = clicked (small), 2 = released/hovered (big)
3812
Game.BigCookieSize=0;
3813
Game.BigCookieSizeD=0;
3814
Game.BigCookieSizeT=1;
3815
Game.cookieClickSound=Math.floor(Math.random()*7)+1;
3816
Game.playCookieClickSound=function()
3817
{
3818
if (Game.prefs.cookiesound) PlaySound('snd/clickb'+(Game.cookieClickSound)+'.mp3',0.5);
3819
else PlaySound('snd/click'+(Game.cookieClickSound)+'.mp3',0.5);
3820
Game.cookieClickSound+=Math.floor(Math.random()*4)+1;
3821
if (Game.cookieClickSound>7) Game.cookieClickSound-=7;
3822
}
3823
Game.ClickCookie=function(e,amount)
3824
{
3825
var now=Date.now();
3826
if (e) e.preventDefault();
3827
if (Game.OnAscend || Game.AscendTimer>0) {}
3828
else if (now-Game.lastClick<1000/250) {}
3829
else
3830
{
3831
if (now-Game.lastClick<1000/15)
3832
{
3833
Game.autoclickerDetected+=Game.fps;
3834
if (Game.autoclickerDetected>=Game.fps*5) Game.Win('Uncanny clicker');
3835
}
3836
Game.loseShimmeringVeil('click');
3837
var amount=amount?amount:Game.computedMouseCps;
3838
Game.Earn(amount);
3839
Game.handmadeCookies+=amount;
3840
if (Game.prefs.particles)
3841
{
3842
Game.particleAdd();
3843
Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1,2);
3844
}
3845
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));
3846
3847
for (var i in Game.customCookieClicks) {Game.customCookieClicks[i]();}
3848
3849
Game.playCookieClickSound();
3850
Game.cookieClicks++;
3851
}
3852
Game.lastClick=now;
3853
Game.Click=0;
3854
}
3855
Game.mouseX=0;
3856
Game.mouseY=0;
3857
Game.mouseX2=0;
3858
Game.mouseY2=0;
3859
Game.mouseMoved=0;
3860
Game.GetMouseCoords=function(e)
3861
{
3862
var posx=0;
3863
var posy=0;
3864
if (!e) var e=window.event;
3865
if (e.pageX||e.pageY)
3866
{
3867
posx=e.pageX;
3868
posy=e.pageY;
3869
}
3870
else if (e.clientX || e.clientY)
3871
{
3872
posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
3873
posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
3874
}
3875
var x=0;
3876
var y=32;
3877
/*
3878
var el=l('sectionLeft');
3879
while(el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop))
3880
{
3881
x+=el.offsetLeft-el.scrollLeft;
3882
y+=el.offsetTop-el.scrollTop;
3883
el=el.offsetParent;
3884
}*/
3885
Game.mouseX2=Game.mouseX;
3886
Game.mouseY2=Game.mouseY;
3887
Game.mouseX=posx-x;
3888
Game.mouseY=posy-y;
3889
Game.mouseMoved=1;
3890
Game.lastActivity=Game.time;
3891
}
3892
var bigCookie=l('bigCookie');
3893
Game.Click=0;
3894
Game.lastClickedEl=0;
3895
Game.clickFrom=0;
3896
Game.Scroll=0;
3897
Game.mouseDown=0;
3898
if (!Game.touchEvents)
3899
{
3900
AddEvent(bigCookie,'click',Game.ClickCookie);
3901
AddEvent(bigCookie,'mousedown',function(event){Game.BigCookieState=1;if (Game.prefs.cookiesound) {Game.playCookieClickSound();}if (event) event.preventDefault();});
3902
AddEvent(bigCookie,'mouseup',function(event){Game.BigCookieState=2;if (event) event.preventDefault();});
3903
AddEvent(bigCookie,'mouseout',function(event){Game.BigCookieState=0;});
3904
AddEvent(bigCookie,'mouseover',function(event){Game.BigCookieState=2;});
3905
AddEvent(document,'mousemove',Game.GetMouseCoords);
3906
AddEvent(document,'mousedown',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;Game.clickFrom=event.target;});
3907
AddEvent(document,'mouseup',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;Game.clickFrom=0;});
3908
AddEvent(document,'click',function(event){Game.lastActivity=Game.time;Game.Click=1;Game.lastClickedEl=event.target;Game.clickFrom=0;});
3909
Game.handleScroll=function(e)
3910
{
3911
if (!e) e=event;
3912
Game.Scroll=(e.detail<0||e.wheelDelta>0)?1:-1;
3913
Game.lastActivity=Game.time;
3914
};
3915
AddEvent(document,'DOMMouseScroll',Game.handleScroll);
3916
AddEvent(document,'mousewheel',Game.handleScroll);
3917
}
3918
else
3919
{
3920
//touch events
3921
AddEvent(bigCookie,'touchend',Game.ClickCookie);
3922
AddEvent(bigCookie,'touchstart',function(event){Game.BigCookieState=1;if (event) event.preventDefault();});
3923
AddEvent(bigCookie,'touchend',function(event){Game.BigCookieState=0;if (event) event.preventDefault();});
3924
//AddEvent(document,'touchmove',Game.GetMouseCoords);
3925
AddEvent(document,'mousemove',Game.GetMouseCoords);
3926
AddEvent(document,'touchstart',function(event){Game.lastActivity=Game.time;Game.mouseDown=1;});
3927
AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.mouseDown=0;});
3928
AddEvent(document,'touchend',function(event){Game.lastActivity=Game.time;Game.Click=1;});
3929
}
3930
3931
Game.keys=[];
3932
AddEvent(window,'keyup',function(e){
3933
Game.lastActivity=Game.time;
3934
if (e.keyCode==27)
3935
{
3936
Game.ClosePrompt();
3937
if (Game.AscendTimer>0) Game.AscendTimer=Game.AscendDuration;
3938
}//esc closes prompt
3939
else if (e.keyCode==13) Game.ConfirmPrompt();//enter confirms prompt
3940
Game.keys[e.keyCode]=0;
3941
});
3942
AddEvent(window,'keydown',function(e){
3943
if (!Game.OnAscend && Game.AscendTimer==0)
3944
{
3945
if (e.ctrlKey && e.keyCode==83) {Game.toSave=true;e.preventDefault();}//ctrl-s saves the game
3946
else if (e.ctrlKey && e.keyCode==79) {Game.ImportSave();e.preventDefault();}//ctrl-o opens the import menu
3947
}
3948
if ((e.keyCode==16 || e.keyCode==17) && Game.tooltip.dynamic) Game.tooltip.update();
3949
Game.keys[e.keyCode]=1;
3950
});
3951
3952
AddEvent(window,'visibilitychange',function(e){
3953
Game.keys=[];//reset all key pressed on visibility change (should help prevent ctrl still being down after ctrl-tab)
3954
});
3955
3956
/*=====================================================================================
3957
CPS RECALCULATOR
3958
=======================================================================================*/
3959
3960
Game.heavenlyPower=1;//how many CpS percents a single heavenly chip gives
3961
Game.recalculateGains=1;
3962
Game.cookiesPsByType={};
3963
Game.cookiesMultByType={};
3964
//display bars with http://codepen.io/anon/pen/waGyEJ
3965
Game.effs={};
3966
Game.eff=function(name,def){if (typeof Game.effs[name]==='undefined') return (typeof def==='undefined'?1:def); else return Game.effs[name];};
3967
3968
Game.CalculateGains=function()
3969
{
3970
Game.cookiesPs=0;
3971
var mult=1;
3972
//add up effect bonuses from building minigames
3973
var effs={};
3974
for (var i in Game.Objects)
3975
{
3976
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs)
3977
{
3978
var myEffs=Game.Objects[i].minigame.effs;
3979
for (var ii in myEffs)
3980
{
3981
if (effs[ii]) effs[ii]*=myEffs[ii];
3982
else effs[ii]=myEffs[ii];
3983
}
3984
}
3985
}
3986
Game.effs=effs;
3987
3988
if (Game.ascensionMode!=1) mult+=parseFloat(Game.prestige)*0.01*Game.heavenlyPower*Game.GetHeavenlyMultiplier();
3989
3990
mult*=Game.eff('cps');
3991
3992
if (Game.Has('Heralds') && Game.ascensionMode!=1) mult*=1+0.01*Game.heralds;
3993
3994
var cookieMult=0;
3995
for (var i in Game.cookieUpgrades)
3996
{
3997
var me=Game.cookieUpgrades[i];
3998
if (Game.Has(me.name))
3999
{
4000
mult*=(1+(typeof(me.power)=='function'?me.power(me):me.power)*0.01);
4001
}
4002
}
4003
mult*=(1+0.01*cookieMult);
4004
4005
if (Game.Has('Specialized chocolate chips')) mult*=1.01;
4006
if (Game.Has('Designer cocoa beans')) mult*=1.02;
4007
if (Game.Has('Underworld ovens')) mult*=1.03;
4008
if (Game.Has('Exotic nuts')) mult*=1.04;
4009
if (Game.Has('Arcane sugar')) mult*=1.05;
4010
4011
if (Game.Has('Increased merriness')) mult*=1.15;
4012
if (Game.Has('Improved jolliness')) mult*=1.15;
4013
if (Game.Has('A lump of coal')) mult*=1.01;
4014
if (Game.Has('An itchy sweater')) mult*=1.01;
4015
if (Game.Has('Santa\'s dominion')) mult*=1.2;
4016
4017
if (Game.Has('Fortune #100')) mult*=1.01;
4018
if (Game.Has('Fortune #101')) mult*=1.07;
4019
4020
var buildMult=1;
4021
if (Game.hasGod)
4022
{
4023
var godLvl=Game.hasGod('asceticism');
4024
if (godLvl==1) mult*=1.15;
4025
else if (godLvl==2) mult*=1.1;
4026
else if (godLvl==3) mult*=1.05;
4027
4028
var godLvl=Game.hasGod('ages');
4029
if (godLvl==1) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*3))*Math.PI*2);
4030
else if (godLvl==2) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*12))*Math.PI*2);
4031
else if (godLvl==3) mult*=1+0.15*Math.sin((Date.now()/1000/(60*60*24))*Math.PI*2);
4032
4033
var godLvl=Game.hasGod('decadence');
4034
if (godLvl==1) buildMult*=0.93;
4035
else if (godLvl==2) buildMult*=0.95;
4036
else if (godLvl==3) buildMult*=0.98;
4037
4038
var godLvl=Game.hasGod('industry');
4039
if (godLvl==1) buildMult*=1.1;
4040
else if (godLvl==2) buildMult*=1.06;
4041
else if (godLvl==3) buildMult*=1.03;
4042
4043
var godLvl=Game.hasGod('labor');
4044
if (godLvl==1) buildMult*=0.97;
4045
else if (godLvl==2) buildMult*=0.98;
4046
else if (godLvl==3) buildMult*=0.99;
4047
}
4048
4049
if (Game.Has('Santa\'s legacy')) mult*=1+(Game.santaLevel+1)*0.03;
4050
4051
for (var i in Game.Objects)
4052
{
4053
var me=Game.Objects[i];
4054
me.storedCps=(typeof(me.cps)=='function'?me.cps(me):me.cps);
4055
if (Game.ascensionMode!=1) me.storedCps*=(1+me.level*0.01)*buildMult;
4056
me.storedTotalCps=me.amount*me.storedCps;
4057
Game.cookiesPs+=me.storedTotalCps;
4058
Game.cookiesPsByType[me.name]=me.storedTotalCps;
4059
}
4060
4061
if (Game.Has('"egg"')) {Game.cookiesPs+=9;Game.cookiesPsByType['"egg"']=9;}//"egg"
4062
4063
for (var i in Game.customCps) {mult*=Game.customCps[i]();}
4064
4065
Game.milkProgress=Game.AchievementsOwned/25;
4066
var milkMult=1;
4067
if (Game.Has('Santa\'s milk and cookies')) milkMult*=1.05;
4068
//if (Game.hasAura('Breath of Milk')) milkMult*=1.05;
4069
milkMult*=1+Game.auraMult('Breath of Milk')*0.05;
4070
if (Game.hasGod)
4071
{
4072
var godLvl=Game.hasGod('mother');
4073
if (godLvl==1) milkMult*=1.1;
4074
else if (godLvl==2) milkMult*=1.05;
4075
else if (godLvl==3) milkMult*=1.03;
4076
}
4077
milkMult*=Game.eff('milk');
4078
4079
var catMult=1;
4080
4081
if (Game.Has('Kitten helpers')) catMult*=(1+Game.milkProgress*0.1*milkMult);
4082
if (Game.Has('Kitten workers')) catMult*=(1+Game.milkProgress*0.125*milkMult);
4083
if (Game.Has('Kitten engineers')) catMult*=(1+Game.milkProgress*0.15*milkMult);
4084
if (Game.Has('Kitten overseers')) catMult*=(1+Game.milkProgress*0.175*milkMult);
4085
if (Game.Has('Kitten managers')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4086
if (Game.Has('Kitten accountants')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4087
if (Game.Has('Kitten specialists')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4088
if (Game.Has('Kitten experts')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4089
if (Game.Has('Kitten consultants')) catMult*=(1+Game.milkProgress*0.2*milkMult);
4090
if (Game.Has('Kitten assistants to the regional manager')) catMult*=(1+Game.milkProgress*0.175*milkMult);
4091
if (Game.Has('Kitten marketeers')) catMult*=(1+Game.milkProgress*0.15*milkMult);
4092
if (Game.Has('Kitten analysts')) catMult*=(1+Game.milkProgress*0.125*milkMult);
4093
if (Game.Has('Kitten executives')) catMult*=(1+Game.milkProgress*0.115*milkMult);
4094
if (Game.Has('Kitten angels')) catMult*=(1+Game.milkProgress*0.1*milkMult);
4095
if (Game.Has('Fortune #103')) catMult*=(1+Game.milkProgress*0.05*milkMult);
4096
4097
Game.cookiesMultByType['kittens']=catMult;
4098
mult*=catMult;
4099
4100
var eggMult=1;
4101
if (Game.Has('Chicken egg')) eggMult*=1.01;
4102
if (Game.Has('Duck egg')) eggMult*=1.01;
4103
if (Game.Has('Turkey egg')) eggMult*=1.01;
4104
if (Game.Has('Quail egg')) eggMult*=1.01;
4105
if (Game.Has('Robin egg')) eggMult*=1.01;
4106
if (Game.Has('Ostrich egg')) eggMult*=1.01;
4107
if (Game.Has('Cassowary egg')) eggMult*=1.01;
4108
if (Game.Has('Salmon roe')) eggMult*=1.01;
4109
if (Game.Has('Frogspawn')) eggMult*=1.01;
4110
if (Game.Has('Shark egg')) eggMult*=1.01;
4111
if (Game.Has('Turtle egg')) eggMult*=1.01;
4112
if (Game.Has('Ant larva')) eggMult*=1.01;
4113
if (Game.Has('Century egg'))
4114
{
4115
//the boost increases a little every day, with diminishing returns up to +10% on the 100th day
4116
var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;
4117
day=Math.min(day,100);
4118
eggMult*=1+(1-Math.pow(1-day/100,3))*0.1;
4119
}
4120
4121
Game.cookiesMultByType['eggs']=eggMult;
4122
mult*=eggMult;
4123
4124
if (Game.Has('Sugar baking')) mult*=(1+Math.min(100,Game.lumps)*0.01);
4125
4126
//if (Game.hasAura('Radiant Appetite')) mult*=2;
4127
mult*=1+Game.auraMult('Radiant Appetite');
4128
4129
if (true)// || Game.hasAura('Dragon\'s Fortune'))
4130
{
4131
var n=Game.shimmerTypes['golden'].n;
4132
var auraMult=Game.auraMult('Dragon\'s Fortune');
4133
for (var i=0;i<n;i++){mult*=1+auraMult*1.23;}
4134
//old behavior
4135
/*var buffs=0;
4136
for (var i in Game.buffs)
4137
{buffs++;}
4138
mult*=1+(0.07)*buffs;*/
4139
}
4140
4141
var rawCookiesPs=Game.cookiesPs*mult;
4142
for (var i in Game.CpsAchievements)
4143
{
4144
if (rawCookiesPs>=Game.CpsAchievements[i].threshold) Game.Win(Game.CpsAchievements[i].name);
4145
}
4146
4147
name=Game.bakeryName.toLowerCase();
4148
if (name=='orteil') mult*=0.99;
4149
else if (name=='ortiel') mult*=0.98;//or so help me
4150
4151
var sucking=0;
4152
for (var i in Game.wrinklers)
4153
{
4154
if (Game.wrinklers[i].phase==2)
4155
{
4156
sucking++;
4157
}
4158
}
4159
var suckRate=1/20;//each wrinkler eats a twentieth of your CpS
4160
suckRate*=Game.eff('wrinklerEat');
4161
4162
Game.cpsSucked=sucking*suckRate;
4163
4164
4165
if (Game.Has('Elder Covenant')) mult*=0.95;
4166
4167
if (Game.Has('Golden switch [off]'))
4168
{
4169
var goldenSwitchMult=1.5;
4170
if (Game.Has('Residual luck'))
4171
{
4172
var upgrades=Game.goldenCookieUpgrades;
4173
for (var i in upgrades) {if (Game.Has(upgrades[i])) goldenSwitchMult+=0.1;}
4174
}
4175
mult*=goldenSwitchMult;
4176
}
4177
if (Game.Has('Shimmering veil [off]'))
4178
{
4179
var veilMult=0.5;
4180
if (Game.Has('Reinforced membrane')) veilMult+=0.1;
4181
mult*=1+veilMult;
4182
}
4183
if (Game.Has('Magic shenanigans')) mult*=1000;
4184
if (Game.Has('Occult obstruction')) mult*=0;
4185
4186
for (var i in Game.customCpsMult) {mult*=Game.customCpsMult[i]();}
4187
4188
4189
//cps without golden cookie effects
4190
Game.unbuffedCps=Game.cookiesPs*mult;
4191
4192
for (var i in Game.buffs)
4193
{
4194
if (typeof Game.buffs[i].multCpS != 'undefined') mult*=Game.buffs[i].multCpS;
4195
}
4196
4197
Game.globalCpsMult=mult;
4198
Game.cookiesPs*=Game.globalCpsMult;
4199
4200
//if (Game.hasBuff('Cursed finger')) Game.cookiesPs=0;
4201
4202
Game.computedMouseCps=Game.mouseCps();
4203
4204
Game.computeLumpTimes();
4205
4206
Game.recalculateGains=0;
4207
}
4208
4209
Game.dropRateMult=function()
4210
{
4211
var rate=1;
4212
if (Game.Has('Green yeast digestives')) rate*=1.03;
4213
rate*=Game.eff('itemDrops');
4214
//if (Game.hasAura('Mind Over Matter')) rate*=1.25;
4215
rate*=1+Game.auraMult('Mind Over Matter')*0.25;
4216
if (Game.Has('Santa\'s bottomless bag')) rate*=1.1;
4217
if (Game.Has('Cosmic beginner\'s luck') && !Game.Has('Heavenly chip secret')) rate*=5;
4218
return rate;
4219
}
4220
/*=====================================================================================
4221
SHIMMERS (GOLDEN COOKIES & SUCH)
4222
=======================================================================================*/
4223
Game.shimmersL=l('shimmers');
4224
Game.shimmers=[];//all shimmers currently on the screen
4225
Game.shimmersN=Math.floor(Math.random()*10000);
4226
Game.shimmer=function(type,obj,noCount)
4227
{
4228
this.type=type;
4229
4230
this.l=document.createElement('div');
4231
this.l.className='shimmer';
4232
if (!Game.touchEvents) {AddEvent(this.l,'click',function(what){return function(event){what.pop(event);};}(this));}
4233
else {AddEvent(this.l,'touchend',function(what){return function(event){what.pop(event);};}(this));}//touch events
4234
4235
this.x=0;
4236
this.y=0;
4237
this.id=Game.shimmersN;
4238
4239
this.forceObj=obj||0;
4240
this.noCount=noCount;
4241
if (!this.noCount) {Game.shimmerTypes[this.type].n++;Game.recalculateGains=1;}
4242
4243
this.init();
4244
4245
Game.shimmersL.appendChild(this.l);
4246
Game.shimmers.push(this);
4247
Game.shimmersN++;
4248
}
4249
Game.shimmer.prototype.init=function()//executed when the shimmer is created
4250
{
4251
Game.shimmerTypes[this.type].initFunc(this);
4252
}
4253
Game.shimmer.prototype.update=function()//executed every frame
4254
{
4255
Game.shimmerTypes[this.type].updateFunc(this);
4256
}
4257
Game.shimmer.prototype.pop=function(event)//executed when the shimmer is popped by the player
4258
{
4259
if (event) event.preventDefault();
4260
Game.loseShimmeringVeil('shimmer');
4261
Game.Click=0;
4262
Game.shimmerTypes[this.type].popFunc(this);
4263
}
4264
Game.shimmer.prototype.die=function()//executed after the shimmer disappears (from old age or popping)
4265
{
4266
if (Game.shimmerTypes[this.type].spawnsOnTimer && this.spawnLead)
4267
{
4268
//if this was the spawn lead for this shimmer type, set the shimmer type's "spawned" to 0 and restart its spawn timer
4269
var type=Game.shimmerTypes[this.type];
4270
type.time=0;
4271
type.spawned=0;
4272
type.minTime=type.getMinTime(this);
4273
type.maxTime=type.getMaxTime(this);
4274
}
4275
Game.shimmersL.removeChild(this.l);
4276
if (Game.shimmers.indexOf(this)!=-1) Game.shimmers.splice(Game.shimmers.indexOf(this),1);
4277
if (!this.noCount) {Game.shimmerTypes[this.type].n=Math.max(0,Game.shimmerTypes[this.type].n-1);Game.recalculateGains=1;}
4278
}
4279
4280
4281
Game.updateShimmers=function()//run shimmer functions, kill overtimed shimmers and spawn new ones
4282
{
4283
for (var i in Game.shimmers)
4284
{
4285
Game.shimmers[i].update();
4286
}
4287
4288
//cookie storm!
4289
if (Game.hasBuff('Cookie storm') && Math.random()<0.5)
4290
{
4291
var newShimmer=new Game.shimmer('golden',0,1);
4292
newShimmer.dur=Math.ceil(Math.random()*4+1);
4293
newShimmer.life=Math.ceil(Game.fps*newShimmer.dur);
4294
newShimmer.force='cookie storm drop';
4295
newShimmer.sizeMult=Math.random()*0.75+0.25;
4296
}
4297
4298
//spawn shimmers
4299
for (var i in Game.shimmerTypes)
4300
{
4301
var me=Game.shimmerTypes[i];
4302
if (me.spawnsOnTimer && me.spawnConditions())//only run on shimmer types that work on a timer
4303
{
4304
if (!me.spawned)//no shimmer spawned for this type? check the timer and try to spawn one
4305
{
4306
me.time++;
4307
if (Math.random()<Math.pow(Math.max(0,(me.time-me.minTime)/(me.maxTime-me.minTime)),5))
4308
{
4309
var newShimmer=new Game.shimmer(i);
4310
newShimmer.spawnLead=1;
4311
if (Game.Has('Distilled essence of redoubled luck') && Math.random()<0.01) var newShimmer=new Game.shimmer(i);
4312
me.spawned=1;
4313
}
4314
}
4315
}
4316
}
4317
}
4318
Game.killShimmers=function()//stop and delete all shimmers (used on resetting etc)
4319
{
4320
for (var i=Game.shimmers.length-1;i>=0;i--)
4321
{
4322
Game.shimmers[i].die();
4323
}
4324
for (var i in Game.shimmerTypes)
4325
{
4326
var me=Game.shimmerTypes[i];
4327
if (me.reset) me.reset();
4328
me.n=0;
4329
if (me.spawnsOnTimer)
4330
{
4331
me.time=0;
4332
me.spawned=0;
4333
me.minTime=me.getMinTime(me);
4334
me.maxTime=me.getMaxTime(me);
4335
}
4336
}
4337
}
4338
4339
Game.shimmerTypes={
4340
//in these, "me" refers to the shimmer itself, and "this" to the shimmer's type object
4341
'golden':{
4342
reset:function()
4343
{
4344
this.chain=0;
4345
this.totalFromChain=0;
4346
this.last='';
4347
},
4348
initFunc:function(me)
4349
{
4350
if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/chime.mp3');
4351
4352
//set image
4353
var bgPic='img/goldCookie.png';
4354
var picX=0;var picY=0;
4355
4356
4357
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'))))
4358
{
4359
me.wrath=1;
4360
if (Game.season=='halloween') bgPic='img/spookyCookie.png';
4361
else bgPic='img/wrathCookie.png';
4362
}
4363
else
4364
{
4365
me.wrath=0;
4366
}
4367
4368
if (Game.season=='valentines')
4369
{
4370
bgPic='img/hearts.png';
4371
picX=Math.floor(Math.random()*8);
4372
}
4373
else if (Game.season=='fools')
4374
{
4375
bgPic='img/contract.png';
4376
if (me.wrath) bgPic='img/wrathContract.png';
4377
}
4378
else if (Game.season=='easter')
4379
{
4380
bgPic='img/bunnies.png';
4381
picX=Math.floor(Math.random()*4);
4382
picY=0;
4383
if (me.wrath) picY=1;
4384
}
4385
4386
me.x=Math.floor(Math.random()*Math.max(0,(Game.bounds.right-300)-Game.bounds.left-128)+Game.bounds.left+64)-64;
4387
me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-128)+Game.bounds.top+64)-64;
4388
me.l.style.left=me.x+'px';
4389
me.l.style.top=me.y+'px';
4390
me.l.style.width='96px';
4391
me.l.style.height='96px';
4392
me.l.style.backgroundImage='url('+bgPic+')';
4393
me.l.style.backgroundPosition=(-picX*96)+'px '+(-picY*96)+'px';
4394
me.l.style.opacity='0';
4395
me.l.style.display='block';
4396
4397
me.life=1;//the cookie's current progression through its lifespan (in frames)
4398
me.dur=13;//duration; the cookie's lifespan in seconds before it despawns
4399
4400
var dur=13;
4401
if (Game.Has('Lucky day')) dur*=2;
4402
if (Game.Has('Serendipity')) dur*=2;
4403
if (Game.Has('Decisive fate')) dur*=1.05;
4404
if (Game.Has('Lucky digit')) dur*=1.01;
4405
if (Game.Has('Lucky number')) dur*=1.01;
4406
if (Game.Has('Lucky payout')) dur*=1.01;
4407
if (!me.wrath) dur*=Game.eff('goldenCookieDur');
4408
else dur*=Game.eff('wrathCookieDur');
4409
dur*=Math.pow(0.95,Game.shimmerTypes['golden'].n-1);//5% shorter for every other golden cookie on the screen
4410
if (this.chain>0) dur=Math.max(2,10/this.chain);//this is hilarious
4411
me.dur=dur;
4412
me.life=Math.ceil(Game.fps*me.dur);
4413
me.force='';
4414
me.sizeMult=1;
4415
},
4416
updateFunc:function(me)
4417
{
4418
var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,4);
4419
me.l.style.opacity=curve;
4420
//this line makes each golden cookie pulse in a unique way
4421
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))))+')';
4422
me.life--;
4423
if (me.life<=0) {this.missFunc(me);me.die();}
4424
},
4425
popFunc:function(me)
4426
{
4427
//get achievs and stats
4428
if (me.spawnLead)
4429
{
4430
Game.goldenClicks++;
4431
Game.goldenClicksLocal++;
4432
4433
if (Game.goldenClicks>=1) Game.Win('Golden cookie');
4434
if (Game.goldenClicks>=7) Game.Win('Lucky cookie');
4435
if (Game.goldenClicks>=27) Game.Win('A stroke of luck');
4436
if (Game.goldenClicks>=77) Game.Win('Fortune');
4437
if (Game.goldenClicks>=777) Game.Win('Leprechaun');
4438
if (Game.goldenClicks>=7777) Game.Win('Black cat\'s paw');
4439
4440
if (Game.goldenClicks>=7) Game.Unlock('Lucky day');
4441
if (Game.goldenClicks>=27) Game.Unlock('Serendipity');
4442
if (Game.goldenClicks>=77) Game.Unlock('Get lucky');
4443
4444
if ((me.life/Game.fps)>(me.dur-1)) Game.Win('Early bird');
4445
if (me.life<Game.fps) Game.Win('Fading luck');
4446
}
4447
4448
if (Game.forceUnslotGod)
4449
{
4450
if (Game.forceUnslotGod('asceticism')) Game.useSwap(1000000);
4451
}
4452
4453
//select an effect
4454
var list=[];
4455
if (me.wrath>0) list.push('clot','multiply cookies','ruin cookies');
4456
else list.push('frenzy','multiply cookies');
4457
if (me.wrath>0 && Game.hasGod && Game.hasGod('scorn')) list.push('clot','ruin cookies','clot','ruin cookies');
4458
if (me.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie','cookie storm');
4459
else if (Math.random()<0.03 && Game.cookiesEarned>=100000) list.push('chain cookie','cookie storm');
4460
if (Math.random()<0.05 && Game.season=='fools') list.push('everything must go');
4461
if (Math.random()<0.1 && (Math.random()<0.05 || !Game.hasBuff('Dragonflight'))) list.push('click frenzy');
4462
if (me.wrath && Math.random()<0.1) list.push('cursed finger');
4463
4464
if (Game.BuildingsOwned>=10 && Math.random()<0.25) list.push('building special');
4465
4466
if (Game.canLumps() && Math.random()<0.0005) list.push('free sugar lump');
4467
4468
if ((me.wrath==0 && Math.random()<0.15) || Math.random()<0.05)
4469
{
4470
//if (Game.hasAura('Reaper of Fields')) list.push('dragon harvest');
4471
if (Math.random()<Game.auraMult('Reaper of Fields')) list.push('dragon harvest');
4472
//if (Game.hasAura('Dragonflight')) list.push('dragonflight');
4473
if (Math.random()<Game.auraMult('Dragonflight')) list.push('dragonflight');
4474
}
4475
4476
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
4477
if (Math.random()<0.0001) list.push('blab');
4478
var choice=choose(list);
4479
4480
if (this.chain>0) choice='chain cookie';
4481
if (me.force!='') {this.chain=0;choice=me.force;me.force='';}
4482
if (choice!='chain cookie') this.chain=0;
4483
4484
this.last=choice;
4485
4486
//create buff for effect
4487
//buff duration multiplier
4488
var effectDurMod=1;
4489
if (Game.Has('Get lucky')) effectDurMod*=2;
4490
if (Game.Has('Lasting fortune')) effectDurMod*=1.1;
4491
if (Game.Has('Lucky digit')) effectDurMod*=1.01;
4492
if (Game.Has('Lucky number')) effectDurMod*=1.01;
4493
if (Game.Has('Green yeast digestives')) effectDurMod*=1.01;
4494
if (Game.Has('Lucky payout')) effectDurMod*=1.01;
4495
//if (Game.hasAura('Epoch Manipulator')) effectDurMod*=1.05;
4496
effectDurMod*=1+Game.auraMult('Epoch Manipulator')*0.05;
4497
if (!me.wrath) effectDurMod*=Game.eff('goldenCookieEffDur');
4498
else effectDurMod*=Game.eff('wrathCookieEffDur');
4499
4500
if (Game.hasGod)
4501
{
4502
var godLvl=Game.hasGod('decadence');
4503
if (godLvl==1) effectDurMod*=1.07;
4504
else if (godLvl==2) effectDurMod*=1.05;
4505
else if (godLvl==3) effectDurMod*=1.02;
4506
}
4507
4508
//effect multiplier (from lucky etc)
4509
var mult=1;
4510
//if (me.wrath>0 && Game.hasAura('Unholy Dominion')) mult*=1.1;
4511
//else if (me.wrath==0 && Game.hasAura('Ancestral Metamorphosis')) mult*=1.1;
4512
if (me.wrath>0) mult*=1+Game.auraMult('Unholy Dominion')*0.1;
4513
else if (me.wrath==0) mult*=1+Game.auraMult('Ancestral Metamorphosis')*0.1;
4514
if (Game.Has('Green yeast digestives')) mult*=1.01;
4515
if (!me.wrath) mult*=Game.eff('goldenCookieGain');
4516
else mult*=Game.eff('wrathCookieGain');
4517
4518
var popup='';
4519
var buff=0;
4520
4521
if (choice=='building special')
4522
{
4523
var time=Math.ceil(30*effectDurMod);
4524
var list=[];
4525
for (var i in Game.Objects)
4526
{
4527
if (Game.Objects[i].amount>=10) list.push(Game.Objects[i].id);
4528
}
4529
if (list.length==0) {choice='frenzy';}//default to frenzy if no proper building
4530
else
4531
{
4532
var obj=choose(list);
4533
var pow=Game.ObjectsById[obj].amount/10+1;
4534
if (me.wrath && Math.random()<0.3)
4535
{
4536
buff=Game.gainBuff('building debuff',time,pow,obj);
4537
}
4538
else
4539
{
4540
buff=Game.gainBuff('building buff',time,pow,obj);
4541
}
4542
}
4543
}
4544
4545
if (choice=='free sugar lump')
4546
{
4547
Game.gainLumps(1);
4548
popup='Sweet!<div style="font-size:65%;">Found 1 sugar lump!</div>';
4549
}
4550
else if (choice=='frenzy')
4551
{
4552
buff=Game.gainBuff('frenzy',Math.ceil(77*effectDurMod),7);
4553
}
4554
else if (choice=='dragon harvest')
4555
{
4556
buff=Game.gainBuff('dragon harvest',Math.ceil(60*effectDurMod),15);
4557
}
4558
else if (choice=='everything must go')
4559
{
4560
buff=Game.gainBuff('everything must go',Math.ceil(8*effectDurMod),5);
4561
}
4562
else if (choice=='multiply cookies')
4563
{
4564
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
4565
Game.Earn(moni);
4566
popup='Lucky!<div style="font-size:65%;">+'+Beautify(moni)+' cookies!</div>';
4567
}
4568
else if (choice=='ruin cookies')
4569
{
4570
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
4571
moni=Math.min(Game.cookies,moni);
4572
Game.Spend(moni);
4573
popup='Ruin!<div style="font-size:65%;">Lost '+Beautify(moni)+' cookies!</div>';
4574
}
4575
else if (choice=='blood frenzy')
4576
{
4577
buff=Game.gainBuff('blood frenzy',Math.ceil(6*effectDurMod),666);
4578
}
4579
else if (choice=='clot')
4580
{
4581
buff=Game.gainBuff('clot',Math.ceil(66*effectDurMod),0.5);
4582
}
4583
else if (choice=='cursed finger')
4584
{
4585
buff=Game.gainBuff('cursed finger',Math.ceil(10*effectDurMod),Game.cookiesPs*Math.ceil(10*effectDurMod));
4586
}
4587
else if (choice=='click frenzy')
4588
{
4589
buff=Game.gainBuff('click frenzy',Math.ceil(13*effectDurMod),777);
4590
}
4591
else if (choice=='dragonflight')
4592
{
4593
buff=Game.gainBuff('dragonflight',Math.ceil(10*effectDurMod),1111);
4594
if (Math.random()<0.8) Game.killBuff('Click frenzy');
4595
}
4596
else if (choice=='chain cookie')
4597
{
4598
//fix by Icehawk78
4599
if (this.chain==0) this.totalFromChain=0;
4600
this.chain++;
4601
var digit=me.wrath?6:7;
4602
if (this.chain==1) this.chain+=Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);
4603
4604
var maxPayout=Math.min(Game.cookiesPs*60*60*6,Game.cookies*0.5)*mult;
4605
var moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain)*digit*mult),maxPayout));
4606
var nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,this.chain+1)*digit*mult),maxPayout));
4607
this.totalFromChain+=moni;
4608
var moniStr=Beautify(moni);
4609
4610
//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)
4611
if (Math.random()<0.01 || nextMoni>=maxPayout)
4612
{
4613
this.chain=0;
4614
popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!<br>Cookie chain over. You made '+Beautify(this.totalFromChain)+' cookies.</div>';
4615
}
4616
else
4617
{
4618
popup='Cookie chain<div style="font-size:65%;">+'+moniStr+' cookies!</div>';//
4619
}
4620
Game.Earn(moni);
4621
}
4622
else if (choice=='cookie storm')
4623
{
4624
buff=Game.gainBuff('cookie storm',Math.ceil(7*effectDurMod),7);
4625
}
4626
else if (choice=='cookie storm drop')
4627
{
4628
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
4629
Game.Earn(moni);
4630
popup='<div style="font-size:75%;">+'+Beautify(moni)+' cookies!</div>';
4631
}
4632
else if (choice=='blab')//sorry (it's really rare)
4633
{
4634
var str=choose([
4635
'Cookie crumbliness x3 for 60 seconds!',
4636
'Chocolatiness x7 for 77 seconds!',
4637
'Dough elasticity halved for 66 seconds!',
4638
'Golden cookie shininess doubled for 3 seconds!',
4639
'World economy halved for 30 seconds!',
4640
'Grandma kisses 23% stingier for 45 seconds!',
4641
'Thanks for clicking!',
4642
'Fooled you! This one was just a test.',
4643
'Golden cookies clicked +1!',
4644
'Your click has been registered. Thank you for your cooperation.',
4645
'Thanks! That hit the spot!',
4646
'Thank you. A team has been dispatched.',
4647
'They know.',
4648
'Oops. This was just a chocolate cookie with shiny aluminium foil.'
4649
]);
4650
popup=str;
4651
}
4652
4653
if (popup=='' && buff && buff.name && buff.desc) popup=buff.name+'<div style="font-size:65%;">'+buff.desc+'</div>';
4654
if (popup!='') Game.Popup(popup,me.x+me.l.offsetWidth/2,me.y);
4655
4656
Game.DropEgg(0.9);
4657
4658
//sparkle and kill the shimmer
4659
Game.SparkleAt(me.x+48,me.y+48);
4660
if (choice=='cookie storm drop')
4661
{
4662
if (Game.prefs.cookiesound) PlaySound('snd/clickb'+Math.floor(Math.random()*7+1)+'.mp3',0.75);
4663
else PlaySound('snd/click'+Math.floor(Math.random()*7+1)+'.mp3',0.75);
4664
}
4665
else PlaySound('snd/shimmerClick.mp3');
4666
me.die();
4667
},
4668
missFunc:function(me)
4669
{
4670
if (this.chain>0 && this.totalFromChain>0)
4671
{
4672
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);
4673
this.chain=0;this.totalFromChain=0;
4674
}
4675
if (me.spawnLead) Game.missedGoldenClicks++;
4676
},
4677
spawnsOnTimer:true,
4678
spawnConditions:function()
4679
{
4680
if (!Game.Has('Golden switch [off]')) return true; else return false;
4681
},
4682
spawned:0,
4683
time:0,
4684
minTime:0,
4685
maxTime:0,
4686
getTimeMod:function(me,m)
4687
{
4688
if (Game.Has('Lucky day')) m/=2;
4689
if (Game.Has('Serendipity')) m/=2;
4690
if (Game.Has('Golden goose egg')) m*=0.95;
4691
if (Game.Has('Heavenly luck')) m*=0.95;
4692
if (Game.Has('Green yeast digestives')) m*=0.99;
4693
//if (Game.hasAura('Arcane Aura')) m*=0.95;
4694
m*=1-Game.auraMult('Arcane Aura')*0.05;
4695
if (Game.hasBuff('Sugar blessing')) m*=0.9;
4696
if (Game.season=='easter' && Game.Has('Starspawn')) m*=0.98;
4697
else if (Game.season=='halloween' && Game.Has('Starterror')) m*=0.98;
4698
else if (Game.season=='valentines' && Game.Has('Starlove')) m*=0.98;
4699
else if (Game.season=='fools' && Game.Has('Startrade')) m*=0.95;
4700
if (!me.wrath) m*=1/Game.eff('goldenCookieFreq');
4701
else m*=1/Game.eff('wrathCookieFreq');
4702
if (Game.hasGod)
4703
{
4704
var godLvl=Game.hasGod('industry');
4705
if (godLvl==1) m*=1.1;
4706
else if (godLvl==2) m*=1.06;
4707
else if (godLvl==3) m*=1.03;
4708
var godLvl=Game.hasGod('mother');
4709
if (godLvl==1) m*=1.15;
4710
else if (godLvl==2) m*=1.1;
4711
else if (godLvl==3) m*=1.05;
4712
4713
if (Game.season!='')
4714
{
4715
var godLvl=Game.hasGod('seasons');
4716
if (Game.season!='fools')
4717
{
4718
if (godLvl==1) m*=0.97;
4719
else if (godLvl==2) m*=0.98;
4720
else if (godLvl==3) m*=0.99;
4721
}
4722
else
4723
{
4724
if (godLvl==1) m*=0.955;
4725
else if (godLvl==2) m*=0.97;
4726
else if (godLvl==3) m*=0.985;
4727
}
4728
}
4729
}
4730
if (this.chain>0) m=0.05;
4731
if (Game.Has('Gold hoard')) m=0.01;
4732
return Math.ceil(Game.fps*60*m);
4733
},
4734
getMinTime:function(me)
4735
{
4736
var m=5;
4737
return this.getTimeMod(me,m);
4738
},
4739
getMaxTime:function(me)
4740
{
4741
var m=15;
4742
return this.getTimeMod(me,m);
4743
},
4744
last:'',
4745
},
4746
'reindeer':{
4747
reset:function()
4748
{
4749
},
4750
initFunc:function(me)
4751
{
4752
if (!this.spawned && Game.chimeType==1 && Game.ascensionMode!=1) PlaySound('snd/jingle.mp3');
4753
4754
me.x=-128;
4755
me.y=Math.floor(Math.random()*Math.max(0,Game.bounds.bottom-Game.bounds.top-256)+Game.bounds.top+128)-128;
4756
//me.l.style.left=me.x+'px';
4757
//me.l.style.top=me.y+'px';
4758
me.l.style.width='167px';
4759
me.l.style.height='212px';
4760
me.l.style.backgroundImage='url(img/frostedReindeer.png)';
4761
me.l.style.opacity='0';
4762
//me.l.style.transform='rotate('+(Math.random()*60-30)+'deg) scale('+(Math.random()*1+0.25)+')';
4763
me.l.style.display='block';
4764
4765
me.life=1;//the reindeer's current progression through its lifespan (in frames)
4766
me.dur=4;//duration; the cookie's lifespan in seconds before it despawns
4767
4768
var dur=4;
4769
if (Game.Has('Weighted sleighs')) dur*=2;
4770
dur*=Game.eff('reindeerDur');
4771
me.dur=dur;
4772
me.life=Math.ceil(Game.fps*me.dur);
4773
me.sizeMult=1;
4774
},
4775
updateFunc:function(me)
4776
{
4777
var curve=1-Math.pow((me.life/(Game.fps*me.dur))*2-1,12);
4778
me.l.style.opacity=curve;
4779
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))+')';
4780
me.life--;
4781
if (me.life<=0) {this.missFunc(me);me.die();}
4782
},
4783
popFunc:function(me)
4784
{
4785
//get achievs and stats
4786
if (me.spawnLead)
4787
{
4788
Game.reindeerClicked++;
4789
}
4790
4791
var val=Game.cookiesPs*60;
4792
if (Game.hasBuff('Elder frenzy')) val*=0.5;//very sorry
4793
if (Game.hasBuff('Frenzy')) val*=0.75;//I sincerely apologize
4794
var moni=Math.max(25,val);//1 minute of cookie production, or 25 cookies - whichever is highest
4795
if (Game.Has('Ho ho ho-flavored frosting')) moni*=2;
4796
moni*=Game.eff('reindeerGain');
4797
Game.Earn(moni);
4798
if (Game.hasBuff('Elder frenzy')) Game.Win('Eldeer');
4799
4800
var cookie='';
4801
var failRate=0.8;
4802
if (Game.HasAchiev('Let it snow')) failRate=0.6;
4803
failRate*=1/Game.dropRateMult();
4804
if (Game.Has('Starsnow')) failRate*=0.95;
4805
if (Game.hasGod)
4806
{
4807
var godLvl=Game.hasGod('seasons');
4808
if (godLvl==1) failRate*=0.9;
4809
else if (godLvl==2) failRate*=0.95;
4810
else if (godLvl==3) failRate*=0.97;
4811
}
4812
if (Math.random()>failRate)//christmas cookie drops
4813
{
4814
cookie=choose(['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits']);
4815
if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))
4816
{
4817
Game.Unlock(cookie);
4818
}
4819
else cookie='';
4820
}
4821
4822
var popup='';
4823
4824
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+'!'));
4825
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);
4826
popup='<div style="font-size:80%;">+'+Beautify(moni)+' cookies!</div>';
4827
4828
if (popup!='') Game.Popup(popup,Game.mouseX,Game.mouseY);
4829
4830
//sparkle and kill the shimmer
4831
Game.SparkleAt(Game.mouseX,Game.mouseY);
4832
PlaySound('snd/jingleClick.mp3');
4833
me.die();
4834
},
4835
missFunc:function(me)
4836
{
4837
},
4838
spawnsOnTimer:true,
4839
spawnConditions:function()
4840
{
4841
if (Game.season=='christmas') return true; else return false;
4842
},
4843
spawned:0,
4844
time:0,
4845
minTime:0,
4846
maxTime:0,
4847
getTimeMod:function(me,m)
4848
{
4849
if (Game.Has('Reindeer baking grounds')) m/=2;
4850
if (Game.Has('Starsnow')) m*=0.95;
4851
if (Game.hasGod)
4852
{
4853
var godLvl=Game.hasGod('seasons');
4854
if (godLvl==1) m*=0.9;
4855
else if (godLvl==2) m*=0.95;
4856
else if (godLvl==3) m*=0.97;
4857
}
4858
m*=1/Game.eff('reindeerFreq');
4859
if (Game.Has('Reindeer season')) m=0.01;
4860
return Math.ceil(Game.fps*60*m);
4861
},
4862
getMinTime:function(me)
4863
{
4864
var m=3;
4865
return this.getTimeMod(me,m);
4866
},
4867
getMaxTime:function(me)
4868
{
4869
var m=6;
4870
return this.getTimeMod(me,m);
4871
},
4872
}
4873
};
4874
4875
Game.goldenCookieChoices=[
4876
"Frenzy","frenzy",
4877
"Lucky","multiply cookies",
4878
"Ruin","ruin cookies",
4879
"Elder frenzy","blood frenzy",
4880
"Clot","clot",
4881
"Click frenzy","click frenzy",
4882
"Cursed finger","cursed finger",
4883
"Cookie chain","chain cookie",
4884
"Cookie storm","cookie storm",
4885
"Building special","building special",
4886
"Dragon Harvest","dragon harvest",
4887
"Dragonflight","dragonflight",
4888
"Sweet","free sugar lump",
4889
"Blab","blab"
4890
];
4891
Game.goldenCookieBuildingBuffs={
4892
'Cursor':['High-five','Slap to the face'],
4893
'Grandma':['Congregation','Senility'],
4894
'Farm':['Luxuriant harvest','Locusts'],
4895
'Mine':['Ore vein','Cave-in'],
4896
'Factory':['Oiled-up','Jammed machinery'],
4897
'Bank':['Juicy profits','Recession'],
4898
'Temple':['Fervent adoration','Crisis of faith'],
4899
'Wizard tower':['Manabloom','Magivores'],
4900
'Shipment':['Delicious lifeforms','Black holes'],
4901
'Alchemy lab':['Breakthrough','Lab disaster'],
4902
'Portal':['Righteous cataclysm','Dimensional calamity'],
4903
'Time machine':['Golden ages','Time jam'],
4904
'Antimatter condenser':['Extra cycles','Predictable tragedy'],
4905
'Prism':['Solar flare','Eclipse'],
4906
'Chancemaker':['Winning streak','Dry spell'],
4907
'Fractal engine':['Macrocosm','Microcosm'],
4908
'Javascript console':['Refactoring','Antipattern'],
4909
};
4910
4911
/*=====================================================================================
4912
PARTICLES
4913
=======================================================================================*/
4914
//generic particles (falling cookies etc)
4915
//only displayed on left section
4916
Game.particles=[];
4917
for (var i=0;i<50;i++)
4918
{
4919
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};
4920
}
4921
4922
Game.particlesUpdate=function()
4923
{
4924
for (var i in Game.particles)
4925
{
4926
var me=Game.particles[i];
4927
if (me.life!=-1)
4928
{
4929
if (!me.text) me.yd+=0.2+Math.random()*0.1;
4930
me.x+=me.xd;
4931
me.y+=me.yd;
4932
//me.y+=me.life*0.25+Math.random()*0.25;
4933
me.life++;
4934
if (me.life>=Game.fps*me.dur)
4935
{
4936
me.life=-1;
4937
}
4938
}
4939
}
4940
}
4941
Game.particleAdd=function(x,y,xd,yd,size,dur,z,pic,text)
4942
{
4943
//Game.particleAdd(pos X,pos Y,speed X,speed Y,size (multiplier),duration (seconds),layer,picture,text);
4944
//pick the first free (or the oldest) particle to replace it
4945
if (1 || Game.prefs.particles)
4946
{
4947
var highest=0;
4948
var highestI=0;
4949
for (var i in Game.particles)
4950
{
4951
if (Game.particles[i].life==-1) {highestI=i;break;}
4952
if (Game.particles[i].life>highest)
4953
{
4954
highest=Game.particles[i].life;
4955
highestI=i;
4956
}
4957
}
4958
var auto=0;
4959
if (x) auto=1;
4960
var i=highestI;
4961
var x=x||-64;
4962
if (Game.LeftBackground && !auto) x=Math.floor(Math.random()*Game.LeftBackground.canvas.width);
4963
var y=y||-64;
4964
var me=Game.particles[i];
4965
me.life=0;
4966
me.x=x;
4967
me.y=y;
4968
me.xd=xd||0;
4969
me.yd=yd||0;
4970
me.size=size||1;
4971
me.z=z||0;
4972
me.dur=dur||2;
4973
me.r=Math.floor(Math.random()*360);
4974
me.picId=Math.floor(Math.random()*10000);
4975
if (!pic)
4976
{
4977
if (Game.season=='fools') pic='smallDollars.png';
4978
else
4979
{
4980
var cookies=[[10,0]];
4981
for (var i in Game.Upgrades)
4982
{
4983
var cookie=Game.Upgrades[i];
4984
if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);
4985
}
4986
me.picPos=choose(cookies);
4987
if (Game.bakeryName.toLowerCase()=='ortiel' || Math.random()<1/10000) me.picPos=[17,5];
4988
pic='icons.png';
4989
}
4990
}
4991
me.pic=pic||'smallCookies.png';
4992
me.text=text||0;
4993
return me;
4994
}
4995
return {};
4996
}
4997
Game.particlesDraw=function(z)
4998
{
4999
var ctx=Game.LeftBackground;
5000
ctx.fillStyle='#fff';
5001
ctx.font='20px Merriweather';
5002
ctx.textAlign='center';
5003
5004
for (var i in Game.particles)
5005
{
5006
var me=Game.particles[i];
5007
if (me.z==z)
5008
{
5009
if (me.life!=-1)
5010
{
5011
var opacity=1-(me.life/(Game.fps*me.dur));
5012
ctx.globalAlpha=opacity;
5013
if (me.text)
5014
{
5015
ctx.fillText(me.text,me.x,me.y);
5016
}
5017
else
5018
{
5019
ctx.save();
5020
ctx.translate(me.x,me.y);
5021
ctx.rotate((me.r/360)*Math.PI*2);
5022
var w=64;
5023
var h=64;
5024
if (me.pic=='icons.png')
5025
{
5026
w=48;
5027
h=48;
5028
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);
5029
}
5030
else
5031
{
5032
if (me.pic=='wrinklerBits.png' || me.pic=='shinyWrinklerBits.png') {w=100;h=200;}
5033
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);
5034
}
5035
ctx.restore();
5036
}
5037
}
5038
}
5039
}
5040
}
5041
5042
//text particles (popups etc)
5043
Game.textParticles=[];
5044
Game.textParticlesY=0;
5045
var str='';
5046
for (var i=0;i<20;i++)
5047
{
5048
Game.textParticles[i]={x:0,y:0,life:-1,text:''};
5049
str+='<div id="particle'+i+'" class="particle title"></div>';
5050
}
5051
l('particles').innerHTML=str;
5052
Game.textParticlesUpdate=function()
5053
{
5054
for (var i in Game.textParticles)
5055
{
5056
var me=Game.textParticles[i];
5057
if (me.life!=-1)
5058
{
5059
me.life++;
5060
if (me.life>=Game.fps*4)
5061
{
5062
var el=me.l;
5063
me.life=-1;
5064
el.style.opacity=0;
5065
el.style.display='none';
5066
}
5067
}
5068
}
5069
}
5070
Game.textParticlesAdd=function(text,el,posX,posY)
5071
{
5072
//pick the first free (or the oldest) particle to replace it
5073
var highest=0;
5074
var highestI=0;
5075
for (var i in Game.textParticles)
5076
{
5077
if (Game.textParticles[i].life==-1) {highestI=i;break;}
5078
if (Game.textParticles[i].life>highest)
5079
{
5080
highest=Game.textParticles[i].life;
5081
highestI=i;
5082
}
5083
}
5084
var i=highestI;
5085
var noStack=0;
5086
if (typeof posX!=='undefined' && typeof posY!=='undefined')
5087
{
5088
x=posX;
5089
y=posY;
5090
noStack=1;
5091
}
5092
else
5093
{
5094
var x=(Math.random()-0.5)*40;
5095
var y=0;//+(Math.random()-0.5)*40;
5096
if (!el)
5097
{
5098
var rect=Game.bounds;
5099
var x=Math.floor((rect.left+rect.right)/2);
5100
var y=Math.floor((rect.bottom))-(Game.mobile*64);
5101
x+=(Math.random()-0.5)*40;
5102
y+=0;//(Math.random()-0.5)*40;
5103
}
5104
}
5105
if (!noStack) y-=Game.textParticlesY;
5106
5107
x=Math.max(Game.bounds.left+200,x);
5108
x=Math.min(Game.bounds.right-200,x);
5109
y=Math.max(Game.bounds.top+32,y);
5110
5111
var me=Game.textParticles[i];
5112
if (!me.l) me.l=l('particle'+i);
5113
me.life=0;
5114
me.x=x;
5115
me.y=y;
5116
me.text=text;
5117
me.l.innerHTML=text;
5118
me.l.style.left=Math.floor(Game.textParticles[i].x-200)+'px';
5119
me.l.style.bottom=Math.floor(-Game.textParticles[i].y)+'px';
5120
for (var ii in Game.textParticles)
5121
{if (ii!=i) (Game.textParticles[ii].l||l('particle'+ii)).style.zIndex=100000000;}
5122
me.l.style.zIndex=100000001;
5123
me.l.style.display='block';
5124
me.l.className='particle title';
5125
void me.l.offsetWidth;
5126
me.l.className='particle title risingUpLinger';
5127
if (!noStack) Game.textParticlesY+=60;
5128
}
5129
Game.popups=1;
5130
Game.Popup=function(text,x,y)
5131
{
5132
if (Game.popups) Game.textParticlesAdd(text,0,x,y);
5133
}
5134
5135
//display sparkles at a set position
5136
Game.sparkles=l('sparkles');
5137
Game.sparklesT=0;
5138
Game.sparklesFrames=16;
5139
Game.SparkleAt=function(x,y)
5140
{
5141
if (Game.blendModesOn)
5142
{
5143
Game.sparklesT=Game.sparklesFrames+1;
5144
Game.sparkles.style.backgroundPosition='0px 0px';
5145
Game.sparkles.style.left=Math.floor(x-64)+'px';
5146
Game.sparkles.style.top=Math.floor(y-64)+'px';
5147
Game.sparkles.style.display='block';
5148
}
5149
}
5150
Game.SparkleOn=function(el)
5151
{
5152
var rect=el.getBoundingClientRect();
5153
Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2-24);
5154
}
5155
5156
/*=====================================================================================
5157
NOTIFICATIONS
5158
=======================================================================================*/
5159
//maybe do all this mess with proper DOM instead of rewriting the innerHTML
5160
Game.Notes=[];
5161
Game.NotesById=[];
5162
Game.noteId=0;
5163
Game.noteL=l('notes');
5164
Game.Note=function(title,desc,pic,quick)
5165
{
5166
this.title=title;
5167
this.desc=desc||'';
5168
this.pic=pic||'';
5169
this.id=Game.noteId;
5170
this.date=Date.now();
5171
this.quick=quick||0;
5172
this.life=(this.quick||1)*Game.fps;
5173
this.l=0;
5174
this.height=0;
5175
Game.noteId++;
5176
Game.NotesById[this.id]=this;
5177
Game.Notes.unshift(this);
5178
if (Game.Notes.length>50) Game.Notes.pop();
5179
//Game.Notes.push(this);
5180
//if (Game.Notes.length>50) Game.Notes.shift();
5181
Game.UpdateNotes();
5182
}
5183
Game.CloseNote=function(id)
5184
{
5185
var me=Game.NotesById[id];
5186
Game.Notes.splice(Game.Notes.indexOf(me),1);
5187
//Game.NotesById.splice(Game.NotesById.indexOf(me),1);
5188
Game.NotesById[id]=null;
5189
Game.UpdateNotes();
5190
}
5191
Game.CloseNotes=function()
5192
{
5193
Game.Notes=[];
5194
Game.NotesById=[];
5195
Game.UpdateNotes();
5196
}
5197
Game.UpdateNotes=function()
5198
{
5199
var str='';
5200
var remaining=Game.Notes.length;
5201
for (var i in Game.Notes)
5202
{
5203
if (i<5)
5204
{
5205
var me=Game.Notes[i];
5206
var pic='';
5207
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>';
5208
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;
5209
remaining--;
5210
}
5211
}
5212
if (remaining>0) str='<div class="remaining">+'+remaining+' more notification'+(remaining==1?'':'s')+'.</div>'+str;
5213
if (Game.Notes.length>1)
5214
{
5215
str+='<div class="framed close sidenote" onclick="PlaySound(\'snd/tick.mp3\');Game.CloseNotes();">x</div>';
5216
}
5217
Game.noteL.innerHTML=str;
5218
for (var i in Game.Notes)
5219
{
5220
me.l=0;
5221
if (i<5)
5222
{
5223
var me=Game.Notes[i];
5224
me.l=l('note-'+me.id);
5225
}
5226
}
5227
}
5228
Game.NotesLogic=function()
5229
{
5230
for (var i in Game.Notes)
5231
{
5232
if (Game.Notes[i].quick>0)
5233
{
5234
var me=Game.Notes[i];
5235
me.life--;
5236
if (me.life<=0) Game.CloseNote(me.id);
5237
}
5238
}
5239
}
5240
Game.NotesDraw=function()
5241
{
5242
for (var i in Game.Notes)
5243
{
5244
if (Game.Notes[i].quick>0)
5245
{
5246
var me=Game.Notes[i];
5247
if (me.l)
5248
{
5249
if (me.life<10)
5250
{
5251
me.l.style.opacity=(me.life/10);
5252
}
5253
}
5254
}
5255
}
5256
}
5257
Game.Notify=function(title,desc,pic,quick,noLog)
5258
{
5259
if (Game.prefs.notifs)
5260
{
5261
quick=Math.min(6,quick);
5262
if (!quick) quick=6;
5263
}
5264
desc=replaceAll('==CLOSETHIS()==','Game.CloseNote('+Game.noteId+');',desc);
5265
if (Game.popups) new Game.Note(title,desc,pic,quick);
5266
if (!noLog) Game.AddToLog('<b>'+title+'</b> | '+desc);
5267
}
5268
5269
5270
/*=====================================================================================
5271
PROMPT
5272
=======================================================================================*/
5273
Game.darkenL=l('darken');
5274
AddEvent(Game.darkenL,'click',function(){Game.Click=0;Game.ClosePrompt();});
5275
Game.promptL=l('promptContent');
5276
Game.promptAnchorL=l('promptAnchor');
5277
Game.promptWrapL=l('prompt');
5278
Game.promptConfirm='';
5279
Game.promptOn=0;
5280
Game.promptUpdateFunc=0;
5281
Game.UpdatePrompt=function()
5282
{
5283
if (Game.promptUpdateFunc) Game.promptUpdateFunc();
5284
Game.promptAnchorL.style.top=Math.floor((Game.windowH-Game.promptWrapL.offsetHeight)/2-16)+'px';
5285
}
5286
Game.Prompt=function(content,options,updateFunc,style)
5287
{
5288
if (updateFunc) Game.promptUpdateFunc=updateFunc;
5289
if (style) Game.promptWrapL.className='framed '+style; else Game.promptWrapL.className='framed';
5290
var str='';
5291
str+=content;
5292
var opts='';
5293
for (var i in options)
5294
{
5295
if (options[i]=='br')//just a linebreak
5296
{opts+='<br>';}
5297
else
5298
{
5299
if (typeof options[i]=='string') options[i]=[options[i],'Game.ClosePrompt();'];
5300
options[i][1]=options[i][1].replace(/'/g,'&#39;').replace(/"/g,'&#34;');
5301
opts+='<a id="promptOption'+i+'" class="option" '+Game.clickStr+'="PlaySound(\'snd/tick.mp3\');'+options[i][1]+'">'+options[i][0]+'</a>';
5302
}
5303
}
5304
Game.promptL.innerHTML=str+'<div class="optionBox">'+opts+'</div>';
5305
Game.promptAnchorL.style.display='block';
5306
Game.darkenL.style.display='block';
5307
Game.promptL.focus();
5308
Game.promptOn=1;
5309
Game.UpdatePrompt();
5310
}
5311
Game.ClosePrompt=function()
5312
{
5313
Game.promptAnchorL.style.display='none';
5314
Game.darkenL.style.display='none';
5315
Game.promptOn=0;
5316
Game.promptUpdateFunc=0;
5317
}
5318
Game.ConfirmPrompt=function()
5319
{
5320
if (Game.promptOn && l('promptOption0') && l('promptOption0').style.display!='none') FireEvent(l('promptOption0'),'click');
5321
}
5322
5323
/*=====================================================================================
5324
MENUS
5325
=======================================================================================*/
5326
Game.cssClasses=[];
5327
Game.addClass=function(what) {if (Game.cssClasses.indexOf(what)==-1) Game.cssClasses.push(what);Game.updateClasses();}
5328
Game.removeClass=function(what) {var i=Game.cssClasses.indexOf(what);if(i!=-1) {Game.cssClasses.splice(i,1);}Game.updateClasses();}
5329
Game.updateClasses=function() {Game.l.className=Game.cssClasses.join(' ');}
5330
5331
Game.WriteButton=function(prefName,button,on,off,callback,invert)
5332
{
5333
var invert=invert?1:0;
5334
if (!callback) callback='';
5335
callback+='PlaySound(\'snd/tick.mp3\');';
5336
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>';
5337
}
5338
Game.Toggle=function(prefName,button,on,off,invert)
5339
{
5340
if (Game.prefs[prefName])
5341
{
5342
l(button).innerHTML=off;
5343
Game.prefs[prefName]=0;
5344
}
5345
else
5346
{
5347
l(button).innerHTML=on;
5348
Game.prefs[prefName]=1;
5349
}
5350
l(button).className='option'+((Game.prefs[prefName]^invert)?'':' off');
5351
5352
}
5353
Game.ToggleFancy=function()
5354
{
5355
if (Game.prefs.fancy) Game.removeClass('noFancy');
5356
else if (!Game.prefs.fancy) Game.addClass('noFancy');
5357
}
5358
Game.ToggleFilters=function()
5359
{
5360
if (Game.prefs.filters) Game.removeClass('noFilters');
5361
else if (!Game.prefs.filters) Game.addClass('noFilters');
5362
}
5363
Game.ToggleExtraButtons=function()
5364
{
5365
if (!Game.prefs.extraButtons) Game.removeClass('extraButtons');
5366
else if (Game.prefs.extraButtons) Game.addClass('extraButtons');
5367
for (var i in Game.Objects)
5368
{
5369
Game.Objects[i].mute(0);
5370
}
5371
}
5372
5373
Game.WriteSlider=function(slider,leftText,rightText,startValueFunction,callback)
5374
{
5375
if (!callback) callback='';
5376
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>';
5377
}
5378
5379
Game.onPanel='Left';
5380
Game.addClass('focus'+Game.onPanel);
5381
Game.ShowPanel=function(what)
5382
{
5383
if (!what) what='';
5384
if (Game.onPanel!=what)
5385
{
5386
Game.removeClass('focus'+Game.onPanel);
5387
Game.addClass('focus'+what);
5388
}
5389
Game.onPanel=what;
5390
}
5391
5392
Game.onMenu='';
5393
Game.ShowMenu=function(what)
5394
{
5395
if (!what || what=='') what=Game.onMenu;
5396
if (Game.onMenu=='' && what!='') Game.addClass('onMenu');
5397
else if (Game.onMenu!='' && what!=Game.onMenu) Game.addClass('onMenu');
5398
else if (what==Game.onMenu) {Game.removeClass('onMenu');what='';}
5399
//if (what=='log') l('donateBox').className='on'; else l('donateBox').className='';
5400
Game.onMenu=what;
5401
5402
l('prefsButton').className=(Game.onMenu=='prefs')?'button selected':'button';
5403
l('statsButton').className=(Game.onMenu=='stats')?'button selected':'button';
5404
l('logButton').className=(Game.onMenu=='log')?'button selected':'button';
5405
5406
if (Game.onMenu=='') PlaySound('snd/clickOff.mp3');
5407
else PlaySound('snd/clickOn.mp3');
5408
5409
Game.UpdateMenu();
5410
5411
if (what=='')
5412
{
5413
for (var i in Game.Objects)
5414
{
5415
var me=Game.Objects[i];
5416
if (me.minigame && me.minigame.onResize) me.minigame.onResize();
5417
}
5418
}
5419
}
5420
Game.sayTime=function(time,detail)
5421
{
5422
//time is a value where one second is equal to Game.fps (30).
5423
//detail skips days when >1, hours when >2, minutes when >3 and seconds when >4.
5424
//if detail is -1, output something like "3 hours, 9 minutes, 48 seconds"
5425
if (time<=0) return '';
5426
var str='';
5427
var detail=detail||0;
5428
time=Math.floor(time);
5429
if (detail==-1)
5430
{
5431
//var months=0;
5432
var days=0;
5433
var hours=0;
5434
var minutes=0;
5435
var seconds=0;
5436
//if (time>=Game.fps*60*60*24*30) months=(Math.floor(time/(Game.fps*60*60*24*30)));
5437
if (time>=Game.fps*60*60*24) days=(Math.floor(time/(Game.fps*60*60*24)));
5438
if (time>=Game.fps*60*60) hours=(Math.floor(time/(Game.fps*60*60)));
5439
if (time>=Game.fps*60) minutes=(Math.floor(time/(Game.fps*60)));
5440
if (time>=Game.fps) seconds=(Math.floor(time/(Game.fps)));
5441
//days-=months*30;
5442
hours-=days*24;
5443
minutes-=hours*60+days*24*60;
5444
seconds-=minutes*60+hours*60*60+days*24*60*60;
5445
if (days>10) {hours=0;}
5446
if (days) {minutes=0;seconds=0;}
5447
if (hours) {seconds=0;}
5448
var bits=[];
5449
//if (months>0) bits.push(Beautify(months)+' month'+(days==1?'':'s'));
5450
if (days>0) bits.push(Beautify(days)+' day'+(days==1?'':'s'));
5451
if (hours>0) bits.push(Beautify(hours)+' hour'+(hours==1?'':'s'));
5452
if (minutes>0) bits.push(Beautify(minutes)+' minute'+(minutes==1?'':'s'));
5453
if (seconds>0) bits.push(Beautify(seconds)+' second'+(seconds==1?'':'s'));
5454
if (bits.length==0) str='less than 1 second';
5455
else str=bits.join(', ');
5456
}
5457
else
5458
{
5459
/*if (time>=Game.fps*60*60*24*30*2 && detail<1) str=Beautify(Math.floor(time/(Game.fps*60*60*24*30)))+' months';
5460
else if (time>=Game.fps*60*60*24*30 && detail<1) str='1 month';
5461
else */if (time>=Game.fps*60*60*24*2 && detail<2) str=Beautify(Math.floor(time/(Game.fps*60*60*24)))+' days';
5462
else if (time>=Game.fps*60*60*24 && detail<2) str='1 day';
5463
else if (time>=Game.fps*60*60*2 && detail<3) str=Beautify(Math.floor(time/(Game.fps*60*60)))+' hours';
5464
else if (time>=Game.fps*60*60 && detail<3) str='1 hour';
5465
else if (time>=Game.fps*60*2 && detail<4) str=Beautify(Math.floor(time/(Game.fps*60)))+' minutes';
5466
else if (time>=Game.fps*60 && detail<4) str='1 minute';
5467
else if (time>=Game.fps*2 && detail<5) str=Beautify(Math.floor(time/(Game.fps)))+' seconds';
5468
else if (time>=Game.fps && detail<5) str='1 second';
5469
else str='less than 1 second';
5470
}
5471
return str;
5472
}
5473
5474
Game.tinyCookie=function()
5475
{
5476
if (!Game.HasAchiev('Tiny cookie'))
5477
{
5478
return '<div class="tinyCookie" '+Game.clickStr+'="Game.ClickTinyCookie();"></div>';
5479
}
5480
return '';
5481
}
5482
Game.ClickTinyCookie=function(){if (!Game.HasAchiev('Tiny cookie')){PlaySound('snd/tick.mp3');Game.Win('Tiny cookie');}}
5483
5484
Game.setVolume=function(what)
5485
{
5486
Game.volume=what;
5487
/*for (var i in Sounds)
5488
{
5489
Sounds[i].volume=Game.volume;
5490
}*/
5491
}
5492
5493
Game.UpdateMenu=function()
5494
{
5495
var str='';
5496
if (Game.onMenu!='')
5497
{
5498
str+='<div class="close menuClose" '+Game.clickStr+'="Game.ShowMenu();">x</div>';
5499
//str+='<div style="position:absolute;top:8px;right:8px;cursor:pointer;font-size:16px;" '+Game.clickStr+'="Game.ShowMenu();">X</div>';
5500
}
5501
if (Game.onMenu=='prefs')
5502
{
5503
str+='<div class="section">Options</div>'+
5504
'<div class="subsection">'+
5505
'<div class="title">General</div>'+
5506
'<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>'+
5507
'<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>'+
5508
'<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>'+
5509
5510
'<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>'+
5511
'<div class="title">Settings</div>'+
5512
'<div class="listing">'+
5513
Game.WriteSlider('volumeSlider','Volume','[$]%',function(){return Game.volume;},'Game.setVolume(Math.round(l(\'volumeSlider\').value));l(\'volumeSliderRightText\').innerHTML=Game.volume+\'%\';')+'<br>'+
5514
Game.WriteButton('fancy','fancyButton','Fancy graphics ON','Fancy graphics OFF','Game.ToggleFancy();')+'<label>(visual improvements; disabling may improve performance)</label><br>'+
5515
Game.WriteButton('filters','filtersButton','CSS filters ON','CSS filters OFF','Game.ToggleFilters();')+'<label>(cutting-edge visual improvements; disabling may improve performance)</label><br>'+
5516
Game.WriteButton('particles','particlesButton','Particles ON','Particles OFF')+'<label>(cookies falling down, etc; disabling may improve performance)</label><br>'+
5517
Game.WriteButton('numbers','numbersButton','Numbers ON','Numbers OFF')+'<label>(numbers that pop up when clicking the cookie)</label><br>'+
5518
Game.WriteButton('milk','milkButton','Milk ON','Milk OFF')+'<label>(only appears with enough achievements)</label><br>'+
5519
Game.WriteButton('cursors','cursorsButton','Cursors ON','Cursors OFF')+'<label>(visual display of your cursors)</label><br>'+
5520
Game.WriteButton('wobbly','wobblyButton','Wobbly cookie ON','Wobbly cookie OFF')+'<label>(your cookie will react when you click it)</label><br>'+
5521
Game.WriteButton('cookiesound','cookiesoundButton','Alt cookie sound ON','Alt cookie sound OFF')+'<label>(how your cookie sounds when you click on it)</label><br>'+
5522
Game.WriteButton('crates','cratesButton','Icon crates ON','Icon crates OFF')+'<label>(display boxes around upgrades and achievements in stats)</label><br>'+
5523
Game.WriteButton('monospace','monospaceButton','Alt font ON','Alt font OFF')+'<label>(your cookies are displayed using a monospace font)</label><br>'+
5524
Game.WriteButton('format','formatButton','Short numbers OFF','Short numbers ON','BeautifyAll();Game.RefreshStore();Game.upgradesToRebuild=1;',1)+'<label>(shorten big numbers)</label><br>'+
5525
Game.WriteButton('notifs','notifsButton','Fast notes ON','Fast notes OFF')+'<label>(notifications disappear much faster)</label><br>'+
5526
//Game.WriteButton('autoupdate','autoupdateButton','Offline mode OFF','Offline mode ON',0,1)+'<label>(disables update notifications)</label><br>'+
5527
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>'+
5528
Game.WriteButton('focus','focusButton','Defocus OFF','Defocus ON',0,1)+'<label>(the game will be less resource-intensive when out of focus)</label><br>'+
5529
Game.WriteButton('extraButtons','extraButtonsButton','Extra buttons ON','Extra buttons OFF','Game.ToggleExtraButtons();')+'<label>(add Mute buttons on buildings)</label><br>'+
5530
Game.WriteButton('askLumps','askLumpsButton','Lump confirmation ON','Lump confirmation OFF')+'<label>(the game will ask you to confirm before spending sugar lumps)</label><br>'+
5531
Game.WriteButton('customGrandmas','customGrandmasButton','Custom grandmas ON','Custom grandmas OFF')+'<label>(some grandmas will be named after Patreon supporters)</label><br>'+
5532
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>'+
5533
'</div>'+
5534
//'<div class="listing">'+Game.WriteButton('autosave','autosaveButton','Autosave ON','Autosave OFF')+'</div>'+
5535
'<div style="padding-bottom:128px;"></div>'+
5536
'</div>'
5537
;
5538
}
5539
else if (Game.onMenu=='main')
5540
{
5541
str+=
5542
'<div class="listing">This isn\'t really finished</div>'+
5543
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'prefs\');">Menu</a></div>'+
5544
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'stats\');">Stats</a></div>'+
5545
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(\'log\');">Updates</a></div>'+
5546
'<div class="listing"><a class="option big title" '+Game.clickStr+'="">Quit</a></div>'+
5547
'<div class="listing"><a class="option big title" '+Game.clickStr+'="Game.ShowMenu(Game.onMenu);">Resume</a></div>';
5548
}
5549
else if (Game.onMenu=='log')
5550
{
5551
str+=replaceAll('[bakeryName]',Game.bakeryName,Game.updateLog);
5552
}
5553
else if (Game.onMenu=='stats')
5554
{
5555
var buildingsOwned=0;
5556
buildingsOwned=Game.BuildingsOwned;
5557
var upgrades='';
5558
var cookieUpgrades='';
5559
var hiddenUpgrades='';
5560
var prestigeUpgrades='';
5561
var upgradesTotal=0;
5562
var upgradesOwned=0;
5563
var prestigeUpgradesTotal=0;
5564
var prestigeUpgradesOwned=0;
5565
5566
var list=[];
5567
for (var i in Game.Upgrades)//sort the upgrades
5568
{
5569
list.push(Game.Upgrades[i]);
5570
}
5571
var sortMap=function(a,b)
5572
{
5573
if (a.order>b.order) return 1;
5574
else if (a.order<b.order) return -1;
5575
else return 0;
5576
}
5577
list.sort(sortMap);
5578
for (var i in list)
5579
{
5580
var str2='';
5581
var me=list[i];
5582
5583
str2+=Game.crate(me,'stats');
5584
5585
if (me.bought)
5586
{
5587
if (Game.CountsAsUpgradeOwned(me.pool)) upgradesOwned++;
5588
else if (me.pool=='prestige') prestigeUpgradesOwned++;
5589
}
5590
5591
if (me.pool=='' || me.pool=='cookie' || me.pool=='tech') upgradesTotal++;
5592
if (me.pool=='debug') hiddenUpgrades+=str2;
5593
else if (me.pool=='prestige') {prestigeUpgrades+=str2;prestigeUpgradesTotal++;}
5594
else if (me.pool=='cookie') cookieUpgrades+=str2;
5595
else if (me.pool!='toggle' && me.pool!='unused') upgrades+=str2;
5596
}
5597
var achievements=[];
5598
var achievementsOwned=0;
5599
var achievementsOwnedOther=0;
5600
var achievementsTotal=0;
5601
5602
var list=[];
5603
for (var i in Game.Achievements)//sort the achievements
5604
{
5605
list.push(Game.Achievements[i]);
5606
}
5607
var sortMap=function(a,b)
5608
{
5609
if (a.order>b.order) return 1;
5610
else if (a.order<b.order) return -1;
5611
else return 0;
5612
}
5613
list.sort(sortMap);
5614
5615
5616
for (var i in list)
5617
{
5618
var me=list[i];
5619
//if (me.pool=='normal' || me.won>0) achievementsTotal++;
5620
if (Game.CountsAsAchievementOwned(me.pool)) achievementsTotal++;
5621
var pool=me.pool;
5622
if (!achievements[pool]) achievements[pool]='';
5623
achievements[pool]+=Game.crate(me,'stats');
5624
5625
if (me.won)
5626
{
5627
if (Game.CountsAsAchievementOwned(me.pool)) achievementsOwned++;
5628
else achievementsOwnedOther++;
5629
}
5630
}
5631
5632
var achievementsStr='';
5633
var pools={
5634
'dungeon':'<b>Dungeon achievements</b> <small>(Not technically achievable yet.)</small>',
5635
'shadow':'<b>Shadow achievements</b> <small>(These are feats that are either unfair or difficult to attain. They do not give milk.)</small>'
5636
};
5637
for (var i in achievements)
5638
{
5639
if (achievements[i]!='')
5640
{
5641
if (pools[i]) achievementsStr+='<div class="listing">'+pools[i]+'</div>';
5642
achievementsStr+='<div class="listing crateBox">'+achievements[i]+'</div>';
5643
}
5644
}
5645
5646
var milkStr='';
5647
for (var i=0;i<Game.Milks.length;i++)
5648
{
5649
if (Game.milkProgress>=i)
5650
{
5651
var milk=Game.Milks[i];
5652
milkStr+='<div '+Game.getTooltip(
5653
'<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>'
5654
,'top')+' style="background:url(img/icons.png) '+(-milk.icon[0]*48)+'px '+(-milk.icon[1]*48)+'px;margin:2px 0px;" class="trophy"></div>';
5655
}
5656
}
5657
milkStr+='<div style="clear:both;"></div>';
5658
5659
var santaStr='';
5660
var frames=15;
5661
if (Game.Has('A festive hat'))
5662
{
5663
for (var i=0;i<=Game.santaLevel;i++)
5664
{
5665
santaStr+='<div '+Game.getTooltip(
5666
'<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>'
5667
,'top')+' style="background:url(img/santa.png) '+(-i*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';
5668
}
5669
santaStr+='<div style="clear:both;"></div>';
5670
}
5671
var dragonStr='';
5672
var frames=9;
5673
var mainLevels=[0,4,8,22,23,24];
5674
if (Game.Has('A crumbly egg'))
5675
{
5676
for (var i=0;i<=mainLevels.length;i++)
5677
{
5678
if (Game.dragonLevel>=mainLevels[i])
5679
{
5680
var level=Game.dragonLevels[mainLevels[i]];
5681
dragonStr+='<div '+Game.getTooltip(
5682
//'<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>'
5683
'<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>'
5684
,'top')+' style="background:url(img/dragon.png?v='+Game.version+') '+(-level.pic*48)+'px 0px;background-size:'+(frames*48)+'px 48px;" class="trophy"></div>';
5685
}
5686
}
5687
dragonStr+='<div style="clear:both;"></div>';
5688
}
5689
var ascensionModeStr='';
5690
var icon=Game.ascensionModes[Game.ascensionMode].icon;
5691
if (Game.resets>0) ascensionModeStr='<span style="cursor:pointer;" '+Game.getTooltip(
5692
'<div style="min-width:200px;text-align:center;font-size:11px;">'+Game.ascensionModes[Game.ascensionMode].desc+'</div>'
5693
,'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>';
5694
5695
var milkName=Game.Milk.name;
5696
5697
var researchStr=Game.sayTime(Game.researchT,-1);
5698
var pledgeStr=Game.sayTime(Game.pledgeT,-1);
5699
var wrathStr='';
5700
if (Game.elderWrath==1) wrathStr='awoken';
5701
else if (Game.elderWrath==2) wrathStr='displeased';
5702
else if (Game.elderWrath==3) wrathStr='angered';
5703
else if (Game.elderWrath==0 && Game.pledges>0) wrathStr='appeased';
5704
5705
var date=new Date();
5706
date.setTime(Date.now()-Game.startDate);
5707
var timeInSeconds=date.getTime()/1000;
5708
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
5709
date.setTime(Date.now()-Game.fullDate);
5710
var fullDate=Game.sayTime(date.getTime()/1000*Game.fps,-1);
5711
if (!Game.fullDate || !fullDate || fullDate.length<1) fullDate='a long while';
5712
/*date.setTime(new Date().getTime()-Game.lastDate);
5713
var lastDate=Game.sayTime(date.getTime()/1000*Game.fps,2);*/
5714
5715
var heavenlyMult=Game.GetHeavenlyMultiplier();
5716
5717
var seasonStr=Game.sayTime(Game.seasonT,-1);
5718
5719
str+='<div class="section">Statistics</div>'+
5720
'<div class="subsection">'+
5721
'<div class="title">General</div>'+
5722
'<div class="listing"><b>Cookies in bank :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookies)+'</div></div>'+
5723
'<div class="listing"><b>Cookies baked (this ascension) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned)+'</div></div>'+
5724
'<div class="listing"><b>Cookies baked (all time) :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesEarned+Game.cookiesReset)+'</div></div>'+
5725
(Game.cookiesReset>0?'<div class="listing"><b>Cookies forfeited by ascending :</b> <div class="price plain">'+Game.tinyCookie()+Beautify(Game.cookiesReset)+'</div></div>':'')+
5726
(Game.resets?('<div class="listing"><b>Legacy started :</b> '+(fullDate==''?'just now':(fullDate+' ago'))+', with '+Beautify(Game.resets)+' ascension'+(Game.resets==1?'':'s')+'</div>'):'')+
5727
'<div class="listing"><b>Run started :</b> '+(startDate==''?'just now':(startDate+' ago'))+'</div>'+
5728
'<div class="listing"><b>Buildings owned :</b> '+Beautify(buildingsOwned)+'</div>'+
5729
'<div class="listing"><b>Cookies per second :</b> '+Beautify(Game.cookiesPs,1)+' <small>'+
5730
'(multiplier : '+Beautify(Math.round(Game.globalCpsMult*100),1)+'%)'+
5731
(Game.cpsSucked>0?' <span class="warning">(withered : '+Beautify(Math.round(Game.cpsSucked*100),1)+'%)</span>':'')+
5732
'</small></div>'+
5733
'<div class="listing"><b>Cookies per click :</b> '+Beautify(Game.computedMouseCps,1)+'</div>'+
5734
'<div class="listing"><b>Cookie clicks :</b> '+Beautify(Game.cookieClicks)+'</div>'+
5735
'<div class="listing"><b>Hand-made cookies :</b> '+Beautify(Game.handmadeCookies)+'</div>'+
5736
'<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>'+
5737
'<br><div class="listing"><b>Running version :</b> '+Game.version+'</div>'+
5738
5739
((researchStr!='' || wrathStr!='' || pledgeStr!='' || santaStr!='' || dragonStr!='' || Game.season!='' || ascensionModeStr!='' || Game.canLumps())?(
5740
'</div><div class="subsection">'+
5741
'<div class="title">Special</div>'+
5742
(ascensionModeStr!=''?'<div class="listing"><b>Challenge mode :</b>'+ascensionModeStr+'</div>':'')+
5743
(Game.season!=''?'<div class="listing"><b>Seasonal event :</b> '+Game.seasons[Game.season].name+
5744
(seasonStr!=''?' <small>('+seasonStr+' remaining)</small>':'')+
5745
'</div>':'')+
5746
(Game.season=='fools'?
5747
'<div class="listing"><b>Money made from selling cookies :</b> $'+Beautify(Game.cookiesEarned*0.08,2)+'</div>'+
5748
(Game.Objects['Portal'].amount>0?'<div class="listing"><b>TV show seasons produced :</b> '+Beautify(Math.floor((timeInSeconds/60/60)*(Game.Objects['Portal'].amount*0.13)+1))+'</div>':'')
5749
:'')+
5750
(researchStr!=''?'<div class="listing"><b>Research :</b> '+researchStr+' remaining</div>':'')+
5751
(wrathStr!=''?'<div class="listing"><b>Grandmatriarchs status :</b> '+wrathStr+'</div>':'')+
5752
(pledgeStr!=''?'<div class="listing"><b>Pledge :</b> '+pledgeStr+' remaining</div>':'')+
5753
(Game.wrinklersPopped>0?'<div class="listing"><b>Wrinklers popped :</b> '+Beautify(Game.wrinklersPopped)+'</div>':'')+
5754
((Game.canLumps() && Game.lumpsTotal>-1)?'<div class="listing"><b>Sugar lumps harvested :</b> <div class="price lump plain">'+Beautify(Game.lumpsTotal)+'</div></div>':'')+
5755
//(Game.cookiesSucked>0?'<div class="listing warning"><b>Withered :</b> '+Beautify(Game.cookiesSucked)+' cookies</div>':'')+
5756
(Game.reindeerClicked>0?'<div class="listing"><b>Reindeer found :</b> '+Beautify(Game.reindeerClicked)+'</div>':'')+
5757
(santaStr!=''?'<div class="listing"><b>Santa stages unlocked :</b></div><div>'+santaStr+'</div>':'')+
5758
(dragonStr!=''?'<div class="listing"><b>Dragon training :</b></div><div>'+dragonStr+'</div>':'')+
5759
''
5760
):'')+
5761
((Game.prestige>0 || prestigeUpgrades!='')?(
5762
'</div><div class="subsection">'+
5763
'<div class="title">Prestige</div>'+
5764
'<div class="listing"><div class="icon" style="float:left;background-position:'+(-19*48)+'px '+(-7*48)+'px;"></div>'+
5765
'<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>'+
5766
'</div>'+
5767
(prestigeUpgrades!=''?(
5768
'<div class="listing" style="clear:left;"><b>Prestige upgrades unlocked :</b> '+prestigeUpgradesOwned+'/'+prestigeUpgradesTotal+' ('+Math.floor((prestigeUpgradesOwned/prestigeUpgradesTotal)*100)+'%)</div>'+
5769
'<div class="listing crateBox">'+prestigeUpgrades+'</div>'):'')+
5770
''):'')+
5771
5772
'</div><div class="subsection">'+
5773
'<div class="title">Upgrades</div>'+
5774
(hiddenUpgrades!=''?('<div class="listing"><b>Debug</b></div>'+
5775
'<div class="listing crateBox">'+hiddenUpgrades+'</div>'):'')+
5776
'<div class="listing"><b>Upgrades unlocked :</b> '+upgradesOwned+'/'+upgradesTotal+' ('+Math.floor((upgradesOwned/upgradesTotal)*100)+'%)</div>'+
5777
'<div class="listing crateBox">'+upgrades+'</div>'+
5778
(cookieUpgrades!=''?('<div class="listing"><b>Cookies</b></div>'+
5779
'<div class="listing crateBox">'+cookieUpgrades+'</div>'):'')+
5780
'</div><div class="subsection">'+
5781
'<div class="title">Achievements</div>'+
5782
'<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>'+
5783
(Game.cookiesMultByType['kittens']>1?('<div class="listing"><b>Kitten multiplier :</b> '+Beautify((Game.cookiesMultByType['kittens'])*100)+'%</div>'):'')+
5784
'<div class="listing"><b>Milk :</b> '+milkName+'</div>'+
5785
(milkStr!=''?'<div class="listing"><b>Milk flavors unlocked :</b></div><div>'+milkStr+'</div>':'')+
5786
'<div class="listing"><small style="opacity:0.75;">(Milk is gained with each achievement. It can unlock unique upgrades over time.)</small></div>'+
5787
achievementsStr+
5788
'</div>'+
5789
'<div style="padding-bottom:128px;"></div>'
5790
;
5791
}
5792
//str='<div id="selectionKeeper" class="selectable">'+str+'</div>';
5793
l('menu').innerHTML=str;
5794
/*AddEvent(l('selectionKeeper'),'mouseup',function(e){
5795
console.log('selection:',window.getSelection());
5796
});*/
5797
}
5798
5799
AddEvent(l('prefsButton'),'click',function(){Game.ShowMenu('prefs');});
5800
AddEvent(l('statsButton'),'click',function(){Game.ShowMenu('stats');});
5801
AddEvent(l('logButton'),'click',function(){Game.ShowMenu('log');});
5802
AddEvent(l('legacyButton'),'click',function(){PlaySound('snd/tick.mp3');Game.Ascend();});
5803
Game.ascendMeter=l('ascendMeter');
5804
Game.ascendNumber=l('ascendNumber');
5805
5806
Game.lastPanel='';
5807
if (Game.touchEvents)
5808
{
5809
AddEvent(l('focusLeft'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Left');});
5810
AddEvent(l('focusMiddle'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});
5811
AddEvent(l('focusRight'),'touchend',function(){Game.ShowMenu('');Game.ShowPanel('Right');});
5812
AddEvent(l('focusMenu'),'touchend',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});
5813
}
5814
else
5815
{
5816
AddEvent(l('focusLeft'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Left');});
5817
AddEvent(l('focusMiddle'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Middle');});
5818
AddEvent(l('focusRight'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Right');});
5819
AddEvent(l('focusMenu'),'click',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');});
5820
}
5821
//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');}});
5822
5823
/*=====================================================================================
5824
NEWS TICKER
5825
=======================================================================================*/
5826
Game.Ticker='';
5827
Game.TickerAge=0;
5828
Game.TickerEffect=0;
5829
Game.TickerN=0;
5830
Game.TickerClicks=0;
5831
Game.UpdateTicker=function()
5832
{
5833
Game.TickerAge--;
5834
if (Game.TickerAge<=0) Game.getNewTicker();
5835
else if (Game.Ticker=='') Game.getNewTicker(true);
5836
}
5837
Game.getNewTicker=function(manual)//note : "manual" is true if the ticker was clicked, but may also be true on startup etc
5838
{
5839
var list=[];
5840
5841
if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)
5842
{
5843
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'];
5844
5845
if (Math.random()<0.75 || Game.cookiesEarned<10000)
5846
{
5847
if (Game.Objects['Grandma'].amount>0) list.push(choose([
5848
'<q>Moist cookies.</q><sig>grandma</sig>',
5849
'<q>We\'re nice grandmas.</q><sig>grandma</sig>',
5850
'<q>Indentured servitude.</q><sig>grandma</sig>',
5851
'<q>Come give grandma a kiss.</q><sig>grandma</sig>',
5852
'<q>Why don\'t you visit more often?</q><sig>grandma</sig>',
5853
'<q>Call me...</q><sig>grandma</sig>'
5854
]));
5855
5856
if (Game.Objects['Grandma'].amount>=50) list.push(choose([
5857
'<q>Absolutely disgusting.</q><sig>grandma</sig>',
5858
'<q>You make me sick.</q><sig>grandma</sig>',
5859
'<q>You disgust me.</q><sig>grandma</sig>',
5860
'<q>We rise.</q><sig>grandma</sig>',
5861
'<q>It begins.</q><sig>grandma</sig>',
5862
'<q>It\'ll all be over soon.</q><sig>grandma</sig>',
5863
'<q>You could have stopped it.</q><sig>grandma</sig>'
5864
]));
5865
5866
if (Game.HasAchiev('Just wrong') && Math.random()<0.4) list.push(choose([
5867
'News : cookie manufacturer downsizes, sells own grandmother!',
5868
'<q>It has betrayed us, the filthy little thing.</q><sig>grandma</sig>',
5869
'<q>It tried to get rid of us, the nasty little thing.</q><sig>grandma</sig>',
5870
'<q>It thought we would go away by selling us. How quaint.</q><sig>grandma</sig>',
5871
'<q>I can smell your rotten cookies.</q><sig>grandma</sig>'
5872
]));
5873
5874
if (Game.Objects['Grandma'].amount>=1 && Game.pledges>0 && Game.elderWrath==0) list.push(choose([
5875
'<q>shrivel</q><sig>grandma</sig>',
5876
'<q>writhe</q><sig>grandma</sig>',
5877
'<q>throb</q><sig>grandma</sig>',
5878
'<q>gnaw</q><sig>grandma</sig>',
5879
'<q>We will rise again.</q><sig>grandma</sig>',
5880
'<q>A mere setback.</q><sig>grandma</sig>',
5881
'<q>We are not satiated.</q><sig>grandma</sig>',
5882
'<q>Too late.</q><sig>grandma</sig>'
5883
]));
5884
5885
if (Game.Objects['Farm'].amount>0) list.push(choose([
5886
'News : cookie farms suspected of employing undeclared elderly workforce!',
5887
'News : cookie farms release harmful chocolate in our rivers, says scientist!',
5888
'News : genetically-modified chocolate controversy strikes cookie farmers!',
5889
'News : free-range farm cookies popular with today\'s hip youth, says specialist.',
5890
'News : farm cookies deemed unfit for vegans, says nutritionist.'
5891
]));
5892
5893
if (Game.Objects['Mine'].amount>0) list.push(choose([
5894
'News : is our planet getting lighter? Experts examine the effects of intensive chocolate mining.',
5895
'News : '+Math.floor(Math.random()*1000+2)+' miners trapped in collapsed chocolate mine!',
5896
'News : chocolate mines found to cause earthquakes and sinkholes!',
5897
'News : chocolate mine goes awry, floods village in chocolate!',
5898
'News : depths of chocolate mines found to house "peculiar, chocolaty beings"!'
5899
]));
5900
5901
if (Game.Objects['Factory'].amount>0) list.push(choose([
5902
'News : cookie factories linked to global warming!',
5903
'News : cookie factories involved in chocolate weather controversy!',
5904
'News : cookie factories on strike, robotic minions employed to replace workforce!',
5905
'News : cookie factories on strike - workers demand to stop being paid in cookies!',
5906
'News : factory-made cookies linked to obesity, says study.'
5907
]));
5908
5909
if (Game.Objects['Bank'].amount>0) list.push(choose([
5910
'News : cookie loans on the rise as people can no longer afford them with regular money.',
5911
'News : cookies slowly creeping up their way as a competitor to traditional currency!',
5912
'News : most bakeries now fitted with ATMs to allow for easy cookie withdrawals and deposits.',
5913
'News : cookie economy now strong enough to allow for massive vaults doubling as swimming pools!',
5914
'News : "Tomorrow\'s wealthiest people will be calculated by their worth in cookies", predict specialists.'
5915
]));
5916
5917
if (Game.Objects['Temple'].amount>0) list.push(choose([
5918
'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'])+'!',
5919
'News : recently-discovered chocolate temples now sparking new cookie-related cult; thousands pray to Baker in the sky!',
5920
'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'])])+'.',
5921
'News : theists of the world discover new cookie religion - "Oh boy, guess we were wrong all along!"',
5922
'News : cookie heaven allegedly "sports elevator instead of stairway"; cookie hell "paved with flagstone, as good intentions make for poor building material".'
5923
]));
5924
5925
if (Game.Objects['Wizard tower'].amount>0) list.push(choose([
5926
'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!',
5927
'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!',
5928
'News : get your new charms and curses at the yearly National Spellcrafting Fair! Exclusive prices on runes and spellbooks.',
5929
'News : cookie wizards deny involvement in shockingly ugly newborn - infant is "honestly grody-looking, but natural", say doctors.',
5930
'News : "Any sufficiently crude magic is indistinguishable from technology", claims renowned technowizard.'
5931
]));
5932
5933
if (Game.Objects['Shipment'].amount>0) list.push(choose([
5934
'News : new chocolate planet found, becomes target of cookie-trading spaceships!',
5935
'News : massive chocolate planet found with 99.8% certified pure dark chocolate core!',
5936
'News : space tourism booming as distant planets attract more bored millionaires!',
5937
'News : chocolate-based organisms found on distant planet!',
5938
'News : ancient baking artifacts found on distant planet; "terrifying implications", experts say.'
5939
]));
5940
5941
if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([
5942
'News : national gold reserves dwindle as more and more of the precious mineral is turned to cookies!',
5943
'News : chocolate jewelry found fashionable, gold and diamonds "just a fad", says specialist.',
5944
'News : silver found to also be transmutable into white chocolate!',
5945
'News : defective alchemy lab shut down, found to convert cookies to useless gold.',
5946
'News : alchemy-made cookies shunned by purists!'
5947
]));
5948
5949
if (Game.Objects['Portal'].amount>0) list.push(choose([
5950
'News : nation worried as more and more unsettling creatures emerge from dimensional portals!',
5951
'News : dimensional portals involved in city-engulfing disaster!',
5952
'News : tourism to cookieverse popular with bored teenagers! Casualty rate as high as 73%!',
5953
'News : cookieverse portals suspected to cause fast aging and obsession with baking, says study.',
5954
'News : "do not settle near portals," says specialist; "your children will become strange and corrupted inside."'
5955
]));
5956
5957
if (Game.Objects['Time machine'].amount>0) list.push(choose([
5958
'News : time machines involved in history-rewriting scandal! Or are they?',
5959
'News : time machines used in unlawful time tourism!',
5960
'News : cookies brought back from the past "unfit for human consumption", says historian.',
5961
'News : various historical figures inexplicably replaced with talking lumps of dough!',
5962
'News : "I have seen the future," says time machine operator, "and I do not wish to go there again."'
5963
]));
5964
5965
if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([
5966
'News : whole town seemingly swallowed by antimatter-induced black hole; more reliable sources affirm town "never really existed"!',
5967
'News : "explain to me again why we need particle accelerators to bake cookies?" asks misguided local woman.',
5968
'News : first antimatter condenser successfully turned on, doesn\'t rip apart reality!',
5969
'News : researchers conclude that what the cookie industry needs, first and foremost, is "more magnets".',
5970
'News : "unravelling the fabric of reality just makes these cookies so much tastier", claims scientist.'
5971
]));
5972
5973
if (Game.Objects['Prism'].amount>0) list.push(choose([
5974
'News : new cookie-producing prisms linked to outbreak of rainbow-related viral videos.',
5975
'News : scientists warn against systematically turning light into matter - "One day, we\'ll end up with all matter and no light!"',
5976
'News : cookies now being baked at the literal speed of light thanks to new prismatic contraptions.',
5977
'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.',
5978
'News : world citizens advised "not to worry" about frequent atmospheric flashes.',
5979
]));
5980
5981
if (Game.Objects['Chancemaker'].amount>0) list.push(choose([
5982
'News : strange statistical anomalies continue as weather forecast proves accurate an unprecedented 3 days in a row!',
5983
'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.',
5984
'News : neighboring nation somehow elects president with sensible policies in freak accident of random chance!',
5985
'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.',
5986
'News : all scratching tickets printed as winners, prompting national economy to crash and, against all odds, recover overnight.',
5987
]));
5988
5989
if (Game.Objects['Fractal engine'].amount>0) list.push(choose([
5990
'News : local man "done with Cookie Clicker", finds the constant self-references "grating and on-the-nose".',
5991
'News : local man sails around the world to find himself - right where he left it.',
5992
'News : local guru claims "there\'s a little bit of ourselves in everyone", under investigation for alleged cannibalism.',
5993
'News : news writer finds herself daydreaming about new career. Or at least a raise.',
5994
'News : polls find idea of cookies made of cookies "acceptable" - "at least we finally know what\'s in them", says interviewed citizen.',
5995
]));
5996
5997
if (Game.Objects['Javascript console'].amount>0) list.push(choose([
5998
'News : strange fad has parents giving their newborns names such as Emma.js or Liam.js. At least one Baby.js reported.',
5999
'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.',
6000
'News : developers unsure what to call their new javascript libraries as all combinations of any 3 dictionary words have already been taken.',
6001
'News : nation holds breath as nested ifs about to hatch.',
6002
'News : clueless copywriter forgets to escape a quote, ends news line prematurely; last words reported to be "Huh, why isn',
6003
]));
6004
6005
if (Game.season=='halloween' && Game.cookiesEarned>=1000) list.push(choose([
6006
'News : strange twisting creatures amass around cookie factories, nibble at assembly lines.',
6007
'News : ominous wrinkly monsters take massive bites out of cookie production; "this can\'t be hygienic", worries worker.',
6008
'News : pagan rituals on the rise as children around the world dress up in strange costumes and blackmail homeowners for candy.',
6009
'News : new-age terrorism strikes suburbs as houses find themselves covered in eggs and toilet paper.',
6010
'News : children around the world "lost and confused" as any and all Halloween treats have been replaced by cookies.'
6011
]));
6012
6013
if (Game.season=='christmas' && Game.cookiesEarned>=1000) list.push(choose([
6014
'News : bearded maniac spotted speeding on flying sleigh! Investigation pending.',
6015
'News : Santa Claus announces new brand of breakfast treats to compete with cookie-flavored cereals! "They\'re ho-ho-horrible!" says Santa.',
6016
'News : "You mean he just gives stuff away for free?!", concerned moms ask. "Personally, I don\'t trust his beard."',
6017
'News : obese jolly lunatic still on the loose, warn officials. "Keep your kids safe and board up your chimneys. We mean it."',
6018
'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.',
6019
'News : mysterious festive entity with quantum powers still wrecking havoc with army of reindeer, officials say.',
6020
'News : elves on strike at toy factory! "We will not be accepting reindeer chow as payment anymore. And stop calling us elves!"',
6021
'News : elves protest around the nation; wee little folks in silly little outfits spread mayhem, destruction; rabid reindeer running rampant through streets.',
6022
'News : scholars debate regarding the plural of reindeer(s) in the midst of elven world war.',
6023
'News : elves "unrelated to gnomes despite small stature and merry disposition", find scientists.',
6024
'News : elves sabotage radioactive frosting factory, turn hundreds blind in vicinity - "Who in their right mind would do such a thing?" laments outraged mayor.',
6025
'News : drama unfolds at North Pole as rumors crop up around Rudolph\'s red nose; "I may have an addiction or two", admits reindeer.'
6026
]));
6027
6028
if (Game.season=='valentines' && Game.cookiesEarned>=1000) list.push(choose([
6029
'News : organ-shaped confectioneries being traded in schools all over the world; gruesome practice undergoing investigation.',
6030
'News : heart-shaped candies overtaking sweets business, offering competition to cookie empire. "It\'s the economy, cupid!"',
6031
'News : love\'s in the air, according to weather specialists. Face masks now offered in every city to stunt airborne infection.',
6032
'News : marrying a cookie - deranged practice, or glimpse of the future?',
6033
'News : boyfriend dumped after offering his lover cookies for Valentine\'s Day, reports say. "They were off-brand", shrugs ex-girlfriend.'
6034
]));
6035
6036
if (Game.season=='easter' && Game.cookiesEarned>=1000) list.push(choose([
6037
'News : long-eared critters with fuzzy tails invade suburbs, spread terror and chocolate!',
6038
'News : eggs have begun to materialize in the most unexpected places; "no place is safe", warn experts.',
6039
'News : packs of rampaging rabbits cause billions in property damage; new strain of myxomatosis being developed.',
6040
'News : egg-laying rabbits "not quite from this dimension", warns biologist; advises against petting, feeding, or cooking the creatures.',
6041
'News : mysterious rabbits found to be egg-layers, but warm-blooded, hinting at possible platypus ancestry.'
6042
]));
6043
}
6044
6045
if (Math.random()<0.05)
6046
{
6047
if (Game.HasAchiev('Base 10')) list.push('News : cookie manufacturer completely forgoes common sense, lets OCD drive building decisions!');//somehow I got flak for this one
6048
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!');
6049
if (Game.HasAchiev('A world filled with cookies')) list.push('News : known universe now jammed with cookies! No vacancies!');
6050
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!');
6051
if (Game.Has('Serendipity')) list.push('News : local cookie manufacturer becomes luckiest being alive!');
6052
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.');
6053
6054
if (Game.Has('Kitten helpers')) list.push('News : faint meowing heard around local cookie facilities; suggests new ingredient being tested.');
6055
if (Game.Has('Kitten workers')) list.push('News : crowds of meowing kittens with little hard hats reported near local cookie facilities.');
6056
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.');
6057
if (Game.Has('Kitten overseers')) list.push('News : locals report troupe of bossy kittens meowing adorable orders at passersby.');
6058
if (Game.Has('Kitten managers')) list.push('News : local office cubicles invaded with armies of stern-looking kittens asking employees "what\'s happening, meow".');
6059
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.');
6060
if (Game.Has('Kitten specialists')) list.push('News : new kitten college opening next week, offers courses on cookie-making and catnip studies.');
6061
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.');
6062
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.');
6063
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!');
6064
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!');
6065
if (Game.Has('Kitten analysts')) list.push('News : are your spending habits sensible? For a hefty fee, these analysts will tell you!');
6066
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!');
6067
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."');
6068
}
6069
6070
if (Game.HasAchiev('Dude, sweet') && Math.random()<0.2) list.push(choose([
6071
'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.',
6072
'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.',
6073
'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.',
6074
'News : experts in bitter disagreement over whether sugar consumption turns children sluggish or hyperactive.',
6075
'News : fishermen deplore upturn in fish tooth decay as sugar lumps-hauling cargo sinks into the ocean.',
6076
'News : rare black sugar lump that captivated millions in unprecedented auction revealed to be common toxic fungus.',
6077
'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.',
6078
'News : sugar lump-snacking fad sweeps the nation; dentists everywhere rejoice.'
6079
]));
6080
6081
if (Math.random()<0.001)//apologies to Will Wright
6082
{
6083
list.push(
6084
'You have been chosen. They will come soon.',
6085
'They\'re coming soon. Maybe you should think twice about opening the door.',
6086
'The end is near. Make preparations.',
6087
'News : broccoli tops for moms, last for kids; dads indifferent.',
6088
'News : middle age a hoax, declares study; turns out to be bad posture after all.',
6089
'News : kitties want answers in possible Kitty Kibble shortage.'
6090
);
6091
}
6092
6093
if (Game.cookiesEarned>=10000) list.push(
6094
'News : '+choose([
6095
'cookies found to '+choose(['increase lifespan','sensibly increase intelligence','reverse aging','decrease hair loss','prevent arthritis','cure blindness'])+' in '+choose(animals)+'!',
6096
'cookies found to make '+choose(animals)+' '+choose(['more docile','more handsome','nicer','less hungry','more pragmatic','tastier'])+'!',
6097
'cookies tested on '+choose(animals)+', found to have no ill effects.',
6098
'cookies unexpectedly popular among '+choose(animals)+'!',
6099
'unsightly lumps found on '+choose(animals)+' near cookie facility; "they\'ve pretty much always looked like that", say biologists.',
6100
'new species of '+choose(animals)+' discovered in distant country; "yup, tastes like cookies", says biologist.',
6101
'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.',
6102
'"do your cookies contain '+choose(animals)+'?", asks PSA warning against counterfeit cookies.',
6103
'doctors recommend twice-daily consumption of fresh cookies.',
6104
'doctors warn against chocolate chip-snorting teen fad.',
6105
'doctors advise against new cookie-free fad diet.',
6106
'doctors warn mothers about the dangers of "home-made cookies".'
6107
]),
6108
'News : "'+choose([
6109
'I\'m all about cookies',
6110
'I just can\'t stop eating cookies. I think I seriously need help',
6111
'I guess I have a cookie problem',
6112
'I\'m not addicted to cookies. That\'s just speculation by fans with too much free time',
6113
'my upcoming album contains 3 songs about cookies',
6114
'I\'ve had dreams about cookies 3 nights in a row now. I\'m a bit worried honestly',
6115
'accusations of cookie abuse are only vile slander',
6116
'cookies really helped me when I was feeling low',
6117
'cookies are the secret behind my perfect skin',
6118
'cookies helped me stay sane while filming my upcoming movie',
6119
'cookies helped me stay thin and healthy',
6120
'I\'ll say one word, just one : cookies',
6121
'alright, I\'ll say it - I\'ve never eaten a single cookie in my life'
6122
])+'", reveals celebrity.',
6123
choose([
6124
'News : scientist predicts imminent cookie-related "end of the world"; becomes joke among peers.',
6125
'News : man robs bank, buys cookies.',
6126
'News : scientists establish that the deal with airline food is, in fact, a critical lack of cookies.',
6127
'News : hundreds of tons of cookies dumped into starving country from airplanes; thousands dead, nation grateful.',
6128
'News : new study suggests cookies neither speed up nor slow down aging, but instead "take you in a different direction".',
6129
'News : overgrown cookies found in fishing nets, raise questions about hormone baking.',
6130
'News : "all-you-can-eat" cookie restaurant opens in big city; waiters trampled in minutes.',
6131
'News : man dies in cookie-eating contest; "a less-than-impressive performance", says judge.',
6132
'News : what makes cookies taste so right? "Probably all the [*****] they put in them", says anonymous tipper.',
6133
'News : man found allergic to cookies; "what a weirdo", says family.',
6134
'News : foreign politician involved in cookie-smuggling scandal.',
6135
'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.',
6136
'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'])+'.',
6137
'News : cookie shortage strikes town, people forced to eat cupcakes; "just not the same", concedes mayor.',
6138
'News : "you gotta admit, all this cookie stuff is a bit ominous", says confused idiot.',
6139
]),
6140
choose([
6141
'News : movie cancelled from lack of actors; "everybody\'s at home eating cookies", laments director.',
6142
'News : comedian forced to cancel cookie routine due to unrelated indigestion.',
6143
'News : new cookie-based religion sweeps the nation.',
6144
'News : fossil records show cookie-based organisms prevalent during Cambrian explosion, scientists say.',
6145
'News : mysterious illegal cookies seized; "tastes terrible", says police.',
6146
'News : man found dead after ingesting cookie; investigators favor "mafia snitch" hypothesis.',
6147
'News : "the universe pretty much loops on itself," suggests researcher; "it\'s cookies all the way down."',
6148
'News : minor cookie-related incident turns whole town to ashes; neighboring cities asked to chip in for reconstruction.',
6149
'News : is our media controlled by the cookie industry? This could very well be the case, says crackpot conspiracy theorist.',
6150
'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.']),
6151
'News : all-cookie restaurant opening downtown. Dishes such as braised cookies, cookie thermidor, and for dessert : crepes.',
6152
'News : "Ook", says interviewed orangutan.',
6153
'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.',
6154
'News : flavor text '+choose(['not particularly flavorful','kind of unsavory'])+', study finds.',
6155
]),
6156
choose([
6157
'News : what do golden cookies taste like? Study reveals a flavor "somewhere between spearmint and liquorice".',
6158
'News : what do wrath cookies taste like? Study reveals a flavor "somewhere between blood sausage and seawater".',
6159
'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.',
6160
'News : "'+Game.bakeryName+'" set to be this year\'s most popular baby name.',
6161
'News : new popularity survey says '+Game.bakeryName+'\'s the word when it comes to cookies.',
6162
'News : major city being renamed '+Game.bakeryName+'ville after world-famous cookie manufacturer.',
6163
'News : '+choose(['street','school','nursing home','stadium','new fast food chain','new planet','new disease','flesh-eating virus','deadly bacteria','new species of '+choose(animals),'new law','baby','programming language'])+' to be named after '+Game.bakeryName+', the world-famous cookie manufacturer.',
6164
'News : don\'t miss tonight\'s biopic on '+Game.bakeryName+'\'s irresistible rise to success!',
6165
'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'])+'!',
6166
'News : people all over the internet still scratching their heads over nonsensical reference : "Okay, but why an egg?"',
6167
'News : viral video "Too Many Cookies" could be "a grim commentary on the impending crisis our world is about to face", says famous economist.',
6168
'News : "memes from last year somehow still relevant", deplore experts.',
6169
'News : cookie emoji most popular among teenagers, far ahead of "judgemental OK hand sign" and "shifty-looking dark moon", says study.',
6170
]),
6171
choose([
6172
'News : births of suspiciously bald babies on the rise; reptilian overlords deny involvement.',
6173
'News : "at this point, cookies permeate the economy", says economist. "If we start eating anything else, we\'re all dead."',
6174
'News : pun in headline infuriates town, causes riot. 21 wounded, 5 dead; mayor still missing.',
6175
'Nws : ky btwn W and R brokn, plas snd nw typwritr ASAP.',
6176
'Neeeeews : "neeeew EEEEEE keeeeey working fineeeeeeeee", reeeports gleeeeeeeeful journalist.',
6177
'News : cookies now illegal in some backwards country nobody cares about. Political tensions rising; war soon, hopefully.',
6178
'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!"',
6179
'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'])+'!',
6180
'News : '+choose(['local','area'])+' '+choose(['man','woman'])+' goes on journey of introspection, finds cookies : "I honestly don\'t know what I was expecting."',
6181
'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.']),
6182
'News : pet '+choose(animals)+', dangerous fad or juicy new market?',
6183
'News : person typing these wouldn\'t mind someone else breaking the news to THEM, for a change.',
6184
'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.'
6185
])
6186
);
6187
}
6188
6189
if (list.length==0)
6190
{
6191
if (Game.cookiesEarned<5) list.push('You feel like making cookies. But nobody wants to eat your cookies.');
6192
else if (Game.cookiesEarned<50) list.push('Your first batch goes to the trash. The neighborhood raccoon barely touches it.');
6193
else if (Game.cookiesEarned<100) list.push('Your family accepts to try some of your cookies.');
6194
else if (Game.cookiesEarned<500) list.push('Your cookies are popular in the neighborhood.');
6195
else if (Game.cookiesEarned<1000) list.push('People are starting to talk about your cookies.');
6196
else if (Game.cookiesEarned<5000) list.push('Your cookies are talked about for miles around.');
6197
else if (Game.cookiesEarned<10000) list.push('Your cookies are renowned in the whole town!');
6198
else if (Game.cookiesEarned<50000) list.push('Your cookies bring all the boys to the yard.');
6199
else if (Game.cookiesEarned<100000) list.push('Your cookies now have their own website!');
6200
else if (Game.cookiesEarned<500000) list.push('Your cookies are worth a lot of money.');
6201
else if (Game.cookiesEarned<1000000) list.push('Your cookies sell very well in distant countries.');
6202
else if (Game.cookiesEarned<5000000) list.push('People come from very far away to get a taste of your cookies.');
6203
else if (Game.cookiesEarned<10000000) list.push('Kings and queens from all over the world are enjoying your cookies.');
6204
else if (Game.cookiesEarned<50000000) list.push('There are now museums dedicated to your cookies.');
6205
else if (Game.cookiesEarned<100000000) list.push('A national day has been created in honor of your cookies.');
6206
else if (Game.cookiesEarned<500000000) list.push('Your cookies have been named a part of the world wonders.');
6207
else if (Game.cookiesEarned<1000000000) list.push('History books now include a whole chapter about your cookies.');
6208
else if (Game.cookiesEarned<5000000000) list.push('Your cookies have been placed under government surveillance.');
6209
else if (Game.cookiesEarned<10000000000) list.push('The whole planet is enjoying your cookies!');
6210
else if (Game.cookiesEarned<50000000000) list.push('Strange creatures from neighboring planets wish to try your cookies.');
6211
else if (Game.cookiesEarned<100000000000) list.push('Elder gods from the whole cosmos have awoken to taste your cookies.');
6212
else if (Game.cookiesEarned<500000000000) list.push('Beings from other dimensions lapse into existence just to get a taste of your cookies.');
6213
else if (Game.cookiesEarned<1000000000000) list.push('Your cookies have achieved sentience.');
6214
else if (Game.cookiesEarned<5000000000000) list.push('The universe has now turned into cookie dough, to the molecular level.');
6215
else if (Game.cookiesEarned<10000000000000) list.push('Your cookies are rewriting the fundamental laws of the universe.');
6216
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>');
6217
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)
6218
}
6219
6220
//if (Game.elderWrath>0 && (Game.pledges==0 || Math.random()<0.2))
6221
if (Game.elderWrath>0 && (((Game.pledges==0 && Game.resets==0) && Math.random()<0.5) || Math.random()<0.05))
6222
{
6223
list=[];
6224
if (Game.elderWrath==1) list.push(choose([
6225
'News : millions of old ladies reported missing!',
6226
'News : processions of old ladies sighted around cookie facilities!',
6227
'News : families around the continent report agitated, transfixed grandmothers!',
6228
'News : doctors swarmed by cases of old women with glassy eyes and a foamy mouth!',
6229
'News : nurses report "strange scent of cookie dough" around female elderly patients!'
6230
]));
6231
if (Game.elderWrath==2) list.push(choose([
6232
'News : town in disarray as strange old ladies break into homes to abduct infants and baking utensils!',
6233
'News : sightings of old ladies with glowing eyes terrify local population!',
6234
'News : retirement homes report "female residents slowly congealing in their seats"!',
6235
'News : whole continent undergoing mass exodus of old ladies!',
6236
'News : old women freeze in place in streets, ooze warm sugary syrup!'
6237
]));
6238
if (Game.elderWrath==3) list.push(choose([
6239
'News : large "flesh highways" scar continent, stretch between various cookie facilities!',
6240
'News : wrinkled "flesh tendrils" visible from space!',
6241
'News : remains of "old ladies" found frozen in the middle of growing fleshy structures!',
6242
'News : all hope lost as writhing mass of flesh and dough engulfs whole city!',
6243
'News : nightmare continues as wrinkled acres of flesh expand at alarming speeds!'
6244
]));
6245
}
6246
6247
if (Game.season=='fools')
6248
{
6249
list=[];
6250
6251
if (Game.cookiesEarned>=1000) list.push(choose([
6252
'Your office chair is really comfortable.',
6253
'Business meetings are such a joy!',
6254
'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'])+'!',
6255
'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'])+'.',
6256
'Profit\'s in the air!'
6257
]));
6258
if (Game.cookiesEarned>=1000 && Math.random()<0.1) list.push(choose([
6259
'If you could get some more cookies baked, that\'d be great.',
6260
'So. About those TPS reports.',
6261
'Another day in paradise!',
6262
'Working hard, or hardly working?'
6263
]));
6264
6265
6266
if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000)
6267
{
6268
if (Game.Objects['Grandma'].amount>0) list.push(choose([
6269
'Your rolling pins are rolling and pinning!',
6270
'Production is steady!'
6271
]));
6272
6273
if (Game.Objects['Grandma'].amount>0) list.push(choose([
6274
'Your ovens are diligently baking more and more cookies.',
6275
'Your ovens burn a whole batch. Ah well! Still good.'
6276
]));
6277
6278
if (Game.Objects['Farm'].amount>0) list.push(choose([
6279
'Scores of cookies come out of your kitchens.',
6280
'Today, new recruits are joining your kitchens!'
6281
]));
6282
6283
if (Game.Objects['Factory'].amount>0) list.push(choose([
6284
'Your factories are producing an unending stream of baked goods.',
6285
'Your factory workers decide to go on strike!',
6286
'It\'s safety inspection day in your factories.'
6287
]));
6288
6289
if (Game.Objects['Mine'].amount>0) list.push(choose([
6290
'Your secret recipes are kept safely inside a giant underground vault.',
6291
'Your chefs are working on new secret recipes!'
6292
]));
6293
6294
if (Game.Objects['Shipment'].amount>0) list.push(choose([
6295
'Your supermarkets are bustling with happy, hungry customers.',
6296
'Your supermarkets are full of cookie merch!'
6297
]));
6298
6299
if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([
6300
'It\'s a new trading day at the stock exchange, and traders can\'t get enough of your shares!',
6301
'Your stock is doubling in value by the minute!'
6302
]));
6303
6304
if (Game.Objects['Portal'].amount>0) list.push(choose([
6305
'You just released a new TV show episode!',
6306
'Your cookie-themed TV show is being adapted into a new movie!'
6307
]));
6308
6309
if (Game.Objects['Time machine'].amount>0) list.push(choose([
6310
'Your theme parks are doing well - puddles of vomit and roller-coaster casualties are being swept under the rug!',
6311
'Visitors are stuffing themselves with cookies before riding your roller-coasters. You might want to hire more clean-up crews.'
6312
]));
6313
6314
if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([
6315
'Cookiecoin is officially the most mined digital currency in the history of mankind!',
6316
'Cookiecoin piracy is rampant!'
6317
]));
6318
6319
if (Game.Objects['Prism'].amount>0) list.push(choose([
6320
'Your corporate nations just gained a new parliament!',
6321
'You\'ve just annexed a new nation!',
6322
'A new nation joins the grand cookie conglomerate!'
6323
]));
6324
6325
if (Game.Objects['Chancemaker'].amount>0) list.push(choose([
6326
'Your intergalactic federation of cookie-sponsored planets reports record-breaking profits!',
6327
'Billions of unwashed aliens are pleased to join your workforce as you annex their planet!',
6328
'New toll opened on interstellar highway, funnelling more profits into the cookie economy!'
6329
]));
6330
6331
if (Game.Objects['Fractal engine'].amount>0) list.push(choose([
6332
'Your cookie-based political party is doing fantastic in the polls!',
6333
'New pro-cookie law passes without a hitch thanks to your firm grasp of the political ecosystem!',
6334
'Your appointed senators are overturning cookie bans left and right!'
6335
]));
6336
6337
if (Game.Objects['Javascript console'].amount>0) list.push(choose([
6338
'Cookies are now one of the defining aspects of mankind! Congratulations!',
6339
'Time travelers report that this era will later come to be known, thanks to you, as the cookie millennium!',
6340
'Cookies now deeply rooted in human culture, likely puzzling future historians!'
6341
]));
6342
}
6343
6344
if (Game.cookiesEarned<5) list.push('Such a grand day to begin a new business.');
6345
else if (Game.cookiesEarned<50) list.push('You\'re baking up a storm!');
6346
else if (Game.cookiesEarned<100) list.push('You are confident that one day, your cookie company will be the greatest on the market!');
6347
else if (Game.cookiesEarned<1000) list.push('Business is picking up!');
6348
else if (Game.cookiesEarned<5000) list.push('You\'re making sales left and right!');
6349
else if (Game.cookiesEarned<20000) list.push('Everyone wants to buy your cookies!');
6350
else if (Game.cookiesEarned<50000) list.push('You are now spending most of your day signing contracts!');
6351
else if (Game.cookiesEarned<500000) list.push('You\'ve been elected "business tycoon of the year"!');
6352
else if (Game.cookiesEarned<1000000) list.push('Your cookies are a worldwide sensation! Well done, old chap!');
6353
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!');
6354
else if (Game.cookiesEarned<1000000000) list.push('A business day like any other. It\'s good to be at the top!');
6355
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
6356
}
6357
6358
for (var i in Game.customTickers)
6359
{
6360
var arr=Game.customTickers[i]();
6361
for (var ii in arr) list.push(arr[ii]);
6362
}
6363
6364
Game.TickerEffect=0;
6365
6366
if (!manual && Game.T>Game.fps*10 && Game.Has('Fortune cookies') && Math.random()<(Game.HasAchiev('O Fortuna')?0.04:0.02))
6367
{
6368
var fortunes=[];
6369
for (var i in Game.Tiers['fortune'].upgrades)
6370
{
6371
var it=Game.Tiers['fortune'].upgrades[i];
6372
if (!Game.HasUnlocked(it.name)) fortunes.push(it);
6373
}
6374
6375
if (!Game.fortuneGC) fortunes.push('fortuneGC');
6376
if (!Game.fortuneCPS) fortunes.push('fortuneCPS');
6377
6378
if (fortunes.length>0)
6379
{
6380
list=[];
6381
var me=choose(fortunes);
6382
Game.TickerEffect={type:'fortune',sub:me};
6383
Math.seedrandom(Game.seed+'-fortune');
6384
if (me=='fortuneGC') me='Today is your lucky day!';/*<br>Click here for a golden cookie.';*/
6385
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.'*/;
6386
else
6387
{
6388
me=me.name.substring(me.name.indexOf('#'))+' : '+me.baseDesc.substring(me.baseDesc.indexOf('<q>')+3);
6389
me=me.substring(0,me.length-4);
6390
}
6391
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>';
6392
Math.seedrandom();
6393
list=[me];
6394
}
6395
}
6396
6397
Game.TickerAge=Game.fps*10;
6398
Game.Ticker=choose(list);
6399
Game.AddToLog(Game.Ticker);
6400
Game.TickerN++;
6401
Game.TickerDraw();
6402
}
6403
Game.tickerL=l('commentsText');
6404
Game.tickerBelowL=l('commentsTextBelow');
6405
Game.tickerCompactL=l('compactCommentsText');
6406
Game.TickerDraw=function()
6407
{
6408
var str='';
6409
if (Game.Ticker!='') str=Game.Ticker;
6410
Game.tickerBelowL.innerHTML=Game.tickerL.innerHTML;
6411
Game.tickerL.innerHTML=str;
6412
Game.tickerCompactL.innerHTML=str;
6413
6414
Game.tickerBelowL.className='commentsText';
6415
void Game.tickerBelowL.offsetWidth;
6416
Game.tickerBelowL.className='commentsText risingAway';
6417
Game.tickerL.className='commentsText';
6418
void Game.tickerL.offsetWidth;
6419
Game.tickerL.className='commentsText risingUp';
6420
}
6421
AddEvent(Game.tickerL,'click',function(event){
6422
Game.Ticker='';
6423
Game.TickerClicks++;
6424
if (Game.TickerClicks==50) {Game.Win('Tabloid addiction');}
6425
6426
if (Game.TickerEffect && Game.TickerEffect.type=='fortune')
6427
{
6428
PlaySound('snd/fortune.mp3',1);
6429
Game.SparkleAt(Game.mouseX,Game.mouseY);
6430
var effect=Game.TickerEffect.sub;
6431
if (effect=='fortuneGC')
6432
{
6433
Game.Notify('Fortune!','A golden cookie has appeared.',[10,32]);
6434
Game.fortuneGC=1;
6435
var newShimmer=new Game.shimmer('golden',{noWrath:true});
6436
}
6437
else if (effect=='fortuneCPS')
6438
{
6439
Game.Notify('Fortune!','You gain <b>one hour</b> of your CpS (capped at double your bank).',[10,32]);
6440
Game.fortuneCPS=1;
6441
Game.Earn((Game.cookiesPs*60*60,Game.cookies));
6442
}
6443
else
6444
{
6445
Game.Notify(effect.name,'You\'ve unlocked a new upgrade.',effect.icon);
6446
effect.unlock();
6447
}
6448
}
6449
6450
Game.TickerEffect=0;
6451
6452
});
6453
6454
Game.Log=[];
6455
Game.AddToLog=function(what)
6456
{
6457
Game.Log.unshift(what);
6458
if (Game.Log.length>100) Game.Log.pop();
6459
}
6460
6461
Game.vanilla=1;
6462
/*=====================================================================================
6463
BUILDINGS
6464
=======================================================================================*/
6465
Game.last=0;
6466
6467
Game.storeToRefresh=1;
6468
Game.priceIncrease=1.15;
6469
Game.buyBulk=1;
6470
Game.buyMode=1;//1 for buy, -1 for sell
6471
Game.buyBulkOld=Game.buyBulk;//used to undo changes from holding Shift or Ctrl
6472
Game.buyBulkShortcut=0;//are we pressing Shift or Ctrl?
6473
6474
Game.Objects=[];
6475
Game.ObjectsById=[];
6476
Game.ObjectsN=0;
6477
Game.BuildingsOwned=0;
6478
Game.Object=function(name,commonName,desc,icon,iconColumn,art,price,cps,buyFunction)
6479
{
6480
this.id=Game.ObjectsN;
6481
this.name=name;
6482
this.displayName=this.name;
6483
commonName=commonName.split('|');
6484
this.single=commonName[0];
6485
this.plural=commonName[1];
6486
this.actionName=commonName[2];
6487
this.extraName=commonName[3];
6488
this.extraPlural=commonName[4];
6489
this.desc=desc;
6490
this.basePrice=price;
6491
this.price=this.basePrice;
6492
this.bulkPrice=this.price;
6493
this.cps=cps;
6494
this.baseCps=this.cps;
6495
this.mouseOn=false;
6496
this.mousePos=[-100,-100];
6497
this.productionAchievs=[];
6498
6499
this.n=this.id;
6500
if (this.n!=0)
6501
{
6502
//new automated price and CpS curves
6503
//this.baseCps=Math.ceil(((this.n*0.5)*Math.pow(this.n*1,this.n*0.9))*10)/10;
6504
//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
6505
this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2))*10)/10;//0.45 used to be 0.5
6506
//this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.45+2.10))*10)/10;
6507
//clamp 14,467,199 to 14,000,000 (there's probably a more elegant way to do that)
6508
var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.baseCps))/Math.LN10)))/100;
6509
this.baseCps=Math.round(this.baseCps/digits)*digits;
6510
6511
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));
6512
//this.basePrice=(this.n*2.5+7.5)*Math.pow(10,this.n);
6513
var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.basePrice))/Math.LN10)))/100;
6514
this.basePrice=Math.round(this.basePrice/digits)*digits;
6515
if (this.id>=16) this.basePrice*=10;
6516
this.price=this.basePrice;
6517
this.bulkPrice=this.price;
6518
}
6519
6520
this.totalCookies=0;
6521
this.storedCps=0;
6522
this.storedTotalCps=0;
6523
this.icon=icon;
6524
this.iconColumn=iconColumn;
6525
this.art=art;
6526
if (art.base)
6527
{art.pic=art.base+'.png';art.bg=art.base+'Background.png';}
6528
this.buyFunction=buyFunction;
6529
this.locked=1;
6530
this.level=0;
6531
this.vanilla=Game.vanilla;
6532
6533
this.tieredUpgrades=[];
6534
this.tieredAchievs=[];
6535
this.synergies=[];
6536
this.fortune=0;
6537
6538
this.amount=0;
6539
this.bought=0;
6540
this.free=0;
6541
6542
this.eachFrame=0;
6543
6544
this.minigameUrl=0;//if this is defined, load the specified script if the building's level is at least 1
6545
this.minigameName=0;
6546
this.onMinigame=false;
6547
this.minigameLoaded=false;
6548
6549
this.switchMinigame=function(on)//change whether we're on the building's minigame
6550
{
6551
if (!Game.isMinigameReady(this)) on=false;
6552
if (on==-1) on=!this.onMinigame;
6553
this.onMinigame=on;
6554
if (this.id!=0)
6555
{
6556
if (this.onMinigame)
6557
{
6558
l('row'+this.id).classList.add('onMinigame');
6559
//l('rowSpecial'+this.id).style.display='block';
6560
//l('rowCanvas'+this.id).style.display='none';
6561
if (this.minigame.onResize) this.minigame.onResize();
6562
}
6563
else
6564
{
6565
l('row'+this.id).classList.remove('onMinigame');
6566
//l('rowSpecial'+this.id).style.display='none';
6567
//l('rowCanvas'+this.id).style.display='block';
6568
}
6569
}
6570
this.refresh();
6571
}
6572
6573
this.getPrice=function(n)
6574
{
6575
var price=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,this.amount-this.free));
6576
price=Game.modifyBuildingPrice(this,price);
6577
return Math.ceil(price);
6578
}
6579
this.getSumPrice=function(amount)//return how much it would cost to buy [amount] more of this building
6580
{
6581
var price=0;
6582
for (var i=Math.max(0,this.amount);i<Math.max(0,(this.amount)+amount);i++)
6583
{
6584
price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));
6585
}
6586
price=Game.modifyBuildingPrice(this,price);
6587
return Math.ceil(price);
6588
}
6589
this.getReverseSumPrice=function(amount)//return how much you'd get from selling [amount] of this building
6590
{
6591
var price=0;
6592
for (var i=Math.max(0,(this.amount)-amount);i<Math.max(0,this.amount);i++)
6593
{
6594
price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));
6595
}
6596
price=Game.modifyBuildingPrice(this,price);
6597
price*=this.getSellMultiplier();
6598
return Math.ceil(price);
6599
}
6600
this.getSellMultiplier=function()
6601
{
6602
var giveBack=0.25;
6603
//if (Game.hasAura('Earth Shatterer')) giveBack=0.5;
6604
giveBack*=1+Game.auraMult('Earth Shatterer');
6605
return giveBack;
6606
}
6607
6608
this.buy=function(amount)
6609
{
6610
if (Game.buyMode==-1) {this.sell(Game.buyBulk,1);return 0;}
6611
var success=0;
6612
var moni=0;
6613
var bought=0;
6614
if (!amount) amount=Game.buyBulk;
6615
if (amount==-1) amount=1000;
6616
for (var i=0;i<amount;i++)
6617
{
6618
var price=this.getPrice();
6619
if (Game.cookies>=price)
6620
{
6621
bought++;
6622
moni+=price;
6623
Game.Spend(price);
6624
this.amount++;
6625
this.bought++;
6626
price=this.getPrice();
6627
this.price=price;
6628
if (this.buyFunction) this.buyFunction();
6629
Game.recalculateGains=1;
6630
if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');
6631
Game.BuildingsOwned++;
6632
success=1;
6633
}
6634
}
6635
if (success) {PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}
6636
//if (moni>0 && amount>1) Game.Notify(this.name,'Bought <b>'+bought+'</b> for '+Beautify(moni)+' cookies','',2);
6637
}
6638
this.sell=function(amount,bypass)
6639
{
6640
var success=0;
6641
var moni=0;
6642
var sold=0;
6643
if (amount==-1) amount=this.amount;
6644
if (!amount) amount=Game.buyBulk;
6645
for (var i=0;i<amount;i++)
6646
{
6647
var price=this.getPrice();
6648
var giveBack=this.getSellMultiplier();
6649
price=Math.floor(price*giveBack);
6650
if (this.amount>0)
6651
{
6652
sold++;
6653
moni+=price;
6654
Game.cookies+=price;
6655
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
6656
this.amount--;
6657
price=this.getPrice();
6658
this.price=price;
6659
if (this.sellFunction) this.sellFunction();
6660
Game.recalculateGains=1;
6661
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
6662
Game.BuildingsOwned--;
6663
success=1;
6664
}
6665
}
6666
if (success && Game.hasGod)
6667
{
6668
var godLvl=Game.hasGod('ruin');
6669
var old=Game.hasBuff('Devastation');
6670
if (old)
6671
{
6672
if (godLvl==1) old.multClick+=sold*0.01;
6673
else if (godLvl==2) old.multClick+=sold*0.005;
6674
else if (godLvl==3) old.multClick+=sold*0.0025;
6675
}
6676
else
6677
{
6678
if (godLvl==1) Game.gainBuff('devastation',10,1+sold*0.01);
6679
else if (godLvl==2) Game.gainBuff('devastation',10,1+sold*0.005);
6680
else if (godLvl==3) Game.gainBuff('devastation',10,1+sold*0.0025);
6681
}
6682
}
6683
if (success) {PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);this.refresh();}
6684
//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);
6685
}
6686
this.sacrifice=function(amount)//sell without getting back any money
6687
{
6688
var success=0;
6689
//var moni=0;
6690
var sold=0;
6691
if (amount==-1) amount=this.amount;
6692
if (!amount) amount=1;
6693
for (var i=0;i<amount;i++)
6694
{
6695
var price=this.getPrice();
6696
price=Math.floor(price*0.5);
6697
if (this.amount>0)
6698
{
6699
sold++;
6700
//moni+=price;
6701
//Game.cookies+=price;
6702
//Game.cookiesEarned=Math.max(Game.cookies,Game.cookiesEarned);
6703
this.amount--;
6704
price=this.getPrice();
6705
this.price=price;
6706
if (this.sellFunction) this.sellFunction();
6707
Game.recalculateGains=1;
6708
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
6709
Game.BuildingsOwned--;
6710
success=1;
6711
}
6712
}
6713
if (success) {this.refresh();}
6714
//if (moni>0) Game.Notify(this.name,'Sold <b>'+sold+'</b> for '+Beautify(moni)+' cookies','',2);
6715
}
6716
this.buyFree=function(amount)//unlike getFree, this still increases the price
6717
{
6718
for (var i=0;i<amount;i++)
6719
{
6720
if (Game.cookies>=price)
6721
{
6722
this.amount++;
6723
this.bought++;
6724
this.price=this.getPrice();
6725
Game.recalculateGains=1;
6726
if (this.amount==1 && this.id!=0) l('row'+this.id).classList.add('enabled');
6727
Game.BuildingsOwned++;
6728
}
6729
}
6730
this.refresh();
6731
}
6732
this.getFree=function(amount)//get X of this building for free, with the price behaving as if you still didn't have them
6733
{
6734
this.amount+=amount;
6735
this.bought+=amount;
6736
this.free+=amount;
6737
Game.BuildingsOwned+=amount;
6738
this.refresh();
6739
}
6740
this.getFreeRanks=function(amount)//this building's price behaves as if you had X less of it
6741
{
6742
this.free+=amount;
6743
this.refresh();
6744
}
6745
6746
this.tooltip=function()
6747
{
6748
var me=this;
6749
var desc=me.desc;
6750
var name=me.name;
6751
if (Game.season=='fools')
6752
{
6753
if (!Game.foolObjects[me.name])
6754
{
6755
name=Game.foolObjects['Unknown'].name;
6756
desc=Game.foolObjects['Unknown'].desc;
6757
}
6758
else
6759
{
6760
name=Game.foolObjects[me.name].name;
6761
desc=Game.foolObjects[me.name].desc;
6762
}
6763
}
6764
var icon=[me.iconColumn,0];
6765
if (me.locked)
6766
{
6767
name='???';
6768
desc='';
6769
icon=[0,7];
6770
}
6771
//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;
6772
6773
var canBuy=false;
6774
var price=me.bulkPrice;
6775
if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) canBuy=true;
6776
6777
var synergiesStr='';
6778
//note : might not be entirely accurate, math may need checking
6779
if (me.amount>0)
6780
{
6781
var synergiesWith={};
6782
var synergyBoost=0;
6783
6784
if (me.name=='Grandma')
6785
{
6786
for (var i in Game.GrandmaSynergies)
6787
{
6788
if (Game.Has(Game.GrandmaSynergies[i]))
6789
{
6790
var other=Game.Upgrades[Game.GrandmaSynergies[i]].buildingTie;
6791
var mult=me.amount*0.01*(1/(other.id-1));
6792
var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+mult);
6793
synergyBoost+=boost;
6794
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
6795
synergiesWith[other.plural]+=mult;
6796
}
6797
}
6798
}
6799
else if (me.name=='Portal' && Game.Has('Elder Pact'))
6800
{
6801
var other=Game.Objects['Grandma'];
6802
var boost=(me.amount*0.05*other.amount)*Game.globalCpsMult;
6803
synergyBoost+=boost;
6804
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
6805
synergiesWith[other.plural]+=boost/(other.storedTotalCps*Game.globalCpsMult);
6806
}
6807
6808
for (var i in me.synergies)
6809
{
6810
var it=me.synergies[i];
6811
if (Game.Has(it.name))
6812
{
6813
var weight=0.05;
6814
var other=it.buildingTie1;
6815
if (me==it.buildingTie1) {weight=0.001;other=it.buildingTie2;}
6816
var boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+me.amount*weight);
6817
synergyBoost+=boost;
6818
if (!synergiesWith[other.plural]) synergiesWith[other.plural]=0;
6819
synergiesWith[other.plural]+=me.amount*weight;
6820
//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>';
6821
}
6822
}
6823
if (synergyBoost>0)
6824
{
6825
for (var i in synergiesWith)
6826
{
6827
if (synergiesStr!='') synergiesStr+=', ';
6828
synergiesStr+=i+' +'+Beautify(synergiesWith[i]*100,1)+'%';
6829
}
6830
//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)';
6831
//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+'';
6832
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)';
6833
}
6834
}
6835
6836
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>!]':'')+
6837
'<div class="line"></div><div class="description">'+desc+'</div>'+
6838
(me.totalCookies>0?(
6839
'<div class="line"></div><div class="data">'+
6840
(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>':'')+
6841
'&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>'+
6842
(synergiesStr?('&bull; '+synergiesStr+'<br>'):'')+
6843
'&bull; <b>'+Beautify(me.totalCookies)+'</b> '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName+' so far</div>'
6844
):'')+
6845
'</div>';
6846
}
6847
this.levelTooltip=function()
6848
{
6849
var me=this;
6850
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>';
6851
}
6852
/*this.levelUp=function()
6853
{
6854
var me=this;
6855
if (Game.lumps<me.level+1) return 0;
6856
Game.lumps-=me.level+1;
6857
me.level+=1;
6858
if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);
6859
PlaySound('snd/upgrade.mp3',0.6);
6860
Game.LoadMinigames();
6861
me.refresh();
6862
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);}
6863
Game.recalculateGains=1;
6864
if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);
6865
}*/
6866
this.levelUp=function(me){
6867
return function(){Game.spendLump(me.level+1,'level up your '+me.plural,function()
6868
{
6869
me.level+=1;
6870
if (me.level>=10 && me.levelAchiev10) Game.Win(me.levelAchiev10.name);
6871
PlaySound('snd/upgrade.mp3',0.6);
6872
Game.LoadMinigames();
6873
me.refresh();
6874
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);}
6875
if (me.minigame && me.minigame.onLevel) me.minigame.onLevel(me.level);
6876
})();};
6877
}(this);
6878
6879
this.refresh=function()//show/hide the building display based on its amount, and redraw it
6880
{
6881
this.price=this.getPrice();
6882
if (Game.buyMode==1) this.bulkPrice=this.getSumPrice(Game.buyBulk);
6883
else if (Game.buyMode==-1 && Game.buyBulk==-1) this.bulkPrice=this.getReverseSumPrice(1000);
6884
else if (Game.buyMode==-1) this.bulkPrice=this.getReverseSumPrice(Game.buyBulk);
6885
this.rebuild();
6886
if (this.amount==0 && this.id!=0) l('row'+this.id).classList.remove('enabled');
6887
else if (this.amount>0 && this.id!=0) l('row'+this.id).classList.add('enabled');
6888
if (this.muted>0 && this.id!=0) {l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}
6889
else if (this.id!=0) {l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}
6890
//if (!this.onMinigame && !this.muted) {}
6891
//else this.pics=[];
6892
}
6893
this.rebuild=function()
6894
{
6895
var me=this;
6896
//var classes='product';
6897
var price=me.bulkPrice;
6898
/*if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';me.locked=0;} else {classes+=' locked';me.locked=1;}
6899
if (Game.cookies>=price) classes+=' enabled'; else classes+=' disabled';
6900
if (me.l.className.indexOf('toggledOff')!=-1) classes+=' toggledOff';
6901
*/
6902
var icon=[0,me.icon];
6903
var iconOff=[1,me.icon];
6904
if (me.iconFunc) icon=me.iconFunc();
6905
6906
var desc=me.desc;
6907
var name=me.name;
6908
var displayName=me.displayName;
6909
if (Game.season=='fools')
6910
{
6911
if (!Game.foolObjects[me.name])
6912
{
6913
icon=[2,0];
6914
iconOff=[3,0];
6915
name=Game.foolObjects['Unknown'].name;
6916
desc=Game.foolObjects['Unknown'].desc;
6917
}
6918
else
6919
{
6920
icon=[2,me.icon];
6921
iconOff=[3,me.icon];
6922
name=Game.foolObjects[me.name].name;
6923
desc=Game.foolObjects[me.name].desc;
6924
}
6925
displayName=name;
6926
if (name.length>16) displayName='<span style="font-size:75%;">'+name+'</span>';
6927
}
6928
icon=[icon[0]*64,icon[1]*64];
6929
iconOff=[iconOff[0]*64,iconOff[1]*64];
6930
6931
//me.l.className=classes;
6932
//l('productIcon'+me.id).style.backgroundImage='url(img/'+icon+')';
6933
l('productIcon'+me.id).style.backgroundPosition='-'+icon[0]+'px -'+icon[1]+'px';
6934
//l('productIconOff'+me.id).style.backgroundImage='url(img/'+iconOff+')';
6935
l('productIconOff'+me.id).style.backgroundPosition='-'+iconOff[0]+'px -'+iconOff[1]+'px';
6936
l('productName'+me.id).innerHTML=displayName;
6937
l('productOwned'+me.id).innerHTML=me.amount?me.amount:'';
6938
l('productPrice'+me.id).innerHTML=Beautify(Math.round(price));
6939
l('productPriceMult'+me.id).innerHTML=(Game.buyBulk>1)?('x'+Game.buyBulk+' '):'';
6940
l('productLevel'+me.id).innerHTML='lvl '+Beautify(me.level);
6941
if (Game.isMinigameReady(me) && Game.ascensionMode!=1)
6942
{
6943
l('productMinigameButton'+me.id).style.display='block';
6944
if (!me.onMinigame) l('productMinigameButton'+me.id).innerHTML='View '+me.minigameName;
6945
else l('productMinigameButton'+me.id).innerHTML='Close '+me.minigameName;
6946
}
6947
else l('productMinigameButton'+me.id).style.display='none';
6948
}
6949
this.muted=false;
6950
this.mute=function(val)
6951
{
6952
if (this.id==0) return false;
6953
this.muted=val;
6954
if (val) {l('productMute'+this.id).classList.add('on');l('row'+this.id).classList.add('muted');l('mutedProduct'+this.id).style.display='inline-block';}
6955
else {l('productMute'+this.id).classList.remove('on');l('row'+this.id).classList.remove('muted');l('mutedProduct'+this.id).style.display='none';}
6956
};
6957
6958
this.draw=function(){};
6959
6960
if (this.id==0)
6961
{
6962
var str='<div class="productButtons">';
6963
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>';
6964
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>';
6965
str+='</div>';
6966
l('sectionLeftExtra').innerHTML=l('sectionLeftExtra').innerHTML+str;
6967
}
6968
else//draw it
6969
{
6970
var str='<div class="row" id="row'+this.id+'"><div class="separatorBottom"></div>';
6971
str+='<div class="productButtons">';
6972
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>';
6973
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>';
6974
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>';
6975
str+='</div>';
6976
str+='<canvas class="rowCanvas" id="rowCanvas'+this.id+'"></canvas>';
6977
str+='<div class="rowSpecial" id="rowSpecial'+this.id+'"></div>';
6978
str+='</div>';
6979
l('rows').innerHTML=l('rows').innerHTML+str;
6980
6981
//building canvas
6982
this.pics=[];
6983
6984
this.toResize=true;
6985
this.redraw=function()
6986
{
6987
var me=this;
6988
me.pics=[];
6989
}
6990
this.draw=function()
6991
{
6992
if (this.amount<=0) return false;
6993
if (this.toResize)
6994
{
6995
this.canvas.width=this.canvas.clientWidth;
6996
this.canvas.height=this.canvas.clientHeight;
6997
this.toResize=false;
6998
}
6999
var ctx=this.ctx;
7000
//clear
7001
//ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
7002
ctx.globalAlpha=1;
7003
7004
//pic : a loaded picture or a function returning a loaded picture
7005
//bg : a loaded picture or a function returning a loaded picture - tiled as the background, 128x128
7006
//xV : the pictures will have a random horizontal shift by this many pixels
7007
//yV : the pictures will have a random vertical shift by this many pixels
7008
//w : how many pixels between each picture (or row of pictures)
7009
//x : horizontal offset
7010
//y : vertical offset (+32)
7011
//rows : if >1, arrange the pictures in rows containing this many pictures
7012
//frames : if present, slice the pic in [frames] horizontal slices and pick one at random
7013
7014
var pic=this.art.pic;
7015
var bg=this.art.bg;
7016
var xV=this.art.xV||0;
7017
var yV=this.art.yV||0;
7018
var w=this.art.w||48;
7019
var h=this.art.h||48;
7020
var offX=this.art.x||0;
7021
var offY=this.art.y||0;
7022
var rows=this.art.rows||1;
7023
var frames=this.art.frames||1;
7024
7025
if (typeof(bg)=='string') ctx.fillPattern(Pic(this.art.bg),0,0,this.canvas.width,this.canvas.height,128,128);
7026
else bg(this,ctx);
7027
/*
7028
ctx.globalAlpha=0.5;
7029
if (typeof(bg)=='string')//test
7030
{
7031
ctx.fillPattern(Pic(this.art.bg),-128+Game.T%128,0,this.canvas.width+128,this.canvas.height,128,128);
7032
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);
7033
}
7034
ctx.globalAlpha=1;
7035
*/
7036
var maxI=Math.floor(this.canvas.width/(w/rows)+1);
7037
var iT=Math.min(this.amount,maxI);
7038
var i=this.pics.length;
7039
7040
7041
var x=0;
7042
var y=0;
7043
var added=0;
7044
if (i!=iT)
7045
{
7046
//for (var iter=0;iter<3;iter++)
7047
//{
7048
while (i<iT)
7049
//if (i<iT)
7050
{
7051
Math.seedrandom(Game.seed+' '+this.id+' '+i);
7052
if (rows!=1)
7053
{
7054
x=Math.floor(i/rows)*w+((i%rows)/rows)*w+Math.floor((Math.random()-0.5)*xV)+offX;
7055
y=32+Math.floor((Math.random()-0.5)*yV)+((-rows/2)*32/2+(i%rows)*32/2)+offY;
7056
}
7057
else
7058
{
7059
x=i*w+Math.floor((Math.random()-0.5)*xV)+offX;
7060
y=32+Math.floor((Math.random()-0.5)*yV)+offY;
7061
}
7062
var usedPic=(typeof(pic)=='string'?pic:pic(this,i));
7063
var frame=-1;
7064
if (frames>1) frame=Math.floor(Math.random()*frames);
7065
this.pics.push({x:Math.floor(x),y:Math.floor(y),z:y,pic:usedPic,id:i,frame:frame});
7066
i++;
7067
added++;
7068
}
7069
while (i>iT)
7070
//else if (i>iT)
7071
{
7072
this.pics.sort(Game.sortSpritesById);
7073
this.pics.pop();
7074
i--;
7075
added--;
7076
}
7077
//}
7078
this.pics.sort(Game.sortSprites);
7079
}
7080
7081
var len=this.pics.length;
7082
7083
if (this.mouseOn)
7084
{
7085
var selected=-1;
7086
//mouse detection only fits grandma sprites for now
7087
var marginW=-18;
7088
var marginH=-10;
7089
for (var i=0;i<len;i++)
7090
{
7091
var pic=this.pics[i];
7092
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;
7093
}
7094
}
7095
7096
Math.seedrandom();
7097
7098
for (var i=0;i<len;i++)
7099
{
7100
var pic=this.pics[i];
7101
var sprite=Pic(pic.pic);
7102
if (selected==i && this.name=='Grandma')
7103
{
7104
ctx.font='14px Merriweather';
7105
ctx.textAlign='center';
7106
Math.seedrandom(Game.seed+' '+pic.id/*+' '+pic.id*/);//(Game.seed+' '+pic.id+' '+pic.x+' '+pic.y);
7107
var years=((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365))+Math.random();//the grandmas age with the game
7108
var name=choose(Game.grandmaNames);
7109
var custom=false;
7110
if (Game.prefs.customGrandmas && Game.customGrandmaNames.length>0 && Math.random()<0.2) {name=choose(Game.customGrandmaNames);custom=true;}
7111
var text=name+', age '+Beautify(Math.floor(70+Math.random()*30+years+this.level));
7112
var width=ctx.measureText(text).width+12;
7113
var x=Math.max(0,Math.min(pic.x+32-width/2+Math.random()*32-16,this.canvas.width-width));
7114
var y=4+Math.random()*8-4;
7115
Math.seedrandom();
7116
ctx.fillStyle='#000';
7117
ctx.strokeStyle='#000';
7118
ctx.lineWidth=8;
7119
ctx.globalAlpha=0.75;
7120
ctx.beginPath();
7121
ctx.moveTo(pic.x+32,pic.y+32);
7122
ctx.lineTo(Math.floor(x+width/2),Math.floor(y+20));
7123
ctx.stroke();
7124
ctx.fillRect(Math.floor(x),Math.floor(y),Math.floor(width),24);
7125
ctx.globalAlpha=1;
7126
if (custom) ctx.fillStyle='#fff';
7127
else ctx.fillStyle='rgba(255,255,255,0.7)';
7128
ctx.fillText(text,Math.floor(x+width/2),Math.floor(y+16));
7129
7130
ctx.drawImage(sprite,Math.floor(pic.x+Math.random()*4-2),Math.floor(pic.y+Math.random()*4-2));
7131
}
7132
//else if (1) ctx.drawImage(sprite,0,0,sprite.width,sprite.height,pic.x,pic.y,sprite.width,sprite.height);
7133
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);
7134
else ctx.drawImage(sprite,pic.x,pic.y);
7135
7136
}
7137
7138
/*
7139
var picX=this.id;
7140
var picY=12;
7141
var w=1;
7142
var h=1;
7143
var w=Math.abs(Math.cos(Game.T*0.2+this.id*2-0.3))*0.2+0.8;
7144
var h=Math.abs(Math.sin(Game.T*0.2+this.id*2))*0.3+0.7;
7145
var x=64+Math.cos(Game.T*0.19+this.id*2)*8-24*w;
7146
var y=128-Math.abs(Math.pow(Math.sin(Game.T*0.2+this.id*2),5)*16)-48*h;
7147
ctx.drawImage(Pic('icons.png'),picX*48,picY*48,48,48,Math.floor(x),Math.floor(y),48*w,48*h);
7148
*/
7149
}
7150
}
7151
7152
Game.last=this;
7153
Game.Objects[this.name]=this;
7154
Game.ObjectsById[this.id]=this;
7155
Game.ObjectsN++;
7156
return this;
7157
}
7158
7159
Game.DrawBuildings=function()//draw building displays with canvas
7160
{
7161
if (Game.drawT%3==0)
7162
{
7163
for (var i in Game.Objects)
7164
{
7165
var me=Game.Objects[i];
7166
if (me.id>0 && !me.onMinigame && !me.muted) me.draw();
7167
else me.pics=[];
7168
}
7169
}
7170
}
7171
7172
Game.sortSprites=function(a,b)
7173
{
7174
if (a.z>b.z) return 1;
7175
else if (a.z<b.z) return -1;
7176
else return 0;
7177
}
7178
Game.sortSpritesById=function(a,b)
7179
{
7180
if (a.id>b.id) return 1;
7181
else if (a.id<b.id) return -1;
7182
else return 0;
7183
}
7184
7185
Game.modifyBuildingPrice=function(building,price)
7186
{
7187
if (Game.Has('Season savings')) price*=0.99;
7188
if (Game.Has('Santa\'s dominion')) price*=0.99;
7189
if (Game.Has('Faberge egg')) price*=0.99;
7190
if (Game.Has('Divine discount')) price*=0.99;
7191
if (Game.Has('Fortune #100')) price*=0.99;
7192
//if (Game.hasAura('Fierce Hoarder')) price*=0.98;
7193
price*=1-Game.auraMult('Fierce Hoarder')*0.02;
7194
if (Game.hasBuff('Everything must go')) price*=0.95;
7195
if (Game.hasBuff('Crafty pixies')) price*=0.98;
7196
if (Game.hasBuff('Nasty goblins')) price*=1.02;
7197
if (building.fortune && Game.Has(building.fortune.name)) price*=0.93;
7198
price*=Game.eff('buildingCost');
7199
if (Game.hasGod)
7200
{
7201
var godLvl=Game.hasGod('creation');
7202
if (godLvl==1) price*=0.93;
7203
else if (godLvl==2) price*=0.95;
7204
else if (godLvl==3) price*=0.98;
7205
}
7206
return price;
7207
}
7208
7209
Game.storeBulkButton=function(id)
7210
{
7211
if (id==0) Game.buyMode=1;
7212
else if (id==1) Game.buyMode=-1;
7213
else if (id==2) Game.buyBulk=1;
7214
else if (id==3) Game.buyBulk=10;
7215
else if (id==4) Game.buyBulk=100;
7216
else if (id==5) Game.buyBulk=-1;
7217
7218
if (Game.buyMode==1 && Game.buyBulk==-1) Game.buyBulk=100;
7219
7220
if (Game.buyMode==1) l('storeBulkBuy').className='storePreButton storeBulkMode selected'; else l('storeBulkBuy').className='storePreButton storeBulkMode';
7221
if (Game.buyMode==-1) l('storeBulkSell').className='storePreButton storeBulkMode selected'; else l('storeBulkSell').className='storePreButton storeBulkMode';
7222
7223
if (Game.buyBulk==1) l('storeBulk1').className='storePreButton storeBulkAmount selected'; else l('storeBulk1').className='storePreButton storeBulkAmount';
7224
if (Game.buyBulk==10) l('storeBulk10').className='storePreButton storeBulkAmount selected'; else l('storeBulk10').className='storePreButton storeBulkAmount';
7225
if (Game.buyBulk==100) l('storeBulk100').className='storePreButton storeBulkAmount selected'; else l('storeBulk100').className='storePreButton storeBulkAmount';
7226
if (Game.buyBulk==-1) l('storeBulkMax').className='storePreButton storeBulkAmount selected'; else l('storeBulkMax').className='storePreButton storeBulkAmount';
7227
7228
if (Game.buyMode==1)
7229
{
7230
l('storeBulkMax').style.visibility='hidden';
7231
l('products').className='storeSection';
7232
}
7233
else
7234
{
7235
l('storeBulkMax').style.visibility='visible';
7236
l('products').className='storeSection selling';
7237
}
7238
7239
Game.storeToRefresh=1;
7240
if (id!=-1) PlaySound('snd/tick.mp3');
7241
}
7242
Game.BuildStore=function()//create the DOM for the store's buildings
7243
{
7244
//if (typeof showAds!=='undefined') l('store').scrollTop=100;
7245
7246
var str='';
7247
str+='<div id="storeBulk" class="storePre" '+Game.getTooltip(
7248
'<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>'
7249
,'store')+
7250
'>'+
7251
'<div id="storeBulkBuy" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(0);">Buy</div>'+
7252
'<div id="storeBulkSell" class="storePreButton storeBulkMode" '+Game.clickStr+'="Game.storeBulkButton(1);">Sell</div>'+
7253
'<div id="storeBulk1" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(2);">1</div>'+
7254
'<div id="storeBulk10" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(3);">10</div>'+
7255
'<div id="storeBulk100" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(4);">100</div>'+
7256
'<div id="storeBulkMax" class="storePreButton storeBulkAmount" '+Game.clickStr+'="Game.storeBulkButton(5);">all</div>'+
7257
'</div>';
7258
for (var i in Game.Objects)
7259
{
7260
var me=Game.Objects[i];
7261
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>'+
7262
/*'<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>'+*/
7263
'</div>';
7264
}
7265
l('products').innerHTML=str;
7266
7267
Game.storeBulkButton(-1);
7268
7269
var SellAllPrompt=function(id)
7270
{
7271
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);
7272
}
7273
7274
Game.ClickProduct=function(what)
7275
{
7276
Game.ObjectsById[what].buy();
7277
}
7278
7279
for (var i in Game.Objects)
7280
{
7281
var me=Game.Objects[i];
7282
me.l=l('product'+me.id);
7283
7284
//these are a bit messy but ah well
7285
if (!Game.touchEvents)
7286
{
7287
AddEvent(me.l,'click',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));
7288
}
7289
else
7290
{
7291
AddEvent(me.l,'touchend',function(what){return function(e){Game.ClickProduct(what);e.preventDefault();};}(me.id));
7292
}
7293
}
7294
}
7295
7296
Game.RefreshStore=function()//refresh the store's buildings
7297
{
7298
for (var i in Game.Objects)
7299
{
7300
Game.Objects[i].refresh();
7301
}
7302
Game.storeToRefresh=0;
7303
}
7304
7305
Game.ComputeCps=function(base,mult,bonus)
7306
{
7307
if (!bonus) bonus=0;
7308
return ((base)*(Math.pow(2,mult))+bonus);
7309
}
7310
7311
Game.isMinigameReady=function(me)
7312
{return (me.minigameUrl && me.minigameLoaded && me.level>0);}
7313
Game.scriptBindings=[];
7314
Game.LoadMinigames=function()//load scripts for each minigame
7315
{
7316
for (var i in Game.Objects)
7317
{
7318
var me=Game.Objects[i];
7319
if (me.minigameUrl && me.level>0 && !me.minigameLoaded && !me.minigameLoading && !l('minigameScript-'+me.id))
7320
{
7321
me.minigameLoading=true;
7322
//we're only loading the minigame scripts that aren't loaded yet and which have enough building level
7323
//we call this function on building level up and on load
7324
//console.log('Loading script '+me.minigameUrl+'...');
7325
setTimeout(function(me){return function(){
7326
var script=document.createElement('script');
7327
script.id='minigameScript-'+me.id;
7328
Game.scriptBindings['minigameScript-'+me.id]=me;
7329
script.setAttribute('src',me.minigameUrl+'?r='+Game.version);
7330
script.onload=function(me,script){return function(){
7331
if (!me.minigameLoaded) Game.scriptLoaded(me,script);
7332
}}(me,'minigameScript-'+me.id);
7333
document.head.appendChild(script);
7334
}}(me),10);
7335
}
7336
}
7337
}
7338
Game.scriptLoaded=function(who,script)
7339
{
7340
who.minigameLoading=false;
7341
who.minigameLoaded=true;
7342
who.refresh();
7343
who.minigame.launch();
7344
if (who.minigameSave) {who.minigame.reset(true);who.minigame.load(who.minigameSave);who.minigameSave=0;}
7345
}
7346
7347
Game.magicCpS=function(what)
7348
{
7349
/*
7350
if (Game.Objects[what].amount>=250)
7351
{
7352
//this makes buildings give 1% more cookies for every building over 250.
7353
//this turns out to be rather stupidly overpowered.
7354
var n=Game.Objects[what].amount-250;
7355
return 1+Math.pow(1.01,n);
7356
}
7357
else return 1;
7358
*/
7359
return 1;
7360
}
7361
7362
//define objects
7363
new Game.Object('Cursor','cursor|cursors|clicked|[X] extra finger|[X] extra fingers','Autoclicks once every 10 seconds.',0,0,{},15,function(me){
7364
var add=0;
7365
if (Game.Has('Thousand fingers')) add+= 0.1;
7366
if (Game.Has('Million fingers')) add+= 0.5;
7367
if (Game.Has('Billion fingers')) add+= 5;
7368
if (Game.Has('Trillion fingers')) add+= 50;
7369
if (Game.Has('Quadrillion fingers')) add+= 500;
7370
if (Game.Has('Quintillion fingers')) add+= 5000;
7371
if (Game.Has('Sextillion fingers')) add+= 50000;
7372
if (Game.Has('Septillion fingers')) add+= 500000;
7373
if (Game.Has('Octillion fingers')) add+= 5000000;
7374
var mult=1;
7375
var num=0;
7376
for (var i in Game.Objects) {if (Game.Objects[i].name!='Cursor') num+=Game.Objects[i].amount;}
7377
add=add*num;
7378
mult*=Game.GetTieredCpsMult(me);
7379
mult*=Game.magicCpS('Cursor');
7380
mult*=Game.eff('cursorCps');
7381
return Game.ComputeCps(0.1,Game.Has('Reinforced index finger')+Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add)*mult;
7382
},function(){
7383
if (this.amount>=1) Game.Unlock(['Reinforced index finger','Carpal tunnel prevention cream']);
7384
if (this.amount>=10) Game.Unlock('Ambidextrous');
7385
if (this.amount>=25) Game.Unlock('Thousand fingers');
7386
if (this.amount>=50) Game.Unlock('Million fingers');
7387
if (this.amount>=100) Game.Unlock('Billion fingers');
7388
if (this.amount>=150) Game.Unlock('Trillion fingers');
7389
if (this.amount>=200) Game.Unlock('Quadrillion fingers');
7390
if (this.amount>=250) Game.Unlock('Quintillion fingers');
7391
if (this.amount>=300) Game.Unlock('Sextillion fingers');
7392
if (this.amount>=350) Game.Unlock('Septillion fingers');
7393
if (this.amount>=400) Game.Unlock('Octillion fingers');
7394
7395
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');
7396
});
7397
7398
Game.SpecialGrandmaUnlock=15;
7399
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){
7400
var list=['grandma'];
7401
if (Game.Has('Farmer grandmas')) list.push('farmerGrandma');
7402
if (Game.Has('Worker grandmas')) list.push('workerGrandma');
7403
if (Game.Has('Miner grandmas')) list.push('minerGrandma');
7404
if (Game.Has('Cosmic grandmas')) list.push('cosmicGrandma');
7405
if (Game.Has('Transmuted grandmas')) list.push('transmutedGrandma');
7406
if (Game.Has('Altered grandmas')) list.push('alteredGrandma');
7407
if (Game.Has('Grandmas\' grandmas')) list.push('grandmasGrandma');
7408
if (Game.Has('Antigrandmas')) list.push('antiGrandma');
7409
if (Game.Has('Rainbow grandmas')) list.push('rainbowGrandma');
7410
if (Game.Has('Banker grandmas')) list.push('bankGrandma');
7411
if (Game.Has('Priestess grandmas')) list.push('templeGrandma');
7412
if (Game.Has('Witch grandmas')) list.push('witchGrandma');
7413
if (Game.Has('Lucky grandmas')) list.push('luckyGrandma');
7414
if (Game.Has('Metagrandmas')) list.push('metaGrandma');
7415
if (Game.Has('Script grannies')) list.push('scriptGrandma');
7416
if (Game.season=='christmas') list.push('elfGrandma');
7417
if (Game.season=='easter') list.push('bunnyGrandma');
7418
return choose(list)+'.png';
7419
},bg:'grandmaBackground.png',xV:8,yV:8,w:32,rows:3,x:0,y:16},100,function(me){
7420
var mult=1;
7421
for (var i in Game.GrandmaSynergies)
7422
{
7423
if (Game.Has(Game.GrandmaSynergies[i])) mult*=2;
7424
}
7425
if (Game.Has('Bingo center/Research facility')) mult*=4;
7426
if (Game.Has('Ritual rolling pins')) mult*=2;
7427
if (Game.Has('Naughty list')) mult*=2;
7428
7429
if (Game.Has('Elderwort biscuits')) mult*=1.02;
7430
7431
mult*=Game.eff('grandmaCps');
7432
7433
mult*=Game.GetTieredCpsMult(me);
7434
7435
var add=0;
7436
if (Game.Has('One mind')) add+=Game.Objects['Grandma'].amount*0.02;
7437
if (Game.Has('Communal brainsweep')) add+=Game.Objects['Grandma'].amount*0.02;
7438
if (Game.Has('Elder Pact')) add+=Game.Objects['Portal'].amount*0.05;
7439
7440
var num=0;
7441
for (var i in Game.Objects) {if (Game.Objects[i].name!='Grandma') num+=Game.Objects[i].amount;}
7442
//if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
7443
mult*=1+Game.auraMult('Elder Battalion')*0.01*num;
7444
7445
mult*=Game.magicCpS(me.name);
7446
7447
return (me.baseCps+add)*mult;
7448
},function(){
7449
Game.UnlockTiered(this);
7450
});
7451
Game.last.sellFunction=function()
7452
{
7453
Game.Win('Just wrong');
7454
if (this.amount==0)
7455
{
7456
Game.Lock('Elder Pledge');
7457
Game.CollectWrinklers();
7458
Game.pledgeT=0;
7459
}
7460
};
7461
Game.last.iconFunc=function(type){
7462
var grandmaIcons=[[0,1],[0,2],[1,2],[2,2]];
7463
if (type=='off') return [0,1];
7464
return grandmaIcons[Game.elderWrath];
7465
};
7466
7467
7468
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){
7469
var mult=1;
7470
mult*=Game.GetTieredCpsMult(me);
7471
mult*=Game.magicCpS(me.name);
7472
return me.baseCps*mult;
7473
},function(){
7474
Game.UnlockTiered(this);
7475
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7476
});
7477
Game.last.minigameUrl='minigameGarden.js';
7478
Game.last.minigameName='Garden';
7479
7480
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){
7481
var mult=1;
7482
mult*=Game.GetTieredCpsMult(me);
7483
mult*=Game.magicCpS(me.name);
7484
return me.baseCps*mult;
7485
},function(){
7486
Game.UnlockTiered(this);
7487
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7488
});
7489
7490
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){
7491
var mult=1;
7492
mult*=Game.GetTieredCpsMult(me);
7493
mult*=Game.magicCpS(me.name);
7494
return me.baseCps*mult;
7495
},function(){
7496
Game.UnlockTiered(this);
7497
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7498
});
7499
//Game.last.minigameUrl='minigameDungeon.js';//not yet
7500
//Game.last.minigameName='Dungeon';
7501
7502
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){
7503
var mult=1;
7504
mult*=Game.GetTieredCpsMult(me);
7505
mult*=Game.magicCpS(me.name);
7506
return me.baseCps*mult;
7507
},function(){
7508
Game.UnlockTiered(this);
7509
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7510
});
7511
7512
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){
7513
var mult=1;
7514
mult*=Game.GetTieredCpsMult(me);
7515
mult*=Game.magicCpS(me.name);
7516
return me.baseCps*mult;
7517
},function(){
7518
Game.UnlockTiered(this);
7519
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7520
});
7521
Game.last.minigameUrl='minigamePantheon.js';
7522
Game.last.minigameName='Pantheon';
7523
7524
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){
7525
var mult=1;
7526
mult*=Game.GetTieredCpsMult(me);
7527
mult*=Game.magicCpS(me.name);
7528
return me.baseCps*mult;
7529
},function(){
7530
Game.UnlockTiered(this);
7531
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7532
});
7533
Game.last.minigameUrl='minigameGrimoire.js';
7534
Game.last.minigameName='Grimoire';
7535
7536
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){
7537
var mult=1;
7538
mult*=Game.GetTieredCpsMult(me);
7539
mult*=Game.magicCpS(me.name);
7540
return me.baseCps*mult;
7541
},function(){
7542
Game.UnlockTiered(this);
7543
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7544
});
7545
7546
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){
7547
var mult=1;
7548
mult*=Game.GetTieredCpsMult(me);
7549
mult*=Game.magicCpS(me.name);
7550
return me.baseCps*mult;
7551
},function(){
7552
Game.UnlockTiered(this);
7553
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7554
});
7555
7556
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){
7557
var mult=1;
7558
mult*=Game.GetTieredCpsMult(me);
7559
mult*=Game.magicCpS(me.name);
7560
return me.baseCps*mult;
7561
},function(){
7562
Game.UnlockTiered(this);
7563
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7564
});
7565
7566
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){
7567
var mult=1;
7568
mult*=Game.GetTieredCpsMult(me);
7569
mult*=Game.magicCpS(me.name);
7570
return me.baseCps*mult;
7571
},function(){
7572
Game.UnlockTiered(this);
7573
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7574
});
7575
7576
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){
7577
var mult=1;
7578
mult*=Game.GetTieredCpsMult(me);
7579
mult*=Game.magicCpS(me.name);
7580
return me.baseCps*mult;
7581
},function(){
7582
Game.UnlockTiered(this);
7583
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7584
});
7585
Game.last.displayName='<span style="font-size:65%;position:relative;bottom:4px;">Antimatter condenser</span>';//shrink the name since it's so large
7586
7587
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){
7588
var mult=1;
7589
mult*=Game.GetTieredCpsMult(me);
7590
mult*=Game.magicCpS(me.name);
7591
return me.baseCps*mult;
7592
},function(){
7593
Game.UnlockTiered(this);
7594
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7595
});
7596
7597
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){
7598
var mult=1;
7599
mult*=Game.GetTieredCpsMult(me);
7600
mult*=Game.magicCpS(me.name);
7601
return me.baseCps*mult;
7602
},function(){
7603
Game.UnlockTiered(this);
7604
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7605
});
7606
7607
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){
7608
var mult=1;
7609
mult*=Game.GetTieredCpsMult(me);
7610
mult*=Game.magicCpS(me.name);
7611
return me.baseCps*mult;
7612
},function(){
7613
Game.UnlockTiered(this);
7614
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7615
});
7616
7617
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){
7618
var mult=1;
7619
mult*=Game.GetTieredCpsMult(me);
7620
mult*=Game.magicCpS(me.name);
7621
return me.baseCps*mult;
7622
},function(){
7623
Game.UnlockTiered(this);
7624
if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock(this.grandma.name);
7625
});
7626
Game.last.displayName='<span style="font-size:65%;position:relative;bottom:4px;">Javascript console</span>';//shrink the name since it's so large
7627
7628
7629
Game.foolObjects={
7630
'Unknown':{name:'Investment',desc:'You\'re not sure what this does, you just know it means profit.',icon:0},
7631
'Cursor':{name:'Rolling pin',desc:'Essential in flattening dough. The first step in cookie-making.',icon:0},
7632
'Grandma':{name:'Oven',desc:'A crucial element of baking cookies.',icon:1},
7633
'Farm':{name:'Kitchen',desc:'The more kitchens, the more cookies your employees can produce.',icon:2},
7634
'Mine':{name:'Secret recipe',desc:'These give you the edge you need to outsell those pesky competitors.',icon:3},
7635
'Factory':{name:'Factory',desc:'Mass production is the future of baking. Seize the day, and synergize!',icon:4},
7636
'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},
7637
'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},
7638
'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},
7639
'Shipment':{name:'Supermarket',desc:'A gigantic cookie emporium - your very own retail chain.',icon:7},
7640
'Alchemy lab':{name:'Stock share',desc:'You\'re officially on the stock market, and everyone wants a piece!',icon:8},
7641
'Portal':{name:'TV show',desc:'Your cookies have their own sitcom! Hilarious baking hijinks set to the cheesiest laughtrack.',icon:10},
7642
'Time machine':{name:'Theme park',desc:'Cookie theme parks, full of mascots and roller-coasters. Build one, build a hundred!',icon:11},
7643
'Antimatter condenser':{name:'Cookiecoin',desc:'A virtual currency, already replacing regular money in some small countries.',icon:12},
7644
'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},
7645
'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},
7646
'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},
7647
'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},
7648
};
7649
7650
7651
//build store
7652
Game.BuildStore();
7653
7654
//build master bar
7655
var str='';
7656
str+='<div id="buildingsMute" class="shadowFilter" style="position:relative;z-index:100;padding:4px 16px 0px 64px;"></div>';
7657
str+='<div class="separatorBottom" style="position:absolute;bottom:-8px;z-index:0;"></div>';
7658
l('buildingsMaster').innerHTML=str;
7659
7660
//build object displays
7661
var muteStr='<div style="position:absolute;left:8px;bottom:12px;opacity:0.5;">Muted :</div>';
7662
for (var i in Game.Objects)
7663
{
7664
var me=Game.Objects[i];
7665
if (me.id>0)
7666
{
7667
me.canvas=l('rowCanvas'+me.id);
7668
me.ctx=me.canvas.getContext('2d',{alpha:false});
7669
me.pics=[];
7670
var icon=[0*64,me.icon*64];
7671
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>';
7672
//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>';
7673
7674
AddEvent(me.canvas,'mouseover',function(me){return function(){me.mouseOn=true;}}(me));
7675
AddEvent(me.canvas,'mouseout',function(me){return function(){me.mouseOn=false;}}(me));
7676
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));
7677
}
7678
}
7679
Game.mutedBuildingTooltip=function(id)
7680
{
7681
return function(){
7682
var me=Game.ObjectsById[id];
7683
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>';
7684
}
7685
}
7686
l('buildingsMute').innerHTML=muteStr;
7687
7688
/*=====================================================================================
7689
UPGRADES
7690
=======================================================================================*/
7691
Game.upgradesToRebuild=1;
7692
Game.Upgrades=[];
7693
Game.UpgradesById=[];
7694
Game.UpgradesN=0;
7695
Game.UpgradesInStore=[];
7696
Game.UpgradesOwned=0;
7697
Game.Upgrade=function(name,desc,price,icon,buyFunction)
7698
{
7699
this.id=Game.UpgradesN;
7700
this.name=name;
7701
this.desc=desc;
7702
this.baseDesc=this.desc;
7703
this.desc=BeautifyInText(this.baseDesc);
7704
this.basePrice=price;
7705
this.priceLumps=0;//note : doesn't do much on its own, you still need to handle the buying yourself
7706
this.icon=icon;
7707
this.iconFunction=0;
7708
this.buyFunction=buyFunction;
7709
/*this.unlockFunction=unlockFunction;
7710
this.unlocked=(this.unlockFunction?0:1);*/
7711
this.unlocked=0;
7712
this.bought=0;
7713
this.order=this.id;
7714
if (order) this.order=order+this.id*0.001;
7715
this.pool='';//can be '', cookie, toggle, debug, prestige, prestigeDecor, tech, or unused
7716
if (pool) this.pool=pool;
7717
this.power=0;
7718
if (power) this.power=power;
7719
this.vanilla=Game.vanilla;
7720
this.unlockAt=0;
7721
this.techUnlock=[];
7722
this.parents=[];
7723
this.type='upgrade';
7724
this.tier=0;
7725
this.buildingTie=0;//of what building is this a tiered upgrade of ?
7726
7727
Game.last=this;
7728
Game.Upgrades[this.name]=this;
7729
Game.UpgradesById[this.id]=this;
7730
Game.UpgradesN++;
7731
return this;
7732
}
7733
7734
Game.Upgrade.prototype.getPrice=function()
7735
{
7736
var price=this.basePrice;
7737
if (this.priceFunc) price=this.priceFunc(this);
7738
if (price==0) return 0;
7739
if (this.pool!='prestige')
7740
{
7741
if (Game.Has('Toy workshop')) price*=0.95;
7742
if (Game.Has('Five-finger discount')) price*=Math.pow(0.99,Game.Objects['Cursor'].amount/100);
7743
if (Game.Has('Santa\'s dominion')) price*=0.98;
7744
if (Game.Has('Faberge egg')) price*=0.99;
7745
if (Game.Has('Divine sales')) price*=0.99;
7746
if (Game.Has('Fortune #100')) price*=0.99;
7747
if (Game.hasBuff('Haggler\'s luck')) price*=0.98;
7748
if (Game.hasBuff('Haggler\'s misery')) price*=1.02;
7749
//if (Game.hasAura('Master of the Armory')) price*=0.98;
7750
price*=1-Game.auraMult('Master of the Armory')*0.02;
7751
price*=Game.eff('upgradeCost');
7752
if (this.pool=='cookie' && Game.Has('Divine bakeries')) price/=5;
7753
}
7754
return Math.ceil(price);
7755
}
7756
7757
Game.Upgrade.prototype.canBuy=function()
7758
{
7759
if (this.canBuyFunc) return this.canBuyFunc();
7760
if (Game.cookies>=this.getPrice()) return true; else return false;
7761
}
7762
7763
Game.storeBuyAll=function()
7764
{
7765
if (!Game.Has('Inspired checklist')) return false;
7766
for (var i in Game.UpgradesInStore)
7767
{
7768
var me=Game.UpgradesInStore[i];
7769
if (!me.isVaulted() && me.pool!='toggle' && me.pool!='tech') me.buy(1);
7770
}
7771
}
7772
7773
Game.vault=[];
7774
Game.Upgrade.prototype.isVaulted=function()
7775
{
7776
if (Game.vault.indexOf(this.id)!=-1) return true; else return false;
7777
}
7778
Game.Upgrade.prototype.vault=function()
7779
{
7780
if (!this.isVaulted()) Game.vault.push(this.id);
7781
}
7782
Game.Upgrade.prototype.unvault=function()
7783
{
7784
if (this.isVaulted()) Game.vault.splice(Game.vault.indexOf(this.id),1);
7785
}
7786
7787
Game.Upgrade.prototype.click=function(e)
7788
{
7789
if ((e && e.shiftKey) || Game.keys[16])
7790
{
7791
if (this.pool=='toggle' || this.pool=='tech') {}
7792
else if (Game.Has('Inspired checklist'))
7793
{
7794
if (this.isVaulted()) this.unvault();
7795
else this.vault();
7796
Game.upgradesToRebuild=1;
7797
PlaySound('snd/tick.mp3');
7798
}
7799
}
7800
else this.buy();
7801
}
7802
7803
7804
Game.Upgrade.prototype.buy=function(bypass)
7805
{
7806
var success=0;
7807
var cancelPurchase=0;
7808
if (this.clickFunction && !bypass) cancelPurchase=!this.clickFunction();
7809
if (!cancelPurchase)
7810
{
7811
if (this.choicesFunction)
7812
{
7813
if (Game.choiceSelectorOn==this.id)
7814
{
7815
l('toggleBox').style.display='none';
7816
l('toggleBox').innerHTML='';
7817
Game.choiceSelectorOn=-1;
7818
PlaySound('snd/tick.mp3');
7819
}
7820
else
7821
{
7822
Game.choiceSelectorOn=this.id;
7823
var choices=this.choicesFunction();
7824
if (choices.length>0)
7825
{
7826
var selected=0;
7827
for (var i in choices) {if (choices[i].selected) selected=i;}
7828
Game.choiceSelectorChoices=choices;//this is a really dumb way of doing this i am so sorry
7829
Game.choiceSelectorSelected=selected;
7830
var str='';
7831
str+='<div class="close" onclick="Game.UpgradesById['+this.id+'].buy();">x</div>';
7832
str+='<h3>'+this.name+'</h3>'+
7833
'<div class="line"></div>'+
7834
'<h4 id="choiceSelectedName">'+choices[selected].name+'</h4>'+
7835
'<div class="line"></div>';
7836
7837
for (var i in choices)
7838
{
7839
var icon=choices[i].icon;
7840
str+='<div class="crate enabled'+(i==selected?' highlighted':'')+'" style="opacity:1;float:none;display:inline-block;'+(icon[2]?'background-image:url('+icon[2]+');':'')+'background-position:'+(-icon[0]*48)+'px '+(-icon[1]*48)+'px;" '+Game.clickStr+'="Game.UpgradesById['+this.id+'].choicesPick('+i+');PlaySound(\'snd/tick.mp3\');Game.choiceSelectorOn=-1;Game.UpgradesById['+this.id+'].buy();" onMouseOut="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices[Game.choiceSelectorSelected].name;" onMouseOver="l(\'choiceSelectedName\').innerHTML=Game.choiceSelectorChoices['+i+'].name;"'+
7841
'></div>';
7842
}
7843
}
7844
l('toggleBox').innerHTML=str;
7845
l('toggleBox').style.display='block';
7846
l('toggleBox').focus();
7847
Game.tooltip.hide();
7848
PlaySound('snd/tick.mp3');
7849
success=1;
7850
}
7851
}
7852
else if (this.pool!='prestige')
7853
{
7854
var price=this.getPrice();
7855
if (this.canBuy() && !this.bought)
7856
{
7857
Game.Spend(price);
7858
this.bought=1;
7859
if (this.buyFunction) this.buyFunction();
7860
if (this.toggleInto)
7861
{
7862
Game.Lock(this.toggleInto);
7863
Game.Unlock(this.toggleInto);
7864
}
7865
Game.upgradesToRebuild=1;
7866
Game.recalculateGains=1;
7867
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
7868
Game.setOnCrate(0);
7869
Game.tooltip.hide();
7870
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
7871
success=1;
7872
}
7873
}
7874
else
7875
{
7876
var price=this.getPrice();
7877
if (Game.heavenlyChips>=price && !this.bought)
7878
{
7879
Game.heavenlyChips-=price;
7880
Game.heavenlyChipsSpent+=price;
7881
this.unlocked=1;
7882
this.bought=1;
7883
if (this.buyFunction) this.buyFunction();
7884
Game.BuildAscendTree();
7885
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
7886
PlaySound('snd/shimmerClick.mp3');
7887
//PlaySound('snd/buyHeavenly.mp3');
7888
success=1;
7889
}
7890
}
7891
}
7892
if (this.bought && this.activateFunction) this.activateFunction();
7893
return success;
7894
}
7895
Game.Upgrade.prototype.earn=function()//just win the upgrades without spending anything
7896
{
7897
this.unlocked=1;
7898
this.bought=1;
7899
if (this.buyFunction) this.buyFunction();
7900
Game.upgradesToRebuild=1;
7901
Game.recalculateGains=1;
7902
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
7903
}
7904
Game.Upgrade.prototype.unearn=function()//remove the upgrade, but keep it unlocked
7905
{
7906
this.bought=0;
7907
Game.upgradesToRebuild=1;
7908
Game.recalculateGains=1;
7909
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
7910
}
7911
Game.Upgrade.prototype.unlock=function()
7912
{
7913
this.unlocked=1;
7914
Game.upgradesToRebuild=1;
7915
}
7916
Game.Upgrade.prototype.lose=function()
7917
{
7918
this.unlocked=0;
7919
this.bought=0;
7920
Game.upgradesToRebuild=1;
7921
Game.recalculateGains=1;
7922
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
7923
}
7924
Game.Upgrade.prototype.toggle=function()//cheating only
7925
{
7926
if (!this.bought)
7927
{
7928
this.bought=1;
7929
if (this.buyFunction) this.buyFunction();
7930
Game.upgradesToRebuild=1;
7931
Game.recalculateGains=1;
7932
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned++;
7933
PlaySound('snd/buy'+choose([1,2,3,4])+'.mp3',0.75);
7934
if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');
7935
}
7936
else
7937
{
7938
this.bought=0;
7939
Game.upgradesToRebuild=1;
7940
Game.recalculateGains=1;
7941
if (Game.CountsAsUpgradeOwned(this.pool)) Game.UpgradesOwned--;
7942
PlaySound('snd/sell'+choose([1,2,3,4])+'.mp3',0.75);
7943
if (this.pool=='prestige' || this.pool=='debug') PlaySound('snd/shimmerClick.mp3');
7944
}
7945
if (Game.onMenu=='stats') Game.UpdateMenu();
7946
}
7947
7948
Game.CountsAsUpgradeOwned=function(pool)
7949
{
7950
if (pool=='' || pool=='cookie' || pool=='tech') return true; else return false;
7951
}
7952
7953
/*AddEvent(l('toggleBox'),'blur',function()//if we click outside of the selector, close it
7954
{
7955
//this has a couple problems, such as when clicking on the upgrade - this toggles it off and back on instantly
7956
l('toggleBox').style.display='none';
7957
l('toggleBox').innerHTML='';
7958
Game.choiceSelectorOn=-1;
7959
}
7960
);*/
7961
7962
Game.RequiresConfirmation=function(upgrade,prompt)
7963
{
7964
upgrade.clickFunction=function(){Game.Prompt(prompt,[['Yes','Game.UpgradesById['+upgrade.id+'].buy(1);Game.ClosePrompt();'],'No']);return false;};
7965
}
7966
7967
Game.Unlock=function(what)
7968
{
7969
if (typeof what==='string')
7970
{
7971
if (Game.Upgrades[what])
7972
{
7973
if (Game.Upgrades[what].unlocked==0)
7974
{
7975
Game.Upgrades[what].unlocked=1;
7976
Game.upgradesToRebuild=1;
7977
Game.recalculateGains=1;
7978
/*if (Game.prefs.popups) {}
7979
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);*/
7980
}
7981
}
7982
}
7983
else {for (var i in what) {Game.Unlock(what[i]);}}
7984
}
7985
Game.Lock=function(what)
7986
{
7987
if (typeof what==='string')
7988
{
7989
if (Game.Upgrades[what])
7990
{
7991
Game.Upgrades[what].unlocked=0;
7992
Game.upgradesToRebuild=1;
7993
if (Game.Upgrades[what].bought==1 && Game.CountsAsUpgradeOwned(Game.Upgrades[what].pool)) Game.UpgradesOwned--;
7994
Game.Upgrades[what].bought=0;
7995
Game.recalculateGains=1;
7996
}
7997
}
7998
else {for (var i in what) {Game.Lock(what[i]);}}
7999
}
8000
8001
Game.Has=function(what)
8002
{
8003
if (Game.ascensionMode==1 && Game.Upgrades[what].pool=='prestige') return 0;
8004
return (Game.Upgrades[what]?Game.Upgrades[what].bought:0);
8005
}
8006
Game.HasUnlocked=function(what)
8007
{
8008
return (Game.Upgrades[what]?Game.Upgrades[what].unlocked:0);
8009
}
8010
8011
8012
Game.RebuildUpgrades=function()//recalculate the upgrades you can buy
8013
{
8014
Game.upgradesToRebuild=0;
8015
var list=[];
8016
for (var i in Game.Upgrades)
8017
{
8018
var me=Game.Upgrades[i];
8019
if (!me.bought && me.pool!='debug' && me.pool!='prestige' && me.pool!='prestigeDecor' && (!me.lasting || Game.ascensionMode!=1))
8020
{
8021
if (me.unlocked) list.push(me);
8022
}
8023
else if (me.displayFuncWhenOwned && me.bought) list.push(me);
8024
}
8025
var sortMap=function(a,b)
8026
{
8027
var ap=a.pool=='toggle'?a.order:a.getPrice();
8028
var bp=b.pool=='toggle'?b.order:b.getPrice();
8029
if (ap>bp) return 1;
8030
else if (ap<bp) return -1;
8031
else return 0;
8032
}
8033
list.sort(sortMap);
8034
8035
Game.UpgradesInStore=[];
8036
for (var i in list)
8037
{
8038
Game.UpgradesInStore.push(list[i]);
8039
}
8040
var storeStr='';
8041
var toggleStr='';
8042
var techStr='';
8043
var vaultStr='';
8044
8045
if (Game.Has('Inspired checklist'))
8046
{
8047
storeStr+='<div id="storeBuyAll" class="storePre" '+Game.getTooltip(
8048
'<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>'
8049
,'store')+
8050
'>'+
8051
'<div id="storeBuyAllButton" class="storePreButton" '+Game.clickStr+'="Game.storeBuyAll();">Buy all upgrades</div>'+
8052
'</div>';
8053
l('upgrades').classList.add('hasMenu');
8054
}
8055
else l('upgrades').classList.remove('hasMenu');
8056
8057
for (var i in Game.UpgradesInStore)
8058
{
8059
//if (!Game.UpgradesInStore[i]) break;
8060
var me=Game.UpgradesInStore[i];
8061
var str=Game.crate(me,'store','Game.UpgradesById['+me.id+'].click(event);','upgrade'+i);
8062
8063
/*var str='<div class="crate upgrade" '+Game.getTooltip(
8064
'<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>'
8065
,'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>';*/
8066
if (me.pool=='toggle') toggleStr+=str; else if (me.pool=='tech') techStr+=str; else
8067
{
8068
if (me.isVaulted() && Game.Has('Inspired checklist')) vaultStr+=str; else storeStr+=str;
8069
}
8070
}
8071
8072
l('upgrades').innerHTML=storeStr;
8073
l('toggleUpgrades').innerHTML=toggleStr;
8074
if (toggleStr=='') l('toggleUpgrades').style.display='none'; else l('toggleUpgrades').style.display='block';
8075
l('techUpgrades').innerHTML=techStr;
8076
if (techStr=='') l('techUpgrades').style.display='none'; else l('techUpgrades').style.display='block';
8077
l('vaultUpgrades').innerHTML=vaultStr;
8078
if (vaultStr=='') l('vaultUpgrades').style.display='none'; else l('vaultUpgrades').style.display='block';
8079
}
8080
8081
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))
8082
//note : the cookie will not be added to the list if it contains locked:1 (use for seasonal cookies and such)
8083
8084
Game.NewUpgradeCookie=function(obj)
8085
{
8086
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);
8087
upgrade.power=obj.power;
8088
upgrade.pool='cookie';
8089
var toPush={cookies:obj.price/20,name:obj.name};
8090
if (obj.require) toPush.require=obj.require;
8091
if (obj.season) toPush.season=obj.season;
8092
if (!obj.locked) Game.UnlockAt.push(toPush);
8093
return upgrade;
8094
}
8095
8096
//tiered upgrades system
8097
//each building has several upgrade tiers
8098
//all upgrades in the same tier have the same color, unlock threshold and price multiplier
8099
Game.Tiers={
8100
1:{name:'Plain',unlock:1,achievUnlock:1,iconRow:0,color:'#ccb3ac',price: 10},
8101
2:{name:'Berrylium',unlock:5,achievUnlock:50,iconRow:1,color:'#ff89e7',price: 50},
8102
3:{name:'Blueberrylium',unlock:25,achievUnlock:100,iconRow:2,color:'#00deff',price: 500},
8103
4:{name:'Chalcedhoney',unlock:50,achievUnlock:150,iconRow:13,color:'#ffcc2f',price: 50000},
8104
5:{name:'Buttergold',unlock:100,achievUnlock:200,iconRow:14,color:'#e9d673',price: 5000000},
8105
6:{name:'Sugarmuck',unlock:150,achievUnlock:250,iconRow:15,color:'#a8bf91',price: 500000000},
8106
7:{name:'Jetmint',unlock:200,achievUnlock:300,iconRow:16,color:'#60ff50',price: 500000000000},
8107
8:{name:'Cherrysilver',unlock:250,achievUnlock:350,iconRow:17,color:'#f01700',price: 500000000000000},
8108
9:{name:'Hazelrald',unlock:300,achievUnlock:400,iconRow:18,color:'#9ab834',price: 500000000000000000},
8109
10:{name:'Mooncandy',unlock:350,achievUnlock:450,iconRow:19,color:'#7e7ab9',price: 500000000000000000000},
8110
11:{name:'Astrofudge',unlock:400,achievUnlock:500,iconRow:28,color:'#9a3316',price: 5000000000000000000000000},
8111
12:{name:'Alabascream',unlock:450,achievUnlock:550,iconRow:30,color:'#c1a88c',price: 50000000000000000000000000000},
8112
13:{name:'Iridyum',unlock:500,achievUnlock:600,iconRow:31,color:'#adb1b3',price: 500000000000000000000000000000000},
8113
'synergy1':{name:'Synergy I',unlock:15,iconRow:20,color:'#008595',special:1,req:'Synergies Vol. I',price: 200000},
8114
'synergy2':{name:'Synergy II',unlock:75,iconRow:29,color:'#008595',special:1,req:'Synergies Vol. II',price: 200000000000},
8115
'fortune':{name:'Fortune',unlock:-1,iconRow:32,color:'#9ab834',special:1,price: 77777777777777777777777777777},
8116
};
8117
for (var i in Game.Tiers){Game.Tiers[i].upgrades=[];}
8118
Game.GetIcon=function(type,tier)
8119
{
8120
var col=0;
8121
if (type=='Kitten') col=18; else col=Game.Objects[type].iconColumn;
8122
return [col,Game.Tiers[tier].iconRow];
8123
}
8124
Game.SetTier=function(building,tier)
8125
{
8126
if (!Game.Objects[building]) alert('No building named '+building);
8127
Game.last.tier=tier;
8128
Game.last.buildingTie=Game.Objects[building];
8129
if (Game.last.type=='achievement') Game.Objects[building].tieredAchievs[tier]=Game.last;
8130
else Game.Objects[building].tieredUpgrades[tier]=Game.last;
8131
}
8132
Game.MakeTiered=function(upgrade,tier,col)
8133
{
8134
upgrade.tier=tier;
8135
if (typeof col!=='undefined') upgrade.icon=[col,Game.Tiers[tier].iconRow];
8136
}
8137
Game.TieredUpgrade=function(name,desc,building,tier)
8138
{
8139
var upgrade=new Game.Upgrade(name,desc,Game.Objects[building].basePrice*Game.Tiers[tier].price,Game.GetIcon(building,tier));
8140
Game.SetTier(building,tier);
8141
if (!upgrade.buildingTie1 && building) upgrade.buildingTie1=Game.Objects[building];
8142
if (tier=='fortune' && building) Game.Objects[building].fortune=upgrade;
8143
return upgrade;
8144
}
8145
Game.SynergyUpgrade=function(name,desc,building1,building2,tier)
8146
{
8147
/*
8148
creates a new upgrade that :
8149
-unlocks when you have tier.unlock of building1 and building2
8150
-is priced at (building1.price*10+building2.price*1)*tier.price (formerly : Math.sqrt(building1.price*building2.price)*tier.price)
8151
-gives +(0.1*building1)% cps to building2 and +(5*building2)% cps to building1
8152
-if building2 is below building1 in worth, swap them
8153
*/
8154
//if (Game.Objects[building1].basePrice>Game.Objects[building2].basePrice) {var temp=building2;building2=building1;building1=temp;}
8155
var b1=Game.Objects[building1];
8156
var b2=Game.Objects[building2];
8157
if (b1.basePrice>b2.basePrice) {b1=Game.Objects[building2];b2=Game.Objects[building1];}//swap
8158
8159
desc=
8160
(b1.plural.charAt(0).toUpperCase()+b1.plural.slice(1))+' gain <b>+5% CpS</b> per '+b2.name.toLowerCase()+'.<br>'+
8161
(b2.plural.charAt(0).toUpperCase()+b2.plural.slice(1))+' gain <b>+0.1% CpS</b> per '+b1.name.toLowerCase()+'.'+
8162
desc;
8163
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
8164
upgrade.tier=tier;
8165
upgrade.buildingTie1=b1;
8166
upgrade.buildingTie2=b2;
8167
upgrade.priceFunc=function(){return (this.buildingTie1.basePrice*10+this.buildingTie2.basePrice*1)*Game.Tiers[this.tier].price*(Game.Has('Chimera')?0.98:1);};
8168
Game.Objects[building1].synergies.push(upgrade);
8169
Game.Objects[building2].synergies.push(upgrade);
8170
//Game.SetTier(building1,tier);
8171
return upgrade;
8172
}
8173
Game.GetTieredCpsMult=function(me)
8174
{
8175
var mult=1;
8176
for (var i in me.tieredUpgrades) {if (!Game.Tiers[me.tieredUpgrades[i].tier].special && Game.Has(me.tieredUpgrades[i].name)) mult*=2;}
8177
for (var i in me.synergies)
8178
{
8179
var syn=me.synergies[i];
8180
if (Game.Has(syn.name))
8181
{
8182
if (syn.buildingTie1.name==me.name) mult*=(1+0.05*syn.buildingTie2.amount);
8183
else if (syn.buildingTie2.name==me.name) mult*=(1+0.001*syn.buildingTie1.amount);
8184
}
8185
}
8186
if (me.fortune && Game.Has(me.fortune.name)) mult*=1.07;
8187
if (me.grandma && Game.Has(me.grandma.name)) mult*=(1+Game.Objects['Grandma'].amount*0.01*(1/(me.id-1)));
8188
return mult;
8189
}
8190
Game.UnlockTiered=function(me)
8191
{
8192
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);}
8193
for (var i in me.tieredAchievs) {if (me.amount>=Game.Tiers[me.tieredAchievs[i].tier].achievUnlock) Game.Win(me.tieredAchievs[i].name);}
8194
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);}
8195
}
8196
8197
8198
8199
var pool='';
8200
var power=0;
8201
8202
//define upgrades
8203
//WARNING : do NOT add new upgrades in between, this breaks the saves. Add them at the end !
8204
var order=100;//this is used to set the order in which the items are listed
8205
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);
8206
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);
8207
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);
8208
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);
8209
new Game.Upgrade('Million fingers','The mouse and cursors gain <b>+0.5</b> cookies for each non-cursor object owned.<q>clickityclickity</q>',10000000,[0,14]);Game.MakeTiered(Game.last,5,0);
8210
new Game.Upgrade('Billion fingers','The mouse and cursors gain <b>+5</b> cookies for each non-cursor object owned.<q>clickityclickityclickity</q>',100000000,[0,15]);Game.MakeTiered(Game.last,6,0);
8211
new Game.Upgrade('Trillion fingers','The mouse and cursors gain <b>+50</b> cookies for each non-cursor object owned.<q>clickityclickityclickityclickity</q>',1000000000,[0,16]);Game.MakeTiered(Game.last,7,0);
8212
8213
order=200;
8214
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);
8215
new Game.TieredUpgrade('Steel-plated rolling pins','Grandmas are <b>twice</b> as efficient.<q>Just what you kneaded.</q>','Grandma',2);
8216
new Game.TieredUpgrade('Lubricated dentures','Grandmas are <b>twice</b> as efficient.<q>squish</q>','Grandma',3);
8217
8218
order=300;
8219
new Game.TieredUpgrade('Cheap hoes','Farms are <b>twice</b> as efficient.<q>Rake in the dough!</q>','Farm',1);
8220
new Game.TieredUpgrade('Fertilizer','Farms are <b>twice</b> as efficient.<q>It\'s chocolate, I swear.</q>','Farm',2);
8221
new Game.TieredUpgrade('Cookie trees','Farms are <b>twice</b> as efficient.<q>A relative of the breadfruit.</q>','Farm',3);
8222
8223
order=500;
8224
new Game.TieredUpgrade('Sturdier conveyor belts','Factories are <b>twice</b> as efficient.<q>You\'re going places.</q>','Factory',1);
8225
new Game.TieredUpgrade('Child labor','Factories are <b>twice</b> as efficient.<q>Cheaper, healthier workforce.</q>','Factory',2);
8226
new Game.TieredUpgrade('Sweatshop','Factories are <b>twice</b> as efficient.<q>Slackers will be terminated.</q>','Factory',3);
8227
8228
order=400;
8229
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);
8230
new Game.TieredUpgrade('Megadrill','Mines are <b>twice</b> as efficient.<q>You\'re in deep.</q>','Mine',2);
8231
new Game.TieredUpgrade('Ultradrill','Mines are <b>twice</b> as efficient.<q>Finally caved in?</q>','Mine',3);
8232
8233
order=600;
8234
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);
8235
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);
8236
new Game.TieredUpgrade('Frequent flyer','Shipments are <b>twice</b> as efficient.<q>Come back soon!</q>','Shipment',3);
8237
8238
order=700;
8239
new Game.TieredUpgrade('Antimony','Alchemy labs are <b>twice</b> as efficient.<q>Actually worth a lot of mony.</q>','Alchemy lab',1);
8240
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);
8241
new Game.TieredUpgrade('True chocolate','Alchemy labs are <b>twice</b> as efficient.<q>The purest form of cacao.</q>','Alchemy lab',3);
8242
8243
order=800;
8244
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);
8245
new Game.TieredUpgrade('Insane oatling workers','Portals are <b>twice</b> as efficient.<q>ARISE, MY MINIONS!</q>','Portal',2);
8246
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);
8247
8248
order=900;
8249
new Game.TieredUpgrade('Flux capacitors','Time machines are <b>twice</b> as efficient.<q>Bake to the future.</q>','Time machine',1);
8250
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);
8251
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);
8252
8253
order=20000;
8254
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);
8255
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);
8256
8257
order=10000;
8258
Game.NewUpgradeCookie({name:'Plain cookies',desc:'We all gotta start somewhere.',icon:[2,3],power: 1, price: 999999});
8259
Game.NewUpgradeCookie({name:'Sugar cookies',desc:'Tasty, if a little unimaginative.',icon:[7,3],power: 1, price: 999999*5});
8260
Game.NewUpgradeCookie({name:'Oatmeal raisin cookies',desc:'No raisin to hate these.',icon:[0,3],power: 1, price: 9999999});
8261
Game.NewUpgradeCookie({name:'Peanut butter cookies',desc:'Get yourself some jam cookies!',icon:[1,3],power: 1, price: 9999999*5});
8262
Game.NewUpgradeCookie({name:'Coconut cookies',desc:'Flaky, but not unreliable. Some people go crazy for these.',icon:[3,3],power: 2, price: 99999999});
8263
order=10001;
8264
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});
8265
Game.NewUpgradeCookie({name:'Macadamia nut cookies',desc:'They\'re macadamn delicious!',icon:[5,3],power: 2, price: 999999999});
8266
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});
8267
Game.NewUpgradeCookie({name:'White chocolate macadamia nut cookies',desc:'Orteil\'s favorite.',icon:[8,3],power: 2, price: 9999999999});
8268
Game.NewUpgradeCookie({name:'All-chocolate cookies',desc:'CHOCOVERDOSE.',icon:[9,3],power: 2, price: 9999999999*5});
8269
8270
order=100;
8271
new Game.Upgrade('Quadrillion fingers','The mouse and cursors gain <b>+500</b> cookies for each non-cursor object owned.<q>clickityclickityclickityclickityclick</q>',10000000000,[0,17]);Game.MakeTiered(Game.last,8,0);
8272
8273
order=200;new Game.TieredUpgrade('Prune juice','Grandmas are <b>twice</b> as efficient.<q>Gets me going.</q>','Grandma',4);
8274
order=300;new Game.TieredUpgrade('Genetically-modified cookies','Farms are <b>twice</b> as efficient.<q>All-natural mutations.</q>','Farm',4);
8275
order=500;new Game.TieredUpgrade('Radium reactors','Factories are <b>twice</b> as efficient.<q>Gives your cookies a healthy glow.</q>','Factory',4);
8276
order=400;new Game.TieredUpgrade('Ultimadrill','Mines are <b>twice</b> as efficient.<q>Pierce the heavens, etc.</q>','Mine',4);
8277
order=600;new Game.TieredUpgrade('Warp drive','Shipments are <b>twice</b> as efficient.<q>To boldly bake.</q>','Shipment',4);
8278
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);
8279
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);
8280
order=900;new Game.TieredUpgrade('Causality enforcer','Time machines are <b>twice</b> as efficient.<q>What happened, happened.</q>','Time machine',4);
8281
8282
order=5000;
8283
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]);
8284
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]);
8285
8286
order=20000;
8287
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);
8288
8289
order=10020;
8290
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: 4, price: 99999999999});
8291
Game.NewUpgradeCookie({name:'White chocolate-coated cookies',desc:'These dazzling cookies absolutely glisten with flavor.',icon:[11,3],power: 4, price: 99999999999});
8292
8293
Game.GrandmaSynergies=[];
8294
Game.GrandmaSynergy=function(name,desc,building)
8295
{
8296
var building=Game.Objects[building];
8297
var grandmaNumber=(building.id-1);
8298
if (grandmaNumber==1) grandmaNumber='grandma';
8299
else grandmaNumber+=' grandmas';
8300
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>';
8301
8302
var upgrade=new Game.Upgrade(name,desc,building.basePrice*Game.Tiers[2].price,[10,9],function(){Game.Objects['Grandma'].redraw();});
8303
building.grandma=upgrade;
8304
upgrade.buildingTie=building;
8305
Game.GrandmaSynergies.push(upgrade.name);
8306
return upgrade;
8307
}
8308
8309
order=250;
8310
Game.GrandmaSynergy('Farmer grandmas','A nice farmer to grow more cookies.','Farm');
8311
Game.GrandmaSynergy('Miner grandmas','A nice miner to dig more cookies.','Mine');
8312
Game.GrandmaSynergy('Worker grandmas','A nice worker to manufacture more cookies.','Factory');
8313
Game.GrandmaSynergy('Cosmic grandmas','A nice thing to... uh... cookies.','Shipment');
8314
Game.GrandmaSynergy('Transmuted grandmas','A nice golden grandma to convert into more cookies.','Alchemy lab');
8315
Game.GrandmaSynergy('Altered grandmas','a NiCe GrAnDmA tO bA##########','Portal');
8316
Game.GrandmaSynergy('Grandmas\' grandmas','A nice grandma\'s nice grandma to bake double the cookies.','Time machine');
8317
8318
order=14000;
8319
Game.baseResearchTime=Game.fps*60*30;
8320
Game.SetResearch=function(what,time)
8321
{
8322
if (Game.Upgrades[what] && !Game.Has(what))
8323
{
8324
Game.researchT=Game.baseResearchTime;
8325
if (Game.Has('Persistent memory')) Game.researchT=Math.ceil(Game.baseResearchTime/10);
8326
if (Game.Has('Ultrascience')) Game.researchT=Game.fps*5;
8327
Game.nextResearch=Game.Upgrades[what].id;
8328
if (Game.prefs.popups) Game.Popup('Research has begun.');
8329
else Game.Notify('Research has begun','Your bingo center/research facility is conducting experiments.',[9,0]);
8330
}
8331
}
8332
8333
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;
8334
8335
order=15000;
8336
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';
8337
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';
8338
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';
8339
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';
8340
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';
8341
//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?');};
8342
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>');
8343
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';
8344
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';
8345
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';
8346
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';
8347
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()
8348
{
8349
Game.elderWrath=0;
8350
Game.pledges++;
8351
Game.pledgeT=Game.getPledgeDuration();
8352
Game.Unlock('Elder Covenant');
8353
Game.CollectWrinklers();
8354
Game.storeToRefresh=1;
8355
});
8356
Game.getPledgeDuration=function(){return Game.fps*60*(Game.Has('Sacrificial rolling pins')?60:30);}
8357
Game.last.pool='toggle';
8358
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>';}
8359
Game.last.timerDisplay=function(){if (!Game.Upgrades['Elder Pledge'].bought) return -1; else return 1-Game.pledgeT/Game.getPledgeDuration();}
8360
Game.last.priceFunc=function(){return Math.pow(8,Math.min(Game.pledges+2,14));}
8361
8362
Game.last.descFunc=function(){
8363
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;
8364
};
8365
8366
8367
order=150;
8368
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);
8369
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);
8370
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);
8371
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);
8372
8373
order=40000;
8374
new Game.Upgrade('Ultrascience','Research takes only <b>5 seconds</b>.<q>YEAH, SCIENCE!</q>',7,[9,2]);//debug purposes only
8375
Game.last.pool='debug';
8376
8377
order=10020;
8378
Game.NewUpgradeCookie({name:'Eclipse cookies',desc:'Look to the cookie.',icon:[0,4],power: 2, price: 99999999999*5});
8379
Game.NewUpgradeCookie({name:'Zebra cookies',desc:'...',icon:[1,4],power: 2, price: 999999999999});
8380
8381
order=100;
8382
new Game.Upgrade('Quintillion fingers','The mouse and cursors gain <b>+5000</b> cookies for each non-cursor object owned.<q>man, just go click click click click click, it\'s real easy, man.</q>',10000000000000,[0,18]);Game.MakeTiered(Game.last,9,0);
8383
8384
order=40000;
8385
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
8386
Game.last.pool='debug';
8387
8388
order=15000;
8389
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()
8390
{
8391
Game.pledgeT=0;
8392
Game.Lock('Revoke Elder Covenant');
8393
Game.Unlock('Revoke Elder Covenant');
8394
Game.Lock('Elder Pledge');
8395
Game.Win('Elder calm');
8396
Game.CollectWrinklers();
8397
Game.storeToRefresh=1;
8398
});
8399
Game.last.pool='toggle';
8400
8401
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()
8402
{
8403
Game.Lock('Elder Covenant');
8404
Game.Unlock('Elder Covenant');
8405
});
8406
Game.last.pool='toggle';
8407
8408
order=5000;
8409
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]);
8410
8411
order=15000;
8412
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]);
8413
8414
order=10020;
8415
Game.NewUpgradeCookie({name:'Snickerdoodles',desc:'True to their name.',icon:[2,4],power: 2, price: 999999999999*5});
8416
Game.NewUpgradeCookie({name:'Stroopwafels',desc:'If it ain\'t dutch, it ain\'t much.',icon:[3,4],power: 2, price: 9999999999999});
8417
Game.NewUpgradeCookie({name:'Macaroons',desc:'Not to be confused with macarons.<br>These have coconut, okay?',icon:[4,4],power: 2, price: 9999999999999*5});
8418
8419
order=40000;
8420
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
8421
Game.last.pool='debug';
8422
8423
order=10031;
8424
Game.NewUpgradeCookie({name:'Empire biscuits',desc:'For your growing cookie empire, of course!',icon:[5,4],power: 2, price: 99999999999999});
8425
Game.NewUpgradeCookie({name:'British tea biscuits',desc:'Quite.',icon:[6,4],require:'Tin of british tea biscuits',power: 2, price: 99999999999999});
8426
Game.NewUpgradeCookie({name:'Chocolate british tea biscuits',desc:'Yes, quite.',icon:[7,4],require:Game.last.name,power: 2, price: 99999999999999});
8427
Game.NewUpgradeCookie({name:'Round british tea biscuits',desc:'Yes, quite riveting.',icon:[8,4],require:Game.last.name,power: 2, price: 99999999999999});
8428
Game.NewUpgradeCookie({name:'Round chocolate british tea biscuits',desc:'Yes, quite riveting indeed.',icon:[9,4],require:Game.last.name,power: 2, price: 99999999999999});
8429
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});
8430
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});
8431
8432
order=1000;
8433
new Game.TieredUpgrade('Sugar bosons','Antimatter condensers are <b>twice</b> as efficient.<q>Sweet firm bosons.</q>','Antimatter condenser',1);
8434
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);
8435
new Game.TieredUpgrade('Large macaron collider','Antimatter condensers are <b>twice</b> as efficient.<q>How singular!</q>','Antimatter condenser',3);
8436
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);
8437
8438
order=255;
8439
Game.GrandmaSynergy('Antigrandmas','A mean antigrandma to vomit more cookies.','Antimatter condenser');
8440
8441
order=10020;
8442
Game.NewUpgradeCookie({name:'Madeleines',desc:'Unforgettable!',icon:[12,3],power: 2, price: 99999999999999*5});
8443
Game.NewUpgradeCookie({name:'Palmiers',desc:'Palmier than you!',icon:[13,3],power: 2, price: 99999999999999*5});
8444
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});
8445
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});
8446
8447
order=20000;
8448
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);
8449
8450
8451
order=100;
8452
new Game.Upgrade('Sextillion fingers','The mouse and cursors gain <b>+50000</b> cookies for each non-cursor object owned.<q>sometimes<br>things just<br>click</q>',10000000000000000,[0,19]);Game.MakeTiered(Game.last,10,0);
8453
8454
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);
8455
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);
8456
order=500;new Game.TieredUpgrade('Recombobulators','Factories are <b>twice</b> as efficient.<q>A major part of cookie recombobulation.</q>','Factory',5);
8457
order=400;new Game.TieredUpgrade('H-bomb mining','Mines are <b>twice</b> as efficient.<q>Questionable efficiency, but spectacular nonetheless.</q>','Mine',5);
8458
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);
8459
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);
8460
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);
8461
order=900;new Game.TieredUpgrade('Yestermorrow comparators','Time machines are <b>twice</b> as efficient.<q>Fortnights into milleniums.</q>','Time machine',5);
8462
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);
8463
8464
order=150;
8465
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);
8466
8467
order=10020;
8468
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});
8469
Game.NewUpgradeCookie({name:'Sagalongs',desc:'Grandma\'s favorite?',icon:[15,3],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8470
Game.NewUpgradeCookie({name:'Shortfoils',desc:'Foiled again!',icon:[15,4],require:'Box of brand biscuits',power: 3, price: 9999999999999999});
8471
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});
8472
8473
order=40000;
8474
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
8475
Game.last.pool='debug';
8476
8477
order=10030;
8478
Game.NewUpgradeCookie({name:'Fig gluttons',desc:'Got it all figured out.',icon:[17,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8479
Game.NewUpgradeCookie({name:'Loreols',desc:'Because, uh... they\'re worth it?',icon:[16,3],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8480
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});
8481
Game.NewUpgradeCookie({name:'Grease\'s cups',desc:'Extra-greasy peanut butter.',icon:[16,4],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
8482
8483
order=30000;
8484
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;
8485
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;
8486
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;
8487
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;
8488
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;
8489
8490
order=10100;
8491
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});
8492
Game.NewUpgradeCookie({name:'Ghost cookies',desc:'They\'re something strange, but they look pretty good!',locked:1,icon:[13,8],power: 2, price: 444444444444});
8493
Game.NewUpgradeCookie({name:'Bat cookies',desc:'The cookies this town deserves.',locked:1,icon:[14,8],power: 2, price: 444444444444});
8494
Game.NewUpgradeCookie({name:'Slime cookies',desc:'The incredible melting cookies!',locked:1,icon:[15,8],power: 2, price: 444444444444});
8495
Game.NewUpgradeCookie({name:'Pumpkin cookies',desc:'Not even pumpkin-flavored. Tastes like glazing. Yeugh.',locked:1,icon:[16,8],power: 2, price: 444444444444});
8496
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});
8497
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});
8498
8499
Game.halloweenDrops=['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies'];
8500
8501
Game.GetHowManyHalloweenDrops=function()
8502
{
8503
var num=0;
8504
for (var i in Game.halloweenDrops) {if (Game.Has(Game.halloweenDrops[i])) num++;}
8505
return num;
8506
}
8507
/*for (var i in Game.halloweenDrops)
8508
{
8509
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;};
8510
}*/
8511
8512
order=0;
8513
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';
8514
8515
order=40000;
8516
new Game.Upgrade('Wrinkler doormat','Wrinklers spawn much more frequently.<q>You\'re such a pushover.</q>',7,[19,8]);//debug purposes only
8517
Game.last.pool='debug';
8518
8519
order=10200;
8520
Game.NewUpgradeCookie({name:'Christmas tree biscuits',desc:'Whose pine is it anyway?',locked:1,icon:[12,10],power:2,price: 252525252525});
8521
Game.NewUpgradeCookie({name:'Snowflake biscuits',desc:'Mass-produced to be unique in every way.',locked:1,icon:[13,10],power:2,price: 252525252525});
8522
Game.NewUpgradeCookie({name:'Snowman biscuits',desc:'It\'s frosted. Doubly so.',locked:1,icon:[14,10],power:2,price: 252525252525});
8523
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});
8524
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});
8525
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});
8526
Game.NewUpgradeCookie({name:'Present biscuits',desc:'The prequel to future biscuits. Watch out!',locked:1,icon:[18,10],power:2,price: 252525252525});
8527
8528
order=10020;
8529
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});
8530
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});
8531
8532
order=25000;
8533
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()
8534
{
8535
var drop=choose(Game.santaDrops);
8536
Game.Unlock(drop);
8537
if (Game.prefs.popups) Game.Popup('In the festive hat, you find...<br>a festive test tube<br>and '+drop+'.');
8538
else Game.Notify('In the festive hat, you find...','a festive test tube<br>and <b>'+drop+'</b>.',Game.Upgrades[drop].icon);
8539
});
8540
8541
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]);
8542
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]);
8543
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]);
8544
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]);
8545
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]);
8546
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]);
8547
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]);
8548
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;});
8549
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;});
8550
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]);
8551
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]);
8552
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]);
8553
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]);
8554
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]);
8555
8556
order=40000;
8557
new Game.Upgrade('Reindeer season','Reindeer spawn much more frequently.<q>Go, Cheater! Go, Hacker and Faker!</q>',7,[12,9]);//debug purposes only
8558
Game.last.pool='debug';
8559
8560
order=25000;
8561
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;});
8562
8563
order=10300;
8564
var heartPower=function(){
8565
var pow=2;
8566
if (Game.Has('Starlove')) pow=3;
8567
if (Game.hasGod)
8568
{
8569
var godLvl=Game.hasGod('seasons');
8570
if (godLvl==1) pow*=1.3;
8571
else if (godLvl==2) pow*=1.2;
8572
else if (godLvl==3) pow*=1.1;
8573
}
8574
return pow;
8575
};
8576
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});
8577
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});
8578
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});
8579
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});
8580
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});
8581
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});
8582
8583
Game.heartDrops=['Pure heart biscuits','Ardent heart biscuits','Sour heart biscuits','Weeping heart biscuits','Golden heart biscuits','Eternal heart biscuits'];
8584
8585
Game.GetHowManyHeartDrops=function()
8586
{
8587
var num=0;
8588
for (var i in Game.heartDrops) {if (Game.Has(Game.heartDrops[i])) num++;}
8589
return num;
8590
}
8591
/*for (var i in Game.heartDrops)
8592
{
8593
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;};
8594
}*/
8595
8596
order=1100;
8597
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);
8598
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);
8599
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);
8600
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);
8601
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);
8602
8603
order=255;
8604
Game.GrandmaSynergy('Rainbow grandmas','A luminous grandma to sparkle into cookies.','Prism');
8605
8606
order=24000;
8607
Game.seasonTriggerBasePrice=1000000000;//1111111111;
8608
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'];
8609
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';
8610
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';
8611
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';
8612
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';
8613
8614
8615
order=40000;
8616
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
8617
Game.last.pool='debug';
8618
8619
8620
order=20000;
8621
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);
8622
8623
order=100;
8624
new Game.Upgrade('Septillion fingers','The mouse and cursors gain <b>+500000</b> cookies for each non-cursor object owned.<q>[cursory flavor text]</q>',10000000000000000000,[12,20]);Game.MakeTiered(Game.last,11,0);
8625
new Game.Upgrade('Octillion fingers','The mouse and cursors gain <b>+5000000</b> cookies for each non-cursor object owned.<q>Turns out you <b>can</b> quite put your finger on it.</q>',10000000000000000000000,[12,19]);Game.MakeTiered(Game.last,12,0);
8626
8627
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);
8628
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);
8629
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);
8630
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);
8631
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);
8632
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);
8633
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);
8634
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);
8635
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);
8636
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);
8637
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);
8638
order=1100;
8639
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);
8640
8641
order=10032;
8642
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});
8643
Game.NewUpgradeCookie({name:'Lemon macarons',desc:'Tastefully sour, delightful treats.',icon:[23,3],require:'Box of macarons', power:3,price: 9999999});
8644
Game.NewUpgradeCookie({name:'Chocolate macarons',desc:'They\'re like tiny sugary burgers!',icon:[24,3],require:'Box of macarons', power:3,price: 9999999999});
8645
Game.NewUpgradeCookie({name:'Pistachio macarons',desc:'Pistachio shells now removed after multiple complaints.',icon:[22,4],require:'Box of macarons', power:3,price: 9999999999999});
8646
Game.NewUpgradeCookie({name:'Hazelnut macarons',desc:'These go especially well with coffee.',icon:[23,4],require:'Box of macarons', power:3,price: 9999999999999999});
8647
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});
8648
8649
order=40000;
8650
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
8651
Game.last.pool='debug';
8652
8653
8654
order=24000;
8655
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';
8656
8657
var eggPrice=999999999999;
8658
var eggPrice2=99999999999999;
8659
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]);
8660
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]);
8661
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]);
8662
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]);
8663
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]);
8664
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]);
8665
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]);
8666
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]);
8667
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]);
8668
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]);
8669
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]);
8670
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]);
8671
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]);
8672
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;});
8673
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]);
8674
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]);
8675
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]);
8676
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()
8677
{
8678
var cookies=Game.cookies*0.05;
8679
if (Game.prefs.popups) Game.Popup('The chocolate egg bursts into<br>'+Beautify(cookies)+'!');
8680
else Game.Notify('Chocolate egg','The egg bursts into <b>'+Beautify(cookies)+'</b> cookies!',Game.Upgrades['Chocolate egg'].icon);
8681
Game.Earn(cookies);
8682
});
8683
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]);
8684
Game.last.descFunc=function(){
8685
var day=Math.floor((Date.now()-Game.startDate)/1000/10)*10/60/60/24;
8686
day=Math.min(day,100);
8687
var n=(1-Math.pow(1-day/100,3))*0.1;
8688
return '<div style="text-align:center;">Current boost : <b>+'+Beautify(n*100,1)+'%</b></div><div class="line"></div>'+this.desc;
8689
};
8690
new Game.Upgrade('"egg"','<b>+9 CpS</b><q>hey it\'s "egg"</q>',eggPrice2,[20,12]);
8691
8692
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"'];
8693
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'];
8694
Game.rareEggDrops=['Golden goose egg','Faberge egg','Wrinklerspawn','Cookie egg','Omelette','Chocolate egg','Century egg','"egg"'];
8695
8696
Game.GetHowManyEggs=function()
8697
{
8698
var num=0;
8699
for (var i in Game.easterEggs) {if (Game.Has(Game.easterEggs[i])) num++;}
8700
return num;
8701
}
8702
for (var i in Game.eggDrops)//scale egg prices to how many eggs you have
8703
{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(2,Game.GetHowManyEggs())*999;}}
8704
//{Game.Upgrades[Game.eggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,2)*Game.cookiesPs*60*5;}}
8705
for (var i in Game.rareEggDrops)
8706
{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(3,Game.GetHowManyEggs())*999;}}
8707
//{Game.Upgrades[Game.rareEggDrops[i]].priceFunc=function(){return Math.pow(Game.GetHowManyEggs()+1,3)*Game.cookiesPs*60*5;}}
8708
8709
/*for (var i in Game.easterEggs)
8710
{
8711
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;};
8712
}*/
8713
8714
Game.DropEgg=function(failRate)
8715
{
8716
failRate*=1/Game.dropRateMult();
8717
if (Game.season!='easter') return;
8718
if (Game.HasAchiev('Hide & seek champion')) failRate*=0.7;
8719
if (Game.Has('Omelette')) failRate*=0.9;
8720
if (Game.Has('Starspawn')) failRate*=0.9;
8721
if (Game.hasGod)
8722
{
8723
var godLvl=Game.hasGod('seasons');
8724
if (godLvl==1) failRate*=0.9;
8725
else if (godLvl==2) failRate*=0.95;
8726
else if (godLvl==3) failRate*=0.97;
8727
}
8728
if (Math.random()>=failRate)
8729
{
8730
var drop='';
8731
if (Math.random()<0.1) drop=choose(Game.rareEggDrops);
8732
else drop=choose(Game.eggDrops);
8733
if (Game.Has(drop) || Game.HasUnlocked(drop))//reroll if we have it
8734
{
8735
if (Math.random()<0.1) drop=choose(Game.rareEggDrops);
8736
else drop=choose(Game.eggDrops);
8737
}
8738
if (Game.Has(drop) || Game.HasUnlocked(drop)) return;
8739
Game.Unlock(drop);
8740
if (Game.prefs.popups) Game.Popup('You find :<br>'+drop+'!');
8741
else Game.Notify('You found an egg!','<b>'+drop+'</b>',Game.Upgrades[drop].icon);
8742
}
8743
};
8744
8745
order=10032;
8746
Game.NewUpgradeCookie({name:'Caramel macarons',desc:'The saltiest, chewiest of them all.',icon:[25,3],require:'Box of macarons', power:3,price: 9999999999999999999999});
8747
Game.NewUpgradeCookie({name:'Licorice macarons',desc:'Also known as "blackarons".',icon:[25,4],require:'Box of macarons', power:3,price: 9999999999999999999999999});
8748
8749
8750
order=525;
8751
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);
8752
new Game.TieredUpgrade('Scissor-resistant credit cards','Banks are <b>twice</b> as efficient.<q>For those truly valued customers.</q>','Bank',2);
8753
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);
8754
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);
8755
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);
8756
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);
8757
8758
order=550;
8759
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);
8760
new Game.TieredUpgrade('Sacrifices','Temples are <b>twice</b> as efficient.<q>What\'s a life to a gigaton of cookies?</q>','Temple',2);
8761
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);
8762
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);
8763
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);
8764
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);
8765
8766
order=575;
8767
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);
8768
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);
8769
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);
8770
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);
8771
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);
8772
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);
8773
8774
order=250;
8775
Game.GrandmaSynergy('Banker grandmas','A nice banker to cash in more cookies.','Bank');
8776
Game.GrandmaSynergy('Priestess grandmas','A nice priestess to praise the one true Baker in the sky.','Temple');
8777
Game.GrandmaSynergy('Witch grandmas','A nice witch to cast a zip, and a zoop, and poof! Cookies.','Wizard tower');
8778
8779
8780
8781
order=0;
8782
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'];
8783
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'];
8784
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'];
8785
8786
order=10020;
8787
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: 4,price: 9999999999999999*5});
8788
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: 4,price: 9999999999999999*5});
8789
Game.NewUpgradeCookie({name:'Ladyfingers',desc:'Cleaned and sanitized so well you\'d swear they\'re actual biscuits.',icon:[27,3],power: 3,price: 99999999999999999});
8790
Game.NewUpgradeCookie({name:'Tuiles',desc:'These never go out of tile.',icon:[27,4],power: 3,price: 99999999999999999*5});
8791
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});
8792
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});
8793
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});
8794
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});
8795
8796
order=0;
8797
var desc='Placing an upgrade in this slot will make its effects <b>permanent</b> across all playthroughs.<br><b>Click to activate.</b>';
8798
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);};
8799
new Game.Upgrade('Permanent upgrade slot II',desc, 2000,[1,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot I'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(1);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(1);};
8800
new Game.Upgrade('Permanent upgrade slot III',desc, 30000,[2,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot II'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(2);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(2);};
8801
new Game.Upgrade('Permanent upgrade slot IV',desc, 400000,[3,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot III'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(3);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(3);};
8802
new Game.Upgrade('Permanent upgrade slot V',desc, 5000000,[4,10]);Game.last.pool='prestige';Game.last.parents=['Permanent upgrade slot IV'];Game.last.iconFunction=function(){return Game.PermanentSlotIcon(4);};Game.last.activateFunction=function(){Game.AssignPermanentSlot(4);};
8803
8804
var slots=['Permanent upgrade slot I','Permanent upgrade slot II','Permanent upgrade slot III','Permanent upgrade slot IV','Permanent upgrade slot V'];
8805
for (var i=0;i<slots.length;i++)
8806
{
8807
Game.Upgrades[slots[i]].descFunc=function(i){return function(){
8808
if (Game.permanentUpgrades[i]==-1) return this.desc;
8809
var upgrade=Game.UpgradesById[Game.permanentUpgrades[i]];
8810
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;
8811
};}(i);
8812
}
8813
8814
Game.PermanentSlotIcon=function(slot)
8815
{
8816
if (Game.permanentUpgrades[slot]==-1) return [slot,10];
8817
return Game.UpgradesById[Game.permanentUpgrades[slot]].icon;
8818
}
8819
Game.AssignPermanentSlot=function(slot)
8820
{
8821
PlaySound('snd/tick.mp3');
8822
Game.tooltip.hide();
8823
var list=[];
8824
for (var i in Game.Upgrades)
8825
{
8826
var me=Game.Upgrades[i];
8827
if (me.bought && me.unlocked && !me.noPerm && (me.pool=='' || me.pool=='cookie'))
8828
{
8829
var fail=0;
8830
for (var ii in Game.permanentUpgrades) {if (Game.permanentUpgrades[ii]==me.id) fail=1;}//check if not already in another permaslot
8831
if (!fail) list.push(me);
8832
}
8833
}
8834
8835
var sortMap=function(a,b)
8836
{
8837
if (a.order>b.order) return 1;
8838
else if (a.order<b.order) return -1;
8839
else return 0;
8840
}
8841
list.sort(sortMap);
8842
8843
var upgrades='';
8844
for (var i in list)
8845
{
8846
var me=list[i];
8847
upgrades+=Game.crate(me,'','PlaySound(\'snd/tick.mp3\');Game.PutUpgradeInPermanentSlot('+me.id+','+slot+');','upgradeForPermanent'+me.id);
8848
}
8849
var upgrade=Game.permanentUpgrades[slot];
8850
Game.SelectingPermanentUpgrade=upgrade;
8851
Game.Prompt('<h3>Pick an upgrade to make permanent</h3>'+
8852
8853
'<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>'+
8854
'<div class="block crateBox" style="overflow-y:scroll;float:left;clear:left;width:317px;padding:0px;height:250px;">'+upgrades+'</div>'+
8855
'<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>'
8856
,[['Confirm','Game.permanentUpgrades['+slot+']=Game.SelectingPermanentUpgrade;Game.BuildAscendTree();Game.ClosePrompt();'],'Cancel'],0,'widePrompt');
8857
}
8858
Game.SelectingPermanentUpgrade=-1;
8859
Game.PutUpgradeInPermanentSlot=function(upgrade,slot)
8860
{
8861
Game.SelectingPermanentUpgrade=upgrade;
8862
l('upgradeToSlotWrap').innerHTML='';
8863
l('upgradeToSlotWrap').style.display=(upgrade==-1?'none':'block');
8864
l('upgradeToSlotNone').style.display=(upgrade!=-1?'none':'block');
8865
l('upgradeToSlotWrap').innerHTML=(Game.crate(Game.UpgradesById[upgrade==-1?0:upgrade],'','','upgradeToSlot'));
8866
}
8867
8868
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'];
8869
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'];
8870
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'];
8871
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'];
8872
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'];
8873
8874
var angelPriceFactor=7;
8875
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>.';}
8876
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'];
8877
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'];
8878
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'];
8879
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'];
8880
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'];
8881
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'];
8882
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'];
8883
8884
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';
8885
8886
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';
8887
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'];
8888
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'];
8889
8890
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'];
8891
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'];
8892
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'];
8893
8894
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'];
8895
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'];
8896
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'];
8897
8898
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;
8899
8900
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'];
8901
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'];
8902
8903
8904
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);
8905
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);
8906
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);
8907
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);
8908
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);
8909
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);
8910
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);
8911
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);
8912
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);
8913
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);
8914
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);
8915
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);
8916
order=1100;
8917
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);
8918
8919
8920
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);
8921
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);
8922
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);
8923
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);
8924
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);
8925
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);
8926
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);
8927
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);
8928
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);
8929
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);
8930
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);
8931
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);
8932
order=1100;
8933
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);
8934
8935
8936
order=20000;
8937
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);
8938
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);
8939
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);
8940
8941
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';
8942
8943
order=25100;
8944
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]);
8945
8946
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'];
8947
8948
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'];
8949
8950
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'];
8951
8952
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=[];
8953
8954
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'];
8955
8956
order=10300;
8957
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});
8958
8959
8960
order=40000;
8961
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]);
8962
Game.last.pool='toggle';Game.last.toggleInto='Golden switch [on]';
8963
Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}
8964
var func=function(){
8965
if (Game.Has('Residual luck'))
8966
{
8967
var bonus=0;
8968
var upgrades=Game.goldenCookieUpgrades;
8969
for (var i in upgrades) {if (Game.Has(upgrades[i])) bonus++;}
8970
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;
8971
}
8972
return this.desc;
8973
};
8974
Game.last.descFunc=func;
8975
8976
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]);
8977
Game.last.pool='toggle';Game.last.toggleInto='Golden switch [off]';
8978
Game.last.priceFunc=function(){return Game.cookiesPs*60*60;}
8979
Game.last.descFunc=func;
8980
8981
order=50000;
8982
new Game.Upgrade('Milk selector','Lets you pick what flavor of milk to display.',0,[1,8]);
8983
Game.last.descFunc=function(){
8984
var choice=this.choicesFunction()[Game.milkType];
8985
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;
8986
};
8987
8988
Game.last.pool='toggle';
8989
Game.last.choicesFunction=function()
8990
{
8991
var choices=[];
8992
choices[0]={name:'Automatic',icon:[0,7]};
8993
choices[1]={name:'Plain milk',icon:[1,8]};
8994
choices[2]={name:'Chocolate milk',icon:[2,8]};
8995
choices[3]={name:'Raspberry milk',icon:[3,8]};
8996
choices[4]={name:'Orange milk',icon:[4,8]};
8997
choices[5]={name:'Caramel milk',icon:[5,8]};
8998
choices[6]={name:'Banana milk',icon:[6,8]};
8999
choices[7]={name:'Lime milk',icon:[7,8]};
9000
choices[8]={name:'Blueberry milk',icon:[8,8]};
9001
choices[9]={name:'Strawberry milk',icon:[9,8]};
9002
choices[10]={name:'Vanilla milk',icon:[10,8]};
9003
9004
if (Game.Has('Fanciful dairy selection'))
9005
{
9006
choices[11]={name:'Zebra milk',icon:[10,7]};
9007
choices[12]={name:'Cosmic milk',icon:[9,7]};
9008
choices[13]={name:'Flaming milk',icon:[8,7]};
9009
choices[14]={name:'Sanguine milk',icon:[7,7]};
9010
choices[15]={name:'Midas milk',icon:[6,7]};
9011
choices[16]={name:'Midnight milk',icon:[5,7]};
9012
choices[17]={name:'Green inferno milk',icon:[4,7]};
9013
choices[18]={name:'Frostfire milk',icon:[3,7]};
9014
9015
choices[24]={name:'Soy milk',icon:[27,23]};
9016
}
9017
9018
choices[19]={name:'Honey milk',icon:[21,23]};
9019
choices[20]={name:'Coffee milk',icon:[22,23]};
9020
choices[21]={name:'Tea milk',icon:[23,23]};
9021
choices[22]={name:'Coconut milk',icon:[24,23]};
9022
choices[23]={name:'Cherry milk',icon:[25,23]};
9023
9024
choices[25]={name:'Spiced milk',icon:[26,23]};
9025
choices[26]={name:'Maple milk',icon:[28,23]};
9026
choices[27]={name:'Mint milk',icon:[29,23]};
9027
9028
choices[Game.milkType].selected=1;
9029
return choices;
9030
}
9031
Game.last.choicesPick=function(id)
9032
{Game.milkType=id;}
9033
9034
Game.MilksByChoice={
9035
0:{pic:'milkPlain'},
9036
1:{pic:'milkPlain'},
9037
2:{pic:'milkChocolate'},
9038
3:{pic:'milkRaspberry'},
9039
4:{pic:'milkOrange'},
9040
5:{pic:'milkCaramel'},
9041
6:{pic:'milkBanana'},
9042
7:{pic:'milkLime'},
9043
8:{pic:'milkBlueberry'},
9044
9:{pic:'milkStrawberry'},
9045
10:{pic:'milkVanilla'},
9046
11:{pic:'milkZebra'},
9047
12:{pic:'milkStars'},
9048
13:{pic:'milkFire'},
9049
14:{pic:'milkBlood'},
9050
15:{pic:'milkGold'},
9051
16:{pic:'milkBlack'},
9052
17:{pic:'milkGreenFire'},
9053
18:{pic:'milkBlueFire'},
9054
19:{pic:'milkHoney'},
9055
20:{pic:'milkCoffee'},
9056
21:{pic:'milkTea'},
9057
22:{pic:'milkCoconut'},
9058
23:{pic:'milkCherry'},
9059
24:{pic:'milkSoy'},
9060
25:{pic:'milkSpiced'},
9061
26:{pic:'milkMaple'},
9062
27:{pic:'milkMint'},
9063
};
9064
9065
9066
order=10300;
9067
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,locked:1});
9068
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,locked:1});
9069
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,locked:1});
9070
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,locked:1});
9071
9072
order=10020;
9073
Game.NewUpgradeCookie({name:'Gingersnaps',desc:'Cookies with a soul. Probably.',icon:[29,10],power: 4,price: 99999999999999999999});
9074
Game.NewUpgradeCookie({name:'Cinnamon cookies',desc:'The secret is in the patented swirly glazing.',icon:[23,8],power: 4,price: 99999999999999999999*5});
9075
Game.NewUpgradeCookie({name:'Vanity cookies',desc:'One tiny candied fruit sits atop this decadent cookie.',icon:[22,8],power: 4,price: 999999999999999999999});
9076
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});
9077
Game.NewUpgradeCookie({name:'Pinwheel cookies',desc:'Bringing you the dizzying combination of brown flavor and beige taste!',icon:[22,10],power: 4,price: 9999999999999999999999});
9078
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});
9079
9080
order=10030;
9081
Game.NewUpgradeCookie({name:'Digits',desc:'Three flavors, zero phalanges.',icon:[26,8],require:'Box of brand biscuits',power: 2, price: 999999999999999*5});
9082
9083
order=10029;
9084
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});
9085
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});
9086
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});
9087
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});
9088
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});
9089
9090
order=10020;
9091
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});
9092
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});
9093
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});
9094
9095
9096
var desc=function(totalHours){
9097
var hours=totalHours%24;
9098
var days=Math.floor(totalHours/24);
9099
var str=hours+(hours==1?' hour':' hours');
9100
if (days>0) str=days+(days==1?' day':' days')+' and '+str;
9101
return 'You retain optimal cookie production while the game is closed for twice as long, for a total of <b>'+str+'</b>.';
9102
}
9103
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'];
9104
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'];
9105
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'];
9106
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'];
9107
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'];
9108
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'];
9109
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'];
9110
9111
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'];
9112
9113
order=49900;
9114
new Game.Upgrade('Golden cookie sound selector','Lets you change the sound golden cookies make when they spawn.',0,[28,6]);
9115
Game.last.descFunc=function(){
9116
var choice=this.choicesFunction()[Game.chimeType];
9117
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;
9118
};
9119
9120
Game.last.pool='toggle';
9121
Game.last.choicesFunction=function()
9122
{
9123
var choices=[];
9124
choices[0]={name:'No sound',icon:[0,7]};
9125
choices[1]={name:'Chime',icon:[22,6]};
9126
9127
choices[Game.chimeType].selected=1;
9128
return choices;
9129
}
9130
Game.last.choicesPick=function(id)
9131
{Game.chimeType=id;}
9132
9133
9134
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'];
9135
9136
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=[];
9137
9138
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'];
9139
9140
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'];
9141
9142
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);
9143
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);
9144
9145
9146
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'];
9147
9148
9149
order=5000;
9150
Game.SynergyUpgrade('Future almanacs','<q>Lets you predict optimal planting times. It\'s crazy what time travel can do!</q>','Farm','Time machine','synergy1');
9151
Game.SynergyUpgrade('Rain prayer','<q>A deeply spiritual ceremonial involving complicated dance moves and high-tech cloud-busting lasers.</q>','Farm','Temple','synergy2');
9152
9153
Game.SynergyUpgrade('Seismic magic','<q>Surprise earthquakes are an old favorite of wizardly frat houses.</q>','Mine','Wizard tower','synergy1');
9154
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');
9155
9156
Game.SynergyUpgrade('Quantum electronics','<q>Your machines won\'t even be sure if they\'re on or off!</q>','Factory','Antimatter condenser','synergy1');
9157
Game.SynergyUpgrade('Temporal overclocking','<q>Introduce more quickitude in your system for increased speedation of fastness.</q>','Factory','Time machine','synergy2');
9158
9159
Game.SynergyUpgrade('Contracts from beyond','<q>Make sure to read the fine print!</q>','Bank','Portal','synergy1');
9160
Game.SynergyUpgrade('Printing presses','<q>Fake bills so real, they\'re almost worth the ink they\'re printed with.</q>','Bank','Factory','synergy2');
9161
9162
Game.SynergyUpgrade('Paganism','<q>Some deities are better left unworshipped.</q>','Temple','Portal','synergy1');
9163
Game.SynergyUpgrade('God particle','<q>Turns out God is much tinier than we thought, I guess.</q>','Temple','Antimatter condenser','synergy2');
9164
9165
Game.SynergyUpgrade('Arcane knowledge','<q>Some things were never meant to be known - only mildly speculated.</q>','Wizard tower','Alchemy lab','synergy1');
9166
Game.SynergyUpgrade('Magical botany','<q>Already known in some reactionary newspapers as "the wizard\'s GMOs".</q>','Wizard tower','Farm','synergy2');
9167
9168
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');
9169
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');
9170
9171
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');
9172
Game.SynergyUpgrade('Gold fund','<q>If gold is the backbone of the economy, cookies, surely, are its hip joints.</q>','Alchemy lab','Bank','synergy2');
9173
9174
Game.SynergyUpgrade('Infernal crops','<q>Sprinkle regularly with FIRE.</q>','Portal','Farm','synergy1');
9175
Game.SynergyUpgrade('Abysmal glimmer','<q>Someone, or something, is staring back at you.<br>Perhaps at all of us.</q>','Portal','Prism','synergy2');
9176
9177
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');
9178
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');
9179
9180
Game.SynergyUpgrade('Extra physics funding','<q>Time to put your money where your particle colliders are.</q>','Antimatter condenser','Bank','synergy1');
9181
Game.SynergyUpgrade('Chemical proficiency','<q>Discover exciting new elements, such as Fleshmeltium, Inert Shampoo Byproduct #17 and Carbon++!</q>','Antimatter condenser','Alchemy lab','synergy2');
9182
9183
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');
9184
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');
9185
9186
9187
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'];
9188
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'];
9189
9190
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;
9191
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;
9192
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'];
9193
9194
order=40000;
9195
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
9196
Game.last.pool='debug';
9197
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
9198
Game.last.pool='debug';
9199
9200
order=10300;
9201
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,locked:1});
9202
9203
order=10030;
9204
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});
9205
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});
9206
9207
order=10020;
9208
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});
9209
Game.NewUpgradeCookie({name:'Moravian spice cookies',desc:'Popular for being the world\'s moravianest cookies.',icon:[26,13],power: 4,price: 9999999999999999999999999});
9210
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});
9211
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});
9212
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});
9213
9214
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'];
9215
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'];
9216
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'];
9217
9218
//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
9219
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);};
9220
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);};
9221
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);};
9222
9223
order=50000;
9224
new Game.Upgrade('Background selector','Lets you pick which wallpaper to display.',0,[29,5]);
9225
Game.last.descFunc=function(){
9226
var choice=this.choicesFunction()[Game.bgType];
9227
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;
9228
};
9229
9230
Game.last.pool='toggle';
9231
Game.last.choicesFunction=function()
9232
{
9233
var choices=[];
9234
choices[0]={name:'Automatic',icon:[0,7]};
9235
choices[1]={name:'Blue',icon:[21,21]};
9236
choices[2]={name:'Red',icon:[22,21]};
9237
choices[3]={name:'White',icon:[23,21]};
9238
choices[4]={name:'Black',icon:[24,21]};
9239
choices[5]={name:'Gold',icon:[25,21]};
9240
choices[6]={name:'Grandmas',icon:[26,21]};
9241
choices[7]={name:'Displeased grandmas',icon:[27,21]};
9242
choices[8]={name:'Angered grandmas',icon:[28,21]};
9243
choices[9]={name:'Money',icon:[29,21]};
9244
choices[Game.bgType].selected=1;
9245
return choices;
9246
}
9247
Game.last.choicesPick=function(id)
9248
{Game.bgType=id;}
9249
9250
Game.BGsByChoice={
9251
0:{pic:'bgBlue'},
9252
1:{pic:'bgBlue'},
9253
2:{pic:'bgRed'},
9254
3:{pic:'bgWhite'},
9255
4:{pic:'bgBlack'},
9256
5:{pic:'bgGold'},
9257
6:{pic:'grandmas1'},
9258
7:{pic:'grandmas2'},
9259
8:{pic:'grandmas3'},
9260
9:{pic:'bgMoney'},
9261
};
9262
9263
order=255;
9264
Game.GrandmaSynergy('Lucky grandmas','A fortunate grandma that always seems to find more cookies.','Chancemaker');
9265
9266
order=1200;
9267
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);
9268
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);
9269
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);
9270
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);
9271
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);
9272
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);
9273
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);
9274
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);
9275
9276
order=5000;
9277
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');
9278
9279
order=20000;
9280
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);
9281
9282
order=99999;
9283
var years=Math.floor((Date.now()-new Date(2013,7,8))/(1000*60*60*24*365));
9284
//only updates on page load
9285
//may behave strangely on leap years
9286
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);
9287
9288
9289
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);
9290
9291
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);
9292
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);
9293
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);
9294
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);
9295
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);
9296
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);
9297
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);
9298
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);
9299
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);
9300
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);
9301
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);
9302
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);
9303
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);
9304
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);
9305
9306
order=20000;
9307
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);
9308
9309
order=5000;
9310
Game.SynergyUpgrade('Charm quarks','<q>They\'re after your lucky quarks!</q>','Chancemaker','Antimatter condenser','synergy2');
9311
9312
9313
order=10020;
9314
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});
9315
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});
9316
Game.NewUpgradeCookie({name:'Candy cookies',desc:'These melt in your hands just a little bit.',icon:[23,16],power: 4,price: 9999999999999999999999999999});
9317
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});
9318
Game.NewUpgradeCookie({name:'One chip cookies',desc:'You get one.',icon:[25,16],power: 1,price: 99999999999999999999999999999});
9319
9320
9321
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'];
9322
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'];
9323
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'];
9324
9325
order=40050;
9326
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]);
9327
Game.last.priceLumps=1;
9328
Game.last.pool='toggle';Game.last.toggleInto=0;
9329
Game.last.canBuyFunc=function(){return Game.lumps>=1;};
9330
Game.last.clickFunction=Game.spendLump(1,'activate the sugar frenzy',function()
9331
{
9332
Game.Upgrades['Sugar frenzy'].buy(1);
9333
buff=Game.gainBuff('sugar frenzy',60*60,3);
9334
if (Game.prefs.popups) Game.Popup('Sugar frenzy activated!');
9335
else Game.Notify('Sugar frenzy!','CpS x3 for 1 hour!',[29,14]);
9336
});
9337
9338
order=10020;
9339
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});
9340
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});
9341
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});
9342
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});
9343
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});
9344
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});
9345
9346
9347
order=40000;
9348
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
9349
Game.last.buyFunction=function(){if (Game.Objects['Farm'].minigameLoaded){Game.Objects['Farm'].minigame.computeStepT();}}
9350
Game.last.pool='debug';
9351
9352
order=150;
9353
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);
9354
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);
9355
9356
order=20000;
9357
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);
9358
9359
order=10030;
9360
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});
9361
9362
order=10020;
9363
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});
9364
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});
9365
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});
9366
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});
9367
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});
9368
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});
9369
9370
order=10200;
9371
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>';
9372
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>';
9373
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>';
9374
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>';
9375
9376
order=23000;
9377
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]);
9378
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]);
9379
9380
order=10200;
9381
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>';
9382
9383
var gardenDrops=['Elderwort biscuits','Bakeberry cookies','Duketater cookies','Green yeast digestives','Fern tea','Ichor syrup','Wheat slims'];
9384
for (var i in gardenDrops)//scale by CpS
9385
{
9386
var it=Game.Upgrades[gardenDrops[i]];
9387
it.priceFunc=function(cost){return function(){return cost*Game.cookiesPs*60;}}(it.basePrice);
9388
it.baseDesc=it.baseDesc.replace('<q>','<br>Cost scales with CpS.<q>');
9389
it.desc=BeautifyInText(it.baseDesc);
9390
it.lasting=true;
9391
}
9392
9393
9394
order=10300;
9395
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,locked:1});
9396
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,locked:1});
9397
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,locked:1});
9398
9399
9400
9401
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);
9402
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);
9403
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);
9404
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);
9405
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);
9406
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);
9407
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);
9408
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);
9409
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);
9410
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);
9411
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);
9412
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);
9413
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);
9414
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);
9415
9416
order=20000;
9417
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);
9418
9419
9420
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'];
9421
9422
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 IV'];
9423
9424
order=10300;
9425
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,locked:1});
9426
9427
order=10020;
9428
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});
9429
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});
9430
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});
9431
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});
9432
9433
9434
order=10000;
9435
//early cookies that unlock at the same time as coconut cookies; meant to boost early game a little bit
9436
Game.NewUpgradeCookie({name:'Almond cookies',desc:'Sometimes you feel like one of these. Sometimes you don\'t.',icon:[21,27],power: 2, price: 99999999});
9437
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});
9438
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});
9439
9440
9441
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'];
9442
9443
9444
9445
9446
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);
9447
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 areate the soil!</q>','Farm',11);
9448
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);
9449
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);
9450
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);
9451
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);
9452
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);
9453
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);
9454
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);
9455
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);
9456
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);
9457
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);
9458
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);
9459
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);
9460
9461
9462
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';
9463
9464
order=255;
9465
Game.GrandmaSynergy('Metagrandmas','A fractal grandma to make more grandmas to make more cookies.','Fractal engine');
9466
9467
order=1300;
9468
new Game.TieredUpgrade('Metabakeries','Fractal engines are <b>twice</b> as efficient.<q>They practically bake themselves!</q>','Fractal engine',1);
9469
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);
9470
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);
9471
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);
9472
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);
9473
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);
9474
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);
9475
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);
9476
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);
9477
new Game.TieredUpgrade('Endless book of prose','Fractal engines are <b>twice</b> as efficient.','Fractal engine',10);
9478
Game.last.descFunc=function(){
9479
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 : ';
9480
var n=35;
9481
var i=Math.floor(Game.T*0.1);
9482
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>';
9483
};
9484
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);
9485
9486
order=5000;
9487
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');
9488
//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');
9489
Game.SynergyUpgrade('Mice clicking mice','','Fractal engine','Cursor','synergy2');
9490
Game.last.descFunc=function(){
9491
Math.seedrandom(Game.seed+'-blasphemouse');
9492
if (Math.random()<0.3) {Math.seedrandom();return this.desc+'<q>Absolutely blasphemouse!</q>';}
9493
else {Math.seedrandom();return this.desc+'<q>Absolutely blasphemous!</q>';}
9494
};
9495
9496
9497
order=10020;
9498
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});
9499
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});
9500
9501
9502
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'];
9503
9504
order=10020;
9505
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});
9506
9507
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(){
9508
var n=5;
9509
for (var i in Game.Objects)
9510
{
9511
if (Game.Objects[i].level>=10) n++;
9512
}
9513
return n;
9514
};Game.last.pseudoCookie=true;
9515
Game.last.descFunc=function(){
9516
var n=5;
9517
for (var i in Game.Objects)
9518
{
9519
if (Game.Objects[i].level>=10) n++;
9520
}
9521
return '<div style="text-align:center;">Current : <b>+'+Beautify(n)+'%</b><div class="line"></div></div>'+this.desc;
9522
};
9523
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'];
9524
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'];
9525
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'];
9526
9527
order=10040;
9528
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)});
9529
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)});
9530
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)});
9531
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)});
9532
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)});
9533
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)});
9534
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)});
9535
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)});
9536
9537
order=10050;
9538
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)});
9539
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)});
9540
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)});
9541
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)});
9542
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)});
9543
9544
order=10060;
9545
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)});
9546
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)});
9547
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)});
9548
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)});
9549
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)});
9550
9551
9552
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'];
9553
9554
9555
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'];
9556
9557
order=40005;
9558
var func=function(){
9559
var boost=50;
9560
var resist=0;
9561
if (Game.Has('Reinforced membrane')) {boost+=10;resist+=10;}
9562
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.'):'');
9563
};
9564
new Game.Upgrade('Shimmering veil [off]','',1000000,[9,10]);
9565
Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [on]';
9566
Game.last.priceFunc=function(){return Game.unbuffedCps*60*60*24;}
9567
Game.last.descFunc=func;
9568
new Game.Upgrade('Shimmering veil [on]','',0,[9,10]);
9569
Game.last.pool='toggle';Game.last.toggleInto='Shimmering veil [off]';
9570
Game.last.descFunc=func;
9571
9572
Game.loseShimmeringVeil=function(context)
9573
{
9574
if (!Game.Has('Shimmering veil')) return false;
9575
if (!Game.Has('Shimmering veil [off]') && Game.Has('Shimmering veil [on]')) return false;
9576
if (Game.Has('Reinforced membrane'))
9577
{
9578
if (context=='shimmer') Math.seedrandom(Game.seed+'/'+Game.goldenClicks);
9579
else if (context=='click') Math.seedrandom(Game.seed+'/'+Game.cookieClicks);
9580
if (Math.random()<0.1)
9581
{
9582
Game.Notify('The reinforced membrane protects the shimmering veil.','',[7,10]);
9583
Game.Win('Thick-skinned');
9584
return false;
9585
}
9586
Math.seedrandom();
9587
}
9588
var me=Game.Upgrades['Shimmering veil [on]'];
9589
me.bought=1;
9590
//Game.Upgrades[me.toggleInto].bought=false;
9591
Game.Lock(me.toggleInto);
9592
Game.Unlock(me.toggleInto);
9593
Game.Notify('The shimmering veil disappears...','',[9,10]);
9594
Game.upgradesToRebuild=1;
9595
Game.recalculateGains=1;
9596
PlaySound('snd/spellFail.mp3',0.75);
9597
}
9598
9599
9600
var getCookiePrice=function(level){return 999999999999999999999999999999999999999*Math.pow(10,(level-1)/2);};
9601
9602
order=10020;
9603
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)});
9604
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)});
9605
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)});
9606
Game.NewUpgradeCookie({name:'Earl Grey cookies',desc:'Captain Picard\'s favorite.',icon:[24,31],power: 5,price: getCookiePrice(4)});
9607
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)});
9608
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)});
9609
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)});
9610
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)});
9611
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)});
9612
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)});
9613
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)});
9614
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)});
9615
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)});
9616
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)});
9617
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)});
9618
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)});
9619
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)});
9620
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)});
9621
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)});
9622
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)});
9623
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)});
9624
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)});
9625
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)});
9626
Game.NewUpgradeCookie({name:'Milk cookies',desc:'Best eaten with a tall glass of chocolate.',icon:[31,31],power: 5,price: getCookiePrice(21)});
9627
9628
order=9999;
9629
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});
9630
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});
9631
9632
9633
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'];
9634
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'];
9635
9636
9637
order=255;
9638
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');
9639
9640
order=1400;
9641
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);
9642
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);
9643
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);
9644
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);
9645
new Game.TieredUpgrade('Syntactic sugar','Javascript consoles are <b>twice</b> as efficient.<q>Tastier code for tastier cookies.</q>','Javascript console',5);
9646
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);
9647
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);
9648
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);
9649
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);
9650
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);
9651
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);
9652
9653
order=5000;
9654
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');
9655
Game.SynergyUpgrade('Tombola computing','','Javascript console','Chancemaker','synergy2');
9656
Game.last.descFunc=function(){
9657
Math.seedrandom(Game.seed+'-tombolacomputing');
9658
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'])+'.)';
9659
Math.seedrandom();
9660
return this.desc+'<q>Like quantum computing, but more fun.<br>'+str+'</q>';
9661
};
9662
9663
order=10020;
9664
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)});
9665
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)});
9666
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)});
9667
9668
order=10060;
9669
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)});
9670
9671
order=10050;
9672
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)});
9673
9674
order=10030;
9675
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});
9676
9677
order=20000;
9678
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);
9679
9680
9681
order=10020;
9682
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;
9683
9684
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)});
9685
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)});
9686
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)});
9687
9688
order=10030;
9689
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});
9690
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: 999999999999999999999999999999*5});
9691
9692
order=10060;
9693
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 candies.',icon:[30,10],require:'Box of not cookies', power:5,price: Math.pow(10,46)});
9694
9695
9696
order=19000;
9697
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');
9698
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');
9699
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');
9700
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');
9701
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');
9702
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');
9703
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');
9704
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');
9705
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');
9706
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');
9707
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');
9708
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');
9709
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');
9710
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');
9711
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');
9712
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');
9713
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');
9714
9715
9716
order=19100;
9717
//note : price for these capped to base price OR 1 day of unbuffed CpS
9718
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>',
9719
Game.Tiers['fortune'].price*100000,[0,0]);Game.MakeTiered(Game.last,'fortune',10);
9720
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
9721
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);
9722
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
9723
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);
9724
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
9725
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);
9726
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
9727
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);
9728
Game.last.priceFunc=function(me){return Math.min(me.basePrice,Game.unbuffedCps*60*60*24);}
9729
9730
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'];
9731
9732
9733
//end of upgrades
9734
9735
Game.seasons={
9736
'christmas':{name:'Christmas',start:'Christmas season has started!',over:'Christmas season is over.',trigger:'Festive biscuit'},
9737
'valentines':{name:'Valentine\'s day',start:'Valentine\'s day has started!',over:'Valentine\'s day is over.',trigger:'Lovesick biscuit'},
9738
'fools':{name:'Business day',start:'Business day has started!',over:'Business day is over.',trigger:'Fool\'s biscuit'},
9739
'easter':{name:'Easter',start:'Easter season has started!',over:'Easter season is over.',trigger:'Bunny biscuit'},
9740
'halloween':{name:'Halloween',start:'Halloween has started!',over:'Halloween is over.',trigger:'Ghostly biscuit'}
9741
};
9742
9743
Game.listTinyOwnedUpgrades=function(arr)
9744
{
9745
var str='';
9746
for (var i=0;i<arr.length;i++)
9747
{
9748
if (Game.Has(arr[i]))
9749
{
9750
var it=Game.Upgrades[arr[i]];
9751
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>';
9752
}
9753
}
9754
return str;
9755
}
9756
9757
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'];
9758
9759
Game.GetHowManySantaDrops=function()
9760
{
9761
var num=0;
9762
for (var i in Game.santaDrops) {if (Game.Has(Game.santaDrops[i])) num++;}
9763
return num;
9764
}
9765
9766
Game.reindeerDrops=['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Holly biscuits','Candy cane biscuits','Bell biscuits','Present biscuits'];
9767
Game.GetHowManyReindeerDrops=function()
9768
{
9769
var num=0;
9770
for (var i in Game.reindeerDrops) {if (Game.Has(Game.reindeerDrops[i])) num++;}
9771
return num;
9772
}
9773
/*for (var i in Game.santaDrops)
9774
{
9775
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;};
9776
}*/
9777
9778
Game.seasonDrops=Game.heartDrops.concat(Game.halloweenDrops).concat(Game.easterEggs).concat(Game.santaDrops).concat(Game.reindeerDrops);
9779
9780
Game.saySeasonSwitchUses=function()
9781
{
9782
if (Game.seasonUses==0) return 'You haven\'t switched seasons this ascension yet.';
9783
return 'You\'ve switched seasons <b>'+(Game.seasonUses==1?'once':Game.seasonUses==2?'twice':(Game.seasonUses+' times'))+'</b> this ascension.';
9784
}
9785
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;};
9786
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;};
9787
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;};
9788
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;};
9789
Game.Upgrades['Fool\'s biscuit'].descFunc=function(){return '<div style="text-align:center;">'+Game.saySeasonSwitchUses()+'<div class="line"></div></div>'+this.desc;};
9790
9791
Game.computeSeasonPrices=function()
9792
{
9793
for (var i in Game.seasons)
9794
{
9795
Game.seasons[i].triggerUpgrade.priceFunc=function(){
9796
var m=1;
9797
if (Game.hasGod)
9798
{
9799
var godLvl=Game.hasGod('seasons');
9800
if (godLvl==1) m*=2;
9801
else if (godLvl==2) m*=1.50;
9802
else if (godLvl==3) m*=1.25;
9803
}
9804
//return Game.seasonTriggerBasePrice*Math.pow(2,Game.seasonUses)*m;
9805
//return Game.cookiesPs*60*Math.pow(1.5,Game.seasonUses)*m;
9806
return Game.seasonTriggerBasePrice+Game.unbuffedCps*60*Math.pow(1.5,Game.seasonUses)*m;
9807
}
9808
}
9809
}
9810
Game.computeSeasons=function()
9811
{
9812
for (var i in Game.seasons)
9813
{
9814
var me=Game.Upgrades[Game.seasons[i].trigger];
9815
Game.seasons[i].triggerUpgrade=me;
9816
me.pool='toggle';
9817
me.buyFunction=function()
9818
{
9819
Game.seasonUses+=1;
9820
Game.computeSeasonPrices();
9821
//Game.Lock(this.name);
9822
for (var i in Game.seasons)
9823
{
9824
var me=Game.Upgrades[Game.seasons[i].trigger];
9825
if (me.name!=this.name) {Game.Lock(me.name);Game.Unlock(me.name);}
9826
}
9827
if (Game.season!='' && Game.season!=this.season)
9828
{
9829
var str=Game.seasons[Game.season].over+'<div class="line"></div>';
9830
if (Game.prefs.popups) Game.Popup(str);
9831
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon,4);
9832
}
9833
Game.season=this.season;
9834
Game.seasonT=Game.getSeasonDuration();
9835
Game.storeToRefresh=1;
9836
Game.upgradesToRebuild=1;
9837
Game.Objects['Grandma'].redraw();
9838
var str=Game.seasons[this.season].start+'<div class="line"></div>';
9839
if (Game.prefs.popups) Game.Popup(str);
9840
else Game.Notify(str,'',this.icon,4);
9841
}
9842
9843
me.clickFunction=function(me){return function()
9844
{
9845
//undo season
9846
if (me.bought && Game.season && me==Game.seasons[Game.season].triggerUpgrade)
9847
{
9848
me.lose();
9849
var str=Game.seasons[Game.season].over;
9850
if (Game.prefs.popups) Game.Popup(str);
9851
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);
9852
if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}
9853
9854
Game.upgradesToRebuild=1;
9855
Game.recalculateGains=1;
9856
Game.season=Game.baseSeason;
9857
Game.seasonT=-1;
9858
PlaySound('snd/tick.mp3');
9859
return false;
9860
}
9861
else return true;
9862
};}(me);
9863
9864
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>';}
9865
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);
9866
9867
}
9868
}
9869
Game.getSeasonDuration=function(){return Game.fps*60*60*24;}
9870
Game.computeSeasons();
9871
9872
//alert untiered building upgrades
9873
for (var i in Game.Upgrades)
9874
{
9875
var me=Game.Upgrades[i];
9876
if (me.order>=200 && me.order<2000 && !me.tier && me.name.indexOf('grandma')==-1 && me.pool!='prestige') console.log(me.name+' has no tier.');
9877
}
9878
9879
Game.UpgradesByPool=[];
9880
for (var i in Game.Upgrades)
9881
{
9882
if (!Game.UpgradesByPool[Game.Upgrades[i].pool]) Game.UpgradesByPool[Game.Upgrades[i].pool]=[];
9883
Game.UpgradesByPool[Game.Upgrades[i].pool].push(Game.Upgrades[i]);
9884
}
9885
9886
Game.PrestigeUpgrades=[];
9887
for (var i in Game.Upgrades)
9888
{
9889
if (Game.Upgrades[i].pool=='prestige' || Game.Upgrades[i].pool=='prestigeDecor')
9890
{
9891
Game.PrestigeUpgrades.push(Game.Upgrades[i]);
9892
Game.Upgrades[i].posX=0;
9893
Game.Upgrades[i].posY=0;
9894
if (Game.Upgrades[i].parents.length==0 && Game.Upgrades[i].name!='Legacy') Game.Upgrades[i].parents=['Legacy'];
9895
Game.Upgrades[i].parents=Game.Upgrades[i].parents||[-1];
9896
for (var ii in Game.Upgrades[i].parents) {if (Game.Upgrades[i].parents[ii]!=-1) Game.Upgrades[i].parents[ii]=Game.Upgrades[Game.Upgrades[i].parents[ii]];}
9897
}
9898
}
9899
9900
Game.goldenCookieUpgrades=['Get lucky','Lucky day','Serendipity','Heavenly luck','Lasting fortune','Decisive fate','Lucky digit','Lucky number','Lucky payout','Golden goose egg'];
9901
9902
Game.cookieUpgrades=[];
9903
for (var i in Game.Upgrades)
9904
{
9905
var me=Game.Upgrades[i];
9906
if ((me.pool=='cookie' || me.pseudoCookie)) Game.cookieUpgrades.push(me);
9907
if (me.tier) Game.Tiers[me.tier].upgrades.push(me);
9908
}
9909
for (var i in Game.UnlockAt){Game.Upgrades[Game.UnlockAt[i].name].unlockAt=Game.UnlockAt[i];}
9910
for (var i in Game.Upgrades){if (Game.Upgrades[i].pool=='prestige') Game.Upgrades[i].order=Game.Upgrades[i].id;}
9911
9912
/*var oldPrestigePrices={"Chimera":5764801,"Synergies Vol. I":2525,"Synergies Vol. II":252525,"Label printer":9999};
9913
for (var i in oldPrestigePrices){Game.Upgrades[i].basePrice=oldPrestigePrices[i];}*/
9914
9915
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:[-206,-476],291:[453,-745],292:[-375,-651],293:[-399,-794],323:[-86,120],325:[192,-1127],326:[-328,-158],327:[-192,290],328:[-3,237],329:[92,376],353:[121,-326],354:[77,-436],355:[64,-548],356:[57,-673],357:[52,-793],358:[58,-924],359:[82,-1043],360:[-188,408],362:[158,289],363:[-30,-30],364:[-232,-730],365:[-77,349],368:[-82,-532],393:[196,-714],394:[197,-964],395:[-143,-140],396:[-264,-889],397:[-69,563],408:[-204,-1036],409:[-72,-1152],410:[-70,-1328],411:[-388,137],412:[-470,253],413:[-482,389],449:[-367,-1113],450:[-334,-1214],451:[-278,-1303],495:[-402,-966],496:[200,49],505:[-545,-570],520:[-279,-8],537:[-907,-131],539:[-508,-1270],540:[-629,-1291],541:[-594,-1186],542:[-548,-1374],561:[300,-17],562:[52,646],591:[154,744],592:[180,608],643:[-121,710],};
9916
9917
for (var i in Game.UpgradePositions) {Game.UpgradesById[i].posX=Game.UpgradePositions[i][0];Game.UpgradesById[i].posY=Game.UpgradePositions[i][1];}
9918
9919
9920
/*=====================================================================================
9921
ACHIEVEMENTS
9922
=======================================================================================*/
9923
Game.Achievements=[];
9924
Game.AchievementsById=[];
9925
Game.AchievementsN=0;
9926
Game.AchievementsOwned=0;
9927
Game.Achievement=function(name,desc,icon)
9928
{
9929
this.id=Game.AchievementsN;
9930
this.name=name;
9931
this.desc=desc;
9932
this.baseDesc=this.desc;
9933
this.desc=BeautifyInText(this.baseDesc);
9934
this.icon=icon;
9935
this.won=0;
9936
this.disabled=0;
9937
this.order=this.id;
9938
if (order) this.order=order+this.id*0.001;
9939
this.pool='normal';
9940
this.vanilla=Game.vanilla;
9941
this.type='achievement';
9942
9943
this.click=function()
9944
{
9945
if (this.clickFunction) this.clickFunction();
9946
}
9947
Game.last=this;
9948
Game.Achievements[this.name]=this;
9949
Game.AchievementsById[this.id]=this;
9950
Game.AchievementsN++;
9951
return this;
9952
}
9953
9954
Game.Win=function(what)
9955
{
9956
if (typeof what==='string')
9957
{
9958
if (Game.Achievements[what])
9959
{
9960
if (Game.Achievements[what].won==0)
9961
{
9962
var name=Game.Achievements[what].shortName?Game.Achievements[what].shortName:Game.Achievements[what].name;
9963
Game.Achievements[what].won=1;
9964
if (Game.prefs.popups) Game.Popup('Achievement unlocked :<br>'+name);
9965
else Game.Notify('Achievement unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+name+'</div>',Game.Achievements[what].icon);
9966
if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned++;
9967
Game.recalculateGains=1;
9968
}
9969
}
9970
}
9971
else {for (var i in what) {Game.Win(what[i]);}}
9972
}
9973
Game.RemoveAchiev=function(what)
9974
{
9975
if (Game.Achievements[what])
9976
{
9977
if (Game.Achievements[what].won==1)
9978
{
9979
Game.Achievements[what].won=0;
9980
if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned--;
9981
Game.recalculateGains=1;
9982
}
9983
}
9984
}
9985
Game.Achievement.prototype.toggle=function()//cheating only
9986
{
9987
if (!this.won)
9988
{
9989
Game.Win(this.name);
9990
}
9991
else
9992
{
9993
Game.RemoveAchiev(this.name);
9994
}
9995
if (Game.onMenu=='stats') Game.UpdateMenu();
9996
}
9997
9998
Game.CountsAsAchievementOwned=function(pool)
9999
{
10000
if (pool=='' || pool=='normal') return true; else return false;
10001
}
10002
10003
Game.HasAchiev=function(what)
10004
{
10005
return (Game.Achievements[what]?Game.Achievements[what].won:0);
10006
}
10007
10008
Game.TieredAchievement=function(name,desc,building,tier)
10009
{
10010
var achiev=new Game.Achievement(name,desc,Game.GetIcon(building,tier));
10011
Game.SetTier(building,tier);
10012
return achiev;
10013
}
10014
10015
Game.ProductionAchievement=function(name,building,tier,q,mult)
10016
{
10017
var building=Game.Objects[building];
10018
var icon=[building.iconColumn,22];
10019
var n=12+building.n+(mult||0);
10020
if (tier==2) {icon[1]=23;n+=7;}
10021
else if (tier==3) {icon[1]=24;n+=14;}
10022
var pow=Math.pow(10,n);
10023
var achiev=new Game.Achievement(name,'Make <b>'+Beautify(pow)+'</b> cookies just from '+building.plural+'.'+(q?'<q>'+q+'</q>':''),icon);
10024
building.productionAchievs.push({pow:pow,achiev:achiev});
10025
return achiev;
10026
}
10027
10028
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];
10029
Game.BankAchievements=[];
10030
Game.BankAchievement=function(name)
10031
{
10032
var threshold=Math.pow(10,Math.floor(Game.BankAchievements.length*1.5+2));
10033
if (Game.BankAchievements.length==0) threshold=1;
10034
var achiev=new Game.Achievement(name,'Bake <b>'+Beautify(threshold)+'</b> cookie'+(threshold==1?'':'s')+' in one ascension.',[Game.thresholdIcons[Game.BankAchievements.length],(Game.BankAchievements.length>32?1:Game.BankAchievements.length>23?2:5)]);
10035
achiev.threshold=threshold;
10036
achiev.order=100+Game.BankAchievements.length*0.01;
10037
Game.BankAchievements.push(achiev);
10038
return achiev;
10039
}
10040
Game.CpsAchievements=[];
10041
Game.CpsAchievement=function(name)
10042
{
10043
var threshold=Math.pow(10,Math.floor(Game.CpsAchievements.length*1.2));
10044
//if (Game.CpsAchievements.length==0) threshold=1;
10045
var achiev=new Game.Achievement(name,'Bake <b>'+Beautify(threshold)+'</b> cookie'+(threshold==1?'':'s')+' per second.',[Game.thresholdIcons[Game.CpsAchievements.length],(Game.CpsAchievements.length>32?1:Game.CpsAchievements.length>23?2:5)]);
10046
achiev.threshold=threshold;
10047
achiev.order=200+Game.CpsAchievements.length*0.01;
10048
Game.CpsAchievements.push(achiev);
10049
return achiev;
10050
}
10051
10052
//define achievements
10053
//WARNING : do NOT add new achievements in between, this breaks the saves. Add them at the end !
10054
10055
var order=0;//this is used to set the order in which the items are listed
10056
10057
Game.BankAchievement('Wake and bake');
10058
Game.BankAchievement('Making some dough');
10059
Game.BankAchievement('So baked right now');
10060
Game.BankAchievement('Fledgling bakery');
10061
Game.BankAchievement('Affluent bakery');
10062
Game.BankAchievement('World-famous bakery');
10063
Game.BankAchievement('Cosmic bakery');
10064
Game.BankAchievement('Galactic bakery');
10065
Game.BankAchievement('Universal bakery');
10066
Game.BankAchievement('Timeless bakery');
10067
Game.BankAchievement('Infinite bakery');
10068
Game.BankAchievement('Immortal bakery');
10069
Game.BankAchievement('Don\'t stop me now');
10070
Game.BankAchievement('You can stop now');
10071
Game.BankAchievement('Cookies all the way down');
10072
Game.BankAchievement('Overdose');
10073
10074
Game.CpsAchievement('Casual baking');
10075
Game.CpsAchievement('Hardcore baking');
10076
Game.CpsAchievement('Steady tasty stream');
10077
Game.CpsAchievement('Cookie monster');
10078
Game.CpsAchievement('Mass producer');
10079
Game.CpsAchievement('Cookie vortex');
10080
Game.CpsAchievement('Cookie pulsar');
10081
Game.CpsAchievement('Cookie quasar');
10082
Game.CpsAchievement('Oh hey, you\'re still here');
10083
Game.CpsAchievement('Let\'s never bake again');
10084
10085
order=30010;
10086
new Game.Achievement('Sacrifice','Ascend with <b>1 million</b> cookies baked.<q>Easy come, easy go.</q>',[11,6]);
10087
new Game.Achievement('Oblivion','Ascend with <b>1 billion</b> cookies baked.<q>Back to square one.</q>',[11,6]);
10088
new Game.Achievement('From scratch','Ascend with <b>1 trillion</b> cookies baked.<q>It\'s been fun.</q>',[11,6]);
10089
10090
order=11010;
10091
new Game.Achievement('Neverclick','Make <b>1 million</b> cookies by only having clicked <b>15 times</b>.',[12,0]);//Game.last.pool='shadow';
10092
order=1000;
10093
new Game.Achievement('Clicktastic','Make <b>1,000</b> cookies from clicking.',[11,0]);
10094
new Game.Achievement('Clickathlon','Make <b>100,000</b> cookies from clicking.',[11,1]);
10095
new Game.Achievement('Clickolympics','Make <b>10,000,000</b> cookies from clicking.',[11,2]);
10096
new Game.Achievement('Clickorama','Make <b>1,000,000,000</b> cookies from clicking.',[11,13]);
10097
10098
order=1050;
10099
new Game.Achievement('Click','Have <b>1</b> cursor.',[0,0]);
10100
new Game.Achievement('Double-click','Have <b>2</b> cursors.',[0,6]);
10101
new Game.Achievement('Mouse wheel','Have <b>50</b> cursors.',[1,6]);
10102
new Game.Achievement('Of Mice and Men','Have <b>100</b> cursors.',[0,1]);
10103
new Game.Achievement('The Digital','Have <b>200</b> cursors.',[0,2]);
10104
10105
order=1100;
10106
new Game.Achievement('Just wrong','Sell a grandma.<q>I thought you loved me.</q>',[10,9]);
10107
Game.TieredAchievement('Grandma\'s cookies','Have <b>1</b> grandma.','Grandma',1);
10108
Game.TieredAchievement('Sloppy kisses','Have <b>50</b> grandmas.','Grandma',2);
10109
Game.TieredAchievement('Retirement home','Have <b>100</b> grandmas.','Grandma',3);
10110
10111
order=1200;
10112
Game.TieredAchievement('My first farm','Have <b>1</b> farm.','Farm',1);
10113
Game.TieredAchievement('Reap what you sow','Have <b>50</b> farms.','Farm',2);
10114
Game.TieredAchievement('Farm ill','Have <b>100</b> farms.','Farm',3);
10115
10116
order=1400;
10117
Game.TieredAchievement('Production chain','Have <b>1</b> factory.','Factory',1);
10118
Game.TieredAchievement('Industrial revolution','Have <b>50</b> factories.','Factory',2);
10119
Game.TieredAchievement('Global warming','Have <b>100</b> factories.','Factory',3);
10120
10121
order=1300;
10122
Game.TieredAchievement('You know the drill','Have <b>1</b> mine.','Mine',1);
10123
Game.TieredAchievement('Excavation site','Have <b>50</b> mines.','Mine',2);
10124
Game.TieredAchievement('Hollow the planet','Have <b>100</b> mines.','Mine',3);
10125
10126
order=1500;
10127
Game.TieredAchievement('Expedition','Have <b>1</b> shipment.','Shipment',1);
10128
Game.TieredAchievement('Galactic highway','Have <b>50</b> shipments.','Shipment',2);
10129
Game.TieredAchievement('Far far away','Have <b>100</b> shipments.','Shipment',3);
10130
10131
order=1600;
10132
Game.TieredAchievement('Transmutation','Have <b>1</b> alchemy lab.','Alchemy lab',1);
10133
Game.TieredAchievement('Transmogrification','Have <b>50</b> alchemy labs.','Alchemy lab',2);
10134
Game.TieredAchievement('Gold member','Have <b>100</b> alchemy labs.','Alchemy lab',3);
10135
10136
order=1700;
10137
Game.TieredAchievement('A whole new world','Have <b>1</b> portal.','Portal',1);
10138
Game.TieredAchievement('Now you\'re thinking','Have <b>50</b> portals.','Portal',2);
10139
Game.TieredAchievement('Dimensional shift','Have <b>100</b> portals.','Portal',3);
10140
10141
order=1800;
10142
Game.TieredAchievement('Time warp','Have <b>1</b> time machine.','Time machine',1);
10143
Game.TieredAchievement('Alternate timeline','Have <b>50</b> time machines.','Time machine',2);
10144
Game.TieredAchievement('Rewriting history','Have <b>100</b> time machines.','Time machine',3);
10145
10146
10147
order=7000;
10148
new Game.Achievement('One with everything','Have <b>at least 1</b> of every building.',[2,7]);
10149
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]);
10150
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]);
10151
10152
order=10000;
10153
new Game.Achievement('Golden cookie','Click a <b>golden cookie</b>.',[10,14]);
10154
new Game.Achievement('Lucky cookie','Click <b>7 golden cookies</b>.',[22,6]);
10155
new Game.Achievement('A stroke of luck','Click <b>27 golden cookies</b>.',[23,6]);
10156
10157
order=30200;
10158
new Game.Achievement('Cheated cookies taste awful','Hack in some cookies.',[10,6]);Game.last.pool='shadow';
10159
order=11010;
10160
new Game.Achievement('Uncanny clicker','Click really, really fast.<q>Well I\'ll be!</q>',[12,0]);
10161
10162
order=5000;
10163
new Game.Achievement('Builder','Own <b>100</b> buildings.',[2,6]);
10164
new Game.Achievement('Architect','Own <b>500</b> buildings.',[3,6]);
10165
order=6000;
10166
new Game.Achievement('Enhancer','Purchase <b>20</b> upgrades.',[9,0]);
10167
new Game.Achievement('Augmenter','Purchase <b>50</b> upgrades.',[9,1]);
10168
10169
order=11000;
10170
new Game.Achievement('Cookie-dunker','Dunk the cookie.<q>You did it!</q>',[1,8]);
10171
10172
order=10000;
10173
new Game.Achievement('Fortune','Click <b>77 golden cookies</b>.<q>You should really go to bed.</q>',[24,6]);
10174
order=31000;
10175
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';
10176
10177
order=20000;
10178
new Game.Achievement('Elder nap','Appease the grandmatriarchs at least <b>once</b>.<q>we<br>are<br>eternal</q>',[8,9]);
10179
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]);
10180
10181
order=1150;
10182
new Game.Achievement('Elder','Own at least <b>7</b> grandma types.',[10,9]);
10183
10184
order=20000;
10185
new Game.Achievement('Elder calm','Declare a covenant with the grandmatriarchs.<q>we<br>have<br>fed</q>',[8,9]);
10186
10187
order=5000;
10188
new Game.Achievement('Engineer','Own <b>1000</b> buildings.',[4,6]);
10189
10190
order=10000;
10191
new Game.Achievement('Leprechaun','Click <b>777 golden cookies</b>.',[25,6]);
10192
new Game.Achievement('Black cat\'s paw','Click <b>7777 golden cookies</b>.',[26,6]);
10193
10194
order=30050;
10195
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]);
10196
10197
order=1900;
10198
Game.TieredAchievement('Antibatter','Have <b>1</b> antimatter condenser.','Antimatter condenser',1);
10199
Game.TieredAchievement('Quirky quarks','Have <b>50</b> antimatter condensers.','Antimatter condenser',2);
10200
Game.TieredAchievement('It does matter!','Have <b>100</b> antimatter condensers.','Antimatter condenser',3);
10201
10202
order=6000;
10203
new Game.Achievement('Upgrader','Purchase <b>100</b> upgrades.',[9,2]);
10204
10205
order=7000;
10206
new Game.Achievement('Centennial','Have at least <b>100 of everything</b>.',[6,6]);
10207
10208
order=30500;
10209
new Game.Achievement('Hardcore','Get to <b>1 billion</b> cookies baked with <b>no upgrades purchased</b>.',[12,6]);//Game.last.pool='shadow';
10210
10211
order=30600;
10212
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';
10213
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';
10214
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';
10215
10216
10217
order=61000;
10218
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';
10219
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';
10220
var achiev=new Game.Achievement('Chirped out','Find and defeat <b>Chirpy</b>, the dysfunctionning alarm bot.',[13,7]);Game.last.pool='dungeon';
10221
var achiev=new Game.Achievement('Follow the white rabbit','Find and defeat the elusive <b>sugar bunny</b>.',[14,7]);Game.last.pool='dungeon';
10222
10223
order=1000;
10224
new Game.Achievement('Clickasmic','Make <b>100,000,000,000</b> cookies from clicking.',[11,14]);
10225
10226
order=1100;
10227
Game.TieredAchievement('Friend of the ancients','Have <b>150</b> grandmas.','Grandma',4);
10228
Game.TieredAchievement('Ruler of the ancients','Have <b>200</b> grandmas.','Grandma',5);
10229
10230
order=32000;
10231
new Game.Achievement('Wholesome','Unlock <b>100%</b> of your heavenly chips power.',[15,7]);
10232
10233
order=33000;
10234
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';
10235
10236
order=21000;
10237
new Game.Achievement('Itchscratcher','Burst <b>1 wrinkler</b>.',[19,8]);
10238
new Game.Achievement('Wrinklesquisher','Burst <b>50 wrinklers</b>.',[19,8]);
10239
new Game.Achievement('Moistburster','Burst <b>200 wrinklers</b>.',[19,8]);
10240
10241
order=22000;
10242
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]);
10243
10244
order=22100;
10245
new Game.Achievement('Coming to town','Reach <b>Santa\'s 7th form</b>.',[18,9]);
10246
new Game.Achievement('All hail Santa','Reach <b>Santa\'s final form</b>.',[19,10]);
10247
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]);
10248
new Game.Achievement('Oh deer','Pop <b>1 reindeer</b>.',[12,9]);
10249
new Game.Achievement('Sleigh of hand','Pop <b>50 reindeer</b>.',[12,9]);
10250
new Game.Achievement('Reindeer sleigher','Pop <b>200 reindeer</b>.',[12,9]);
10251
10252
order=1200;
10253
Game.TieredAchievement('Perfected agriculture','Have <b>150</b> farms.','Farm',4);
10254
order=1400;
10255
Game.TieredAchievement('Ultimate automation','Have <b>150</b> factories.','Factory',4);
10256
order=1300;
10257
Game.TieredAchievement('Can you dig it','Have <b>150</b> mines.','Mine',4);
10258
order=1500;
10259
Game.TieredAchievement('Type II civilization','Have <b>150</b> shipments.','Shipment',4);
10260
order=1600;
10261
Game.TieredAchievement('Gild wars','Have <b>150</b> alchemy labs.','Alchemy lab',4);
10262
order=1700;
10263
Game.TieredAchievement('Brain-split','Have <b>150</b> portals.','Portal',4);
10264
order=1800;
10265
Game.TieredAchievement('Time duke','Have <b>150</b> time machines.','Time machine',4);
10266
order=1900;
10267
Game.TieredAchievement('Molecular maestro','Have <b>150</b> antimatter condensers.','Antimatter condenser',4);
10268
10269
order=2000;
10270
Game.TieredAchievement('Lone photon','Have <b>1</b> prism.','Prism',1);
10271
Game.TieredAchievement('Dazzling glimmer','Have <b>50</b> prisms.','Prism',2);
10272
Game.TieredAchievement('Blinding flash','Have <b>100</b> prisms.','Prism',3);
10273
Game.TieredAchievement('Unending glow','Have <b>150</b> prisms.','Prism',4);
10274
10275
order=5000;
10276
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]);
10277
order=6000;
10278
new Game.Achievement('Lord of Progress','Purchase <b>200</b> upgrades.<q>One can always do better. But should you?</q>',[9,14]);
10279
order=7002;
10280
new Game.Achievement('Bicentennial','Have at least <b>200 of everything</b>.<q>You crazy person.</q>',[8,6]);
10281
10282
order=22300;
10283
new Game.Achievement('Lovely cookies','Unlock <b>every Valentine-themed cookie</b>.',[20,3]);
10284
10285
order=7001;
10286
new Game.Achievement('Centennial and a half','Have at least <b>150 of everything</b>.',[7,6]);
10287
10288
order=11000;
10289
new Game.Achievement('Tiny cookie','Click the tiny cookie.<q>These aren\'t the cookies<br>you\'re clicking for.</q>',[0,5]);
10290
10291
order=400000;
10292
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]);
10293
10294
order=1070;
10295
Game.ProductionAchievement('Click delegator','Cursor',1,0,7);
10296
order=1120;
10297
Game.ProductionAchievement('Gushing grannies','Grandma',1,0,6);
10298
order=1220;
10299
Game.ProductionAchievement('I hate manure','Farm',1);
10300
order=1320;
10301
Game.ProductionAchievement('Never dig down','Mine',1);
10302
order=1420;
10303
Game.ProductionAchievement('The incredible machine','Factory',1);
10304
order=1520;
10305
Game.ProductionAchievement('And beyond','Shipment',1);
10306
order=1620;
10307
Game.ProductionAchievement('Magnum Opus','Alchemy lab',1);
10308
order=1720;
10309
Game.ProductionAchievement('With strange eons','Portal',1);
10310
order=1820;
10311
Game.ProductionAchievement('Spacetime jigamaroo','Time machine',1);
10312
order=1920;
10313
Game.ProductionAchievement('Supermassive','Antimatter condenser',1);
10314
order=2020;
10315
Game.ProductionAchievement('Praise the sun','Prism',1);
10316
10317
10318
order=1000;
10319
new Game.Achievement('Clickageddon','Make <b>10,000,000,000,000</b> cookies from clicking.',[11,15]);
10320
new Game.Achievement('Clicknarok','Make <b>1,000,000,000,000,000</b> cookies from clicking.',[11,16]);
10321
10322
order=1050;
10323
new Game.Achievement('Extreme polydactyly','Have <b>300</b> cursors.',[0,13]);
10324
new Game.Achievement('Dr. T','Have <b>400</b> cursors.',[0,14]);
10325
10326
order=1100;Game.TieredAchievement('The old never bothered me anyway','Have <b>250</b> grandmas.','Grandma',6);
10327
order=1200;Game.TieredAchievement('Homegrown','Have <b>200</b> farms.','Farm',5);
10328
order=1400;Game.TieredAchievement('Technocracy','Have <b>200</b> factories.','Factory',5);
10329
order=1300;Game.TieredAchievement('The center of the Earth','Have <b>200</b> mines.','Mine',5);
10330
order=1500;Game.TieredAchievement('We come in peace','Have <b>200</b> shipments.','Shipment',5);
10331
order=1600;Game.TieredAchievement('The secrets of the universe','Have <b>200</b> alchemy labs.','Alchemy lab',5);
10332
order=1700;Game.TieredAchievement('Realm of the Mad God','Have <b>200</b> portals.','Portal',5);
10333
order=1800;Game.TieredAchievement('Forever and ever','Have <b>200</b> time machines.','Time machine',5);
10334
order=1900;Game.TieredAchievement('Walk the planck','Have <b>200</b> antimatter condensers.','Antimatter condenser',5);
10335
order=2000;Game.TieredAchievement('Rise and shine','Have <b>200</b> prisms.','Prism',5);
10336
10337
order=30200;
10338
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';
10339
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!
10340
10341
order=30050;
10342
new Game.Achievement('Dematerialize','Ascend with <b>1 quintillion</b> cookies baked.<q>Presto!<br>...where\'d the cookies go?</q>',[11,7]);
10343
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]);
10344
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]);
10345
new Game.Achievement('Obliterate','Ascend with <b>1 octillion</b> cookies baked.<q>Resistance is futile, albeit entertaining.</q>',[11,8]);
10346
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]);
10347
10348
order=22400;
10349
new Game.Achievement('The hunt is on','Unlock <b>1 egg</b>.',[1,12]);
10350
new Game.Achievement('Egging on','Unlock <b>7 eggs</b>.',[4,12]);
10351
new Game.Achievement('Mass Easteria','Unlock <b>14 eggs</b>.',[7,12]);
10352
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]);
10353
10354
order=11000;
10355
new Game.Achievement('What\'s in a name','Give your bakery a name.',[15,9]);
10356
10357
10358
order=1425;
10359
Game.TieredAchievement('Pretty penny','Have <b>1</b> bank.','Bank',1);
10360
Game.TieredAchievement('Fit the bill','Have <b>50</b> banks.','Bank',2);
10361
Game.TieredAchievement('A loan in the dark','Have <b>100</b> banks.','Bank',3);
10362
Game.TieredAchievement('Need for greed','Have <b>150</b> banks.','Bank',4);
10363
Game.TieredAchievement('It\'s the economy, stupid','Have <b>200</b> banks.','Bank',5);
10364
order=1450;
10365
Game.TieredAchievement('Your time to shrine','Have <b>1</b> temple.','Temple',1);
10366
Game.TieredAchievement('Shady sect','Have <b>50</b> temples.','Temple',2);
10367
Game.TieredAchievement('New-age cult','Have <b>100</b> temples.','Temple',3);
10368
Game.TieredAchievement('Organized religion','Have <b>150</b> temples.','Temple',4);
10369
Game.TieredAchievement('Fanaticism','Have <b>200</b> temples.','Temple',5);
10370
order=1475;
10371
Game.TieredAchievement('Bewitched','Have <b>1</b> wizard tower.','Wizard tower',1);
10372
Game.TieredAchievement('The sorcerer\'s apprentice','Have <b>50</b> wizard towers.','Wizard tower',2);
10373
Game.TieredAchievement('Charms and enchantments','Have <b>100</b> wizard towers.','Wizard tower',3);
10374
Game.TieredAchievement('Curses and maledictions','Have <b>150</b> wizard towers.','Wizard tower',4);
10375
Game.TieredAchievement('Magic kingdom','Have <b>200</b> wizard towers.','Wizard tower',5);
10376
10377
order=1445;
10378
Game.ProductionAchievement('Vested interest','Bank',1);
10379
order=1470;
10380
Game.ProductionAchievement('New world order','Temple',1);
10381
order=1495;
10382
Game.ProductionAchievement('Hocus pocus','Wizard tower',1);
10383
10384
10385
10386
order=1070;
10387
Game.ProductionAchievement('Finger clickin\' good','Cursor',2,0,7);
10388
order=1120;
10389
Game.ProductionAchievement('Panic at the bingo','Grandma',2,0,6);
10390
order=1220;
10391
Game.ProductionAchievement('Rake in the dough','Farm',2);
10392
order=1320;
10393
Game.ProductionAchievement('Quarry on','Mine',2);
10394
order=1420;
10395
Game.ProductionAchievement('Yes I love technology','Factory',2);
10396
order=1445;
10397
Game.ProductionAchievement('Paid in full','Bank',2);
10398
order=1470;
10399
Game.ProductionAchievement('Church of Cookiology','Temple',2);
10400
order=1495;
10401
Game.ProductionAchievement('Too many rabbits, not enough hats','Wizard tower',2);
10402
order=1520;
10403
Game.ProductionAchievement('The most precious cargo','Shipment',2);
10404
order=1620;
10405
Game.ProductionAchievement('The Aureate','Alchemy lab',2);
10406
order=1720;
10407
Game.ProductionAchievement('Ever more hideous','Portal',2);
10408
order=1820;
10409
Game.ProductionAchievement('Be kind, rewind','Time machine',2);
10410
order=1920;
10411
Game.ProductionAchievement('Infinitesimal','Antimatter condenser',2);
10412
order=2020;
10413
Game.ProductionAchievement('A still more glorious dawn','Prism',2);
10414
10415
order=30000;
10416
new Game.Achievement('Rebirth','Ascend at least once.',[21,6]);
10417
10418
order=11000;
10419
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');}};
10420
10421
order=30000;
10422
new Game.Achievement('Resurrection','Ascend <b>10 times</b>.',[21,6]);
10423
new Game.Achievement('Reincarnation','Ascend <b>100 times</b>.',[21,6]);
10424
new Game.Achievement('Endless cycle','Ascend <b>1000 times</b>.<q>Oh hey, it\'s you again.</q>',[2,7]);Game.last.pool='shadow';
10425
10426
10427
10428
order=1100;
10429
Game.TieredAchievement('The agemaster','Have <b>300</b> grandmas.','Grandma',7);
10430
Game.TieredAchievement('To oldly go','Have <b>350</b> grandmas.','Grandma',8);
10431
10432
order=1200;Game.TieredAchievement('Gardener extraordinaire','Have <b>250</b> farms.','Farm',6);
10433
order=1300;Game.TieredAchievement('Tectonic ambassador','Have <b>250</b> mines.','Mine',6);
10434
order=1400;Game.TieredAchievement('Rise of the machines','Have <b>250</b> factories.','Factory',6);
10435
order=1425;Game.TieredAchievement('Acquire currency','Have <b>250</b> banks.','Bank',6);
10436
order=1450;Game.TieredAchievement('Zealotry','Have <b>250</b> temples.','Temple',6);
10437
order=1475;Game.TieredAchievement('The wizarding world','Have <b>250</b> wizard towers.','Wizard tower',6);
10438
order=1500;Game.TieredAchievement('Parsec-masher','Have <b>250</b> shipments.','Shipment',6);
10439
order=1600;Game.TieredAchievement('The work of a lifetime','Have <b>250</b> alchemy labs.','Alchemy lab',6);
10440
order=1700;Game.TieredAchievement('A place lost in time','Have <b>250</b> portals.','Portal',6);
10441
order=1800;Game.TieredAchievement('Heat death','Have <b>250</b> time machines.','Time machine',6);
10442
order=1900;Game.TieredAchievement('Microcosm','Have <b>250</b> antimatter condensers.','Antimatter condenser',6);
10443
order=2000;Game.TieredAchievement('Bright future','Have <b>250</b> prisms.','Prism',6);
10444
10445
order=25000;
10446
new Game.Achievement('Here be dragon','Complete your <b>dragon\'s training</b>.',[21,12]);
10447
10448
Game.BankAchievement('How?');
10449
Game.BankAchievement('The land of milk and cookies');
10450
Game.BankAchievement('He who controls the cookies controls the universe');Game.last.baseDesc+='<q>The milk must flow!</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10451
Game.BankAchievement('Tonight on Hoarders');
10452
Game.BankAchievement('Are you gonna eat all that?');
10453
Game.BankAchievement('We\'re gonna need a bigger bakery');
10454
Game.BankAchievement('In the mouth of madness');Game.last.baseDesc+='<q>A cookie is just what we tell each other it is.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10455
Game.BankAchievement('Brought to you by the letter <div style="display:inline-block;background:url(img/money.png);width:16px;height:16px;"></div>');
10456
10457
10458
Game.CpsAchievement('A world filled with cookies');
10459
Game.CpsAchievement('When this baby hits '+Beautify(10000000000000*60*60)+' cookies per hour');
10460
Game.CpsAchievement('Fast and delicious');
10461
Game.CpsAchievement('Cookiehertz : a really, really tasty hertz');Game.last.baseDesc+='<q>Tastier than a hertz donut, anyway.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10462
Game.CpsAchievement('Woops, you solved world hunger');
10463
Game.CpsAchievement('Turbopuns');Game.last.baseDesc+='<q>Mother Nature will be like "slowwwww dowwwwwn".</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10464
Game.CpsAchievement('Faster menner');
10465
Game.CpsAchievement('And yet you\'re still hungry');
10466
Game.CpsAchievement('The Abakening');
10467
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 [...]';
10468
Game.CpsAchievement('Fast');Game.last.baseDesc+='<q>Wow!</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10469
10470
order=7002;
10471
new Game.Achievement('Bicentennial and a half','Have at least <b>250 of everything</b>.<q>Keep on truckin\'.</q>',[9,6]);
10472
10473
order=11000;
10474
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]);
10475
10476
order=1000;
10477
new Game.Achievement('Clickastrophe','Make <b>100,000,000,000,000,000</b> cookies from clicking.',[11,17]);
10478
new Game.Achievement('Clickataclysm','Make <b>10,000,000,000,000,000,000</b> cookies from clicking.',[11,18]);
10479
10480
order=1050;
10481
new Game.Achievement('Thumbs, phalanges, metacarpals','Have <b>500</b> cursors.<q>& KNUCKLES</q>',[0,15]);
10482
10483
order=6000;
10484
new Game.Achievement('Polymath','Own <b>300</b> upgrades and <b>3000</b> buildings.<q>Excellence doesn\'t happen overnight - it usually takes a good couple days.</q>',[29,7]);
10485
10486
order=6005;
10487
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]);
10488
10489
order=30050;
10490
new Game.Achievement('To crumbs, you say?','Ascend with <b>1 decillion</b> cookies baked.<q>Very well then.</q>',[29,6]);
10491
10492
order=1200;Game.TieredAchievement('Seedy business','Have <b>300</b> farms.','Farm',7);
10493
order=1300;Game.TieredAchievement('Freak fracking','Have <b>300</b> mines.','Mine',7);
10494
order=1400;Game.TieredAchievement('Modern times','Have <b>300</b> factories.','Factory',7);
10495
order=1425;Game.TieredAchievement('The nerve of war','Have <b>300</b> banks.','Bank',7);
10496
order=1450;Game.TieredAchievement('Wololo','Have <b>300</b> temples.','Temple',7);
10497
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);
10498
order=1500;Game.TieredAchievement('It\'s not delivery','Have <b>300</b> shipments.','Shipment',7);
10499
order=1600;Game.TieredAchievement('Gold, Jerry! Gold!','Have <b>300</b> alchemy labs.','Alchemy lab',7);
10500
order=1700;Game.TieredAchievement('Forbidden zone','Have <b>300</b> portals.','Portal',7);
10501
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);
10502
order=1900;Game.TieredAchievement('Scientists baffled everywhere','Have <b>300</b> antimatter condensers.','Antimatter condenser',7);
10503
order=2000;Game.TieredAchievement('Harmony of the spheres','Have <b>300</b> prisms.','Prism',7);
10504
10505
order=35000;
10506
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';
10507
10508
order=10000;
10509
new Game.Achievement('Early bird','Click a golden cookie <b>less than 1 second after it spawns</b>.',[10,14]);
10510
new Game.Achievement('Fading luck','Click a golden cookie <b>less than 1 second before it dies</b>.',[10,14]);
10511
10512
order=22100;
10513
new Game.Achievement('Eldeer','Pop a reindeer <b>during an elder frenzy</b>.',[12,9]);
10514
10515
order=21100;
10516
new Game.Achievement('Dude, sweet','Harvest <b>7 coalescing sugar lumps</b>.',[24,14]);
10517
new Game.Achievement('Sugar rush','Harvest <b>30 coalescing sugar lumps</b>.',[26,14]);
10518
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]);
10519
new Game.Achievement('Hand-picked','Successfully harvest a coalescing sugar lump before it\'s ripe.',[28,14]);
10520
new Game.Achievement('Sugar sugar','Harvest a <b>bifurcated sugar lump</b>.',[29,15]);
10521
new Game.Achievement('All-natural cane sugar','Harvest a <b>golden sugar lump</b>.',[29,16]);Game.last.pool='shadow';
10522
new Game.Achievement('Sweetmeats','Harvest a <b>meaty sugar lump</b>.',[29,17]);
10523
10524
order=7002;
10525
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]);
10526
10527
Game.CpsAchievement('Knead for speed');Game.last.baseDesc+='<q>How did we not make that one yet?</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10528
Game.CpsAchievement('Well the cookies start coming and they don\'t stop coming');Game.last.baseDesc+='<q>Didn\'t make sense not to click for fun.</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10529
Game.CpsAchievement('I don\'t know if you\'ve noticed but all these icons are very slightly off-center');
10530
Game.CpsAchievement('The proof of the cookie is in the baking');Game.last.baseDesc+='<q>How can you have any cookies if you don\'t bake your dough?</q>';Game.last.desc=BeautifyInText(Game.last.baseDesc);
10531
Game.CpsAchievement('If it\'s worth doing, it\'s worth overdoing');
10532
10533
Game.BankAchievement('The dreams in which I\'m baking are the best I\'ve ever had');
10534
Game.BankAchievement('Set for life');
10535
10536
order=1200;Game.TieredAchievement('You and the beanstalk','Have <b>350</b> farms.','Farm',8);
10537
order=1300;Game.TieredAchievement('Romancing the stone','Have <b>350</b> mines.','Mine',8);
10538
order=1400;Game.TieredAchievement('Ex machina','Have <b>350</b> factories.','Factory',8);
10539
order=1425;Game.TieredAchievement('And I need it now','Have <b>350</b> banks.','Bank',8);
10540
order=1450;Game.TieredAchievement('Pray on the weak','Have <b>350</b> temples.','Temple',8);
10541
order=1475;Game.TieredAchievement('It\'s a kind of magic','Have <b>350</b> wizard towers.','Wizard tower',8);
10542
order=1500;Game.TieredAchievement('Make it so','Have <b>350</b> shipments.','Shipment',8);
10543
order=1600;Game.TieredAchievement('All that glitters is gold','Have <b>350</b> alchemy labs.','Alchemy lab',8);
10544
order=1700;Game.TieredAchievement('H̸̷͓̳̳̯̟͕̟͍͍̣͡ḛ̢̦̰̺̮̝͖͖̘̪͉͘͡ ̠̦͕̤̪̝̥̰̠̫̖̣͙̬͘ͅC̨̦̺̩̲̥͉̭͚̜̻̝̣̼͙̮̯̪o̴̡͇̘͎̞̲͇̦̲͞͡m̸̩̺̝̣̹̱͚̬̥̫̳̼̞̘̯͘ͅẹ͇̺̜́̕͢s̶̙̟̱̥̮̯̰̦͓͇͖͖̝͘͘͞','Have <b>350</b> portals.','Portal',8);
10545
order=1800;Game.TieredAchievement('Way back then','Have <b>350</b> time machines.','Time machine',8);
10546
order=1900;Game.TieredAchievement('Exotic matter','Have <b>350</b> antimatter condensers.','Antimatter condenser',8);
10547
order=2000;Game.TieredAchievement('At the end of the tunnel','Have <b>350</b> prisms.','Prism',8);
10548
10549
10550
10551
order=1070;
10552
Game.ProductionAchievement('Click (starring Adam Sandler)','Cursor',3,0,7);
10553
order=1120;
10554
Game.ProductionAchievement('Frantiquities','Grandma',3,0,6);
10555
order=1220;
10556
Game.ProductionAchievement('Overgrowth','Farm',3);
10557
order=1320;
10558
Game.ProductionAchievement('Sedimentalism','Mine',3);
10559
order=1420;
10560
Game.ProductionAchievement('Labor of love','Factory',3);
10561
order=1445;
10562
Game.ProductionAchievement('Reverse funnel system','Bank',3);
10563
order=1470;
10564
Game.ProductionAchievement('Thus spoke you','Temple',3);
10565
order=1495;
10566
Game.ProductionAchievement('Manafest destiny','Wizard tower',3);
10567
order=1520;
10568
Game.ProductionAchievement('Neither snow nor rain nor heat nor gloom of night','Shipment',3);
10569
order=1620;
10570
Game.ProductionAchievement('I\'ve got the Midas touch','Alchemy lab',3);
10571
order=1720;
10572
Game.ProductionAchievement('Which eternal lie','Portal',3);
10573
order=1820;
10574
Game.ProductionAchievement('D&eacute;j&agrave; vu','Time machine',3);
10575
order=1920;
10576
Game.ProductionAchievement('Powers of Ten','Antimatter condenser',3);
10577
order=2020;
10578
Game.ProductionAchievement('Now the dark days are gone','Prism',3);
10579
10580
order=1070;
10581
new Game.Achievement('Freaky jazz hands','Reach level <b>10</b> cursors.',[0,26]);Game.Objects['Cursor'].levelAchiev10=Game.last;
10582
order=1120;
10583
new Game.Achievement('Methuselah','Reach level <b>10</b> grandmas.',[1,26]);Game.Objects['Grandma'].levelAchiev10=Game.last;
10584
order=1220;
10585
new Game.Achievement('Huge tracts of land','Reach level <b>10</b> farms.',[2,26]);Game.Objects['Farm'].levelAchiev10=Game.last;
10586
order=1320;
10587
new Game.Achievement('D-d-d-d-deeper','Reach level <b>10</b> mines.',[3,26]);Game.Objects['Mine'].levelAchiev10=Game.last;
10588
order=1420;
10589
new Game.Achievement('Patently genius','Reach level <b>10</b> factories.',[4,26]);Game.Objects['Factory'].levelAchiev10=Game.last;
10590
order=1445;
10591
new Game.Achievement('A capital idea','Reach level <b>10</b> banks.',[15,26]);Game.Objects['Bank'].levelAchiev10=Game.last;
10592
order=1470;
10593
new Game.Achievement('It belongs in a bakery','Reach level <b>10</b> temples.',[16,26]);Game.Objects['Temple'].levelAchiev10=Game.last;
10594
order=1495;
10595
new Game.Achievement('Motormouth','Reach level <b>10</b> wizard towers.',[17,26]);Game.Objects['Wizard tower'].levelAchiev10=Game.last;
10596
order=1520;
10597
new Game.Achievement('Been there done that','Reach level <b>10</b> shipments.',[5,26]);Game.Objects['Shipment'].levelAchiev10=Game.last;
10598
order=1620;
10599
new Game.Achievement('Phlogisticated substances','Reach level <b>10</b> alchemy labs.',[6,26]);Game.Objects['Alchemy lab'].levelAchiev10=Game.last;
10600
order=1720;
10601
new Game.Achievement('Bizarro world','Reach level <b>10</b> portals.',[7,26]);Game.Objects['Portal'].levelAchiev10=Game.last;
10602
order=1820;
10603
new Game.Achievement('The long now','Reach level <b>10</b> time machines.',[8,26]);Game.Objects['Time machine'].levelAchiev10=Game.last;
10604
order=1920;
10605
new Game.Achievement('Chubby hadrons','Reach level <b>10</b> antimatter condensers.',[13,26]);Game.Objects['Antimatter condenser'].levelAchiev10=Game.last;
10606
order=2020;
10607
new Game.Achievement('Palettable','Reach level <b>10</b> prisms.',[14,26]);Game.Objects['Prism'].levelAchiev10=Game.last;
10608
10609
order=61470;
10610
order=61495;
10611
new Game.Achievement('Bibbidi-bobbidi-boo','Cast <b>9</b> spells.',[21,11]);
10612
new Game.Achievement('I\'m the wiz','Cast <b>99</b> spells.',[22,11]);
10613
new Game.Achievement('A wizard is you','Cast <b>999</b> spells.<q>I\'m a what?</q>',[29,11]);
10614
10615
order=10000;
10616
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';
10617
10618
order=2100;
10619
Game.TieredAchievement('Lucked out','Have <b>1</b> chancemaker.','Chancemaker',1);
10620
Game.TieredAchievement('What are the odds','Have <b>50</b> chancemakers.','Chancemaker',2);
10621
Game.TieredAchievement('Grandma needs a new pair of shoes','Have <b>100</b> chancemakers.','Chancemaker',3);
10622
Game.TieredAchievement('Million to one shot, doc','Have <b>150</b> chancemakers.','Chancemaker',4);
10623
Game.TieredAchievement('As luck would have it','Have <b>200</b> chancemakers.','Chancemaker',5);
10624
Game.TieredAchievement('Ever in your favor','Have <b>250</b> chancemakers.','Chancemaker',6);
10625
Game.TieredAchievement('Be a lady','Have <b>300</b> chancemakers.','Chancemaker',7);
10626
Game.TieredAchievement('Dicey business','Have <b>350</b> chancemakers.','Chancemaker',8);
10627
10628
order=2120;
10629
Game.ProductionAchievement('Fingers crossed','Chancemaker',1);
10630
Game.ProductionAchievement('Just a statistic','Chancemaker',2);
10631
Game.ProductionAchievement('Murphy\'s wild guess','Chancemaker',3);
10632
10633
new Game.Achievement('Let\'s leaf it at that','Reach level <b>10</b> chancemakers.',[19,26]);Game.Objects['Chancemaker'].levelAchiev10=Game.last;
10634
10635
order=1000;
10636
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]);
10637
10638
10639
order=1100;
10640
Game.TieredAchievement('Aged well','Have <b>400</b> grandmas.','Grandma',9);
10641
Game.TieredAchievement('101st birthday','Have <b>450</b> grandmas.','Grandma',10);
10642
Game.TieredAchievement('Defense of the ancients','Have <b>500</b> grandmas.','Grandma',11);
10643
order=1200;Game.TieredAchievement('Harvest moon','Have <b>400</b> farms.','Farm',9);
10644
order=1300;Game.TieredAchievement('Mine?','Have <b>400</b> mines.','Mine',9);
10645
order=1400;Game.TieredAchievement('In full gear','Have <b>400</b> factories.','Factory',9);
10646
order=1425;Game.TieredAchievement('Treacle tart economics','Have <b>400</b> banks.','Bank',9);
10647
order=1450;Game.TieredAchievement('Holy cookies, grandma!','Have <b>400</b> temples.','Temple',9);
10648
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);
10649
order=1500;Game.TieredAchievement('That\'s just peanuts to space','Have <b>400</b> shipments.','Shipment',9);
10650
order=1600;Game.TieredAchievement('Worth its weight in lead','Have <b>400</b> alchemy labs.','Alchemy lab',9);
10651
order=1700;Game.TieredAchievement('What happens in the vortex stays in the vortex','Have <b>400</b> portals.','Portal',9);
10652
order=1800;Game.TieredAchievement('Invited to yesterday\'s party','Have <b>400</b> time machines.','Time machine',9);
10653
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
10654
order=2000;Game.TieredAchievement('My eyes','Have <b>400</b> prisms.','Prism',9);
10655
order=2100;Game.TieredAchievement('Maybe a chance in hell, actually','Have <b>400</b> chancemakers.','Chancemaker',9);
10656
10657
order=1200;Game.TieredAchievement('Make like a tree','Have <b>450</b> farms.','Farm',10);
10658
order=1300;Game.TieredAchievement('Cave story','Have <b>450</b> mines.','Mine',10);
10659
order=1400;Game.TieredAchievement('In-cog-neato','Have <b>450</b> factories.','Factory',10);
10660
order=1425;Game.TieredAchievement('Save your breath because that\'s all you\'ve got left','Have <b>450</b> banks.','Bank',10);
10661
order=1450;Game.TieredAchievement('Vengeful and almighty','Have <b>450</b> temples.','Temple',10);
10662
order=1475;Game.TieredAchievement('Spell it out for you','Have <b>450</b> wizard towers.','Wizard tower',10);
10663
order=1500;Game.TieredAchievement('Space space space space space','Have <b>450</b> shipments.<q>It\'s too far away...</q>','Shipment',10);
10664
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);
10665
order=1700;Game.TieredAchievement('Objects in the mirror dimension are closer than they appear','Have <b>450</b> portals.','Portal',10);
10666
order=1800;Game.TieredAchievement('Groundhog day','Have <b>450</b> time machines.','Time machine',10);
10667
order=1900;Game.TieredAchievement('A matter of perspective','Have <b>450</b> antimatter condensers.','Antimatter condenser',10);
10668
order=2000;Game.TieredAchievement('Optical illusion','Have <b>450</b> prisms.','Prism',10);
10669
order=2100;Game.TieredAchievement('Jackpot','Have <b>450</b> chancemakers.','Chancemaker',10);
10670
10671
order=36000;
10672
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';
10673
10674
10675
10676
Game.CpsAchievement('Running with scissors');
10677
Game.CpsAchievement('Rarefied air');
10678
Game.CpsAchievement('Push it to the limit');
10679
Game.CpsAchievement('Green cookies sleep furiously');
10680
10681
Game.BankAchievement('Panic! at Nabisco');
10682
Game.BankAchievement('Bursting at the seams');
10683
Game.BankAchievement('Just about full');
10684
Game.BankAchievement('Hungry for more');
10685
10686
order=1000;
10687
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]);
10688
new Game.Achievement('One...more...click...','Make <b>10,000,000,000,000,000,000,000,000</b> cookies from clicking.',[11,30]);
10689
10690
order=61515;
10691
new Game.Achievement('Botany enthusiast','Harvest <b>100</b> mature garden plants.',[26,20]);
10692
new Game.Achievement('Green, aching thumb','Harvest <b>1000</b> mature garden plants.',[27,20]);
10693
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]);
10694
10695
new Game.Achievement('Keeper of the conservatory','Unlock every garden seed.',[25,20]);
10696
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]);
10697
10698
order=30050;
10699
new Game.Achievement('You get nothing','Ascend with <b>1 undecillion</b> cookies baked.<q>Good day sir!</q>',[29,6]);
10700
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]);
10701
new Game.Achievement('The end of the world','Ascend with <b>1 tredecillion</b> cookies baked.<q>(as we know it)</q>',[21,25]);
10702
new Game.Achievement('Oh, you\'re back','Ascend with <b>1 quattuordecillion</b> cookies baked.<q>Missed us?</q>',[21,25]);
10703
new Game.Achievement('Lazarus','Ascend with <b>1 quindecillion</b> cookies baked.<q>All rise.</q>',[21,25]);
10704
10705
Game.CpsAchievement('Leisurely pace');
10706
Game.CpsAchievement('Hypersonic');
10707
10708
Game.BankAchievement('Feed me, Orteil');
10709
Game.BankAchievement('And then what?');
10710
10711
order=7002;
10712
new Game.Achievement('Tricentennial and a half','Have at least <b>350 of everything</b>.<q>(it\'s free real estate)</q>',[21,26]);
10713
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]);
10714
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]);
10715
10716
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]);
10717
10718
10719
order=21100;
10720
new Game.Achievement('Maillard reaction','Harvest a <b>caramelized sugar lump</b>.',[29,27]);
10721
10722
order=30250;
10723
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
10724
10725
10726
order=1050;
10727
new Game.Achievement('With her finger and her thumb','Have <b>600</b> cursors.',[0,16]);
10728
10729
order=1100;Game.TieredAchievement('But wait \'til you get older','Have <b>550</b> grandmas.','Grandma',12);
10730
order=1200;Game.TieredAchievement('Sharpest tool in the shed','Have <b>500</b> farms.','Farm',11);
10731
order=1300;Game.TieredAchievement('Hey now, you\'re a rock','Have <b>500</b> mines.','Mine',11);
10732
order=1400;Game.TieredAchievement('Break the mold','Have <b>500</b> factories.','Factory',11);
10733
order=1425;Game.TieredAchievement('Get the show on, get paid','Have <b>500</b> banks.','Bank',11);
10734
order=1450;Game.TieredAchievement('My world\'s on fire, how about yours','Have <b>500</b> temples.','Temple',11);
10735
order=1475;Game.TieredAchievement('The meteor men beg to differ','Have <b>500</b> wizard towers.','Wizard tower',11);
10736
order=1500;Game.TieredAchievement('Only shooting stars','Have <b>500</b> shipments.','Shipment',11);
10737
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
10738
order=1700;Game.TieredAchievement('Your brain gets smart but your head gets dumb','Have <b>500</b> portals.','Portal',11);
10739
order=1800;Game.TieredAchievement('The years start coming','Have <b>500</b> time machines.','Time machine',11);
10740
order=1900;Game.TieredAchievement('What a concept','Have <b>500</b> antimatter condensers.','Antimatter condenser',11);
10741
order=2000;Game.TieredAchievement('You\'ll never shine if you don\'t glow','Have <b>500</b> prisms.','Prism',11);
10742
order=2100;Game.TieredAchievement('You\'ll never know if you don\'t go','Have <b>500</b> chancemakers.','Chancemaker',11);
10743
10744
order=2200;
10745
Game.TieredAchievement('Self-contained','Have <b>1</b> fractal engine.','Fractal engine',1);
10746
Game.TieredAchievement('Threw you for a loop','Have <b>50</b> fractal engines.','Fractal engine',2);
10747
Game.TieredAchievement('The sum of its parts','Have <b>100</b> fractal engines.','Fractal engine',3);
10748
Game.TieredAchievement('Bears repeating','Have <b>150</b> fractal engines.<q>Where did these come from?</q>','Fractal engine',4);
10749
Game.TieredAchievement('More of the same','Have <b>200</b> fractal engines.','Fractal engine',5);
10750
Game.TieredAchievement('Last recurse','Have <b>250</b> fractal engines.','Fractal engine',6);
10751
Game.TieredAchievement('Out of one, many','Have <b>300</b> fractal engines.','Fractal engine',7);
10752
Game.TieredAchievement('An example of recursion','Have <b>350</b> fractal engines.','Fractal engine',8);
10753
Game.TieredAchievement('For more information on this achievement, please refer to its title','Have <b>400</b> fractal engines.','Fractal engine',9);
10754
Game.TieredAchievement('I\'m so meta, even this achievement','Have <b>450</b> fractal engines.','Fractal engine',10);
10755
Game.TieredAchievement('Never get bored','Have <b>500</b> fractal engines.','Fractal engine',11);
10756
10757
order=2220;
10758
Game.ProductionAchievement('The needs of the many','Fractal engine',1);
10759
Game.ProductionAchievement('Eating its own','Fractal engine',2);
10760
Game.ProductionAchievement('We must go deeper','Fractal engine',3);
10761
10762
new Game.Achievement('Sierpinski rhomboids','Reach level <b>10</b> fractal engines.',[20,26]);Game.Objects['Fractal engine'].levelAchiev10=Game.last;
10763
10764
Game.CpsAchievement('Gotta go fast');
10765
Game.BankAchievement('I think it\'s safe to say you\'ve got it made');
10766
10767
order=6000;
10768
new Game.Achievement('Renaissance baker','Own <b>400</b> upgrades and <b>4000</b> buildings.<q>If you have seen further, it is by standing on the shoulders of giants - a mysterious species of towering humanoids until now thought long-extinct.</q>',[10,10]);
10769
10770
order=1150;
10771
new Game.Achievement('Veteran','Own at least <b>14</b> grandma types.<q>14\'s a crowd!</q>',[10,9]);
10772
10773
order=10000;
10774
new Game.Achievement('Thick-skinned','Have your <b>reinforced membrane</b> protect the <b>shimmering veil</b>.',[7,10]);
10775
10776
10777
order=2300;
10778
Game.TieredAchievement('F12','Have <b>1</b> javascript console.','Javascript console',1);
10779
Game.TieredAchievement('Variable success','Have <b>50</b> javascript consoles.','Javascript console',2);
10780
Game.TieredAchievement('No comments','Have <b>100</b> javascript consoles.','Javascript console',3);
10781
Game.TieredAchievement('Up to code','Have <b>150</b> javascript consoles.','Javascript console',4);
10782
Game.TieredAchievement('Works on my machine','Have <b>200</b> javascript consoles.','Javascript console',5);
10783
Game.TieredAchievement('Technical debt','Have <b>250</b> javascript consoles.','Javascript console',6);
10784
Game.TieredAchievement('Mind your language','Have <b>300</b> javascript consoles.','Javascript console',7);
10785
Game.TieredAchievement('Inconsolable','Have <b>350</b> javascript consoles.','Javascript console',8);
10786
Game.TieredAchievement('Closure','Have <b>400</b> javascript consoles.','Javascript console',9);
10787
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);
10788
Game.TieredAchievement('Taking the back streets','Have <b>500</b> javascript consoles.','Javascript console',11);
10789
10790
order=2320;
10791
Game.ProductionAchievement('Inherited prototype','Javascript console',1);
10792
Game.ProductionAchievement('A model of document object','Javascript console',2);
10793
Game.ProductionAchievement('First-class citizen','Javascript console',3);
10794
10795
new Game.Achievement('Alexandria','Reach level <b>10</b> javascript consoles.',[32,26]);Game.Objects['Javascript console'].levelAchiev10=Game.last;
10796
10797
Game.CpsAchievement('Bake him away, toys');
10798
Game.CpsAchievement('You\'re #1 so why try harder');
10799
Game.CpsAchievement('Haven\'t even begun to peak');
10800
Game.BankAchievement('A sometimes food');
10801
Game.BankAchievement('Not enough of a good thing');
10802
Game.BankAchievement('Horn of plenty');
10803
10804
order=30050;
10805
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]);
10806
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]);
10807
10808
order=33000;
10809
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>; fortune upgrades also have a <b>40% chance</b> to carry over after ascending.',[29,8]);
10810
10811
//end of achievements
10812
10813
/*=====================================================================================
10814
BUFFS
10815
=======================================================================================*/
10816
10817
Game.buffs=[];//buffs currently in effect by name
10818
Game.buffsN=0;
10819
Game.buffsL=l('buffs');
10820
Game.gainBuff=function(type,time,arg1,arg2,arg3)
10821
{
10822
type=Game.buffTypesByName[type];
10823
var obj=type.func(time,arg1,arg2,arg3);
10824
obj.type=type;
10825
obj.arg1=arg1;
10826
obj.arg2=arg2;
10827
obj.arg3=arg3;
10828
10829
var buff={
10830
visible:true,
10831
time:0,
10832
name:'???',
10833
desc:'',
10834
icon:[0,0]
10835
};
10836
if (Game.buffs[obj.name])//if there is already a buff in effect with this name
10837
{
10838
var buff=Game.buffs[obj.name];
10839
if (obj.max) buff.time=Math.max(obj.time,buff.time);//new duration is max of old and new
10840
if (obj.add) buff.time+=obj.time;//new duration is old + new
10841
if (!obj.max && !obj.add) buff.time=obj.time;//new duration is set to new
10842
buff.maxTime=buff.time;
10843
}
10844
else//create new buff
10845
{
10846
for (var i in obj)//paste parameters onto buff
10847
{buff[i]=obj[i];}
10848
buff.maxTime=buff.time;
10849
Game.buffs[buff.name]=buff;
10850
buff.id=Game.buffsN;
10851
10852
//create dom
10853
Game.buffsL.innerHTML=Game.buffsL.innerHTML+'<div id="buff'+buff.id+'" class="crate enabled buff" '+(buff.desc?Game.getTooltip(
10854
'<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>'
10855
,'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>';
10856
10857
buff.l=l('buff'+buff.id);
10858
10859
Game.buffsN++;
10860
}
10861
Game.recalculateGains=1;
10862
Game.storeToRefresh=1;
10863
return buff;
10864
}
10865
Game.hasBuff=function(what)//returns 0 if there is no buff in effect with this name; else, returns it
10866
{if (!Game.buffs[what]) return 0; else return Game.buffs[what];}
10867
Game.updateBuffs=function()//executed every logic frame
10868
{
10869
for (var i in Game.buffs)
10870
{
10871
var buff=Game.buffs[i];
10872
10873
if (buff.time>=0)
10874
{
10875
if (!l('buffPieTimer'+buff.id)) l('buff'+buff.id).innerHTML=l('buff'+buff.id).innerHTML+'<div class="pieTimer" id="buffPieTimer'+buff.id+'"></div>';
10876
var T=1-(buff.time/buff.maxTime);
10877
T=(T*144)%144;
10878
l('buffPieTimer'+buff.id).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';
10879
}
10880
buff.time--;
10881
if (buff.time<=0)
10882
{
10883
if (Game.onCrate==l('buff'+buff.id)) Game.tooltip.hide();
10884
if (buff.onDie) buff.onDie();
10885
Game.buffsL.removeChild(l('buff'+buff.id));
10886
if (Game.buffs[buff.name])
10887
{
10888
Game.buffs[buff.name]=0;
10889
delete Game.buffs[buff.name];
10890
}
10891
Game.recalculateGains=1;
10892
Game.storeToRefresh=1;
10893
}
10894
}
10895
}
10896
Game.killBuff=function(what)//remove a buff by name
10897
{if (Game.buffs[what]){Game.buffs[what].time=0;/*Game.buffs[what]=0;*/}}
10898
Game.killBuffs=function()//remove all buffs
10899
{Game.buffsL.innerHTML='';Game.buffs=[];Game.recalculateGains=1;Game.storeToRefresh=1;}
10900
10901
10902
Game.buffTypes=[];//buff archetypes; only buffs declared from these can be saved and loaded
10903
Game.buffTypesByName=[];
10904
Game.buffTypesN=0;
10905
Game.buffType=function(name,func)
10906
{
10907
this.name=name;
10908
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
10909
this.id=Game.buffTypesN;
10910
this.vanilla=Game.vanilla;
10911
Game.buffTypesByName[this.name]=this;
10912
Game.buffTypes[Game.buffTypesN]=this;
10913
Game.buffTypesN++;
10914
}
10915
10916
/*
10917
basic buff parameters :
10918
name:'Kitten rain',
10919
desc:'It\'s raining kittens!',
10920
icon:[0,0],
10921
time:30*Game.fps
10922
other parameters :
10923
visible:false - will hide the buff from the buff list
10924
add:true - if this buff already exists, add the new duration to the old one
10925
max:true - if this buff already exists, set the new duration to the max of either
10926
onDie:function(){} - function will execute when the buff runs out
10927
power:3 - used by some buffs
10928
multCpS:3 - buff multiplies CpS by this amount
10929
multClick:3 - buff multiplies click power by this amount
10930
*/
10931
10932
//base buffs
10933
new Game.buffType('frenzy',function(time,pow)
10934
{
10935
return {
10936
name:'Frenzy',
10937
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
10938
icon:[10,14],
10939
time:time*Game.fps,
10940
add:true,
10941
multCpS:pow,
10942
aura:1
10943
};
10944
});
10945
new Game.buffType('blood frenzy',function(time,pow)
10946
{
10947
return {
10948
name:'Elder frenzy',
10949
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
10950
icon:[29,6],
10951
time:time*Game.fps,
10952
add:true,
10953
multCpS:pow,
10954
aura:1
10955
};
10956
});
10957
new Game.buffType('clot',function(time,pow)
10958
{
10959
return {
10960
name:'Clot',
10961
desc:'Cookie production halved for '+Game.sayTime(time*Game.fps,-1)+'!',
10962
icon:[15,5],
10963
time:time*Game.fps,
10964
add:true,
10965
multCpS:pow,
10966
aura:2
10967
};
10968
});
10969
new Game.buffType('dragon harvest',function(time,pow)
10970
{
10971
return {
10972
name:'Dragon Harvest',
10973
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
10974
icon:[10,25],
10975
time:time*Game.fps,
10976
add:true,
10977
multCpS:pow,
10978
aura:1
10979
};
10980
});
10981
new Game.buffType('everything must go',function(time,pow)
10982
{
10983
return {
10984
name:'Everything must go',
10985
desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
10986
icon:[17,6],
10987
time:time*Game.fps,
10988
add:true,
10989
power:pow,
10990
aura:1
10991
};
10992
});
10993
new Game.buffType('cursed finger',function(time,pow)
10994
{
10995
return {
10996
name:'Cursed finger',
10997
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.',
10998
icon:[12,17],
10999
time:time*Game.fps,
11000
add:true,
11001
power:pow,
11002
multCpS:0,
11003
aura:1
11004
};
11005
});
11006
new Game.buffType('click frenzy',function(time,pow)
11007
{
11008
return {
11009
name:'Click frenzy',
11010
desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11011
icon:[0,14],
11012
time:time*Game.fps,
11013
add:true,
11014
multClick:pow,
11015
aura:1
11016
};
11017
});
11018
new Game.buffType('dragonflight',function(time,pow)
11019
{
11020
return {
11021
name:'Dragonflight',
11022
desc:'Clicking power x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11023
icon:[0,25],
11024
time:time*Game.fps,
11025
add:true,
11026
multClick:pow,
11027
aura:1
11028
};
11029
});
11030
new Game.buffType('cookie storm',function(time,pow)
11031
{
11032
return {
11033
name:'Cookie storm',
11034
desc:'Cookies everywhere!',
11035
icon:[22,6],
11036
time:time*Game.fps,
11037
add:true,
11038
power:pow,
11039
aura:1
11040
};
11041
});
11042
new Game.buffType('building buff',function(time,pow,building)
11043
{
11044
var obj=Game.ObjectsById[building];
11045
return {
11046
name:Game.goldenCookieBuildingBuffs[obj.name][0],
11047
desc:'Your '+obj.amount+' '+obj.plural+' are boosting your CpS!<br>Cookie production +'+(Math.ceil(pow*100-100))+'% for '+Game.sayTime(time*Game.fps,-1)+'!',
11048
icon:[obj.iconColumn,14],
11049
time:time*Game.fps,
11050
add:true,
11051
multCpS:pow,
11052
aura:1
11053
};
11054
});
11055
new Game.buffType('building debuff',function(time,pow,building)
11056
{
11057
var obj=Game.ObjectsById[building];
11058
return {
11059
name:Game.goldenCookieBuildingBuffs[obj.name][1],
11060
desc:'Your '+obj.amount+' '+obj.plural+' are rusting your CpS!<br>Cookie production '+(Math.ceil(pow*100-100))+'% slower for '+Game.sayTime(time*Game.fps,-1)+'!',
11061
icon:[obj.iconColumn,15],
11062
time:time*Game.fps,
11063
add:true,
11064
multCpS:1/pow,
11065
aura:2
11066
};
11067
});
11068
new Game.buffType('sugar blessing',function(time,pow)
11069
{
11070
return {
11071
name:'Sugar blessing',
11072
desc:'You find 10% more golden cookies for the next '+Game.sayTime(time*Game.fps,-1)+'.',
11073
icon:[29,16],
11074
time:time*Game.fps,
11075
//add:true
11076
};
11077
});
11078
new Game.buffType('haggler luck',function(time,pow)
11079
{
11080
return {
11081
name:'Haggler\'s luck',
11082
desc:'All upgrades are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
11083
icon:[25,11],
11084
time:time*Game.fps,
11085
power:pow,
11086
max:true
11087
};
11088
});
11089
new Game.buffType('haggler misery',function(time,pow)
11090
{
11091
return {
11092
name:'Haggler\'s misery',
11093
desc:'All upgrades are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',
11094
icon:[25,11],
11095
time:time*Game.fps,
11096
power:pow,
11097
max:true
11098
};
11099
});
11100
new Game.buffType('pixie luck',function(time,pow)
11101
{
11102
return {
11103
name:'Crafty pixies',
11104
desc:'All buildings are '+pow+'% cheaper for '+Game.sayTime(time*Game.fps,-1)+'!',
11105
icon:[26,11],
11106
time:time*Game.fps,
11107
power:pow,
11108
max:true
11109
};
11110
});
11111
new Game.buffType('pixie misery',function(time,pow)
11112
{
11113
return {
11114
name:'Nasty goblins',
11115
desc:'All buildings are '+pow+'% pricier for '+Game.sayTime(time*Game.fps,-1)+'!',
11116
icon:[26,11],
11117
time:time*Game.fps,
11118
power:pow,
11119
max:true
11120
};
11121
});
11122
new Game.buffType('magic adept',function(time,pow)
11123
{
11124
return {
11125
name:'Magic adept',
11126
desc:'Spells backfire '+pow+' times less for '+Game.sayTime(time*Game.fps,-1)+'.',
11127
icon:[29,11],
11128
time:time*Game.fps,
11129
power:pow,
11130
max:true
11131
};
11132
});
11133
new Game.buffType('magic inept',function(time,pow)
11134
{
11135
return {
11136
name:'Magic inept',
11137
desc:'Spells backfire '+pow+' times more for '+Game.sayTime(time*Game.fps,-1)+'.',
11138
icon:[29,11],
11139
time:time*Game.fps,
11140
power:pow,
11141
max:true
11142
};
11143
});
11144
new Game.buffType('devastation',function(time,pow)
11145
{
11146
return {
11147
name:'Devastation',
11148
desc:'Clicking power +'+Math.floor(pow*100-100)+'% for '+Game.sayTime(time*Game.fps,-1)+'!',
11149
icon:[23,18],
11150
time:time*Game.fps,
11151
multClick:pow,
11152
aura:1,
11153
max:true
11154
};
11155
});
11156
new Game.buffType('sugar frenzy',function(time,pow)
11157
{
11158
return {
11159
name:'Sugar frenzy',
11160
desc:'Cookie production x'+pow+' for '+Game.sayTime(time*Game.fps,-1)+'!',
11161
icon:[29,14],
11162
time:time*Game.fps,
11163
add:true,
11164
multCpS:pow,
11165
aura:0
11166
};
11167
});
11168
11169
//end of buffs
11170
11171
11172
11173
11174
11175
BeautifyAll();
11176
Game.vanilla=0;//everything we create beyond this will not be saved in the default save
11177
11178
11179
for (var i in Game.customCreate) {Game.customCreate[i]();}
11180
11181
11182
/*=====================================================================================
11183
GRANDMAPOCALYPSE
11184
=======================================================================================*/
11185
Game.UpdateGrandmapocalypse=function()
11186
{
11187
if (Game.Has('Elder Covenant') || Game.Objects['Grandma'].amount==0) Game.elderWrath=0;
11188
else if (Game.pledgeT>0)//if the pledge is active, lower it
11189
{
11190
Game.pledgeT--;
11191
if (Game.pledgeT==0)//did we reach 0? make the pledge purchasable again
11192
{
11193
Game.Lock('Elder Pledge');
11194
Game.Unlock('Elder Pledge');
11195
Game.elderWrath=1;
11196
}
11197
}
11198
else
11199
{
11200
if (Game.Has('One mind') && Game.elderWrath==0)
11201
{
11202
Game.elderWrath=1;
11203
}
11204
if (Math.random()<0.001 && Game.elderWrath<Game.Has('One mind')+Game.Has('Communal brainsweep')+Game.Has('Elder Pact'))
11205
{
11206
Game.elderWrath++;//have we already pledged? make the elder wrath shift between different stages
11207
}
11208
if (Game.Has('Elder Pact') && Game.Upgrades['Elder Pledge'].unlocked==0)
11209
{
11210
Game.Lock('Elder Pledge');
11211
Game.Unlock('Elder Pledge');
11212
}
11213
}
11214
Game.elderWrathD+=((Game.elderWrath+1)-Game.elderWrathD)*0.001;//slowly fade to the target wrath state
11215
11216
if (Game.elderWrath!=Game.elderWrathOld) Game.storeToRefresh=1;
11217
11218
Game.elderWrathOld=Game.elderWrath;
11219
11220
Game.UpdateWrinklers();
11221
}
11222
11223
//wrinklers
11224
11225
function inRect(x,y,rect)
11226
{
11227
//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)
11228
//I found this somewhere online I guess
11229
var dx = x+Math.sin(-rect.r)*(-(rect.h/2-rect.o)),dy=y+Math.cos(-rect.r)*(-(rect.h/2-rect.o));
11230
var h1 = Math.sqrt(dx*dx + dy*dy);
11231
var currA = Math.atan2(dy,dx);
11232
var newA = currA - rect.r;
11233
var x2 = Math.cos(newA) * h1;
11234
var y2 = Math.sin(newA) * h1;
11235
if (x2 > -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true;
11236
return false;
11237
}
11238
11239
Game.wrinklerHP=2.1;
11240
Game.wrinklers=[];
11241
for (var i=0;i<12;i++)
11242
{
11243
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});
11244
}
11245
Game.getWrinklersMax=function()
11246
{
11247
var n=10;
11248
if (Game.Has('Elder spice')) n+=2;
11249
return n;
11250
}
11251
Game.ResetWrinklers=function()
11252
{
11253
for (var i in Game.wrinklers)
11254
{
11255
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};
11256
}
11257
}
11258
Game.CollectWrinklers=function()
11259
{
11260
for (var i in Game.wrinklers)
11261
{
11262
Game.wrinklers[i].hp=0;
11263
}
11264
}
11265
Game.wrinklerSquishSound=Math.floor(Math.random()*4)+1;
11266
Game.playWrinklerSquishSound=function()
11267
{
11268
PlaySound('snd/squish'+(Game.wrinklerSquishSound)+'.mp3',0.5);
11269
Game.wrinklerSquishSound+=Math.floor(Math.random()*1.5)+1;
11270
if (Game.wrinklerSquishSound>4) Game.wrinklerSquishSound-=4;
11271
}
11272
Game.SpawnWrinkler=function(me)
11273
{
11274
if (!me)
11275
{
11276
var max=Game.getWrinklersMax();
11277
var n=0;
11278
for (var i in Game.wrinklers)
11279
{
11280
if (Game.wrinklers[i].phase>0) n++;
11281
}
11282
for (var i in Game.wrinklers)
11283
{
11284
var it=Game.wrinklers[i];
11285
if (it.phase==0 && Game.elderWrath>0 && n<max && it.id<max)
11286
{
11287
me=it;
11288
break;
11289
}
11290
}
11291
}
11292
if (!me) return false;
11293
me.phase=1;
11294
me.hp=Game.wrinklerHP;
11295
me.type=0;
11296
if (Math.random()<0.0001) me.type=1;//shiny wrinkler
11297
return me;
11298
}
11299
Game.PopRandomWrinkler=function()
11300
{
11301
var wrinklers=[];
11302
for (var i in Game.wrinklers)
11303
{
11304
if (Game.wrinklers[i].phase>0 && Game.wrinklers[i].hp>0) wrinklers.push(Game.wrinklers[i]);
11305
}
11306
if (wrinklers.length>0)
11307
{
11308
var me=choose(wrinklers);
11309
me.hp=-10;
11310
return me;
11311
}
11312
return false;
11313
}
11314
Game.UpdateWrinklers=function()
11315
{
11316
var xBase=0;
11317
var yBase=0;
11318
var onWrinkler=0;
11319
if (Game.LeftBackground)
11320
{
11321
xBase=Game.cookieOriginX;
11322
yBase=Game.cookieOriginY;
11323
}
11324
var max=Game.getWrinklersMax();
11325
var n=0;
11326
for (var i in Game.wrinklers)
11327
{
11328
if (Game.wrinklers[i].phase>0) n++;
11329
}
11330
for (var i in Game.wrinklers)
11331
{
11332
var me=Game.wrinklers[i];
11333
if (me.phase==0 && Game.elderWrath>0 && n<max && me.id<max)
11334
{
11335
var chance=0.00001*Game.elderWrath;
11336
chance*=Game.eff('wrinklerSpawn');
11337
if (Game.Has('Unholy bait')) chance*=5;
11338
if (Game.hasGod)
11339
{
11340
var godLvl=Game.hasGod('scorn');
11341
if (godLvl==1) chance*=2.5;
11342
else if (godLvl==2) chance*=2;
11343
else if (godLvl==3) chance*=1.5;
11344
}
11345
if (Game.Has('Wrinkler doormat')) chance=0.1;
11346
if (Math.random()<chance)//respawn
11347
{
11348
Game.SpawnWrinkler(me);
11349
}
11350
}
11351
if (me.phase>0)
11352
{
11353
if (me.close<1) me.close+=(1/Game.fps)/10;
11354
if (me.close>1) me.close=1;
11355
}
11356
else me.close=0;
11357
if (me.close==1 && me.phase==1)
11358
{
11359
me.phase=2;
11360
Game.recalculateGains=1;
11361
}
11362
if (me.phase==2)
11363
{
11364
me.sucked+=(((Game.cookiesPs/Game.fps)*Game.cpsSucked));//suck the cookies
11365
}
11366
if (me.phase>0)
11367
{
11368
if (me.type==0)
11369
{
11370
if (me.hp<Game.wrinklerHP) me.hp+=0.04;
11371
me.hp=Math.min(Game.wrinklerHP,me.hp);
11372
}
11373
else if (me.type==1)
11374
{
11375
if (me.hp<Game.wrinklerHP*3) me.hp+=0.04;
11376
me.hp=Math.min(Game.wrinklerHP*3,me.hp);
11377
}
11378
var d=128*(2-me.close);//*Game.BigCookieSize;
11379
if (Game.prefs.fancy) d+=Math.cos(Game.T*0.05+parseInt(me.id))*4;
11380
me.r=(me.id/max)*360;
11381
if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.05+parseInt(me.id))*4;
11382
me.x=xBase+(Math.sin(me.r*Math.PI/180)*d);
11383
me.y=yBase+(Math.cos(me.r*Math.PI/180)*d);
11384
if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.09+parseInt(me.id))*4;
11385
var rect={w:100,h:200,r:(-me.r)*Math.PI/180,o:10};
11386
if (Math.random()<0.01) me.hurt=Math.max(me.hurt,Math.random());
11387
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;}
11388
if (me.selected && onWrinkler==0 && Game.CanClick)
11389
{
11390
me.hurt=Math.max(me.hurt,0.25);
11391
//me.close*=0.99;
11392
if (Game.Click && Game.lastClickedEl==l('backgroundLeftCanvas'))
11393
{
11394
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
11395
else
11396
{
11397
Game.playWrinklerSquishSound();
11398
me.hurt=1;
11399
me.hp-=0.75;
11400
if (Game.prefs.particles && !(me.hp<=0.5 && me.phase>0))
11401
{
11402
var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
11403
var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
11404
for (var ii=0;ii<3;ii++)
11405
{
11406
//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');
11407
var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
11408
part.r=-me.r;
11409
}
11410
}
11411
}
11412
Game.Click=0;
11413
}
11414
onWrinkler=1;
11415
}
11416
}
11417
11418
if (me.hurt>0)
11419
{
11420
me.hurt-=5/Game.fps;
11421
//me.close-=me.hurt*0.05;
11422
//me.x+=Math.random()*2-1;
11423
//me.y+=Math.random()*2-1;
11424
me.r+=(Math.sin(Game.T*1)*me.hurt)*18;//Math.random()*2-1;
11425
}
11426
if (me.hp<=0.5 && me.phase>0)
11427
{
11428
Game.playWrinklerSquishSound();
11429
PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
11430
Game.wrinklersPopped++;
11431
Game.recalculateGains=1;
11432
me.phase=0;
11433
me.close=0;
11434
me.hurt=0;
11435
me.hp=3;
11436
var toSuck=1.1;
11437
if (Game.Has('Sacrilegious corruption')) toSuck*=1.05;
11438
if (me.type==1) toSuck*=3;//shiny wrinklers are an elusive, profitable breed
11439
me.sucked*=toSuck;//cookie dough does weird things inside wrinkler digestive tracts
11440
if (Game.Has('Wrinklerspawn')) me.sucked*=1.05;
11441
if (Game.hasGod)
11442
{
11443
var godLvl=Game.hasGod('scorn');
11444
if (godLvl==1) me.sucked*=1.15;
11445
else if (godLvl==2) me.sucked*=1.1;
11446
else if (godLvl==3) me.sucked*=1.05;
11447
}
11448
if (me.sucked>0.5)
11449
{
11450
if (Game.prefs.popups) Game.Popup('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler : found '+Beautify(me.sucked)+' cookies!');
11451
else Game.Notify('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler','Found <b>'+Beautify(me.sucked)+'</b> cookies!',[19,8],6);
11452
Game.Popup('<div style="font-size:80%;">+'+Beautify(me.sucked)+' cookies</div>',Game.mouseX,Game.mouseY);
11453
11454
if (Game.season=='halloween')
11455
{
11456
//if (Math.random()<(Game.HasAchiev('Spooky cookies')?0.2:0.05))//halloween cookie drops
11457
var failRate=0.95;
11458
if (Game.HasAchiev('Spooky cookies')) failRate=0.8;
11459
if (Game.Has('Starterror')) failRate*=0.9;
11460
failRate*=1/Game.dropRateMult();
11461
if (Game.hasGod)
11462
{
11463
var godLvl=Game.hasGod('seasons');
11464
if (godLvl==1) failRate*=0.9;
11465
else if (godLvl==2) failRate*=0.95;
11466
else if (godLvl==3) failRate*=0.97;
11467
}
11468
if (me.type==1) failRate*=0.9;
11469
if (Math.random()>failRate)//halloween cookie drops
11470
{
11471
var cookie=choose(['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies']);
11472
if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))
11473
{
11474
Game.Unlock(cookie);
11475
if (Game.prefs.popups) Game.Popup('Found : '+cookie+'!');
11476
else Game.Notify(cookie,'You also found <b>'+cookie+'</b>!',Game.Upgrades[cookie].icon);
11477
}
11478
}
11479
}
11480
Game.DropEgg(0.98);
11481
}
11482
if (me.type==1) Game.Win('Last Chance to See');
11483
Game.Earn(me.sucked);
11484
/*if (Game.prefs.particles)
11485
{
11486
var x=me.x+(Math.sin(me.r*Math.PI/180)*100);
11487
var y=me.y+(Math.cos(me.r*Math.PI/180)*100);
11488
for (var ii=0;ii<6;ii++)
11489
{
11490
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');
11491
}
11492
}*/
11493
if (Game.prefs.particles)
11494
{
11495
var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
11496
var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
11497
if (me.sucked>0)
11498
{
11499
for (var ii=0;ii<5;ii++)
11500
{
11501
Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.75,1.5,2);
11502
}
11503
}
11504
for (var ii=0;ii<8;ii++)
11505
{
11506
var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
11507
part.r=-me.r;
11508
}
11509
}
11510
me.sucked=0;
11511
}
11512
}
11513
if (onWrinkler)
11514
{
11515
Game.mousePointer=1;
11516
}
11517
}
11518
Game.DrawWrinklers=function()
11519
{
11520
var ctx=Game.LeftBackground;
11521
var selected=0;
11522
for (var i in Game.wrinklers)
11523
{
11524
var me=Game.wrinklers[i];
11525
if (me.phase>0)
11526
{
11527
ctx.globalAlpha=me.close;
11528
ctx.save();
11529
ctx.translate(me.x,me.y);
11530
ctx.rotate(-(me.r)*Math.PI/180);
11531
//var s=Math.min(1,me.sucked/(Game.cookiesPs*60))*0.75+0.25;//scale wrinklers as they eat
11532
//ctx.scale(Math.pow(s,1.5)*1.25,s);
11533
//ctx.fillRect(-50,-10,100,200);
11534
if (me.type==1) ctx.drawImage(Pic('shinyWrinkler.png'),-50,-10);
11535
else if (Game.season=='christmas') ctx.drawImage(Pic('winterWrinkler.png'),-50,-10);
11536
else ctx.drawImage(Pic('wrinkler.png'),-50,-10);
11537
//ctx.fillText(me.id+' : '+me.sucked,0,0);
11538
if (me.type==1 && Math.random()<0.3 && Game.prefs.particles)//sparkle
11539
{
11540
ctx.globalAlpha=Math.random()*0.65+0.1;
11541
var s=Math.random()*30+5;
11542
ctx.globalCompositeOperation='lighter';
11543
ctx.drawImage(Pic('glint.jpg'),-s/2+Math.random()*50-25,-s/2+Math.random()*200,s,s);
11544
}
11545
ctx.restore();
11546
11547
if (me.phase==2 && Math.random()<0.03 && Game.prefs.particles)
11548
{
11549
Game.particleAdd(me.x,me.y,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.5,1,2);
11550
}
11551
11552
if (me.selected) selected=me;
11553
}
11554
}
11555
if (selected && Game.Has('Eye of the wrinkler'))
11556
{
11557
var x=Game.cookieOriginX;
11558
var y=Game.cookieOriginY;
11559
ctx.font='14px Merriweather';
11560
ctx.textAlign='center';
11561
var width=Math.max(ctx.measureText('Swallowed :').width,ctx.measureText(Beautify(selected.sucked)).width);
11562
ctx.fillStyle='#000';
11563
ctx.strokeStyle='#000';
11564
ctx.lineWidth=8;
11565
ctx.globalAlpha=0.5;
11566
ctx.beginPath();
11567
ctx.moveTo(x,y);
11568
ctx.lineTo(Math.floor(selected.x),Math.floor(selected.y));
11569
ctx.stroke();
11570
ctx.fillRect(x-width/2-8-14,y-23,width+16+28,38);
11571
ctx.globalAlpha=1;
11572
ctx.fillStyle='#fff';
11573
ctx.fillText('Swallowed :',x+14,y-8);
11574
ctx.fillText(Beautify(selected.sucked),x+14,y+8);
11575
ctx.drawImage(Pic('icons.png'),27*48,26*48,48,48,x-width/2-8-22,y-4-24,48,48);
11576
}
11577
}
11578
Game.SaveWrinklers=function()
11579
{
11580
var amount=0;
11581
var amountShinies=0;
11582
var number=0;
11583
var shinies=0;
11584
for (var i in Game.wrinklers)
11585
{
11586
if (Game.wrinklers[i].sucked>0.5)
11587
{
11588
number++;
11589
if (Game.wrinklers[i].type==1)
11590
{
11591
shinies++;
11592
amountShinies+=Game.wrinklers[i].sucked;
11593
}
11594
else amount+=Game.wrinklers[i].sucked;
11595
}
11596
}
11597
return {amount:amount,number:number,shinies:shinies,amountShinies:amountShinies};
11598
}
11599
Game.LoadWrinklers=function(amount,number,shinies,amountShinies)
11600
{
11601
if (number>0 && (amount>0 || amountShinies>0))
11602
{
11603
var fullNumber=number-shinies;
11604
var fullNumberShinies=shinies;
11605
for (var i in Game.wrinklers)
11606
{
11607
if (number>0)
11608
{
11609
Game.wrinklers[i].phase=2;
11610
Game.wrinklers[i].close=1;
11611
Game.wrinklers[i].hp=3;
11612
if (shinies>0) {Game.wrinklers[i].type=1;Game.wrinklers[i].sucked=amountShinies/fullNumberShinies;shinies--;}
11613
else Game.wrinklers[i].sucked=amount/fullNumber;
11614
number--;
11615
}//respawn
11616
}
11617
}
11618
}
11619
11620
/*=====================================================================================
11621
SPECIAL THINGS AND STUFF
11622
=======================================================================================*/
11623
11624
11625
Game.specialTab='';
11626
Game.specialTabHovered='';
11627
Game.specialTabs=[];
11628
11629
Game.UpdateSpecial=function()
11630
{
11631
Game.specialTabs=[];
11632
if (Game.Has('A festive hat')) Game.specialTabs.push('santa');
11633
if (Game.Has('A crumbly egg')) Game.specialTabs.push('dragon');
11634
if (Game.specialTabs.length==0) {Game.ToggleSpecialMenu(0);return;}
11635
11636
if (Game.LeftBackground)
11637
{
11638
Game.specialTabHovered='';
11639
var len=Game.specialTabs.length;
11640
if (len==0) return;
11641
var y=Game.LeftBackground.canvas.height-24-48*len;
11642
for (var i in Game.specialTabs)
11643
{
11644
var selected=0;
11645
if (Game.specialTab==Game.specialTabs[i]) selected=1;
11646
var x=24;
11647
var s=1;
11648
if (selected) {s=2;x+=24;}
11649
11650
if (Math.abs(Game.mouseX-x)<=24*s && Math.abs(Game.mouseY-y)<=24*s)
11651
{
11652
Game.specialTabHovered=Game.specialTabs[i];
11653
Game.mousePointer=1;
11654
Game.CanClick=0;
11655
if (Game.Click)
11656
{
11657
if (Game.specialTab!=Game.specialTabs[i]) {Game.specialTab=Game.specialTabs[i];Game.ToggleSpecialMenu(1);PlaySound('snd/press.mp3');}
11658
else {Game.ToggleSpecialMenu(0);PlaySound('snd/press.mp3');}
11659
//PlaySound('snd/tick.mp3');
11660
}
11661
}
11662
11663
y+=48;
11664
}
11665
}
11666
}
11667
11668
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'];
11669
for (var i in Game.santaDrops)//scale christmas upgrade prices with santa level
11670
{Game.Upgrades[Game.santaDrops[i]].priceFunc=function(){return Math.pow(3,Game.santaLevel)*2525;}}
11671
11672
11673
Game.UpgradeSanta=function()
11674
{
11675
var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);
11676
if (Game.cookies>moni && Game.santaLevel<14)
11677
{
11678
PlaySound('snd/shimmerClick.mp3');
11679
11680
Game.Spend(moni);
11681
Game.santaLevel=(Game.santaLevel+1)%15;
11682
if (Game.santaLevel==14)
11683
{
11684
Game.Unlock('Santa\'s dominion');
11685
if (Game.prefs.popups) Game.Popup('You are granted<br>Santa\'s dominion.');
11686
else Game.Notify('You are granted Santa\'s dominion.','',Game.Upgrades['Santa\'s dominion'].icon);
11687
}
11688
var drops=[];
11689
for (var i in Game.santaDrops) {if (!Game.HasUnlocked(Game.santaDrops[i])) drops.push(Game.santaDrops[i]);}
11690
var drop=choose(drops);
11691
if (drop)
11692
{
11693
Game.Unlock(drop);
11694
if (Game.prefs.popups) Game.Popup('You find a present which contains...<br>'+drop+'!');
11695
else Game.Notify('Found a present!','You find a present which contains...<br><b>'+drop+'</b>!',Game.Upgrades[drop].icon);
11696
}
11697
11698
Game.ToggleSpecialMenu(1);
11699
11700
if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}
11701
11702
if (Game.santaLevel>=6) Game.Win('Coming to town');
11703
if (Game.santaLevel>=14) Game.Win('All hail Santa');
11704
Game.recalculateGains=1;
11705
Game.upgradesToRebuild=1;
11706
}
11707
}
11708
11709
Game.dragonLevels=[
11710
{name:'Dragon egg',action:'Chip it',pic:0,
11711
cost:function(){return Game.cookies>=1000000;},
11712
buy:function(){Game.Spend(1000000);},
11713
costStr:function(){return Beautify(1000000)+' cookies';}},
11714
{name:'Dragon egg',action:'Chip it',pic:1,
11715
cost:function(){return Game.cookies>=1000000*2;},
11716
buy:function(){Game.Spend(1000000*2);},
11717
costStr:function(){return Beautify(1000000*2)+' cookies';}},
11718
{name:'Dragon egg',action:'Chip it',pic:2,
11719
cost:function(){return Game.cookies>=1000000*4;},
11720
buy:function(){Game.Spend(1000000*4);},
11721
costStr:function(){return Beautify(1000000*4)+' cookies';}},
11722
{name:'Shivering dragon egg',action:'Hatch it',pic:3,
11723
cost:function(){return Game.cookies>=1000000*8;},
11724
buy:function(){Game.Spend(1000000*8);},
11725
costStr:function(){return Beautify(1000000*8)+' cookies';}},
11726
{name:'Krumblor, cookie hatchling',action:'Train Breath of Milk<br><small>Aura : kittens are 5% more effective</small>',pic:4,
11727
cost:function(){return Game.cookies>=1000000*16;},
11728
buy:function(){Game.Spend(1000000*16);},
11729
costStr:function(){return Beautify(1000000*16)+' cookies';}},
11730
{name:'Krumblor, cookie hatchling',action:'Train Dragon Cursor<br><small>Aura : clicking is 5% more effective</small>',pic:4,
11731
cost:function(){return Game.Objects['Cursor'].amount>=100;},
11732
buy:function(){Game.Objects['Cursor'].sacrifice(100);},
11733
costStr:function(){return '100 cursors';}},
11734
{name:'Krumblor, cookie hatchling',action:'Train Elder Battalion<br><small>Aura : grandmas gain +1% CpS for every non-grandma building</small>',pic:4,
11735
cost:function(){return Game.Objects['Grandma'].amount>=100;},
11736
buy:function(){Game.Objects['Grandma'].sacrifice(100);},
11737
costStr:function(){return '100 grandmas';}},
11738
{name:'Krumblor, cookie hatchling',action:'Train Reaper of Fields<br><small>Aura : golden cookies may trigger a Dragon Harvest</small>',pic:4,
11739
cost:function(){return Game.Objects['Farm'].amount>=100;},
11740
buy:function(){Game.Objects['Farm'].sacrifice(100);},
11741
costStr:function(){return '100 farms';}},
11742
{name:'Krumblor, cookie dragon',action:'Train Earth Shatterer<br><small>Aura : buildings sell back for 50% instead of 25%</small>',pic:5,
11743
cost:function(){return Game.Objects['Mine'].amount>=100;},
11744
buy:function(){Game.Objects['Mine'].sacrifice(100);},
11745
costStr:function(){return '100 mines';}},
11746
{name:'Krumblor, cookie dragon',action:'Train Master of the Armory<br><small>Aura : all upgrades are 2% cheaper</small>',pic:5,
11747
cost:function(){return Game.Objects['Factory'].amount>=100;},
11748
buy:function(){Game.Objects['Factory'].sacrifice(100);},
11749
costStr:function(){return '100 factories';}},
11750
{name:'Krumblor, cookie dragon',action:'Train Fierce Hoarder<br><small>Aura : all buildings are 2% cheaper</small>',pic:5,
11751
cost:function(){return Game.Objects['Bank'].amount>=100;},
11752
buy:function(){Game.Objects['Bank'].sacrifice(100);},
11753
costStr:function(){return '100 banks';}},
11754
{name:'Krumblor, cookie dragon',action:'Train Dragon God<br><small>Aura : prestige CpS bonus +5%</small>',pic:5,
11755
cost:function(){return Game.Objects['Temple'].amount>=100;},
11756
buy:function(){Game.Objects['Temple'].sacrifice(100);},
11757
costStr:function(){return '100 temples';}},
11758
{name:'Krumblor, cookie dragon',action:'Train Arcane Aura<br><small>Aura : golden cookies appear 5% more often</small>',pic:5,
11759
cost:function(){return Game.Objects['Wizard tower'].amount>=100;},
11760
buy:function(){Game.Objects['Wizard tower'].sacrifice(100);},
11761
costStr:function(){return '100 wizard towers';}},
11762
{name:'Krumblor, cookie dragon',action:'Train Dragonflight<br><small>Aura : golden cookies may trigger a Dragonflight</small>',pic:5,
11763
cost:function(){return Game.Objects['Shipment'].amount>=100;},
11764
buy:function(){Game.Objects['Shipment'].sacrifice(100);},
11765
costStr:function(){return '100 shipments';}},
11766
{name:'Krumblor, cookie dragon',action:'Train Ancestral Metamorphosis<br><small>Aura : golden cookies give 10% more cookies</small>',pic:5,
11767
cost:function(){return Game.Objects['Alchemy lab'].amount>=100;},
11768
buy:function(){Game.Objects['Alchemy lab'].sacrifice(100);},
11769
costStr:function(){return '100 alchemy labs';}},
11770
{name:'Krumblor, cookie dragon',action:'Train Unholy Dominion<br><small>Aura : wrath cookies give 10% more cookies</small>',pic:5,
11771
cost:function(){return Game.Objects['Portal'].amount>=100;},
11772
buy:function(){Game.Objects['Portal'].sacrifice(100);},
11773
costStr:function(){return '100 portals';}},
11774
{name:'Krumblor, cookie dragon',action:'Train Epoch Manipulator<br><small>Aura : golden cookie effects last 5% longer</small>',pic:5,
11775
cost:function(){return Game.Objects['Time machine'].amount>=100;},
11776
buy:function(){Game.Objects['Time machine'].sacrifice(100);},
11777
costStr:function(){return '100 time machines';}},
11778
{name:'Krumblor, cookie dragon',action:'Train Mind Over Matter<br><small>Aura : +25% random drops</small>',pic:5,
11779
cost:function(){return Game.Objects['Antimatter condenser'].amount>=100;},
11780
buy:function(){Game.Objects['Antimatter condenser'].sacrifice(100);},
11781
costStr:function(){return '100 antimatter condensers';}},
11782
{name:'Krumblor, cookie dragon',action:'Train Radiant Appetite<br><small>Aura : all cookie production multiplied by 2</small>',pic:5,
11783
cost:function(){return Game.Objects['Prism'].amount>=100;},
11784
buy:function(){Game.Objects['Prism'].sacrifice(100);},
11785
costStr:function(){return '100 prisms';}},
11786
{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Fortune<br><small>Aura : +123% CpS per golden cookie on-screen</small>',pic:5,
11787
cost:function(){return Game.Objects['Chancemaker'].amount>=100;},
11788
buy:function(){Game.Objects['Chancemaker'].sacrifice(100);},
11789
costStr:function(){return '100 chancemakers';}},
11790
{name:'Krumblor, cookie dragon',action:'Train Dragon\'s Curve<br><small>Aura : sugar lumps grow 5% faster, 50% weirder</small>',pic:5,
11791
cost:function(){return Game.Objects['Fractal engine'].amount>=100;},
11792
buy:function(){Game.Objects['Fractal engine'].sacrifice(100);},
11793
costStr:function(){return '100 fractal engines';}},
11794
{name:'Krumblor, cookie dragon',action:'Train Reality Bending<br><small>Aura : 10% of every other aura, combined</small>',pic:5,
11795
cost:function(){return Game.Objects['Javascript console'].amount>=100;},
11796
buy:function(){Game.Objects['Javascript console'].sacrifice(100);},
11797
costStr:function(){return '100 javascript consoles';}},
11798
{name:'Krumblor, cookie dragon',action:'Bake dragon cookie<br><small>Delicious!</small>',pic:6,
11799
cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<50) fail=1;}return (fail==0);},
11800
buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(50);}Game.Unlock('Dragon cookie');},
11801
costStr:function(){return '50 of every building';}},
11802
{name:'Krumblor, cookie dragon',action:'Train secondary aura<br><small>Lets you use two dragon auras simultaneously</small>',pic:7,
11803
cost:function(){var fail=0;for (var i in Game.Objects){if (Game.Objects[i].amount<200) fail=1;}return (fail==0);},
11804
buy:function(){for (var i in Game.Objects){Game.Objects[i].sacrifice(200);}},
11805
costStr:function(){return '200 of every building';}},
11806
{name:'Krumblor, cookie dragon',action:'Your dragon is fully trained.',pic:8}
11807
];
11808
11809
Game.dragonAuras={
11810
0:{name:'No aura',pic:[0,7],desc:'Select an aura from those your dragon knows.'},
11811
1:{name:'Breath of Milk',pic:[18,25],desc:'Kittens are <b>5%</b> more effective.'},
11812
2:{name:'Dragon Cursor',pic:[0,25],desc:'Clicking is <b>5%</b> more effective.'},
11813
3:{name:'Elder Battalion',pic:[1,25],desc:'Grandmas gain <b>+1% CpS</b> for every non-grandma building.'},
11814
4:{name:'Reaper of Fields',pic:[2,25],desc:'Golden cookies may trigger a <b>Dragon Harvest</b>.'},
11815
5:{name:'Earth Shatterer',pic:[3,25],desc:'Buildings sell back for <b>50%</b> instead of 25%.'},
11816
6:{name:'Master of the Armory',pic:[4,25],desc:'All upgrades are <b>2%</b> cheaper.'},
11817
7:{name:'Fierce Hoarder',pic:[15,25],desc:'All buildings are <b>2%</b> cheaper.'},
11818
8:{name:'Dragon God',pic:[16,25],desc:'Prestige CpS bonus <b>+5%</b>.'},
11819
9:{name:'Arcane Aura',pic:[17,25],desc:'Golden cookies appear <b>+5%</b> more often.'},
11820
10:{name:'Dragonflight',pic:[5,25],desc:'Golden cookies may trigger a <b>Dragonflight</b>.'},
11821
11:{name:'Ancestral Metamorphosis',pic:[6,25],desc:'Golden cookies give <b>10%</b> more cookies.'},
11822
12:{name:'Unholy Dominion',pic:[7,25],desc:'Wrath cookies give <b>10%</b> more cookies.'},
11823
13:{name:'Epoch Manipulator',pic:[8,25],desc:'Golden cookies last <b>5%</b> longer.'},
11824
14:{name:'Mind Over Matter',pic:[13,25],desc:'Random drops are <b>25% more common</b>.'},
11825
15:{name:'Radiant Appetite',pic:[14,25],desc:'All cookie production <b>multiplied by 2</b>.'},
11826
16:{name:'Dragon\'s Fortune',pic:[19,25],desc:'<b>+123% CpS</b> per golden cookie on-screen, multiplicative.'},
11827
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.'},
11828
18:{name:'Reality Bending',pic:[32,25],desc:'<b>One tenth</b> of every other dragon aura, <b>combined</b>.'},
11829
};
11830
11831
Game.hasAura=function(what)
11832
{
11833
if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) return true; else return false;
11834
}
11835
Game.auraMult=function(what)
11836
{
11837
var n=0;
11838
if (Game.dragonAuras[Game.dragonAura].name==what || Game.dragonAuras[Game.dragonAura2].name==what) n=1;
11839
if (Game.dragonAuras[Game.dragonAura].name=='Reality Bending' || Game.dragonAuras[Game.dragonAura2].name=='Reality Bending') n+=0.1;
11840
return n;
11841
}
11842
11843
Game.SelectDragonAura=function(slot,update)
11844
{
11845
var currentAura=0;
11846
var otherAura=0;
11847
if (slot==0) currentAura=Game.dragonAura; else currentAura=Game.dragonAura2;
11848
if (slot==0) otherAura=Game.dragonAura2; else otherAura=Game.dragonAura;
11849
if (!update) Game.SelectingDragonAura=currentAura;
11850
11851
var str='';
11852
for (var i in Game.dragonAuras)
11853
{
11854
if (Game.dragonLevel>=parseInt(i)+4)
11855
{
11856
var icon=Game.dragonAuras[i].pic;
11857
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+');"'+
11858
'></div>';
11859
}
11860
}
11861
11862
var highestBuilding=0;
11863
for (var i in Game.Objects) {if (Game.Objects[i].amount>0) highestBuilding=Game.Objects[i];}
11864
11865
Game.Prompt('<h3>Set your dragon\'s '+(slot==1?'secondary ':'')+'aura</h3>'+
11866
'<div class="line"></div>'+
11867
'<div id="dragonAuraInfo" style="min-height:60px;"></div>'+
11868
'<div style="text-align:center;">'+str+'</div>'+
11869
'<div class="line"></div>'+
11870
'<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>'
11871
,[['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');
11872
Game.DescribeDragonAura(Game.SelectingDragonAura);
11873
}
11874
Game.SelectingDragonAura=-1;
11875
Game.SetDragonAura=function(aura,slot)
11876
{
11877
Game.SelectingDragonAura=aura;
11878
Game.SelectDragonAura(slot,1);
11879
}
11880
Game.DescribeDragonAura=function(aura)
11881
{
11882
l('dragonAuraInfo').innerHTML=
11883
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[aura].name+'</h4>'+
11884
'<div class="line"></div>'+
11885
Game.dragonAuras[aura].desc+
11886
'</div>';
11887
}
11888
11889
Game.UpgradeDragon=function()
11890
{
11891
if (Game.dragonLevel<Game.dragonLevels.length-1 && Game.dragonLevels[Game.dragonLevel].cost())
11892
{
11893
PlaySound('snd/shimmerClick.mp3');
11894
Game.dragonLevels[Game.dragonLevel].buy();
11895
Game.dragonLevel=(Game.dragonLevel+1)%Game.dragonLevels.length;
11896
11897
if (Game.dragonLevel>=Game.dragonLevels.length-1) Game.Win('Here be dragon');
11898
Game.ToggleSpecialMenu(1);
11899
if (l('specialPic')){var rect=l('specialPic').getBoundingClientRect();Game.SparkleAt((rect.left+rect.right)/2,(rect.top+rect.bottom)/2);}
11900
Game.recalculateGains=1;
11901
Game.upgradesToRebuild=1;
11902
}
11903
}
11904
11905
Game.ToggleSpecialMenu=function(on)
11906
{
11907
if (on)
11908
{
11909
var pic='';
11910
var frame=0;
11911
if (Game.specialTab=='santa') {pic='santa.png';frame=Game.santaLevel;}
11912
else if (Game.specialTab=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}
11913
else {pic='dragon.png?v='+Game.version;frame=4;}
11914
11915
var str='<div id="specialPic" style="position:absolute;left:-16px;top:-64px;width:96px;height:96px;background:url(img/'+pic+');background-position:'+(-frame*96)+'px 0px;filter:drop-shadow(0px 3px 2px #000);-webkit-filter:drop-shadow(0px 3px 2px #000);"></div>';
11916
str+='<div class="close" onclick="PlaySound(\'snd/press.mp3\');Game.ToggleSpecialMenu(0);">x</div>';
11917
11918
if (Game.specialTab=='santa')
11919
{
11920
var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1);
11921
11922
str+='<h3>'+Game.santaLevels[Game.santaLevel]+'</h3>';
11923
if (Game.santaLevel<14)
11924
{
11925
str+='<div class="line"></div>'+
11926
'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeSanta();">'+
11927
'<div style="display:table-cell;vertical-align:middle;">Evolve</div>'+
11928
'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+
11929
'<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>'+
11930
'</a></div>';
11931
}
11932
}
11933
else if (Game.specialTab=='dragon')
11934
{
11935
var level=Game.dragonLevels[Game.dragonLevel];
11936
11937
str+='<h3>'+level.name+'</h3>';
11938
11939
if (Game.dragonLevel>=5)
11940
{
11941
var icon=Game.dragonAuras[Game.dragonAura].pic;
11942
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(
11943
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura].name+'</h4>'+
11944
'<div class="line"></div>'+
11945
Game.dragonAuras[Game.dragonAura].desc+
11946
'</div>'
11947
,'top')+
11948
'></div>';
11949
}
11950
if (Game.dragonLevel>=24)//2nd aura slot; increased with last building (javascript consoles)
11951
{
11952
var icon=Game.dragonAuras[Game.dragonAura2].pic;
11953
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(
11954
'<div style="min-width:200px;text-align:center;"><h4>'+Game.dragonAuras[Game.dragonAura2].name+'</h4>'+
11955
'<div class="line"></div>'+
11956
Game.dragonAuras[Game.dragonAura2].desc+
11957
'</div>'
11958
,'top')+
11959
'></div>';
11960
}
11961
11962
if (Game.dragonLevel<Game.dragonLevels.length-1)
11963
{
11964
str+='<div class="line"></div>'+
11965
'<div class="optionBox" style="margin-bottom:0px;"><a class="option framed large title" '+Game.clickStr+'="Game.UpgradeDragon();">'+
11966
'<div style="display:table-cell;vertical-align:middle;">'+level.action+'</div>'+
11967
'<div style="display:table-cell;vertical-align:middle;padding:4px 12px;">|</div>'+
11968
'<div style="display:table-cell;vertical-align:middle;font-size:65%;">sacrifice<div'+(level.cost()?'':' style="color:#777;"')+'>'+level.costStr()+'</div></div>'+
11969
'</a></div>';
11970
}
11971
else
11972
{
11973
str+='<div class="line"></div>'+
11974
'<div style="text-align:center;margin-bottom:4px;">'+level.action+'</div>';
11975
}
11976
}
11977
11978
l('specialPopup').innerHTML=str;
11979
11980
l('specialPopup').className='framed prompt onScreen';
11981
}
11982
else
11983
{
11984
if (Game.specialTab!='')
11985
{
11986
Game.specialTab='';
11987
l('specialPopup').className='framed prompt offScreen';
11988
setTimeout(function(){if (Game.specialTab=='') {/*l('specialPopup').style.display='none';*/l('specialPopup').innerHTML='';}},1000*0.2);
11989
}
11990
}
11991
}
11992
Game.DrawSpecial=function()
11993
{
11994
var len=Game.specialTabs.length;
11995
if (len==0) return;
11996
Game.LeftBackground.globalAlpha=1;
11997
var y=Game.LeftBackground.canvas.height-24-48*len;
11998
var tabI=0;
11999
12000
for (var i in Game.specialTabs)
12001
{
12002
var selected=0;
12003
var hovered=0;
12004
if (Game.specialTab==Game.specialTabs[i]) selected=1;
12005
if (Game.specialTabHovered==Game.specialTabs[i]) hovered=1;
12006
var x=24;
12007
var s=1;
12008
var pic='';
12009
var frame=0;
12010
if (hovered) {s=1;x=24;}
12011
if (selected) {s=1;x=48;}
12012
12013
if (Game.specialTabs[i]=='santa') {pic='santa.png';frame=Game.santaLevel;}
12014
else if (Game.specialTabs[i]=='dragon') {pic='dragon.png?v='+Game.version;frame=Game.dragonLevels[Game.dragonLevel].pic;}
12015
else {pic='dragon.png?v='+Game.version;frame=4;}
12016
12017
if (hovered || selected)
12018
{
12019
var ss=s*64;
12020
var r=Math.floor((Game.T*0.5)%360);
12021
Game.LeftBackground.save();
12022
Game.LeftBackground.translate(x,y);
12023
if (Game.prefs.fancy) Game.LeftBackground.rotate((r/360)*Math.PI*2);
12024
Game.LeftBackground.globalAlpha=0.75;
12025
Game.LeftBackground.drawImage(Pic('shine.png'),-ss/2,-ss/2,ss,ss);
12026
Game.LeftBackground.restore();
12027
}
12028
12029
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);
12030
else Game.LeftBackground.drawImage(Pic(pic),96*frame,0,96,96,(x-24*s),(y-24*s),48*s,48*s);
12031
12032
tabI++;
12033
y+=48;
12034
}
12035
12036
}
12037
12038
/*=====================================================================================
12039
VISUAL EFFECTS
12040
=======================================================================================*/
12041
12042
Game.Milks=[
12043
{name:'Rank I - Plain milk',pic:'milkPlain',icon:[1,8]},
12044
{name:'Rank II - Chocolate milk',pic:'milkChocolate',icon:[2,8]},
12045
{name:'Rank III - Raspberry milk',pic:'milkRaspberry',icon:[3,8]},
12046
{name:'Rank IV - Orange milk',pic:'milkOrange',icon:[4,8]},
12047
{name:'Rank V - Caramel milk',pic:'milkCaramel',icon:[5,8]},
12048
{name:'Rank VI - Banana milk',pic:'milkBanana',icon:[6,8]},
12049
{name:'Rank VII - Lime milk',pic:'milkLime',icon:[7,8]},
12050
{name:'Rank VIII - Blueberry milk',pic:'milkBlueberry',icon:[8,8]},
12051
{name:'Rank IX - Strawberry milk',pic:'milkStrawberry',icon:[9,8]},
12052
{name:'Rank X - Vanilla milk',pic:'milkVanilla',icon:[10,8]},
12053
{name:'Rank XI - Honey milk',pic:'milkHoney',icon:[21,23]},
12054
{name:'Rank XII - Coffee milk',pic:'milkCoffee',icon:[22,23]},
12055
{name:'Rank XIII - Tea with a spot of milk',pic:'milkTea',icon:[23,23]},
12056
{name:'Rank XIV - Coconut milk',pic:'milkCoconut',icon:[24,23]},
12057
{name:'Rank XV - Cherry milk',pic:'milkCherry',icon:[25,23]},
12058
{name:'Rank XVI - Spiced milk',pic:'milkSpiced',icon:[26,23]},
12059
{name:'Rank XVII - Maple milk',pic:'milkMaple',icon:[28,23]},
12060
{name:'Rank XVIII - Mint milk',pic:'milkMint',icon:[29,23]},
12061
];
12062
Game.Milk=Game.Milks[0];
12063
12064
Game.mousePointer=0;//when 1, draw the mouse as a pointer on the left screen
12065
12066
Game.cookieOriginX=0;
12067
Game.cookieOriginY=0;
12068
Game.DrawBackground=function()
12069
{
12070
12071
Timer.clean();
12072
//background
12073
if (!Game.Background)//init some stuff
12074
{
12075
Game.Background=l('backgroundCanvas').getContext('2d');
12076
Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;
12077
Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;
12078
Game.LeftBackground=l('backgroundLeftCanvas').getContext('2d');
12079
Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;
12080
Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;
12081
//preload ascend animation bits so they show up instantly
12082
Game.LeftBackground.globalAlpha=0;
12083
Game.LeftBackground.drawImage(Pic('brokenCookie.png'),0,0);
12084
Game.LeftBackground.drawImage(Pic('brokenCookieHalo.png'),0,0);
12085
Game.LeftBackground.drawImage(Pic('starbg.jpg'),0,0);
12086
12087
window.addEventListener('resize', function(event)
12088
{
12089
Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth;
12090
Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight;
12091
Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth;
12092
Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight;
12093
});
12094
}
12095
12096
var ctx=Game.LeftBackground;
12097
12098
if (Game.OnAscend)
12099
{
12100
Timer.clean();
12101
//starry background on ascend screen
12102
var w=Game.Background.canvas.width;
12103
var h=Game.Background.canvas.height;
12104
var b=Game.ascendl.getBoundingClientRect();
12105
var x=(b.left+b.right)/2;
12106
var y=(b.top+b.bottom)/2;
12107
Game.Background.globalAlpha=0.5;
12108
var s=1*Game.AscendZoom*(1+Math.cos(Game.T*0.0027)*0.05);
12109
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);
12110
Timer.track('star layer 1');
12111
if (Game.prefs.fancy)
12112
{
12113
//additional star layer
12114
Game.Background.globalAlpha=0.5*(0.5+Math.sin(Game.T*0.02)*0.3);
12115
var s=2*Game.AscendZoom*(1+Math.sin(Game.T*0.002)*0.07);
12116
//Game.Background.globalCompositeOperation='lighter';
12117
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);
12118
//Game.Background.globalCompositeOperation='source-over';
12119
Timer.track('star layer 2');
12120
12121
x=x+Game.AscendOffX*Game.AscendZoom;
12122
y=y+Game.AscendOffY*Game.AscendZoom;
12123
//wispy nebula around the center
12124
Game.Background.save();
12125
Game.Background.globalAlpha=0.5;
12126
Game.Background.translate(x,y);
12127
Game.Background.globalCompositeOperation='lighter';
12128
Game.Background.rotate(Game.T*0.001);
12129
s=(600+150*Math.sin(Game.T*0.007))*Game.AscendZoom;
12130
Game.Background.drawImage(Pic('heavenRing1.jpg'),-s/2,-s/2,s,s);
12131
Game.Background.rotate(-Game.T*0.0017);
12132
s=(600+150*Math.sin(Game.T*0.0037))*Game.AscendZoom;
12133
Game.Background.drawImage(Pic('heavenRing2.jpg'),-s/2,-s/2,s,s);
12134
Game.Background.restore();
12135
Timer.track('nebula');
12136
12137
/*
12138
//links between upgrades
12139
//not in because I am bad at this
12140
Game.Background.globalAlpha=1;
12141
Game.Background.save();
12142
Game.Background.translate(x,y);
12143
s=(32)*Game.AscendZoom;
12144
12145
for (var i in Game.PrestigeUpgrades)
12146
{
12147
var me=Game.PrestigeUpgrades[i];
12148
var ghosted=0;
12149
if (me.canBePurchased || Game.Has('Neuromancy')){}
12150
else
12151
{
12152
for (var ii in me.parents){if (me.parents[ii]!=-1 && me.parents[ii].canBePurchased) ghosted=1;}
12153
}
12154
for (var ii in me.parents)//create pulsing links
12155
{
12156
if (me.parents[ii]!=-1 && (me.canBePurchased || ghosted))
12157
{
12158
var origX=0;
12159
var origY=0;
12160
var targX=me.posX+28;
12161
var targY=me.posY+28;
12162
if (me.parents[ii]!=-1) {origX=me.parents[ii].posX+28;origY=me.parents[ii].posY+28;}
12163
var rot=-Math.atan((targY-origY)/(origX-targX));
12164
if (targX<=origX) rot+=180;
12165
var dist=Math.floor(Math.sqrt((targX-origX)*(targX-origX)+(targY-origY)*(targY-origY)));
12166
origX+=2;
12167
origY-=18;
12168
//rot=-(Math.PI/2)*(me.id%4);
12169
Game.Background.translate(origX,origY);
12170
Game.Background.rotate(rot);
12171
//Game.Background.drawImage(Pic('linkPulse.png'),-s/2,-s/2,s,s);
12172
Game.Background.fillPattern(Pic('linkPulse.png'),0,-4,dist,8,32,8);
12173
Game.Background.rotate(-rot);
12174
Game.Background.translate(-origX,-origY);
12175
}
12176
}
12177
}
12178
Game.Background.restore();
12179
Timer.track('links');
12180
*/
12181
12182
//Game.Background.drawImage(Pic('shadedBorders.png'),0,0,w,h);
12183
//Timer.track('border');
12184
}
12185
}
12186
else
12187
{
12188
12189
var goodBuff=0;
12190
var badBuff=0;
12191
for (var i in Game.buffs)
12192
{
12193
if (Game.buffs[i].aura==1) goodBuff=1;
12194
if (Game.buffs[i].aura==2) badBuff=1;
12195
}
12196
12197
if (Game.drawT%5==0)
12198
{
12199
Game.defaultBg='bgBlue';
12200
Game.bgR=0;
12201
12202
if (Game.season=='fools') Game.defaultBg='bgMoney';
12203
if (Game.elderWrathD<1)
12204
{
12205
Game.bgR=0;
12206
Game.bg=Game.defaultBg;
12207
Game.bgFade=Game.defaultBg;
12208
}
12209
else if (Game.elderWrathD>=1 && Game.elderWrathD<2)
12210
{
12211
Game.bgR=(Game.elderWrathD-1)/1;
12212
Game.bg=Game.defaultBg;
12213
Game.bgFade='grandmas1';
12214
}
12215
else if (Game.elderWrathD>=2 && Game.elderWrathD<3)
12216
{
12217
Game.bgR=(Game.elderWrathD-2)/1;
12218
Game.bg='grandmas1';
12219
Game.bgFade='grandmas2';
12220
}
12221
else if (Game.elderWrathD>=3)// && Game.elderWrathD<4)
12222
{
12223
Game.bgR=(Game.elderWrathD-3)/1;
12224
Game.bg='grandmas2';
12225
Game.bgFade='grandmas3';
12226
}
12227
12228
if (Game.bgType!=0 && Game.ascensionMode!=1)
12229
{
12230
Game.bgR=0;
12231
Game.bg=Game.BGsByChoice[Game.bgType].pic;
12232
Game.bgFade=Game.bg;
12233
}
12234
12235
Game.Background.fillPattern(Pic(Game.bg+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);
12236
if (Game.bgR>0)
12237
{
12238
Game.Background.globalAlpha=Game.bgR;
12239
Game.Background.fillPattern(Pic(Game.bgFade+'.jpg'),0,0,Game.Background.canvas.width,Game.Background.canvas.height,512,512,0,0);
12240
}
12241
Game.Background.globalAlpha=1;
12242
Game.Background.drawImage(Pic('shadedBordersSoft.png'),0,0,Game.Background.canvas.width,Game.Background.canvas.height);
12243
12244
}
12245
Timer.track('window background');
12246
12247
//clear
12248
ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
12249
/*if (Game.AscendTimer<Game.AscendBreakpoint) ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
12250
else
12251
{
12252
ctx.globalAlpha=0.05;
12253
ctx.fillStyle='#000';
12254
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
12255
ctx.globalAlpha=1;
12256
OldCanvasDrawImage.apply(ctx,[ctx.canvas,Math.random()*4-2,Math.random()*4-2-4]);
12257
ctx.globalAlpha=1;
12258
}*/
12259
Timer.clean();
12260
12261
var showDragon=0;
12262
if (Game.hasBuff('Dragonflight') || Game.hasBuff('Dragon Harvest')) showDragon=1;
12263
12264
Game.cookieOriginX=Math.floor(ctx.canvas.width/2);
12265
Game.cookieOriginY=Math.floor(ctx.canvas.height*0.4);
12266
12267
if (Game.AscendTimer==0)
12268
{
12269
if (Game.prefs.particles)
12270
{
12271
//falling cookies
12272
var pic='';
12273
var opacity=1;
12274
if (Game.elderWrathD<=1.5)
12275
{
12276
if (Game.cookiesPs>=1000) pic='cookieShower3.png';
12277
else if (Game.cookiesPs>=500) pic='cookieShower2.png';
12278
else if (Game.cookiesPs>=50) pic='cookieShower1.png';
12279
else pic='';
12280
}
12281
if (pic!='')
12282
{
12283
if (Game.elderWrathD>=1) opacity=1-((Math.min(Game.elderWrathD,1.5)-1)/0.5);
12284
ctx.globalAlpha=opacity;
12285
var y=(Math.floor(Game.T*2)%512);
12286
ctx.fillPattern(Pic(pic),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
12287
ctx.globalAlpha=1;
12288
}
12289
//snow
12290
if (Game.season=='christmas')
12291
{
12292
var y=(Math.floor(Game.T*2.5)%512);
12293
ctx.globalAlpha=0.75;
12294
ctx.globalCompositeOperation='lighter';
12295
ctx.fillPattern(Pic('snow2.jpg'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
12296
ctx.globalCompositeOperation='source-over';
12297
ctx.globalAlpha=1;
12298
}
12299
//hearts
12300
if (Game.season=='valentines')
12301
{
12302
var y=(Math.floor(Game.T*2.5)%512);
12303
ctx.globalAlpha=1;
12304
ctx.fillPattern(Pic('heartStorm.png'),0,0,ctx.canvas.width,ctx.canvas.height+512,512,512,0,y);
12305
ctx.globalAlpha=1;
12306
}
12307
Timer.track('left background');
12308
12309
Game.particlesDraw(0);
12310
ctx.globalAlpha=1;
12311
Timer.track('particles');
12312
12313
//big cookie shine
12314
var s=512;
12315
12316
var x=Game.cookieOriginX;
12317
var y=Game.cookieOriginY;
12318
12319
var r=Math.floor((Game.T*0.5)%360);
12320
ctx.save();
12321
ctx.translate(x,y);
12322
ctx.rotate((r/360)*Math.PI*2);
12323
var alphaMult=1;
12324
if (Game.bgType==2 || Game.bgType==4) alphaMult=0.5;
12325
var pic='shine.png';
12326
if (goodBuff) {pic='shineGold.png';alphaMult=1;}
12327
else if (badBuff) {pic='shineRed.png';alphaMult=1;}
12328
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';
12329
ctx.globalAlpha=0.5*alphaMult;
12330
ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);
12331
ctx.rotate((-r*2/360)*Math.PI*2);
12332
ctx.globalAlpha=0.25*alphaMult;
12333
ctx.drawImage(Pic(pic),-s/2,-s/2,s,s);
12334
ctx.restore();
12335
Timer.track('shine');
12336
12337
if (Game.ReincarnateTimer>0)
12338
{
12339
ctx.globalAlpha=1-Game.ReincarnateTimer/Game.ReincarnateDuration;
12340
ctx.fillStyle='#000';
12341
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
12342
ctx.globalAlpha=1;
12343
}
12344
12345
if (showDragon)
12346
{
12347
//big dragon
12348
var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);
12349
var x=Game.cookieOriginX-s/2;
12350
var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));
12351
ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);
12352
}
12353
12354
//big cookie
12355
if (false)//don't do that
12356
{
12357
ctx.globalAlpha=1;
12358
var amount=Math.floor(Game.cookies).toString();
12359
var digits=amount.length;
12360
var space=0;
12361
for (var i=0;i<digits;i++)
12362
{
12363
var s=16*(digits-i);
12364
var num=parseInt(amount[i]);
12365
if (i>0) space-=s*(1-num/10)/2;
12366
if (i==0 && num>1) space+=s*0.1;
12367
for (var ii=0;ii<num;ii++)
12368
{
12369
var x=Game.cookieOriginX;
12370
var y=Game.cookieOriginY;
12371
var spin=Game.T*(0.005+i*0.001)+i+(ii/num)*Math.PI*2;
12372
x+=Math.sin(spin)*space;
12373
y+=Math.cos(spin)*space;
12374
ctx.drawImage(Pic('perfectCookie.png'),x-s/2,y-s/2,s,s);
12375
}
12376
space+=s/2;
12377
}
12378
}
12379
else
12380
{
12381
ctx.globalAlpha=1;
12382
var s=256*Game.BigCookieSize;
12383
var x=Game.cookieOriginX;
12384
var y=Game.cookieOriginY;
12385
ctx.save();
12386
ctx.translate(x,y);
12387
if (Game.season=='easter')
12388
{
12389
var nestW=304*0.98*Game.BigCookieSize;
12390
var nestH=161*0.98*Game.BigCookieSize;
12391
ctx.drawImage(Pic('nest.png'),-nestW/2,-nestH/2+130,nestW,nestH);
12392
}
12393
//ctx.rotate(((Game.startDate%360)/360)*Math.PI*2);
12394
ctx.drawImage(Pic('perfectCookie.png'),-s/2,-s/2,s,s);
12395
12396
if (goodBuff && Game.prefs.particles)//sparkle
12397
{
12398
ctx.globalCompositeOperation='lighter';
12399
for (var i=0;i<1;i++)
12400
{
12401
ctx.globalAlpha=Math.random()*0.65+0.1;
12402
var size=Math.random()*30+5;
12403
var a=Math.random()*Math.PI*2;
12404
var d=s*0.9*Math.random()/2;
12405
ctx.drawImage(Pic('glint.jpg'),-size/2+Math.sin(a)*d,-size/2+Math.cos(a)*d,size,size);
12406
}
12407
}
12408
12409
ctx.restore();
12410
Timer.track('big cookie');
12411
}
12412
}
12413
else//no particles
12414
{
12415
//big cookie shine
12416
var s=512;
12417
var x=Game.cookieOriginX-s/2;
12418
var y=Game.cookieOriginY-s/2;
12419
ctx.globalAlpha=0.5;
12420
ctx.drawImage(Pic('shine.png'),x,y,s,s);
12421
12422
if (showDragon)
12423
{
12424
//big dragon
12425
var s=300*2*(1+Math.sin(Game.T*0.013)*0.1);
12426
var x=Game.cookieOriginX-s/2;
12427
var y=Game.cookieOriginY-s/(1.4+0.2*Math.sin(Game.T*0.01));
12428
ctx.drawImage(Pic('dragonBG.png'),x,y,s,s);
12429
}
12430
12431
//big cookie
12432
ctx.globalAlpha=1;
12433
var s=256*Game.BigCookieSize;
12434
var x=Game.cookieOriginX-s/2;
12435
var y=Game.cookieOriginY-s/2;
12436
ctx.drawImage(Pic('perfectCookie.png'),x,y,s,s);
12437
}
12438
12439
//cursors
12440
if (Game.prefs.cursors)
12441
{
12442
ctx.save();
12443
ctx.translate(Game.cookieOriginX,Game.cookieOriginY);
12444
var pic=Pic('cursor.png');
12445
var fancy=Game.prefs.fancy;
12446
12447
if (showDragon) ctx.globalAlpha=0.25;
12448
var amount=Game.Objects['Cursor'].amount;
12449
//var spe=-1;
12450
for (var i=0;i<amount;i++)
12451
{
12452
var n=Math.floor(i/50);
12453
//var a=((i+0.5*n)%50)/50;
12454
var w=0;
12455
if (fancy) w=(Math.sin(Game.T*0.025+(((i+n*12)%25)/25)*Math.PI*2));
12456
if (w>0.997) w=1.5;
12457
else if (w>0.994) w=0.5;
12458
else w=0;
12459
w*=-4;
12460
if (fancy) w+=Math.sin((n+Game.T*0.01)*Math.PI/2)*4;
12461
var x=0;
12462
var y=(140/* *Game.BigCookieSize*/+n*16+w)-16;
12463
12464
var rot=7.2;//(1/50)*360
12465
if (i==0 && fancy) rot-=Game.T*0.1;
12466
if (i%50==0) rot+=7.2/2;
12467
ctx.rotate((rot/360)*Math.PI*2);
12468
ctx.drawImage(pic,0,0,32,32,x,y,32,32);
12469
//ctx.drawImage(pic,32*(i==spe),0,32,32,x,y,32,32);
12470
12471
/*if (i==spe)
12472
{
12473
y+=16;
12474
x=Game.cookieOriginX+Math.sin(-((r-5)/360)*Math.PI*2)*y;
12475
y=Game.cookieOriginY+Math.cos(-((r-5)/360)*Math.PI*2)*y;
12476
if (Game.CanClick && ctx && Math.abs(Game.mouseX-x)<16 && Math.abs(Game.mouseY-y)<16) Game.mousePointer=1;
12477
}*/
12478
}
12479
ctx.restore();
12480
Timer.track('cursors');
12481
}
12482
}
12483
else
12484
{
12485
var tBase=Math.max(0,(Game.AscendTimer-Game.AscendBreakpoint)/(Game.AscendDuration-Game.AscendBreakpoint));
12486
//big crumbling cookie
12487
//var t=(3*Math.pow(tBase,2)-2*Math.pow(tBase,3));//S curve
12488
var t=Math.pow(tBase,0.5);
12489
12490
var shake=0;
12491
if (Game.AscendTimer<Game.AscendBreakpoint) {shake=Game.AscendTimer/Game.AscendBreakpoint;}
12492
//else {shake=1-t;}
12493
12494
ctx.globalAlpha=1;
12495
12496
var x=Game.cookieOriginX;
12497
var y=Game.cookieOriginY;
12498
12499
x+=(Math.random()*2-1)*10*shake;
12500
y+=(Math.random()*2-1)*10*shake;
12501
12502
var s=1;
12503
if (tBase>0)
12504
{
12505
ctx.save();
12506
ctx.globalAlpha=1-Math.pow(t,0.5);
12507
ctx.translate(x,y);
12508
ctx.globalCompositeOperation='lighter';
12509
ctx.rotate(Game.T*0.007);
12510
s=0.5+Math.pow(tBase,0.6)*1;
12511
var s2=(600)*s;
12512
ctx.drawImage(Pic('heavenRing1.jpg'),-s2/2,-s2/2,s2,s2);
12513
ctx.rotate(-Game.T*0.002);
12514
s=0.5+Math.pow(1-tBase,0.4)*1;
12515
s2=(600)*s;
12516
ctx.drawImage(Pic('heavenRing2.jpg'),-s2/2,-s2/2,s2,s2);
12517
ctx.restore();
12518
}
12519
12520
s=256;//*Game.BigCookieSize;
12521
12522
ctx.save();
12523
ctx.translate(x,y);
12524
ctx.rotate((t*(-0.1))*Math.PI*2);
12525
12526
var chunks={0:7,1:6,2:3,3:2,4:8,5:1,6:9,7:5,8:0,9:4};
12527
s*=t/2+1;
12528
/*ctx.globalAlpha=(1-t)*0.33;
12529
for (var i=0;i<10;i++)
12530
{
12531
var d=(t-0.2)*(80+((i+2)%3)*40);
12532
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);
12533
}
12534
ctx.globalAlpha=(1-t)*0.66;
12535
for (var i=0;i<10;i++)
12536
{
12537
var d=(t-0.1)*(80+((i+2)%3)*40);
12538
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);
12539
}*/
12540
ctx.globalAlpha=1-t;
12541
for (var i=0;i<10;i++)
12542
{
12543
var d=(t)*(80+((i+2)%3)*40);
12544
var x2=(Math.random()*2-1)*5*shake;
12545
var y2=(Math.random()*2-1)*5*shake;
12546
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);
12547
}
12548
var brokenHalo=1-Math.min(t/(1/3),1/3)*3;
12549
if (Game.AscendTimer<Game.AscendBreakpoint) brokenHalo=Game.AscendTimer/Game.AscendBreakpoint;
12550
ctx.globalAlpha=brokenHalo;
12551
ctx.drawImage(Pic('brokenCookieHalo.png'),-s/1.3333,-s/1.3333,s*1.5,s*1.5);
12552
12553
ctx.restore();
12554
12555
//flares
12556
var n=9;
12557
var t=Game.AscendTimer/Game.AscendBreakpoint;
12558
if (Game.AscendTimer<Game.AscendBreakpoint)
12559
{
12560
ctx.save();
12561
ctx.translate(x,y);
12562
for (var i=0;i<n;i++)
12563
{
12564
if (Math.floor(t/3*n*3+i*2.7)%2)
12565
{
12566
var t2=Math.pow((t/3*n*3+i*2.7)%1,1.5);
12567
ctx.globalAlpha=(1-t)*(Game.drawT%2==0?0.5:1);
12568
var sw=(1-t2*0.5)*96;
12569
var sh=(0.5+t2*1.5)*96;
12570
ctx.drawImage(Pic('shineSpoke.png'),-sw/2,-sh-32-(1-t2)*256,sw,sh);
12571
}
12572
ctx.rotate(Math.PI*2/n);
12573
}
12574
ctx.restore();
12575
}
12576
12577
12578
//flash at breakpoint
12579
if (tBase<0.1 && tBase>0)
12580
{
12581
ctx.globalAlpha=1-tBase/0.1;
12582
ctx.fillStyle='#fff';
12583
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
12584
ctx.globalAlpha=1;
12585
}
12586
if (tBase>0.8)
12587
{
12588
ctx.globalAlpha=(tBase-0.8)/0.2;
12589
ctx.fillStyle='#000';
12590
ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
12591
ctx.globalAlpha=1;
12592
}
12593
}
12594
12595
//milk and milk accessories
12596
if (Game.prefs.milk)
12597
{
12598
var width=ctx.canvas.width;
12599
var height=ctx.canvas.height;
12600
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);
12601
var y=(Game.milkHd)*height;//(((Game.milkHd)*ctx.canvas.height)*(1+0.05*(Math.sin(Game.T*0.017)/2+0.5)));
12602
var a=1;
12603
if (Game.AscendTimer>0)
12604
{
12605
y*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;
12606
a*=1-Math.pow((Game.AscendTimer/Game.AscendBreakpoint),2)*2;
12607
}
12608
else if (Game.ReincarnateTimer>0)
12609
{
12610
y*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;
12611
a*=1-Math.pow(1-(Game.ReincarnateTimer/Game.ReincarnateDuration),2)*2;
12612
}
12613
12614
if (Game.TOYS)
12615
{
12616
//golly
12617
if (!Game.Toy)
12618
{
12619
Game.toys=[];
12620
Game.toysType=choose([1,2]);
12621
Game.Toy=function(x,y)
12622
{
12623
this.id=Game.toys.length;
12624
this.x=x;
12625
this.y=y;
12626
this.xd=Math.random()*10-5;
12627
this.yd=Math.random()*10-5;
12628
this.r=Math.random()*Math.PI*2;
12629
this.rd=Math.random()*0.1-0.05;
12630
var v=Math.random();var a=0.5;var b=0.5;
12631
if (v<=a) v=b-b*Math.pow(1-v/a,3); else v=b+(1-b)*Math.pow((v-a)/(1-a),3);
12632
this.s=(Game.toysType==1?64:48)*(0.1+v*1.9);
12633
if (Game.toysType==2) this.s=(this.id%10==1)?96:48;
12634
this.st=this.s;this.s=0;
12635
var cookies=[[10,0]];
12636
for (var i in Game.Upgrades)
12637
{
12638
var cookie=Game.Upgrades[i];
12639
if (cookie.bought>0 && cookie.pool=='cookie') cookies.push(cookie.icon);
12640
}
12641
this.icon=choose(cookies);
12642
this.dragged=false;
12643
this.l=document.createElement('div');
12644
this.l.innerHTML=this.id;
12645
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);';
12646
l('sectionLeft').appendChild(this.l);
12647
AddEvent(this.l,'mousedown',function(what){return function(){what.dragged=true;};}(this));
12648
AddEvent(this.l,'mouseup',function(what){return function(){what.dragged=false;};}(this));
12649
Game.toys.push(this);
12650
return this;
12651
}
12652
for (var i=0;i<Math.floor(Math.random()*15+(Game.toysType==1?5:30));i++)
12653
{
12654
new Game.Toy(Math.random()*width,Math.random()*height*0.3);
12655
}
12656
}
12657
ctx.globalAlpha=0.5;
12658
for (var i in Game.toys)
12659
{
12660
var me=Game.toys[i];
12661
ctx.save();
12662
ctx.translate(me.x,me.y);
12663
ctx.rotate(me.r);
12664
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);
12665
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);
12666
ctx.restore();
12667
}
12668
ctx.globalAlpha=1;
12669
for (var i in Game.toys)
12670
{
12671
var me=Game.toys[i];
12672
//psst... not real physics
12673
for (var ii in Game.toys)
12674
{
12675
var it=Game.toys[ii];
12676
if (it.id!=me.id)
12677
{
12678
var x1=me.x+me.xd;
12679
var y1=me.y+me.yd;
12680
var x2=it.x+it.xd;
12681
var y2=it.y+it.yd;
12682
var dist=Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2))/(me.s/2+it.s/2);
12683
if (dist<(Game.toysType==1?0.95:0.75))
12684
{
12685
var angle=Math.atan2(y1-y2,x1-x2);
12686
var v1=Math.sqrt(Math.pow((me.xd),2)+Math.pow((me.yd),2));
12687
var v2=Math.sqrt(Math.pow((it.xd),2)+Math.pow((it.yd),2));
12688
var v=((v1+v2)/2+dist)*0.75;
12689
var ratio=it.s/me.s;
12690
me.xd+=Math.sin(-angle+Math.PI/2)*v*(ratio);
12691
me.yd+=Math.cos(-angle+Math.PI/2)*v*(ratio);
12692
it.xd+=Math.sin(-angle-Math.PI/2)*v*(1/ratio);
12693
it.yd+=Math.cos(-angle-Math.PI/2)*v*(1/ratio);
12694
me.rd+=(Math.random()*1-0.5)*0.1*(ratio);
12695
it.rd+=(Math.random()*1-0.5)*0.1*(1/ratio);
12696
me.rd*=Math.min(1,v);
12697
it.rd*=Math.min(1,v);
12698
}
12699
}
12700
}
12701
if (me.y>=height-(Game.milkHd)*height+8)
12702
{
12703
me.xd*=0.85;
12704
me.yd*=0.85;
12705
me.rd*=0.85;
12706
me.yd-=1;
12707
me.xd+=(Math.random()*1-0.5)*0.3;
12708
me.yd+=(Math.random()*1-0.5)*0.05;
12709
me.rd+=(Math.random()*1-0.5)*0.02;
12710
}
12711
else
12712
{
12713
me.xd*=0.99;
12714
me.rd*=0.99;
12715
me.yd+=1;
12716
}
12717
me.yd*=(Math.min(1,Math.abs(me.y-(height-(Game.milkHd)*height)/16)));
12718
me.rd+=me.xd*0.01/(me.s/(Game.toysType==1?64:48));
12719
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;}
12720
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;}
12721
me.xd=Math.min(Math.max(me.xd,-30),30);
12722
me.yd=Math.min(Math.max(me.yd,-30),30);
12723
me.rd=Math.min(Math.max(me.rd,-0.5),0.5);
12724
me.x+=me.xd;
12725
me.y+=me.yd;
12726
me.r+=me.rd;
12727
me.r=me.r%(Math.PI*2);
12728
me.s+=(me.st-me.s)*0.5;
12729
if (Game.toysType==2 && !me.dragged && Math.random()<0.003) me.st=choose([48,48,48,48,96]);
12730
if (me.dragged)
12731
{
12732
me.x=Game.mouseX;
12733
me.y=Game.mouseY;
12734
me.xd+=((Game.mouseX-Game.mouseX2)*3-me.xd)*0.5;
12735
me.yd+=((Game.mouseY-Game.mouseY2)*3-me.yd)*0.5
12736
me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px) scale(50)';
12737
}
12738
else me.l.style.transform='translate('+(me.x-me.s/2)+'px,'+(me.y-me.s/2)+'px)';
12739
me.l.style.width=me.s+'px';
12740
me.l.style.height=me.s+'px';
12741
ctx.save();
12742
ctx.translate(me.x,me.y);
12743
ctx.rotate(me.r);
12744
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);
12745
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);
12746
ctx.restore();
12747
}
12748
}
12749
12750
var pic=Game.Milk.pic;
12751
if (Game.milkType!=0 && Game.ascensionMode!=1) pic=Game.MilksByChoice[Game.milkType].pic;
12752
ctx.globalAlpha=0.9*a;
12753
ctx.fillPattern(Pic(pic+'.png'),0,height-y,width+480,1,480,480,x,0);
12754
12755
ctx.fillStyle='#000';
12756
ctx.fillRect(0,height-y+480,width,Math.max(0,(y-480)));
12757
ctx.globalAlpha=1;
12758
12759
Timer.track('milk');
12760
}
12761
12762
if (Game.AscendTimer>0)
12763
{
12764
ctx.drawImage(Pic('shadedBordersSoft.png'),0,0,ctx.canvas.width,ctx.canvas.height);
12765
}
12766
12767
if (Game.AscendTimer==0)
12768
{
12769
Game.DrawWrinklers();Timer.track('wrinklers');
12770
Game.DrawSpecial();Timer.track('evolvables');
12771
12772
Game.particlesDraw(2);Timer.track('text particles');
12773
12774
//shiny border during frenzies etc
12775
ctx.globalAlpha=1;
12776
var borders='shadedBordersSoft.png';
12777
if (goodBuff) borders='shadedBordersGold.png';
12778
else if (badBuff) borders='shadedBordersRed.png';
12779
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='lighter';
12780
ctx.drawImage(Pic(borders),0,0,ctx.canvas.width,ctx.canvas.height);
12781
if (goodBuff && Game.prefs.fancy) ctx.globalCompositeOperation='source-over';
12782
}
12783
}
12784
};
12785
12786
12787
/*=====================================================================================
12788
INITIALIZATION END; GAME READY TO LAUNCH
12789
=======================================================================================*/
12790
12791
Game.killShimmers();
12792
12793
//booooo
12794
Game.RuinTheFun=function(silent)
12795
{
12796
Game.popups=0;
12797
Game.SetAllUpgrades(1);
12798
Game.SetAllAchievs(1);
12799
Game.popups=0;
12800
Game.Earn(999999999999999999999999999999);
12801
Game.MaxSpecials();
12802
Game.nextResearch=0;
12803
Game.researchT=-1;
12804
Game.upgradesToRebuild=1;
12805
Game.recalculateGains=1;
12806
Game.popups=1;
12807
for (var i in Game.Objects)
12808
{
12809
var me=Game.Objects[i];
12810
if (me.minigame && me.minigame.onRuinTheFun) me.minigame.onRuinTheFun();
12811
}
12812
if (!silent)
12813
{
12814
if (Game.prefs.popups) Game.Popup('Thou doth ruineth the fun!');
12815
else Game.Notify('Thou doth ruineth the fun!','You\'re free. Free at last.',[11,5]);
12816
}
12817
return 'You feel a bitter taste in your mouth...';
12818
}
12819
12820
Game.SetAllUpgrades=function(on)
12821
{
12822
Game.popups=0;
12823
var leftout=['Magic shenanigans','Occult obstruction','Glucose-charged air'];
12824
for (var i in Game.Upgrades)
12825
{
12826
if (on && (Game.Upgrades[i].pool=='toggle' || leftout.indexOf(Game.Upgrades[i].name)!=-1)) {}
12827
else if (on) Game.Upgrades[i].earn();
12828
else if (!on) Game.Upgrades[i].lose();
12829
}
12830
Game.upgradesToRebuild=1;
12831
Game.recalculateGains=1;
12832
Game.popups=1;
12833
}
12834
Game.SetAllAchievs=function(on)
12835
{
12836
Game.popups=0;
12837
for (var i in Game.Achievements)
12838
{
12839
if (on && Game.Achievements[i].pool!='dungeon') Game.Win(Game.Achievements[i].name);
12840
else if (!on) Game.RemoveAchiev(Game.Achievements[i].name);
12841
}
12842
Game.recalculateGains=1;
12843
Game.popups=1;
12844
}
12845
Game.GetAllDebugs=function()
12846
{
12847
Game.popups=0;
12848
for (var i in Game.Upgrades)
12849
{
12850
if (Game.Upgrades[i].pool=='debug') Game.Upgrades[i].earn();
12851
}
12852
Game.upgradesToRebuild=1;
12853
Game.recalculateGains=1;
12854
Game.popups=1;
12855
}
12856
Game.MaxSpecials=function()
12857
{
12858
Game.dragonLevel=Game.dragonLevels.length-1;
12859
Game.santaLevel=Game.santaLevels.length-1;
12860
}
12861
12862
Game.SesameReset=function()
12863
{
12864
var name=Game.bakeryName;
12865
Game.HardReset(2);
12866
Game.bakeryName=name;
12867
Game.bakeryNameRefresh();
12868
Game.Achievements['Cheated cookies taste awful'].won=1;
12869
}
12870
12871
Game.debugTimersOn=0;
12872
Game.sesame=0;
12873
Game.OpenSesame=function()
12874
{
12875
var str='';
12876
str+='<div class="icon" style="position:absolute;left:-9px;top:-6px;background-position:'+(-10*48)+'px '+(-6*48)+'px;"></div>';
12877
str+='<div style="position:absolute;left:0px;top:0px;z-index:10;font-size:10px;background:#000;padding:1px;" id="fpsCounter"></div>';
12878
12879
str+='<div id="devConsoleContent">';
12880
str+='<div class="title" style="font-size:14px;margin:6px;">Dev tools</div>';
12881
12882
str+='<a class="option neato" '+Game.clickStr+'="Game.Ascend(1);">Ascend</a>';
12883
str+='<div class="line"></div>';
12884
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=10;Game.cookiesEarned*=10;">x10</a>';
12885
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=10;Game.cookiesEarned/=10;">/10</a><br>';
12886
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies*=1000;Game.cookiesEarned*=1000;">x1k</a>';
12887
str+='<a class="option neato" '+Game.clickStr+'="Game.cookies/=1000;Game.cookiesEarned/=1000;">/1k</a><br>';
12888
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);}}
12889
str+='<a class="option neato" '+Game.clickStr+'="for (var i in Game.Objects){Game.Objects[i].sell(100);}">Sell 100 of all</a><br>';
12890
str+='<a class="option neato" '+Game.clickStr+'="Game.gainLumps(10);">+10 lumps</a>';
12891
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>';
12892
str+='<div class="line"></div>';
12893
str+='<a class="option warning" '+Game.clickStr+'="Game.RuinTheFun(1);">Ruin The Fun</a>';
12894
str+='<a class="option warning" '+Game.clickStr+'="Game.SesameReset();">Wipe</a>';
12895
str+='<a class="option neato" '+Game.clickStr+'="Game.GetAllDebugs();">All debugs</a>';
12896
str+='<a class="option neato" '+Game.clickStr+'="Game.debugTimersOn=!Game.debugTimersOn;Game.OpenSesame();">Timers '+(Game.debugTimersOn?'On':'Off')+'</a><br>';
12897
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(0);">No upgrades</a>';
12898
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllUpgrades(1);">All upgrades</a><br>';
12899
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(0);">No achievs</a>';
12900
str+='<a class="option neato" '+Game.clickStr+'="Game.SetAllAchievs(1);">All achievs</a><br>';
12901
str+='<a class="option neato" '+Game.clickStr+'="Game.santaLevel=0;Game.dragonLevel=0;">Reset specials</a>';
12902
str+='<a class="option neato" '+Game.clickStr+'="Game.MaxSpecials();">Max specials</a><br>';
12903
str+='<a class="option neato" '+Game.clickStr+'="Game.lumpRefill=Date.now()-Game.getLumpRefillMax();">Reset refills</a>';
12904
str+='<a class="option neato" '+Game.clickStr+'="Game.EditAscend();">'+(Game.DebuggingPrestige?'Exit Ascend Edit':'Ascend Edit')+'</a>';
12905
str+='<a class="option neato" '+Game.clickStr+'="Game.DebugUpgradeCpS();">Debug upgrades CpS</a>';
12906
str+='<a class="option neato" '+Game.clickStr+'="Game.seed=Game.makeSeed();">Re-seed</a>';
12907
str+='<a class="option neato" '+Game.clickStr+'="Game.heralds=100;l(\'heraldsAmount\').innerHTML=Game.heralds;Game.externalDataLoaded=true;Game.recalculateGains=1;">Max heralds</a>';
12908
str+='<div class="line"></div>';
12909
for (var i=0;i<Game.goldenCookieChoices.length/2;i++)
12910
{
12911
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>';
12912
//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>';
12913
//str+='<a class="option neato" '+Game.clickStr+'="Game.goldenCookie.click(0,\''+Game.goldenCookie.choices[i*2+1]+'\');">'+Game.goldenCookie.choices[i*2]+'</a>';
12914
}
12915
str+='</div>';
12916
12917
l('devConsole').innerHTML=str;
12918
12919
if (!l('fpsGraph'))
12920
{
12921
var div=document.createElement('canvas');
12922
div.id='fpsGraph';
12923
div.width=128;
12924
div.height=64;
12925
div.style.opacity=0.5;
12926
div.style.pointerEvents='none';
12927
div.style.transformOrigin='0% 0%';
12928
div.style.transform='scale(0.75)';
12929
//l('devConsole').appendChild(div);
12930
l('devConsole').parentNode.insertBefore(div,l('devConsole').nextSibling);
12931
Game.fpsGraph=div;
12932
Game.fpsGraphCtx=Game.fpsGraph.getContext('2d',{alpha:false});
12933
var ctx=Game.fpsGraphCtx;
12934
ctx.fillStyle='#000';
12935
ctx.fillRect(0,0,128,64);
12936
}
12937
12938
l('debug').style.display='block';
12939
Game.sesame=1;
12940
Game.Achievements['Cheated cookies taste awful'].won=1;
12941
}
12942
12943
Game.EditAscend=function()
12944
{
12945
if (!Game.DebuggingPrestige)
12946
{
12947
Game.DebuggingPrestige=true;
12948
Game.AscendTimer=0;
12949
Game.OnAscend=1;
12950
Game.removeClass('ascendIntro');
12951
Game.addClass('ascending');
12952
}
12953
else
12954
{
12955
Game.DebuggingPrestige=false;
12956
}
12957
Game.BuildAscendTree();
12958
Game.OpenSesame();
12959
}
12960
12961
//experimental debugging function that cycles through every owned upgrade, turns it off and on, and lists how much each upgrade is participating to CpS
12962
Game.debuggedUpgradeCpS=[];
12963
Game.debuggedUpgradeCpClick=[];
12964
Game.debugColors=['#322','#411','#600','#900','#f30','#f90','#ff0','#9f0','#0f9','#09f','#90f'];
12965
Game.DebugUpgradeCpS=function()
12966
{
12967
Game.CalculateGains();
12968
Game.debuggedUpgradeCpS=[];
12969
Game.debuggedUpgradeCpClick=[];
12970
var CpS=Game.cookiesPs;
12971
var CpClick=Game.computedMouseCps;
12972
for (var i in Game.Upgrades)
12973
{
12974
var me=Game.Upgrades[i];
12975
if (me.bought)
12976
{
12977
me.bought=0;
12978
Game.CalculateGains();
12979
//Game.debuggedUpgradeCpS[me.name]=CpS-Game.cookiesPs;
12980
Game.debuggedUpgradeCpS[me.name]=(CpS/(Game.cookiesPs||1)-1);
12981
Game.debuggedUpgradeCpClick[me.name]=(CpClick/(Game.computedMouseCps||1)-1);
12982
me.bought=1;
12983
}
12984
}
12985
Game.CalculateGains();
12986
}
12987
12988
12989
12990
12991
for (var i in Game.customInit) {Game.customInit[i]();}
12992
12993
if (!Game.LoadSave())
12994
{//try to load the save when we open the page. if this fails, try to brute-force it half a second later
12995
setTimeout(function(){
12996
var local=Game.localStorageGet(Game.SaveTo);
12997
Game.LoadSave(local);
12998
},500);
12999
}
13000
13001
Game.ready=1;
13002
setTimeout(function(){if (typeof showAds==='undefined' && (!l('detectAds') || l('detectAds').clientHeight<1)) Game.addClass('noAds');},500);
13003
l('javascriptError').innerHTML='';
13004
l('javascriptError').style.display='none';
13005
Game.Loop();
13006
Game.Draw();
13007
}
13008
/*=====================================================================================
13009
LOGIC
13010
=======================================================================================*/
13011
Game.Logic=function()
13012
{
13013
Game.bounds=Game.l.getBoundingClientRect();
13014
13015
if (!Game.OnAscend && Game.AscendTimer==0)
13016
{
13017
for (var i in Game.Objects)
13018
{
13019
if (Game.Objects[i].eachFrame) Game.Objects[i].eachFrame();
13020
}
13021
Game.UpdateSpecial();
13022
Game.UpdateGrandmapocalypse();
13023
13024
//these are kinda fun
13025
//if (Game.BigCookieState==2 && !Game.promptOn && Game.Scroll!=0) Game.ClickCookie();
13026
//if (Game.BigCookieState==1 && !Game.promptOn) Game.ClickCookie();
13027
13028
//handle graphic stuff
13029
if (Game.prefs.wobbly)
13030
{
13031
if (Game.BigCookieState==1) Game.BigCookieSizeT=0.98;
13032
else if (Game.BigCookieState==2) Game.BigCookieSizeT=1.05;
13033
else Game.BigCookieSizeT=1;
13034
Game.BigCookieSizeD+=(Game.BigCookieSizeT-Game.BigCookieSize)*0.75;
13035
Game.BigCookieSizeD*=0.75;
13036
Game.BigCookieSize+=Game.BigCookieSizeD;
13037
Game.BigCookieSize=Math.max(0.1,Game.BigCookieSize);
13038
}
13039
else
13040
{
13041
if (Game.BigCookieState==1) Game.BigCookieSize+=(0.98-Game.BigCookieSize)*0.5;
13042
else if (Game.BigCookieState==2) Game.BigCookieSize+=(1.05-Game.BigCookieSize)*0.5;
13043
else Game.BigCookieSize+=(1-Game.BigCookieSize)*0.5;
13044
}
13045
Game.particlesUpdate();
13046
13047
if (Game.mousePointer) l('sectionLeft').style.cursor='pointer';
13048
else l('sectionLeft').style.cursor='auto';
13049
Game.mousePointer=0;
13050
13051
//handle milk and milk accessories
13052
Game.milkProgress=Game.AchievementsOwned/25;
13053
if (Game.milkProgress>=0.5) Game.Unlock('Kitten helpers');
13054
if (Game.milkProgress>=1) Game.Unlock('Kitten workers');
13055
if (Game.milkProgress>=2) Game.Unlock('Kitten engineers');
13056
if (Game.milkProgress>=3) Game.Unlock('Kitten overseers');
13057
if (Game.milkProgress>=4) Game.Unlock('Kitten managers');
13058
if (Game.milkProgress>=5) Game.Unlock('Kitten accountants');
13059
if (Game.milkProgress>=6) Game.Unlock('Kitten specialists');
13060
if (Game.milkProgress>=7) Game.Unlock('Kitten experts');
13061
if (Game.milkProgress>=8) Game.Unlock('Kitten consultants');
13062
if (Game.milkProgress>=9) Game.Unlock('Kitten assistants to the regional manager');
13063
if (Game.milkProgress>=10) Game.Unlock('Kitten marketeers');
13064
if (Game.milkProgress>=11) Game.Unlock('Kitten analysts');
13065
if (Game.milkProgress>=12) Game.Unlock('Kitten executives');
13066
Game.milkH=Math.min(1,Game.milkProgress)*0.35;
13067
Game.milkHd+=(Game.milkH-Game.milkHd)*0.02;
13068
13069
Game.Milk=Game.Milks[Math.min(Math.floor(Game.milkProgress),Game.Milks.length-1)];
13070
13071
if (Game.autoclickerDetected>0) Game.autoclickerDetected--;
13072
13073
//handle research
13074
if (Game.researchT>0)
13075
{
13076
Game.researchT--;
13077
}
13078
if (Game.researchT==0 && Game.nextResearch)
13079
{
13080
if (!Game.Has(Game.UpgradesById[Game.nextResearch].name))
13081
{
13082
Game.Unlock(Game.UpgradesById[Game.nextResearch].name);
13083
if (Game.prefs.popups) Game.Popup('Researched : '+Game.UpgradesById[Game.nextResearch].name);
13084
else Game.Notify('Research complete','You have discovered : <b>'+Game.UpgradesById[Game.nextResearch].name+'</b>.',Game.UpgradesById[Game.nextResearch].icon);
13085
}
13086
Game.nextResearch=0;
13087
Game.researchT=-1;
13088
Game.recalculateGains=1;
13089
}
13090
//handle seasons
13091
if (Game.seasonT>0)
13092
{
13093
Game.seasonT--;
13094
}
13095
if (Game.seasonT<=0 && Game.season!='' && Game.season!=Game.baseSeason && !Game.Has('Eternal seasons'))
13096
{
13097
var str=Game.seasons[Game.season].over;
13098
if (Game.prefs.popups) Game.Popup(str);
13099
else Game.Notify(str,'',Game.seasons[Game.season].triggerUpgrade.icon);
13100
if (Game.Has('Season switcher')) {Game.Unlock(Game.seasons[Game.season].trigger);Game.seasons[Game.season].triggerUpgrade.bought=0;}
13101
Game.season=Game.baseSeason;
13102
Game.seasonT=-1;
13103
}
13104
13105
//press ctrl to bulk-buy 10, shift to bulk-buy 100
13106
if (!Game.promptOn)
13107
{
13108
if ((Game.keys[16] || Game.keys[17]) && !Game.buyBulkShortcut)
13109
{
13110
Game.buyBulkOld=Game.buyBulk;
13111
if (Game.keys[16]) Game.buyBulk=100;
13112
if (Game.keys[17]) Game.buyBulk=10;
13113
Game.buyBulkShortcut=1;
13114
Game.storeBulkButton(-1);
13115
}
13116
}
13117
if ((!Game.keys[16] && !Game.keys[17]) && Game.buyBulkShortcut)//release
13118
{
13119
Game.buyBulk=Game.buyBulkOld;
13120
Game.buyBulkShortcut=0;
13121
Game.storeBulkButton(-1);
13122
}
13123
13124
//handle cookies
13125
if (Game.recalculateGains) Game.CalculateGains();
13126
Game.Earn(Game.cookiesPs/Game.fps);//add cookies per second
13127
13128
//grow lumps
13129
Game.doLumps();
13130
13131
//minigames
13132
for (var i in Game.Objects)
13133
{
13134
var me=Game.Objects[i];
13135
if (Game.isMinigameReady(me) && me.minigame.logic && Game.ascensionMode!=1) me.minigame.logic();
13136
}
13137
13138
if (Game.specialTab!='' && Game.T%(Game.fps*3)==0) Game.ToggleSpecialMenu(1);
13139
13140
//wrinklers
13141
if (Game.cpsSucked>0)
13142
{
13143
Game.Dissolve((Game.cookiesPs/Game.fps)*Game.cpsSucked);
13144
Game.cookiesSucked+=((Game.cookiesPs/Game.fps)*Game.cpsSucked);
13145
//should be using one of the following, but I'm not sure what I'm using this stat for anymore
13146
//Game.cookiesSucked=Game.wrinklers.reduce(function(s,w){return s+w.sucked;},0);
13147
//for (var i in Game.wrinklers) {Game.cookiesSucked+=Game.wrinklers[i].sucked;}
13148
}
13149
13150
//var cps=Game.cookiesPs+Game.cookies*0.01;//exponential cookies
13151
//Game.Earn(cps/Game.fps);//add cookies per second
13152
13153
for (var i in Game.Objects)
13154
{
13155
var me=Game.Objects[i];
13156
me.totalCookies+=(me.storedTotalCps*Game.globalCpsMult)/Game.fps;
13157
}
13158
if (Game.cookies && Game.T%Math.ceil(Game.fps/Math.min(10,Game.cookiesPs))==0 && Game.prefs.particles) Game.particleAdd();//cookie shower
13159
13160
if (Game.T%(Game.fps*10)==0) Game.recalculateGains=1;//recalculate CpS every 10 seconds (for dynamic boosts such as Century egg)
13161
13162
/*=====================================================================================
13163
UNLOCKING STUFF
13164
=======================================================================================*/
13165
if (Game.T%(Game.fps)==0 && Math.random()<1/500000) Game.Win('Just plain lucky');//1 chance in 500,000 every second achievement
13166
if (Game.T%(Game.fps*5)==0 && Game.ObjectsById.length>0)//check some achievements and upgrades
13167
{
13168
if (isNaN(Game.cookies)) {Game.cookies=0;Game.cookiesEarned=0;Game.recalculateGains=1;}
13169
13170
var timePlayed=new Date();
13171
timePlayed.setTime(Date.now()-Game.startDate);
13172
13173
if (!Game.fullDate || (Date.now()-Game.fullDate)>=365*24*60*60*1000) Game.Win('So much to do so much to see');
13174
13175
if (Game.cookiesEarned>=1000000 && (Game.ascensionMode==1 || Game.resets==0))//challenge run or hasn't ascended yet
13176
{
13177
if (timePlayed<=1000*60*35) Game.Win('Speed baking I');
13178
if (timePlayed<=1000*60*25) Game.Win('Speed baking II');
13179
if (timePlayed<=1000*60*15) Game.Win('Speed baking III');
13180
13181
if (Game.cookieClicks<=15) Game.Win('Neverclick');
13182
if (Game.cookieClicks<=0) Game.Win('True Neverclick');
13183
if (Game.cookiesEarned>=1000000000 && Game.UpgradesOwned==0) Game.Win('Hardcore');
13184
}
13185
13186
for (var i in Game.UnlockAt)
13187
{
13188
var unlock=Game.UnlockAt[i];
13189
if (Game.cookiesEarned>=unlock.cookies)
13190
{
13191
var pass=1;
13192
if (unlock.require && !Game.Has(unlock.require) && !Game.HasAchiev(unlock.require)) pass=0;
13193
if (unlock.season && Game.season!=unlock.season) pass=0;
13194
if (pass) {Game.Unlock(unlock.name);Game.Win(unlock.name);}
13195
}
13196
}
13197
13198
if (Game.Has('Golden switch')) Game.Unlock('Golden switch [off]');
13199
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();}
13200
if (Game.Has('Sugar craving')) Game.Unlock('Sugar frenzy');
13201
if (Game.Has('Classic dairy selection')) Game.Unlock('Milk selector');
13202
if (Game.Has('Basic wallpaper assortment')) Game.Unlock('Background selector');
13203
if (Game.Has('Golden cookie alert sound')) Game.Unlock('Golden cookie sound selector');
13204
13205
if (Game.Has('Eternal heart biscuits')) Game.Win('Lovely cookies');
13206
if (Game.season=='easter')
13207
{
13208
var eggs=0;
13209
for (var i in Game.easterEggs)
13210
{
13211
if (Game.HasUnlocked(Game.easterEggs[i])) eggs++;
13212
}
13213
if (eggs>=1) Game.Win('The hunt is on');
13214
if (eggs>=7) Game.Win('Egging on');
13215
if (eggs>=14) Game.Win('Mass Easteria');
13216
if (eggs>=Game.easterEggs.length) Game.Win('Hide & seek champion');
13217
}
13218
13219
if (Game.Has('Fortune cookies'))
13220
{
13221
var list=Game.Tiers['fortune'].upgrades;
13222
var fortunes=0;
13223
for (var i in list)
13224
{
13225
if (Game.Has(list[i].name)) fortunes++;
13226
}
13227
if (fortunes>=list.length) Game.Win('O Fortuna');
13228
}
13229
13230
if (Game.prestige>0 && Game.ascensionMode!=1)
13231
{
13232
Game.Unlock('Heavenly chip secret');
13233
if (Game.Has('Heavenly chip secret')) Game.Unlock('Heavenly cookie stand');
13234
if (Game.Has('Heavenly cookie stand')) Game.Unlock('Heavenly bakery');
13235
if (Game.Has('Heavenly bakery')) Game.Unlock('Heavenly confectionery');
13236
if (Game.Has('Heavenly confectionery')) Game.Unlock('Heavenly key');
13237
13238
if (Game.Has('Heavenly key')) Game.Win('Wholesome');
13239
}
13240
13241
for (var i in Game.BankAchievements)
13242
{
13243
if (Game.cookiesEarned>=Game.BankAchievements[i].threshold) Game.Win(Game.BankAchievements[i].name);
13244
}
13245
13246
var buildingsOwned=0;
13247
var mathematician=1;
13248
var base10=1;
13249
var minAmount=100000;
13250
for (var i in Game.Objects)
13251
{
13252
buildingsOwned+=Game.Objects[i].amount;
13253
minAmount=Math.min(Game.Objects[i].amount,minAmount);
13254
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;}
13255
if (!Game.HasAchiev('Base 10')) {if (Game.Objects[i].amount<(Game.ObjectsById.length-Game.Objects[i].id)*10) base10=0;}
13256
}
13257
if (minAmount>=1) Game.Win('One with everything');
13258
if (mathematician==1) Game.Win('Mathematician');
13259
if (base10==1) Game.Win('Base 10');
13260
if (minAmount>=100) {Game.Win('Centennial');Game.Unlock('Milk chocolate butter biscuit');}
13261
if (minAmount>=150) {Game.Win('Centennial and a half');Game.Unlock('Dark chocolate butter biscuit');}
13262
if (minAmount>=200) {Game.Win('Bicentennial');Game.Unlock('White chocolate butter biscuit');}
13263
if (minAmount>=250) {Game.Win('Bicentennial and a half');Game.Unlock('Ruby chocolate butter biscuit');}
13264
if (minAmount>=300) {Game.Win('Tricentennial');Game.Unlock('Lavender chocolate butter biscuit');}
13265
if (minAmount>=350) {Game.Win('Tricentennial and a half');Game.Unlock('Synthetic chocolate green honey butter biscuit');}
13266
if (minAmount>=400) {Game.Win('Quadricentennial');Game.Unlock('Royal raspberry chocolate butter biscuit');}
13267
if (minAmount>=450) {Game.Win('Quadricentennial and a half');Game.Unlock('Ultra-concentrated high-energy chocolate butter biscuit');}
13268
if (minAmount>=500) {Game.Win('Quincentennial');Game.Unlock('Pure pitch-black chocolate butter biscuit');}
13269
13270
if (Game.handmadeCookies>=1000) {Game.Win('Clicktastic');Game.Unlock('Plastic mouse');}
13271
if (Game.handmadeCookies>=100000) {Game.Win('Clickathlon');Game.Unlock('Iron mouse');}
13272
if (Game.handmadeCookies>=10000000) {Game.Win('Clickolympics');Game.Unlock('Titanium mouse');}
13273
if (Game.handmadeCookies>=1000000000) {Game.Win('Clickorama');Game.Unlock('Adamantium mouse');}
13274
if (Game.handmadeCookies>=100000000000) {Game.Win('Clickasmic');Game.Unlock('Unobtainium mouse');}
13275
if (Game.handmadeCookies>=10000000000000) {Game.Win('Clickageddon');Game.Unlock('Eludium mouse');}
13276
if (Game.handmadeCookies>=1000000000000000) {Game.Win('Clicknarok');Game.Unlock('Wishalloy mouse');}
13277
if (Game.handmadeCookies>=100000000000000000) {Game.Win('Clickastrophe');Game.Unlock('Fantasteel mouse');}
13278
if (Game.handmadeCookies>=10000000000000000000) {Game.Win('Clickataclysm');Game.Unlock('Nevercrack mouse');}
13279
if (Game.handmadeCookies>=1000000000000000000000) {Game.Win('The ultimate clickdown');Game.Unlock('Armythril mouse');}
13280
if (Game.handmadeCookies>=100000000000000000000000) {Game.Win('All the other kids with the pumped up clicks');Game.Unlock('Technobsidian mouse');}
13281
if (Game.handmadeCookies>=10000000000000000000000000) {Game.Win('One...more...click...');Game.Unlock('Plasmarble mouse');}
13282
13283
if (Game.cookiesEarned<Game.cookies) Game.Win('Cheated cookies taste awful');
13284
13285
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');
13286
if (Game.wrinklersPopped>=1) Game.Win('Itchscratcher');
13287
if (Game.wrinklersPopped>=50) Game.Win('Wrinklesquisher');
13288
if (Game.wrinklersPopped>=200) Game.Win('Moistburster');
13289
13290
if (Game.cookiesEarned>=1000000 && Game.Has('How to bake your dragon')) Game.Unlock('A crumbly egg');
13291
13292
if (Game.cookiesEarned>=25 && Game.season=='christmas') Game.Unlock('A festive hat');
13293
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');
13294
13295
if (Game.reindeerClicked>=1) Game.Win('Oh deer');
13296
if (Game.reindeerClicked>=50) Game.Win('Sleigh of hand');
13297
if (Game.reindeerClicked>=200) Game.Win('Reindeer sleigher');
13298
13299
if (buildingsOwned>=100) Game.Win('Builder');
13300
if (buildingsOwned>=500) Game.Win('Architect');
13301
if (buildingsOwned>=1000) Game.Win('Engineer');
13302
if (buildingsOwned>=2000) Game.Win('Lord of Constructs');
13303
if (Game.UpgradesOwned>=20) Game.Win('Enhancer');
13304
if (Game.UpgradesOwned>=50) Game.Win('Augmenter');
13305
if (Game.UpgradesOwned>=100) Game.Win('Upgrader');
13306
if (Game.UpgradesOwned>=200) Game.Win('Lord of Progress');
13307
if (buildingsOwned>=3000 && Game.UpgradesOwned>=300) Game.Win('Polymath');
13308
if (buildingsOwned>=4000 && Game.UpgradesOwned>=400) Game.Win('Renaissance baker');
13309
13310
if (Game.cookiesEarned>=10000000000000 && !Game.HasAchiev('You win a cookie')) {Game.Win('You win a cookie');Game.Earn(1);}
13311
13312
if (Game.shimmerTypes['golden'].n>=4) Game.Win('Four-leaf cookie');
13313
13314
var grandmas=0;
13315
for (var i in Game.GrandmaSynergies)
13316
{
13317
if (Game.Has(Game.GrandmaSynergies[i])) grandmas++;
13318
}
13319
if (!Game.HasAchiev('Elder') && grandmas>=7) Game.Win('Elder');
13320
if (!Game.HasAchiev('Veteran') && grandmas>=14) Game.Win('Veteran');
13321
if (Game.Objects['Grandma'].amount>=6 && !Game.Has('Bingo center/Research facility') && Game.HasAchiev('Elder')) Game.Unlock('Bingo center/Research facility');
13322
if (Game.pledges>0) Game.Win('Elder nap');
13323
if (Game.pledges>=5) Game.Win('Elder slumber');
13324
if (Game.pledges>=10) Game.Unlock('Sacrificial rolling pins');
13325
if (Game.Objects['Cursor'].amount+Game.Objects['Grandma'].amount>=777) Game.Win('The elder scrolls');
13326
13327
for (var i in Game.Objects)
13328
{
13329
var it=Game.Objects[i];
13330
for (var ii in it.productionAchievs)
13331
{
13332
if (it.totalCookies>=it.productionAchievs[ii].pow) Game.Win(it.productionAchievs[ii].achiev.name);
13333
}
13334
}
13335
13336
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');
13337
//&& l('bigCookie').getBoundingClientRect().bottom>l('milk').getBoundingClientRect().top+16 && Game.milkProgress>0.1) Game.Win('Cookie-dunker');
13338
13339
for (var i in Game.customChecks) {Game.customChecks[i]();}
13340
}
13341
13342
Game.cookiesd+=(Game.cookies-Game.cookiesd)*0.3;
13343
13344
if (Game.storeToRefresh) Game.RefreshStore();
13345
if (Game.upgradesToRebuild) Game.RebuildUpgrades();
13346
13347
Game.updateShimmers();
13348
Game.updateBuffs();
13349
13350
Game.UpdateTicker();
13351
}
13352
13353
if (Game.T%(Game.fps*2)==0)
13354
{
13355
var title='Cookie Clicker';
13356
if (Game.season=='fools') title='Cookie Baker';
13357
document.title=(Game.OnAscend?'Ascending! ':'')+Beautify(Game.cookies)+' '+(Game.cookies==1?'cookie':'cookies')+' - '+title;
13358
}
13359
if (Game.T%15==0)
13360
{
13361
//written through the magic of "hope for the best" maths
13362
var chipsOwned=Game.HowMuchPrestige(Game.cookiesReset);
13363
var ascendNowToOwn=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));
13364
var ascendNowToGet=ascendNowToOwn-Math.floor(chipsOwned);
13365
var nextChipAt=Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet+1))-Game.HowManyCookiesReset(Math.floor(chipsOwned+ascendNowToGet));
13366
var cookiesToNext=Game.HowManyCookiesReset(ascendNowToOwn+1)-(Game.cookiesEarned+Game.cookiesReset);
13367
var percent=1-(cookiesToNext/nextChipAt);
13368
13369
//fill the tooltip under the Legacy tab
13370
var date=new Date();
13371
date.setTime(Date.now()-Game.startDate);
13372
var timeInSeconds=date.getTime()/1000;
13373
var startDate=Game.sayTime(timeInSeconds*Game.fps,-1);
13374
13375
var str='';
13376
str+='You\'ve been on this run for <b>'+(startDate==''?'not very long':(startDate))+'</b>.<br>';
13377
str+='<div class="line"></div>';
13378
if (Game.prestige>0)
13379
{
13380
str+='Your prestige level is currently <b>'+Beautify(Game.prestige)+'</b>.<br>(CpS +'+Beautify(Game.prestige)+'%)';
13381
str+='<div class="line"></div>';
13382
}
13383
if (ascendNowToGet<1) str+='Ascending now would grant you no prestige.';
13384
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.';
13385
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.';
13386
str+='<div class="line"></div>';
13387
str+='You need <b>'+Beautify(cookiesToNext)+' more cookies</b> for the next level.<br>';
13388
l('ascendTooltip').innerHTML=str;
13389
13390
if (ascendNowToGet>0)//show number saying how many chips you'd get resetting now
13391
{
13392
var str=ascendNowToGet.toString();
13393
var str2='';
13394
for (var i in str)//add commas
13395
{
13396
if ((str.length-i)%3==0 && i>0) str2+=',';
13397
str2+=str[i];
13398
}
13399
Game.ascendNumber.innerHTML='+'+str2;
13400
Game.ascendNumber.style.display='block';
13401
}
13402
else
13403
{
13404
Game.ascendNumber.style.display='none';
13405
}
13406
13407
if (ascendNowToGet>Game.ascendMeterLevel || Game.ascendMeterPercentT<Game.ascendMeterPercent)
13408
{
13409
//reset the gauge and play a sound if we gained a potential level
13410
Game.ascendMeterPercent=0;
13411
//PlaySound('snd/levelPrestige.mp3');//a bit too annoying
13412
}
13413
Game.ascendMeterLevel=ascendNowToGet;
13414
Game.ascendMeterPercentT=percent;//gauge that fills up as you near your next chip
13415
//if (Game.ascendMeterPercentT<Game.ascendMeterPercent) {Game.ascendMeterPercent=0;PlaySound('snd/levelPrestige.mp3',0.5);}
13416
//if (percent>=1) {Game.ascendMeter.className='';} else Game.ascendMeter.className='filling';
13417
}
13418
Game.ascendMeter.style.right=Math.floor(Math.max(0,1-Game.ascendMeterPercent)*100)+'px';
13419
Game.ascendMeterPercent+=(Game.ascendMeterPercentT-Game.ascendMeterPercent)*0.1;
13420
13421
Game.NotesLogic();
13422
if (Game.mouseMoved || Game.Scroll || Game.tooltip.dynamic) Game.tooltip.update();
13423
13424
if (Game.T%(Game.fps*5)==0 && !Game.mouseDown && (Game.onMenu=='stats' || Game.onMenu=='prefs')) Game.UpdateMenu();
13425
if (Game.T%(Game.fps*1)==0) Game.UpdatePrompt();
13426
if (Game.AscendTimer>0) Game.UpdateAscendIntro();
13427
if (Game.ReincarnateTimer>0) Game.UpdateReincarnateIntro();
13428
if (Game.OnAscend) Game.UpdateAscend();
13429
13430
for (var i in Game.customLogic) {Game.customLogic[i]();}
13431
13432
if (Game.sparklesT>0)
13433
{
13434
Game.sparkles.style.backgroundPosition=-Math.floor((Game.sparklesFrames-Game.sparklesT+1)*128)+'px 0px';
13435
Game.sparklesT--;
13436
if (Game.sparklesT==1) Game.sparkles.style.display='none';
13437
}
13438
13439
Game.Click=0;
13440
Game.Scroll=0;
13441
Game.mouseMoved=0;
13442
Game.CanClick=1;
13443
13444
if ((Game.toSave || (Game.T%(Game.fps*60)==0 && Game.T>Game.fps*10 && Game.prefs.autosave)) && !Game.OnAscend)
13445
{
13446
//check if we can save : no minigames are loading
13447
var canSave=true;
13448
for (var i in Game.Objects)
13449
{
13450
var me=Game.Objects[i];
13451
if (me.minigameLoading){canSave=false;break;}
13452
}
13453
if (canSave) Game.WriteSave();
13454
}
13455
13456
//every 30 minutes : get server data (ie. update notification, patreon data)
13457
if (Game.T%(Game.fps*60*30)==0 && Game.T>Game.fps*10/* && Game.prefs.autoupdate*/) {Game.CheckUpdates();Game.GrabData();}
13458
13459
Game.T++;
13460
}
13461
13462
/*=====================================================================================
13463
DRAW
13464
=======================================================================================*/
13465
13466
Game.Draw=function()
13467
{
13468
Game.DrawBackground();Timer.track('end of background');
13469
13470
if (!Game.OnAscend)
13471
{
13472
13473
var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies');
13474
var str=Beautify(Math.round(Game.cookiesd));
13475
if (Game.cookiesd>=1000000)//dirty padding
13476
{
13477
var spacePos=str.indexOf(' ');
13478
var dotPos=str.indexOf('.');
13479
var add='';
13480
if (spacePos!=-1)
13481
{
13482
if (dotPos==-1) add+='.000';
13483
else
13484
{
13485
if (spacePos-dotPos==2) add+='00';
13486
if (spacePos-dotPos==3) add+='0';
13487
}
13488
}
13489
str=[str.slice(0, spacePos),add,str.slice(spacePos)].join('');
13490
}
13491
if (str.length>11 && !Game.mobile) unit='<br>cookies';
13492
str+=unit;
13493
if (Game.prefs.monospace) str='<span class="monospace">'+str+'</span>';
13494
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
13495
l('cookies').innerHTML=str;
13496
l('compactCookies').innerHTML=str;
13497
Timer.track('cookie amount');
13498
13499
for (var i in Game.Objects)
13500
{
13501
var me=Game.Objects[i];
13502
if (me.onMinigame && me.minigame.draw && !me.muted) me.minigame.draw();
13503
}
13504
Timer.track('draw minigames');
13505
13506
if (Game.drawT%5==0)
13507
{
13508
//if (Game.prefs.monospace) {l('cookies').className='title monospace';} else {l('cookies').className='title';}
13509
var lastLocked=0;
13510
for (var i in Game.Objects)
13511
{
13512
var me=Game.Objects[i];
13513
13514
//make products full-opacity if we can buy them
13515
var classes='product';
13516
var price=me.bulkPrice;
13517
if (Game.cookiesEarned>=me.basePrice || me.bought>0) {classes+=' unlocked';lastLocked=0;me.locked=0;} else {classes+=' locked';lastLocked++;me.locked=1;}
13518
if ((Game.buyMode==1 && Game.cookies>=price) || (Game.buyMode==-1 && me.amount>0)) classes+=' enabled'; else classes+=' disabled';
13519
if (lastLocked>2) classes+=' toggledOff';
13520
me.l.className=classes;
13521
//if (me.id>0) {l('productName'+me.id).innerHTML=Beautify(me.storedTotalCps/Game.ObjectsById[me.id-1].storedTotalCps,2);}
13522
}
13523
13524
//make upgrades full-opacity if we can buy them
13525
var lastPrice=0;
13526
for (var i in Game.UpgradesInStore)
13527
{
13528
var me=Game.UpgradesInStore[i];
13529
if (!me.bought)
13530
{
13531
var price=me.getPrice();
13532
var canBuy=me.canBuy();//(Game.cookies>=price);
13533
var enabled=(l('upgrade'+i).className.indexOf('enabled')>-1);
13534
if ((canBuy && !enabled) || (!canBuy && enabled)) Game.upgradesToRebuild=1;
13535
if (price<lastPrice) Game.storeToRefresh=1;//is this upgrade less expensive than the previous one? trigger a refresh to sort it again
13536
lastPrice=price;
13537
}
13538
if (me.timerDisplay)
13539
{
13540
var T=me.timerDisplay();
13541
if (T!=-1)
13542
{
13543
if (!l('upgradePieTimer'+i)) l('upgrade'+i).innerHTML=l('upgrade'+i).innerHTML+'<div class="pieTimer" id="upgradePieTimer'+i+'"></div>';
13544
T=(T*144)%144;
13545
l('upgradePieTimer'+i).style.backgroundPosition=(-Math.floor(T%18))*48+'px '+(-Math.floor(T/18))*48+'px';
13546
}
13547
}
13548
13549
//if (me.canBuy()) l('upgrade'+i).className='crate upgrade enabled'; else l('upgrade'+i).className='crate upgrade disabled';
13550
}
13551
}
13552
Timer.track('store');
13553
13554
if (Game.PARTY)//i was bored and felt like messing with CSS
13555
{
13556
var pulse=Math.pow((Game.T%10)/10,0.5);
13557
Game.l.style.filter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';
13558
Game.l.style.webkitFilter='hue-rotate('+((Game.T*5)%360)+'deg) brightness('+(150-50*pulse)+'%)';
13559
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)';
13560
l('wrapper').style.overflowX='hidden';
13561
l('wrapper').style.overflowY='hidden';
13562
}
13563
13564
Timer.clean();
13565
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');
13566
13567
Game.textParticlesUpdate();Timer.track('text particles');
13568
}
13569
13570
Game.NotesDraw();Timer.track('notes');
13571
//Game.tooltip.update();//changed to only update when the mouse is moved
13572
13573
for (var i in Game.customDraw) {Game.customDraw[i]();}
13574
13575
Game.drawT++;
13576
//if (Game.prefs.altDraw) requestAnimationFrame(Game.Draw);
13577
}
13578
13579
/*=====================================================================================
13580
MAIN LOOP
13581
=======================================================================================*/
13582
Game.Loop=function()
13583
{
13584
if (Game.timedout) return false;
13585
Timer.say('START');
13586
Timer.track('browser stuff');
13587
Timer.say('LOGIC');
13588
//update game logic !
13589
Game.catchupLogic=0;
13590
Game.Logic();
13591
Game.catchupLogic=1;
13592
13593
var time=Date.now();
13594
13595
13596
//latency compensator
13597
Game.accumulatedDelay+=((time-Game.time)-1000/Game.fps);
13598
if (Game.prefs.timeout && time-Game.lastActivity>=1000*60*5)
13599
{
13600
if (Game.accumulatedDelay>1000*60*30) Game.delayTimeouts+=3;//more than 30 minutes delay ? computer probably asleep and not making cookies anyway
13601
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)
13602
if (Game.delayTimeouts>=3) Game.Timeout();//trigger timeout when the timeout counter is 3+
13603
}
13604
13605
Game.accumulatedDelay=Math.min(Game.accumulatedDelay,1000*5);//don't compensate over 5 seconds; if you do, something's probably very wrong
13606
Game.time=time;
13607
while (Game.accumulatedDelay>0)
13608
{
13609
Game.Logic();
13610
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)
13611
}
13612
Game.catchupLogic=0;
13613
Timer.track('logic');
13614
Timer.say('END LOGIC');
13615
if (!Game.prefs.altDraw)
13616
{
13617
var hasFocus=document.hasFocus();
13618
Timer.say('DRAW');
13619
if (hasFocus || Game.prefs.focus || Game.loopT%10==0) requestAnimationFrame(Game.Draw);
13620
//if (document.hasFocus() || Game.loopT%5==0) Game.Draw();
13621
Timer.say('END DRAW');
13622
}
13623
else requestAnimationFrame(Game.Draw);
13624
13625
//if (!hasFocus) Game.tooltip.hide();
13626
13627
if (Game.sesame)
13628
{
13629
//fps counter and graph
13630
Game.previousFps=Game.currentFps;
13631
Game.currentFps=Game.getFps();
13632
var ctx=Game.fpsGraphCtx;
13633
ctx.drawImage(Game.fpsGraph,-1,0);
13634
ctx.fillStyle='rgb('+Math.round((1-Game.currentFps/Game.fps)*128)+',0,0)';
13635
ctx.fillRect(128-1,0,1,64);
13636
ctx.strokeStyle='#fff';
13637
ctx.beginPath();
13638
ctx.moveTo(128-1,(1-Game.previousFps/Game.fps)*64);
13639
ctx.lineTo(128,(1-Game.currentFps/Game.fps)*64);
13640
ctx.stroke();
13641
13642
l('fpsCounter').innerHTML=Game.currentFps+' fps';
13643
var str='';
13644
for (var i in Timer.labels) {str+=Timer.labels[i];}
13645
if (Game.debugTimersOn) l('debugLog').style.display='block';
13646
else l('debugLog').style.display='none';
13647
l('debugLog').innerHTML=str;
13648
13649
}
13650
Timer.reset();
13651
13652
Game.loopT++;
13653
setTimeout(Game.Loop,1000/Game.fps);
13654
}
13655
}
13656
13657
13658
/*=====================================================================================
13659
LAUNCH THIS THING
13660
=======================================================================================*/
13661
Game.Launch();
13662
//try {Game.Launch();}
13663
//catch(err) {console.log('ERROR : '+err.message);}
13664
13665
window.onload=function()
13666
{
13667
13668
if (!Game.ready)
13669
{
13670
if (top!=self) Game.ErrorFrame();
13671
else
13672
{
13673
console.log('[=== '+choose([
13674
'Oh, hello!',
13675
'hey, how\'s it hangin',
13676
'About to cheat in some cookies or just checking for bugs?',
13677
'Remember : cheated cookies taste awful!',
13678
'Hey, Orteil here. Cheated cookies taste awful... or do they?',
13679
])+' ===]');
13680
Game.Load();
13681
//try {Game.Load();}
13682
//catch(err) {console.log('ERROR : '+err.message);}
13683
}
13684
}
13685
};
13686
13687