From baa0a68dcc965833b2c9f0eb31dda045fa3d17c7 Mon Sep 17 00:00:00 2001 From: ozh Date: Thu, 13 Feb 2014 22:18:39 +0100 Subject: Init --- DungeonGen.js | 871 ++++++ ajax.js | 6 + base64.js | 142 + dungeons.js | 1136 ++++++++ img/alarmTurret.png | Bin 0 -> 440 bytes img/alchemylab.png | Bin 0 -> 820 bytes img/alchemylabBackground.png | Bin 0 -> 472 bytes img/alchemylabIcon.png | Bin 0 -> 854 bytes img/alteredGrandma.png | Bin 0 -> 470 bytes img/angrySentientCookie.png | Bin 0 -> 498 bytes img/antiGrandma.png | Bin 0 -> 526 bytes img/antimattercondenser.png | Bin 0 -> 666 bytes img/antimattercondenserBackground.png | Bin 0 -> 966 bytes img/antimattercondenserIcon.png | Bin 0 -> 905 bytes img/aqworldsbanner.jpg | Bin 0 -> 29770 bytes img/ascendedBakingPod.png | Bin 0 -> 1781 bytes img/babySentientCookie.png | Bin 0 -> 303 bytes img/bgBlue.jpg | Bin 0 -> 54968 bytes img/blackGradient.png | Bin 0 -> 561 bytes img/burntSentientCookie.png | Bin 0 -> 523 bytes img/buttonTile.jpg | Bin 0 -> 7741 bytes img/caramelWave.png | Bin 0 -> 11202 bytes img/chirpy.png | Bin 0 -> 426 bytes img/chocolateMilkWave.png | Bin 0 -> 10321 bytes img/control.png | Bin 0 -> 49522 bytes img/cookieShower1.png | Bin 0 -> 29496 bytes img/cookieShower2.png | Bin 0 -> 56506 bytes img/cookieShower3.png | Bin 0 -> 77323 bytes img/cosmicGrandma.png | Bin 0 -> 616 bytes img/crazedDoughSpurter.png | Bin 0 -> 597 bytes img/crazedKneader.png | Bin 0 -> 820 bytes img/cursor.png | Bin 0 -> 335 bytes img/cursoricon.png | Bin 0 -> 378 bytes img/darkNoise.png | Bin 0 -> 1746 bytes img/disgruntledCleaningLady.png | Bin 0 -> 893 bytes img/disgruntledOverseer.png | Bin 0 -> 902 bytes img/disgruntledWorker.png | Bin 0 -> 865 bytes img/doughling.png | Bin 0 -> 418 bytes img/dungeonFactory.png | Bin 0 -> 2355 bytes img/dungeonIcons.png | Bin 0 -> 4451 bytes img/dungeonOverlay.png | Bin 0 -> 12956 bytes img/dungeonTiles.png | Bin 0 -> 3480 bytes img/elderDoughling.png | Bin 0 -> 744 bytes img/elfGrandma.png | Bin 0 -> 622 bytes img/empty.png | Bin 0 -> 95 bytes img/factory.png | Bin 0 -> 477 bytes img/factoryBackground.png | Bin 0 -> 1285 bytes img/factoryIcon.png | Bin 0 -> 667 bytes img/farm.png | Bin 0 -> 765 bytes img/farmBackground.png | Bin 0 -> 812 bytes img/farmIcon.png | Bin 0 -> 904 bytes img/farmerGrandma.png | Bin 0 -> 615 bytes img/favicon.ico | Bin 0 -> 318 bytes img/frostedReindeer.png | Bin 0 -> 9957 bytes img/girlscoutChip.png | Bin 0 -> 751 bytes img/girlscoutCrumb.png | Bin 0 -> 738 bytes img/girlscoutDoe.png | Bin 0 -> 762 bytes img/girlscoutLucky.png | Bin 0 -> 754 bytes img/goldCookie.png | Bin 0 -> 4099 bytes img/grandma.png | Bin 0 -> 571 bytes img/grandmaBackground.png | Bin 0 -> 837 bytes img/grandmaIcon.png | Bin 0 -> 1234 bytes img/grandmaIconB.png | Bin 0 -> 1282 bytes img/grandmaIconC.png | Bin 0 -> 1297 bytes img/grandmaIconD.png | Bin 0 -> 1137 bytes img/grandmas1.jpg | Bin 0 -> 21400 bytes img/grandmas2.jpg | Bin 0 -> 17288 bytes img/grandmas3.jpg | Bin 0 -> 26926 bytes img/grandmasGrandma.png | Bin 0 -> 619 bytes img/hpBar.png | Bin 0 -> 781 bytes img/hpmBar.png | Bin 0 -> 778 bytes img/icons.png | Bin 0 -> 32827 bytes img/imperfectCookie.png | Bin 0 -> 95956 bytes img/infoBG.png | Bin 0 -> 94 bytes img/infoBGfade.png | Bin 0 -> 276 bytes img/list.txt | 124 + img/mapBG.jpg | Bin 0 -> 13022 bytes img/mapIcons.png | Bin 0 -> 664 bytes img/mapTiles.png | Bin 0 -> 595 bytes img/marshmallows.png | Bin 0 -> 2666 bytes img/milk.png | Bin 0 -> 6435 bytes img/milkWave.png | Bin 0 -> 15903 bytes img/mine.png | Bin 0 -> 668 bytes img/mineBackground.png | Bin 0 -> 1071 bytes img/mineIcon.png | Bin 0 -> 725 bytes img/minerGrandma.png | Bin 0 -> 626 bytes img/money.png | Bin 0 -> 280 bytes img/mysteriousHero.png | Bin 0 -> 366 bytes img/mysteriousOpponent.png | Bin 0 -> 561 bytes img/orangeWave.png | Bin 0 -> 11175 bytes img/panelHorizontal.png | Bin 0 -> 7121 bytes img/panelVertical.png | Bin 0 -> 7753 bytes img/perfectCookie.png | Bin 0 -> 98484 bytes img/portal.png | Bin 0 -> 973 bytes img/portalBackground.png | Bin 0 -> 3636 bytes img/portalIcon.png | Bin 0 -> 1078 bytes img/portraitChip.png | Bin 0 -> 940 bytes img/portraitCrumb.png | Bin 0 -> 967 bytes img/portraitDoe.png | Bin 0 -> 1069 bytes img/portraitLucky.png | Bin 0 -> 1045 bytes img/raspberryWave.png | Bin 0 -> 10444 bytes img/rawSentientCookie.png | Bin 0 -> 530 bytes img/santa.png | Bin 0 -> 9479 bytes img/sentientFurnace.png | Bin 0 -> 1657 bytes img/shadedBorders.png | Bin 0 -> 2357 bytes img/shadedBordersGold.png | Bin 0 -> 2357 bytes img/shadedBordersRed.png | Bin 0 -> 2357 bytes img/shine.png | Bin 0 -> 6172 bytes img/shipment.png | Bin 0 -> 507 bytes img/shipmentBackground.png | Bin 0 -> 923 bytes img/shipmentIcon.png | Bin 0 -> 805 bytes img/smallCookies.png | Bin 0 -> 14752 bytes img/snow.jpg | Bin 0 -> 47836 bytes img/snow2.jpg | Bin 0 -> 72223 bytes img/spookyCookie.png | Bin 0 -> 4436 bytes img/storeTile.jpg | Bin 0 -> 18462 bytes img/sugarBunny.png | Bin 0 -> 239 bytes img/timemachine.png | Bin 0 -> 773 bytes img/timemachineBackground.png | Bin 0 -> 1195 bytes img/timemachineIcon.png | Bin 0 -> 564 bytes img/transmutedGrandma.png | Bin 0 -> 449 bytes img/upgradeFrame.png | Bin 0 -> 880 bytes img/winterFrame.png | Bin 0 -> 898 bytes img/winterWrinkler.png | Bin 0 -> 5894 bytes img/workerGrandma.png | Bin 0 -> 534 bytes img/wrathCookie.png | Bin 0 -> 4894 bytes img/wrinkler.png | Bin 0 -> 5942 bytes img/wrinklerBits.png | Bin 0 -> 6554 bytes index.html | 164 ++ main.js | 4665 +++++++++++++++++++++++++++++++++ mobile.js | 82 + phonegap.js | 168 ++ style.css | 1260 +++++++++ 133 files changed, 8618 insertions(+) create mode 100644 DungeonGen.js create mode 100644 ajax.js create mode 100644 base64.js create mode 100644 dungeons.js create mode 100644 img/alarmTurret.png create mode 100644 img/alchemylab.png create mode 100644 img/alchemylabBackground.png create mode 100644 img/alchemylabIcon.png create mode 100644 img/alteredGrandma.png create mode 100644 img/angrySentientCookie.png create mode 100644 img/antiGrandma.png create mode 100644 img/antimattercondenser.png create mode 100644 img/antimattercondenserBackground.png create mode 100644 img/antimattercondenserIcon.png create mode 100644 img/aqworldsbanner.jpg create mode 100644 img/ascendedBakingPod.png create mode 100644 img/babySentientCookie.png create mode 100644 img/bgBlue.jpg create mode 100644 img/blackGradient.png create mode 100644 img/burntSentientCookie.png create mode 100644 img/buttonTile.jpg create mode 100644 img/caramelWave.png create mode 100644 img/chirpy.png create mode 100644 img/chocolateMilkWave.png create mode 100644 img/control.png create mode 100644 img/cookieShower1.png create mode 100644 img/cookieShower2.png create mode 100644 img/cookieShower3.png create mode 100644 img/cosmicGrandma.png create mode 100644 img/crazedDoughSpurter.png create mode 100644 img/crazedKneader.png create mode 100644 img/cursor.png create mode 100644 img/cursoricon.png create mode 100644 img/darkNoise.png create mode 100644 img/disgruntledCleaningLady.png create mode 100644 img/disgruntledOverseer.png create mode 100644 img/disgruntledWorker.png create mode 100644 img/doughling.png create mode 100644 img/dungeonFactory.png create mode 100644 img/dungeonIcons.png create mode 100644 img/dungeonOverlay.png create mode 100644 img/dungeonTiles.png create mode 100644 img/elderDoughling.png create mode 100644 img/elfGrandma.png create mode 100644 img/empty.png create mode 100644 img/factory.png create mode 100644 img/factoryBackground.png create mode 100644 img/factoryIcon.png create mode 100644 img/farm.png create mode 100644 img/farmBackground.png create mode 100644 img/farmIcon.png create mode 100644 img/farmerGrandma.png create mode 100644 img/favicon.ico create mode 100644 img/frostedReindeer.png create mode 100644 img/girlscoutChip.png create mode 100644 img/girlscoutCrumb.png create mode 100644 img/girlscoutDoe.png create mode 100644 img/girlscoutLucky.png create mode 100644 img/goldCookie.png create mode 100644 img/grandma.png create mode 100644 img/grandmaBackground.png create mode 100644 img/grandmaIcon.png create mode 100644 img/grandmaIconB.png create mode 100644 img/grandmaIconC.png create mode 100644 img/grandmaIconD.png create mode 100644 img/grandmas1.jpg create mode 100644 img/grandmas2.jpg create mode 100644 img/grandmas3.jpg create mode 100644 img/grandmasGrandma.png create mode 100644 img/hpBar.png create mode 100644 img/hpmBar.png create mode 100644 img/icons.png create mode 100644 img/imperfectCookie.png create mode 100644 img/infoBG.png create mode 100644 img/infoBGfade.png create mode 100644 img/list.txt create mode 100644 img/mapBG.jpg create mode 100644 img/mapIcons.png create mode 100644 img/mapTiles.png create mode 100644 img/marshmallows.png create mode 100644 img/milk.png create mode 100644 img/milkWave.png create mode 100644 img/mine.png create mode 100644 img/mineBackground.png create mode 100644 img/mineIcon.png create mode 100644 img/minerGrandma.png create mode 100644 img/money.png create mode 100644 img/mysteriousHero.png create mode 100644 img/mysteriousOpponent.png create mode 100644 img/orangeWave.png create mode 100644 img/panelHorizontal.png create mode 100644 img/panelVertical.png create mode 100644 img/perfectCookie.png create mode 100644 img/portal.png create mode 100644 img/portalBackground.png create mode 100644 img/portalIcon.png create mode 100644 img/portraitChip.png create mode 100644 img/portraitCrumb.png create mode 100644 img/portraitDoe.png create mode 100644 img/portraitLucky.png create mode 100644 img/raspberryWave.png create mode 100644 img/rawSentientCookie.png create mode 100644 img/santa.png create mode 100644 img/sentientFurnace.png create mode 100644 img/shadedBorders.png create mode 100644 img/shadedBordersGold.png create mode 100644 img/shadedBordersRed.png create mode 100644 img/shine.png create mode 100644 img/shipment.png create mode 100644 img/shipmentBackground.png create mode 100644 img/shipmentIcon.png create mode 100644 img/smallCookies.png create mode 100644 img/snow.jpg create mode 100644 img/snow2.jpg create mode 100644 img/spookyCookie.png create mode 100644 img/storeTile.jpg create mode 100644 img/sugarBunny.png create mode 100644 img/timemachine.png create mode 100644 img/timemachineBackground.png create mode 100644 img/timemachineIcon.png create mode 100644 img/transmutedGrandma.png create mode 100644 img/upgradeFrame.png create mode 100644 img/winterFrame.png create mode 100644 img/winterWrinkler.png create mode 100644 img/workerGrandma.png create mode 100644 img/wrathCookie.png create mode 100644 img/wrinkler.png create mode 100644 img/wrinklerBits.png create mode 100644 index.html create mode 100644 main.js create mode 100644 mobile.js create mode 100644 phonegap.js create mode 100644 style.css diff --git a/DungeonGen.js b/DungeonGen.js new file mode 100644 index 0000000..72234de --- /dev/null +++ b/DungeonGen.js @@ -0,0 +1,871 @@ +/* +Orteil's crappy dungeon generation library, 2013 +Unfinished and buggy, use at your own risk (please credit) +http://orteil.dashnet.org + +Rough process (might or might not be what actually happens) : +1 make a room in the middle +2 pick one of its walls (not corners) +3 select a free tile on the other side of that wall +4 iteratively expand the selection in one (corridors) or two (rooms) directions, stopping when we meet a wall or when we're above the size threshold +5 compute that selection into a room +6 add decorations to the room (pillars, water) but only on the center tiles, as to leave free passages (sprinkle destructible decorations anywhere) +7 take a random floor tile in the room and repeat step 4, but don't stop at the walls of this room (this creates branching) - repeat about 5 times for interesting shapes +8 add those branches to the room +9 carve the room into the map, and set the initially selected wall as a door - set the new room's parent to the previous room, and add it to its parent's children +10 repeat step 2 with any free wall on the map until the amount of tiles dug is above the desired fill ratio + +Note : I should probably switch the rendering to canvas to allow stuff like occlusion shadows and lights +*/ + +if (1==1 || undefined==Math.seedrandom) +{ + //seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html + (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); +} + +if (1==1 || undefined==choose) {function choose(arr) {if (arr.length==0) return 0; else return arr[Math.floor(Math.random()*arr.length)];}} + + +var DungeonGen=function() +{ + var TILE_EMPTY=0;//solid + var TILE_LIMIT=-100;//can't build anything here; edges of map + var TILE_FLOOR_EDGE=100; + var TILE_FLOOR_CENTER=110; + var TILE_DOOR=200; + var TILE_PILLAR=300;//not just pillars, could be any type of repetitive decoration + var TILE_WATER=400; + var TILE_WALL=500; + var TILE_WALL_CORNER=510; + var TILE_ENTRANCE=250; + var TILE_EXIT=260; + + var colors=[]; + colors[TILE_EMPTY]='000'; + colors[TILE_LIMIT]='900'; + colors[TILE_FLOOR_EDGE]='ffc'; + colors[TILE_FLOOR_CENTER]='ff9'; + colors[TILE_DOOR]='f9f'; + colors[TILE_PILLAR]='990'; + colors[TILE_WATER]='99f'; + colors[TILE_WALL]='960'; + colors[TILE_WALL_CORNER]='630'; + colors[TILE_ENTRANCE]='f9f'; + colors[TILE_EXIT]='f9f'; + + var rand=function(a,b){return Math.floor(Math.random()*(b-a+1)+a);}//return random value between a and b + + var Patterns=[]; + this.Pattern=function(name,func) + { + this.name=name; + this.func=func; + Patterns.push(this); + } + new this.Pattern('Pillars',function(x,y,room) + { + if ((x+room.x)%2==0 && (y+room.y)%2==0 && Math.random()<0.8) return TILE_PILLAR; + return 0; + }); + new this.Pattern('Large pillars',function(x,y,room) + { + if ((x+room.x)%3<2 && (y+room.y)%3<2 && Math.random()<0.8) return TILE_PILLAR; + return 0; + }); + new this.Pattern('Sparse pillars',function(x,y,room) + { + if ((x+room.x)%3==0 && (y+room.y)%3==0 && Math.random()<0.8) return TILE_PILLAR; + return 0; + }); + new this.Pattern('Lines',function(x,y,room) + { + if (room.x%2==0) if ((x+room.x)%2==0 && Math.random()<0.98) return TILE_PILLAR; + if (room.x%2==1) if ((y+room.y)%2==0 && Math.random()<0.98) return TILE_PILLAR; + return 0; + }); + + + var getRandomPattern=function() + {return choose(Patterns);} + + var defaultGenerator=function(me) + { + me.roomSize=10; + me.corridorSize=5; + me.fillRatio=1/3; + me.corridorRatio=0.2; + me.pillarRatio=0.2; + me.waterRatio=0; + me.branching=4; + me.sizeVariance=0.2; + + me.fillRatio=0.1+Math.random()*0.4; + me.roomSize=Math.ceil(rand(5,15)*me.fillRatio*2); + me.corridorSize=Math.ceil(rand(1,7)*me.fillRatio*2); + me.corridorRatio=Math.random()*0.8+0.1; + me.pillarRatio=Math.random()*0.5+0.5; + me.waterRatio=Math.pow(Math.random(),2); + me.branching=Math.floor(Math.random()*6); + me.sizeVariance=Math.random(); + } + + + this.Map=function(w,h,seed,params) + { + //create a new map + //leave the seed out for a random seed + //params is an object that contains custom parameters as defined in defaultGenerator + //example : MyMap=new DungeonGen.Map(30,30,MySeed,{waterRatio:0.8}); (80 percent of the rooms will contain water) + if (undefined!=seed) this.seed=seed; else {Math.seedrandom();this.seed=Math.random();} + Math.seedrandom(this.seed); + this.seedState=Math.random; + this.w=w||20; + this.h=h||20; + + this.roomsAreHidden=0; + + this.rooms=[]; + this.freeWalls=[];//all walls that would be a good spot for a door + this.freeTiles=[];//all passable floor tiles + this.doors=[]; + this.tiles=this.w*this.h; + this.tilesDug=0; + this.digs=0;//amount of digging steps + this.stuck=0;//how many times we ran into a problem; stop digging if we get too many of these + + this.data=[];//fill the map with 0 + for (var x=0;x=this.w-1 || ry+rh>=this.h-1) return false; + for (var x=rx;x0 && h>0) + { + if (w>0) {forcedExpansions.push(1,3);w--;} + if (h>0) {forcedExpansions.push(2,4);h--;} + } + + for (var i=0;i0) side=forcedExpansions[0]; + if (side==1) {xd=-1;wd=1;} + else if (side==2) {yd=-1;hd=1;} + else if (side==3) {wd=1;} + else if (side==4) {hd=1;} + if (this.canPlaceRoom(rx+xd,ry+yd,rw+wd,rh+hd)) {rx+=xd;ry+=yd;rw+=wd;rh+=hd;} else expansions.splice(expansions.indexOf(side),1); + if (forcedExpansions.length>0) forcedExpansions.splice(0,1); + } + if (rw>1 || rh>1) + { + this.expandRoom(room,rx,ry,rw,rh); + } + } + } + + + this.Map.prototype.carve=function(room) + { + //carve a room into the map + for (var i in room.tiles) + { + var thisTile=room.tiles[i]; + var x=thisTile.x;var y=thisTile.y; + var myType=this.data[x][y][0]; + var type=thisTile.type; + + if ((type==TILE_WALL || type==TILE_WALL_CORNER) && this.isWall(x,y)!=-1) {this.freeWalls.splice(this.isWall(x,y),1);} + + if (this.data[x][y][1]!=-1 && (type==TILE_WALL || type==TILE_WALL_CORNER)) {} + else + { + if (this.data[x][y][1]==-1) this.tilesDug++; + this.data[x][y]=[thisTile.type,room.id,0]; + if (x>1 && y>1 && x0 && room.freeTiles>0)//we got a decent room + { + this.carve(room); + this.data[door[0]][door[1]][0]=TILE_DOOR;//place door + room.door=[door[0],door[1]]; + this.data[door[0]][door[1]][1]=room.id;//set ID + this.freeWalls.splice(this.isWall(door[0],door[1]),1);//the door isn't a wall anymore + this.doors.push([door[0],door[1],room]); + //remove free tiles on either side of the door + if (this.isFloor(door[0]+side[0],door[1]+side[1])!=-1) this.removeFreeTile(door[0]+side[0],door[1]+side[1]); + if (this.isFloor(door[0]-side[0],door[1]-side[1])!=-1) this.removeFreeTile(door[0]-side[0],door[1]-side[1]); + room.parent=parentRoom; + parentRoom.children.push(room); + room.gen=parentRoom.gen+1; + } + else//not a good spot; remove this tile from the list of walls + { + this.freeWalls.splice(this.isWall(door[0],door[1]),1); + success=0; + } + } + } + if (success) return room; + else return 0; + } + + this.Map.prototype.getRandomSpotInRoom=function(room) + { + var listOfTiles=[]; + for (var i in room.tiles) + { + if ((room.tiles[i].type==TILE_FLOOR_EDGE || room.tiles[i].type==TILE_FLOOR_CENTER) && this.isFloor(room.tiles[i].x,room.tiles[i].y)!=-1) + { + listOfTiles.push(room.tiles[i]); + } + } + if (listOfTiles.length==0) return -1; + return choose(listOfTiles); + } + this.Map.prototype.getBestSpotInRoom=function(room) + { + var highest=-1; + var listOfHighest=[]; + for (var i in room.tiles) + { + if ((room.tiles[i].type==TILE_FLOOR_EDGE || room.tiles[i].type==TILE_FLOOR_CENTER) && this.isFloor(room.tiles[i].x,room.tiles[i].y)!=-1) + { + if (room.tiles[i].score>highest) + { + listOfHighest=[]; + highest=room.tiles[i].score; + listOfHighest.push(room.tiles[i]); + } + else if (room.tiles[i].score==highest) + { + listOfHighest.push(room.tiles[i]); + } + } + } + if (listOfHighest.length==0) return -1; + return choose(listOfHighest); + } + this.Map.prototype.getEarliestRoom=function() + { + return this.rooms[0]; + } + this.Map.prototype.getDeepestRoom=function() + { + var deepest=0; + var deepestRoom=this.rooms[0]; + for (var i in this.rooms) + { + if ((this.rooms[i].gen+Math.sqrt(this.rooms[i].freeTiles)*0.05)>=deepest && this.rooms[i].corridor==0 && this.rooms[i].freeTiles>4) {deepest=(this.rooms[i].gen+Math.sqrt(this.rooms[i].freeTiles)*0.05);deepestRoom=this.rooms[i];} + } + return deepestRoom; + } + + this.Map.prototype.dig=function() + { + //one step in which we try to carve new stuff + //returns 0 when we couldn't dig this step, 1 when we could, and 2 when the digging is complete + Math.random=this.seedState; + + var badDig=0; + + if (this.digs==0)//first dig : build a starting room in the middle of the map + { + var w=rand(3,7); + var h=rand(3,7); + var room=this.newRoom(Math.floor(this.w/2-w/2),Math.floor(this.h/2-h/2),w,h); + room.corridor=0; + this.planRoom(room); + this.carve(room); + } + else + { + if (this.newRandomRoom()==0) badDig++; + } + if (badDig>0) this.stuck++; + + this.digs++; + + var finished=0; + if (this.tilesDug>=this.tiles*this.fillRatio) finished=1; + if (this.stuck>100) finished=1; + + if (finished==1)//last touch : try to add a whole room at the end + { + for (var i=0;i<10;i++) + { + var newRoom=this.newRandomRoom({corridor:0,w:rand(3,7),h:rand(3,7)}); + if (newRoom!=0 && newRoom.freeTiles>15) break; + } + } + + Math.seedrandom(); + if (finished==1) return 1; else if (badDig>0) return -1; else return 0; + } + + this.Map.prototype.finish=function() + { + //touch up the map : add pillars in corners etc + /* + //set paths + for (var i in this.rooms) + { + var me=this.rooms[i]; + if (me.door!=0) + { + var doors=[]; + doors.push(me.door); + for (var ii in me.children) + { + if (me.children[ii].door!=0) doors.push(me.children[ii].door); + } + for (var ii in doors) + { + this.data[doors[ii][0]][doors[ii][1]][0]=TILE_LIMIT; + //ideally we should run agents that step from each door to the next + } + } + } + */ + for (var i in this.rooms) + { + var pillars=Math.random()4) + { + if ((angle==1 || (complete && walls==7)) && me==TILE_FLOOR_EDGE && x1!=TILE_DOOR && x2!=TILE_DOOR && y1!=TILE_DOOR && y2!=TILE_DOOR) + { + this.data[x][y][0]=TILE_PILLAR; + me=TILE_PILLAR; + this.removeFreeTile(x,y); + this.rooms[i].freeTiles--; + } + } + + //calculate score (for placing items and exits) + if (top==1 || bottom==1 || left==1 || right==1) + { + this.rooms[i].tiles[ii].score+=2; + } + if (walls>5 || floors>5) + { + this.rooms[i].tiles[ii].score+=1; + } + if (walls==7 || floors==8) + { + this.rooms[i].tiles[ii].score+=5; + } + if ((me!=TILE_FLOOR_CENTER && me!=TILE_FLOOR_EDGE) || x1==TILE_DOOR || x2==TILE_DOOR || y1==TILE_DOOR || y2==TILE_DOOR) this.rooms[i].tiles[ii].score=-1; + + } + } + + + + //carve entrance and exit + var entrance=this.getBestSpotInRoom(this.getEarliestRoom()); + this.data[entrance.x][entrance.y][0]=TILE_ENTRANCE; + this.entrance=[entrance.x,entrance.y]; + entrance.score=0; + this.removeFreeTile(entrance.x,entrance.y); + var exit=this.getBestSpotInRoom(this.getDeepestRoom()); + this.data[exit.x][exit.y][0]=TILE_EXIT; + this.exit=[exit.x,exit.y]; + this.removeFreeTile(exit.x,exit.y); + exit.score=0; + + /* + for (var i in this.doors)//remove door tiles (to add later; replace the tiles by entities that delete themselves when opened) + { + this.data[this.doors[i][0]][this.doors[i][1]][0]=TILE_FLOOR_EDGE; + } + */ + } + + this.Map.prototype.isObstacle=function(x,y) + { + var free=[TILE_FLOOR_EDGE,TILE_FLOOR_CENTER,TILE_DOOR,TILE_ENTRANCE,TILE_EXIT]; + for (var i in free) + { + if (this.data[x][y][0]==free[i]) return 0; + } + return 1; + } + + var joinTile=function(map,x,y,joinWith) + { + //for the tile at x,y, return 2 if it joins with its horizontal neighbors, 3 if it joins with its vertical neighbors, 1 if it joins with either both or neither. + //joinWith contains the tile types that count as joinable, in addition to this tile. (don't add the tested tile to joinWith!) + var p=1; + var me=map.data[x][y][0]; + var x1=map.data[x-1][y][0]; + var x2=map.data[x+1][y][0]; + var y1=map.data[x][y-1][0]; + var y2=map.data[x][y+1][0]; + joinWith.push(me); + var joinsX=0; + for (var i in joinWith) + { + if (x1==joinWith[i]) joinsX++; + if (x2==joinWith[i]) joinsX++; + } + var joinsY=0; + for (var i in joinWith) + { + if (y1==joinWith[i]) joinsY++; + if (y2==joinWith[i]) joinsY++; + } + if (joinsX==2 && joinsY==2) p=1; + else if (joinsX==2) p=2; + else if (joinsY==2) p=3; + return p; + } + this.Map.prototype.getPic=function(x,y) + { + //return a position [x,y] in the tiles (as 0, 1, 2...) for the tile on the map at position x,y + if (Tiles[this.data[x][y][2]]) + { + if (Tiles[this.data[x][y][2]].joinType=='join') + { + var thisPic=Tiles[this.data[x][y][2]].pic; + thisPic=[thisPic[0],thisPic[1]];//why is this even necessary? + var joinWith=[]; + if (this.data[x][y][0]==TILE_WALL) joinWith.push(TILE_WALL_CORNER); + else if (this.data[x][y][0]==TILE_DOOR) joinWith.push(TILE_WALL,TILE_WALL_CORNER); + thisPic[0]+=joinTile(this,x,y,joinWith)-1; + return thisPic; + } + else if (Tiles[this.data[x][y][2]].joinType=='random3') + { + var thisPic=Tiles[this.data[x][y][2]].pic; + thisPic=[thisPic[0],thisPic[1]]; + thisPic[0]+=Math.floor(Math.random()*3); + return thisPic; + } + return Tiles[this.data[x][y][2]].pic; + } + return [0,0]; + } + + var Tiles=[]; + var TilesByName=[]; + this.Tile=function(name,pic,joinType) + { + this.name=name; + this.pic=pic; + this.joinType=joinType||'none'; + this.id=Tiles.length; + Tiles[this.id]=this; + TilesByName[this.name]=this; + } + new this.Tile('void',[0,0]); + this.loadTiles=function(tiles) + { + for (var i in tiles) + { + var name=tiles[i][0]; + var pic=tiles[i][1]; + var joinType=tiles[i][2]; + new this.Tile(name,pic,joinType); + } + } + + var computeTile=function(tile,tiles,value,name) + { + if (tile==value && tiles[name]) return TilesByName[tiles[name]]; + return 0; + } + this.Map.prototype.assignTiles=function(room,tiles) + { + //set the displayed tiles for this room + for (var i in room.tiles) + { + var type=Tiles[0]; + var me=room.tiles[i]; + var tile=this.data[me.x][me.y][0]; + type=computeTile(tile,tiles,TILE_WALL_CORNER,'wall corner')||type; + type=computeTile(tile,tiles,TILE_WALL,'wall')||type; + type=computeTile(tile,tiles,TILE_FLOOR_EDGE,'floor edges')||type; + type=computeTile(tile,tiles,TILE_FLOOR_CENTER,'floor')||type; + type=computeTile(tile,tiles,TILE_PILLAR,'pillar')||type; + type=computeTile(tile,tiles,TILE_DOOR,'door')||type; + type=computeTile(tile,tiles,TILE_WATER,'water')||type; + type=computeTile(tile,tiles,TILE_ENTRANCE,'entrance')||type; + type=computeTile(tile,tiles,TILE_EXIT,'exit')||type; + + this.data[me.x][me.y][2]=type.id; + } + } + + + this.Map.prototype.draw=function(size) + { + //return a string containing a rough visual representation of the map + var str=''; + var size=size||10; + for (var y=0;y'+text+''; + } + str+='
'; + } + str='
'+str+'
'; + return str; + } + + this.Map.prototype.drawDetailed=function() + { + //return a string containing a rough visual representation of the map (with graphics) + var str=''; + var size=16; + for (var y=0;y'; + } + str+='
'; + } + str='
'+str+'
'; + return str; + } + + this.Map.prototype.getStr=function() + { + //return a string containing the map with tile graphics, ready to be pasted in a wrapper + var str=''; + var size=16; + for (var y=0;y'; + } + str+='
'; + } + return str; + } + +} \ No newline at end of file diff --git a/ajax.js b/ajax.js new file mode 100644 index 0000000..8d08eab --- /dev/null +++ b/ajax.js @@ -0,0 +1,6 @@ +function ajax(url,callback){ + var ajaxRequest; + try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest=new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {try{ajaxRequest=new ActiveXObject('Microsoft.XMLHTTP');} catch (e){alert("Something broke!");return false;}}} + if (callback){ajaxRequest.onreadystatechange=function(){if(ajaxRequest.readyState==4){callback(ajaxRequest.responseText);}}} + ajaxRequest.open('GET',url+'&nocache='+(new Date().getTime()),true);ajaxRequest.send(null); +} \ No newline at end of file diff --git a/base64.js b/base64.js new file mode 100644 index 0000000..6e87eb7 --- /dev/null +++ b/base64.js @@ -0,0 +1,142 @@ +/** +* +* Base64 encode / decode +* http://www.webtoolkit.info/ +* +**/ + +var Base64 = { + + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + + // public method for encoding + encode : function (input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + input = Base64._utf8_encode(input); + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + + } + + return output; + }, + + // public method for decoding + decode : function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + output = Base64._utf8_decode(output); + + return output; + + }, + + // private method for UTF-8 encoding + _utf8_encode : function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + + for (var n = 0; n < string.length; n++) { + + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + }, + + // private method for UTF-8 decoding + _utf8_decode : function (utftext) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + + while ( i < utftext.length ) { + + c = utftext.charCodeAt(i); + + if (c < 128) { + string += String.fromCharCode(c); + i++; + } + else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } + else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + + } + + return string; + } + +} \ No newline at end of file diff --git a/dungeons.js b/dungeons.js new file mode 100644 index 0000000..7271fb3 --- /dev/null +++ b/dungeons.js @@ -0,0 +1,1136 @@ +/* +Orteil's sloppy Cookie Clicker dungeons + +Optimizations to do (not mentioning the dozens of missing features) : +-use canvas instead +-only compute AI for mobs with 2 tiles of view +*/ +var LaunchDungeons=function() +{ + Game.GetWord=function(type) + { + if (type=='secret') return choose(['hidden','secret','mysterious','forgotten','forbidden','lost','sunk','buried','concealed','shrouded','invisible','elder']); + if (type=='ruined') return choose(['ancient','old','ruined','ravaged','destroyed','collapsed','demolished','burnt','torn-down','shattered','dilapidated','abandoned','crumbling','derelict','decaying']); + if (type=='magical') return choose(['arcane','magical','mystical','sacred','honed','banished','unholy','holy','demonic','enchanted','necromantic','bewitched','haunted','occult','astral']); + return ''; + } + + /*===================================================================================== + DUNGEONS + =======================================================================================*/ + Game.DungeonTypes=[]; + Game.DungeonType=function(name) + { + this.name=name; + this.nameGenerator=function(){return 'Mysterious dungeon';}; + this.roomTypes=[]; + Game.DungeonTypes[this.name]=this; + return this; + }; + + /*===================================================================================== + CREATE DUNGEON TYPES + =======================================================================================*/ + new Game.DungeonType('Factory'). + nameGenerator=function(){ + var str=''; + str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['factory','factories','bakery','bakeries','confectionery','laboratory','research center','chocolate forge','chocolate foundry','manufactory','warehouse','machinery','works','bakeworks','workshop','assembly line']); + return str; + }; + + new Game.DungeonType('Mine'). + nameGenerator=function(){ + var str=''; + str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['chocolate','chocolate','chocolate','white chocolate','sugar','cacao'])+' '+choose(['mine','mines','pit','pits','quarry','excavation','tunnel','shaft','lode','trench','mountain','vein','cliff','peak','dome','crater','abyss','chasm','hole','burrow']); + return str; + }; + + new Game.DungeonType('Portal'). + nameGenerator=function(){ + var str=''; + str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['portal','gate','dimension','warpgate','door']); + return str; + }; + + new Game.DungeonType('Secret zebra level'). + nameGenerator=function(){ + var str=''; + str+=Game.GetWord(choose(['secret']))+' '+choose(['zebra level']); + return str; + }; + + + /*===================================================================================== + CREATE TILE TYPES + =======================================================================================*/ + + var D=new DungeonGen(); + D.loadTiles([ + ['wall',[1,0],'join'], + ['wall corner',[1,0]], + ['floor',[1,1],'random3'], + ['tiled floor',[1,2],'join'], + ['round pillar',[1,4]], + ['square pillar',[2,4]], + ['potted plant',[3,4]], + ['bookshelf',[4,5],'join'], + ['door',[1,3],'join'], + ['alt wall',[4,0],'join'], + ['alt wall corner',[4,0]], + ['alt floor',[4,1],'random3'], + ['alt tiled floor',[4,2],'join'], + ['alt round pillar',[4,4]], + ['alt square pillar',[5,4]], + ['alt potted plant',[6,4]], + ['alt bookshelf',[4,6],'join'], + ['alt door',[4,3],'join'], + ['water',[1,5]], + ['green water',[2,5]], + ['dark water',[3,5]], + ['wooden wall',[1,7],'join'], + ['wooden floor',[1,6],'random3'], + ['conveyor belt',[4,7],'join'], + ['entrance',[0,1]], + ['alt entrance',[0,3]], + ['exit',[0,2]], + ['alt exit',[0,4]] + ]); + + + /*===================================================================================== + CREATE MONSTER TYPES + =======================================================================================*/ + + /* + An explanation of stats : + -hp : health points + -speed : determines who attacks first in a fight; bypasses dodging; determines how fast heroes auto-run dungeons + -might : determines how much damage is done to opponents + -guard : lowers incoming damage + -dodge : chance of avoiding incoming attacks completely (affected by the opponent's speed) + -luck : heroes only, determines drops and rare encounters + -rarity : monsters only, determines how often a monster is added to the spawn table + -level : monsters only, determines which average room depth the monster is more likely to spawn in (also determines the loot amount) + */ + Game.monsterIconY=10;//offset for dungeonItems.png monsters + Game.Monsters=[]; + Game.Monster=function(name,pic,icon,level,stats,loot) + { + this.name=name; + this.pic=pic; + this.icon=icon; + this.level=level; + this.stats={}; + for (var i in stats) + {this.stats[i]=stats[i];} + this.stats.hpm=this.stats.hp; + this.stats.rarity=stats.rarity||1; + this.loot=loot||{}; + this.boss=0; + this.quotes={}; + Game.Monsters[this.name]=this; + } + var basicLoot={cookies:{min:1,max:5,prob:0.5}}; + var goodLoot={cookies:{min:3,max:8,prob:1},gear:{prob:0.05}}; + var bossLoot={gear:{prob:1}}; + var chestLoot={cookies:{min:2,max:20,prob:1},gear:{prob:0.1}}; + var bossLoot={cookies:{min:10,max:50,prob:1},gear:{prob:0.2}}; + + //general monsters + new Game.Monster('Doughling','doughling',[0,0],1,{hp:5,might:2,guard:2,speed:6,dodge:6,rarity:0.7},basicLoot); + new Game.Monster('Elder doughling','elderDoughling',[1,0],7,{hp:20,might:7,guard:7,speed:4,dodge:4,rarity:0.7},goodLoot); + new Game.Monster('Angry sentient cookie','angrySentientCookie',[5,0],5,{hp:16,might:8,guard:4,speed:5,dodge:5,rarity:1},basicLoot); + new Game.Monster('Baby sentient cookie','babySentientCookie',[4,0],1,{hp:3,might:1,guard:1,speed:7,dodge:7,rarity:1},basicLoot); + new Game.Monster('Burnt sentient cookie','burntSentientCookie',[6,0],5,{hp:16,might:12,guard:2,speed:3,dodge:2,rarity:0.2},basicLoot); + new Game.Monster('Raw sentient cookie','rawSentientCookie',[5,0],5,{hp:16,might:6,guard:4,speed:7,dodge:7,rarity:0.2},basicLoot); + new Game.Monster('Sugar bunny','sugarBunny',[8,0],5,{hp:10,might:3,guard:8,speed:12,dodge:9,rarity:0.001},{cookies:{min:1000,max:10000}}); + Game.Monsters['Sugar bunny'].onKill=function(){Game.Win('Follow the white rabbit');};Game.Monsters['Sugar bunny'].AI='flee'; + + //factory monsters + new Game.Monster('Crazed kneader','crazedKneader',[0,2],6,{hp:18,might:6,guard:8,speed:3,dodge:2,rarity:0.5},goodLoot); + new Game.Monster('Crazed chip-spurter','crazedDoughSpurter',[0,2],6,{hp:15,might:6,guard:8,speed:5,dodge:3,rarity:0.5},goodLoot); + new Game.Monster('Alarm bot','alarmTurret',[3,2],2,{hp:6,might:3,guard:5,speed:8,dodge:8,rarity:0.5},basicLoot); + new Game.Monster('Chirpy','chirpy',[4,2],3,{hp:7,might:4,guard:6,speed:9,dodge:9,rarity:0.01},{cookies:{min:500,max:5000}}); + Game.Monsters['Chirpy'].onKill=function(){Game.Win('Chirped out');};Game.Monsters['Chirpy'].quotes={fight:'oh, hello <3'}; + new Game.Monster('Disgruntled worker','disgruntledWorker',[1,2],4,{hp:14,might:5,guard:5,speed:6,dodge:4,rarity:0.6},basicLoot); + new Game.Monster('Disgruntled overseer','disgruntledOverseer',[1,2],7,{hp:22,might:7,guard:5,speed:6,dodge:4,rarity:0.5},basicLoot); + new Game.Monster('Disgruntled cleaning lady','disgruntledCleaningLady',[2,2],4,{hp:13,might:4,guard:5,speed:7,dodge:6,rarity:0.3},basicLoot); + + new Game.Monster('Sentient Furnace','sentientFurnace',[0,3],0,{hp:60,might:14,guard:12,speed:4,dodge:0,rarity:1},bossLoot);//boss + Game.Monsters['Sentient Furnace'].onKill=function(){Game.Win('Getting even with the oven');};Game.Monsters['Sentient Furnace'].AI='static';Game.Monsters['Sentient Furnace'].boss=1;Game.Monsters['Sentient Furnace'].quotes={fight:'YOU ARE NOT READY!',defeat:'OH... BURN.'}; + new Game.Monster('Ascended Baking Pod','ascendedBakingPod',[1,3],0,{hp:60,might:12,guard:14,speed:4,dodge:0,rarity:0.7},bossLoot);//boss + Game.Monsters['Ascended Baking Pod'].onKill=function(){Game.Win('Now this is pod-smashing');};Game.Monsters['Ascended Baking Pod'].AI='static';Game.Monsters['Ascended Baking Pod'].boss=1;Game.Monsters['Ascended Baking Pod'].quotes={fight:'rrrrrrrise.',defeat:'blrglblg.'}; + + + Game.BossMonsters=[]; + for (var i in Game.Monsters) + { + if (Game.Monsters[i].boss) Game.BossMonsters.push(Game.Monsters[i]); + } + + /*===================================================================================== + ENTITY MECHANICS + =======================================================================================*/ + + Game.Entity=function(type,subtype,dungeon,pic,stats)//objects you could find on the map : doors, mobs, interactables, items, player, exits... + { + this.type=type; + this.subtype=subtype||''; + this.dungeon=dungeon; + this.pic=pic||[0,0]; + this.stats={}; + for (var i in stats) + {this.stats[i]=stats[i];} + + this.x=-1; + this.y=-1; + this.obstacle=0; + this.zIndex=1; + if (this.type=='monster') + { + this.obstacle=1; + this.pic=[Game.Monsters[this.subtype].icon[0],Game.Monsters[this.subtype].icon[1]]; + this.pic[1]+=Game.monsterIconY; + this.targets=[]; + this.stuck=0; + this.zIndex=10; + this.fighting=0; + this.AI=Game.Monsters[this.subtype].AI||'normal'; + this.onKill=Game.Monsters[this.subtype].onKill||function(){}; + for (var i in Game.Monsters[this.subtype].stats){this.stats[i]=Game.Monsters[this.subtype].stats[i];} + } + else if (this.type=='hero') + { + this.obstacle=1; + this.pic=[Game.Heroes[this.subtype].icon[0],Game.Heroes[this.subtype].icon[1]]; + this.targets=[]; + this.stuck=0; + this.zIndex=100; + this.fighting=0; + for (var i in Game.Heroes[this.subtype].stats){this.stats[i]=Game.Heroes[this.subtype].stats[i];} + + //increase stats by amount of matching building (change that later to use gear instead) + var mult=Math.max(0,(Game.Objects[this.dungeon.type].amount/20-1)); + this.stats.hpm+=Math.ceil(mult*2); + this.stats.hp=this.stats.hpm; + this.stats.might+=mult; + this.stats.guard+=mult; + this.stats.speed+=mult; + this.stats.dodge+=mult; + } + else if (this.type=='item') + { + this.zIndex=5; + this.value=0; + } + else if (this.type=='destructible')//crates, doors + { + this.obstacle=1; + this.life=3; + this.zIndex=15; + if (this.subtype=='door') this.pic=[0,7]; + else this.pic=[Math.floor(Math.random()*4+2),7]; + + this.onKill=function() + { + if (this.subtype=='random') + { + var value=Math.round(Math.pow(Math.random(),6)*(10+this.dungeon.level)); + if (value>0) + { + var entity=this.dungeon.AddEntity('item','cookies',this.x,this.y); + entity.value=value; + } + } + } + } + else if (this.type=='special') + { + this.zIndex=5; + this.value=''; + this.obstacle=1; + } + + this.Say=function(what) + { + if (this.type=='monster') + { + if (Game.Monsters[this.subtype].quotes[what]) this.dungeon.Log(this.subtype+' : "'+choose(Game.Monsters[this.subtype].quotes[what].split('|'))+'"'); + } + } + this.Draw=function()//return the string to draw this + { + var name='?'; + if (this.subtype=='random') name='clutter'; else name=this.subtype; + if (this.type=='item' && this.subtype=='cookies' && this.value>0) + { + if (this.value<2) this.pic=[0,5]; + else if (this.value<3) this.pic=[1,5]; + else if (this.value<4) this.pic=[2,5]; + else if (this.value<6) this.pic=[3,5]; + else if (this.value<10) this.pic=[4,5]; + else if (this.value<20) this.pic=[5,5]; + else if (this.value<30) this.pic=[7,5]; + else if (this.value<70) this.pic=[6,5]; + else if (this.value<200) this.pic=[8,5]; + else this.pic=[6,6];// if (this.value<1000) this.pic=[1,5]; + } + else if (this.type=='special' && this.subtype=='upgrade') + { + if (this.value!='') this.pic=[7,6]; else this.pic=[8,6]; + } + return '
'; + } + this.Wander=function()//AI to move around aimlessly + { + this.targets=[]; + this.targets.push([-1,0],[1,0],[0,-1],[0,1]); + this.Move(); + } + this.GoTo=function(x,y)//AI to move to a specific point + { + this.targets=[]; + if (this.xx) this.targets.push([-1,0]); + if (this.yy) this.targets.push([0,-1]); + if (!this.Move())//really stuck? try to maneuver laterally! + { + this.targets=[]; + if (this.x==x) this.targets.push([1,0],[-1,0]);//somehow this feels inverted... but it doesn't work the other way + if (this.y==y) this.targets.push([0,1],[0,-1]);//hypothesis : *MAGIC* + this.Move(); + } + } + this.Flee=function(x,y)//AI to run away from a specific point + { + this.targets=[]; + if (this.x>x) this.targets.push([1,0]); + if (this.xy) this.targets.push([0,1]); + if (this.y0) + { + var goodTargets=[]; + if (this.type=='hero') goodTargets=this.targets; + else + { + for (var i in this.targets) + { + var thisTarget=this.targets[i]; + if (this.dungeon.CheckObstacle(this.x+thisTarget[0],this.y+thisTarget[1])!=-1) goodTargets.push([thisTarget[0],thisTarget[1]]); + } + } + if (goodTargets.length>0) + { + var target=choose(goodTargets); + var obstacle=this.dungeon.CheckObstacle(this.x+target[0],this.y+target[1]); + if (obstacle==this) obstacle=0; + if (obstacle==0 && this.AI!='static') + { + this.x+=target[0]; + this.y+=target[1]; + } + else this.stuck+=2; + if (obstacle!=0 && obstacle!=-1) + { + obstacle.HitBy(this); + } + if (obstacle==-1) return 0; + } + else {this.stuck+=2;return 0;} + if (this.AI=='static') this.stuck=0; + return 1; + } + return 0; + } + this.HitBy=function(by)//attacked by another entity + { + if (this.type=='destructible' && by.type=='hero')//break destructibles + { + by.stuck=0; + this.life--; + if (this.life<=0) + { + if (this.onKill) this.onKill(); + this.Destroy(); + } + else this.pic=[this.pic[0],this.pic[1]+1]; + } + else if (this.type=='special' && this.subtype=='upgrade')//upgrade relic + { + this.obstacle=0; + if (Game.Upgrades[this.value]) Game.Upgrades[this.value].earn(); + this.value=''; + } + else if ((this.type=='monster' && by.type=='hero') || (this.type=='hero' && by.type=='monster') && this.stats.hp>0)//it's a fight! + { + by.stuck=0; + + var monster=(this.type=='hero'?by:this); + var hero=(this.type=='hero'?this:by); + this.dungeon.currentOpponent=monster; + + if (monster.fighting==0)//first meeting + { + Game.Heroes[hero.subtype].Say('meet '+Game.Monsters[monster.subtype].name); + this.Say('fight'); + } + if (this.fighting==0) + { + this.fighting=1; + by.fighting=1; + } + + var attackStr=''; + var attackerName=''; + var defenderName=''; + if (by.type=='hero') attackerName=Game.Heroes[by.subtype].name; + else if (by.type=='monster') attackerName=Game.Monsters[by.subtype].name; + if (this.type=='hero') defenderName=Game.Heroes[this.subtype].name; + else if (this.type=='monster') defenderName=Game.Monsters[this.subtype].name; + + //battle formulas (have fun with these) + attackStr+=attackerName+' swings at '+defenderName+'!'; + var damage=Math.round(Math.max(1,Math.min(by.stats.might,Math.pow(((by.stats.might+2.5)/Math.max(1,this.stats.guard)),2)))*(0.8+Math.random()*0.4+Math.pow(Math.random()*0.8,6))); + var dodge=Math.random()>(by.stats.speed/Math.max(1,this.stats.dodge+2.5)); + if (dodge) + { + attackStr+=' '+defenderName+' dodged the attack.'; + } + else + { + if (by.stats.luck && by.type=='hero' && Math.random()It\'s a critical!';}//very rare critical based on luck + attackStr+=' '+damage+' damage!'; + + this.stats.hp-=damage; + this.stats.hp=Math.max(this.stats.hp,0); + if (this.stats.luck && this.type=='hero') + { + if (this.stats.hp==0 && Math.random()'; + if (attackStr!='') this.dungeon.Log(attackStr); + + if (this.stats.hp<=0)//die + { + this.dungeon.Log(attackerName+' crushed '+defenderName+'!'); + if (this.type=='hero') + { + Game.Heroes[this.subtype].Say('defeat'); + this.dungeon.Log(''+Game.Heroes[this.subtype].name+' has been defeated.'); + this.dungeon.FailLevel(); + } + if (this.type=='monster' && by.type=='hero') + { + l('monsterSlot'+this.dungeon.id).style.visibility='hidden'; + this.dungeon.monstersKilledThisRun+=1; + if (Math.random()<0.05) Game.Heroes[by.subtype].Say('win'); + Game.Heroes[by.subtype].Say('win against '+Game.Monsters[this.subtype].name); + this.Say('defeat'); + if (Game.Monsters[this.subtype].loot) + { + var loot=Game.Monsters[this.subtype].loot; + if (loot.gear && (!loot.gear.prob || Math.random()0) this.stuck--; + this.stuck=Math.min(10,this.stuck); + this.targets=[]; + } + if ((this.type=='hero' || this.type=='monster') && this.fighting==0 && this.stats.hp0) + { + this.dungeon.Log('Found '+Beautify(value)+' cookie'+(value==1?'':'s')+'!'); + this.dungeon.cookiesMadeThisRun+=value; + Game.Earn(value); + } + entity.Destroy(); + } + } + } + if (this.type=='hero') this.fighting=0; + } + this.Destroy=function() + { + this.dungeon.entities.splice(this.dungeon.entities.indexOf(this),1); + } + this.GetInitiative=function() + { + return randomFloor((this.stats.speed/5)*(1/Math.max(1,(this.dungeon.heroEntity.stats.speed/5)))); + } + } + + /*===================================================================================== + DUNGEON MECHANICS + =======================================================================================*/ + + Game.Dungeons=[]; + Game.Dungeon=function(type,id) + { + this.type=type; + this.id=id; + Game.Dungeons[this.id]=this; + this.log=[]; + this.logNew=0; + this.name=Game.DungeonTypes[this.type].nameGenerator(); + this.hero=null; + this.currentOpponent=0; + this.level=0; + this.auto=1; + this.portalPic=''; + + this.cookiesMadeThisRun=0; + this.monstersKilledThisRun=0; + + this.Log=function(what,nested) + { + if (typeof what==='string') + { + this.log.unshift(what); + this.logNew++; + } + else {for (var i in what) {this.Log(what[i],1);}} + //if (!nested) this.UpdateLog(); + } + + this.UpdateLog=function() + { + this.log=this.log.slice(0,30); + var str=''; + for (var i in this.log) + { + if (i'; + else str+='
'+this.log[i]+'
'; + } + this.logNew=0; + l('dungeonLog'+this.id).innerHTML=str; + } + + this.entities=[]; + this.GetEntities=function(x,y)//returns the first entity found on tile x,y + { + var entities=[]; + for (var i in this.entities) {if (this.entities[i].x==x && this.entities[i].y==y) entities.push(this.entities[i]);} + return entities; + } + this.AddEntity=function(type,subtype,x,y) + { + //this.RemoveEntities(x,y); + var entity=new Game.Entity(type,subtype,this); + entity.x=x; + entity.y=y; + entity.dungeon=this; + this.entities.push(entity); + return entity; + } + this.RemoveEntities=function(x,y) + { + var entities=this.GetEntities(x,y); + for (var i in entities) + { + entities[i].Destroy(); + } + } + this.DrawEntities=function() + { + var str=''; + for (var i in this.entities) {str+=this.entities[i].Draw();} + return str; + } + + this.CheckObstacle=function(x,y)//returns 0 for no obstacle; -1 for a wall; an entity if there's at least one entity on this tile + { + if (x<0 || x>=this.map.w || y<0 || y>=this.map.h) return -1; + var entities=this.GetEntities(x,y); + for (var i in entities) + { + if (entities[i].obstacle) return entities[i]; + } + return this.map.isObstacle(x,y)?-1:0; + } + + + this.map={}; + this.Generate=function() + { + if (this.level==0) this.name=Game.DungeonTypes[this.type].nameGenerator(); + this.entities=[]; + var M=new D.Map(40,40,Math.random(),{ + roomSize:10, + corridorSize:5, + fillRatio:1/2, + corridorRatio:0.3, + pillarRatio:Math.random()*0.8+0.2, + waterRatio:Math.random(), + branching:Math.ceil(Math.random()*6), + sizeVariance:0.4 + }); + r=0; + while (r!=1) + { + r=M.dig(); + } + //all done! decorate and render. + M.finish(); + //spawn treasure + /* + for (var i in M.rooms) + { + if (M.rooms[i].freeTiles>1) + { + for (var ii=0;ii1) + { + var spot=M.getBestSpotInRoom(M.rooms[i]); + M.data[spot.x][spot.y][0]=0; + spot.score=0; + M.rooms[i].freeTiles--; + } + } + } + }*/ + + for (var i in M.doors)//place door entities on door positions + { + //M.data[M.doors[i][0]][M.doors[i][1]][0]=TILE_FLOOR_EDGE; + this.AddEntity('destructible','door',M.doors[i][0],M.doors[i][1]); + } + //set tile graphics + for (var i in M.rooms) + { + var altStr=choose(['alt ','','']); + var tiles={ + 'void':altStr+'void', + 'wall':altStr+'wall', + 'wall corner':altStr+'wall corner', + 'floor':altStr+'tiled floor', + 'floor edges':altStr+'floor',//choose([altStr+'floor',altStr+'floor edges']), + 'door':altStr+'door', + 'water':choose(['water','green water','dark water']), + 'pillar':choose([altStr+'wall',altStr+'round pillar',altStr+'square pillar',altStr+'potted plant','conveyor belt']), + 'entrance':altStr+'entrance', + 'exit':altStr+'exit', + }; + if (Math.random()<0.1) {tiles['wall corner']='wooden wall';tiles['wall']='wooden wall';tiles['floor edges']='wooden floor';tiles['pillar']='wooden wall';} + if (Math.random()<0.1) {tiles['wall corner']=altStr+'bookshelf';tiles['wall']=altStr+'bookshelf';tiles['pillar']=altStr+'bookshelf';} + M.assignTiles(M.rooms[i],tiles); + } + this.map=M; + this.map.str=this.map.getStr(); + + //place a boss + var tile=this.map.exit; + var monsters=[]; + for (var ii in Game.BossMonsters) + { + var me=Game.BossMonsters[ii]; + if (me.level<=(depth+this.level) && Math.random()<(me.stats.rarity||1)) monsters.push(me.name); + } + if (monsters.length==0) monsters=[choose(Game.BossMonsters).name]; + if (monsters.length>0) + { + this.AddEntity('monster',choose(monsters),tile[0],tile[1]); + this.map.removeFreeTile(tile[0],tile[1]); + } + + //place relics + /* + var tile=this.map.getBestSpotInRoom(this.map.getRoom(this.map.exit[0],this.map.exit[1])); + var entity=this.AddEntity('special','upgrade',tile.x,tile.y); + entity.value='Dungeon cookie upgrade'; + this.map.removeFreeTile(tile.x,tile.y); + for (var i=0;i10) + { + var tile=this.map.getBestSpotInRoom(room); + var entity=this.AddEntity('special','upgrade',tile.x,tile.y); + entity.value='Dungeon cookie upgrade'; + this.map.removeFreeTile(tile.x,tile.y); + } + }*/ + + //sprinkle monsters and treasure + for (var i=0;i0) + { + this.AddEntity('monster',choose(monsters),tile[0],tile[1]); + this.map.removeFreeTile(tile[0],tile[1]); + } + } + else//the rest of the spawns are destructibles or loot + { + if (Math.random()<0.6) + { + var value=Math.round(Math.pow(Math.random(),6)*(10+this.level)); + if (value>0) + { + var entity=this.AddEntity('item','cookies',tile[0],tile[1]);//random cookies + entity.value=value; + } + } + else this.AddEntity('destructible','random',tile[0],tile[1]);//random crates etc + this.map.removeFreeTile(tile[0],tile[1]); + } + } + } + } + + this.onTile=-1; + + this.Draw=function() + { + var str=''; + var x=-this.hero.x; + var y=-this.hero.y; + str+='
'+this.map.str+'
'; + str+='
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'; + str+='
'+ + '
Exit - '+this.name+' lvl.'+(this.level+1)+'
'+ + '
'+ + '
'+ + '
'+ + '
'; + l('rowSpecial'+this.id).innerHTML='
'+str+'
'; + + l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.portrait+'.png)'; + l('nameHero'+this.id).innerHTML=this.hero.name; + } + this.Refresh=function() + { + if (!l('mapcontainer'+this.id)) this.Draw(); + var x=4-this.hero.x; + var y=4-this.hero.y; + l('mapcontainer'+this.id).style.left=(x*16)+'px'; + l('mapcontainer'+this.id).style.top=(y*16)+'px'; + l('mapitems'+this.id).innerHTML=this.DrawEntities(); + } + this.RedrawMap=function() + { + this.map.str=this.map.getStr(); + this.Draw(); + } + this.Turn=function() + { + for (var i in this.entities) + { + if (this.entities[i] && this.entities[i].type) this.entities[i].Turn(); + } + if (this.currentOpponent) + { + l('monsterSlot'+this.id).style.visibility='visible'; + l('hpMonster'+this.id).style.width=Math.round((this.currentOpponent.stats.hp/this.currentOpponent.stats.hpm)*100)+'%'; + l('picMonster'+this.id).style.backgroundImage='url(img/'+Game.Monsters[this.currentOpponent.subtype].pic+'.png)'; + l('nameMonster'+this.id).innerHTML=Game.Monsters[this.currentOpponent.subtype].name; + l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.pic+'.png)'; + } + else + { + l('monsterSlot'+this.id).style.visibility='hidden'; + l('hpMonster'+this.id).style.width='100%'; + l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.portrait+'.png)'; + } + this.currentOpponent=0; + l('hpHero'+this.id).style.width=Math.round((this.heroEntity.stats.hp/this.heroEntity.stats.hpm)*100)+'%'; + + this.Refresh(); + this.UpdateLog(); + + if (this.hero.x==this.map.exit[0] && this.hero.y==this.map.exit[1]) + { + this.CompleteLevel(); + } + } + + this.DrawButton=function() + { + var str=''; + //str+=''; + str+=''; + return str; + } + + this.CompleteLevel=function() + { + this.hero.Say('completion'); + this.level++; + this.Generate(); + Game.HeroesById[0].EnterDungeon(this,this.map.entrance[0],this.map.entrance[1]); + this.Draw(); + } + this.FailLevel=function() + { + this.Log('Cookies made this run : '+Beautify(this.cookiesMadeThisRun)+' | Monsters defeated this run : '+Beautify(this.monstersKilledThisRun)); + this.cookiesMadeThisRun=0; + this.monstersKilledThisRun=0; + this.level=0; + this.Generate(); + Game.HeroesById[0].EnterDungeon(this,this.map.entrance[0],this.map.entrance[1]); + this.Draw(); + } + } + + Game.DungeonLocationChain=function(map,x,y)//return an array of the rooms between the root room and this tile's room, inclusive + {//we shouldn't need all this if we used A*... + var room=map.getRoom(x,y); + var chain=[]; + if (room!=-1) + { + while (room.parent) + { + chain.push(room); + room=room.parent; + } + } + chain.reverse(); + return chain; + } + Game.DungeonLinkLocationChains=function(start,end)//return the room in which the first location chain should go to to get closer to the second location chain + { + /* + 4 cases + -we're already in the same room + -the target is in a different branch + -the target is above in the same branch + -the target is below in the same branch + */ + start.reverse(); + end.reverse(); + if (start[0].id==end[0].id) return start[start.length-1];//same room + for (var i in end) + { + if (start[0]==end[i].parent) return end[i];//inferior branch, go to the inferior room + } + if (start.length>1) return start[1];//different or superior branch, go to the superior room + return start[0];//eeeh, let's just stay in the same room + } + + /*===================================================================================== + CREATE DUNGEONS + =======================================================================================*/ + Game.Objects['Factory'].special=function() + { + this.dungeon=new Game.Dungeon('Factory',this.id); + this.dungeon.Generate(); + this.specialDrawFunction=function(){this.dungeon.Refresh();}; + this.drawSpecialButton=function(){return this.dungeon.DrawButton();}; + this.dungeon.timer=0; + this.dungeon.timerWarmup=5; + this.dungeon.portalPic='dungeonFactory'; + + this.EachFrame=function() + { + if (this.dungeon.auto) + { + if (this.dungeon.timer>0) this.dungeon.timer--; + if (this.dungeon.timer==0) + { + this.dungeon.timer=Game.fps*(Math.max(0.1,2-(this.dungeon.hero.stats.speed*0.2))+Math.max(this.dungeon.timerWarmup,0)); + if (this.dungeon.timerWarmup>0) this.dungeon.timerWarmup--; + + var dungeon=this.dungeon; + var hero=dungeon.heroEntity; + + var targetRoom=Game.DungeonLinkLocationChains(Game.DungeonLocationChain(dungeon.map,hero.x,hero.y),Game.DungeonLocationChain(dungeon.map,dungeon.map.exit[0],dungeon.map.exit[1])); + var targetTile=(targetRoom.gen==0 || targetRoom.id==dungeon.map.getRoom(hero.x,hero.y).id)?[dungeon.map.exit[0],dungeon.map.exit[1]]:targetRoom.door; + hero.GoTo(targetTile[0],targetTile[1]); + if (hero.stuck) hero.Wander(); + dungeon.hero.x=hero.x; + dungeon.hero.y=hero.y; + dungeon.Turn(); + } + } + } + + if (document.addEventListener)//clean this up later + { + l('rowSpecial'+this.dungeon.id).removeEventListener('keydown',arguments.callee,false); + l('rowSpecial'+this.dungeon.id).addEventListener('keydown',function(event) + { + var dungeon=Game.Objects['Factory'].dungeon; + var control=0; + if (event.keyCode==37) {dungeon.hero.Move(-1,0);control=1;} + else if (event.keyCode==38) {dungeon.hero.Move(0,-1);control=1;} + else if (event.keyCode==39) {dungeon.hero.Move(1,0);control=1;} + else if (event.keyCode==40) {dungeon.hero.Move(0,1);control=1;} + else if (event.keyCode==32) {dungeon.hero.Move(0,0);control=1;}//space + else if (event.keyCode==65)//A (auto) + { + if (dungeon.auto) + { + dungeon.auto=0; + dungeon.timerWarmup=-1; + } + else + { + dungeon.auto=1; + dungeon.timer=0; + dungeon.timerWarmup=0; + } + event.preventDefault(); + } + + if (control) + { + event.preventDefault(); + dungeon.timer=Game.fps*10; + dungeon.timerWarmup=5; + } + } + ); + } + + var hero=choose(Game.HeroesById); + hero.EnterDungeon(this.dungeon,this.dungeon.map.entrance[0],this.dungeon.map.entrance[1]); + } + + /*===================================================================================== + HEROES + =======================================================================================*/ + Game.Heroes=[]; + Game.HeroesById=[]; + Game.Hero=function(name,pic,portrait,icon) + { + this.name=name; + this.pic=pic; + this.portrait=portrait; + this.icon=icon; + this.stats={ + hp:25, + hpm:25, + might:5, + guard:5, + speed:5, + dodge:5, + luck:5 + }; + this.dialogue={ + 'greeting':'Oh hey.|Sup.', + 'entrance':'Here we go.|So exciting.', + 'completion':'That was easy.|All done here.', + 'defeat':'Welp.|Better luck next time.' + }; + this.gear={ + 'armor':-1, + 'weapon':-1 + }; + this.inDungeon=-1; + this.completedDungeons=0; + + this.x=0; + this.y=0; + + this.EnterDungeon=function(dungeon,x,y) + { + this.inDungeon=dungeon.id; + dungeon.hero=this; + this.x=x; + this.y=y; + dungeon.heroEntity=dungeon.AddEntity('hero',dungeon.hero.name,x,y); + var room=dungeon.map.getRoom(this.x,this.y); + if (room!=-1 && room.hidden) {room.hidden=0;dungeon.RedrawMap();} + Game.Dungeons[this.inDungeon].Refresh(); + dungeon.Log('--------------------'); + if (dungeon.level==0) this.Say('greeting'); + this.Say('entrance'); + l('monsterSlot'+dungeon.id).style.visibility='hidden'; + } + this.Move=function(x,y) + { + var dungeon=Game.Dungeons[this.inDungeon]; + dungeon.heroEntity.targets=[[x,y]]; + if (dungeon.heroEntity.Move()) + { + this.x=dungeon.heroEntity.x; + this.y=dungeon.heroEntity.y; + dungeon.Turn(); + } + } + + this.Say=function(what) + { + if (this.dialogue[what]) Game.Dungeons[this.inDungeon].Log(this.name+' : "'+choose(this.dialogue[what].split('|'))+'"'); + } + + this.save=function() + { + var str=''; + str+= + this.inDungeon+','+ + this.completedDungeons+','+ + this.gear.armor+','+ + this.gear.weapon + ; + return str; + } + this.load=function(data) + { + var str=data.split(','); + this.inDungeon=parseInt(str[0]); + this.completedDungeons=parseInt(str[1]); + this.gear.armor=parseInt(str[2]); + this.gear.weapon=parseInt(str[3]); + } + this.id=Game.HeroesById.length; + Game.HeroesById.push(this); + Game.Heroes[this.name]=this; + } + + /*===================================================================================== + CREATE HEROES + =======================================================================================*/ + var hero=new Game.Hero('Chip','girlscoutChip','portraitChip',[1,0]); + hero.dialogue={ + 'intro':'I\'m Chip! I just really like exploring stuff. Let\'s go have an adventure!', + 'greeting':'Hello there!|I\'m ready!|Where are we going today?|Adventure!', + 'win':'Take that!|Hah!|That\'s right.', + 'entrance':'Chipping in!|Welp, here goes nothing!|I wonder what I\'ll find!|Hey, this place is new!|This place seems familiar.|Let\'s make it happen.', + 'completion':'I\'m one smart cookie.|Oh yeah!|Let\'s explore some more!|That was easy!|That sure was fun!|I\'m not lost, am I?|More exploring? Sure, why not!', + 'defeat':'B-better luck next time.|That really hurt!|I yield! I yield!|That went badly.|No half-baked excuses next time.|I think I scraped my knee!|Owie.|Woopsie!', + 'win against Sentient Furnace':'The irony, it burns! (...it\'s funny because it was burning. And made of iron. ...Moving on.)', + 'win against Ascended Baking Pod':'Where is your pod now?|That was disturbing.' + }; + hero.stats={ + hp:30, + hpm:30, + might:5, + guard:5, + speed:5, + dodge:5, + luck:5 + }; + var hero=new Game.Hero('Crumb','girlscoutCrumb','portraitCrumb',[2,0]); + hero.dialogue={ + 'intro':'I\'m Crumb. I look like this because of a baking accident when I was little. Big deal. At least now I don\'t get hurt as easily as others, I guess.', + 'greeting':'Hi there.|Ready for adventure, I guess.|Reporting for duty.', + 'win':'Oh sorry, did that hurt?|Should have moved out of the way.|Oops. My bad.', + 'entrance':'Let\'s do this, I guess.|Well, let\'s go...|I gotta go in there?|Are we really doing this?|I hope I won\'t get lost like last time.|Let\'s get this over with.', + 'completion':'I... I did it...|I\'m glad that\'s over.|What, there\'s more?|In I go, I guess.|It doesn\'t end, does it?|But it\'s dark in there.', + 'defeat':'I, uh, ouch.|Why does that always happen to me?|I\'m just no good, am I?|Oh no.|I\'m... I\'m not crying.|Well that wasn\'t fun at all.|I\'m sorry I failed you.|Please... make them go away...', + 'meet Ascended Baking Pod':'That thing shouldn\'t even be alive.|Is that where they all came from?', + 'win against Ascended Baking Pod':'Hm. Fascinating.' + }; + hero.stats={ + hp:25, + hpm:25, + might:5, + guard:7, + speed:4, + dodge:4, + luck:5 + }; + var hero=new Game.Hero('Doe','girlscoutDoe','portraitDoe',[3,0]); + hero.dialogue={ + 'intro':'H-hey. Name\'s Doe. I\'m pretty fast. I uh, I promise I\'ll do my best.', + 'greeting':'H-hey.|Oh, uh, h-hi there.|C-can I join?', + 'win':'Th-that looks like it hurt... awesome...|D-did I do that?|N-neat... there\'s pieces everywhere.', + 'entrance':'Alright, let\'s do this!|I-if I really have to.|I-in there? By myself?|...won\'t you come with me this time?|H-here I go!', + 'completion':'Oh... oh my.|That\'s... I uh, I\'m glad.|Y-yeah that was real easy. Piece of pie!|T-too easy, right?|S-so many cookies...|Ooh? F-fascinating.', + 'defeat':'I-if you can\'t beat them... join them.|I-it\'s because I stutter, isn\'t it?|W-well that\'s just no good at all.|I, uh, I meant for that to happen.|H-how embarrassing.', + 'meet Ascended Baking Pod':'W-whoah... it\'s... magnificent...', + 'win against Ascended Baking Pod':'I\'m sorry, buddy.|I... I think I hurt it...|Oh no... I-I think I broke it...' + }; + hero.stats={ + hp:25, + hpm:25, + might:4, + guard:4, + speed:7, + dodge:5, + luck:5 + }; + var hero=new Game.Hero('Lucky','girlscoutLucky','portraitLucky',[4,0]); + hero.dialogue={ + 'intro':'Oh joy! My name\'s Lucky. Guess what I\'m good at?', + 'greeting':'I\'m feeling lucky!|It\'s a bright day today!|Let\'s do great things together.', + 'win':'Ooh lucky shot!|Pow! One more.|Damn straight!', + 'entrance':'Glad to be of service!|Oooh this one\'ll be interesting.|This will be a good one, I can feel it!|Here I come!', + 'completion':'Over already?|Let\'s explore some more!|That was lucky!|That was no luck, I\'m just that good.|Alright, let\'s move on!|I\'m just getting warmed up!', + 'defeat':'I can\'t believe it!|...This is a joke, right?|Hey! No fair!|B-but...|I\'m gonna need a bandaid. And some hot chocolate.|I\'ll, uh, try again later.|Bad luck! Bad luck!', + 'win against Ascended Baking Pod':'Golly, that was peculiar.' + }; + hero.stats={ + hp:25, + hpm:25, + might:5, + guard:4, + speed:4, + dodge:5, + luck:7 + }; + +}; \ No newline at end of file diff --git a/img/alarmTurret.png b/img/alarmTurret.png new file mode 100644 index 0000000..df85713 Binary files /dev/null and b/img/alarmTurret.png differ diff --git a/img/alchemylab.png b/img/alchemylab.png new file mode 100644 index 0000000..1d0ae00 Binary files /dev/null and b/img/alchemylab.png differ diff --git a/img/alchemylabBackground.png b/img/alchemylabBackground.png new file mode 100644 index 0000000..2cd0cce Binary files /dev/null and b/img/alchemylabBackground.png differ diff --git a/img/alchemylabIcon.png b/img/alchemylabIcon.png new file mode 100644 index 0000000..69285e3 Binary files /dev/null and b/img/alchemylabIcon.png differ diff --git a/img/alteredGrandma.png b/img/alteredGrandma.png new file mode 100644 index 0000000..938fe15 Binary files /dev/null and b/img/alteredGrandma.png differ diff --git a/img/angrySentientCookie.png b/img/angrySentientCookie.png new file mode 100644 index 0000000..4749729 Binary files /dev/null and b/img/angrySentientCookie.png differ diff --git a/img/antiGrandma.png b/img/antiGrandma.png new file mode 100644 index 0000000..0a40d2d Binary files /dev/null and b/img/antiGrandma.png differ diff --git a/img/antimattercondenser.png b/img/antimattercondenser.png new file mode 100644 index 0000000..50a8760 Binary files /dev/null and b/img/antimattercondenser.png differ diff --git a/img/antimattercondenserBackground.png b/img/antimattercondenserBackground.png new file mode 100644 index 0000000..ae90cb6 Binary files /dev/null and b/img/antimattercondenserBackground.png differ diff --git a/img/antimattercondenserIcon.png b/img/antimattercondenserIcon.png new file mode 100644 index 0000000..25cd7ab Binary files /dev/null and b/img/antimattercondenserIcon.png differ diff --git a/img/aqworldsbanner.jpg b/img/aqworldsbanner.jpg new file mode 100644 index 0000000..f115cd3 Binary files /dev/null and b/img/aqworldsbanner.jpg differ diff --git a/img/ascendedBakingPod.png b/img/ascendedBakingPod.png new file mode 100644 index 0000000..cd21dc5 Binary files /dev/null and b/img/ascendedBakingPod.png differ diff --git a/img/babySentientCookie.png b/img/babySentientCookie.png new file mode 100644 index 0000000..69acc2b Binary files /dev/null and b/img/babySentientCookie.png differ diff --git a/img/bgBlue.jpg b/img/bgBlue.jpg new file mode 100644 index 0000000..1a45fb8 Binary files /dev/null and b/img/bgBlue.jpg differ diff --git a/img/blackGradient.png b/img/blackGradient.png new file mode 100644 index 0000000..8cfab38 Binary files /dev/null and b/img/blackGradient.png differ diff --git a/img/burntSentientCookie.png b/img/burntSentientCookie.png new file mode 100644 index 0000000..49cd86c Binary files /dev/null and b/img/burntSentientCookie.png differ diff --git a/img/buttonTile.jpg b/img/buttonTile.jpg new file mode 100644 index 0000000..26f79c6 Binary files /dev/null and b/img/buttonTile.jpg differ diff --git a/img/caramelWave.png b/img/caramelWave.png new file mode 100644 index 0000000..91795b0 Binary files /dev/null and b/img/caramelWave.png differ diff --git a/img/chirpy.png b/img/chirpy.png new file mode 100644 index 0000000..886020c Binary files /dev/null and b/img/chirpy.png differ diff --git a/img/chocolateMilkWave.png b/img/chocolateMilkWave.png new file mode 100644 index 0000000..ec2fc5f Binary files /dev/null and b/img/chocolateMilkWave.png differ diff --git a/img/control.png b/img/control.png new file mode 100644 index 0000000..6a18fe7 Binary files /dev/null and b/img/control.png differ diff --git a/img/cookieShower1.png b/img/cookieShower1.png new file mode 100644 index 0000000..dcd2c66 Binary files /dev/null and b/img/cookieShower1.png differ diff --git a/img/cookieShower2.png b/img/cookieShower2.png new file mode 100644 index 0000000..44e6f8a Binary files /dev/null and b/img/cookieShower2.png differ diff --git a/img/cookieShower3.png b/img/cookieShower3.png new file mode 100644 index 0000000..d44ee42 Binary files /dev/null and b/img/cookieShower3.png differ diff --git a/img/cosmicGrandma.png b/img/cosmicGrandma.png new file mode 100644 index 0000000..8c06dc4 Binary files /dev/null and b/img/cosmicGrandma.png differ diff --git a/img/crazedDoughSpurter.png b/img/crazedDoughSpurter.png new file mode 100644 index 0000000..ac0fb2c Binary files /dev/null and b/img/crazedDoughSpurter.png differ diff --git a/img/crazedKneader.png b/img/crazedKneader.png new file mode 100644 index 0000000..e3f39db Binary files /dev/null and b/img/crazedKneader.png differ diff --git a/img/cursor.png b/img/cursor.png new file mode 100644 index 0000000..5352c09 Binary files /dev/null and b/img/cursor.png differ diff --git a/img/cursoricon.png b/img/cursoricon.png new file mode 100644 index 0000000..bd957dd Binary files /dev/null and b/img/cursoricon.png differ diff --git a/img/darkNoise.png b/img/darkNoise.png new file mode 100644 index 0000000..a8821f7 Binary files /dev/null and b/img/darkNoise.png differ diff --git a/img/disgruntledCleaningLady.png b/img/disgruntledCleaningLady.png new file mode 100644 index 0000000..df8822d Binary files /dev/null and b/img/disgruntledCleaningLady.png differ diff --git a/img/disgruntledOverseer.png b/img/disgruntledOverseer.png new file mode 100644 index 0000000..be77ab5 Binary files /dev/null and b/img/disgruntledOverseer.png differ diff --git a/img/disgruntledWorker.png b/img/disgruntledWorker.png new file mode 100644 index 0000000..6694ba2 Binary files /dev/null and b/img/disgruntledWorker.png differ diff --git a/img/doughling.png b/img/doughling.png new file mode 100644 index 0000000..e659bb9 Binary files /dev/null and b/img/doughling.png differ diff --git a/img/dungeonFactory.png b/img/dungeonFactory.png new file mode 100644 index 0000000..54d97a7 Binary files /dev/null and b/img/dungeonFactory.png differ diff --git a/img/dungeonIcons.png b/img/dungeonIcons.png new file mode 100644 index 0000000..88e8d12 Binary files /dev/null and b/img/dungeonIcons.png differ diff --git a/img/dungeonOverlay.png b/img/dungeonOverlay.png new file mode 100644 index 0000000..9a9eefb Binary files /dev/null and b/img/dungeonOverlay.png differ diff --git a/img/dungeonTiles.png b/img/dungeonTiles.png new file mode 100644 index 0000000..1d30692 Binary files /dev/null and b/img/dungeonTiles.png differ diff --git a/img/elderDoughling.png b/img/elderDoughling.png new file mode 100644 index 0000000..8d53bed Binary files /dev/null and b/img/elderDoughling.png differ diff --git a/img/elfGrandma.png b/img/elfGrandma.png new file mode 100644 index 0000000..75edd6a Binary files /dev/null and b/img/elfGrandma.png differ diff --git a/img/empty.png b/img/empty.png new file mode 100644 index 0000000..c2da5b8 Binary files /dev/null and b/img/empty.png differ diff --git a/img/factory.png b/img/factory.png new file mode 100644 index 0000000..3cdd950 Binary files /dev/null and b/img/factory.png differ diff --git a/img/factoryBackground.png b/img/factoryBackground.png new file mode 100644 index 0000000..e96ea55 Binary files /dev/null and b/img/factoryBackground.png differ diff --git a/img/factoryIcon.png b/img/factoryIcon.png new file mode 100644 index 0000000..c8b748a Binary files /dev/null and b/img/factoryIcon.png differ diff --git a/img/farm.png b/img/farm.png new file mode 100644 index 0000000..4580556 Binary files /dev/null and b/img/farm.png differ diff --git a/img/farmBackground.png b/img/farmBackground.png new file mode 100644 index 0000000..fe6acf9 Binary files /dev/null and b/img/farmBackground.png differ diff --git a/img/farmIcon.png b/img/farmIcon.png new file mode 100644 index 0000000..36cbf3e Binary files /dev/null and b/img/farmIcon.png differ diff --git a/img/farmerGrandma.png b/img/farmerGrandma.png new file mode 100644 index 0000000..abde9b8 Binary files /dev/null and b/img/farmerGrandma.png differ diff --git a/img/favicon.ico b/img/favicon.ico new file mode 100644 index 0000000..3846c2c Binary files /dev/null and b/img/favicon.ico differ diff --git a/img/frostedReindeer.png b/img/frostedReindeer.png new file mode 100644 index 0000000..0795ec6 Binary files /dev/null and b/img/frostedReindeer.png differ diff --git a/img/girlscoutChip.png b/img/girlscoutChip.png new file mode 100644 index 0000000..46ab993 Binary files /dev/null and b/img/girlscoutChip.png differ diff --git a/img/girlscoutCrumb.png b/img/girlscoutCrumb.png new file mode 100644 index 0000000..4189911 Binary files /dev/null and b/img/girlscoutCrumb.png differ diff --git a/img/girlscoutDoe.png b/img/girlscoutDoe.png new file mode 100644 index 0000000..448b87e Binary files /dev/null and b/img/girlscoutDoe.png differ diff --git a/img/girlscoutLucky.png b/img/girlscoutLucky.png new file mode 100644 index 0000000..d840a14 Binary files /dev/null and b/img/girlscoutLucky.png differ diff --git a/img/goldCookie.png b/img/goldCookie.png new file mode 100644 index 0000000..e1fc379 Binary files /dev/null and b/img/goldCookie.png differ diff --git a/img/grandma.png b/img/grandma.png new file mode 100644 index 0000000..872a44b Binary files /dev/null and b/img/grandma.png differ diff --git a/img/grandmaBackground.png b/img/grandmaBackground.png new file mode 100644 index 0000000..dba0b3d Binary files /dev/null and b/img/grandmaBackground.png differ diff --git a/img/grandmaIcon.png b/img/grandmaIcon.png new file mode 100644 index 0000000..7d9f587 Binary files /dev/null and b/img/grandmaIcon.png differ diff --git a/img/grandmaIconB.png b/img/grandmaIconB.png new file mode 100644 index 0000000..7e0323a Binary files /dev/null and b/img/grandmaIconB.png differ diff --git a/img/grandmaIconC.png b/img/grandmaIconC.png new file mode 100644 index 0000000..fb3e687 Binary files /dev/null and b/img/grandmaIconC.png differ diff --git a/img/grandmaIconD.png b/img/grandmaIconD.png new file mode 100644 index 0000000..fb2e6fd Binary files /dev/null and b/img/grandmaIconD.png differ diff --git a/img/grandmas1.jpg b/img/grandmas1.jpg new file mode 100644 index 0000000..581553d Binary files /dev/null and b/img/grandmas1.jpg differ diff --git a/img/grandmas2.jpg b/img/grandmas2.jpg new file mode 100644 index 0000000..efbed26 Binary files /dev/null and b/img/grandmas2.jpg differ diff --git a/img/grandmas3.jpg b/img/grandmas3.jpg new file mode 100644 index 0000000..676b336 Binary files /dev/null and b/img/grandmas3.jpg differ diff --git a/img/grandmasGrandma.png b/img/grandmasGrandma.png new file mode 100644 index 0000000..7781ad2 Binary files /dev/null and b/img/grandmasGrandma.png differ diff --git a/img/hpBar.png b/img/hpBar.png new file mode 100644 index 0000000..09653ed Binary files /dev/null and b/img/hpBar.png differ diff --git a/img/hpmBar.png b/img/hpmBar.png new file mode 100644 index 0000000..300a291 Binary files /dev/null and b/img/hpmBar.png differ diff --git a/img/icons.png b/img/icons.png new file mode 100644 index 0000000..a400a36 Binary files /dev/null and b/img/icons.png differ diff --git a/img/imperfectCookie.png b/img/imperfectCookie.png new file mode 100644 index 0000000..afa7bc0 Binary files /dev/null and b/img/imperfectCookie.png differ diff --git a/img/infoBG.png b/img/infoBG.png new file mode 100644 index 0000000..eff05e6 Binary files /dev/null and b/img/infoBG.png differ diff --git a/img/infoBGfade.png b/img/infoBGfade.png new file mode 100644 index 0000000..23cb233 Binary files /dev/null and b/img/infoBGfade.png differ diff --git a/img/list.txt b/img/list.txt new file mode 100644 index 0000000..d105b90 --- /dev/null +++ b/img/list.txt @@ -0,0 +1,124 @@ +alarmTurret.png +alchemylab.png +alchemylabBackground.png +alchemylabIcon.png +alteredGrandma.png +angrySentientCookie.png +antiGrandma.png +antimattercondenser.png +antimattercondenserBackground.png +antimattercondenserIcon.png +aqworldsbanner.jpg +ascendedBakingPod.png +babySentientCookie.png +bgBlue.jpg +blackGradient.png +burntSentientCookie.png +buttonTile.jpg +caramelMilk.png +caramelWave.png +chirpy.png +chocolateMilkWave.png +control.png +cookieShower1.png +cookieShower2.png +cookieShower3.png +cosmicGrandma.png +crazedDoughSpurter.png +crazedKneader.png +cursor.png +cursoricon.png +darkNoise.png +disgruntledCleaningLady.png +disgruntledOverseer.png +disgruntledWorker.png +doughling.png +dungeonFactory.png +dungeonIcons.png +dungeonOverlay.png +dungeonTiles.png +elderDoughling.png +elfGrandma.png +empty.png +factory.png +factoryBackground.png +factoryIcon.png +farm.png +farmBackground.png +farmIcon.png +farmerGrandma.png +favicon.ico +frostedReindeer.png +girlscoutChip.png +girlscoutCrumb.png +girlscoutDoe.png +girlscoutLucky.png +goldCookie.png +grandma.png +grandmaBackground.png +grandmaIcon.png +grandmaIconB.png +grandmaIconC.png +grandmaIconD.png +grandmas1.jpg +grandmas2.jpg +grandmas3.jpg +grandmasGrandma.png +hpBar.png +hpmBar.png +icons.png +imperfectCookie.png +infoBG.png +infoBGfade.png +mapBG.jpg +mapIcons.png +mapTiles.png +marshmallows.png +milk.png +milkWave.png +mine.png +mineBackground.png +mineIcon.png +minerGrandma.png +money.png +mysteriousHero.png +mysteriousOpponent.png +orangeWave.png +panelHorizontal.png +panelVertical.png +perfectCookie.png +portal.png +portalBackground.png +portalIcon.png +portraitChip.png +portraitCrumb.png +portraitDoe.png +portraitLucky.png +raspberryWave.png +rawSentientCookie.png +santa.png +sentientFurnace.png +shadedBorders.png +shadedBordersGold.png +shadedBordersRed.png +shine.png +shipment.png +shipmentBackground.png +shipmentIcon.png +smallCookies.png +snow.jpg +snow2.jpg +spookyCookie.png +storeTile.jpg +sugarBunny.png +timemachine.png +timemachineBackground.png +timemachineIcon.png +transmutedGrandma.png +upgradeFrame.png +winterFrame.png +winterWrinkler.png +workerGrandma.png +wrathCookie.png +wrinkler.png +wrinklerBits.png diff --git a/img/mapBG.jpg b/img/mapBG.jpg new file mode 100644 index 0000000..c7728a3 Binary files /dev/null and b/img/mapBG.jpg differ diff --git a/img/mapIcons.png b/img/mapIcons.png new file mode 100644 index 0000000..ac909e7 Binary files /dev/null and b/img/mapIcons.png differ diff --git a/img/mapTiles.png b/img/mapTiles.png new file mode 100644 index 0000000..3971ce0 Binary files /dev/null and b/img/mapTiles.png differ diff --git a/img/marshmallows.png b/img/marshmallows.png new file mode 100644 index 0000000..789771f Binary files /dev/null and b/img/marshmallows.png differ diff --git a/img/milk.png b/img/milk.png new file mode 100644 index 0000000..d3af479 Binary files /dev/null and b/img/milk.png differ diff --git a/img/milkWave.png b/img/milkWave.png new file mode 100644 index 0000000..5ac25ce Binary files /dev/null and b/img/milkWave.png differ diff --git a/img/mine.png b/img/mine.png new file mode 100644 index 0000000..372ea7e Binary files /dev/null and b/img/mine.png differ diff --git a/img/mineBackground.png b/img/mineBackground.png new file mode 100644 index 0000000..7986c4c Binary files /dev/null and b/img/mineBackground.png differ diff --git a/img/mineIcon.png b/img/mineIcon.png new file mode 100644 index 0000000..f63a6df Binary files /dev/null and b/img/mineIcon.png differ diff --git a/img/minerGrandma.png b/img/minerGrandma.png new file mode 100644 index 0000000..a58d9b9 Binary files /dev/null and b/img/minerGrandma.png differ diff --git a/img/money.png b/img/money.png new file mode 100644 index 0000000..5908aa7 Binary files /dev/null and b/img/money.png differ diff --git a/img/mysteriousHero.png b/img/mysteriousHero.png new file mode 100644 index 0000000..ecd5873 Binary files /dev/null and b/img/mysteriousHero.png differ diff --git a/img/mysteriousOpponent.png b/img/mysteriousOpponent.png new file mode 100644 index 0000000..52cadb5 Binary files /dev/null and b/img/mysteriousOpponent.png differ diff --git a/img/orangeWave.png b/img/orangeWave.png new file mode 100644 index 0000000..cc3ba49 Binary files /dev/null and b/img/orangeWave.png differ diff --git a/img/panelHorizontal.png b/img/panelHorizontal.png new file mode 100644 index 0000000..7881c6a Binary files /dev/null and b/img/panelHorizontal.png differ diff --git a/img/panelVertical.png b/img/panelVertical.png new file mode 100644 index 0000000..4c5d914 Binary files /dev/null and b/img/panelVertical.png differ diff --git a/img/perfectCookie.png b/img/perfectCookie.png new file mode 100644 index 0000000..bc6282c Binary files /dev/null and b/img/perfectCookie.png differ diff --git a/img/portal.png b/img/portal.png new file mode 100644 index 0000000..0dd3ca5 Binary files /dev/null and b/img/portal.png differ diff --git a/img/portalBackground.png b/img/portalBackground.png new file mode 100644 index 0000000..441de2a Binary files /dev/null and b/img/portalBackground.png differ diff --git a/img/portalIcon.png b/img/portalIcon.png new file mode 100644 index 0000000..224159d Binary files /dev/null and b/img/portalIcon.png differ diff --git a/img/portraitChip.png b/img/portraitChip.png new file mode 100644 index 0000000..ca0263f Binary files /dev/null and b/img/portraitChip.png differ diff --git a/img/portraitCrumb.png b/img/portraitCrumb.png new file mode 100644 index 0000000..5bb54ef Binary files /dev/null and b/img/portraitCrumb.png differ diff --git a/img/portraitDoe.png b/img/portraitDoe.png new file mode 100644 index 0000000..a6c62f3 Binary files /dev/null and b/img/portraitDoe.png differ diff --git a/img/portraitLucky.png b/img/portraitLucky.png new file mode 100644 index 0000000..34e33bf Binary files /dev/null and b/img/portraitLucky.png differ diff --git a/img/raspberryWave.png b/img/raspberryWave.png new file mode 100644 index 0000000..0893d35 Binary files /dev/null and b/img/raspberryWave.png differ diff --git a/img/rawSentientCookie.png b/img/rawSentientCookie.png new file mode 100644 index 0000000..448b909 Binary files /dev/null and b/img/rawSentientCookie.png differ diff --git a/img/santa.png b/img/santa.png new file mode 100644 index 0000000..69c9832 Binary files /dev/null and b/img/santa.png differ diff --git a/img/sentientFurnace.png b/img/sentientFurnace.png new file mode 100644 index 0000000..e0e361a Binary files /dev/null and b/img/sentientFurnace.png differ diff --git a/img/shadedBorders.png b/img/shadedBorders.png new file mode 100644 index 0000000..3ed6dcf Binary files /dev/null and b/img/shadedBorders.png differ diff --git a/img/shadedBordersGold.png b/img/shadedBordersGold.png new file mode 100644 index 0000000..7a8c198 Binary files /dev/null and b/img/shadedBordersGold.png differ diff --git a/img/shadedBordersRed.png b/img/shadedBordersRed.png new file mode 100644 index 0000000..bc9cab2 Binary files /dev/null and b/img/shadedBordersRed.png differ diff --git a/img/shine.png b/img/shine.png new file mode 100644 index 0000000..f48e14a Binary files /dev/null and b/img/shine.png differ diff --git a/img/shipment.png b/img/shipment.png new file mode 100644 index 0000000..89f7f6d Binary files /dev/null and b/img/shipment.png differ diff --git a/img/shipmentBackground.png b/img/shipmentBackground.png new file mode 100644 index 0000000..210c66a Binary files /dev/null and b/img/shipmentBackground.png differ diff --git a/img/shipmentIcon.png b/img/shipmentIcon.png new file mode 100644 index 0000000..f8fbb88 Binary files /dev/null and b/img/shipmentIcon.png differ diff --git a/img/smallCookies.png b/img/smallCookies.png new file mode 100644 index 0000000..9ecee5a Binary files /dev/null and b/img/smallCookies.png differ diff --git a/img/snow.jpg b/img/snow.jpg new file mode 100644 index 0000000..230b4fc Binary files /dev/null and b/img/snow.jpg differ diff --git a/img/snow2.jpg b/img/snow2.jpg new file mode 100644 index 0000000..ce09231 Binary files /dev/null and b/img/snow2.jpg differ diff --git a/img/spookyCookie.png b/img/spookyCookie.png new file mode 100644 index 0000000..3aeeeda Binary files /dev/null and b/img/spookyCookie.png differ diff --git a/img/storeTile.jpg b/img/storeTile.jpg new file mode 100644 index 0000000..3c10245 Binary files /dev/null and b/img/storeTile.jpg differ diff --git a/img/sugarBunny.png b/img/sugarBunny.png new file mode 100644 index 0000000..b55754c Binary files /dev/null and b/img/sugarBunny.png differ diff --git a/img/timemachine.png b/img/timemachine.png new file mode 100644 index 0000000..07bf344 Binary files /dev/null and b/img/timemachine.png differ diff --git a/img/timemachineBackground.png b/img/timemachineBackground.png new file mode 100644 index 0000000..01b50a2 Binary files /dev/null and b/img/timemachineBackground.png differ diff --git a/img/timemachineIcon.png b/img/timemachineIcon.png new file mode 100644 index 0000000..9017b4f Binary files /dev/null and b/img/timemachineIcon.png differ diff --git a/img/transmutedGrandma.png b/img/transmutedGrandma.png new file mode 100644 index 0000000..07755af Binary files /dev/null and b/img/transmutedGrandma.png differ diff --git a/img/upgradeFrame.png b/img/upgradeFrame.png new file mode 100644 index 0000000..19d3d64 Binary files /dev/null and b/img/upgradeFrame.png differ diff --git a/img/winterFrame.png b/img/winterFrame.png new file mode 100644 index 0000000..bf9f9cd Binary files /dev/null and b/img/winterFrame.png differ diff --git a/img/winterWrinkler.png b/img/winterWrinkler.png new file mode 100644 index 0000000..4abadae Binary files /dev/null and b/img/winterWrinkler.png differ diff --git a/img/workerGrandma.png b/img/workerGrandma.png new file mode 100644 index 0000000..fac73e1 Binary files /dev/null and b/img/workerGrandma.png differ diff --git a/img/wrathCookie.png b/img/wrathCookie.png new file mode 100644 index 0000000..f3599a1 Binary files /dev/null and b/img/wrathCookie.png differ diff --git a/img/wrinkler.png b/img/wrinkler.png new file mode 100644 index 0000000..39d1f0f Binary files /dev/null and b/img/wrinkler.png differ diff --git a/img/wrinklerBits.png b/img/wrinklerBits.png new file mode 100644 index 0000000..85c8315 Binary files /dev/null and b/img/wrinklerBits.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..ed132bd --- /dev/null +++ b/index.html @@ -0,0 +1,164 @@ + + + +Cookie Clicker + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ Cookie Clicker © Orteil, 2013 - hosted by DashNet | twitter | tumblr | Help? Bugs? Ideas? Check out the forum! | Chat with us on IRC | Get your Cookie Clicker shirts, stickers and hoodies! + +
+
+ +
+
+
+
Oops, looks like the game isn't loading right!
+
Please make sure your javascript is enabled, then refresh.
+ This could also be caused by a problem on our side, in which case - wait a moment, then refresh!
+
+
+ + + +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
Menu
+
Stats
+
Updates
+
+
+
+
Buildings
+
+ +
+ +
+
+
Store
+
+
+
+
+
+ + +
+
Sponsored links
+ + + + + + + + +
+
+ +
+
Cookie
+
Buildings
+
Store
+
Menu
+
+
+
+
+
+
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..9a6f888 --- /dev/null +++ b/main.js @@ -0,0 +1,4665 @@ +/* +All this code is copyright Orteil, 2013. + -with some help, advice and fixes by Debugbro and Opti + -also includes a bunch of snippets found on stackoverflow.com +Spoilers ahead. +http://orteil.dashnet.org +*/ + +/*===================================================================================== +MISC HELPER FUNCTIONS +=======================================================================================*/ +function l(what) {return document.getElementById(what);} +function choose(arr) {return arr[Math.floor(Math.random()*arr.length)];} + +//disable sounds coming from soundjay.com (sorry, +realAudio=Audio;//backup real audio +Audio=function(src){ + if (src.indexOf('soundjay')>-1) {Game.Popup('Sorry, no sounds hotlinked from soundjay.com.');this.play=function(){};} + else return realAudio(src); +}; + +if(!Array.prototype.indexOf) { + Array.prototype.indexOf = function(needle) { + for(var i = 0; i < this.length; i++) { + if(this[i] === needle) { + return i; + } + } + return -1; + }; +} + +function randomFloor(x) {if ((x%1)0) + { + var floater=what-Math.floor(what); + floater=Math.round(floater*10000000)/10000000;//get rid of weird rounding errors + var floatPresent=floater?1:0; + floater=(floater.toString()+'0000000').slice(2,2+floats);//yes this is hacky (but it works) + if (parseInt(floater)===0) floatPresent=0; + str=Beautify(Math.floor(what))+(floatPresent?('.'+floater):''); + } + else + { + what=Math.floor(what); + what=(what+'').split('').reverse(); + for (var i in what) + { + if (i%3==0 && i>0) str=','+str; + str=what[i]+str; + } + } + return str; +} + + +function utf8_to_b64( str ) { + try{ + return Base64.encode(unescape(encodeURIComponent( str ))); + //return window.btoa(unescape(encodeURIComponent( str ))); + } + catch(err) + { + //Game.Popup('There was a problem while encrypting to base64.
('+err+')'); + return ''; + } +} + +function b64_to_utf8( str ) { + try{ + return decodeURIComponent(escape(Base64.decode( str ))); + //return decodeURIComponent(escape(window.atob( str ))); + } + catch(err) + { + //Game.Popup('There was a problem while decrypting from base64.
('+err+')'); + return ''; + } +} + + +function CompressBin(arr)//compress a sequence like [0,1,1,0,1,0]... into a number like 54. +{ + var str=''; + var arr2=arr.slice(0); + arr2.unshift(1); + arr2.push(1); + arr2.reverse(); + for (var i in arr2) + { + str+=arr2[i]; + } + str=parseInt(str,2); + return str; +} + +function UncompressBin(num)//uncompress a number like 54 to a sequence like [0,1,1,0,1,0]. +{ + var arr=num.toString(2); + arr=arr.split(''); + arr.reverse(); + arr.shift(); + arr.pop(); + return arr; +} + +function CompressLargeBin(arr)//we have to compress in smaller chunks to avoid getting into scientific notation +{ + var arr2=arr.slice(0); + var thisBit=[]; + var bits=[]; + for (var i in arr2) + { + thisBit.push(arr2[i]); + if (thisBit.length>=50) + { + bits.push(CompressBin(thisBit)); + thisBit=[]; + } + } + if (thisBit.length>0) bits.push(CompressBin(thisBit)); + arr2=bits.join(';'); + return arr2; +} + +function UncompressLargeBin(arr) +{ + var arr2=arr.split(';'); + var bits=[]; + for (var i in arr2) + { + bits.push(UncompressBin(parseInt(arr2[i]))); + } + arr2=[]; + for (var i in bits) + { + for (var ii in bits[i]) arr2.push(bits[i][ii]); + } + return arr2; +} + +//seeded random function, courtesy of http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html +(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); + +function bind(scope, fn) +{ + //use : bind(this,function(){this.x++;}) - returns a function where "this" refers to the scoped this + return function() + { + fn.apply(scope,arguments); + }; +} + +CanvasRenderingContext2D.prototype.fillPattern=function(img,X,Y,W,H,iW,iH) +{ + //for when built-in patterns aren't enough + for (var y=0;yUpdates'+ + '
'+ + '
Now working on :
'+ + '
-technical optimization
'+ + '
-prettifying it up
'+ + '
-more customization options
'+ + + '
'+ + '
What\'s next :
'+ + '
-more dungeon stuff!
'+ + '
-more buildings and upgrades!
'+ + '
-revamping the prestige system!
'+ + '
Note : this game is updated fairly frequently, which often involves rebalancing. Expect to see prices and cookies/second vary wildly from one update to another!
'+ + + + '
'+ + '
22/12/2013 - merry fixmas
'+ + '
-some issues with the christmas upgrades have been fixed
'+ + '
-reindeer cookie drops are now more common
'+ + '
-reindeers are now reindeer
'+ + + '
'+ + '
20/12/2013 - Christmas is here
'+ + '
-there is now a festive new evolving upgrade in store
'+ + '
-reindeer are running amok (catch them if you can!)
'+ + '
-added a new option to warn you when you close the window, so you don\'t lose your un-popped wrinklers
'+ + '
-also added a separate option for displaying cursors
'+ + '
-all the Halloween features are still there (and having the Spooky cookies achievements makes the Halloween cookies drop much more often)
'+ + '
-oh yeah, we now have Cookie Clicker shirts, stickers and hoodies! (they\'re really rad)
'+ + + '
'+ + '
29/10/2013 - spooky update
'+ + '
-the Grandmapocalypse now spawns wrinklers, hideous elderly creatures that damage your CpS when they reach your big cookie. Thankfully, you can click on them to make them explode (you\'ll even gain back the cookies they\'ve swallowed - with interest!).
'+ + '
-wrath cookie now 27% spookier
'+ + '
-some other stuff
'+ + '
-you should totally go check out Candy Box 2, the sequel to the game that inspired Cookie Clicker
'+ + + '
'+ + '
15/10/2013 - it\'s a secret
'+ + '
-added a new heavenly upgrade that gives you 5% of your heavenly chips power for 11 cookies (if you purchased the Heavenly key, you might need to buy it again, sorry)
'+ + '
-golden cookie chains should now work properly
'+ + + '
'+ + '
15/10/2013 - player-friendly
'+ + '
-heavenly upgrades are now way, way cheaper
'+ + '
-tier 5 building upgrades are 5 times cheaper
'+ + '
-cursors now just plain disappear with Fancy Graphics off, I might add a proper option to toggle only the cursors later
'+ + '
-warning : the Cookie Monster add-on seems to be buggy with this update, you might want to wait until its programmer updates it
'+ + + '
'+ + '
15/10/2013 - a couple fixes
'+ + '
-golden cookies should no longer spawn embarrassingly often
'+ + '
-cursors now stop moving if Fancy Graphics is turned off
'+ + + '
'+ + '
14/10/2013 - going for the gold
'+ + '
-golden cookie chains work a bit differently
'+ + '
-golden cookie spawns are more random
'+ + '
-CpS achievements are no longer affected by golden cookie frenzies
'+ + '
-revised cookie-baking achievement requirements
'+ + '
-heavenly chips now require upgrades to function at full capacity
'+ + '
-added 4 more cookie upgrades, unlocked after reaching certain amounts of Heavenly Chips
'+ + '
-speed baking achievements now require you to have no heavenly upgrades; as such, they have been reset for everyone (along with the Hardcore achievement) to better match their initially intended difficulty
'+ + '
-made good progress on the mobile port
'+ + + '
'+ + '
01/10/2013 - smoothing it out
'+ + '
-some visual effects have been completely rewritten and should now run more smoothly (and be less CPU-intensive)
'+ + '
-new upgrade tier
'+ + '
-new milk tier
'+ + '
-cookie chains have different capping mechanics
'+ + '
-antimatter condensers are back to their previous price
'+ + '
-heavenly chips now give +2% CpS again (they will be extensively reworked in the future)
'+ + '
-farms have been buffed a bit (to popular demand)
'+ + '
-dungeons still need a bit more work and will be released soon - we want them to be just right! (you can test an unfinished version in the beta)
'+ + + '
'+ + '
28/09/2013 - dungeon beta
'+ + '
-from now on, big updates will come through a beta stage first (you can try it here)
'+ + '
-first dungeons! (you need 50 factories to unlock them!)
'+ + '
-cookie chains can be longer
'+ + '
-antimatter condensers are a bit more expensive
'+ + '
-heavenly chips now only give +1% cps each (to account for all the cookies made from condensers)
'+ + '
-added flavor text on all upgrades
'+ + + '
'+ + '
15/09/2013 - anticookies
'+ + '
-ran out of regular matter to make your cookies? Try our new antimatter condensers!
'+ + '
-renamed Hard-reset to "Wipe save" to avoid confusion
'+ + '
-reset achievements are now regular achievements and require cookies baked all time, not cookies in bank
'+ + '
-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)
'+ + '
-golden cookie clicks are no longer reset by soft-resets
'+ + '
-you can now see how long you\'ve been playing in the stats
'+ + + '
'+ + '
08/09/2013 - everlasting cookies
'+ + '
-added a prestige system - resetting gives you permanent CpS boosts (the more cookies made before resetting, the bigger the boost!)
'+ + '
-save format has been slightly modified to take less space
'+ + '
-Leprechaun has been bumped to 777 golden cookies clicked and is now shadow; Fortune is the new 77 golden cookies achievement
'+ + '
-clicking frenzy is now x777
'+ + + '
'+ + '
04/09/2013 - smarter cookie
'+ + '
-golden cookies only have 20% chance of giving the same outcome twice in a row now
'+ + '
-added a golden cookie upgrade
'+ + '
-added an upgrade that makes pledges last twice as long (requires having pledged 10 times)
'+ + '
-Quintillion fingers is now twice as efficient
'+ + '
-Uncanny clicker was really too unpredictable; it is now a regular achievement and no longer requires a world record, just *pretty fast* clicking
'+ + + '
'+ + '
02/09/2013 - a better way out
'+ + '
-Elder Covenant is even cheaper, and revoking it is cheaper still (also added a new achievement for getting it)
'+ + '
-each grandma upgrade now requires 15 of the matching building
'+ + '
-the dreaded bottom cursor has been fixed with a new cursor display style
'+ + '
-added an option for faster, cheaper graphics
'+ + '
-base64 encoding has been redone; this might make saving possible again on some older browsers
'+ + '
-shadow achievements now have their own section
'+ + '
-raspberry juice is now named raspberry milk, despite raspberry juice being delicious and going unquestionably well with cookies
'+ + '
-HOTFIX : cursors now click; fancy graphics button renamed; cookies amount now more visible against cursors
'+ + + '
'+ + '
01/09/2013 - sorting things out
'+ + '
-upgrades and achievements are properly sorted in the stats screen
'+ + '
-made Elder Covenant much cheaper and less harmful
'+ + '
-importing from the first version has been disabled, as promised
'+ + '
-"One mind" now actually asks you to confirm the upgrade
'+ + + '
'+ + '
31/08/2013 - hotfixes
'+ + '
-added a way to permanently stop the grandmapocalypse
'+ + '
-Elder Pledge price is now capped
'+ + '
-One Mind and other grandma research upgrades are now a little more powerful, if not 100% accurate
'+ + '
-"golden" cookie now appears again during grandmapocalypse; Elder Pledge-related achievements are now unlockable
'+ + + '
'+ + '
31/08/2013 - too many grandmas
'+ + '
-the grandmapocalypse is back, along with more grandma types
'+ + '
-added some upgrades that boost your clicking power and make it scale with your cps
'+ + '
-clicking achievements made harder; Neverclick is now a shadow achievement; Uncanny clicker should now truly be a world record
'+ + + '
'+ + '
28/08/2013 - over-achiever
'+ + '
-added a few more achievements
'+ + '
-reworked the "Bake X cookies" achievements so they take longer to achieve
'+ + + '
'+ + '
27/08/2013 - a bad idea
'+ + '
-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!
'+ + '
-made some achievements hidden for added mystery
'+ + + '
'+ + '
27/08/2013 - a sense of achievement
'+ + '
-added achievements (and milk)
'+ + '
(this is a big update, please don\'t get too mad if you lose some data!)
'+ + + '
'+ + '
26/08/2013 - new upgrade tier
'+ + '
-added some more upgrades (including a couple golden cookie-related ones)
'+ + '
-added clicking stats
'+ + + '
'+ + '
26/08/2013 - more tweaks
'+ + '
-tweaked a couple cursor upgrades
'+ + '
-made time machines less powerful
'+ + '
-added offline mode option
'+ + + '
'+ + '
25/08/2013 - tweaks
'+ + '
-rebalanced progression curve (mid- and end-game objects cost more and give more)
'+ + '
-added some more cookie upgrades
'+ + '
-added CpS for cursors
'+ + '
-added sell button
'+ + '
-made golden cookie more useful
'+ + + '
'+ + '
24/08/2013 - hotfixes
'+ + '
-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)
'+ + '
-upgrade store now has unlimited slots (just hover over it), due to popular demand
'+ + '
-added update log
'+ + + '
'+ + '
24/08/2013 - big update!
'+ + '
-revamped the whole game (new graphics, new game mechanics)
'+ + '
-added upgrades
'+ + '
-much safer saving
'+ + + '
'+ + '
08/08/2013 - game launch
'+ + '
-made the game in a couple hours, for laughs
'+ + '
-kinda starting to regret it
'+ + '
-ah well
'+ + '
' + ; + + Game.ready=0; + + Game.Load=function() + { + l('javascriptError').innerHTML='
Loading...
'; + + Game.Loader=new Loader(); + Game.Loader.domain='img/'; + Game.Loader.loaded=Game.Init; + /* + What we should load in here : + -heavy images + -images that are displayed on and off (flashing backgrounds etc) + -images used in stuff + */ + var pics=[ + 'perfectCookie.png', + 'goldCookie.png', + 'wrathCookie.png', + 'spookyCookie.png', + 'icons.png', + 'cookieShower1.png', + 'cookieShower2.png', + 'cookieShower3.png', + 'milkWave.png', + 'chocolateMilkWave.png', + 'raspberryWave.png', + 'orangeWave.png', + 'caramelWave.png', + 'grandmas1.jpg', + 'grandmas2.jpg', + 'grandmas3.jpg', + 'bgBlue.jpg', + 'blackGradient.png', + 'shine.png', + 'shadedBorders.png', + 'shadedBordersRed.png', + 'shadedBordersGold.png', + 'smallCookies.png', + 'cursor.png', + 'wrinkler.png', + 'winterWrinkler.png', + 'wrinklerBits.png', + 'grandmaIcon.png', + 'grandmaIconB.png', + 'grandmaIconC.png', + 'grandmaIconD.png', + 'santa.png', + 'frostedReindeer.png', + 'snow2.jpg', + 'winterFrame.png' + ]; + Game.Loader.Load(pics); + Game.Assets=Game.Loader.assets; + } + + Game.Init=function() + { + Game.ready=1; + + /*===================================================================================== + VARIABLES AND PRESETS + =======================================================================================*/ + Game.T=0; + Game.drawT=0; + Game.fps=30; + + Game.season='christmas';//halloween, christmas + + if (Game.mobile==1) + { + l('wrapper').className='mobile'; + LaunchMobile(); + } + + Game.SaveTo='CookieClickerGame'; + if (Game.beta) Game.SaveTo='CookieClickerGameBeta'; + l('versionNumber').innerHTML='v.'+Game.version+(Game.beta?' beta':''); + l('links').innerHTML=(Game.beta?'Live version | ':'Try the beta! | ')+'Cookie Clicker Classic'; + //l('links').innerHTML='Cookie Clicker Classic'; + + //latency compensator stuff + Game.time=new Date().getTime(); + Game.fpsMeasure=new Date().getTime(); + Game.accumulatedDelay=0; + Game.catchupLogic=0; + + Game.cookiesEarned=0;//all cookies earned during gameplay + Game.cookies=0;//cookies + Game.cookiesd=0;//cookies display + Game.cookiesPs=1;//cookies per second (to recalculate with every new purchase) + Game.cookiesReset=0;//cookies lost to resetting + Game.frenzy=0;//as long as >0, cookie production is multiplied by frenzyPower + Game.frenzyPower=1; + Game.clickFrenzy=0;//as long as >0, mouse clicks get 777x more cookies + Game.cookieClicks=0;//+1 for each click on the cookie + Game.goldenClicks=0;//+1 for each golden cookie clicked (all time) + Game.goldenClicksLocal=0;//+1 for each golden cookie clicked (this game only) + Game.missedGoldenClicks=0;//+1 for each golden cookie missed + Game.handmadeCookies=0;//all the cookies made from clicking the cookie + Game.milkProgress=0;//you gain a little bit for each achievement. Each increment of 1 is a different milk displayed. + Game.milkH=Game.milkProgress/2;//milk height, between 0 and 1 (although should never go above 0.5) + Game.milkHd=0;//milk height display + Game.milkType=-1;//custom milk : 0=plain, 1=chocolate... + Game.backgroundType=-1;//custom background : 0=blue, 1=red... + Game.prestige=[];//cool stuff that carries over beyond resets + Game.resets=0;//reset counter + + Game.elderWrath=0; + Game.elderWrathD=0; + Game.pledges=0; + Game.pledgeT=0; + Game.researchT=0; + Game.nextResearch=0; + Game.cookiesSucked=0;//cookies sucked by wrinklers + Game.cpsSucked=0;//percent of CpS being sucked by wrinklers + Game.wrinklersPopped=0; + Game.santaLevel=0; + Game.reindeerClicked=0; + + Game.bg='';//background (grandmas and such) + Game.bgFade='';//fading to background + Game.bgR=0;//ratio (0 - not faded, 1 - fully faded) + Game.bgRd=0;//ratio displayed + + Game.startDate=parseInt(new Date().getTime());//when we started playing + Game.fullDate=parseInt(new Date().getTime());//when we started playing (carries over with resets) + Game.lastDate=parseInt(new Date().getTime());//when we last saved the game (used to compute "cookies made since we closed the game" etc) + + Game.prefs=[]; + Game.DefaultPrefs=function() + { + Game.prefs.particles=1;//particle effects : falling cookies etc + Game.prefs.numbers=1;//numbers that pop up when clicking the cookie + Game.prefs.autosave=1;//save the game every minute or so + Game.prefs.autoupdate=1;//send an AJAX request to the server every 30 minutes (crashes the game when playing offline) + Game.prefs.milk=1;//display milk + Game.prefs.fancy=1;//CSS shadow effects (might be heavy on some browsers) + Game.prefs.warn=0;//warn before closing the window + Game.prefs.cursors=1;//display cursors + } + Game.DefaultPrefs(); + + window.onbeforeunload=function(event) + { + if (Game.prefs.warn) + { + if (typeof event=='undefined') event=window.event; + if (event) event.returnValue='Are you sure you want to close Cookie Clicker?\n(you might have some un-popped wrinklers!)'; + } + } + + Game.Mobile=function() + { + if (!Game.mobile) + { + l('wrapper').className='mobile'; + Game.mobile=1; + } + else + { + l('wrapper').className=''; + Game.mobile=0; + } + } + + /*===================================================================================== + UPDATE CHECKER + =======================================================================================*/ + Game.CheckUpdates=function() + { + ajax('server.php?q=checkupdate',Game.CheckUpdatesResponse); + } + Game.CheckUpdatesResponse=function(response) + { + var r=response.split('|'); + if (parseFloat(r[0])>Game.version) + { + var str='New version available : v.'+r[0]+'!'; + if (r[1]) str+='
Update note : "'+r[1]+'"'; + str+='
Refresh to get it!'; + l('alert').innerHTML=str; + l('alert').style.display='block'; + } + } + + /*===================================================================================== + SAVE + =======================================================================================*/ + Game.ExportSave=function() + { + var save=prompt('Copy this text and keep it somewhere safe!',Game.WriteSave(1)); + } + Game.ImportSave=function() + { + var save=prompt('Please paste in the text that was given to you on save export.',''); + if (save && save!='') Game.LoadSave(save); + Game.WriteSave(); + } + + Game.WriteSave=function(exporting)//guess what we'e using to save the game? + { + Game.lastDate=parseInt(new Date().getTime()); + var str=''; + str+=Game.version+'|'; + str+='|';//just in case we need some more stuff here + str+=//save stats + parseInt(Game.startDate)+';'+ + parseInt(Game.fullDate)+';'+ + parseInt(Game.lastDate)+ + '|'; + str+=//prefs + (Game.prefs.particles?'1':'0')+ + (Game.prefs.numbers?'1':'0')+ + (Game.prefs.autosave?'1':'0')+ + (Game.prefs.autoupdate?'1':'0')+ + (Game.prefs.milk?'1':'0')+ + (Game.prefs.fancy?'1':'0')+ + (Game.prefs.warn?'1':'0')+ + (Game.prefs.cursors?'1':'0')+ + '|'; + str+=parseFloat(Game.cookies).toString()+';'+ + parseFloat(Game.cookiesEarned).toString()+';'+ + parseInt(Math.floor(Game.cookieClicks))+';'+ + parseInt(Math.floor(Game.goldenClicks))+';'+ + parseFloat(Game.handmadeCookies).toString()+';'+ + parseInt(Math.floor(Game.missedGoldenClicks))+';'+ + parseInt(Math.floor(Game.backgroundType))+';'+ + parseInt(Math.floor(Game.milkType))+';'+ + parseFloat(Game.cookiesReset).toString()+';'+ + parseInt(Math.floor(Game.elderWrath))+';'+ + parseInt(Math.floor(Game.pledges))+';'+ + parseInt(Math.floor(Game.pledgeT))+';'+ + parseInt(Math.floor(Game.nextResearch))+';'+ + parseInt(Math.floor(Game.researchT))+';'+ + parseInt(Math.floor(Game.resets))+';'+ + parseInt(Math.floor(Game.goldenClicksLocal))+';'+ + parseFloat(Game.cookiesSucked).toString()+';'+ + parseInt(Math.floor(Game.wrinklersPopped))+';'+ + parseInt(Math.floor(Game.santaLevel))+';'+ + parseInt(Math.floor(Game.reindeerClicked))+ + '|';//cookies + for (var i in Game.Objects)//buildings + { + var me=Game.Objects[i]; + str+=me.amount+','+me.bought+','+Math.floor(me.totalCookies)+','+(me.specialUnlocked?1:0)+';'; + } + str+='|'; + var toCompress=[]; + for (var i in Game.Upgrades)//upgrades + { + var me=Game.Upgrades[i]; + toCompress.push(Math.min(me.unlocked,1),Math.min(me.bought,1)); + } + toCompress=CompressLargeBin(toCompress); + str+=toCompress; + str+='|'; + var toCompress=[]; + for (var i in Game.Achievements)//achievements + { + var me=Game.Achievements[i]; + toCompress.push(Math.min(me.won)); + } + toCompress=CompressLargeBin(toCompress); + str+=toCompress; + + + if (exporting) + { + str=escape(utf8_to_b64(str)+'!END!'); + return str; + } + else + { + //that's right + //we're using cookies + //yeah I went there + var now=new Date();//we storin dis for 5 years, people + now.setFullYear(now.getFullYear()+5);//mmh stale cookies + str=utf8_to_b64(str)+'!END!'; + Game.saveData=escape(str); + if (Game.mobile==1) Game.m.writeSaveRequest();//save on mobile + else + { + str=Game.SaveTo+'='+escape(str)+'; expires='+now.toUTCString()+';'; + document.cookie=str;//aaand save + if (document.cookie.indexOf(Game.SaveTo)<0) Game.Popup('Error while saving.
Export your save instead!'); + else Game.Popup('Game saved'); + } + } + } + + /*===================================================================================== + LOAD + =======================================================================================*/ + Game.LoadSave=function(data) + { + var str=''; + if (data) str=unescape(data); + else + { + if (Game.mobile==1) {Game.m.readSaveRequest();return;}//get saved file here + else {if (document.cookie.indexOf(Game.SaveTo)>=0) str=unescape(document.cookie.split(Game.SaveTo+'=')[1]);}//get cookie here + } + + if (str!='') + { + var version=0; + var oldstr=str.split('|'); + if (oldstr[0]<1) {} + else + { + str=str.split('!END!')[0]; + str=b64_to_utf8(str); + } + if (str!='') + { + var spl=''; + str=str.split('|'); + version=parseFloat(str[0]); + if (isNaN(version) || str.length<5) {Game.Popup('Oops, looks like the import string is all wrong!');return 0;} + if (version>=1 && version>Game.version) + { + alert('Error : you are attempting to load a save from a future version (v.'+version+'; you are using v.'+Game.version+').'); + return 0; + } + else if (version>=1) + { + spl=str[2].split(';');//save stats + Game.startDate=parseInt(spl[0]); + Game.fullDate=parseInt(spl[1]); + Game.lastDate=parseInt(spl[2]); + spl=str[3].split('');//prefs + Game.prefs.particles=parseInt(spl[0]); + Game.prefs.numbers=parseInt(spl[1]); + Game.prefs.autosave=parseInt(spl[2]); + Game.prefs.autoupdate=spl[3]?parseInt(spl[3]):1; + Game.prefs.milk=spl[4]?parseInt(spl[4]):1; + Game.prefs.fancy=parseInt(spl[5]);if (Game.prefs.fancy) Game.removeClass('noFancy'); else if (!Game.prefs.fancy) Game.addClass('noFancy'); + Game.prefs.warn=spl[6]?parseInt(spl[6]):0; + Game.prefs.cursors=spl[7]?parseInt(spl[7]):0; + spl=str[4].split(';');//cookies + Game.cookies=parseFloat(spl[0]);Game.cookiesEarned=parseFloat(spl[1]); + Game.cookieClicks=spl[2]?parseInt(spl[2]):0; + Game.goldenClicks=spl[3]?parseInt(spl[3]):0; + Game.handmadeCookies=spl[4]?parseFloat(spl[4]):0; + Game.missedGoldenClicks=spl[5]?parseInt(spl[5]):0; + Game.backgroundType=spl[6]?parseInt(spl[6]):0; + Game.milkType=spl[7]?parseInt(spl[7]):0; + Game.cookiesReset=spl[8]?parseFloat(spl[8]):0; + Game.elderWrath=spl[9]?parseInt(spl[9]):0; + Game.pledges=spl[10]?parseInt(spl[10]):0; + Game.pledgeT=spl[11]?parseInt(spl[11]):0; + Game.nextResearch=spl[12]?parseInt(spl[12]):0; + Game.researchT=spl[13]?parseInt(spl[13]):0; + Game.resets=spl[14]?parseInt(spl[14]):0; + Game.goldenClicksLocal=spl[15]?parseInt(spl[15]):0; + Game.cookiesSucked=spl[16]?parseFloat(spl[16]):0; + Game.wrinklersPopped=spl[17]?parseInt(spl[17]):0; + Game.santaLevel=spl[18]?parseInt(spl[18]):0; + Game.reindeerClicked=spl[19]?parseInt(spl[19]):0; + spl=str[5].split(';');//buildings + Game.BuildingsOwned=0; + for (var i in Game.ObjectsById) + { + var me=Game.ObjectsById[i]; + if (spl[i]) + { + var mestr=spl[i].toString().split(','); + me.amount=parseInt(mestr[0]);me.bought=parseInt(mestr[1]);me.totalCookies=parseInt(mestr[2]);me.specialUnlocked=parseInt(mestr[3]); + Game.BuildingsOwned+=me.amount; + } + else + { + me.unlocked=0;me.bought=0;me.totalCookies=0; + } + } + if (version<1.035)//old non-binary algorithm + { + spl=str[6].split(';');//upgrades + Game.UpgradesOwned=0; + for (var i in Game.UpgradesById) + { + var me=Game.UpgradesById[i]; + if (spl[i]) + { + var mestr=spl[i].split(','); + me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]); + if (me.bought && me.hide!=3) Game.UpgradesOwned++; + } + else + { + me.unlocked=0;me.bought=0; + } + } + if (str[7]) spl=str[7].split(';'); else spl=[];//achievements + Game.AchievementsOwned=0; + for (var i in Game.AchievementsById) + { + var me=Game.AchievementsById[i]; + if (spl[i]) + { + var mestr=spl[i].split(','); + me.won=parseInt(mestr[0]); + } + else + { + me.won=0; + } + if (me.won && me.hide!=3) Game.AchievementsOwned++; + } + } + else + { + if (str[6]) spl=str[6]; else spl=[];//upgrades + spl=UncompressLargeBin(spl); + Game.UpgradesOwned=0; + for (var i in Game.UpgradesById) + { + var me=Game.UpgradesById[i]; + if (spl[i*2]) + { + var mestr=[spl[i*2],spl[i*2+1]]; + me.unlocked=parseInt(mestr[0]);me.bought=parseInt(mestr[1]); + if (me.bought && me.hide!=3) Game.UpgradesOwned++; + } + else + { + me.unlocked=0;me.bought=0; + } + } + if (str[7]) spl=str[7]; else spl=[];//achievements + spl=UncompressLargeBin(spl); + Game.AchievementsOwned=0; + for (var i in Game.AchievementsById) + { + var me=Game.AchievementsById[i]; + if (spl[i]) + { + var mestr=[spl[i]]; + me.won=parseInt(mestr[0]); + } + else + { + me.won=0; + } + if (me.won && me.hide!=3) Game.AchievementsOwned++; + } + } + + if (version<1.038) + { + Game.Achievements['Hardcore'].won=0; + Game.Achievements['Speed baking I'].won=0; + Game.Achievements['Speed baking II'].won=0; + Game.Achievements['Speed baking III'].won=0; + } + + for (var i in Game.ObjectsById) + { + var me=Game.ObjectsById[i]; + if (me.buyFunction) me.buyFunction(); + me.setSpecial(0); + if (me.special && me.specialUnlocked==1) me.special(); + me.refresh(); + } + + Game.ResetWrinklers(); + /*//why was this here ? + Game.cookiesSucked=0; + Game.wrinklersPopped=0; + + Game.santaLevel=0; + Game.reindeerClicked=0; + */ + + Game.CalculateGains(); + + //compute cookies earned while the game was closed + if (Game.mobile || Game.Has('Perfect idling')) + { + var amount=((new Date().getTime()-Game.lastDate)/1000)*Game.cookiesPs; + if (amount>0) + { + Game.Popup('Earned '+Beautify(amount)+' cookie'+(Math.floor(amount)==1?'':'s')+' while you were away'); + Game.Earn(amount); + } + } + + } + else//importing old version save + { + /* + Game.startDate=parseInt(new Date().getTime()); + Game.cookies=parseInt(str[1]); + Game.cookiesEarned=parseInt(str[1]); + + for (var i in Game.ObjectsById) + { + var me=Game.ObjectsById[i]; + me.amount=0;me.bought=0;me.totalCookies=0; + me.refresh(); + } + for (var i in Game.UpgradesById) + { + var me=Game.UpgradesById[i]; + me.unlocked=0;me.bought=0; + } + + var moni=0; + moni+=15*Math.pow(1.1,parseInt(str[2])); + moni+=100*Math.pow(1.1,parseInt(str[4])); + moni+=500*Math.pow(1.1,parseInt(str[6])); + moni+=2000*Math.pow(1.1,parseInt(str[8])); + moni+=7000*Math.pow(1.1,parseInt(str[10])); + moni+=50000*Math.pow(1.1,parseInt(str[12])); + moni+=1000000*Math.pow(1.1,parseInt(str[14])); + if (parseInt(str[16])) moni+=123456789*Math.pow(1.1,parseInt(str[16])); + + alert('Imported old save from version '+version+'; recovered '+Beautify(Game.cookies)+' cookies, and converted buildings back to '+Beautify(moni)+' cookies.'); + + Game.cookies+=moni; + Game.cookiesEarned+=moni; + */ + alert('Sorry, you can\'t import saves from the old version anymore.'); + return; + } + + + Game.goldenCookie.reset(); + Game.seasonPopup.reset(); + + Game.prestige=[]; + + Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,14)); + + Game.RebuildUpgrades(); + + Game.TickerAge=0; + + Game.elderWrathD=0; + Game.frenzy=0; + Game.frenzyPower=1; + Game.clickFrenzy=0; + Game.recalculateGains=1; + Game.storeToRebuild=1; + Game.upgradesToRebuild=1; + Game.Popup('Game loaded'); + } + } + } + + /*===================================================================================== + RESET + =======================================================================================*/ + Game.Reset=function(bypass) + { + 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.)')) + { + if (!bypass) + { + if (Game.cookiesEarned>=1000000) Game.Win('Sacrifice'); + if (Game.cookiesEarned>=1000000000) Game.Win('Oblivion'); + if (Game.cookiesEarned>=1000000000000) Game.Win('From scratch'); + if (Game.cookiesEarned>=1000000000000000) Game.Win('Nihilism'); + } + + + Game.cookiesReset+=Game.cookiesEarned; + Game.cookies=0; + Game.cookiesEarned=0; + Game.cookieClicks=0; + Game.goldenClicksLocal=0; + //Game.goldenClicks=0; + //Game.missedGoldenClicks=0; + Game.handmadeCookies=0; + Game.backgroundType=-1; + Game.milkType=-1; + Game.frenzy=0; + Game.frenzyPower=1; + Game.clickFrenzy=0; + Game.pledges=0; + Game.pledgeT=0; + Game.elderWrath=0; + Game.nextResearch=0; + Game.researchT=0; + + Game.startDate=parseInt(new Date().getTime()); + Game.lastDate=parseInt(new Date().getTime()); + + Game.cookiesSucked=0; + Game.wrinklersPopped=0; + Game.ResetWrinklers(); + + Game.santaLevel=0; + Game.reindeerClicked=0; + + Game.resets++; + Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,14)); + for (var i in Game.ObjectsById) + { + var me=Game.ObjectsById[i]; + me.amount=0;me.bought=0;me.totalCookies=0;me.specialUnlocked=0; + me.setSpecial(0); + me.refresh(); + } + for (var i in Game.UpgradesById) + { + var me=Game.UpgradesById[i]; + me.unlocked=0;me.bought=0; + } + /* + for (var i in Game.AchievementsById) + { + var me=Game.AchievementsById[i]; + me.won=0; + }*/ + //Game.DefaultPrefs(); + Game.BuildingsOwned=0; + Game.UpgradesOwned=0; + Game.RebuildUpgrades(); + Game.TickerAge=0; + Game.recalculateGains=1; + Game.storeToRebuild=1; + Game.upgradesToRebuild=1; + Game.goldenCookie.reset(); + Game.seasonPopup.reset(); + + Game.Popup('Game reset'); + + if (!bypass) + { + var prestige=0; + if (Game.prestige.ready) prestige=Game.prestige['Heavenly chips']; + Game.prestige=[]; + Game.CalculatePrestige(); + prestige=Game.prestige['Heavenly chips']-prestige; + if (prestige!=0) Game.Popup('You earn '+prestige+' heavenly chip'+(prestige==1?'':'s')+'!'); + } + } + } + Game.HardReset=function() + { + if (confirm('Do you REALLY want to wipe your save?\n(you will lose your progress, your achievements, and your prestige!)')) + { + if (confirm('Whoah now, are you really, REALLY sure?\n(don\'t say we didn\'t warn you!)')) + { + for (var i in Game.AchievementsById) + { + var me=Game.AchievementsById[i]; + me.won=0; + } + Game.AchievementsOwned=0; + Game.goldenClicks=0; + Game.missedGoldenClicks=0; + Game.Reset(1); + Game.resets=0; + Game.fullDate=parseInt(new Date().getTime()); + Game.cookiesReset=0; + Game.prestige=[]; + Game.CalculatePrestige(); + } + } + } + + + /*===================================================================================== + COOKIE ECONOMICS + =======================================================================================*/ + Game.Earn=function(howmuch) + { + Game.cookies+=howmuch; + Game.cookiesEarned+=howmuch; + } + Game.Spend=function(howmuch) + { + Game.cookies-=howmuch; + } + Game.Dissolve=function(howmuch) + { + Game.cookies-=howmuch; + Game.cookiesEarned-=howmuch; + } + Game.mouseCps=function() + { + var add=0; + if (Game.Has('Thousand fingers')) add+=0.1; + if (Game.Has('Million fingers')) add+=0.5; + if (Game.Has('Billion fingers')) add+=2; + if (Game.Has('Trillion fingers')) add+=10; + if (Game.Has('Quadrillion fingers')) add+=20; + if (Game.Has('Quintillion fingers')) add+=100; + if (Game.Has('Sextillion fingers')) add+=200; + var num=0; + for (var i in Game.Objects) {num+=Game.Objects[i].amount;} + num-=Game.Objects['Cursor'].amount; + add=add*num; + if (Game.Has('Plastic mouse')) add+=Game.cookiesPs*0.01; + if (Game.Has('Iron mouse')) add+=Game.cookiesPs*0.01; + if (Game.Has('Titanium mouse')) add+=Game.cookiesPs*0.01; + if (Game.Has('Adamantium mouse')) add+=Game.cookiesPs*0.01; + if (Game.Has('Unobtainium mouse')) add+=Game.cookiesPs*0.01; + var mult=1; + if (Game.Has('Santa\'s helpers')) mult*=1.1; + if (Game.clickFrenzy>0) mult*=777; + return mult*Game.ComputeCps(1,Game.Has('Reinforced index finger'),Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add); + } + Game.computedMouseCps=1; + Game.globalCpsMult=1; + Game.lastClick=0; + Game.autoclickerDetected=0; + Game.BigCookieState=0; + Game.BigCookieSize=0; + Game.ClickCookie=function(event) + { + if (event) event.preventDefault(); + if (new Date().getTime()-Game.lastClick<1000/250) + { + } + else + { + if (new Date().getTime()-Game.lastClick<1000/15) + { + Game.autoclickerDetected+=Game.fps; + if (Game.autoclickerDetected>=Game.fps*5) Game.Win('Uncanny clicker'); + } + Game.Earn(Game.computedMouseCps); + Game.handmadeCookies+=Game.computedMouseCps; + if (Game.prefs.particles) + { + Game.particleAdd(); + Game.particleAdd(Game.mouseX,Game.mouseY,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.2,1,2); + } + if (Game.prefs.numbers) Game.particleAdd(Game.mouseX+Math.random()*8-4,Game.mouseY-8+Math.random()*8-4,0,-2,1,4,2,'','+'+Beautify(Game.computedMouseCps,1)); + Game.cookieClicks++; + } + Game.lastClick=new Date().getTime(); + } + Game.mouseX=0; + Game.mouseY=0; + Game.GetMouseCoords=function(e) + { + var posx=0; + var posy=0; + if (!e) var e=window.event; + if (e.pageX||e.pageY) + { + posx=e.pageX; + posy=e.pageY; + } + else if (e.clientX || e.clientY) + { + posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft; + posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop; + } + var el=l('sectionLeft'); + var x=0; + var y=0; + while(el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) + { + x+=el.offsetLeft-el.scrollLeft; + y+=el.offsetTop-el.scrollTop; + el=el.offsetParent; + } + Game.mouseX=posx-x;//Math.min(Game.w,Math.max(0,posx-x)); + Game.mouseY=posy-y;//Math.min(Game.h,Math.max(0,posy-y)); + } + var bigCookie=l('bigCookie'); + AddEvent(bigCookie,'click',Game.ClickCookie); + AddEvent(bigCookie,'mousedown',function(event){Game.BigCookieState=1;if (event) event.preventDefault();}); + AddEvent(bigCookie,'mouseup',function(event){Game.BigCookieState=2;if (event) event.preventDefault();}); + AddEvent(bigCookie,'mouseout',function(event){Game.BigCookieState=0;}); + AddEvent(bigCookie,'mouseover',function(event){Game.BigCookieState=2;}); + AddEvent(document,'mousemove',Game.GetMouseCoords); + Game.Click=0; + AddEvent(document,'click',function(event){Game.Click=1;}); + + Game.HowMuchPrestige=function(cookies) + { + var prestige=cookies/1000000000000; + //prestige=Math.max(0,Math.floor(Math.pow(prestige,0.5)));//old version + prestige=Math.max(0,Math.floor((-1+Math.pow(1+8*prestige,0.5))/2));//geometric progression + return prestige; + } + Game.CalculatePrestige=function() + { + var prestige=Game.HowMuchPrestige(Game.cookiesReset); + Game.prestige=[]; + Game.prestige['Heavenly chips']=prestige; + Game.prestige.ready=1; + } + /*===================================================================================== + CPS RECALCULATOR + =======================================================================================*/ + Game.recalculateGains=1; + Game.CalculateGains=function() + { + Game.cookiesPs=0; + var mult=1; + for (var i in Game.Upgrades) + { + var me=Game.Upgrades[i]; + if (me.bought>0) + { + if (me.type=='cookie' && Game.Has(me.name)) mult+=me.power*0.01; + } + } + mult+=Game.Has('Specialized chocolate chips')*0.01; + mult+=Game.Has('Designer cocoa beans')*0.02; + mult+=Game.Has('Underworld ovens')*0.03; + mult+=Game.Has('Exotic nuts')*0.04; + mult+=Game.Has('Arcane sugar')*0.05; + + if (Game.Has('Increased merriness')) mult+=0.15; + if (Game.Has('Improved jolliness')) mult+=0.15; + if (Game.Has('A lump of coal')) mult+=0.01; + if (Game.Has('An itchy sweater')) mult+=0.01; + if (Game.Has('Santa\'s dominion')) mult+=0.5; + + if (Game.Has('Santa\'s legacy')) mult+=(Game.santaLevel+1)*0.1; + + if (!Game.prestige.ready) Game.CalculatePrestige(); + var heavenlyMult=0; + if (Game.Has('Heavenly chip secret')) heavenlyMult+=0.05; + if (Game.Has('Heavenly cookie stand')) heavenlyMult+=0.20; + if (Game.Has('Heavenly bakery')) heavenlyMult+=0.25; + if (Game.Has('Heavenly confectionery')) heavenlyMult+=0.25; + if (Game.Has('Heavenly key')) heavenlyMult+=0.25; + mult+=parseFloat(Game.prestige['Heavenly chips'])*0.02*heavenlyMult; + + for (var i in Game.Objects) + { + var me=Game.Objects[i]; + me.storedCps=(typeof(me.cps)=='function'?me.cps():me.cps); + me.storedTotalCps=me.amount*me.storedCps; + Game.cookiesPs+=me.storedTotalCps; + } + + var milkMult=Game.Has('Santa\'s milk and cookies')?1.05:1; + if (Game.Has('Kitten helpers')) mult*=(1+Game.milkProgress*0.05*milkMult); + if (Game.Has('Kitten workers')) mult*=(1+Game.milkProgress*0.1*milkMult); + if (Game.Has('Kitten engineers')) mult*=(1+Game.milkProgress*0.2*milkMult); + if (Game.Has('Kitten overseers')) mult*=(1+Game.milkProgress*0.2*milkMult); + + var rawCookiesPs=Game.cookiesPs*mult; + for (var i=0;i=Game.cpsAchievs[i*2+1]) Game.Win(Game.cpsAchievs[i*2]); + } + + if (Game.frenzy>0) mult*=Game.frenzyPower; + + var sucked=1; + for (var i in Game.wrinklers) + { + if (Game.wrinklers[i].phase==2) sucked-=1/20; + } + Game.cpsSucked=(1-sucked); + + if (Game.Has('Elder Covenant')) mult*=0.95; + + Game.globalCpsMult=mult; + Game.cookiesPs*=Game.globalCpsMult; + + Game.computedMouseCps=Game.mouseCps(); + + Game.recalculateGains=0; + } + /*===================================================================================== + GOLDEN COOKIE + =======================================================================================*/ + Game.goldenCookie={x:0,y:0,life:0,time:0,minTime:0,maxTime:0,dur:13,toDie:1,wrath:0,chain:0,last:''}; + Game.goldenCookie.reset=function() + { + this.life=1;//the cookie's current progression through its lifespan + this.time=0;//the amount of time since the cookie has last been clicked + this.minTime=this.getMinTime();//the minimum amount of time we must wait for the cookie to spawn + this.maxTime=this.getMaxTime();//the maximum amount of time we must wait for the cookie to spawn + this.dur=13;//duration; the cookie's lifespan before it despawns + this.toDie=1;//should the cookie despawn? (I think that's what it does?) + this.last='';//what was the last cookie effect? + this.chain=0;//how far in the chain are we? + } + Game.goldenCookie.getMinTime=function() + { + var m=5; + if (Game.Has('Lucky day')) m/=2; + if (Game.Has('Serendipity')) m/=2; + if (this.chain>0) m=0.05; + if (Game.Has('Gold hoard')) m=0.01; + return Math.ceil(Game.fps*60*m); + } + Game.goldenCookie.getMaxTime=function() + { + var m=15; + if (Game.Has('Lucky day')) m/=2; + if (Game.Has('Serendipity')) m/=2; + if (this.chain>0) m=0.05; + if (Game.Has('Gold hoard')) m=0.01; + return Math.ceil(Game.fps*60*m); + } + Game.goldenCookie.spawn=function() + { + if (this.time0) Game.Win('Cheated cookies taste awful'); + + var me=l('goldenCookie'); + if ((Game.elderWrath==1 && Math.random()<0.33) || (Game.elderWrath==2 && Math.random()<0.66) || (Game.elderWrath==3)) + { + this.wrath=1; + if (Game.season=='halloween') me.style.background='url(img/spookyCookie.png)'; + else me.style.background='url(img/wrathCookie.png)'; + } + else + { + this.wrath=0; + me.style.background='url(img/goldCookie.png)'; + } + //fancy visual stuff + var r=Math.floor(Math.random()*360); + if (Game.season=='halloween' && this.wrath) r=Math.floor(Math.random()*36-18); + me.style.transform='rotate('+r+'deg)'; + me.style.mozTransform='rotate('+r+'deg)'; + me.style.webkitTransform='rotate('+r+'deg)'; + me.style.msTransform='rotate('+r+'deg)'; + me.style.oTransform='rotate('+r+'deg)'; + var screen=l('game').getBoundingClientRect(); + this.x=Math.floor(Math.random()*Math.max(0,(screen.right-300)-screen.left-128)+screen.left+64)-64; + this.y=Math.floor(Math.random()*Math.max(0,screen.bottom-screen.top-128)+screen.top+64)-64; + me.style.left=this.x+'px'; + me.style.top=this.y+'px'; + me.style.display='block'; + //how long will it stay on-screen? + var dur=13; + if (Game.Has('Lucky day')) dur*=2; + if (Game.Has('Serendipity')) dur*=2; + if (this.chain>0) dur=Math.max(1,10/this.chain);//this is hilarious + this.dur=dur; + this.life=Math.ceil(Game.fps*this.dur); + this.time=0; + this.toDie=0; + } + Game.goldenCookie.update=function() + { + if (this.toDie==0 && this.life<=0 && Math.random()0) + { + this.life--; + l('goldenCookie').style.opacity=1-Math.pow((this.life/(Game.fps*this.dur))*2-1,4); + if (this.life==0 || this.toDie==1) + { + if (this.life==0) this.chain=0; + l('goldenCookie').style.display='none'; + if (this.toDie==0) Game.missedGoldenClicks++; + this.toDie=0; + this.life=0; + } + } + else this.time++; + } + Game.goldenCookie.choose=function() + { + var list=[]; + if (this.wrath>0) list.push('clot','multiply cookies','ruin cookies'); + else list.push('frenzy','multiply cookies'); + if (this.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie'); + else if (Math.random()<0.01 && Game.cookiesEarned>=100000) list.push('chain cookie'); + if (Math.random()<0.1) list.push('click frenzy'); + if (this.last!='' && Math.random()<0.8 && list.indexOf(this.last)!=-1) list.splice(list.indexOf(this.last),1);//80% chance to force a different one + if (Math.random()<0.0001) list.push('blab'); + var choice=choose(list); + return choice; + } + Game.goldenCookie.click=function() + { + var me=Game.goldenCookie; + if (me.life>0) + { + me.toDie=1; + Game.goldenClicks++; + Game.goldenClicksLocal++; + + if (Game.goldenClicks>=1) Game.Win('Golden cookie'); + if (Game.goldenClicks>=7) Game.Win('Lucky cookie'); + if (Game.goldenClicks>=27) Game.Win('A stroke of luck'); + if (Game.goldenClicks>=77) Game.Win('Fortune'); + if (Game.goldenClicks>=777) Game.Win('Leprechaun'); + if (Game.goldenClicks>=7777) Game.Win('Black cat\'s paw'); + + //change to goldenClicksLocal later + if (Game.goldenClicks>=7) Game.Unlock('Lucky day'); + if (Game.goldenClicks>=27) Game.Unlock('Serendipity'); + if (Game.goldenClicks>=77) Game.Unlock('Get lucky'); + + l('goldenCookie').style.display='none'; + + var choice=me.choose(); + + if (me.chain>0) choice='chain cookie'; + me.last=choice; + + if (choice!='chain cookie') me.chain=0; + if (choice=='frenzy') + { + var time=77+77*Game.Has('Get lucky'); + Game.frenzy=Game.fps*time; + Game.frenzyPower=7; + Game.recalculateGains=1; + Game.Popup('Frenzy : cookie production x7 for '+time+' seconds!'); + } + else if (choice=='multiply cookies') + { + var moni=Math.min(Game.cookies*0.1,Game.cookiesPs*60*20)+13;//add 10% to cookies owned (+13), or 20 minutes of cookie production - whichever is lowest + Game.Earn(moni); + Game.Popup('Lucky! +'+Beautify(moni)+' cookies!'); + } + else if (choice=='ruin cookies') + { + var moni=Math.min(Game.cookies*0.05,Game.cookiesPs*60*10)+13;//lose 5% of cookies owned (-13), or 10 minutes of cookie production - whichever is lowest + moni=Math.min(Game.cookies,moni); + Game.Spend(moni); + Game.Popup('Ruin! Lost '+Beautify(moni)+' cookies!'); + } + else if (choice=='blood frenzy') + { + var time=6+6*Game.Has('Get lucky'); + Game.frenzy=Game.fps*time;//*2;//we shouldn't need *2 but I keep getting reports of it lasting only 3 seconds + Game.frenzyPower=666; + Game.recalculateGains=1; + Game.Popup('Elder frenzy : cookie production x666 for '+time+' seconds!'); + } + else if (choice=='clot') + { + var time=66+66*Game.Has('Get lucky'); + Game.frenzy=Game.fps*time; + Game.frenzyPower=0.5; + Game.recalculateGains=1; + Game.Popup('Clot : cookie production halved for '+time+' seconds!'); + } + else if (choice=='click frenzy') + { + var time=13+13*Game.Has('Get lucky'); + Game.clickFrenzy=Game.fps*time; + Game.recalculateGains=1; + Game.Popup('Click frenzy! Clicking power x777 for '+time+' seconds!'); + } + else if (choice=='chain cookie') + { + me.chain++; + var digit='7'; + if (me.wrath) digit='6'; + var moni=''; + for (var i=0;i=Game.cookies*0.25 || nextMoni>Game.cookiesPs*60*60*6) && me.chain>4)//break the chain if we're above 5 digits AND it's more than 25% of our bank, it grants more than six hours of our CpS, or just a 1% chance each digit + { + me.chain=0; + Game.Popup('Cookie chain : +'+Beautify(moni)+' cookies!
Cookie chain over.'); + } + else Game.Popup('Cookie chain : +'+Beautify(moni)+' cookies!'); + Game.Earn(moni); + } + else if (choice=='blab')//sorry (it's really rare) + { + var str=choose([ + 'Cookie crumbliness x3 for 60 seconds!', + 'Chocolatiness x7 for 77 seconds!', + 'Dough elasticity halved for 66 seconds!', + 'Golden cookie shininess doubled for 3 seconds!', + 'World economy halved for 30 seconds!', + 'Grandma kisses 23% stingier for 45 seconds!', + 'Thanks for clicking!', + 'Fooled you! This one was just a test.', + 'Golden cookies clicked +1!', + 'Your click has been registered. Thank you for your cooperation.', + 'Thanks! That hit the spot!' + ]); + Game.Popup(str); + } + + me.minTime=me.getMinTime(); + me.maxTime=me.getMaxTime(); + } + } + l('goldenCookie').onclick=Game.goldenCookie.click; + + /*===================================================================================== + SEASON POPUP + =======================================================================================*/ + Game.seasonPopup={x:0,y:0,life:0,time:0,minTime:0,maxTime:0,dur:4,toDie:1,last:'',type:'',bounds:{}}; + Game.seasonPopup.reset=function() + { + this.life=1;//the popup's current progression through its lifespan + this.time=0;//the amount of time since the popup has last been clicked + this.minTime=this.getMinTime();//the minimum amount of time we must wait for the popup to spawn + this.maxTime=this.getMaxTime();//the maximum amount of time we must wait for the popup to spawn + this.dur=4;//duration; the popup's lifespan before it despawns + this.toDie=1;//should the popup despawn? (I think that's what it does?) + this.last='';//what was the last popup effect? + this.type='';//is it a reindeer? what the hell is it? no seriously + this.bounds=l('game').getBoundingClientRect(); + } + Game.seasonPopup.getMinTime=function() + { + var m=3; + //time bonuses go here + if (Game.Has('Reindeer baking grounds')) m/=2; + if (Game.Has('Reindeer season')) m=0.01; + return Math.ceil(Game.fps*60*m); + } + Game.seasonPopup.getMaxTime=function() + { + var m=6; + //time bonuses go here + if (Game.Has('Reindeer baking grounds')) m/=2; + if (Game.Has('Reindeer season')) m=0.01; + return Math.ceil(Game.fps*60*m); + } + Game.seasonPopup.spawn=function() + { + if (this.time0) Game.Win('Cheated cookies taste awful'); + + var me=l('seasonPopup'); + + if (this.type=='reindeer') + { + me.style.backgroundImage='url(img/frostedReindeer.png)'; + } + + //fancy visual stuff + this.bounds=l('game').getBoundingClientRect(); + //this.x=Math.floor(Math.random()*Math.max(0,(screen.right-300)-screen.left-128)+screen.left+64)-64; + //this.y=Math.floor(Math.random()*Math.max(0,screen.bottom-screen.top-128)+screen.top+64)-64; + this.x=-128; + this.y=Math.floor(Math.random()*Math.max(0,this.bounds.bottom-this.bounds.top-256)+this.bounds.top+128)-128; + me.style.left=this.x+'px'; + me.style.top=this.y+'px'; + me.style.display='block'; + //how long will it stay on-screen? + var dur=4; + if (Game.Has('Weighted sleighs')) dur*=2; + this.dur=dur; + this.life=Math.ceil(Game.fps*this.dur); + this.time=0; + this.toDie=0; + } + Game.seasonPopup.update=function() + { + if (this.toDie==0 && this.life<=0 && Math.random()0) + { + this.life--; + var me=l('seasonPopup'); + me.style.opacity=1-Math.pow((this.life/(Game.fps*this.dur))*2-1,12); + this.x=Math.floor((1-this.life/(Game.fps*this.dur))*(this.bounds.right-this.bounds.left))-128; + me.style.left=this.x+'px'; + me.style.top=this.y-Math.floor(Math.abs(Math.pow(Math.sin(this.life*0.05),1))*128)+'px'; + if (this.life==0 || Game.seasonPopup.toDie==1) + { + if (this.life==0) this.chain=0; + l('seasonPopup').style.display='none'; + this.toDie=0; + this.life=0; + } + } + else this.time++; + } + Game.seasonPopup.click=function() + { + var me=Game.seasonPopup; + if (me.life>0) + { + me.toDie=1; + if (me.type=='reindeer') + { + Game.reindeerClicked++; + + var moni=Math.max(25,Game.cookiesPs*60*1);//1 minute of cookie production, or 25 cookies - whichever is highest + if (Game.Has('Ho ho ho-flavored frosting')) moni*=2; + Game.Earn(moni); + + var failRate=0.8; + var cookie=''; + if (Game.HasAchiev('Let it snow')) failRate=0.6; + if (Game.Has('Santa\'s bottomless bag')) failRate*=0.9; + if (Math.random()>failRate)//christmas cookie drops + { + cookie=choose(['Christmas tree biscuits','Snowflake biscuits','Snowman biscuits','Mistletoe biscuits','Candy cane biscuits','Bell biscuits','Present biscuits']); + if (!Game.HasUnlocked(cookie) && !Game.Has(cookie)) + { + Game.Unlock(cookie); + } + else cookie=''; + } + + Game.Popup('You found '+choose(['Dasher','Dancer','Prancer','Vixen','Comet','Cupid','Donner','Blitzen','Rudolph'])+'!
The reindeer gives you '+Beautify(moni)+' cookies.'+(cookie==''?'':'
You are also rewarded with '+cookie+'!')); + } + l('seasonPopup').style.display='none'; + me.minTime=me.getMinTime(); + me.maxTime=me.getMaxTime(); + } + } + l('seasonPopup').onclick=Game.seasonPopup.click; + + + /*===================================================================================== + PARTICLES + =======================================================================================*/ + //generic particles (falling cookies etc) + Game.particles=[]; + for (var i=0;i<50;i++) + { + Game.particles[i]={x:0,y:0,xd:0,yd:0,z:0,size:1,dur:2,life:-1,r:0,pic:'smallCookies.png',picId:0}; + } + + Game.particlesUpdate=function() + { + for (var i in Game.particles) + { + var me=Game.particles[i]; + if (me.life!=-1) + { + if (!me.text) me.yd+=0.2+Math.random()*0.1; + me.x+=me.xd; + me.y+=me.yd; + //me.y+=me.life*0.25+Math.random()*0.25; + me.life++; + if (me.life>=Game.fps*me.dur) + { + me.life=-1; + } + } + } + } + Game.particleAdd=function(x,y,xd,yd,size,dur,z,pic,text) + { + //Game.particleAdd(pos X,pos Y,speed X,speed Y,size (multiplier),duration (seconds),layer,picture,text); + //pick the first free (or the oldest) particle to replace it + if (1 || Game.prefs.particles) + { + var highest=0; + var highestI=0; + for (var i in Game.particles) + { + if (Game.particles[i].life==-1) {highestI=i;break;} + if (Game.particles[i].life>highest) + { + highest=Game.particles[i].life; + highestI=i; + } + } + var auto=0; + if (x) auto=1; + var i=highestI; + var x=x||-64; + if (Game.LeftBackground && !auto) x=Math.floor(Math.random()*Game.LeftBackground.canvas.width); + var y=y||-64; + var me=Game.particles[i]; + me.life=0; + me.x=x; + me.y=y; + me.xd=xd||0; + me.yd=yd||0; + me.size=size||1; + me.z=z||0; + me.dur=dur||2; + me.r=Math.floor(Math.random()*360); + me.picId=Math.floor(Math.random()*10000); + me.pic=pic||'smallCookies.png'; + me.text=text||0; + } + } + Game.particlesDraw=function(z) + { + Game.LeftBackground.fillStyle='#fff'; + Game.LeftBackground.font='20px Kavoon'; + Game.LeftBackground.textAlign='center'; + + for (var i in Game.particles) + { + var me=Game.particles[i]; + if (me.z==z) + { + if (me.life!=-1) + { + var opacity=1-(me.life/(Game.fps*me.dur)); + Game.LeftBackground.globalAlpha=opacity; + if (me.text) + { + Game.LeftBackground.fillText(me.text,me.x,me.y); + } + else + { + Game.LeftBackground.save(); + Game.LeftBackground.translate(me.x,me.y); + Game.LeftBackground.rotate((me.r/360)*Math.PI*2); + Game.LeftBackground.drawImage(Game.Assets[me.pic],(me.picId%8)*64,0,64,64,-32*me.size,-32*me.size,64*me.size,64*me.size); + Game.LeftBackground.restore(); + } + } + } + } + } + + //text particles (popups etc) + Game.textParticles=[]; + Game.textParticlesY=0; + var str=''; + for (var i=0;i<20;i++) + { + Game.textParticles[i]={x:0,y:0,life:-1,text:''}; + str+='
'; + } + l('particles').innerHTML=str; + Game.textParticlesUpdate=function() + { + Game.textParticlesY=0; + for (var i in Game.textParticles) + { + var me=Game.textParticles[i]; + if (me.life!=-1) + { + Game.textParticlesY+=64;//me.l.clientHeight; + var y=me.y-(1-Math.pow(1-me.life/(Game.fps*4),10))*50; + //me.y=me.life*0.25+Math.random()*0.25; + me.life++; + var el=me.l; + el.style.left=Math.floor(-200+me.x)+'px'; + el.style.bottom=Math.floor(-y)+'px'; + el.style.opacity=1-(me.life/(Game.fps*4)); + if (me.life>=Game.fps*4) + { + me.life=-1; + el.style.opacity=0; + el.style.display='none'; + } + } + } + } + Game.textParticlesAdd=function(text,el) + { + //pick the first free (or the oldest) particle to replace it + var highest=0; + var highestI=0; + for (var i in Game.textParticles) + { + if (Game.textParticles[i].life==-1) {highestI=i;break;} + if (Game.textParticles[i].life>highest) + { + highest=Game.textParticles[i].life; + highestI=i; + } + } + var i=highestI; + var x=(Math.random()-0.5)*40; + var y=0;//+(Math.random()-0.5)*40; + if (!el) + { + var rect=l('game').getBoundingClientRect(); + var x=Math.floor((rect.left+rect.right)/2); + var y=Math.floor((rect.bottom))-(Game.mobile*64); + x+=(Math.random()-0.5)*40; + y+=0;//(Math.random()-0.5)*40; + } + var me=Game.textParticles[i]; + if (!me.l) me.l=l('particle'+i); + me.life=0; + me.x=x; + me.y=y-Game.textParticlesY; + me.text=text; + me.l.innerHTML=text; + me.l.style.left=Math.floor(Game.textParticles[i].x-200)+'px'; + me.l.style.bottom=Math.floor(-Game.textParticles[i].y)+'px'; + me.l.style.display='block'; + Game.textParticlesY+=60; + } + Game.Popup=function(text) + { + Game.textParticlesAdd(text); + } + + + Game.veil=1; + Game.veilOn=function() + { + //l('sectionMiddle').style.display='none'; + //l('sectionRight').style.display='none'; + //l('backgroundLayer2').style.background='#000 url(img/darkNoise.png)'; + Game.veil=1; + } + Game.veilOff=function() + { + //l('sectionMiddle').style.display='block'; + //l('sectionRight').style.display='block'; + //l('backgroundLayer2').style.background='transparent'; + Game.veil=0; + } + + /*===================================================================================== + MENUS + =======================================================================================*/ + Game.cssClasses=[]; + Game.addClass=function(what) {if (Game.cssClasses.indexOf(what)==-1) Game.cssClasses.push(what);Game.updateClasses();} + Game.removeClass=function(what) {var i=Game.cssClasses.indexOf(what);if(i!=-1) {Game.cssClasses.splice(i,1);}Game.updateClasses();} + Game.updateClasses=function() {l('game').className=Game.cssClasses.join(' ');} + + Game.WriteButton=function(prefName,button,on,off,callback) + { + return ''+(Game.prefs[prefName]?on:off)+''; + } + Game.Toggle=function(prefName,button,on,off) + { + if (Game.prefs[prefName]) + { + l(button).innerHTML=off; + l(button).className='option'; + Game.prefs[prefName]=0; + } + else + { + l(button).innerHTML=on; + l(button).className='option enabled'; + Game.prefs[prefName]=1; + } + } + Game.ToggleFancy=function() + { + if (Game.prefs.fancy) Game.removeClass('noFancy'); + else if (!Game.prefs.fancy) Game.addClass('noFancy'); + } + + Game.WriteSelector=function(prefName,button,list,def,selected,callback)//def is default (which is a reserved keyword) + { + var str=''; + var me=0; + for (var i in list) + { + me=Game.Upgrades[list[i]]; + str+='
'+me.name+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + } + str=''+str+'
'; + return str; + } + Game.Select=function(prefName,button,value) + { + if (l(button+'-'+Game[prefName])) l(button+'-'+Game[prefName]).className='crate'; + if (l(button+'-'+value)) l(button+'-'+value).className='crate enabled'; + Game[prefName]=value; + } + + + Game.onPanel='Left'; + Game.addClass('focus'+Game.onPanel); + Game.ShowPanel=function(what) + { + if (!what) what=''; + if (Game.onPanel!=what) + { + Game.removeClass('focus'+Game.onPanel); + Game.addClass('focus'+what); + } + Game.onPanel=what; + } + + Game.onMenu=''; + Game.ShowMenu=function(what) + { + if (!what || what=='') what=Game.onMenu; + if (Game.onMenu=='' && what!='') Game.addClass('onMenu'); + else if (Game.onMenu!='' && what!=Game.onMenu) Game.addClass('onMenu'); + else if (what==Game.onMenu) {Game.removeClass('onMenu');what='';} + Game.onMenu=what; + Game.UpdateMenu(); + } + Game.sayTime=function(time,detail) + { + var str=''; + var detail=detail||0; + time=Math.floor(time); + if (time>=Game.fps*60*60*24*2 && detail<2) str=Beautify(time/(Game.fps*60*60*24))+' days'; + else if (time>=Game.fps*60*60*24 && detail<2) str='1 day'; + else if (time>=Game.fps*60*60*2 && detail<3) str=Beautify(time/(Game.fps*60*60))+' hours'; + else if (time>=Game.fps*60*60 && detail<3) str='1 hour'; + else if (time>=Game.fps*60*2 && detail<4) str=Beautify(time/(Game.fps*60))+' minutes'; + else if (time>=Game.fps*60 && detail<4) str='1 minute'; + else if (time>=Game.fps*2 && detail<5) str=Beautify(time/(Game.fps))+' seconds'; + else if (time>=Game.fps && detail<5) str='1 second'; + return str; + } + + Game.UpdateMenu=function() + { + var str=''; + if (Game.onMenu!='') + { + str+='
X
'; + } + if (Game.onMenu=='prefs') + { + str+='
Menu
'+ + '
'+ + '
General
'+ + '
Save
'+ + '
Export saveImport save
'+ + //'
[Note : importing saves from earlier versions than 1.0 will be disabled beyond September 1st, 2013.]
'+ + '
Reset
'+ + '
Wipe save
'+ + '
Settings
'+ + '
'+ + Game.WriteButton('fancy','fancyButton','Fancy graphics ON','Fancy graphics OFF','Game.ToggleFancy();')+ + Game.WriteButton('particles','particlesButton','Particles ON','Particles OFF')+ + Game.WriteButton('numbers','numbersButton','Numbers ON','Numbers OFF')+ + Game.WriteButton('milk','milkButton','Milk ON','Milk OFF')+ + Game.WriteButton('cursors','cursorsButton','Cursors ON','Cursors OFF')+ + '
'+ + '
'+Game.WriteButton('autoupdate','autoupdateButton','Offline mode OFF','Offline mode ON')+'
'+ '
'+Game.WriteButton('warn','warnButton','Closing warning ON','Closing warning OFF')+'
'+ + //'
'+Game.WriteButton('autosave','autosaveButton','Autosave ON','Autosave OFF')+'
'+ + (1==2?( + '
Customization
'+ + '
Background'+ + Game.WriteSelector('backgroundType','backgroundType',['Blue background','Red background','White background','Black background'],'Blue background',(Game.backgroundType>0?Game.UpgradesById[Game.backgroundType].name:Game.Upgrades['Blue background'].name))+ + '
' + ):'')+ + '
'+ + '
' + ; + } + else if (Game.onMenu=='main') + { + str+= + '
This isn\'t really finished
'+ + ''+ + ''+ + ''+ + ''+ + ''; + } + else if (Game.onMenu=='log')//might want to make this static someday + { + str+=Game.updateLog; + } + else if (Game.onMenu=='stats') + { + var buildingsOwned=0; + buildingsOwned=Game.BuildingsOwned; + var upgrades=''; + var cookieUpgrades=''; + var hiddenUpgrades=''; + var upgradesTotal=0; + var upgradesOwned=0; + + var list=[]; + for (var i in Game.Upgrades)//sort the upgrades + { + list.push(Game.Upgrades[i]); + } + var sortMap=function(a,b) + { + if (a.order>b.order) return 1; + else if (a.order0) + { + str2+='
'+Beautify(Math.round(me.basePrice))+'
[Upgrade] [Purchased]
'+me.name+'
'+me.desc+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + if (me.hide!=3) upgradesOwned++; + } + } + else + { + str2+='
'+Beautify(Math.round(me.basePrice))+'
[Upgrade]'+(me.bought>0?' [Purchased]':'')+'
'+me.name+'
'+me.desc+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + if (me.hide!=3) upgradesOwned++; + } + if (me.hide!=3) upgradesTotal++; + if (me.debug) hiddenUpgrades+=str2; else if (me.type=='cookie') cookieUpgrades+=str2; else upgrades+=str2; + } + var achievements=[]; + var shadowAchievements=''; + var achievementsOwned=0; + var achievementsTotal=0; + + var list=[]; + for (var i in Game.Achievements)//sort the achievements + { + list.push(Game.Achievements[i]); + } + var sortMap=function(a,b) + { + if (a.order>b.order) return 1; + else if (a.order0) achievementsTotal++; + var category=me.category; + if (!achievements[category]) achievements[category]=''; + + if (me.won>0 && me.hide==3) + { + shadowAchievements+='
[Achievement] [Unlocked]'+(me.hide==3?' [Shadow]':'')+'
'+me.name+'
'+me.desc+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + achievementsOwned++; + } + else if (me.won>0) + { + achievements[category]+='
[Achievement] [Unlocked]'+(me.hide==3?' [Shadow]':'')+'
'+me.name+'
'+me.desc+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + achievementsOwned++; + } + else if (me.hide==0) + { + achievements[category]+='
[Achievement]
'+me.name+'
'+me.desc+'
' + ,'bottom-right')+' style="background-position:'+(-me.icon[0]*48+6)+'px '+(-me.icon[1]*48+6)+'px;">'; + } + else if (me.hide==1) + { + achievements[category]+='
[Achievement]
'+me.name+'
???
' + ,'bottom-right')+' style="background-position:'+(-0*48+6)+'px '+(-7*48+6)+'px;">'; + } + else if (me.hide==2) + { + achievements[category]+='
[Achievement]
???
???
' + ,'bottom-right')+' style="background-position:'+(-0*48+6)+'px '+(-7*48+6)+'px;">'; + } + } + + var achievementsStr=''; + var categories={'dungeon':'Dungeon achievements'}; + for (var i in achievements) + { + if(achievements[i]!='') + { + var cat=i; + if (categories[i]) achievementsStr+='
'+categories[i]+'
'; + achievementsStr+='
'+achievements[i]+'
'; + } + } + + var santaStr=''; + if (Game.Has('A festive hat')) + { + for (var i=0;i<=Game.santaLevel;i++) + { + santaStr+='
'+Game.santaLevels[i]+'
' + ,'bottom-right')+' style="width:96px;height:96px;margin:2px;float:left;background:url(img/santa.png) '+(-i*96)+'px 0px;">'; + } + santaStr+='
'; + } + + var milkName='plain milk'; + if (Game.milkProgress>=4.5) milkName='caramel milk'; + else if (Game.milkProgress>=3.5) milkName='orange juice'; + else if (Game.milkProgress>=2.5) milkName='raspberry milk'; + else if (Game.milkProgress>=1.5) milkName='chocolate milk'; + + var researchStr=Game.sayTime(Game.researchT); + var pledgeStr=Game.sayTime(Game.pledgeT); + var wrathStr=''; + if (Game.elderWrath==1) wrathStr='awoken'; + else if (Game.elderWrath==2) wrathStr='displeased'; + else if (Game.elderWrath==3) wrathStr='angered'; + else if (Game.elderWrath==0 && Game.pledges>0) wrathStr='appeased'; + + var date=new Date(); + date.setTime(new Date().getTime()-Game.startDate); + var startDate=Game.sayTime(date.getTime()/1000*Game.fps,2); + date.setTime(new Date().getTime()-Game.fullDate); + var fullDate=Game.sayTime(date.getTime()/1000*Game.fps,2); + if (!fullDate || fullDate.length<1) fullDate='a long while'; + /*date.setTime(new Date().getTime()-Game.lastDate); + var lastDate=Game.sayTime(date.getTime()/1000*Game.fps,2);*/ + + var heavenlyMult=0; + if (Game.Has('Heavenly chip secret')) heavenlyMult+=5; + if (Game.Has('Heavenly cookie stand')) heavenlyMult+=20; + if (Game.Has('Heavenly bakery')) heavenlyMult+=25; + if (Game.Has('Heavenly confectionery')) heavenlyMult+=25; + if (Game.Has('Heavenly key')) heavenlyMult+=25; + + str+='
Statistics
'+ + '
'+ + '
General
'+ + '
Cookies in bank :
'+Beautify(Game.cookies)+'
'+ + '
Cookies baked (this game) :
'+Beautify(Game.cookiesEarned)+'
'+ + '
Cookies baked (all time) :
'+Beautify(Game.cookiesEarned+Game.cookiesReset)+'
'+ + (Game.cookiesReset>0?'
Cookies forfeited by resetting :
'+Beautify(Game.cookiesReset)+'
':'')+ + (Game.resets?('
Legacy started : '+fullDate+' ago, with '+Beautify(Game.resets)+' reset'+(Game.resets==1?'':'s')+'
'):'')+ + '
Session started : '+startDate+' ago
'+ + '
Buildings owned : '+Beautify(buildingsOwned)+'
'+ + '
Cookies per second : '+Beautify(Game.cookiesPs,1)+' '+ + '(multiplier : '+Beautify(Math.round(Game.globalCpsMult*100),1)+'%)'+ + (Game.cpsSucked>0?' (withered : '+Beautify(Math.round(Game.cpsSucked*100),1)+'%)':'')+ + '
'+ + '
Cookies per click : '+Beautify(Game.computedMouseCps,1)+'
'+ + '
Cookie clicks : '+Beautify(Game.cookieClicks)+'
'+ + '
Hand-made cookies : '+Beautify(Game.handmadeCookies)+'
'+ + '
Golden cookie clicks : '+Beautify(Game.goldenClicksLocal)+' (all time : '+Beautify(Game.goldenClicks)+')
'+//'
'+ + '
Running version : '+Game.version+'
'+ + + ((researchStr!='' || wrathStr!='' || pledgeStr!='' || santaStr!='')?( + '
'+ + '
Special
'+ + (researchStr!=''?'
Research : '+researchStr+' remaining
':'')+ + (wrathStr!=''?'
Grandmatriarchs status : '+wrathStr+'
':'')+ + (pledgeStr!=''?'
Pledge : '+pledgeStr+' remaining
':'')+ + (Game.wrinklersPopped>0?'
Wrinklers popped : '+Beautify(Game.wrinklersPopped)+'
':'')+ + //(Game.cookiesSucked>0?'
Withered : '+Beautify(Game.cookiesSucked)+' cookies
':'')+ + (Game.reindeerClicked>0?'
Reindeer found : '+Beautify(Game.reindeerClicked)+'
':'')+ + (santaStr!=''?'
Santa stages unlocked :
'+santaStr+'
':'')+ + '' + ):'')+ + + (Game.prestige['Heavenly chips']>0?( + '
'+ + '
Prestige
'+ + '
(Note : each heavenly chip grants you +2% CpS multiplier. You can gain more chips by resetting with a lot of cookies.)
'+ + '
'+Game.prestige['Heavenly chips']+' heavenly chip'+(Game.prestige['Heavenly chips']==1?'':'s')+' at '+heavenlyMult+'% of their potential (+'+Beautify(Game.prestige['Heavenly chips']*2*heavenlyMult/100,1)+'% CpS)
'):'')+ + + '
'+ + '
Upgrades unlocked
'+ + '
Unlocked : '+upgradesOwned+'/'+upgradesTotal+' ('+Math.round((upgradesOwned/upgradesTotal)*100)+'%)
'+ + '
'+upgrades+'
'+ + (cookieUpgrades!=''?('
Cookies
'+ + '
'+cookieUpgrades+'
'):'')+ + (hiddenUpgrades!=''?('
Debug
'+ + '
'+hiddenUpgrades+'
'):'')+ + '
'+ + '
Achievements
'+ + '
Unlocked : '+achievementsOwned+'/'+achievementsTotal+' ('+Math.round((achievementsOwned/achievementsTotal)*100)+'%)
'+ + '
Milk : '+Math.round(Game.milkProgress*100)+'% ('+milkName+') (Note : you gain milk through achievements. Milk can unlock unique upgrades over time.)
'+ + achievementsStr+ + (shadowAchievements!=''?( + '
Shadow achievements (These are feats that are either unfair or difficult to attain. They do not give milk.)
'+ + '
'+shadowAchievements+'
' + ):'')+ + '
'+ + '
' + ; + } + l('menu').innerHTML=str; + } + + AddEvent(l('prefsButton'),'click',function(){Game.ShowMenu('prefs');}); + AddEvent(l('statsButton'),'click',function(){Game.ShowMenu('stats');}); + AddEvent(l('logButton'),'click',function(){Game.ShowMenu('log');}); + + Game.lastPanel=''; + AddEvent(l('focusLeft'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Left');}); + AddEvent(l('focusMiddle'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Middle');}); + AddEvent(l('focusRight'),'click',function(){Game.ShowMenu('');Game.ShowPanel('Right');}); + AddEvent(l('focusMenu'),'click',function(){Game.ShowMenu('main');Game.ShowPanel('Menu');}); + //AddEvent(l('focusMenu'),'click',function(){if (Game.onPanel=='Menu' && Game.lastPanel!='') {Game.ShowMenu('main');Game.ShowPanel(Game.lastPanel);} else {Game.lastPanel=Game.onPanel;Game.ShowMenu('main');Game.ShowPanel('Menu');}}); + + /*===================================================================================== + TOOLTIP + =======================================================================================*/ + Game.tooltip={text:'',x:0,y:0,origin:0,on:0}; + Game.tooltip.draw=function(from,text,x,y,origin) + { + this.text=text; + this.x=x; + this.y=y; + this.origin=origin; + var tt=l('tooltip'); + var tta=l('tooltipAnchor'); + tta.style.display='block'; + tt.style.left='auto'; + tt.style.top='auto'; + tt.style.right='auto'; + tt.style.bottom='auto'; + if (this.origin=='left' || 1) + { + tt.style.right='8px'; + tt.style.top='8px'; + } + else if (this.origin=='bottom-right') + { + tt.style.right='8px'; + tt.style.top='8px'; + } + + tt.innerHTML=unescape(text); + this.on=1; + } + Game.tooltip.update=function() + { + var tt=l('tooltip'); + var tta=l('tooltipAnchor'); + tta.style.left=Game.mouseX+'px'; + tta.style.top=Game.mouseY+'px'; + } + Game.tooltip.hide=function() + { + l('tooltipAnchor').style.display='none'; + this.on=0; + } + Game.getTooltip=function(text,origin) + { + origin=(origin?origin:'middle'); + return 'onMouseOut="Game.tooltip.hide();" onMouseOver="Game.tooltip.draw(this,\''+escape(text)+'\',\''+origin+'\');"'; + } + + /*===================================================================================== + NEWS TICKER + =======================================================================================*/ + Game.Ticker=''; + Game.TickerAge=0; + Game.TickerN=0; + Game.getNewTicker=function() + { + var list=[]; + + if (Game.TickerN%2==0 || Game.cookiesEarned>=10100000000) + { + if (Game.Objects['Grandma'].amount>0) list.push(choose([ + 'Moist cookies.grandma', + 'We\'re nice grandmas.grandma', + 'Indentured servitude.grandma', + 'Come give grandma a kiss.grandma', + 'Why don\'t you visit more often?grandma', + 'Call me...grandma' + ])); + + if (Game.Objects['Grandma'].amount>=50) list.push(choose([ + 'Absolutely disgusting.grandma', + 'You make me sick.grandma', + 'You disgust me.grandma', + 'We rise.grandma', + 'It begins.grandma', + 'It\'ll all be over soon.grandma', + 'You could have stopped it.grandma' + ])); + + if (Game.HasAchiev('Just wrong')) list.push(choose([ + 'News : cookie manufacturer downsizes, sells own grandmother!', + 'It has betrayed us, the filthy little thing.grandma', + 'It tried to get rid of us, the nasty little thing.grandma', + 'It thought we would go away by selling us. How quaint.grandma', + 'I can smell your rotten cookies.grandma' + ])); + + if (Game.Objects['Grandma'].amount>=1 && Game.pledges>0 && Game.elderWrath==0) list.push(choose([ + 'shrivelgrandma', + 'writhegrandma', + 'throbgrandma', + 'gnawgrandma', + 'We will rise again.grandma', + 'A mere setback.grandma', + 'We are not satiated.grandma', + 'Too late.grandma' + ])); + + if (Game.Objects['Farm'].amount>0) list.push(choose([ + 'News : cookie farms suspected of employing undeclared elderly workforce!', + 'News : cookie farms release harmful chocolate in our rivers, says scientist!', + 'News : genetically-modified chocolate controversy strikes cookie farmers!', + 'News : free-range farm cookies popular with today\'s hip youth, says specialist.', + 'News : farm cookies deemed unfit for vegans, says nutritionist.' + ])); + + if (Game.Objects['Factory'].amount>0) list.push(choose([ + 'News : cookie factories linked to global warming!', + 'News : cookie factories involved in chocolate weather controversy!', + 'News : cookie factories on strike, robotic minions employed to replace workforce!', + 'News : cookie factories on strike - workers demand to stop being paid in cookies!', + 'News : factory-made cookies linked to obesity, says study.' + ])); + + if (Game.Objects['Mine'].amount>0) list.push(choose([ + 'News : '+Math.floor(Math.random()*1000+2)+' miners dead in chocolate mine catastrophe!', + 'News : '+Math.floor(Math.random()*1000+2)+' miners trapped in collapsed chocolate mine!', + 'News : chocolate mines found to cause earthquakes and sink holes!', + 'News : chocolate mine goes awry, floods village in chocolate!', + 'News : depths of chocolate mines found to house "peculiar, chocolaty beings"!' + ])); + + if (Game.Objects['Shipment'].amount>0) list.push(choose([ + 'News : new chocolate planet found, becomes target of cookie-trading spaceships!', + 'News : massive chocolate planet found with 99.8% certified pure dark chocolate core!', + 'News : space tourism booming as distant planets attract more bored millionaires!', + 'News : chocolate-based organisms found on distant planet!', + 'News : ancient baking artifacts found on distant planet; "terrifying implications", experts say.' + ])); + + if (Game.Objects['Alchemy lab'].amount>0) list.push(choose([ + 'News : national gold reserves dwindle as more and more of the precious mineral is turned to cookies!', + 'News : chocolate jewelry found fashionable, gold and diamonds "just a fad", says specialist.', + 'News : silver found to also be transmutable into white chocolate!', + 'News : defective alchemy lab shut down, found to convert cookies to useless gold.', + 'News : alchemy-made cookies shunned by purists!' + ])); + + if (Game.Objects['Portal'].amount>0) list.push(choose([ + 'News : nation worried as more and more unsettling creatures emerge from dimensional portals!', + 'News : dimensional portals involved in city-engulfing disaster!', + 'News : tourism to cookieverse popular with bored teenagers! Casualty rate as high as 73%!', + 'News : cookieverse portals suspected to cause fast aging and obsession with baking, says study.', + 'News : "do not settle near portals," says specialist; "your children will become strange and corrupted inside."' + ])); + + if (Game.Objects['Time machine'].amount>0) list.push(choose([ + 'News : time machines involved in history-rewriting scandal! Or are they?', + 'News : time machines used in unlawful time tourism!', + 'News : cookies brought back from the past "unfit for human consumption", says historian.', + 'News : various historical figures inexplicably replaced with talking lumps of dough!', + 'News : "I have seen the future," says time machine operator, "and I do not wish to go there again."' + ])); + + if (Game.Objects['Antimatter condenser'].amount>0) list.push(choose([ + 'News : whole town seemingly swallowed by antimatter-induced black hole; more reliable sources affirm town "never really existed"!', + 'News : "explain to me again why we need particle accelerators to bake cookies?" asks misguided local woman.', + 'News : first antimatter condenser successfully turned on, doesn\'t rip apart reality!', + 'News : researchers conclude that what the cookie industry needs, first and foremost, is "more magnets".', + 'News : "unravelling the fabric of reality just makes these cookies so much tastier", claims scientist.' + ])); + + if (Game.season=='halloween' && Game.cookiesEarned>=1000) list.push(choose([ + 'News : strange twisting creatures amass around cookie factories, nibble at assembly lines.', + 'News : ominous wrinkly monsters take massive bites out of cookie production; "this can\'t be hygienic", worries worker.', + 'News : pagan rituals on the rise as children around the world dress up in strange costumes and blackmail homeowners for candy.', + 'News : new-age terrorism strikes suburbs as houses find themselves covered in eggs and toilet paper.', + 'News : children around the world "lost and confused" as any and all Halloween treats have been replaced by cookies.' + ])); + + if (Game.season=='christmas' && Game.cookiesEarned>=1000) list.push(choose([ + 'News : bearded maniac spotted speeding on flying sleigh! Investigation pending.', + 'News : Santa Claus announces new brand of breakfast treats to compete with cookie-flavored cereals! "They\'re ho-ho-horrible!" says Santa.', + 'News : "You mean he just gives stuff away for free?!", concerned moms ask. "Personally, I don\'t trust his beard."', + 'News : obese jolly lunatic still on the loose, warn officials. "Keep your kids safe and board up your chimneys. We mean it."', + 'News : children shocked as they discover Santa Claus isn\'t just their dad in a costume after all!
"I\'m reassessing my life right now", confides Laura, aged 6.', + 'News : mysterious festive entity with quantum powers still wrecking havoc with army of reindeer, officials say.', + 'News : elves on strike at toy factory! "We will not be accepting reindeer chow as payment anymore. And stop calling us elves!"', + 'News : elves protest around the nation; wee little folks in silly little outfits spread mayhem, destruction; rabid reindeer running rampant through streets.', + 'News : scholars debate regarding the plural of reindeer(s) in the midst of elven world war.', + 'News : elves "unrelated to gnomes despite small stature and merry disposition", find scientists.', + 'News : elves sabotage radioactive frosting factory, turn hundreds blind in vincinity - "Who in their right mind would do such a thing?" laments outraged mayor.', + 'News : drama unfolds at North Pole as rumors crop up around Rudolph\'s red nose; "I may have an addiction or two", admits reindeer.' + ])); + + if (Game.HasAchiev('Base 10')) list.push('News : cookie manufacturer completely forgoes common sense, lets OCD drive building decisions!'); + if (Game.HasAchiev('From scratch')) list.push('News : follow the tear-jerking, riches-to-rags story about a local cookie manufacturer who decided to give it all up!'); + if (Game.HasAchiev('A world filled with cookies')) list.push('News : known universe now jammed with cookies! No vacancies!'); + if (Game.HasAchiev('Serendipity')) list.push('News : local cookie manufacturer becomes luckiest being alive!'); + + if (Game.Has('Kitten helpers')) list.push('News : faint meowing heard around local cookie facilities; suggests new ingredient being tested.'); + if (Game.Has('Kitten workers')) list.push('News : crowds of meowing kittens with little hard hats reported near local cookie facilities.'); + if (Game.Has('Kitten engineers')) list.push('News : surroundings of local cookie facilities now overrun with kittens in adorable little suits. Authorities advise to stay away from the premises.'); + if (Game.Has('Kitten overseers')) list.push('News : locals report troupe of bossy kittens meowing adorable orders at passersby.'); + + 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']; + if (Game.cookiesEarned>=10000) list.push( + 'News : '+choose([ + 'cookies found to '+choose(['increase lifespan','sensibly increase intelligence','reverse aging','decrease hair loss','prevent arthritis','cure blindness'])+' in '+choose(animals)+'!', + 'cookies found to make '+choose(animals)+' '+choose(['more docile','more handsome','nicer','less hungry','more pragmatic','tastier'])+'!', + 'cookies tested on '+choose(animals)+', found to have no ill effects.', + 'cookies unexpectedly popular among '+choose(animals)+'!', + 'unsightly lumps found on '+choose(animals)+' near cookie facility; "they\'ve pretty much always looked like that", say biologists.', + 'new species of '+choose(animals)+' discovered in distant country; "yup, tastes like cookies", says biologist.', + 'cookies go well with roasted '+choose(animals)+', says controversial chef.', + '"do your cookies contain '+choose(animals)+'?", asks PSA warning against counterfeit cookies.' + ]), + 'News : "'+choose([ + 'I\'m all about cookies', + 'I just can\'t stop eating cookies. I think I seriously need help', + 'I guess I have a cookie problem', + 'I\'m not addicted to cookies. That\'s just speculation by fans with too much free time', + 'my upcoming album contains 3 songs about cookies', + 'I\'ve had dreams about cookies 3 nights in a row now. I\'m a bit worried honestly', + 'accusations of cookie abuse are only vile slander', + 'cookies really helped me when I was feeling low', + 'cookies are the secret behind my perfect skin', + 'cookies helped me stay sane while filming my upcoming movie', + 'cookies helped me stay thin and healthy', + 'I\'ll say one word, just one : cookies', + 'alright, I\'ll say it - I\'ve never eaten a single cookie in my life' + ])+'", reveals celebrity.', + 'News : '+choose(['doctors recommend twice-daily consumption of fresh cookies.','doctors warn against chocolate chip-snorting teen fad.','doctors advise against new cookie-free fad diet.','doctors warn mothers about the dangers of "home-made cookies".']), + choose([ + 'News : scientist predicts imminent cookie-related "end of the world"; becomes joke among peers.', + 'News : man robs bank, buys cookies.', + 'News : scientists establish that the deal with airline food is, in fact, a critical lack of cookies.', + 'News : hundreds of tons of cookies dumped into starving country from airplanes; thousands dead, nation grateful.', + 'News : new study suggests cookies neither speed up nor slow down aging, but instead "take you in a different direction".', + 'News : overgrown cookies found in fishing nets, raise questions about hormone baking.', + 'News : "all-you-can-eat" cookie restaurant opens in big city; waiters trampled in minutes.', + 'News : man dies in cookie-eating contest; "a less-than-impressive performance", says judge.', + 'News : what makes cookies taste so right? "Probably all the [*****] they put in them", says anonymous tipper.', + 'News : man found allergic to cookies; "what a weirdo", says family.', + 'News : foreign politician involved in cookie-smuggling scandal.', + 'News : cookies now more popular than '+choose(['cough drops','broccoli','smoked herring','cheese','video games','stable jobs','relationships','time travel','cat videos','tango','fashion','television','nuclear warfare','whatever it is we ate before','politics','oxygen','lamps'])+', says study.', + 'News : obesity epidemic strikes nation; experts blame '+choose(['twerking','that darn rap music','video-games','lack of cookies','mysterious ghostly entities','aliens','parents','schools','comic-books','cookie-snorting fad'])+'.', + 'News : cookie shortage strikes town, people forced to eat cupcakes; "just not the same", concedes mayor.', + 'News : "you gotta admit, all this cookie stuff is a bit ominous", says confused idiot.', + 'News : movie cancelled from lack of actors; "everybody\'s at home eating cookies", laments director.', + 'News : comedian forced to cancel cookie routine due to unrelated indigestion.', + 'News : new cookie-based religion sweeps the nation.', + 'News : fossil records show cookie-based organisms prevalent during Cambrian explosion, scientists say.', + 'News : mysterious illegal cookies seized; "tastes terrible", says police.', + 'News : man found dead after ingesting cookie; investigators favor "mafia snitch" hypothesis.', + 'News : "the universe pretty much loops on itself," suggests researcher; "it\'s cookies all the way down."', + 'News : minor cookie-related incident turns whole town to ashes; neighboring cities asked to chip in for reconstruction.', + 'News : is our media controlled by the cookie industry? This could very well be the case, says crackpot conspiracy theorist.', + 'News : '+choose(['cookie-flavored popcorn pretty damn popular; "we kinda expected that", say scientists.','cookie-flavored cereals break all known cereal-related records','cookies popular among all age groups, including fetuses, says study.','cookie-flavored popcorn sales exploded during screening of Grandmothers II : The Moistening.']), + 'News : all-cookie restaurant opening downtown. Dishes such as braised cookies, cookie thermidor, and for dessert : crepes.', + 'News : cookies could be the key to '+choose(['eternal life','infinite riches','eternal youth','eternal beauty','curing baldness','world peace','solving world hunger','ending all wars world-wide','making contact with extraterrestrial life','mind-reading','better living','better eating','more interesting TV shows','faster-than-light travel','quantum baking','chocolaty goodness','gooder thoughtness'])+', say scientists.', + 'News : flavor text '+choose(["not particularly flavorful","kind of unsavory"])+', study finds.', + 'News : what do golden cookies taste like? Study reveals a flavor "somewhere between spearmint and liquorice".', + 'News : what do red cookies taste like? Study reveals a flavor "somewhere between blood sausage and seawater".' + ]) + ); + } + + if (list.length==0) + { + if (Game.cookiesEarned<5) list.push('You feel like making cookies. But nobody wants to eat your cookies.'); + else if (Game.cookiesEarned<50) list.push('Your first batch goes to the trash. The neighborhood raccoon barely touches it.'); + else if (Game.cookiesEarned<100) list.push('Your family accepts to try some of your cookies.'); + else if (Game.cookiesEarned<500) list.push('Your cookies are popular in the neighborhood.'); + else if (Game.cookiesEarned<1000) list.push('People are starting to talk about your cookies.'); + else if (Game.cookiesEarned<3000) list.push('Your cookies are talked about for miles around.'); + else if (Game.cookiesEarned<6000) list.push('Your cookies are renowned in the whole town!'); + else if (Game.cookiesEarned<10000) list.push('Your cookies bring all the boys to the yard.'); + else if (Game.cookiesEarned<20000) list.push('Your cookies now have their own website!'); + else if (Game.cookiesEarned<30000) list.push('Your cookies are worth a lot of money.'); + else if (Game.cookiesEarned<40000) list.push('Your cookies sell very well in distant countries.'); + else if (Game.cookiesEarned<60000) list.push('People come from very far away to get a taste of your cookies.'); + else if (Game.cookiesEarned<80000) list.push('Kings and queens from all over the world are enjoying your cookies.'); + else if (Game.cookiesEarned<100000) list.push('There are now museums dedicated to your cookies.'); + else if (Game.cookiesEarned<200000) list.push('A national day has been created in honor of your cookies.'); + else if (Game.cookiesEarned<300000) list.push('Your cookies have been named a part of the world wonders.'); + else if (Game.cookiesEarned<450000) list.push('History books now include a whole chapter about your cookies.'); + else if (Game.cookiesEarned<600000) list.push('Your cookies have been placed under government surveillance.'); + else if (Game.cookiesEarned<1000000) list.push('The whole planet is enjoying your cookies!'); + else if (Game.cookiesEarned<5000000) list.push('Strange creatures from neighboring planets wish to try your cookies.'); + else if (Game.cookiesEarned<10000000) list.push('Elder gods from the whole cosmos have awoken to taste your cookies.'); + else if (Game.cookiesEarned<30000000) list.push('Beings from other dimensions lapse into existence just to get a taste of your cookies.'); + else if (Game.cookiesEarned<100000000) list.push('Your cookies have achieved sentience.'); + else if (Game.cookiesEarned<300000000) list.push('The universe has now turned into cookie dough, to the molecular level.'); + else if (Game.cookiesEarned<1000000000) list.push('Your cookies are rewriting the fundamental laws of the universe.'); + else if (Game.cookiesEarned<10000000000) list.push('A local news station runs a 10-minute segment about your cookies. Success!
(you win a cookie)'); + else if (Game.cookiesEarned<10100000000) list.push('it\'s time to stop playing');//only show this for 100 millions (it's funny for a moment) + } + + if (Game.elderWrath>0 && (Game.pledges==0 || Math.random()<0.5)) + { + list=[]; + if (Game.elderWrath==1) list.push(choose([ + 'News : millions of old ladies reported missing!', + 'News : processions of old ladies sighted around cookie facilities!', + 'News : families around the continent report agitated, transfixed grandmothers!', + 'News : doctors swarmed by cases of old women with glassy eyes and a foamy mouth!', + 'News : nurses report "strange scent of cookie dough" around female elderly patients!' + ])); + if (Game.elderWrath==2) list.push(choose([ + 'News : town in disarray as strange old ladies break into homes to abduct infants and baking utensils!', + 'News : sightings of old ladies with glowing eyes terrify local population!', + 'News : retirement homes report "female residents slowly congealing in their seats"!', + 'News : whole continent undergoing mass exodus of old ladies!', + 'News : old women freeze in place in streets, ooze warm sugary syrup!' + ])); + if (Game.elderWrath==3) list.push(choose([ + 'News : large "flesh highways" scar continent, stretch between various cookie facilities!', + 'News : wrinkled "flesh tendrils" visible from space!', + 'News : remains of "old ladies" found frozen in the middle of growing fleshy structures!', + 'News : all hope lost as writhing mass of flesh and dough engulfs whole city!', + 'News : nightmare continues as wrinkled acres of flesh expand at alarming speeds!' + ])); + } + + Game.TickerAge=Game.fps*10; + Game.Ticker=choose(list); + Game.TickerN++; + } + Game.TickerDraw=function() + { + var str=''; + var o=0; + if (Game.Ticker!='') + { + if (Game.TickerAgeadd 1,000 | add 1,000,000'; + } + + /*===================================================================================== + BUILDINGS + =======================================================================================*/ + Game.storeToRebuild=1; + Game.priceIncrease=1.15; + + Game.Objects=[]; + Game.ObjectsById=[]; + Game.ObjectsN=0; + Game.BuildingsOwned=0; + Game.Object=function(name,commonName,desc,pic,icon,background,price,cps,drawFunction,buyFunction) + { + this.id=Game.ObjectsN; + this.name=name; + this.displayName=this.name; + commonName=commonName.split('|'); + this.single=commonName[0]; + this.plural=commonName[1]; + this.actionName=commonName[2]; + this.desc=desc; + this.basePrice=price; + this.price=this.basePrice; + this.cps=cps; + this.totalCookies=0; + this.storedCps=0; + this.storedTotalCps=0; + this.pic=pic; + this.icon=icon; + this.background=background; + this.buyFunction=buyFunction; + this.drawFunction=drawFunction; + + 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. + this.onSpecial=0;//are we on this object's special screen (dungeons etc)? + this.specialUnlocked=0; + this.specialDrawFunction=null; + this.drawSpecialButton=null; + + this.amount=0; + this.bought=0; + + this.getPrice=function() + { + var price=this.basePrice*Math.pow(Game.priceIncrease,this.amount); + if (Game.Has('Season savings')) price*=0.99; + if (Game.Has('Santa\'s dominion')) price*=0.99; + return Math.ceil(price); + } + + this.buy=function() + { + var price=this.getPrice(); + if (Game.cookies>=price) + { + Game.Spend(price); + this.amount++; + this.bought++; + price=this.getPrice(); + this.price=price; + if (this.buyFunction) this.buyFunction(); + if (this.drawFunction) this.drawFunction(); + Game.storeToRebuild=1; + Game.recalculateGains=1; + if (this.amount==1 && this.id!=0) l('row'+this.id).className='row enabled'; + Game.BuildingsOwned++; + } + } + this.sell=function() + { + var price=this.getPrice(); + price=Math.floor(price*0.5); + if (this.amount>0) + { + //Game.Earn(price); + Game.cookies+=price; + this.amount--; + price=this.getPrice(); + this.price=price; + if (this.sellFunction) this.sellFunction(); + if (this.drawFunction) this.drawFunction(); + Game.storeToRebuild=1; + Game.recalculateGains=1; + Game.BuildingsOwned--; + } + } + + this.setSpecial=function(what)//change whether we're on the special overlay for this object or not + { + if (what==1) this.onSpecial=1; + else this.onSpecial=0; + if (this.id!=0) + { + if (this.onSpecial) + { + l('rowSpecial'+this.id).style.display='block'; + if (this.specialDrawFunction) this.specialDrawFunction(); + } + else + { + l('rowSpecial'+this.id).style.display='none'; + if (this.drawFunction) this.drawFunction(); + } + } + } + this.unlockSpecial=function() + { + if (this.specialUnlocked==0) + { + this.specialUnlocked=1; + this.setSpecial(0); + if (this.special) this.special(); + this.refresh(); + } + } + + this.refresh=function() + { + this.price=this.getPrice(); + if (this.amount==0 && this.id!=0) l('row'+this.id).className='row'; + else if (this.amount>0 && this.id!=0) l('row'+this.id).className='row enabled'; + if (this.drawFunction && !this.onSpecial) this.drawFunction(); + //else if (this.specialDrawFunction && this.onSpecial) this.specialDrawFunction(); + } + + if (this.id!=0)//draw it + { + var str=''; + l('rows').innerHTML=l('rows').innerHTML+str; + } + + Game.Objects[this.name]=this; + Game.ObjectsById[this.id]=this; + Game.ObjectsN++; + return this; + } + + Game.NewDrawFunction=function(pic,xVariance,yVariance,w,shift,heightOffset) + { + //pic : either 0 (the default picture will be used), a filename (will be used as override), or a function to determine a filename + //xVariance : the pictures will have a random horizontal shift by this many pixels + //yVariance : the pictures will have a random vertical shift by this many pixels + //w : how many pixels between each picture (or row of pictures) + //shift : if >1, arrange the pictures in rows containing this many pictures + //heightOffset : the pictures will be displayed at this height, +32 pixels + return function() + { + if (pic==0 && typeof(pic)!='function') pic=this.pic; + shift=shift || 1; + heightOffset=heightOffset || 0; + var bgW=0; + var str=''; + var offX=0; + var offY=0; + + if (this.drawSpecialButton && this.specialUnlocked) + { + l('rowSpecialButton'+this.id).style.display='block'; + l('rowSpecialButton'+this.id).innerHTML=this.drawSpecialButton(); + str+='
'+this.drawSpecialButton()+'
'; + l('rowInfo'+this.id).style.paddingLeft=(8+128)+'px'; + offX+=128; + } + + for (var i=0;i'; + bgW=Math.max(bgW,x+64); + } + bgW+=offX; + l('rowObjects'+this.id).innerHTML=str; + l('rowBackground'+this.id).style.width=bgW+'px'; + } + } + + Game.RefreshBuildings=function() + { + for (var i in Game.Objects) + { + var me=Game.Objects[i]; + me.refresh(); + } + Game.storeToRebuild=1; + } + + Game.RebuildStore=function()//redraw the store from scratch + { + Game.RefreshBuildings(); + var str=''; + for (var i in Game.Objects) + { + var me=Game.Objects[i]; + str+='
'+Beautify(Math.round(me.price))+'
'+me.name+'
'+'[owned : '+me.amount+']
'+me.desc+'
' + ,'left')+' id="product'+me.id+'">
'+me.displayName+'
'+Beautify(Math.round(me.price))+''+(me.amount>0?('
'+me.amount+'
'):'')+'
'; + } + l('products').innerHTML=str; + for (var i in Game.Objects) + { + // onclick="Game.ObjectsById['+me.id+'].buy();" + var me=Game.Objects[i]; + AddEvent(l('product'+me.id),'click',function(what){return function(){Game.ObjectsById[what].buy()};}(me.id)); + } + Game.storeToRebuild=0; + } + + Game.ComputeCps=function(base,add,mult,bonus) + { + if (!bonus) bonus=0; + return ((base+add)*(Math.pow(2,mult))+bonus); + } + + //define objects + new Game.Object('Cursor','cursor|cursors|clicked','Autoclicks once every 10 seconds.','cursor','cursoricon','',15,function(){ + var add=0; + if (Game.Has('Thousand fingers')) add+=0.1; + if (Game.Has('Million fingers')) add+=0.5; + if (Game.Has('Billion fingers')) add+=2; + if (Game.Has('Trillion fingers')) add+=10; + if (Game.Has('Quadrillion fingers')) add+=20; + if (Game.Has('Quintillion fingers')) add+=100; + if (Game.Has('Sextillion fingers')) add+=200; + var num=0; + for (var i in Game.Objects) {if (Game.Objects[i].name!='Cursor') num+=Game.Objects[i].amount;} + add=add*num; + return Game.ComputeCps(0.1,Game.Has('Reinforced index finger')*0.1,Game.Has('Carpal tunnel prevention cream')+Game.Has('Ambidextrous'),add); + },function(){//draw function for cursors + /* + var str=''; + for (var i=0;i'; + + } + l('cookieCursors').innerHTML=str; + */ + if (!l('rowInfo'+this.id)) l('sectionLeftInfo').innerHTML=''; + },function(){ + if (this.amount>=1) Game.Unlock(['Reinforced index finger','Carpal tunnel prevention cream']); + if (this.amount>=10) Game.Unlock('Ambidextrous'); + if (this.amount>=20) Game.Unlock('Thousand fingers'); + if (this.amount>=40) Game.Unlock('Million fingers'); + if (this.amount>=80) Game.Unlock('Billion fingers'); + if (this.amount>=120) Game.Unlock('Trillion fingers'); + if (this.amount>=160) Game.Unlock('Quadrillion fingers'); + if (this.amount>=200) Game.Unlock('Quintillion fingers'); + if (this.amount>=240) Game.Unlock('Sextillion fingers'); + + 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'); + }); + + Game.SpecialGrandmaUnlock=15; + new Game.Object('Grandma','grandma|grandmas|baked','A nice grandma to bake more cookies.','grandma','grandmaIcon','grandmaBackground',100,function(){ + var mult=0; + if (Game.Has('Farmer grandmas')) mult++; + if (Game.Has('Worker grandmas')) mult++; + if (Game.Has('Miner grandmas')) mult++; + if (Game.Has('Cosmic grandmas')) mult++; + if (Game.Has('Transmuted grandmas')) mult++; + if (Game.Has('Altered grandmas')) mult++; + if (Game.Has('Grandmas\' grandmas')) mult++; + if (Game.Has('Antigrandmas')) mult++; + if (Game.Has('Bingo center/Research facility')) mult+=2; + if (Game.Has('Ritual rolling pins')) mult++; + if (Game.Has('Naughty list')) mult++; + var add=0; + if (Game.Has('One mind')) add+=Game.Objects['Grandma'].amount*0.02; + if (Game.Has('Communal brainsweep')) add+=Game.Objects['Grandma'].amount*0.02; + if (Game.Has('Elder Pact')) add+=Game.Objects['Portal'].amount*0.05; + 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')+Game.Has('Double-thick glasses')+mult); + },Game.NewDrawFunction(function(){ + var list=['grandma']; + if (Game.Has('Farmer grandmas')) list.push('farmerGrandma'); + if (Game.Has('Worker grandmas')) list.push('workerGrandma'); + if (Game.Has('Miner grandmas')) list.push('minerGrandma'); + if (Game.Has('Cosmic grandmas')) list.push('cosmicGrandma'); + if (Game.Has('Transmuted grandmas')) list.push('transmutedGrandma'); + if (Game.Has('Altered grandmas')) list.push('alteredGrandma'); + if (Game.Has('Grandmas\' grandmas')) list.push('grandmasGrandma'); + if (Game.Has('Antigrandmas')) list.push('antiGrandma'); + if (Game.season=='christmas') list.push('elfGrandma'); + return choose(list); + },8,8,32,3,16),function(){ + 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');if (this.amount>=100) Game.Unlock('Double-thick glasses'); + if (this.amount>=1) Game.Win('Grandma\'s cookies');if (this.amount>=50) Game.Win('Sloppy kisses');if (this.amount>=100) Game.Win('Retirement home');if (this.amount>=150) Game.Win('Friend of the ancients');if (this.amount>=200) Game.Win('Ruler of the ancients'); + }); + Game.Objects['Grandma'].sellFunction=function() + { + Game.Win('Just wrong'); + if (this.amount==0) + { + Game.Lock('Elder Pledge'); + Game.CollectWrinklers(); + Game.pledgeT=0; + } + }; + + + + new Game.Object('Farm','farm|farms|harvested','Grows cookie plants from cookie seeds.','farm','farmIcon','farmBackground',500,function(){ + return Game.ComputeCps(4,Game.Has('Cheap hoes')*1,Game.Has('Fertilizer')+Game.Has('Cookie trees')+Game.Has('Genetically-modified cookies')+Game.Has('Gingerbread scarecrows')); + },Game.NewDrawFunction(0,16,16,64,2,32),function(){ + if (this.amount>=1) Game.Unlock(['Cheap hoes','Fertilizer']);if (this.amount>=10) Game.Unlock('Cookie trees');if (this.amount>=50) Game.Unlock('Genetically-modified cookies');if (this.amount>=100) Game.Unlock('Gingerbread scarecrows'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Farmer grandmas'); + 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'); + }); + + new Game.Object('Factory','factory|factories|mass-produced','Produces large quantities of cookies.','factory','factoryIcon','factoryBackground',3000,function(){ + return Game.ComputeCps(10,Game.Has('Sturdier conveyor belts')*4,Game.Has('Child labor')+Game.Has('Sweatshop')+Game.Has('Radium reactors')+Game.Has('Recombobulators')); + },Game.NewDrawFunction(0,32,2,64,1,-22),function(){ + 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');if (this.amount>=100) Game.Unlock('Recombobulators'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Worker grandmas'); + if (this.amount>=1) Game.Win('Production chain');if (this.amount>=50) Game.Win('Industrial revolution');if (this.amount>=100) Game.Win('Global warming'); + }); + + new Game.Object('Mine','mine|mines|mined','Mines out cookie dough and chocolate chips.','mine','mineIcon','mineBackground',10000,function(){ + return Game.ComputeCps(40,Game.Has('Sugar gas')*10,Game.Has('Megadrill')+Game.Has('Ultradrill')+Game.Has('Ultimadrill')+Game.Has('H-bomb mining')); + },Game.NewDrawFunction(0,16,16,64,2,24),function(){ + if (this.amount>=1) Game.Unlock(['Sugar gas','Megadrill']);if (this.amount>=10) Game.Unlock('Ultradrill');if (this.amount>=50) Game.Unlock('Ultimadrill');if (this.amount>=100) Game.Unlock('H-bomb mining'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Miner grandmas'); + 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'); + }); + + new Game.Object('Shipment','shipment|shipments|shipped','Brings in fresh cookies from the cookie planet.','shipment','shipmentIcon','shipmentBackground',40000,function(){ + return Game.ComputeCps(100,Game.Has('Vanilla nebulae')*30,Game.Has('Wormholes')+Game.Has('Frequent flyer')+Game.Has('Warp drive')+Game.Has('Chocolate monoliths')); + },Game.NewDrawFunction(0,16,16,64),function(){ + 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');if (this.amount>=100) Game.Unlock('Chocolate monoliths'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Cosmic grandmas'); + if (this.amount>=1) Game.Win('Expedition');if (this.amount>=50) Game.Win('Galactic highway');if (this.amount>=100) Game.Win('Far far away'); + }); + + new Game.Object('Alchemy lab','alchemy lab|alchemy labs|transmuted','Turns gold into cookies!','alchemylab','alchemylabIcon','alchemylabBackground',200000,function(){ + return Game.ComputeCps(400,Game.Has('Antimony')*100,Game.Has('Essence of dough')+Game.Has('True chocolate')+Game.Has('Ambrosia')+Game.Has('Aqua crustulae')); + },Game.NewDrawFunction(0,16,16,64,2,16),function(){ + 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');if (this.amount>=100) Game.Unlock('Aqua crustulae'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Transmuted grandmas'); + if (this.amount>=1) Game.Win('Transmutation');if (this.amount>=50) Game.Win('Transmogrification');if (this.amount>=100) Game.Win('Gold member'); + }); + + new Game.Object('Portal','portal|portals|retrieved','Opens a door to the Cookieverse.','portal','portalIcon','portalBackground',1666666,function(){ + return Game.ComputeCps(6666,Game.Has('Ancient tablet')*1666,Game.Has('Insane oatling workers')+Game.Has('Soul bond')+Game.Has('Sanity dance')+Game.Has('Brane transplant')); + },Game.NewDrawFunction(0,32,32,64,2),function(){ + 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');if (this.amount>=100) Game.Unlock('Brane transplant'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Altered grandmas'); + 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'); + }); + new Game.Object('Time machine','time machine|time machines|recovered','Brings cookies from the past, before they were even eaten.','timemachine','timemachineIcon','timemachineBackground',123456789,function(){ + return Game.ComputeCps(98765,Game.Has('Flux capacitors')*9876,Game.Has('Time paradox resolver')+Game.Has('Quantum conundrum')+Game.Has('Causality enforcer')+Game.Has('Yestermorrow comparators')); + },Game.NewDrawFunction(0,32,32,64,1),function(){ + 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');if (this.amount>=100) Game.Unlock('Yestermorrow comparators'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Grandmas\' grandmas'); + if (this.amount>=1) Game.Win('Time warp');if (this.amount>=50) Game.Win('Alternate timeline');if (this.amount>=100) Game.Win('Rewriting history'); + }); + new Game.Object('Antimatter condenser','antimatter condenser|antimatter condensers|condensed','Condenses the antimatter in the universe into cookies.','antimattercondenser','antimattercondenserIcon','antimattercondenserBackground',3999999999,function(){ + return Game.ComputeCps(999999,Game.Has('Sugar bosons')*99999,Game.Has('String theory')+Game.Has('Large macaron collider')+Game.Has('Big bang bake')+Game.Has('Reverse cyclotrons')); + },Game.NewDrawFunction(0,0,64,64,1),function(){ + 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');if (this.amount>=100) Game.Unlock('Reverse cyclotrons'); + if (this.amount>=Game.SpecialGrandmaUnlock && Game.Objects['Grandma'].amount>0) Game.Unlock('Antigrandmas'); + if (this.amount>=1) Game.Win('Antibatter');if (this.amount>=50) Game.Win('Quirky quarks');if (this.amount>=100) Game.Win('It does matter!'); + }); + Game.Objects['Antimatter condenser'].displayName='Antimatter condenser';//shrink the name since it's so large + + /*===================================================================================== + UPGRADES + =======================================================================================*/ + Game.upgradesToRebuild=1; + Game.Upgrades=[]; + Game.UpgradesById=[]; + Game.UpgradesN=0; + Game.UpgradesInStore=[]; + Game.UpgradesOwned=0; + Game.Upgrade=function(name,desc,price,icon,buyFunction) + { + this.id=Game.UpgradesN; + this.name=name; + this.desc=desc; + this.basePrice=price; + this.icon=icon; + this.buyFunction=buyFunction; + /*this.unlockFunction=unlockFunction; + this.unlocked=(this.unlockFunction?0:1);*/ + this.unlocked=0; + this.bought=0; + this.hide=0;//0=show, 3=hide (1-2 : I have no idea) + this.order=this.id; + if (order) this.order=order+this.id*0.001; + this.type=''; + if (type) this.type=type; + this.power=0; + if (power) this.power=power; + + this.getPrice=function() + { + var price=this.basePrice; + if (Game.Has('Toy workshop')) price*=0.95; + if (Game.Has('Santa\'s dominion')) price*=0.98; + return Math.ceil(price); + } + + this.buy=function() + { + var cancelPurchase=0; + if (this.clickFunction) cancelPurchase=!this.clickFunction(); + if (!cancelPurchase) + { + var price=this.getPrice(); + if (Game.cookies>=price && !this.bought) + { + Game.Spend(price); + this.bought=1; + if (this.buyFunction) this.buyFunction(); + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + if (this.hide!=3) Game.UpgradesOwned++; + } + } + } + this.earn=function()//just win the upgrades without spending anything + { + Game.Upgrades[this.name].unlocked=1; + this.bought=1; + if (this.buyFunction) this.buyFunction(); + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + if (this.hide!=3) Game.UpgradesOwned++; + } + + this.toggle=function()//cheating only + { + if (!this.bought) + { + this.bought=1; + if (this.buyFunction) this.buyFunction(); + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + if (this.hide!=3) Game.UpgradesOwned++; + } + else + { + this.bought=0; + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + if (this.hide!=3) Game.UpgradesOwned--; + } + Game.UpdateMenu(); + } + + Game.Upgrades[this.name]=this; + Game.UpgradesById[this.id]=this; + Game.UpgradesN++; + return this; + } + + Game.Unlock=function(what) + { + if (typeof what==='string') + { + if (Game.Upgrades[what]) + { + if (Game.Upgrades[what].unlocked==0) + { + Game.Upgrades[what].unlocked=1; + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + } + } + } + else {for (var i in what) {Game.Unlock(what[i]);}} + } + Game.Lock=function(what) + { + if (typeof what==='string') + { + if (Game.Upgrades[what]) + { + Game.Upgrades[what].unlocked=0; + Game.Upgrades[what].bought=0; + Game.upgradesToRebuild=1; + if (Game.Upgrades[what].bought==1) + { + Game.UpgradesOwned--; + } + Game.recalculateGains=1; + } + } + else {for (var i in what) {Game.Lock(what[i]);}} + } + + Game.Has=function(what) + { + return (Game.Upgrades[what]?Game.Upgrades[what].bought:0); + } + Game.HasUnlocked=function(what) + { + return (Game.Upgrades[what]?Game.Upgrades[what].unlocked:0); + } + + Game.RebuildUpgrades=function()//recalculate the upgrades you can buy + { + Game.upgradesToRebuild=0; + var list=[]; + for (var i in Game.Upgrades) + { + var me=Game.Upgrades[i]; + if (!me.bought) + { + if (me.unlocked) list.push(me); + } + } + + var sortMap=function(a,b) + { + if (a.basePrice>b.basePrice) return 1; + else if (a.basePrice'+me.name+''+me.desc + '
'+Beautify(Math.round(me.getPrice()))+'
[Upgrade]
'+me.name+'
'+me.desc+'
' + ,'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;">'; + } + l('upgrades').innerHTML=str; + } + + var tier1=10; + var tier2=100; + var tier3=1000; + var tier4=50000; + var tier5=1000000; + + var type=''; + var power=0; + + //define upgrades + //WARNING : do NOT add new upgrades in between, this breaks the saves. Add them at the end ! + var order=100;//this is used to set the order in which the items are listed + new Game.Upgrade('Reinforced index finger','The mouse gains +1 cookie per click.
Cursors gain +0.1 base CpS.prod prod',100,[0,0]); + new Game.Upgrade('Carpal tunnel prevention cream','The mouse and cursors are twice as efficient.it... it hurts to click...',400,[0,0]); + new Game.Upgrade('Ambidextrous','The mouse and cursors are twice as efficient.Look ma, both hands!',10000,[0,6]); + new Game.Upgrade('Thousand fingers','The mouse and cursors gain +0.1 cookies for each non-cursor object owned.clickity',500000,[0,6]); + new Game.Upgrade('Million fingers','The mouse and cursors gain +0.5 cookies for each non-cursor object owned.clickityclickity',50000000,[1,6]); + new Game.Upgrade('Billion fingers','The mouse and cursors gain +2 cookies for each non-cursor object owned.clickityclickityclickity',500000000,[2,6]); + new Game.Upgrade('Trillion fingers','The mouse and cursors gain +10 cookies for each non-cursor object owned.clickityclickityclickityclickity',5000000000,[3,6]); + + order=200; + new Game.Upgrade('Forwards from grandma','Grandmas gain +0.3 base CpS.RE:RE:thought you\'d get a kick out of this ;))',Game.Objects['Grandma'].basePrice*tier1,[1,0]); + new Game.Upgrade('Steel-plated rolling pins','Grandmas are twice as efficient.Just what you kneaded.',Game.Objects['Grandma'].basePrice*tier2,[1,0]); + new Game.Upgrade('Lubricated dentures','Grandmas are twice as efficient.squish',Game.Objects['Grandma'].basePrice*tier3,[1,1]); + + order=300; + new Game.Upgrade('Cheap hoes','Farms gain +1 base CpS.Rake in the dough!',Game.Objects['Farm'].basePrice*tier1,[2,0]); + new Game.Upgrade('Fertilizer','Farms are twice as efficient.It\'s chocolate, I swear.',Game.Objects['Farm'].basePrice*tier2,[2,0]); + new Game.Upgrade('Cookie trees','Farms are twice as efficient.A relative of the breadfruit.',Game.Objects['Farm'].basePrice*tier3,[2,1]); + + order=400; + new Game.Upgrade('Sturdier conveyor belts','Factories gain +4 base CpS.You\'re going places.',Game.Objects['Factory'].basePrice*tier1,[4,0]); + new Game.Upgrade('Child labor','Factories are twice as efficient.Cheaper, healthier workforce.',Game.Objects['Factory'].basePrice*tier2,[4,0]); + new Game.Upgrade('Sweatshop','Factories are twice as efficient.Slackers will be terminated.',Game.Objects['Factory'].basePrice*tier3,[4,1]); + + order=500; + new Game.Upgrade('Sugar gas','Mines gain +10 base CpS.A pink, volatile gas, found in the depths of some chocolate caves.',Game.Objects['Mine'].basePrice*tier1,[3,0]); + new Game.Upgrade('Megadrill','Mines are twice as efficient.You\'re in deep.',Game.Objects['Mine'].basePrice*tier2,[3,0]); + new Game.Upgrade('Ultradrill','Mines are twice as efficient.Finally caved in?',Game.Objects['Mine'].basePrice*tier3,[3,1]); + + order=600; + new Game.Upgrade('Vanilla nebulae','Shipments gain +30 base CpS.If you removed your space helmet, you could probably smell it!
(Note : don\'t do that.)
',Game.Objects['Shipment'].basePrice*tier1,[5,0]); + new Game.Upgrade('Wormholes','Shipments are twice as efficient.By using these as shortcuts, your ships can travel much faster.',Game.Objects['Shipment'].basePrice*tier2,[5,0]); + new Game.Upgrade('Frequent flyer','Shipments are twice as efficient.Come back soon!',Game.Objects['Shipment'].basePrice*tier3,[5,1]); + + order=700; + new Game.Upgrade('Antimony','Alchemy labs gain +100 base CpS.Actually worth a lot of mony.',Game.Objects['Alchemy lab'].basePrice*tier1,[6,0]); + new Game.Upgrade('Essence of dough','Alchemy labs are twice as efficient.Extracted through the 5 ancient steps of alchemical baking.',Game.Objects['Alchemy lab'].basePrice*tier2,[6,0]); + new Game.Upgrade('True chocolate','Alchemy labs are twice as efficient.The purest form of cacao.',Game.Objects['Alchemy lab'].basePrice*tier3,[6,1]); + + order=800; + new Game.Upgrade('Ancient tablet','Portals gain +1,666 base CpS.A strange slab of peanut brittle, holding an ancient cookie recipe. Neat!',Game.Objects['Portal'].basePrice*tier1,[7,0]); + new Game.Upgrade('Insane oatling workers','Portals are twice as efficient.ARISE, MY MINIONS!',Game.Objects['Portal'].basePrice*tier2,[7,0]); + new Game.Upgrade('Soul bond','Portals are twice as efficient.So I just sign up and get more cookies? Sure, whatever!',Game.Objects['Portal'].basePrice*tier3,[7,1]); + + order=900; + new Game.Upgrade('Flux capacitors','Time machines gain +9,876 base CpS.Bake to the future.',1234567890,[8,0]); + new Game.Upgrade('Time paradox resolver','Time machines are twice as efficient.No more fooling around with your own grandmother!',9876543210,[8,0]); + new Game.Upgrade('Quantum conundrum','Time machines are twice as efficient.There is only one constant, and that is universal uncertainty.
Or is it?
',98765456789,[8,1]); + + order=20000; + new Game.Upgrade('Kitten helpers','You gain more CpS the more milk you have.meow may I help you',9000000,[1,7]); + new Game.Upgrade('Kitten workers','You gain more CpS the more milk you have.meow meow meow meow',9000000000,[2,7]); + + order=10000; + type='cookie';power=5; + new Game.Upgrade('Oatmeal raisin cookies','Cookie production multiplier +5%.No raisin to hate these.',99999999,[0,3]); + new Game.Upgrade('Peanut butter cookies','Cookie production multiplier +5%.Get yourself some jam cookies!',99999999,[1,3]); + new Game.Upgrade('Plain cookies','Cookie production multiplier +5%.Meh.',99999999,[2,3]); + new Game.Upgrade('Coconut cookies','Cookie production multiplier +5%.These are *way* flaky.',999999999,[3,3]); + new Game.Upgrade('White chocolate cookies','Cookie production multiplier +5%.I know what you\'ll say. It\'s just cocoa butter! It\'s not real chocolate!
Oh please.
',999999999,[4,3]); + new Game.Upgrade('Macadamia nut cookies','Cookie production multiplier +5%.They\'re macadamn delicious!',999999999,[5,3]); + power=10;new Game.Upgrade('Double-chip cookies','Cookie production multiplier +10%.DOUBLE THE CHIPS
DOUBLE THE TASTY
(double the calories)
',99999999999,[6,3]); + power=5;new Game.Upgrade('Sugar cookies','Cookie production multiplier +5%.Tasty, if a little unimaginative.',99999999,[7,3]); + power=10;new Game.Upgrade('White chocolate macadamia nut cookies','Cookie production multiplier +10%.Orteil\'s favorite.',99999999999,[8,3]); + new Game.Upgrade('All-chocolate cookies','Cookie production multiplier +10%.CHOCOVERDOSE.',99999999999,[9,3]); + type='';power=0; + + order=100; + new Game.Upgrade('Quadrillion fingers','The mouse and cursors gain +20 cookies for each non-cursor object owned.clickityclickityclickityclickityclick',50000000000,[3,6]); + + order=200;new Game.Upgrade('Prune juice','Grandmas are twice as efficient.Gets me going.',Game.Objects['Grandma'].basePrice*tier4,[1,2]); + order=300;new Game.Upgrade('Genetically-modified cookies','Farms are twice as efficient.All-natural mutations.',Game.Objects['Farm'].basePrice*tier4,[2,2]); + order=400;new Game.Upgrade('Radium reactors','Factories are twice as efficient.Gives your cookies a healthy glow.',Game.Objects['Factory'].basePrice*tier4,[4,2]); + order=500;new Game.Upgrade('Ultimadrill','Mines are twice as efficient.Pierce the heavens, etc.',Game.Objects['Mine'].basePrice*tier4,[3,2]); + order=600;new Game.Upgrade('Warp drive','Shipments are twice as efficient.To boldly bake.',Game.Objects['Shipment'].basePrice*tier4,[5,2]); + order=700;new Game.Upgrade('Ambrosia','Alchemy labs are twice as efficient.Adding this to the cookie mix is sure to make them even more addictive!
Perhaps dangerously so.
Let\'s hope you can keep selling these legally.
',Game.Objects['Alchemy lab'].basePrice*tier4,[6,2]); + order=800;new Game.Upgrade('Sanity dance','Portals are twice as efficient.We can change if we want to.
We can leave our brains behind.
',Game.Objects['Portal'].basePrice*tier4,[7,2]); + order=900;new Game.Upgrade('Causality enforcer','Time machines are twice as efficient.What happened, happened.',1234567890000,[8,2]); + + order=5000; + new Game.Upgrade('Lucky day','Golden cookies appear twice as often and stay twice as long.Oh hey, a four-leaf penny!',777777777,[10,1]); + new Game.Upgrade('Serendipity','Golden cookies appear twice as often and stay twice as long.What joy! Seven horseshoes!',77777777777,[10,1]); + + order=20000; + new Game.Upgrade('Kitten engineers','You gain more CpS the more milk you have.meow meow meow meow, sir',9000000000000,[3,7]); + + order=10000; + type='cookie';power=15; + new Game.Upgrade('Dark chocolate-coated cookies','Cookie production multiplier +15%.These absorb light so well you almost need to squint to see them.',999999999999,[10,3]); + new Game.Upgrade('White chocolate-coated cookies','Cookie production multiplier +15%.These dazzling cookies absolutely glisten with flavor.',999999999999,[11,3]); + type='';power=0; + + order=250; + new Game.Upgrade('Farmer grandmas','Grandmas are twice as efficient.A nice farmer to grow more cookies.',Game.Objects['Farm'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Worker grandmas','Grandmas are twice as efficient.A nice worker to manufacture more cookies.',Game.Objects['Factory'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Miner grandmas','Grandmas are twice as efficient.A nice miner to dig more cookies.',Game.Objects['Mine'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Cosmic grandmas','Grandmas are twice as efficient.A nice thing to... uh... cookies.',Game.Objects['Shipment'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Transmuted grandmas','Grandmas are twice as efficient.A nice golden grandma to convert into more cookies.',Game.Objects['Alchemy lab'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Altered grandmas','Grandmas are twice as efficient.a NiCe GrAnDmA tO bA##########',Game.Objects['Portal'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + new Game.Upgrade('Grandmas\' grandmas','Grandmas are twice as efficient.A nice grandma\'s nice grandma to bake double the cookies.',Game.Objects['Time machine'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + + order=14000; + Game.baseResearchTime=Game.fps*60*30; + Game.SetResearch=function(what,time) + { + if (Game.Upgrades[what]) + { + Game.researchT=Game.baseResearchTime; + if (Game.Has('Persistent memory')) Game.researchT=Math.ceil(Game.baseResearchTime/10); + if (Game.Has('Ultrascience')) Game.researchT=Game.fps*5; + Game.nextResearch=Game.Upgrades[what].id; + Game.Popup('Research has begun.'); + } + } + + new Game.Upgrade('Bingo center/Research facility','Grandma-operated science lab and leisure club.
Grandmas are 4 times as efficient.
Regularly unlocks new upgrades.What could possibly keep those grandmothers in check?...
Bingo.
',100000000000,[11,9],function(){Game.SetResearch('Specialized chocolate chips');}); + + order=15000; + + new Game.Upgrade('Specialized chocolate chips','[Research]
Cookie production multiplier +1%.Computer-designed chocolate chips. Computer chips, if you will.',10000000000,[0,9],function(){Game.SetResearch('Designer cocoa beans');}); + new Game.Upgrade('Designer cocoa beans','[Research]
Cookie production multiplier +2%.Now more aerodynamic than ever!',20000000000,[1,9],function(){Game.SetResearch('Ritual rolling pins');}); + new Game.Upgrade('Ritual rolling pins','[Research]
Grandmas are twice as efficient.The result of years of scientific research!',40000000000,[2,9],function(){Game.SetResearch('Underworld ovens');}); + new Game.Upgrade('Underworld ovens','[Research]
Cookie production multiplier +3%.Powered by science, of course!',80000000000,[3,9],function(){Game.SetResearch('One mind');}); + new Game.Upgrade('One mind','[Research]
Each grandma gains +1 base CpS for every 50 grandmas.
Note : the grandmothers are growing restless. Do not encourage them.
We are one. We are many.',160000000000,[4,9],function(){Game.elderWrath=1;Game.SetResearch('Exotic nuts');}); + 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?');}; + new Game.Upgrade('Exotic nuts','[Research]
Cookie production multiplier +4%.You\'ll go crazy over these!',320000000000,[5,9],function(){Game.SetResearch('Communal brainsweep');}); + new Game.Upgrade('Communal brainsweep','[Research]
Each grandma gains another +1 base CpS for every 50 grandmas.
Note : proceeding any further in scientific research may have unexpected results. You have been warned.
We fuse. We merge. We grow.',640000000000,[6,9],function(){Game.elderWrath=2;Game.SetResearch('Arcane sugar');}); + new Game.Upgrade('Arcane sugar','[Research]
Cookie production multiplier +5%.Tastes like insects, ligaments, and molasses.',1280000000000,[7,9],function(){Game.SetResearch('Elder Pact');}); + new Game.Upgrade('Elder Pact','[Research]
Each grandma gains +1 base CpS for every 20 portals.
Note : this is a bad idea.
squirm crawl slither writhe
today we rise
',2560000000000,[8,9],function(){Game.elderWrath=3;}); + new Game.Upgrade('Elder Pledge','[Repeatable]
Contains the wrath of the elders, at least for a while.This is a simple ritual involving anti-aging cream, cookie batter mixed in the moonlight, and a live chicken.',1,[9,9],function() + { + Game.elderWrath=0; + Game.pledges++; + Game.pledgeT=Game.fps*60*(Game.Has('Sacrificial rolling pins')?60:30); + Game.Upgrades['Elder Pledge'].basePrice=Math.pow(8,Math.min(Game.pledges+2,14)); + Game.Unlock('Elder Covenant'); + Game.CollectWrinklers(); + }); + Game.Upgrades['Elder Pledge'].hide=3; + + order=150; + new Game.Upgrade('Plastic mouse','Clicking gains +1% of your CpS.Slightly squeaky.',50000,[11,0]); + new Game.Upgrade('Iron mouse','Clicking gains +1% of your CpS.Click like it\'s 1349!',5000000,[11,0]); + new Game.Upgrade('Titanium mouse','Clicking gains +1% of your CpS.Heavy, but powerful.',500000000,[11,1]); + new Game.Upgrade('Adamantium mouse','Clicking gains +1% of your CpS.You could cut diamond with these.',50000000000,[11,2]); + + order=40000; + new Game.Upgrade('Ultrascience','Research takes only 5 seconds.YEAH, SCIENCE!',7,[9,2]);//debug purposes only + Game.Upgrades['Ultrascience'].hide=3;Game.Upgrades['Ultrascience'].debug=1; + + order=10000; + type='cookie';power=15; + new Game.Upgrade('Eclipse cookies','Cookie production multiplier +15%.Look to the cookie.',9999999999999,[0,4]); + new Game.Upgrade('Zebra cookies','Cookie production multiplier +15%....',9999999999999,[1,4]); + type='';power=0; + + order=100; + new Game.Upgrade('Quintillion fingers','The mouse and cursors gain +100 cookies for each non-cursor object owned.man, just go click click click click click, it\'s real easy, man.',50000000000000,[3,6]); + + order=40000; + new Game.Upgrade('Gold hoard','Golden cookies appear really often.That\'s entirely too many.',7,[10,1]);//debug purposes only + Game.Upgrades['Gold hoard'].hide=3;Game.Upgrades['Gold hoard'].debug=1; + + order=15000; + new Game.Upgrade('Elder Covenant','[Switch]
Puts a permanent end to the elders\' wrath, at the price of 5% of your CpS.This is a complicated ritual involving silly, inconsequential trivialities such as cursed laxatives, century-old cacao, and an infant.
Don\'t question it.
',66666666666666,[8,9],function() + { + Game.pledgeT=0; + Game.Lock('Revoke Elder Covenant'); + Game.Unlock('Revoke Elder Covenant'); + Game.Lock('Elder Pledge'); + Game.Win('Elder calm'); + Game.CollectWrinklers(); + }); + Game.Upgrades['Elder Covenant'].hide=3; + + new Game.Upgrade('Revoke Elder Covenant','[Switch]
You will get 5% of your CpS back, but the grandmatriarchs will return.we
rise
again
',6666666666,[8,9],function() + { + Game.Lock('Elder Covenant'); + Game.Unlock('Elder Covenant'); + }); + Game.Upgrades['Revoke Elder Covenant'].hide=3; + + order=5000; + new Game.Upgrade('Get lucky','Golden cookie effects last twice as long.You\'ve been up all night, haven\'t you?',77777777777777,[10,1]); + + order=15000; + new Game.Upgrade('Sacrificial rolling pins','Elder pledge last twice as long.These are mostly for spreading the anti-aging cream.
(and accessorily, shortening the chicken\'s suffering.)
',2888888888888,[2,9]); + + order=10000; + type='cookie';power=15; + new Game.Upgrade('Snickerdoodles','Cookie production multiplier +15%.True to their name.',99999999999999,[2,4]); + new Game.Upgrade('Stroopwafels','Cookie production multiplier +15%.If it ain\'t dutch, it ain\'t much.',99999999999999,[3,4]); + new Game.Upgrade('Macaroons','Cookie production multiplier +15%.Not to be confused with macarons.
These have coconut, okay?
',99999999999999,[4,4]); + type='';power=0; + + order=40000; + new Game.Upgrade('Neuromancy','Can toggle upgrades on and off at will in the stats menu.Can also come in handy to unsee things that can\'t be unseen.',7,[4,9]);//debug purposes only + Game.Upgrades['Neuromancy'].hide=3;Game.Upgrades['Neuromancy'].debug=1; + + order=10000; + type='cookie';power=15; + new Game.Upgrade('Empire biscuits','Cookie production multiplier +15%.For your growing cookie empire, of course!',99999999999999,[5,4]); + new Game.Upgrade('British tea biscuits','Cookie production multiplier +15%.Quite.',99999999999999,[6,4]); + new Game.Upgrade('Chocolate british tea biscuits','Cookie production multiplier +15%.Yes, quite.',99999999999999,[7,4]); + new Game.Upgrade('Round british tea biscuits','Cookie production multiplier +15%.Yes, quite riveting.',99999999999999,[8,4]); + new Game.Upgrade('Round chocolate british tea biscuits','Cookie production multiplier +15%.Yes, quite riveting indeed.',99999999999999,[9,4]); + new Game.Upgrade('Round british tea biscuits with heart motif','Cookie production multiplier +15%.Yes, quite riveting indeed, old chap.',99999999999999,[10,4]); + new Game.Upgrade('Round chocolate british tea biscuits with heart motif','Cookie production multiplier +15%.I like cookies.',99999999999999,[11,4]); + type='';power=0; + + + order=1000; + new Game.Upgrade('Sugar bosons','Antimatter condensers gain +99,999 base CpS.Sweet firm bosons.',Game.Objects['Antimatter condenser'].basePrice*tier1,[13,0]); + new Game.Upgrade('String theory','Antimatter condensers are twice as efficient.Reveals new insight about the true meaning of baking cookies (and, as a bonus, the structure of the universe).',Game.Objects['Antimatter condenser'].basePrice*tier2,[13,0]); + new Game.Upgrade('Large macaron collider','Antimatter condensers are twice as efficient.How singular!',Game.Objects['Antimatter condenser'].basePrice*tier3,[13,1]); + new Game.Upgrade('Big bang bake','Antimatter condensers are twice as efficient.And that\'s how it all began.',Game.Objects['Antimatter condenser'].basePrice*tier4,[13,2]); + + order=250; + new Game.Upgrade('Antigrandmas','Grandmas are twice as efficient.A mean antigrandma to vomit more cookies.
(Do not put in contact with normal grandmas; loss of matter may occur.)
',Game.Objects['Antimatter condenser'].basePrice*tier2,[10,9],function(){Game.Objects['Grandma'].drawFunction();}); + + order=10000; + type='cookie';power=20; + new Game.Upgrade('Madeleines','Cookie production multiplier +20%.Unforgettable!',199999999999999,[12,3]); + new Game.Upgrade('Palmiers','Cookie production multiplier +20%.Palmier than you!
Yes, I just said that.
',199999999999999,[13,3]); + new Game.Upgrade('Palets','Cookie production multiplier +20%.You could probably play hockey with these.
I mean, you\'re welcome to try.
',199999999999999,[12,4]); + new Game.Upgrade('Sablés','Cookie production multiplier +20%.The name implies they\'re made of sand. But you know better, don\'t you?',199999999999999,[13,4]); + type='';power=0; + + order=20000; + new Game.Upgrade('Kitten overseers','You gain more CpS the more milk you have.my purrpose is to serve you, sir',900000000000000,[8,7]); + + + order=100; + new Game.Upgrade('Sextillion fingers','The mouse and cursors gain +200 cookies for each non-cursor object owned.sometimes
things just
click
',500000000000000,[12,13]); + + order=200;new Game.Upgrade('Double-thick glasses','Grandmas are twice as efficient.Oh... so THAT\'s what I\'ve been baking.',Game.Objects['Grandma'].basePrice*tier5,[1,13]); + order=300;new Game.Upgrade('Gingerbread scarecrows','Farms are twice as efficient.Staring at your crops with mischievous glee.',Game.Objects['Farm'].basePrice*tier5,[2,13]); + order=400;new Game.Upgrade('Recombobulators','Factories are twice as efficient.A major part of cookie recombobulation.',Game.Objects['Factory'].basePrice*tier5,[4,13]); + order=500;new Game.Upgrade('H-bomb mining','Mines are twice as efficient.Questionable efficiency, but spectacular nonetheless.',Game.Objects['Mine'].basePrice*tier5,[3,13]); + order=600;new Game.Upgrade('Chocolate monoliths','Shipments are twice as efficient.My god. It\'s full of chocolate bars.',Game.Objects['Shipment'].basePrice*tier5,[5,13]); + order=700;new Game.Upgrade('Aqua crustulae','Alchemy labs are twice as efficient.Careful with the dosing - one drop too much and you get muffins.
And nobody likes muffins.
',Game.Objects['Alchemy lab'].basePrice*tier5,[6,13]); + order=800;new Game.Upgrade('Brane transplant','Portals are twice as efficient.This refers to the practice of merging higher dimensional universes, or "branes", with our own, in order to facilitate transit (and harvesting of precious cookie dough).',Game.Objects['Portal'].basePrice*tier5,[7,13]); + order=900;new Game.Upgrade('Yestermorrow comparators','Time machines are twice as efficient.Fortnights into milleniums.',Game.Objects['Time machine'].basePrice*tier5,[8,13]); + order=1000;new Game.Upgrade('Reverse cyclotrons','Antimatter condensers are twice as efficient.These can uncollision particles and unspin atoms. For... uh... better flavor, and stuff.',Game.Objects['Antimatter condenser'].basePrice*tier5,[13,13]); + + order=150; + new Game.Upgrade('Unobtainium mouse','Clicking gains +1% of your CpS.These nice mice should suffice.',5000000000000,[11,13]); + + order=10000; + type='cookie';power=25; + new Game.Upgrade('Caramoas','Cookie production multiplier +25%.Yeah. That\'s got a nice ring to it.',999999999999999,[14,4]); + new Game.Upgrade('Sagalongs','Cookie production multiplier +25%.Grandma\'s favorite?',999999999999999,[15,3]); + new Game.Upgrade('Shortfoils','Cookie production multiplier +25%.Foiled again!',999999999999999,[15,4]); + new Game.Upgrade('Win mints','Cookie production multiplier +25%.They\'re the luckiest cookies you\'ve ever tasted!',999999999999999,[14,3]); + type='';power=0; + + order=40000; + new Game.Upgrade('Perfect idling','You keep producing cookies even while the game is closed.It\'s the most beautiful thing I\'ve ever seen.',7,[10,0]);//debug purposes only + Game.Upgrades['Perfect idling'].hide=3;Game.Upgrades['Perfect idling'].debug=1; + + order=10000; + type='cookie';power=25; + new Game.Upgrade('Fig gluttons','Cookie production multiplier +25%.Got it all figured out.',999999999999999,[17,4]); + new Game.Upgrade('Loreols','Cookie production multiplier +25%.Because, uh... they\'re worth it?',999999999999999,[16,3]); + new Game.Upgrade('Jaffa cakes','Cookie production multiplier +25%.If you want to bake a cookie from scratch, you must first build a factory.',999999999999999,[17,3]); + new Game.Upgrade('Grease\'s cups','Cookie production multiplier +25%.Extra-greasy peanut butter.',999999999999999,[16,4]); + type='';power=0; + + order=30000; + new Game.Upgrade('Heavenly chip secret','Unlocks 5% of the potential of your heavenly chips.Grants the knowledge of heavenly chips, and how to use them to make baking more efficient.
It\'s a secret to everyone.
',11,[19,7]); + new Game.Upgrade('Heavenly cookie stand','Unlocks 25% of the potential of your heavenly chips.Don\'t forget to visit the heavenly lemonade stand afterwards.',1111,[18,7]); + new Game.Upgrade('Heavenly bakery','Unlocks 50% of the potential of your heavenly chips.Also sells godly cakes and divine pastries.',111111,[17,7]); + new Game.Upgrade('Heavenly confectionery','Unlocks 75% of the potential of your heavenly chips.They say angel bakers work there. They take angel lunch breaks and sometimes go on angel strikes.',11111111,[16,7]); + new Game.Upgrade('Heavenly key','Unlocks 100% of the potential of your heavenly chips.This is the key to the pearly (and tasty) gates of pastry heaven, granting you access to your entire stockpile of heavenly chips.
May you use them wisely.
',1111111111,[15,7]); + + order=10100; + type='cookie';power=20; + new Game.Upgrade('Skull cookies','Cookie production multiplier +20%.Wanna know something spooky? You\'ve got one of these inside your head RIGHT NOW.',444444444444,[12,8]); + new Game.Upgrade('Ghost cookies','Cookie production multiplier +20%.They\'re something strange, but they look pretty good!',444444444444,[13,8]); + new Game.Upgrade('Bat cookies','Cookie production multiplier +20%.The cookies this town deserves.',444444444444,[14,8]); + new Game.Upgrade('Slime cookies','Cookie production multiplier +20%.The incredible melting cookies!',444444444444,[15,8]); + new Game.Upgrade('Pumpkin cookies','Cookie production multiplier +20%.Not even pumpkin-flavored. Tastes like glazing. Yeugh.',444444444444,[16,8]); + new Game.Upgrade('Eyeball cookies','Cookie production multiplier +20%.When you stare into the cookie, the cookie stares back at you.',444444444444,[17,8]); + new Game.Upgrade('Spider cookies','Cookie production multiplier +20%.You found the recipe on the web. They do whatever a cookie can.',444444444444,[18,8]); + type='';power=0; + + order=14000; + new Game.Upgrade('Persistent memory','Subsequent research will be 10 times as fast.It\'s all making sense!
Again!
',100000000000,[9,2]); + + order=40000; + new Game.Upgrade('Wrinkler doormat','Wrinklers spawn much more frequently.You\'re such a pushover.',7,[19,8]);//debug purposes only + Game.Upgrades['Wrinkler doormat'].hide=3;Game.Upgrades['Wrinkler doormat'].debug=1; + + order=10200; + type='cookie';power=20; + new Game.Upgrade('Christmas tree biscuits','Cookie production multiplier +20%.Whose pine is it anyway?',252525252525,[12,10]); + new Game.Upgrade('Snowflake biscuits','Cookie production multiplier +20%.Mass-produced to be unique in every way.',252525252525,[13,10]); + new Game.Upgrade('Snowman biscuits','Cookie production multiplier +20%.It\'s frosted. Doubly so.',252525252525,[14,10]); + new Game.Upgrade('Mistletoe biscuits','Cookie production multiplier +20%.An acceptable smooching catalyst. Botanically, this is a smellier variant of the mistlefinger.',252525252525,[15,10]); + new Game.Upgrade('Candy cane biscuits','Cookie production multiplier +20%.It\'s two treats in one!
(Further inspection reveals the frosting does not actually taste like peppermint, but like mundane sugary frosting.)
',252525252525,[16,10]); + new Game.Upgrade('Bell biscuits','Cookie production multiplier +20%.What do these even have to do with christmas? Who cares, ring them in!',252525252525,[17,10]); + new Game.Upgrade('Present biscuits','Cookie production multiplier +20%.The prequel to future biscuits. Watch out!',252525252525,[18,10]); + type='';power=0; + + order=10000; + type='cookie';power=25; + new Game.Upgrade('Gingerbread men','Cookie production multiplier +25%.You like to bite the legs off first, right? How about tearing off the arms? You sick monster.',9999999999999999,[18,4]); + new Game.Upgrade('Gingerbread trees','Cookie production multiplier +25%.Evergreens in pastry form. Yule be surprised what you can come up with.',9999999999999999,[18,3]); + type='';power=0; + + order=25000; + new Game.Upgrade('A festive hat','Unlocks... something.Not a creature was stirring, not even a mouse.',25,[19,9],function() + { + var drop=choose(Game.santaDrops); + Game.Unlock(drop); + Game.Popup('In the festive hat, you find...
a festive test tube
and '+drop+'.'); + }); + + new Game.Upgrade('Increased merriness','Cookie production multiplier +15%.It turns out that the key to increased merriness, strangely enough, happens to be a good campfire and some s\'mores.
You know what they say, after all; the s\'more, the merrier.
',2525,[17,9]); + new Game.Upgrade('Improved jolliness','Cookie production multiplier +15%.A nice wobbly belly goes a long way.
You jolly?
',2525,[17,9]); + new Game.Upgrade('A lump of coal','Cookie production multiplier +1%.Some of the world\'s worst stocking stuffing.
I guess you could try starting your own little industrial revolution, or something?...
',2525,[13,9]); + new Game.Upgrade('An itchy sweater','Cookie production multiplier +1%.You don\'t know what\'s worse : the embarrassingly quaint "elf on reindeer" motif, or the fact that wearing it makes you feel like you\'re wrapped in a dead sasquatch.',2525,[14,9]); + new Game.Upgrade('Reindeer baking grounds','Reindeer appear twice as frequently.Male reindeer are from Mars; female reindeer are from venison.',2525,[12,9]); + new Game.Upgrade('Weighted sleighs','Reindeer are twice as slow.Hope it was worth the weight.
(Something something forced into cervidude)
',2525,[12,9]); + new Game.Upgrade('Ho ho ho-flavored frosting','Reindeer give twice as much.It\'s time to up the antler.',2525,[12,9]); + new Game.Upgrade('Season savings','All buildings are 1% cheaper.By Santa\'s beard, what savings!
But who will save us?
',2525,[16,9],function(){Game.RefreshBuildings();}); + new Game.Upgrade('Toy workshop','All upgrades are 5% cheaper.Watch yours-elf around elvesdroppers who might steal our production secrets.
Or elven worse!
',2525,[16,9],function(){Game.upgradesToRebuild=1;}); + new Game.Upgrade('Naughty list','Grandmas are twice as productive.This list contains every unholy deed perpetuated by grandmakind.
He won\'t be checking this one twice.
Once. Once is enough.
',2525,[15,9]); + new Game.Upgrade('Santa\'s bottomless bag','Random drops are 10% more common.This is one bottom you can\'t check out.',2525,[19,9]); + new Game.Upgrade('Santa\'s helpers','Clicking is 10% more powerful.Some choose to help hamburger; some choose to help you.
To each their own, I guess.
',2525,[19,9]); + new Game.Upgrade('Santa\'s legacy','Cookie production multiplier +10% per Santa\'s levels.In the north pole, you gotta get the gnomes first. Then when you get the gnomes, you start making the toys. Then when you get the toys... then you get the cookies.',2525,[19,9]); + new Game.Upgrade('Santa\'s milk and cookies','Milk is 5% more powerful.Part of Santa\'s dreadfully unbalanced diet.',2525,[19,9]); + + order=40000; + new Game.Upgrade('Reindeer season','Reindeer spawn much more frequently.Go, Cheater! Go, Hacker and Faker!',7,[12,9]);//debug purposes only + Game.Upgrades['Reindeer season'].hide=3;Game.Upgrades['Reindeer season'].debug=1; + + order=25000; + new Game.Upgrade('Santa\'s dominion','Cookie production multiplier +50%.
All buildings are 1% cheaper.
All upgrades are 2% cheaper.My name is Claus, king of kings;
Look on my toys, ye Mighty, and despair!
',2525252525252525,[19,10]); + + /* + //I really should release these someday + new Game.Upgrade('Plain milk','Unlocks plain milk, available in the menu.',120000000000,[4,7]); + new Game.Upgrade('Chocolate milk','Unlocks chocolate milk, available in the menu.',120000000000,[5,7]); + new Game.Upgrade('Raspberry milk','Unlocks raspberry milk, available in the menu.',120000000000,[6,7]); + new Game.Upgrade('Orange juice','Unlocks orange juice, available in the menu.',120000000000,[7,7]); + new Game.Upgrade('Ain\'t got milk','Unlocks no milk please, available in the menu.',120000000000,[0,7]); + + new Game.Upgrade('Blue background','Unlocks the blue background, available in the menu.',120000000000,[0,8]); + new Game.Upgrade('Red background','Unlocks the red background, available in the menu.',120000000000,[1,8]); + new Game.Upgrade('White background','Unlocks the white background, available in the menu.',120000000000,[2,8]); + new Game.Upgrade('Black background','Unlocks the black background, available in the menu.',120000000000,[3,8]); + */ + + //new Game.Upgrade('Golden switch','Unlocks the Golden switch, available in the menu.
When active, the Golden switch grants you a passive CpS boost, but prevents golden cookies from spawning.',77777777777,[10,1]); + + /*===================================================================================== + ACHIEVEMENTS + =======================================================================================*/ + Game.Achievements=[]; + Game.AchievementsById=[]; + Game.AchievementsN=0; + Game.AchievementsOwned=0; + Game.Achievement=function(name,desc,icon,hide) + { + this.id=Game.AchievementsN; + this.name=name; + this.desc=desc; + this.icon=icon; + this.won=0; + this.disabled=0; + this.hide=hide||0;//hide levels : 0=show, 1=hide description, 2=hide, 3=secret (doesn't count toward achievement total) + this.order=this.id; + if (order) this.order=order+this.id*0.001; + + this.category='none'; + + Game.Achievements[this.name]=this; + Game.AchievementsById[this.id]=this; + Game.AchievementsN++; + return this; + } + + Game.Win=function(what) + { + if (typeof what==='string') + { + if (Game.Achievements[what]) + { + if (Game.Achievements[what].won==0) + { + Game.Achievements[what].won=1; + Game.Popup('Achievement unlocked :
'+Game.Achievements[what].name+'
'); + if (Game.Achievements[what].hide!=3) Game.AchievementsOwned++; + Game.recalculateGains=1; + } + } + } + else {for (var i in what) {Game.Win(what[i]);}} + } + + Game.HasAchiev=function(what) + { + return (Game.Achievements[what]?Game.Achievements[what].won:0); + } + + //define achievements + //WARNING : do NOT add new achievements in between, this breaks the saves. Add them at the end ! + + var order=100;//this is used to set the order in which the items are listed + //new Game.Achievement('name','description',[0,0]); + Game.moneyAchievs=[ + 'Wake and bake', 1, + 'Making some dough', 100, + 'So baked right now', 1000, + 'Fledgling bakery', 10000, + 'Affluent bakery', 100000, + 'World-famous bakery', 1000000, + 'Cosmic bakery', 10000000, + 'Galactic bakery', 100000000, + 'Universal bakery', 1000000000, + 'Timeless bakery', 10000000000, + 'Infinite bakery', 100000000000, + 'Immortal bakery', 1000000000000, + 'You can stop now', 10000000000000, + 'Cookies all the way down', 100000000000000, + 'Overdose', 1000000000000000, + 'How?', 10000000000000000 + ]; + for (var i=0;i'+Beautify(Game.moneyAchievs[i*2+1])+' cookie'+(Game.moneyAchievs[i*2+1]==1?'':'s')+'.',pic,2); + } + + order=200; + Game.cpsAchievs=[ + 'Casual baking', 1, + 'Hardcore baking', 10, + 'Steady tasty stream', 100, + 'Cookie monster', 1000, + 'Mass producer', 10000, + 'Cookie vortex', 1000000, + 'Cookie pulsar', 10000000, + 'Cookie quasar', 100000000, + 'A world filled with cookies', 10000000000, + 'Let\'s never bake again', 1000000000000 + ]; + for (var i=0;i'+Beautify(Game.cpsAchievs[i*2+1])+' cookie'+(Game.cpsAchievs[i*2+1]==1?'':'s')+' per second.',pic,2); + } + + order=30000; + new Game.Achievement('Sacrifice','Reset your game with 1 million cookies baked.Easy come, easy go.',[11,6],2); + new Game.Achievement('Oblivion','Reset your game with 1 billion cookies baked.Back to square one.',[11,6],2); + new Game.Achievement('From scratch','Reset your game with 1 trillion cookies baked.It\'s been fun.',[11,6],2); + + order=31000; + new Game.Achievement('Neverclick','Make 1 million cookies by only having clicked 15 times.',[12,0],2); + order=1000; + new Game.Achievement('Clicktastic','Make 1,000 cookies from clicking.',[11,0]); + new Game.Achievement('Clickathlon','Make 100,000 cookies from clicking.',[11,1]); + new Game.Achievement('Clickolympics','Make 10,000,000 cookies from clicking.',[11,1]); + new Game.Achievement('Clickorama','Make 1,000,000,000 cookies from clicking.',[11,2]); + + order=1050; + new Game.Achievement('Click','Have 1 cursor.',[0,0]); + new Game.Achievement('Double-click','Have 2 cursors.',[0,6]); + new Game.Achievement('Mouse wheel','Have 50 cursors.',[1,6]); + new Game.Achievement('Of Mice and Men','Have 100 cursors.',[2,6]); + new Game.Achievement('The Digital','Have 200 cursors.',[3,6]); + + order=1100; + new Game.Achievement('Just wrong','Sell a grandma.I thought you loved me.',[10,9],2); + new Game.Achievement('Grandma\'s cookies','Have 1 grandma.',[1,0]); + new Game.Achievement('Sloppy kisses','Have 50 grandmas.',[1,1]); + new Game.Achievement('Retirement home','Have 100 grandmas.',[1,2]); + + order=1200; + new Game.Achievement('My first farm','Have 1 farm.',[2,0]); + new Game.Achievement('Reap what you sow','Have 50 farms.',[2,1]); + new Game.Achievement('Farm ill','Have 100 farms.',[2,2]); + + order=1300; + new Game.Achievement('Production chain','Have 1 factory.',[4,0]); + new Game.Achievement('Industrial revolution','Have 50 factories.',[4,1]); + new Game.Achievement('Global warming','Have 100 factories.',[4,2]); + + order=1400; + new Game.Achievement('You know the drill','Have 1 mine.',[3,0]); + new Game.Achievement('Excavation site','Have 50 mines.',[3,1]); + new Game.Achievement('Hollow the planet','Have 100 mines.',[3,2]); + + order=1500; + new Game.Achievement('Expedition','Have 1 shipment.',[5,0]); + new Game.Achievement('Galactic highway','Have 50 shipments.',[5,1]); + new Game.Achievement('Far far away','Have 100 shipments.',[5,2]); + + order=1600; + new Game.Achievement('Transmutation','Have 1 alchemy lab.',[6,0]); + new Game.Achievement('Transmogrification','Have 50 alchemy labs.',[6,1]); + new Game.Achievement('Gold member','Have 100 alchemy labs.',[6,2]); + + order=1700; + new Game.Achievement('A whole new world','Have 1 portal.',[7,0]); + new Game.Achievement('Now you\'re thinking','Have 50 portals.',[7,1]); + new Game.Achievement('Dimensional shift','Have 100 portals.',[7,2]); + + order=1800; + new Game.Achievement('Time warp','Have 1 time machine.',[8,0]); + new Game.Achievement('Alternate timeline','Have 50 time machines.',[8,1]); + new Game.Achievement('Rewriting history','Have 100 time machines.',[8,2]); + + order=7000; + new Game.Achievement('One with everything','Have at least 1 of every building.',[4,6],2); + new Game.Achievement('Mathematician','Have at least 1 of the most expensive object, 2 of the second-most expensive, 4 of the next and so on (capped at 128).',[7,6],2); + new Game.Achievement('Base 10','Have at least 10 of the most expensive object, 20 of the second-most expensive, 30 of the next and so on.',[8,6],2); + + order=10000; + new Game.Achievement('Golden cookie','Click a golden cookie.',[10,1],1); + new Game.Achievement('Lucky cookie','Click 7 golden cookies.',[10,1],1); + new Game.Achievement('A stroke of luck','Click 27 golden cookies.',[10,1],1); + + order=30200; + new Game.Achievement('Cheated cookies taste awful','Hack in some cookies.',[10,6],3); + order=30001; + new Game.Achievement('Uncanny clicker','Click really, really fast.Well I\'ll be!',[12,0],2); + + order=5000; + new Game.Achievement('Builder','Own 100 buildings.',[4,6],1); + new Game.Achievement('Architect','Own 400 buildings.',[5,6],1); + order=6000; + new Game.Achievement('Enhancer','Purchase 20 upgrades.',[9,0],1); + new Game.Achievement('Augmenter','Purchase 50 upgrades.',[9,1],1); + + order=11000; + new Game.Achievement('Cookie-dunker','Dunk the cookie.You did it!',[4,7],2); + + order=10000; + new Game.Achievement('Fortune','Click 77 golden cookies.You should really go to bed.',[10,1],1); + order=31000; + new Game.Achievement('True Neverclick','Make 1 million cookies with no cookie clicks.This kinda defeats the whole purpose, doesn\'t it?',[12,0],3); + + order=20000; + new Game.Achievement('Elder nap','Appease the grandmatriarchs at least once.we
are
eternal
',[8,9],2); + new Game.Achievement('Elder slumber','Appease the grandmatriarchs at least 5 times.our mind
outlives
the universe
',[8,9],2); + + order=1150; + new Game.Achievement('Elder','Own at least 7 grandma types.',[10,9],2); + + order=20000; + new Game.Achievement('Elder calm','Declare a covenant with the grandmatriarchs.we
have
fed
',[8,9],2); + + order=5000; + new Game.Achievement('Engineer','Own 800 buildings.',[6,6],1); + + order=10000; + new Game.Achievement('Leprechaun','Click 777 golden cookies.',[10,1],1); + new Game.Achievement('Black cat\'s paw','Click 7777 golden cookies.',[10,1],3); + + order=30000; + new Game.Achievement('Nihilism','Reset your game with 1 quadrillion cookies baked.There are many things
that need to be erased
',[11,6],2); + //new Game.Achievement('Galactus\' Reprimand','Reset your game with 1 quintillion coo- okay no I'm yanking your chain + + order=1900; + new Game.Achievement('Antibatter','Have 1 antimatter condenser.',[13,0]); + new Game.Achievement('Quirky quarks','Have 50 antimatter condensers.',[13,1]); + new Game.Achievement('It does matter!','Have 100 antimatter condensers.',[13,2]); + + order=6000; + new Game.Achievement('Upgrader','Purchase 100 upgrades.',[9,2],1); + + order=7000; + new Game.Achievement('Centennial','Have at least 100 of everything.',[9,6],2); + + order=30500; + new Game.Achievement('Hardcore','Get to 1 billion cookies baked with no upgrades purchased.',[12,6],3); + + order=30600; + new Game.Achievement('Speed baking I','Get to 1 million cookies baked in 35 minutes (with no heavenly upgrades).',[12,5],3); + new Game.Achievement('Speed baking II','Get to 1 million cookies baked in 25 minutes (with no heavenly upgrades).',[13,5],3); + new Game.Achievement('Speed baking III','Get to 1 million cookies baked in 15 minutes (with no heavenly upgrades).',[14,5],3); + + + + order=61000; + var achiev=new Game.Achievement('Getting even with the oven','Defeat the Sentient Furnace in the factory dungeons.',[12,7],3);achiev.category='dungeon';//make this 2 when dungeons are released + var achiev=new Game.Achievement('Now this is pod-smashing','Defeat the Ascended Baking Pod in the factory dungeons.',[12,7],3);achiev.category='dungeon';//make this 2 when dungeons are released + var achiev=new Game.Achievement('Chirped out','Find and defeat Chirpy, the dysfunctionning alarm bot.',[13,7],3);achiev.category='dungeon'; + var achiev=new Game.Achievement('Follow the white rabbit','Find and defeat the elusive sugar bunny.',[14,7],3);achiev.category='dungeon'; + + order=1000; + new Game.Achievement('Clickasmic','Make 100,000,000,000 cookies from clicking.',[11,13]); + + order=1100; + new Game.Achievement('Friend of the ancients','Have 150 grandmas.',[1,13]); + new Game.Achievement('Ruler of the ancients','Have 200 grandmas.',[1,13]); + + order=32000; + new Game.Achievement('Wholesome','Unlock 100% of your heavenly chips power.',[15,7],2); + + order=33000; + new Game.Achievement('Just plain lucky','You have 1 chance in 500,000 every second of earning this achievement.',[15,6],3); + + order=21000; + new Game.Achievement('Itchscratcher','Burst 1 wrinkler.',[19,8],2); + new Game.Achievement('Wrinklesquisher','Burst 50 wrinklers.',[19,8],2); + new Game.Achievement('Moistburster','Burst 200 wrinklers.',[19,8],2); + + order=22000; + new Game.Achievement('Spooky cookies','Unlock every Halloween-themed cookie.
Owning this achievement makes Halloween-themed cookies drop more frequently in future playthroughs.',[12,8],2); + + order=22100; + new Game.Achievement('Coming to town','Reach Santa\'s 7th form.',[18,9],2); + new Game.Achievement('All hail Santa','Reach Santa\'s final form.',[19,10],2); + new Game.Achievement('Let it snow','Unlock every Christmas-themed cookie.',[19,9],2); + new Game.Achievement('Oh deer','Pop 1 reindeer.',[12,9],2); + new Game.Achievement('Sleigh of hand','Pop 50 reindeer.',[12,9],2); + new Game.Achievement('Reindeer sleigher','Pop 200 reindeer.',[12,9],2); + + + + Game.RuinTheFun=function() + { + for (var i in Game.Upgrades) + { + Game.Upgrades[i].earn(); + /* + Game.Upgrades[i].bought=1; + if (Game.Upgrades[i].buyFunction) Game.Upgrades[i].buyFunction(); + */ + } + for (var i in Game.Achievements) + { + Game.Win(Game.Achievements[i].name); + } + Game.Earn(999999999999999999); + Game.upgradesToRebuild=1; + Game.recalculateGains=1; + } + + /*===================================================================================== + GRANDMAPOCALYPSE + =======================================================================================*/ + Game.UpdateGrandmapocalypse=function() + { + if (Game.Has('Elder Covenant') || Game.Objects['Grandma'].amount==0) Game.elderWrath=0; + else if (Game.pledgeT>0)//if the pledge is active, lower it + { + Game.pledgeT--; + if (Game.pledgeT==0)//did we reach 0? make the pledge purchasable again + { + Game.Lock('Elder Pledge'); + Game.Unlock('Elder Pledge'); + Game.elderWrath=1; + } + } + else + { + if (Game.Has('One mind') && Game.elderWrath==0) + { + Game.elderWrath=1; + } + if (Math.random()<0.001 && Game.elderWrath -0.5 * rect.w && x2 < 0.5 * rect.w && y2 > -0.5 * rect.h && y2 < 0.5 * rect.h) return true; + return false; + } + + Game.wrinklers=[]; + for (var i=0;i<10;i++) + { + Game.wrinklers.push({id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:3}); + } + Game.ResetWrinklers=function() + { + for (var i in Game.wrinklers) + { + Game.wrinklers[i]={id:parseInt(i),close:0,sucked:0,phase:0,x:0,y:0,r:0,hurt:0,hp:3}; + } + } + Game.CollectWrinklers=function() + { + for (var i in Game.wrinklers) + { + Game.wrinklers[i].hp=0; + } + } + Game.UpdateWrinklers=function() + { + var xBase=0; + var yBase=0; + var onWrinkler=0; + if (Game.LeftBackground) + { + xBase=Game.cookieOriginX; + yBase=Game.cookieOriginY; + } + for (var i in Game.wrinklers) + { + var me=Game.wrinklers[i]; + if (me.phase==0 && Game.elderWrath>0 && Math.random()<(!Game.Has('Wrinkler doormat')?0.0001:0.1)) {me.phase=1;me.hp=3;}//respawn + if (me.phase>0) + { + if (me.close<1) me.close+=(1/Game.fps)/10; + if (me.close>1) me.close=1; + } + else me.close=0; + if (me.close==1 && me.phase==1) + { + me.phase=2; + Game.recalculateGains=1; + } + if (me.phase==2) + { + me.sucked+=(((Game.cookiesPs/Game.fps)*Game.cpsSucked));//suck the cookies + } + if (me.phase>0) + { + var d=128*(2-me.close); + d+=Math.cos(Game.T*0.05+parseInt(me.id))*4; + me.r=(me.id/Game.wrinklers.length)*360; + me.r+=Math.sin(Game.T*0.05+parseInt(me.id))*4; + me.x=xBase+(Math.sin(me.r*Math.PI/180)*d); + me.y=yBase+(Math.cos(me.r*Math.PI/180)*d); + me.r+=Math.sin(Game.T*0.09+parseInt(me.id))*4; + rect={w:100,h:200,r:(-me.r)*Math.PI/180,o:10}; + if (Math.random()<0.01) me.hurt=Math.max(me.hurt,Math.random()); + if (inRect(Game.mouseX-me.x,Game.mouseY-me.y,rect) && onWrinkler==0) + { + me.hurt=Math.max(me.hurt,0.25); + //me.close*=0.99; + if (Game.Click) + { + me.hurt=1; + me.hp--; + var x=me.x+(Math.sin(me.r*Math.PI/180)*100); + var y=me.y+(Math.cos(me.r*Math.PI/180)*100); + for (var ii=0;ii<3;ii++) + { + 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'); + } + } + onWrinkler=1; + } + } + if (me.hurt>0) + { + me.hurt-=5/Game.fps; + //me.close-=me.hurt*0.05; + //me.x+=Math.random()*2-1; + //me.y+=Math.random()*2-1; + me.r+=(Math.sin(Game.T*1)*me.hurt)*18;//Math.random()*2-1; + } + if (me.hp<=0 && me.phase>0) + { + Game.wrinklersPopped++; + Game.recalculateGains=1; + me.phase=0; + me.close=0; + me.hurt=0; + me.hp=3; + me.sucked*=1.1;//cookie dough does weird things inside wrinkler digestive tracts + if (me.sucked>0.5) + { + Game.Popup('Exploded a wrinkler : found '+Beautify(me.sucked)+' cookies!'); + //if (Math.random()<(Game.HasAchiev('Spooky cookies')?0.2:0.05))//halloween cookie drops + var failRate=0.95; + if (Game.HasAchiev('Spooky cookies')) failRate=0.8; + if (Game.Has('Santa\'s bottomless bag')) failRate*=0.9; + if (Math.random()>failRate)//halloween cookie drops + { + var cookie=choose(['Skull cookies','Ghost cookies','Bat cookies','Slime cookies','Pumpkin cookies','Eyeball cookies','Spider cookies']); + if (!Game.HasUnlocked(cookie) && !Game.Has(cookie)) + { + Game.Unlock(cookie); + Game.Popup('Found : '+cookie+'!'); + } + } + } + Game.Earn(me.sucked); + me.sucked=0; + var x=me.x+(Math.sin(me.r*Math.PI/180)*100); + var y=me.y+(Math.cos(me.r*Math.PI/180)*100); + for (var ii=0;ii<6;ii++) + { + 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'); + } + } + } + if (onWrinkler) + { + Game.mousePointer=1; + } + } + Game.DrawWrinklers=function() + { + for (var i in Game.wrinklers) + { + var me=Game.wrinklers[i]; + if (me.phase>0) + { + Game.LeftBackground.globalAlpha=me.close; + Game.LeftBackground.save(); + Game.LeftBackground.translate(me.x,me.y); + Game.LeftBackground.rotate(-(me.r)*Math.PI/180); + //Game.LeftBackground.fillRect(-50,-10,100,200); + if (Game.season=='christmas') Game.LeftBackground.drawImage(Game.Assets['winterWrinkler.png'],-50,-10); + else Game.LeftBackground.drawImage(Game.Assets['wrinkler.png'],-50,-10); + //Game.LeftBackground.fillText(me.id+' : '+me.sucked,0,0); + Game.LeftBackground.restore(); + if (me.phase==2 && Math.random()<0.1 && Game.prefs.particles) + { + Game.particleAdd(me.x,me.y,Math.random()*4-2,Math.random()*-2-2,Math.random()*0.5+0.2,1,2); + } + } + } + } + + + /*===================================================================================== + SPECIAL THINGS AND STUFF + =======================================================================================*/ + + Game.santaLevels=['Festive test tube','Festive ornament','Festive wreath','Festive tree','Festive present','Festive elf fetus','Elf toddler','Elfling','Young elf','Bulky elf','Nick','Santa Claus','Elder Santa','True Santa','Final Claus']; + Game.santaDrops=['Increased merriness','Improved jolliness','A lump of coal','An itchy sweater','Reindeer baking grounds','Weighted sleighs','Ho ho ho-flavored frosting','Season savings','Toy workshop','Naughty list','Santa\'s bottomless bag','Santa\'s helpers','Santa\'s legacy','Santa\'s milk and cookies']; + + Game.santaTransition=0; + Game.UpdateSanta=function() + { + if (Game.LeftBackground) + { + var x=48; + var y=Game.LeftBackground.canvas.height-48-24; + if (Math.abs(Game.mouseX-x)<48 && Math.abs(Game.mouseY-y)<48) + { + Game.mousePointer=1; + if (Game.Click) + { + var moni=Math.pow(Game.santaLevel+1,Game.santaLevel+1); + if (Game.cookies>moni && Game.santaLevel<14) + { + Game.Spend(moni); + Game.santaLevel=(Game.santaLevel+1)%15; + if (Game.santaLevel==14) {Game.Unlock('Santa\'s dominion');Game.Popup('You are granted
Santa\'s dominion.');} + Game.santaTransition=1; + var drops=[]; + for (var i in Game.santaDrops) {if (!Game.HasUnlocked(Game.santaDrops[i])) drops.push(Game.santaDrops[i]);} + var drop=choose(drops); + if (drop) {Game.Unlock(drop);Game.Popup('You find a present which contains...
'+drop+'!');} + + if (Game.santaLevel>=6) Game.Win('Coming to town'); + if (Game.santaLevel>=14) Game.Win('All hail Santa'); + } + } + } + if (Game.santaTransition>0) + { + Game.santaTransition++; + if (Game.santaTransition>=Game.fps/2) Game.santaTransition=0; + } + } + } + Game.DrawSanta=function() + { + Game.LeftBackground.globalAlpha=1; + var x=48; + var y=Game.LeftBackground.canvas.height-48-24; + var r=Math.sin(Game.T*0.2)*Math.PI*0.02; + var s=1; + if (Math.abs(Game.mouseX-x)<48 && Math.abs(Game.mouseY-y)<48) + { + Game.LeftBackground.drawImage(Game.Assets['winterFrame.png'],x-48,y-48); + Game.LeftBackground.textAlign='center'; + var tx=x+48+96; + if (Game.santaLevel<14) + { + var str=[Game.santaLevels[Game.santaLevel],'upgrade for',Beautify(Math.pow(Game.santaLevel+1,Game.santaLevel+1))+' '+(Game.santaLevel>0?'cookies':'cookie')]; + Game.LeftBackground.fillStyle='#200e0a'; + + Game.LeftBackground.font='16px Kavoon'; + Game.LeftBackground.fillText(str[0],tx-1,y-8+1); + Game.LeftBackground.font='12px Arial'; + Game.LeftBackground.fillText(str[1],tx-1,y+10+1); + Game.LeftBackground.fillText(str[2],tx-1,y+24+1); + + Game.LeftBackground.fillStyle='#fff'; + + Game.LeftBackground.font='16px Kavoon'; + Game.LeftBackground.fillText(str[0],tx,y-8); + Game.LeftBackground.font='12px Arial'; + Game.LeftBackground.fillText(str[1],tx,y+10); + Game.LeftBackground.fillText(str[2],tx,y+24); + } + else + { + str=Game.santaLevels[Game.santaLevel]; + Game.LeftBackground.fillStyle='#200e0a'; + + Game.LeftBackground.font='20px Kavoon'; + Game.LeftBackground.fillText(str,tx-1,y+8+1); + + Game.LeftBackground.fillStyle='#fff'; + + Game.LeftBackground.font='20px Kavoon'; + Game.LeftBackground.fillText(str,tx,y+8); + } + s=Math.sin(Game.T*0.15)*0.05+1.05; + /*if (Math.random()<0.5) + { + x+=Math.floor(Math.random()*8-4); + y+=Math.floor(Math.random()*8-4); + r+=Math.random()*Math.PI*0.05; + }*/ + } + Game.LeftBackground.save(); + Game.LeftBackground.translate(x+Math.cos(Game.T*0.2)*4,y+48); + Game.LeftBackground.rotate(r); + Game.LeftBackground.drawImage(Game.Assets['santa.png'],96*Game.santaLevel,0,96,96,-48*s,-96*s,96*s,96*s); + if (Game.santaTransition>0) + { + Game.LeftBackground.globalAlpha=1-Game.santaTransition/(Game.fps/2); + var s=1+(Game.santaTransition/(Game.fps/2)); + Game.LeftBackground.drawImage(Game.Assets['santa.png'],96*Math.max(0,Game.santaLevel-1),0,96,96,-48*s,-96*s,96*s,96*s); + } + Game.LeftBackground.restore(); + //Game.LeftBackground.drawImage(Game.Assets['santa.png'],96*(Math.floor(Game.T/Game.fps)%14),0,96,96,x-48,y-48,96,96); + + + } + + /*===================================================================================== + VISUAL EFFECTS + =======================================================================================*/ + Game.mousePointer=0;//when 1, draw the mouse as a pointer on the left screen + + Game.cookieOriginX=0; + Game.cookieOriginY=0; + Game.DrawBackground=function() + { + //background + if (!Game.Background) + { + Game.Background=l('backgroundCanvas').getContext('2d'); + Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth; + Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight; + Game.LeftBackground=l('backgroundLeftCanvas').getContext('2d'); + Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth; + Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight; + window.addEventListener('resize', function(event) + { + Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth; + Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight; + Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth; + Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight; + }); + } + if (Game.drawT%15==0) + { + Game.defaultBg='bgBlue'; + if (Game.elderWrathD<1) + { + Game.bgR=0; + Game.bg=Game.defaultBg; + Game.bgFade=Game.defaultBg; + } + else if (Game.elderWrathD>=1 && Game.elderWrathD<2) + { + Game.bgR=(Game.elderWrathD-1)/1; + Game.bg=Game.defaultBg; + Game.bgFade='grandmas1'; + } + else if (Game.elderWrathD>=2 && Game.elderWrathD<3) + { + Game.bgR=(Game.elderWrathD-2)/1; + Game.bg='grandmas1'; + Game.bgFade='grandmas2'; + } + else if (Game.elderWrathD>=3)// && Game.elderWrathD<4) + { + Game.bgR=(Game.elderWrathD-3)/1; + Game.bg='grandmas2'; + Game.bgFade='grandmas3'; + } + var s1=512;if (Game.bg==Game.defaultBg) s1=600; + var s2=512;if (Game.bgFade==Game.defaultBg) s2=600; + var x=0; + var y=0; + Game.Background.fillPattern(Game.Assets[Game.bg+'.jpg'],x,y,Game.Background.canvas.width,Game.Background.canvas.height,s1,s1); + if (Game.bgR>0) + { + Game.Background.globalAlpha=Game.bgR; + Game.Background.fillPattern(Game.Assets[Game.bgFade+'.jpg'],x,y,Game.Background.canvas.width,Game.Background.canvas.height,s2,s2); + Game.Background.globalAlpha=1; + } + Game.Background.drawImage(Game.Assets['shadedBorders.png'],0,0,Game.Background.canvas.width,Game.Background.canvas.height); + } + + //clear + Game.LeftBackground.clearRect(0,0,Game.LeftBackground.canvas.width,Game.LeftBackground.canvas.height); + + + Game.cookieOriginX=Math.floor(Game.LeftBackground.canvas.width/2); + Game.cookieOriginY=Math.floor(Game.LeftBackground.canvas.height*0.4); + + if (Game.prefs.particles) + { + //falling cookies + var pic=''; + var opacity=1; + if (Game.elderWrathD<=1.5) + { + if (Game.cookiesPs>=1000) pic='cookieShower3.png'; + else if (Game.cookiesPs>=500) pic='cookieShower2.png'; + else if (Game.cookiesPs>=50) pic='cookieShower1.png'; + else pic=''; + } + if (pic!='') + { + if (Game.elderWrathD>=1) opacity=1-((Math.min(Game.elderWrathD,1.5)-1)/0.5); + Game.LeftBackground.globalAlpha=opacity; + var y=(Math.floor(Game.T*2)%512); + Game.LeftBackground.fillPattern(Game.Assets[pic],0,-512+y,Game.LeftBackground.canvas.width,Game.LeftBackground.canvas.height+512,512,512); + Game.LeftBackground.globalAlpha=1; + } + //snow + if (Game.season=='christmas') + { + var y=(Math.floor(Game.T*2.5)%512); + Game.LeftBackground.globalAlpha=0.75; + Game.LeftBackground.globalCompositeOperation='lighter'; + Game.LeftBackground.fillPattern(Game.Assets['snow2.jpg'],0,-512+y,Game.LeftBackground.canvas.width,Game.LeftBackground.canvas.height+512,512,512); + Game.LeftBackground.globalCompositeOperation='source-over'; + Game.LeftBackground.globalAlpha=1; + } + + Game.particlesDraw(0); + Game.LeftBackground.globalAlpha=1; + + //big cookie shine + var s=512; + + var x=Game.cookieOriginX; + var y=Game.cookieOriginY; + + var r=Math.floor((Game.T*0.5)%360); + Game.LeftBackground.save(); + Game.LeftBackground.translate(x,y); + Game.LeftBackground.rotate((r/360)*Math.PI*2); + Game.LeftBackground.globalAlpha=0.5; + Game.LeftBackground.drawImage(Game.Assets['shine.png'],-s/2,-s/2,s,s); + Game.LeftBackground.rotate((-r*2/360)*Math.PI*2); + Game.LeftBackground.globalAlpha=0.25; + Game.LeftBackground.drawImage(Game.Assets['shine.png'],-s/2,-s/2,s,s); + Game.LeftBackground.restore(); + //big cookie + Game.LeftBackground.globalAlpha=1; + var s=256*Game.BigCookieSize; + var x=Game.cookieOriginX; + var y=Game.cookieOriginY; + Game.LeftBackground.save(); + Game.LeftBackground.translate(x,y); + //Game.LeftBackground.rotate(((Game.startDate%360)/360)*Math.PI*2); + Game.LeftBackground.drawImage(Game.Assets['perfectCookie.png'],-s/2,-s/2,s,s); + Game.LeftBackground.restore(); + } + else + { + //big cookie shine + var s=512; + var x=Game.cookieOriginX-s/2; + var y=Game.cookieOriginY-s/2; + Game.LeftBackground.globalAlpha=0.5; + Game.LeftBackground.drawImage(Game.Assets['shine.png'],x,y,s,s); + //big cookie + Game.LeftBackground.globalAlpha=1; + var s=256*Game.BigCookieSize; + var x=Game.cookieOriginX-s/2; + var y=Game.cookieOriginY-s/2; + Game.LeftBackground.drawImage(Game.Assets['perfectCookie.png'],x,y,s,s); + } + + + + + //cursors + if (Game.prefs.cursors) + { + var amount=Game.Objects['Cursor'].amount; + for (var i=0;i0.997) w=1.5; + else if (w>0.994) w=0.5; + else w=0; + w*=-4; + if (Game.prefs.fancy) w+=Math.sin((n+Game.T*0.01)*Math.PI/2)*4; + if (Game.prefs.fancy) r=(-(a)*360-Game.T*0.1); + var x=0; + var y=(140+n*16+w)-16; + + Game.LeftBackground.save(); + Game.LeftBackground.translate((Game.LeftBackground.canvas.width/2),(Game.LeftBackground.canvas.height*0.4)); + Game.LeftBackground.rotate((r/360)*Math.PI*2); + + Game.LeftBackground.drawImage(Game.Assets['cursor.png'],x,y); + Game.LeftBackground.restore(); + } + } + + + //milk and milk accessories + if (Game.prefs.milk) + { + 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*2)%480); + var y=(((Game.milkHd)*Game.LeftBackground.canvas.height)*(1+0.05*(Math.sin(Game.T*0.017)/2+0.5))); + var m1o=1; + var m2o=0; + var m1i=0; + var m2i=0; + if (Game.milkProgress<1) {m1o=1;m1i=0;m2i=1;} + else if (Game.milkProgress<2) {m1o=1-(Game.milkProgress-1);m1i=0;m2i=1;} + else if (Game.milkProgress<3) {m1o=1-(Game.milkProgress-2);m1i=1;m2i=2;} + else if (Game.milkProgress<4) {m1o=1-(Game.milkProgress-3);m1i=2;m2i=3;} + else if (Game.milkProgress<5) {m1o=1-(Game.milkProgress-4);m1i=3;m2i=4;} + else {m1o=1;m1i=2;m2i=2;} + var pic1=Game.MilkPics[m1i]; + var pic2=Game.MilkPics[m2i]; + Game.LeftBackground.globalAlpha=m1o*0.9; + Game.LeftBackground.fillPattern(Game.Assets[pic1+'.png'],-480+x,Game.LeftBackground.canvas.height-y,Game.LeftBackground.canvas.width+480,1,480,480); + m2o=1-m1o; + if (m2o>0) + { + Game.LeftBackground.globalAlpha=m2o*0.9; + Game.LeftBackground.fillPattern(Game.Assets[pic2+'.png'],-480+x,Game.LeftBackground.canvas.height-y,Game.LeftBackground.canvas.width+480,1,480,480); + } + Game.LeftBackground.globalAlpha=0.9; + Game.LeftBackground.fillStyle='#000'; + Game.LeftBackground.fillRect(0,Game.LeftBackground.canvas.height-y+480,Game.LeftBackground.canvas.width,Math.max(0,(y-480))); + Game.LeftBackground.globalAlpha=1; + } + + Game.DrawWrinklers(); + if (Game.Has('A festive hat')) Game.DrawSanta(); + + Game.particlesDraw(2); + + //shiny border during frenzies etc + Game.LeftBackground.globalAlpha=1; + var borders='shadedBorders.png'; + if (Game.clickFrenzy>0 || (Game.frenzy>0 && Game.frenzyPower>=1)) borders='shadedBordersGold.png'; + else if (Game.frenzy>0) borders='shadedBordersRed.png'; + Game.LeftBackground.drawImage(Game.Assets[borders],0,0,Game.LeftBackground.canvas.width,Game.LeftBackground.canvas.height); + + }; + + + /*===================================================================================== + DUNGEONS + =======================================================================================*/ + + LaunchDungeons(); + + /*===================================================================================== + INITIALIZATION END; GAME READY TO LAUNCH + =======================================================================================*/ + + if (!Game.mobile) Game.LoadSave(); + + Game.ready=1; + l('javascriptError').innerHTML=''; + l('javascriptError').style.display='none'; + Game.Loop(); + } + + /*===================================================================================== + LOGIC + =======================================================================================*/ + Game.Logic=function() + { + for (var i in Game.Objects) + { + if (Game.Objects[i].EachFrame) Game.Objects[i].EachFrame(); + } + if (Game.Has('A festive hat')) Game.UpdateSanta(); + Game.UpdateGrandmapocalypse(); + + + //handle graphic stuff + if (Game.BigCookieState==1) Game.BigCookieSize+=(0.98-Game.BigCookieSize)*0.5; + else if (Game.BigCookieState==2) Game.BigCookieSize+=(1.05-Game.BigCookieSize)*0.5; + else Game.BigCookieSize+=(1-Game.BigCookieSize)*0.5; + Game.particlesUpdate(); + + if (Game.mousePointer) l('sectionLeft').style.cursor='pointer'; + else l('sectionLeft').style.cursor='auto'; + Game.mousePointer=0; + + //handle milk and milk accessories + Game.milkProgress=Game.AchievementsOwned/25; + if (Game.milkProgress>=0.5) Game.Unlock('Kitten helpers'); + if (Game.milkProgress>=1) Game.Unlock('Kitten workers'); + if (Game.milkProgress>=2) Game.Unlock('Kitten engineers'); + if (Game.milkProgress>=3) Game.Unlock('Kitten overseers'); + Game.milkH=Math.min(1,Game.milkProgress)*0.35; + Game.milkHd+=(Game.milkH-Game.milkHd)*0.02; + + if (Game.autoclickerDetected>0) Game.autoclickerDetected--; + + //handle research + if (Game.researchT>0) + { + Game.researchT--; + } + if (Game.researchT==0 && Game.nextResearch) + { + Game.Unlock(Game.UpgradesById[Game.nextResearch].name); + Game.Popup('Researched : '+Game.UpgradesById[Game.nextResearch].name); + Game.nextResearch=0; + Game.researchT=-1; + } + + //handle cookies + if (Game.recalculateGains) Game.CalculateGains(); + Game.Earn(Game.cookiesPs/Game.fps);//add cookies per second + + //wrinklers + if (Game.cpsSucked>0) + { + Game.Dissolve((Game.cookiesPs/Game.fps)*Game.cpsSucked); + Game.cookiesSucked+=((Game.cookiesPs/Game.fps)*Game.cpsSucked); + } + + //var cps=Game.cookiesPs+Game.cookies*0.01;//exponential cookies + //Game.Earn(cps/Game.fps);//add cookies per second + + for (var i in Game.Objects) + { + var me=Game.Objects[i]; + me.totalCookies+=me.storedTotalCps/Game.fps; + } + if (Game.cookies && Game.T%Math.ceil(Game.fps/Math.min(10,Game.cookiesPs))==0 && Game.prefs.particles) Game.particleAdd();//cookie shower + if (Game.frenzy>0) + { + Game.frenzy--; + if (Game.frenzy<1) Game.recalculateGains=1; + } + if (Game.clickFrenzy>0) + { + Game.clickFrenzy--; + if (Game.clickFrenzy<1) Game.recalculateGains=1; + } + if (Game.T%(Game.fps)==0 && Math.random()<1/500000) Game.Win('Just plain lucky');//1 chance in 500,000 every second achievement + if (Game.T%(Game.fps*5)==0 && Game.ObjectsById.length>0)//check some achievements and upgrades + { + //if (Game.Objects['Factory'].amount>=50 && Game.Objects['Factory'].specialUnlocked==0) {Game.Objects['Factory'].unlockSpecial();Game.Popup('You have unlocked the factory dungeons!');} + + if (isNaN(Game.cookies)) {Game.cookies=0;Game.cookiesEarned=0;Game.recalculateGains=1;} + + var timePlayed=new Date(); + timePlayed.setTime(new Date().getTime()-Game.startDate); + + if (Game.cookiesEarned>=1000000 && !Game.Has('Heavenly chip secret')) + { + if (timePlayed<=1000*60*35) Game.Win('Speed baking I'); + if (timePlayed<=1000*60*25) Game.Win('Speed baking II'); + if (timePlayed<=1000*60*15) Game.Win('Speed baking III'); + } + + if (Game.cookiesEarned>=9999999) Game.Unlock(['Oatmeal raisin cookies','Peanut butter cookies','Plain cookies','Sugar cookies']); + if (Game.cookiesEarned>=99999999) Game.Unlock(['Coconut cookies','White chocolate cookies','Macadamia nut cookies']); + if (Game.cookiesEarned>=999999999) Game.Unlock(['Double-chip cookies','White chocolate macadamia nut cookies','All-chocolate cookies']); + if (Game.cookiesEarned>=9999999999) Game.Unlock(['Dark chocolate-coated cookies','White chocolate-coated cookies']); + if (Game.cookiesEarned>=99999999999) Game.Unlock(['Eclipse cookies','Zebra cookies']); + if (Game.cookiesEarned>=999999999999) Game.Unlock(['Snickerdoodles','Stroopwafels','Macaroons']); + if (Game.cookiesEarned>=999999999999 && Game.Has('Snickerdoodles') && Game.Has('Stroopwafels') && Game.Has('Macaroons')) + { + Game.Unlock('Empire biscuits'); + if (Game.Has('Empire biscuits')) Game.Unlock('British tea biscuits'); + if (Game.Has('British tea biscuits')) Game.Unlock('Chocolate british tea biscuits'); + if (Game.Has('Chocolate british tea biscuits')) Game.Unlock('Round british tea biscuits'); + if (Game.Has('Round british tea biscuits')) Game.Unlock('Round chocolate british tea biscuits'); + if (Game.Has('Round chocolate british tea biscuits')) Game.Unlock('Round british tea biscuits with heart motif'); + if (Game.Has('Round british tea biscuits with heart motif')) Game.Unlock('Round chocolate british tea biscuits with heart motif'); + } + if (Game.cookiesEarned>=9999999999999) + { + Game.Unlock(['Madeleines','Palmiers','Palets','Sablés']); + + if (Game.prestige['Heavenly chips']>=1) Game.Unlock('Caramoas'); + if (Game.prestige['Heavenly chips']>=2) Game.Unlock('Sagalongs'); + if (Game.prestige['Heavenly chips']>=3) Game.Unlock('Shortfoils'); + if (Game.prestige['Heavenly chips']>=4) Game.Unlock('Win mints'); + + if (Game.prestige['Heavenly chips']>=10) Game.Unlock('Fig gluttons'); + if (Game.prestige['Heavenly chips']>=100) Game.Unlock('Loreols'); + if (Game.prestige['Heavenly chips']>=500) Game.Unlock('Jaffa cakes'); + if (Game.prestige['Heavenly chips']>=2000) Game.Unlock('Grease\'s cups'); + } + if (Game.cookiesEarned>=99999999999999) + { + Game.Unlock(['Gingerbread men','Gingerbread trees']); + } + + + + if (Game.prestige['Heavenly chips']>0) + { + Game.Unlock('Heavenly chip secret'); + if (Game.Has('Heavenly chip secret')) Game.Unlock('Heavenly cookie stand'); + if (Game.Has('Heavenly cookie stand')) Game.Unlock('Heavenly bakery'); + if (Game.Has('Heavenly bakery')) Game.Unlock('Heavenly confectionery'); + if (Game.Has('Heavenly confectionery')) Game.Unlock('Heavenly key'); + + if (Game.Has('Heavenly key')) Game.Win('Wholesome'); + } + + for (var i=0;i=Game.moneyAchievs[i*2+1]) Game.Win(Game.moneyAchievs[i*2]); + } + var buildingsOwned=0; + var oneOfEach=1; + var mathematician=1; + var base10=1; + var centennial=1; + for (var i in Game.Objects) + { + buildingsOwned+=Game.Objects[i].amount; + if (!Game.HasAchiev('One with everything')) {if (Game.Objects[i].amount==0) oneOfEach=0;} + if (!Game.HasAchiev('Mathematician')) {if (Game.Objects[i].amount=1000000 && Game.cookieClicks<=15) Game.Win('Neverclick'); + if (Game.cookiesEarned>=1000000 && Game.cookieClicks<=0) Game.Win('True Neverclick'); + if (Game.handmadeCookies>=1000) {Game.Win('Clicktastic');Game.Unlock('Plastic mouse');} + if (Game.handmadeCookies>=100000) {Game.Win('Clickathlon');Game.Unlock('Iron mouse');} + if (Game.handmadeCookies>=10000000) {Game.Win('Clickolympics');Game.Unlock('Titanium mouse');} + if (Game.handmadeCookies>=1000000000) {Game.Win('Clickorama');Game.Unlock('Adamantium mouse');} + if (Game.handmadeCookies>=100000000000) {Game.Win('Clickasmic');Game.Unlock('Unobtainium mouse');} + if (Game.cookiesEarned=1) Game.Win('Itchscratcher'); + if (Game.wrinklersPopped>=50) Game.Win('Wrinklesquisher'); + if (Game.wrinklersPopped>=200) Game.Win('Moistburster'); + + if (Game.cookiesEarned>=25) Game.Unlock('A festive hat'); + if (Game.Has('Christmas tree biscuits') && Game.Has('Snowflake biscuits') && Game.Has('Snowman biscuits') && Game.Has('Mistletoe biscuits') && Game.Has('Candy cane biscuits') && Game.Has('Bell biscuits') && Game.Has('Present biscuits')) Game.Win('Let it snow'); + + if (Game.reindeerClicked>=1) Game.Win('Oh deer'); + if (Game.reindeerClicked>=50) Game.Win('Sleigh of hand'); + if (Game.reindeerClicked>=200) Game.Win('Reindeer sleigher'); + + if (buildingsOwned>=100) Game.Win('Builder'); + if (buildingsOwned>=400) Game.Win('Architect'); + if (buildingsOwned>=800) Game.Win('Engineer'); + if (Game.UpgradesOwned>=20) Game.Win('Enhancer'); + if (Game.UpgradesOwned>=50) Game.Win('Augmenter'); + if (Game.UpgradesOwned>=100) Game.Win('Upgrader'); + + if (Game.UpgradesOwned==0 && Game.cookiesEarned>=1000000000) Game.Win('Hardcore'); + + if (Game.prestige['Heavenly chips']>=1 && Game.Has('Bingo center/Research facility')) Game.Unlock('Persistent memory'); + + var grandmas=0; + if (Game.Has('Farmer grandmas')) grandmas++; + if (Game.Has('Worker grandmas')) grandmas++; + if (Game.Has('Miner grandmas')) grandmas++; + if (Game.Has('Cosmic grandmas')) grandmas++; + if (Game.Has('Transmuted grandmas')) grandmas++; + if (Game.Has('Altered grandmas')) grandmas++; + if (Game.Has('Grandmas\' grandmas')) grandmas++; + if (Game.Has('Antigrandmas')) grandmas++; + if (!Game.HasAchiev('Elder') && grandmas>=7) Game.Win('Elder'); + if (Game.Objects['Grandma'].amount>=6 && !Game.Has('Bingo center/Research facility') && Game.HasAchiev('Elder')) Game.Unlock('Bingo center/Research facility'); + if (Game.pledges>0) Game.Win('Elder nap'); + if (Game.pledges>=5) Game.Win('Elder slumber'); + if (Game.pledges>=10) Game.Unlock('Sacrificial rolling pins'); + + if (!Game.HasAchiev('Cookie-dunker') && Game.LeftBackground && Game.milkProgress>0.1 && (Game.LeftBackground.canvas.height*0.4+256/2-16)>((1-Game.milkHd)*Game.LeftBackground.canvas.height)) Game.Win('Cookie-dunker'); + //&& l('bigCookie').getBoundingClientRect().bottom>l('milk').getBoundingClientRect().top+16 && Game.milkProgress>0.1) Game.Win('Cookie-dunker'); + } + + Game.cookiesd+=(Game.cookies-Game.cookiesd)*0.3; + + if (Game.storeToRebuild) Game.RebuildStore(); + if (Game.upgradesToRebuild) Game.RebuildUpgrades(); + + if (Game.T%(Game.fps*2)==0) document.title=Beautify(Game.cookies)+' '+(Game.cookies==1?'cookie':'cookies')+' - Cookie Clicker'; + + Game.TickerAge--; + if (Game.TickerAge<=0 || Game.Ticker=='') Game.getNewTicker(); + + var veilLimit=0;//10; + if (Game.veil==1 && Game.cookiesEarned>=veilLimit) Game.veilOff(); + else if (Game.veil==0 && Game.cookiesEarnedGame.fps*10 && Game.prefs.autosave) Game.WriteSave(); + if (Game.T%(Game.fps*60*30)==0 && Game.T>Game.fps*10 && Game.prefs.autoupdate) Game.CheckUpdates(); + + Game.T++; + } + + /*===================================================================================== + DRAW + =======================================================================================*/ + + Game.MilkPics={0:'milkWave',1:'chocolateMilkWave',2:'raspberryWave',3:'orangeWave',4:'caramelWave'}; + + Game.Draw=function() + { + Game.DrawBackground(); + + + + var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies'); + if (Math.round(Game.cookiesd).toString().length>11 && !Game.mobile) unit='
cookies'; + var str=Beautify(Math.round(Game.cookiesd))+unit+'
0?' class="warning"':'')+'>per second : '+Beautify(Game.cookiesPs*(1-Game.cpsSucked),1)+'
';//display cookie amount + l('cookies').innerHTML=str; + l('compactCookies').innerHTML=str; + + + Game.TickerDraw(); + Game.tooltip.update(); + + for (var i in Game.Objects) + { + var me=Game.Objects[i]; + + //make products full-opacity if we can buy them + if (Game.cookies>=me.getPrice()) l('product'+me.id).className='product enabled'; else l('product'+me.id).className='product disabled'; + + //update object info + if (l('rowInfo'+me.id) && Game.T%5==0) l('rowInfoContent'+me.id).innerHTML='• '+me.amount+' '+(me.amount==1?me.single:me.plural)+'
• producing '+Beautify(me.storedTotalCps,1)+' '+(me.storedTotalCps==1?'cookie':'cookies')+' per second
• total : '+Beautify(me.totalCookies)+' '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName; + } + + //make upgrades full-opacity if we can buy them + for (var i in Game.UpgradesInStore) + { + var me=Game.UpgradesInStore[i]; + if (Game.cookies>=me.getPrice()) l('upgrade'+i).className='crate upgrade enabled'; else l('upgrade'+i).className='crate upgrade disabled'; + } + if (Game.drawT%30==0) + { + var grandmaIcons=['grandmaIcon','grandmaIconB','grandmaIconC','grandmaIconD']; + l('productIcon'+Game.Objects['Grandma'].id).style.backgroundImage='url(img/'+grandmaIcons[Game.elderWrath]+'.png)';//oh god fix this (should change when the store tabs are updated and when the grandmapocalypse level changes) + } + + if (Math.floor(Game.T%Game.fps)==0) Game.UpdateMenu(); + + Game.textParticlesUpdate(); + + Game.drawT++; + } + + /*===================================================================================== + MAIN LOOP + =======================================================================================*/ + Game.Loop=function() + { + //update game logic ! + Game.catchupLogic=0; + Game.Logic(); + Game.catchupLogic=1; + + //latency compensator + Game.accumulatedDelay+=((new Date().getTime()-Game.time)-1000/Game.fps); + Game.accumulatedDelay=Math.min(Game.accumulatedDelay,1000*5);//don't compensate over 5 seconds; if you do, something's probably very wrong + Game.time=new Date().getTime(); + while (Game.accumulatedDelay>0) + { + Game.Logic(); + 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) + } + Game.catchupLogic=0; + + Game.Draw(); + + setTimeout(Game.Loop,1000/Game.fps); + } +} + + +/*===================================================================================== +LAUNCH THIS THING +=======================================================================================*/ +Game.Launch(); + +window.onload=function() +{ + if (!Game.ready) Game.Load(); +}; diff --git a/mobile.js b/mobile.js new file mode 100644 index 0000000..3d0f5d6 --- /dev/null +++ b/mobile.js @@ -0,0 +1,82 @@ +var LaunchMobile=function() +{ + Game.m={fileSystem:{}};//handle for every thing mobile + + //docs for this stuff : http://docs.phonegap.com/en/3.0.0/cordova_file_file.md.html + + Game.m.readSaveRequest=function() + { + Debug('Load save request'); + Game.m.fileSystem.root.getFile(Game.SaveTo+'.txt',{create:true,exclusive: false},Game.m.readFileEntry,Game.m.fail); + } + Game.m.readSaveResponse=function(response) + { + Debug('Load save response'); + Game.LoadSave(unescape(response)); + } + Game.m.writeSaveRequest=function() + { + Debug('Write save request'); + Game.m.fileSystem.root.getFile(Game.SaveTo+'.txt',{create:true,exclusive: false},Game.m.writeFileEntry,Game.m.fail); + } + + + Game.m.onDeviceReady=function() + { + Debug('Ready'); + window.requestFileSystem(LocalFileSystem.PERSISTENT,0,Game.m.gotFileSystem,Game.m.fail);//ask for the file system + } + + Game.m.gotFileSystem=function(fileSystem) + { + Debug('Got file system'); + Game.m.fileSystem=fileSystem;//did we get the file system? Good, save it + Game.LoadSave();//load the save for good measure + } + + Game.m.readFileEntry=function(fileEntry) + { + Debug('Read file entry'); + fileEntry.file(Game.m.readFile,Game.m.fail);//did we get the requested file entry? That's just super, get ready to read it + } + Game.m.readFile=function(file) + { + Debug('Read file'); + var reader=new FileReader();//we got the file we wanted? Radical. Let's read it now + reader.onloadend=function(evt) + { + Game.m.readSaveResponse(evt.target.result); + //console.log(evt.target.result); + }; + reader.readAsText(file); + } + + + + Game.m.writeFileEntry=function(fileEntry) + { + Debug('Write file entry'); + fileEntry.createWriter(Game.m.writeFile,Game.m.fail);//did we get the requested file entry? Joy and butterflies, now we can write to it + } + Game.m.writeFile=function(writer) + { + Debug('Write file'); + writer.onwriteend=function(evt)//why this plugin isn't using unquestionably superior camel-case is beyond me + { + }; + writer.write(Game.saveData);//well oh my goodness I think we're done here + } + + + + Game.m.fail=function(evt)//well I guess something went wrong + { + Debug('Failed'); + console.log(evt.target.error.code); + Game.Popup(evt.target.error.code); + } + + //Wait for device API libraries to load + Debug('Readying mobile'); + document.addEventListener('deviceready',Game.m.onDeviceReady,false); +} \ No newline at end of file diff --git a/phonegap.js b/phonegap.js new file mode 100644 index 0000000..d04c424 --- /dev/null +++ b/phonegap.js @@ -0,0 +1,168 @@ +Aw noes ! 404 ! + + + + + + + + + + +
+
+
+
+
+
+
(c) Orteil 2011
proudly hosted by dashnet.org
+
+
+ + + + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..c36eb41 --- /dev/null +++ b/style.css @@ -0,0 +1,1260 @@ +/* reset CSS */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} + + +html,body +{ + width:100%; + height:100%; +} + +body +{ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: -moz-none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + color:#fff; + background:#000 url(img/darkNoise.png); + font-family:Tahoma,Arial,sans-serif; + font-size:13px; +} + +small +{ + font-size:80%; +} + +a,a:visited +{ + text-decoration:underline; + cursor:pointer; + color:#ccc; +} +a:hover +{ + text-shadow:0px 0px 3px #fff; + color:#fff; +} +a:active +{ + opacity:0.8; + background:transparent; +} + +.inset +{ + /*box-shadow:0px 0px 12px #000 inset;*/ +} + +.title,.section +{ + font-family: 'Kavoon', Georgia,serif; + font-size:28px; + text-shadow:0px 0px 4px #000; + color:#fff; +} +.section +{ + padding:16px; + width:100%; + text-align:center; +} +.subsection +{ + padding:8px 0px; + font-size:14px; +} +.subsection div.title +{ + font-size:22px; + padding:8px 16px; + width:100%; + border-bottom:1px solid #999; + margin-bottom:8px; +} +.update .title +{ + color:#69c; +} +.update.small .title +{ + font-size:16px; + opacity:0.8; + color:#fff; +} +.listing +{ + padding:3px 16px; + font-size:13px; +} +.listing b +{ + font-weight:bold; + opacity:0.6; +} +.listing small +{ + font-size:11px; + opacity:0.9; +} +.listing label +{ + font-size:12px; + border-bottom:1px solid #fff; + opacity:0.5; + padding-left:16px; + padding-bottom:2px; + position:relative; + left:-4px; + top:-2px; +} +.hidden +{ + visibility:hidden; +} +.listing:hover .hidden +{ + visibility:visible; +} + +a.option, .info a +{ + display:inline-block; + border:1px solid #ccc; + background:#000; + margin:2px 4px 2px 0px; + color:#ccc; + font-size:12px; + padding:4px 8px; + text-decoration:none; +} +a.option:hover, .info a:hover +{ + border-color:#fff; + color:#fff; + text-shadow:none; +} +a.option:active, .info a:active +{ + background-color:#333; +} +a.option.warning:hover +{ + border-color:#f33; + color:#f33; +} +a.option.warning:active +{ + background-color:#300; +} +.info a +{ + border-color:#666; + background:#eee; + color:#666; + padding:2px 6px; +} +.info a:hover +{ + border-color:#000; + background-color:#fff; + color:#000; +} +.info a:active +{ + background-color:#999; +} + +.warning, a.option.warning +{ + color:#c00; + border-color:#c00; +} + +#backgroundLayers, #backgroundLayers div +{ + width:100%; + height:100%; + position:absolute; + left:0px; + top:0px; +} +/* +#backgroundLayer1 +{ + background:url(img/bgBlue.jpg); +} +#backgroundLayer2 +{ + background:#000 url(img/darkNoise.png); +} +*/ +#backgroundCanvas,#backgroundLeftCanvas +{ + position:absolute; + left:0px; + top:0px; +} + +#topBar +{ + position:absolute; + left:0px; + top:0px; + width:100%; + height:32px; + background:url(img/darkNoise.png); + box-shadow:0px -4px 8px #666 inset; + color:#ccc; +} +#topBar div +{ + margin:6px 8px; +} +#topBar a +{color:#fff;} + +#javascriptError +{ + position:absolute; + left:0px; + top:0px; + right:0px; + bottom:0px; + background:url(img/darkNoise.png); + text-align:center; + z-index:100000000000; + line-height:150%; + font-size:20px; +} +#game +{ + position:absolute; + left:0px; + top:32px; + right:0px; + bottom:0px; + overflow:hidden; +} +#sectionLeft +{ + position:absolute; + left:0px; + top:0px; + width:30%; + bottom:0px; + min-width:100px; + overflow:hidden; +} +#sectionMiddle +{ + position:absolute; + left:30%; + padding-left:16px; + margin-right:15px; + top:0px; + right:318px; + bottom:0px; + min-width:100px; + overflow-x:hidden; + overflow-y:scroll; +} +#game.onMenu #sectionMiddle +{ + background:#000 url(img/darkNoise.png); +} +#sectionRight +{ + height:100%; + position:absolute; + top:0px; + right:0px; + overflow-x:hidden; + overflow-y:scroll; +} + +#sectionLeft .blackGradient +{ + background:url(img/blackGradient.png) repeat-x bottom; + position:absolute; + left:0px; + right:0px; + top:300px; + height:640px; +} +#sectionLeft .blackFiller +{ + background:#000; + position:absolute; + left:0px; + right:0px; + top:940px; + bottom:0px; +} + +#tooltipAnchor +{ + position:absolute; + z-index:1000000000; + display:none; +} +#tooltip +{ + position:absolute; + background:#000 url(img/darkNoise.png); + padding:4px 8px; + margin:4px; + border:3px ridge #d2e248; + border-color:#c7cd6e #a48836 #845a36 #a48836; + border-radius:3px; + box-shadow:0px 0px 1px 2px rgba(0,0,0,0.5),0px 2px 4px rgba(0,0,0,0.25),0px 0px 6px 1px rgba(0,0,0,0.5) inset; + text-shadow:0px 1px 1px #000; + color:#ccc; +} + +#tooltip b +{ + color:#fff; + font-weight:bold; +} +#tooltip .name +{ + font-weight:bold; + font-size:110%; + color:#fff; + margin:2px 0px; +} +.description +{ + margin:4px 0px; +} + +#tooltip q +{ + display:block; + position:relative; + text-align:right; + margin-top:8px; + font-style:italic; + opacity:0.7; + font-size:11px; +} +q:before +{ + display:inline-block; + content:"\""; +} +q:after +{ + display:inline-block; + content:"\""; +} + + +.price +{ + font-weight:bold; + color:#6f6; + padding-left:18px; + position:relative; +} +.price.disabled, .disabled .price +{ + color:#f66; +} +.price:before +{ + content:''; + display:block; + position:absolute; + left:0px; + top:2px; + background:url(img/money.png); + width:16px; + height:16px; +} +.price.plain +{ + color:#fff; + display:inline-block; +} +.price.plain:before +{ + top:0px; +} + +#cookieAnchor +{ + position:absolute; + left:50%; + top:40%; +} +#bigCookie +{ + width:256px; + height:256px; + position:absolute; + left:-128px; + top:-128px; + /*background:url(img/perfectCookie.png); + background-size:256px 256px;*/ + background:url(img/empty.png);/* somehow necessary; an empty div with no background seems to be click-through */ + cursor:pointer; + z-index:10000; +} +.elderWrath #bigCookie +{ + background:url(img/imperfectCookie.png); + background-size:256px 256px; +} +#cookieNumbers{position:absolute;top:-80px;} +.cookieNumber +{ + position:absolute; + pointer-events:none; + left:-100px; + top:0px; + width:200px; + z-index:100; + text-align:center; + text-shadow:none; +} +#cookieCursors{position:absolute;z-index:5;} +.cursor +{ + width:32px; + height:32px; + position:absolute; + background:url(img/cursor.png); +} +.cookieParticle +{ + width:64px; + height:64px; + margin-left:-32px; + margin-top:-32px; + position:absolute; + background:url(img/smallCookies.png); + opacity:0; +} +#particles {position:absolute;left:0px;top:0px;} +.particle +{ + position:absolute; + pointer-events:none; + left:-200px; + bottom:0px; + width:400px; + z-index:100000000; + text-align:center; + text-shadow:0px 0px 6px #000; + font-size:24px; +} +#cookieShower +{ + position:absolute; + width:100%; + height:100%; + z-index:2; +} +#milk +{ + width:100%; + height:0%; + position:absolute; + left:0px; + bottom:0px; + z-index:100; + opacity:0.9; +} +.milkLayer +{ + width:100%; + height:100%; + position:absolute; + left:0px; + top:0px; + background-repeat:repeat-x; +} +#cookies +{ + position:absolute; + left:0px; + top:15%; + width:100%; + text-align:center; + z-index:200; + background:#000; + background:rgba(0,0,0,0.4); + padding:2px 0px; +} + +.separatorLeft, .separatorRight +{ + width:16px; + height:100%; + background:url(img/panelVertical.png) repeat-y; + position:absolute; + top:0px; + bottom:0px; + z-index:100; +} +.separatorLeft +{ + left:30%; +} +.separatorRight +{ + right:317px; +} +.separatorBottom +{ + width:100%; + height:16px; + background:url(img/panelHorizontal.png) repeat-x; + position:absolute; + left:0px; + bottom:0px; +} + +.button +{ + background:#000 url(img/darkNoise.png); + box-shadow:0px 0px 3px #666 inset,0px 0px 4px #000; + position:absolute; + z-index:100; + width:64px; + height:24px; + text-align:center; + font-size:18px; + cursor:pointer; + + -webkit-transition: left 0.1s ease-out,right 0.1s ease-out,box-shadow 0.1s ease-out; + -moz-transition: left 0.1s ease-out,right 0.1s ease-out,box-shadow 0.1s ease-out; + -ms-transition: left 0.1s ease-out,right 0.1s ease-out,box-shadow 0.1s ease-out; + -o-transition: left 0.1s ease-out,right 0.1s ease-out,box-shadow 0.1s ease-out; + transition: left 0.1s ease-out,right 0.1s ease-out,box-shadow 0.1s ease-out; +} +.button:hover +{ + box-shadow:0px 0px 12px #ccc inset,0px 0px 4px #000; + z-index:1000; +} +#prefsButton:hover,#statsButton:hover{left:-8px;} +#prefsButton,#statsButton{padding:14px 0px 10px 16px;} +#prefsButton{top:0px;left:-16px;} +#statsButton{bottom:16px;left:-16px;} +#logButton:hover{right:-8px;} +#logButton{padding:14px 16px 10px 0px;} +#logButton{bottom:16px;right:-16px;} + +#game.onMenu #menu{display:block;} +#game.onMenu .row{display:none;} +#menu +{ + display:none; + z-index:1000000; + position:absolute; + left:16px; + right:0px; + top:112px; + bottom:0px; + /*box-shadow:0px 0px 24px #000 inset; + background:#000 url(img/darkNoise.png);*/ +} + +#comments +{ + padding:16px; + text-align:center; + position:relative; + padding-bottom:32px; + font-size:16px; + height:64px; + overflow:hidden; +} +#commentsText +{ + padding:0px 64px; +} +.commentsText q +{ + font-style:italic; +} +.commentsText sig +{ + font-size:70%; + display:block; + text-align:center; + opacity:0.7; +} +.commentsText sig:before +{ + content:"-"; + padding-left:64px; +} + +.row +{ + height:128px; + position:relative; + padding-bottom:32px; + display:none; + overflow:hidden; +} +.row.enabled{display:block;} +.row .content +{ + width:100%; + height:128px; + position:absolute; + overflow-x:scroll; + overflow-y:hidden; + padding-bottom:16px; +} +.row .background +{ + background:#999; + position:absolute; + left:0px; + top:0px; + height:100%; + z-index:1; + min-width:100%; +} +.row .backgroundLeft,.row .backgroundRight +{ + width:128px; + height:128px; + position:absolute; + top:0px; +} +.row .backgroundLeft +{ + left:0px; +} +.row .backgroundRight +{ + right:0px; +} +.row .objects +{ + position:absolute; + z-index:10; +} +.row .special +{ + position:absolute; + z-index:1000000; + width:100%; + top:0px; + bottom:16px; + background:#000 url(img/mapBG.jpg) fixed; + display:none; +} +.row .specialButton +{ + display:none; + position:absolute; + top:0px; + left:0px; + width:128px; + height:128px; + z-index:200000; +} +.row .specialButtonPic +{ + display:block; + width:100%; + height:100%; + background:transparent 0px 8px no-repeat; +} +.row .specialButtonText +{ + display:block; + position:absolute; + left:0px; + bottom:16px; + width:100%; + text-align:center; + text-shadow:0px 0px 4px #000; + font-weight:bold; + font-size:10px; +} +a.control +{ + position:absolute; + width:48px; + height:48px; + background:url(img/control.png) no-repeat; + opacity:0.8; +} +a.control:hover{opacity:1;} +a.control.west{left:0px;top:48px;background-position:0px -48px;} +a.control.east{left:96px;top:48px;background-position:-96px -48px;} +a.control.north{left:48px;top:0px;background-position:-48px 0px;} +a.control.south{left:48px;top:96px;background-position:-48px -96px;} +a.control.middle{left:48px;top:48px;background-position:-48px -48px;} +.map +{ + position:absolute; + left:0px; + top:0px; + overflow:hidden; + background:#00061b; +} +.map:after{content:'';pointer-events:none;display:block;position:absolute;left:0px;top:0px;width:144px;height:144px;z-index:100000;background:url(img/dungeonOverlay.png);} +.map .tile, .map .thing +{ + width:16px; + height:16px; + position:absolute; + left:0px; + top:0px; +} +.mapContainer +{ + /* meh. */ + /* + -webkit-transition: top 0.1s ease-out, left 0.1s ease-out; + -moz-transition: top 0.1s ease-out, left 0.1s ease-out; + -ms-transition: top 0.1s ease-out, left 0.1s ease-out; + -o-transition: top 0.1s ease-out, left 0.1s ease-out; + transition: top 0.1s ease-out, left 0.1s ease-out; + */ +} +.map .tile {background:url(img/dungeonTiles.png) no-repeat;z-index:100;} +.map .thing {background:url(img/dungeonIcons.png) no-repeat;z-index:200;} + +.dungeonName +{ + position:absolute; + top:24px; + left:-32px; + width:256px; + opacity:0.6; +} +.dungeonLog +{ + position:absolute; + right:0px; + top:0px; + width:200px; + height:100%; + overflow-y:scroll; + z-index:100; +} +.dungeonLog div +{ + font-size:10px; + padding:3px 2px; + opacity:0.6; + text-shadow:0px 1px 0px #000; +} +.dungeonLog div.new +{ + opacity:1; +} +.dungeonLog div b{font-weight:bold;} + +.mobSlot +{ + width:96px; + height:100%; + position:absolute; + left:0px; + bottom:0px; +} +.mobPic +{ + width:96px; + height:96px; + background:transparent center bottom no-repeat; + position:absolute; + left:0px; + bottom:32px; +} +.mobName +{ + position:absolute; + width:200%; + left:-50%; + bottom:16px; + text-align:center; + font-size:12px; +} +.hpBar +{ + position:absolute; + width:100%; + left:0px; + top:0px; + height:100%; + background:url(img/hpBar.png) repeat-x; + -webkit-transition: width 0.1s ease-out; + -moz-transition: width 0.1s ease-out; + -ms-transition: width 0.1s ease-out; + -o-transition: width 0.1s ease-out; + transition: width 0.1s ease-out; +} +.hpmBar +{ + position:absolute; + width:70%; + left:15%; + bottom:4px; + height:8px; + background:url(img/hpmBar.png) repeat-x; + box-shadow:0px 0px 4px #000; +} + +.map .thing .mapInfo{display:none;position:absolute;left:0px;top:0px;z-index:1000000;background:#000;padding:4px 8px;} +.map .thing:hover .mapInfo{display:block;} +.special .fighter {position:absolute;width:96px;height:96px;} +.row .info, #sectionLeft .info, .row .specialButton +{ + /*visibility:hidden;*/ + -webkit-transition: opacity 0.1s ease-out; + -moz-transition: opacity 0.1s ease-out; + -ms-transition: opacity 0.1s ease-out; + -o-transition: opacity 0.1s ease-out; + transition: opacity 0.1s ease-out; + opacity:0; +} +.row .info, #sectionLeft .info +{ + position:absolute; + top:0px; + left:0px; + height:112px; + padding:8px; + font-size:12px; + line-height:125%; + background:url(img/infoBG.png); + color:#666; + z-index:100000; +} +.row .info:after +{ + width:16px; + height:128px; + position:absolute; + right:-16px; + top:0px; + background:url(img/infoBGfade.png) repeat-y; + display:block; + content:''; +} +#sectionLeft .info +{ + border-radius:16px; + padding:24px 8px 8px 24px; + left:-16px; + top:-16px; + height:auto; +} +.row:hover .info, #sectionLeft:hover .info, .row:hover .specialButton +{ + opacity:1; +} +.row .object +{ + position:absolute; + width:64px; + height:64px; +} +#sectionLeftInfo +{ + position:absolute; + left:0px; + top:0px; + width:100%; +} + +.zoneTitle +{ + text-align:center; + padding:8px; + width:100%; +} +#storeTitle +{ + width:284px; +} +#buildingsTitle +{ + display:none; +} +#upgrades +{ + height:60px; + width:300px; + position:relative; + overflow-y:hidden; +} +#upgrades:hover +{ + height:auto; + min-height:60px; +} +.crate +{ + width:60px; + height:60px; + display:inline-block; + cursor:pointer; + opacity:0.6; + position:relative; + background:#000; + float:left; +} +.crate:before +{ + content:''; + position:absolute; + left:0px; + top:0px; + width:60px; + height:60px; + display:block; + background:url(img/upgradeFrame.png); + z-index:10; +} +.icon +{ + width:48px; + height:48px; + display:inline-block; + margin:0px 4px; +} +.icon,.crate +{ + background-image:url(img/icons.png?v=8); +} +.achievement +{ + opacity:0.4; +} +.crate.enabled +{ + opacity:1; +} +.crate:hover:before +{ + box-shadow:0px 0px 6px #fff inset,0px 0px 1px #000; + z-index:20; +} +.crate:hover +{ + background-color:#200e0a; +} +.product +{ + width:300px; + height:64px; + cursor:pointer; + opacity:0.6; + background:url(img/storeTile.jpg); + position:relative; +} +.product:nth-child(4n-3) {background-position:0px 64px;} +.product:nth-child(4n-2) {background-position:0px 128px;} +.product:nth-child(4n-1) {background-position:0px 192px;} +.product:hover +{ + box-shadow:0px 0px 16px #fff inset,0px 0px 1px #000; + z-index:20; +} +.product.enabled:active +{ + box-shadow:0px 0px 16px #000 inset; +} +.product.enabled +{ + opacity:1; +} +.product .icon +{ + width:64px; + height:64px; + position:absolute; + left:0px; + top:0px; + background-repeat:no-repeat; + margin:0px; +} +.product .content +{ + display:inline-block; + position:absolute; + left:64px; + top:6px; + right:0px; + bottom:6px; + padding:4px; + text-shadow:0px 0px 6px #000,0px 1px 1px #000; +} +.product .content .owned +{ + position:absolute; + right:12px; + top:6px; + font-size:40px; + opacity:0.2; + color:#000; + text-shadow:0px 0px 8px #fff; +} + +.goldenCookie +{ + width:96px; + height:96px; + background:url(img/goldCookie.png); + cursor:pointer; + position:absolute; + z-index:10000000000; + display:none; +} + +.seasonPopup +{ + width:256px; + height:256px; + background:url(img/goldCookie.png) center center no-repeat; + cursor:pointer; + position:absolute; + z-index:10000000000; + display:none; +} + +#versionNumber +{ + position:absolute; + left:0px; + bottom:0px; + opacity:0.5; + margin:8px; + font-size:22px; + z-index:100000000; +} + +#alert +{ + display:none; + position:fixed; + bottom:-16px; + left:-16px; + z-index:100000000000; + padding:8px 8px 24px 24px; + font-size:14px; + background:#990; + border-radius:16px; + color:#fff; + box-shadow:0px 0px 4px #000; +} + +#support +{ + width:300px; + text-align:center; + margin:16px auto; +} +#supportComment +{ + opacity:0.5; + margin:8px; +} + +.noFancy * +{ + text-shadow:none!important; + box-shadow:none!important; +} +.noFancy .price +{ + text-shadow:0px 0px 4px #000,0px 1px 0px #000!important; +} + +/* mobile layout */ +.mobile #sectionLeft,.mobile #sectionMiddle,.mobile #sectionRight +{ + width:100%; + position:absolute; + left:0px; + top:128px; + right:0px; + bottom:64px; + display:none; +} +.mobile .separatorLeft,.mobile .separatorRight +{display:none;} + +.mobile .focusLeft #sectionLeft{display:block;} +.mobile .focusMiddle #sectionMiddle{display:block;} +.mobile .focusRight #sectionRight{display:block;} +.mobile .focusMenu #sectionMiddle{display:block;} +.mobile #sectionMiddle +{ + margin:0px; + padding:0px; +} +.mobile #storeTitle,.mobile #upgrades +{ + width:100%; +} +.mobile .product +{ + width:100%; + background-size:100% 400%; +} + +.mobile #game{top:0px;} +.mobile #topBar,.mobile #versionNumber{display:none;} + +#focusButtons +{ + display:none; + position:fixed; + left:0px; + bottom:0px; + height:64px; + width:100%; + background:url(img/darkNoise.png); + z-index:1000000; + font-size:32px; +} +#focusButtons:before +{ + content:''; + display:block; + position:absolute; + left:0px; + top:-16px; + background:url(img/blackGradient.png) repeat-x bottom; + background-size:100% 100%; + width:100%; + height:16px; + opacity:0.5; + pointer-events:none; +} +#focusButtons div +{ + width:25%; + height:50%; + cursor:pointer; + float:left; + background:url(img/buttonTile.jpg); + background-size:100% 400%; + padding:16px 0px; + text-align:center; + opacity:0.5; +} +#focusButtons div:nth-child(4n-3) {background-position:0px 100%;} +#focusButtons div:nth-child(4n-2) {background-position:0px 200%;} +#focusButtons div:nth-child(4n-1) {background-position:0px 300%;} +#focusButtons div:hover +{ + box-shadow:0px 0px 16px #fff inset,0px 0px 1px #000; + z-index:20; +} +#focusButtons div:active +{ + box-shadow:0px 0px 16px #000 inset; +} +.focusLeft #focusButtons #focusLeft,.focusMiddle #focusButtons #focusMiddle,.focusRight #focusButtons #focusRight,.focusMenu #focusButtons #focusMenu +{ + opacity:1; + z-index:20; + box-shadow:0px 0px 8px #fff; +} + +#compactOverlay +{ + display:none; + position:fixed; + left:0px; + top:0px; + height:128px; + width:100%; + background:url(img/darkNoise.png); + z-index:1000000; + text-align:center; + font-size:16px; +} +#compactCommentsText +{ + padding:8px 0px; + opacity:0.8; + position:absolute; + width:100%; + text-align:center; + bottom:16px; + left:0px; +} +#compactCookies +{ + padding:8px 0px; + position:absolute; + width:100%; + height:32px; + top:0px; + left:0px; + font-size:24px; + text-shadow:0px 0px 12px rgba(255,255,255,0.5); + background:rgba(255,255,255,0.05); +} + +.mobile .row {padding-bottom:16px;} + +.mobile #comments, .mobile #cookies {display:none;} +.mobile #focusButtons, .mobile #compactOverlay/*, .mobile #buildingsTitle*/ +{display:block;} + +/**{overflow:hidden!important;}*/ \ No newline at end of file -- cgit v1.2.3