FANDOM


As of 20:20 06/09/2013 from http://orteil.dashnet.org/cookieclicker/dungeons.js


 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;
 	};
 
 	Game.DungeonTiles=[];
 	Game.DungeonTile=function(name,pic,obstacle)
 	{
 		this.name=name;
 		this.pic=pic;
 		this.obstacle=obstacle;
 		this.id=Game.DungeonTiles.length;
 		Game.DungeonTiles[this.id]=this;
 	}
 	new Game.DungeonTile('void',[0,0],1);
 	new Game.DungeonTile('path',[0,0],0);
 	new Game.DungeonTile('path2',[0,0],0);
 	new Game.DungeonTile('land',[0,0],0);
 	new Game.DungeonTile('land2',[0,0],0);
 	new Game.DungeonTile('bridge',[0,0],0);
 	new Game.DungeonTile('wall1',[0,0],1);
 	new Game.DungeonTile('wall2',[0,0],1);
 	new Game.DungeonTile('water',[0,0],1);
 
 	Game.DungeonNode=function(type)
 	{
 		//note : this isn't how it's gonna work in the final version.
 		//it'll have tiny little maps
 		//it's gonna be cute as butts
 		this.type=type;
 		this.id=0;
 		this.dungeon=-1;
 		this.exits=[];
 		this.Write=function()
 		{
 			var str='';''
 			for (var i in this.exits) {str+='
 <a onclick="Game.ExploreDungeon('+this.dungeon+','+this.id+','+this.exits[i].id+');">'+this.exits[i].type+'</a>';}
 			return 'This is a '+this.type+'.'+(str!=''?'''
 Exits :'+str:'');''
 		}
 	}
 
 	Game.Dungeons=[];
 	Game.Dungeon=function(type,id)
 	{
 		this.type=type;
 		this.id=id;
 		Game.Dungeons[this.id]=this;
 		this.log=[];
 		this.name=Game.DungeonTypes[this.type].nameGenerator();
 		this.Log=function(what)
 		{
 		}
 
 		this.map=[];
 		this.Generate=function()
 		{
 			this.map=[];
 			var nodes=20;
 			for (var i=0;i<nodes;i++)
 			{
 				//this is really just temporary
 				//like, for testing and stuff
 				this.map[i]=new Game.DungeonNode(choose(['hallowed','bloody','filthy','dark','hidden','pretty','fancy','magic','dangerous','haunted','cursed','pixie','dwarven','elven','demonic'])+' '+choose(['alley','forest','tunnel','inn','castle','river','village','mansion','mountain','lair','cave','woods','jungle','depths']));
 				this.map[i].exits=[];
 				this.map[i].id=i;
 				this.map[i].dungeon=this.id;
 			}
 			for (var i=0;i<nodes;i++)
 			{
 				if (i>0) this.map[i].exits.push(this.map[i-1]);
 				if (i<nodes-1) this.map[i].exits.push(this.map[i+1]);
 				if (Math.random()<0.1 && i>0)
 				{
 					var other=this.map[Math.floor(Math.random()*(20))];
 					if (other.id==i-1 || other.id==i || other.id==i+1) {}
 					else
 					{
 						this.map[i].exits.push(other);
 						other.exits.push(this.map[i]);
 					}
 				}
 			}
 			this.onTile=this.map[0];
 		}
 
 		this.onTile=-1;
 
 		this.Draw=function()
 		{
 			var str='';''
 			str+=this.onTile.Write();
 			str='<a onclick="Game.ObjectsById['+this.id+'].setSpecial(0);">Exit</a> | <i>(note : this is placeholder code, the final dungeons will have a tiny map and stuff)</i>
 <b>'+this.name+'</b>
 '+str;
 </code>
<code>l('rowSpecial'+this.id).innerHTML=' </code>
 
<div style="width:100%;height:100%;z-index:10000;position:absolute;left:0px;top:0px;background:#000;">
<code>'+str+'</code>
</div>
<code>'; </code>
 <code>		}
 
 		this.DrawButton=function()
 		{
 			var str='';''
 </code>
<code>str+=' </code>
 
<div style="text-align:center;margin:48px auto;color:#999;">
<code><a onclick="Game.ObjectsById['+this.id+'].setSpecial(1);">Enter</a></code>
</div>
<code>'; </code>
 <code>			return str;
 		}
 	}
 
 	Game.ExploreDungeon=function(dungeon,from,to)
 	{
 		var me=Game.Dungeons[dungeon];
 		me.onTile=me.map[to];
 		me.Draw();
 	}
 
 
 	/*=====================================================================================
 	CREATE DUNGEONS
 	=======================================================================================*/
 	Game.Objects['Factory'].special=function()
 	{
 		this.dungeon=new Game.Dungeon('Factory',this.id);
 		this.dungeon.Generate();
 		this.specialDrawFunction=function(){this.dungeon.Draw();};
 		this.drawSpecialButton=function(){return this.dungeon.DrawButton();};
 	}
 	//Game.Objects['Factory'].special();
 	//setTimeout(function(){Game.Objects['Factory'].dungeon.Draw();},500);
 	//Game.Objects['Factory'].unlockSpecial();//unlock it
 	//Game.Objects['Factory'].setSpecial(1);//enter it
 
 
 	/*=====================================================================================
 	HEROES
 	=======================================================================================*/
 	Game.Heroes=[];
 	Game.HeroesById=[];
 	Game.Hero=function(name,pic)
 	{
 		this.name=name;
 		this.pic=pic;
 		this.stats={
 			hp:20,
 			hpm:20,
 			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.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.Heroes.length;
 		Game.Heroes[this.name]=this;
 		Game.HeroesById[this.id]=this;
 	}
 
 	/*=====================================================================================
 	CREATE HEROES
 	=======================================================================================*/
 	new Game.Hero('Mysterious hero','nopic.png');
 };

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.