Skip to content

Commit

Permalink
Added sower functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AWittyUsername committed Oct 6, 2018
1 parent 07a6bf8 commit cff4ae1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
.idea/
cookie-clicker.js
47 changes: 46 additions & 1 deletion cookie-sower.js
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
Game.Popup("Hello world!");
CS = {}

CS.init = function(){
CS.Garden = Game.Objects['Farm'].minigame;
CS.initializeTool();
if(Game.prefs.popups){
Game.Popup("Cookie sower loaded!");
}
else{
Game.Notify("Cookie sower loaded!", "Cookie sower for Cookie Clicker version "+Game.version, '', 1, 1);
}
}
CS.plantAll = function(){
if(CS.Garden.seedSelected >= 0){
var plantId = CS.Garden.seedSelected;
Game.Popup(CS.Garden.plantsById[plantId].name);
for(var x = 0;x<6;x++){
for(var y = 0;y<6;y++){
if(CS.Garden.isTileUnlocked(x,y) && CS.Garden.canPlant(CS.Garden.plantsById[plantId]) && (CS.Garden.plot[y][x][0] == 0)){
CS.Garden.plot[y][x]=[plantId+1,0];
Game.Spend(CS.Garden.getCost(CS.Garden.plantsById[plantId]));
}
}
}
l('gardenSeed-'+CS.Garden.seedSelected).classList.remove('on');
CS.Garden.seedSelected = -1;
CS.Garden.toRebuild=true;
}
}
CS.initializeTool = function(){
CS.Garden.tools['sower'] = {
name:'Quick sower',
icon: 2,
desc:'-',
descFunc:function(){
return 'Instantly fill as many empty garden tiles as you can afford with the selected seed. <span class="red">Be careful when <using></using> this tool! Some seeds are VERY expensive.</span><div class=\"line\"></div>';
},
func:function(){
CS.plantAll();
}
}
CS.Garden.toolsById=[];var n=0;for (var i in CS.Garden.tools){CS.Garden.tools[i].id=n;CS.Garden.tools[i].key=i;CS.Garden.toolsById[n]=CS.Garden.tools[i];n++;}
CS.Garden.buildPanel();
}

CS.init();

0 comments on commit cff4ae1

Please sign in to comment.