<data>
	<levels>
		<!-- LEVEL DESGIN TEMPLATES -->
		<levelTemplate r_name="'emptyTemplate'"
									 groundTile="'commonGround'"
									 wallTile="'commonWall'"
									 waterTile="'commonWater'"
									 downstairTile="'commonDownstair'"
									 upstairTile="'commonUpstair'"
									 doorTile="'commonDoor'"
									 trapTile="'commonTrap'"
									 levelSurface="100"
									 downstairVisible="1"
									 r_enteringSquareXCoord="upstairXCoord"
									 r_enteringSquareYCoord="upstairYCoord"
									 upstairXCoord="0"
									 upstairYCoord="0"
									 downstairXCoord="0"
									 downstairYCoord="0"
									 r_defaultTileName="wallTile"
									 asciiDesignTranslation="{{'.',groundTile},{'#',wallTile},{'«',upstairTile},{'»',downstairTile},{'+',doorTile},{'~',waterTile}}"
									 exitStairExplorable="0">
		</levelTemplate>
		
		<levelTemplate r_name="'standardStairsInterface'">
			<feature r_name="'levelUpstairTile'" r_template="'mainFeatureTemplate'" r_tile="upstairTile" r_shape="'random1'"/>
			<feature r_name="'levelDownstairTile'" r_template="'mainFeatureTemplate'" r_tile="downstairTile" r_shape="'farStart1'"/>
		</levelTemplate>
		<levelTemplate r_name="'stdDownstairInterface'">
			<feature r_name="'levelDownstairTile'" r_template="'mainFeatureTemplate'" r_tile="downstairTile" r_shape="'farStart1'"/>
		</levelTemplate>
		<levelTemplate r_name="'advancedStairsInterface'">
			<layout r_name="'walls'" upstairIsNorth="upstairIsNorth=(1D2==1)">
				<feature r_name="'upstairNorth'" r_template="'upstair1x2NTemplate'" r_enabled="upstairIsNorth" r_mandatory="1"/>
				<feature r_name="'downstairSouth'" r_template="'downstair1x2STemplate'" r_enabled="upstairIsNorth" r_mandatory="1"/>
				<feature r_name="'upstairSouth'" r_template="'upstair1x2STemplate'" r_enabled="!upstairIsNorth" r_mandatory="1"/>
				<feature r_name="'downstairNorth'" r_template="'downstair1x2NTemplate'" r_enabled="!upstairIsNorth" r_mandatory="1"/>
			</layout>
		</levelTemplate>
		<levelTemplate r_name="'advDownstairInterface'">
			<layout r_name="'walls'" upstairIsNorth="upstairIsNorth=(1D2==1)">
				<feature r_name="'downstairSouth'" r_template="'downstair1x2STemplate'" r_mandatory="1"/>
			</layout>
		</levelTemplate>
		<levelTemplate r_name="'advUpstairInterface'">
			<layout r_name="'walls'" upstairIsNorth="upstairIsNorth=(1D2==1)">
				<feature r_name="'upstairNorth'" r_template="'upstair1x2NTemplate'" r_mandatory="1"/>
			</layout>
		</levelTemplate>
		<levelTemplate r_name="'advPortalStairsInterface'">
			<feature r_name="'entryPortalTile'" r_template="'mainFeatureTemplate'" r_tile="'entryPortalTile'" r_shape="'random1'"/>
			<feature r_name="'exitPortalTile'" r_template="'mainFeatureTemplate'" r_tile="'exitPortalTile'" r_shape="'farStart1'"/>
		</levelTemplate>
		<levelTemplate r_name="'lavaPitPortalInterface'">
			<feature r_name="'levelUpstairTile'" r_template="'mainFeatureTemplate'" r_tile="'entryPortalTile'" r_shape="'random1'"/>
			<feature r_name="'levelDownstairTile'" r_template="'mainFeatureTemplate'" r_tile="'downstairPortal'" r_shape="'farStart1'"/>
		</levelTemplate>
		
		<levelTemplate r_name="'standardTemplate'" r_template="'emptyTemplate'"
									 r_totalXP="dungeonTotalXP"
									 r_minXPMonster="dungeonMinXPMonster"
									 r_maxXPMonster="dungeonMaxXPMonster"
									 r_levelRandomMonsterList="{}"
									 r_minMonsterFromStartDistance="5"
									 levelLootCount="floor(dungeonLootCount/levelCount)+((dungeonLootCount%levelCount)>=1D(levelCount))"
									 levelChestCount="floor(dungeonChestCount/levelCount)+((dungeonChestCount%levelCount)>=1D(levelCount))"
									 levelPotionCount="floor(dungeonPotionCount/levelCount)+((dungeonPotionCount%levelCount)>=1D(levelCount))">
			<loop r_name="'lootLoop'" r_loopCondition="levelLootCount>iLoop" r_loopStep="child.r_name=(child.r_name+iLoop++)" iLoop="0">
				<feature r_name="'loot'" r_template="'mainFeatureTemplate'" r_tile="'commonLoot'" r_shape="'farStart1'"/>
		 	</loop>
			<loop r_name="'chestLoop'" r_loopCondition="levelChestCount>iLoop" r_loopStep="child.r_name=(child.r_name+iLoop++)" iLoop="0">
				<feature r_name="'chest'" r_template="'mainFeatureTemplate'" r_tile="'commonChest'" r_shape="'farStart1'"/>
		 	</loop>
			<loop r_name="'potionLoop'" r_loopCondition="levelPotionCount>iLoop" r_loopStep="child.r_name=(child.r_name+iLoop++)" iLoop="0">
				<feature r_name="'potion'" r_template="'mainFeatureTemplate'" r_tile="'commonPotion'"/>
		 	</loop>
			<loop r_name="'trapLoop'" r_loopCondition="(levelSurface/50)>iLoop" r_loopStep="child.r_name=(child.r_name+iLoop++)" iLoop="0">
				<feature r_name="'trap'" r_template="'mainFeatureTemplate'" r_tile="trapTile"/>
			</loop>
		</levelTemplate>

		<level r_name="'waterFilledLevel'" r_template="'standardTemplate'" doorTile="groundTile">
			<layout r_name="'ground'" r_template="'incrementalLayout'" r_createdTile="groundTile">
				<room r_name="'En'" r_forceCorner="0"/>
			</layout>
			<layout r_name="'water'" r_template="'cellularLayout'" r_createdTile="waterTile" r_minimumSurface="levelSurface" r_centerOnPrevious="1" r_initialWallDensity="0.4" r_automataLoopCount="4" r_mustConnect="0" /> 
			<layout r_name="'walls'" r_template="'missingWallsLayout'"/>
		</level>
		
		<!-- STANDARD TEMPLATES -->
		<!-- settings : dungeon, forest, cave, swamp, lava cave, desert -->
		<level r_name="'castle'" 			r_template="{'scaterredCircularLayout',			'advancedStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'castleMonsters'}"/>
		<level r_name="'cave'" 				r_template="{'cellularLayout',							'advancedStairsInterface',	'standardTemplate',	'caveAdvancedGraphics',			'caveMonsters'}"/>
		<level r_name="'desert'" 			r_template="{'incrementalLayoutWithEntry',	'stdDownstairInterface',		'standardTemplate',	'desertAdvancedGraphics',		'desertMonsters'}"/>
		<level r_name="'dungeon'" 		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'dungeonMonsters'}"/>
		<level r_name="'forest'" 			r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'forestAdvancedGraphics',		'forestMonsters'}"/>
		<level r_name="'jungle'"	 		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'forestAdvancedGraphics',		'jungleMonsters'}"/>
		<level r_name="'lavacave'"	 	r_template="{'cellularLayout',							'advancedStairsInterface',	'standardTemplate',	'lavacaveAdvancedGraphics',	'lavacaveMonsters'}"/>
		<level r_name="'mansion'" 		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'mansionMonsters'}"/>
		<level r_name="'mountain'"		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'caveAdvancedGraphics',			'mountainMonsters'}"/>
		<level r_name="'ruin'" 				r_template="{'incrementalLayoutWithEntry',	'stdDownstairInterface',		'standardTemplate',	'desertAdvancedGraphics',		'ruinMonsters'}"/>
		<level r_name="'sewer0'" 			r_template="{'incrementalLayoutWithEntry',	'advDownstairInterface',		'standardTemplate',	'dungeonAdvancedGraphics',	'sewerMonsters'}">
			<layout r_name="'basic'" r_firstRoom="'En2'">
				<room r_name="'En2'" r_template="'sewerEntryVault'" r_additionalExit="1">
					<exit r_name="'2'" r_template="'exitTemplate'" r_targetRoom="'DX'" r_probability="1" r_extend="'X'"/>
					<exit r_name="'3'" r_template="'exitTemplate'" r_targetRoom="'DY'" r_probability="1" r_extend="'Y+'"/>
				</room>
			</layout>
		</level>
		<level r_name="'sewer'" 		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'sewerMonsters'}">
			<layout r_name="'basic'">
				<room r_name="'En'">
					<feature r_name="'entryUpstairTile'" r_enabled="0"/>
				</room>
			</layout>
		</level>
		<level r_name="'swamp'" 		r_template="{'waterFilledLevel',						'standardStairsInterface',											'swampAdvancedGraphics',		'swampMonsters'}">
			<loop r_name="'cloudLoop'" r_loopCondition="levelSurface>10*iLoop" r_loopStep="child.r_name=(child.r_name+iLoop++)" iLoop="0">
				<feature r_name="'blinkingCloud'" r_template="'mainFeatureTemplate'" r_tile="'blinkingCloud'" r_shape="'random1'"/>
			</loop>
		</level>
		<level r_name="'temple'" 		r_template="{'incrementalLayout',						'advancedStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'templeMonsters'}"/>

		
		<!-- levels for Abyss -->
		<level r_name="'cavePlane'" 			r_template="{'cellularLayout',				'advPortalStairsInterface',	'standardTemplate',	'caveAdvancedGraphics',			'fullMonsters'}"/>
		<level r_name="'desertPlane'" 		r_template="{'incrementalLayout',			'advPortalStairsInterface',	'standardTemplate',	'desertAdvancedGraphics',		'fullMonsters'}"/>
		<level r_name="'dungeonPlane'"		r_template="{'incrementalLayout',			'advPortalStairsInterface',	'standardTemplate',	'dungeonAdvancedGraphics',	'fullMonsters'}"/>
		<level r_name="'forestPlane'" 		r_template="{'incrementalLayout',			'advPortalStairsInterface',	'standardTemplate',	'forestAdvancedGraphics',		'fullMonsters'}"/>
		<level r_name="'lavacavePlane'" 	r_template="{'cellularLayout',				'advPortalStairsInterface',	'standardTemplate',	'lavacaveAdvancedGraphics',	'fullMonsters'}"/>
		<level r_name="'swampPlane'" 			r_template="{'waterFilledLevel',			'advPortalStairsInterface',											'swampAdvancedGraphics',		'fullMonsters'}"/>
		
		<!-- Debug templates -->
		<level r_name="'bigRoom'" r_template="{'incrementalLayout','advancedStairsInterface','emptyTemplate','caveAdvancedGraphics','caveMonsters'}">
			<layout r_name="'basic'">
				<room r_name="'En'" r_xSize="10" r_ySize="10" r_additionalExit="0"/>
				<room r_name="'C2'" r_xSize="10" r_ySize="10" r_additionalExit="0"/>
			</layout>
		</level>
		<level r_name="'longRoom'" r_template="{'incrementalLayout','advancedStairsInterface','emptyTemplate','caveAdvancedGraphics','caveMonsters'}">
			<layout r_name="'basic'">
				<room r_name="'En'" r_xSize="1" r_ySize="10" r_additionalExit="0"/>
				<room r_name="'C2'" r_xSize="1" r_ySize="10" r_additionalExit="0"/>
			</layout>
		</level>
		<level r_name="'longCave'" r_template="{'incrementalLayout','advancedStairsInterface','standardTemplate','caveAdvancedGraphics','caveMonsters'}">
			<layout r_name="'basic'">
				<room r_name="'En'" r_xSize="6" r_ySize="2" r_additionalExit="0"/>
				<room r_name="'C2'" r_xSize="6" r_ySize="2" r_additionalExit="0"/>
				<feature 	r_name="'water4'" r_template="'mainFeatureTemplate'"
									r_shape="'asciiPattern'"
									r_asciiDesignTranslation="asciiDesignTranslation"
									r_asciiPattern="{	'..',
																		'..'}"
									r_asciiDesign="{'~~',
																	'~~'}"
									r_checkConnection="1"/>
			</layout>
		</level>
		<level r_name="'smallRoom'" r_template="{'incrementalLayout','advancedStairsInterface','emptyTemplate','caveAdvancedGraphics','caveMonsters'}">
			<layout r_name="'basic'">
				<room r_name="'En'" r_xSize="1" r_ySize="2" r_additionalExit="0"/>
				<room r_name="'C2'" r_xSize="1" r_ySize="2" r_additionalExit="0"/>
			</layout>
		</level>
	</levels>
</data>