MasterSparky

Cookie Clicker Genocide Route

Mar 4th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.27 KB | None | 0 0
  1. Game.Win("Third-party");
  2. wrinklersLeft = 150;
  3. new Game.Achievement("But nobody came","Exhaust the wrinklers kill-counter.<q>Every time a number increases, that feeling...<br>That's me.<br>\""+Game.bakeryName+"\".</q>",[29,6]); Game.last.pool="shadow";
  4. function inRect(x,y,rect)
  5. {
  6. //find out if the point x,y is in the rotated rectangle rect{w,h,r,o} (width,height,rotation in radians,y-origin) (needs to be normalized)
  7. //I found this somewhere online I guess
  8. var dx = x+Math.sin(-rect.r)*(-(rect.h/2-rect.o)),dy=y+Math.cos(-rect.r)*(-(rect.h/2-rect.o));
  9. var h1 = Math.sqrt(dx*dx + dy*dy);
  10. var currA = Math.atan2(dy,dx);
  11. var newA = currA - rect.r;
  12. var x2 = Math.cos(newA) * h1;
  13. var y2 = Math.sin(newA) * h1;
  14. if (x2 > -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true;
  15. return false;
  16. }
  17.  
  18. Game.UpdateWrinklers=function()
  19. {
  20. var xBase=0;
  21. var yBase=0;
  22. var onWrinkler=0;
  23. if (Game.LeftBackground)
  24. {
  25. xBase=Game.cookieOriginX;
  26. yBase=Game.cookieOriginY;
  27. }
  28. var max=Game.getWrinklersMax();
  29. var n=0;
  30. for (var i in Game.wrinklers)
  31. {
  32. if (Game.wrinklers[i].phase>0) n++;
  33. }
  34. for (var i in Game.wrinklers)
  35. {
  36. var me=Game.wrinklers[i];
  37. if (me.phase==0 && Game.elderWrath>0 && n<max && me.id<max)
  38. {
  39. var chance=0.00001*Game.elderWrath;
  40. if (Game.Has('Unholy bait')) chance*=5;
  41. if (Game.Has('Wrinkler doormat')) chance=0.1;
  42. if (Math.random()<chance)//respawn
  43. {
  44. me.phase=1;
  45. me.hp=Game.wrinklerHP;
  46. me.type=0;
  47. if (Math.random()<0.0001) me.type=1;//shiny wrinkler
  48. }
  49. }
  50. if (me.phase>0)
  51. {
  52. if (me.close<1) me.close+=(1/Game.fps)/10;
  53. if (me.close>1) me.close=1;
  54. }
  55. else me.close=0;
  56. if (me.close==1 && me.phase==1)
  57. {
  58. me.phase=2;
  59. Game.recalculateGains=1;
  60. }
  61. if (me.phase==2)
  62. {
  63. me.sucked+=(((Game.cookiesPs/Game.fps)*Game.cpsSucked));//suck the cookies
  64. }
  65. if (me.phase>0)
  66. {
  67. if (me.type==0)
  68. {
  69. if (me.hp<Game.wrinklerHP) me.hp+=0.04;
  70. me.hp=Math.min(Game.wrinklerHP,me.hp);
  71. }
  72. else if (me.type==1)
  73. {
  74. if (me.hp<Game.wrinklerHP*3) me.hp+=0.04;
  75. me.hp=Math.min(Game.wrinklerHP*3,me.hp);
  76. }
  77. var d=128*(2-me.close);//*Game.BigCookieSize;
  78. if (Game.prefs.fancy) d+=Math.cos(Game.T*0.05+parseInt(me.id))*4;
  79. me.r=(me.id/max)*360;
  80. if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.05+parseInt(me.id))*4;
  81. me.x=xBase+(Math.sin(me.r*Math.PI/180)*d);
  82. me.y=yBase+(Math.cos(me.r*Math.PI/180)*d);
  83. if (Game.prefs.fancy) me.r+=Math.sin(Game.T*0.09+parseInt(me.id))*4;
  84. var rect={w:100,h:200,r:(-me.r)*Math.PI/180,o:10};
  85. if (Math.random()<0.01) me.hurt=Math.max(me.hurt,Math.random());
  86. if (Game.T%5==0 && Game.CanClick) {if (Game.LeftBackground && Game.mouseX<Game.LeftBackground.canvas.width && inRect(Game.mouseX-me.x,Game.mouseY-me.y,rect)) me.selected=1; else me.selected=0;}
  87. if (me.selected && onWrinkler==0 && Game.CanClick)
  88. {
  89. me.hurt=Math.max(me.hurt,0.25);
  90. //me.close*=0.99;
  91. if (Game.Click)
  92. {
  93. Game.playWrinklerSquishSound();
  94. me.hurt=1;
  95. me.hp-=0.75;
  96. if (Game.prefs.particles && !(me.hp<=0.5 && me.phase>0))
  97. {
  98. var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
  99. var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
  100. for (var ii=0;ii<3;ii++)
  101. {
  102. //Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');
  103. var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
  104. part.r=-me.r;
  105. }
  106. }
  107. Game.Click=0;
  108. }
  109. onWrinkler=1;
  110. }
  111. }
  112.  
  113. if (me.hurt>0)
  114. {
  115. me.hurt-=5/Game.fps;
  116. //me.close-=me.hurt*0.05;
  117. //me.x+=Math.random()*2-1;
  118. //me.y+=Math.random()*2-1;
  119. me.r+=(Math.sin(Game.T*1)*me.hurt)*18;//Math.random()*2-1;
  120. }
  121. if (me.hp<=0.5 && me.phase>0)
  122. {
  123. Game.playWrinklerSquishSound();
  124. PlaySound('snd/pop'+Math.floor(Math.random()*3+1)+'.mp3',0.75);
  125. Game.wrinklersPopped++;
  126. Game.recalculateGains=1;
  127. me.phase=0;
  128. me.close=0;
  129. me.hurt=0;
  130. me.hp=3;
  131. var toSuck=1.1;
  132. if (Game.Has('Sacrilegious corruption')) toSuck*=1.05;
  133. if (me.type==1) toSuck*=3;//shiny wrinklers are an elusive, profitable breed
  134. me.sucked*=toSuck;//cookie dough does weird things inside wrinkler digestive tracts
  135. if (Game.Has('Wrinklerspawn')) me.sucked*=1.05;
  136. if (me.sucked>0.5)
  137. { if(wrinklersLeft>0) wrinklersLeft--;
  138. if (Game.prefs.popups) Game.Popup('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler : found '+Beautify(me.sucked)+' cookies!');
  139. else if(wrinklersLeft>0) Game.Notify('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler','Found <b>'+Beautify(me.sucked)+'</b> cookies!<br><b><span class="warning">'+wrinklersLeft+' left.</span></b>',[19,8]);
  140. else Game.Notify('Exploded a '+(me.type==1?'shiny ':'')+'wrinkler','Found <b>'+Beautify(me.sucked)+'</b> cookies!',[19,8]);
  141. if(wrinklersLeft==0) Game.Win("But nobody came");
  142.  
  143. if (Game.season=='halloween')
  144. {
  145. //if (Math.random()<(Game.HasAchiev('Spooky cookies')?0.2:0.05))//halloween cookie drops
  146. var failRate=0.95;
  147. if (Game.HasAchiev('Spooky cookies')) failRate=0.8;
  148. if (Game.Has('Santa\'s bottomless bag')) failRate*=0.9;
  149. if (Game.hasAura('Mind Over Matter')) failRate*=0.75;
  150. if (Game.Has('Starterror')) failRate*=0.9;
  151. if (me.type==1) failRate*=0.9;
  152. if (Math.random()>failRate)//halloween cookie drops
  153. {
  154. var cookie=choose(['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies']);
  155. if (!Game.HasUnlocked(cookie) && !Game.Has(cookie))
  156. {
  157. Game.Unlock(cookie);
  158. if (Game.prefs.popups) Game.Popup('Found : '+cookie+'!');
  159. else Game.Notify(cookie,'You also found <b>'+cookie+'</b>!',Game.Upgrades[cookie].icon);
  160. }
  161. }
  162. }
  163. Game.DropEgg(0.98);
  164. }
  165. if (me.type==1) Game.Win('Last Chance to See');
  166. Game.Earn(me.sucked);
  167. /*if (Game.prefs.particles)
  168. {
  169. var x=me.x+(Math.sin(me.r*Math.PI/180)*100);
  170. var y=me.y+(Math.cos(me.r*Math.PI/180)*100);
  171. for (var ii=0;ii<6;ii++)
  172. {
  173. Game.particleAdd(x+Math.random()*50-25,y+Math.random()*50-25,Math.random()*4-2,Math.random()*-2-2,1,1,2,'wrinklerBits.png');
  174. }
  175. }*/
  176. if (Game.prefs.particles)
  177. {
  178. var x=me.x+(Math.sin(me.r*Math.PI/180)*90);
  179. var y=me.y+(Math.cos(me.r*Math.PI/180)*90);
  180. if (me.sucked>0)
  181. {
  182. for (var ii=0;ii<5;ii++)
  183. {
  184. Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.4,1.5,2);
  185. }
  186. }
  187. for (var ii=0;ii<8;ii++)
  188. {
  189. var part=Game.particleAdd(x,y,Math.random()*4-2,Math.random()*-2-2,1,1,2,me.type==1?'shinyWrinklerBits.png':'wrinklerBits.png');
  190. part.r=-me.r;
  191. }
  192. }
  193. me.sucked=0;
  194. }
  195. }
  196. if (onWrinkler)
  197. {
  198. Game.mousePointer=1;
  199. }
  200. }
Advertisement
Add Comment
Please, Sign In to add comment