WeeHee

main.js to main.php

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