label="2p - Silverhead Crossing Turn 8_guest_ru"
version="1.6"
completion="victory"
campaign_type="multiplayer"
difficulty="NORMAL"
random_seed="1327609764"
random_calls="0"
next_underlying_unit_id="24"
end_text_duration="0"
[variables]
[/variables]
[replay]
	[command]
		[start]
		[/start]
	[/command]
	[command]
		[recruit]
			value="0"
			x="6"
			y="14"
		[/recruit]
		[random]
			value="791480217"
		[/random]
		[random]
			value="1843167994"
		[/random]
		[random]
			value="443748486"
		[/random]
		[random]
			value="848276823"
		[/random]
		[random]
			value="3849827"
		[/random]
		[random]
			value="302259727"
		[/random]
		[random]
			value="711918718"
		[/random]
		[random]
			value="155000873"
		[/random]
		[random]
			value="684079306"
		[/random]
		[random]
			value="1068618310"
		[/random]
		[random]
			value="312665055"
		[/random]
		[random]
			value="1734253401"
		[/random]
		[random]
			value="291664671"
		[/random]
		[random]
			value="9043592"
		[/random]
		[random]
			value="877449033"
			[results]
				checksum="LhGI28qHcsJn9Niqer4mpRo6wD4zsHnKP1Hy+wP.,jg1d-5cL>71745hhbgk5n1,oc<nn6f23854.p5418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sergio has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message="ummh :)"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Punkka has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="5"
			x="5"
			y="14"
		[/recruit]
		[random]
			value="1881331887"
		[/random]
		[random]
			value="1525697993"
		[/random]
		[random]
			value="581278389"
		[/random]
		[random]
			value="1448749138"
		[/random]
		[random]
			value="1981624696"
		[/random]
		[random]
			value="1372758606"
		[/random]
		[random]
			value="1144433484"
		[/random]
		[random]
			value="277889534"
		[/random]
		[random]
			value="73551781"
		[/random]
		[random]
			value="1148283311"
		[/random]
		[random]
			value="580149261"
		[/random]
		[random]
			value="785470500"
		[/random]
		[random]
			value="1303284184"
		[/random]
		[random]
			value="1264228567"
		[/random]
		[random]
			value="1854088810"
			[results]
				checksum="wmNOCQ,<jCB,xNaeN9c8kBjp>f.33i3,bi2g6odf4d42johapi+j5>4.,j0+4d89dk>9,2l6x.fc-I>-,WJ2j2m>8oQ0birbp4<4OkUyc1lTJvFiKQ-515ck2<Ih5Kjg"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="KenanKamal has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="0"
			x="5"
			y="12"
		[/recruit]
		[random]
			value="1896564209"
		[/random]
		[random]
			value="1582067271"
		[/random]
		[random]
			value="1215530841"
		[/random]
		[random]
			value="112059858"
		[/random]
		[random]
			value="1125412444"
		[/random]
		[random]
			value="1998551585"
		[/random]
		[random]
			value="55073315"
		[/random]
		[random]
			value="907482632"
		[/random]
		[random]
			value="1732399824"
		[/random]
		[random]
			value="1580771308"
		[/random]
		[random]
			value="1488761021"
		[/random]
		[random]
			value="1033665314"
		[/random]
		[random]
			value="1414912356"
		[/random]
		[random]
			value="714035979"
		[/random]
		[random]
			value="30615151"
			[results]
				checksum="LhGI37qHcsJn9Niqer4moRo6wD4zsHoKP1Hy+wP.,jg1d-5cL>71745hhbgk5n1,oc<nn6f23854.p4418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sage has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Nane has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="2"
			x="5"
			y="13"
		[/recruit]
		[random]
			value="379312084"
		[/random]
		[random]
			value="582521667"
		[/random]
		[random]
			value="157495578"
		[/random]
		[random]
			value="2111711908"
		[/random]
		[random]
			value="15809327"
		[/random]
		[random]
			value="1646256599"
		[/random]
		[random]
			value="997893575"
		[/random]
		[random]
			value="1430721684"
		[/random]
		[random]
			value="212808930"
		[/random]
		[random]
			value="1028508726"
		[/random]
		[random]
			value="976039927"
		[/random]
		[random]
			value="1000396691"
		[/random]
		[random]
			value="59923540"
			[results]
				checksum="TuuzMJvu3JOmTCCoKGpBJPA6SCMFtLEzKIxOCmtqSOKJLCFwmIsr1QENmxPFHFw.RFKFnqypNLqM8mwoForIhF8xkkBsH9ih>N4ftxqADyQNdDsofqQwNFrCg8vPGzPi"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="0"
			x="4"
			y="12"
		[/recruit]
		[random]
			value="111105051"
		[/random]
		[random]
			value="1502392267"
		[/random]
		[random]
			value="315961431"
		[/random]
		[random]
			value="1571302006"
		[/random]
		[random]
			value="1917780761"
		[/random]
		[random]
			value="588045581"
		[/random]
		[random]
			value="2099546153"
		[/random]
		[random]
			value="297745466"
		[/random]
		[random]
			value="1985542175"
		[/random]
		[random]
			value="331374590"
		[/random]
		[random]
			value="880267133"
		[/random]
		[random]
			value="2143037754"
		[/random]
		[random]
			value="295602850"
		[/random]
		[random]
			value="896076461"
		[/random]
		[random]
			value="1641810705"
			[results]
				checksum="LhGI28qHcsJn9Niqer4mpRo6wD4zsHnKP1Hy+wP.,jg1d-5cL>71745hhbgk5n1,oc<nn6f23854.p5418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmI"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="5"
			x="4"
			y="13"
		[/recruit]
		[random]
			value="109378207"
		[/random]
		[random]
			value="1133503982"
		[/random]
		[random]
			value="629067583"
		[/random]
		[random]
			value="453098063"
		[/random]
		[random]
			value="691655061"
		[/random]
		[random]
			value="826854713"
		[/random]
		[random]
			value="890028663"
		[/random]
		[random]
			value="1527739396"
		[/random]
		[random]
			value="305315617"
		[/random]
		[random]
			value="1001133715"
		[/random]
		[random]
			value="882648015"
		[/random]
		[random]
			value="621277048"
		[/random]
		[random]
			value="424952073"
		[/random]
		[random]
			value="652945129"
		[/random]
		[random]
			value="1209322629"
			[results]
				checksum="wmNOCQ,<jCB,xNaeN9c8kBjp>f.33i3,bi2g6odf4d42johapi+j5>4.,j0+4d89dk>9,2l6y.fc-I>-,WJ2j2m>8oQ0birbp4<4OkUyc1iTJvFiKQ-515ck2.Ih5Kjg"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message="gl n hf :)"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="4,4,4,5,5"
			y="11,10,9,9,8"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="thx, u2 :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="22"
			y="17"
		[/recruit]
		[random]
			value="899118479"
		[/random]
		[random]
			value="755715649"
		[/random]
		[random]
			value="1909798140"
		[/random]
		[random]
			value="1054021199"
		[/random]
		[random]
			value="162395900"
		[/random]
		[random]
			value="2030600680"
		[/random]
		[random]
			value="1214743695"
		[/random]
		[random]
			value="87676973"
		[/random]
		[random]
			value="1410150900"
		[/random]
		[random]
			value="826210427"
		[/random]
		[random]
			value="565483107"
		[/random]
		[random]
			value="1240055307"
		[/random]
		[random]
			value="717489349"
		[/random]
		[random]
			value="1292690703"
		[/random]
		[random]
			value="1363813697"
			[results]
				checksum="80N696kdt17Q-aGPQ75eF4RIQSHu+GNvRCnIqFywJTCHmxqx1EwQVOxDmGODNOzCNSPAGPJnfzEDPJCs,8AqDwqDqPxMAuFRQxPzFwD4sc7wU,890qvi7pTKGPwx3xSB"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="23"
			y="17"
		[/recruit]
		[random]
			value="1469159791"
		[/random]
		[random]
			value="1800628842"
		[/random]
		[random]
			value="970719423"
		[/random]
		[random]
			value="330898389"
		[/random]
		[random]
			value="469142618"
		[/random]
		[random]
			value="1857945529"
		[/random]
		[random]
			value="530437563"
		[/random]
		[random]
			value="1398746126"
		[/random]
		[random]
			value="1202926656"
		[/random]
		[random]
			value="1429556042"
		[/random]
		[random]
			value="6978127"
		[/random]
		[random]
			value="965241148"
		[/random]
		[random]
			value="336093593"
		[/random]
		[random]
			value="169374028"
		[/random]
		[random]
			value="848358181"
			[results]
				checksum="80N696kdt17Q-aGPQ75eF4RIQSHu+GNvRCnIqFywJTCHmxqx1EwQVOxDmGODNOzCNSPAGPJrfzEDPJCs,8AqDwqDqPxMAuFRQxPzFwD4sc7wUX890qvi7pTKCPwx3xSB"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="24"
			y="15"
		[/recruit]
		[random]
			value="185030294"
		[/random]
		[random]
			value="814726264"
		[/random]
		[random]
			value="57044957"
		[/random]
		[random]
			value="654172912"
		[/random]
		[random]
			value="525188145"
		[/random]
		[random]
			value="587482520"
		[/random]
		[random]
			value="2052919039"
		[/random]
		[random]
			value="1728114802"
		[/random]
		[random]
			value="2017038562"
		[/random]
		[random]
			value="2059897166"
		[/random]
		[random]
			value="545872302"
		[/random]
		[random]
			value="205648507"
		[/random]
		[random]
			value="81787546"
		[/random]
		[random]
			value="1394230483"
		[/random]
		[random]
			value="1756485795"
			[results]
				checksum="80N696kdt17Q-aGPQ75eF4RIQSHu+GNvRCnIqFywJTCHmxqx1EwQVOxDmGODNOzCNSPAGPJAfzEDPJCs,8AqDwqDqPxMAuFRQxPzFwD4s97wUX890qvi7pTKNPwx3xSB"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="24"
			y="16"
		[/recruit]
		[random]
			value="1276263800"
		[/random]
		[random]
			value="1822051323"
		[/random]
		[random]
			value="1242251529"
		[/random]
		[random]
			value="2032007226"
		[/random]
		[random]
			value="1458880498"
		[/random]
		[random]
			value="1646721954"
		[/random]
		[random]
			value="416408679"
		[/random]
		[random]
			value="1302887339"
		[/random]
		[random]
			value="1372868522"
		[/random]
		[random]
			value="601438973"
		[/random]
		[random]
			value="2117613603"
		[/random]
		[random]
			value="1429913479"
		[/random]
		[random]
			value="1255611886"
		[/random]
		[random]
			value="495318100"
		[/random]
		[random]
			value="2017395999"
			[results]
				checksum="80M696kdt17Q-aGPQ75eF4RIQSHu+GNvRCnIqFywJTCHmxqx1EwQVOxDmGODNOzCNSPAGPJtfzEDPJCs,8AqDwqDqPxMAuFRQxPzFwD4s97wUX890qvi7pTKEPwx3xSB"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,21,20,19,18"
			y="14,14,13,13,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="16"
			y="13"
		[/recruit]
		[random]
			value="2113828702"
		[/random]
		[random]
			value="437285585"
		[/random]
		[random]
			value="886394257"
		[/random]
		[random]
			value="1221956940"
		[/random]
		[random]
			value="932603685"
		[/random]
		[random]
			value="756306608"
		[/random]
		[random]
			value="235520569"
		[/random]
		[random]
			value="1008552940"
		[/random]
		[random]
			value="495773873"
		[/random]
		[random]
			value="1308981365"
		[/random]
		[random]
			value="1630374497"
		[/random]
		[random]
			value="440889645"
		[/random]
		[random]
			value="316746059"
		[/random]
		[random]
			value="1498942889"
		[/random]
		[random]
			value="2142491213"
			[results]
				checksum="gfk10b5br.kQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9et4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWGe+,PQ3hpR"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="17"
			y="13"
		[/recruit]
		[random]
			value="185338177"
		[/random]
		[random]
			value="1197774475"
		[/random]
		[random]
			value="80365549"
		[/random]
		[random]
			value="151683231"
		[/random]
		[random]
			value="1635060060"
		[/random]
		[random]
			value="966759806"
		[/random]
		[random]
			value="1373640172"
		[/random]
		[random]
			value="420180098"
		[/random]
		[random]
			value="1723066415"
		[/random]
		[random]
			value="1609160741"
		[/random]
		[random]
			value="1428733038"
		[/random]
		[random]
			value="71356640"
		[/random]
		[random]
			value="770658458"
		[/random]
		[random]
			value="911623887"
		[/random]
		[random]
			value="512246286"
			[results]
				checksum=">UABEPGKRFs+RPP0VDMFU5szDKhwNqBscwwqoNtRxBzMHwQmPyPvpPAuOCIG6zNHsCQFqzuGzwKqqyuyKqqN5RBJTuEm3frBwnBwBICTrpKGHCIsunwteCIWceMGO<Yo"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,17"
			y="12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[move]
			x="4,4,4,4,4,5,6"
			y="13,14,15,16,17,18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="High-5 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,6,6,5"
			y="18,19,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="npc1 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="hellboy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="5,6,7,8,9,10"
			y="12,11,11,10,10,10"
		[/move]
	[/command]
	[command]
		[move]
			x="5,6,7,8,9,10"
			y="13,13,14,14,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Isgrimnur has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,7,8,9,10,11"
			y="14,15,15,16,16,16"
		[/move]
	[/command]
	[command]
		[move]
			x="5,5,6,6,6,7"
			y="8,9,9,10,11,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="reini has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="5,5,6,6,7"
			y="14,15,15,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Quetzalcoatl has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Gideon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Eirinn has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="7,8,8,8,9,10"
			y="17,17,18,19,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sjrs456 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="HeavyMetal has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="krzychrzy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sorenimmel has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="timothy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="4,5,5,6,7,8"
			y="12,13,14,14,15,15"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="LOca has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Bluecrash has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,15,14,13,12,11"
			y="13,14,14,15,14,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="11"
				y="15"
			[/source]
			[destination]
				x="11"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1005551630"
			[results]
				chance="40"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1915725923"
			[results]
				chance="40"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="465440741"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="125447814"
			[results]
				chance="40"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lok3m has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,16,15,14,13,12"
			y="13,13,14,14,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="12"
				y="15"
			[/source]
			[destination]
				x="11"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1393543962"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="536141653"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,18,18,18,18,19"
			y="12,11,10,9,8,8"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,23,23,23,23,23,22,22,21"
			y="15,15,14,13,12,11,10,9,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,24,24,24,24"
			y="16,17,18,19,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,22,21,20,19"
			y="17,17,17,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,22,22,22,22,21,20,19"
			y="17,18,19,20,21,22,23,23,24"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Pardum has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="5,6,7,8,8,9"
			y="21,21,22,22,23,24"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="zod has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Set has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,9,8,8"
			y="20,20,19,18"
		[/move]
	[/command]
	[command]
		[move]
			x="8,9"
			y="18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Pudels_Kern has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Swart has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="9,10"
			y="18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="lor has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Soulz has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,10,10,10,11"
			y="10,11,12,13,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="11"
				y="14"
			[/source]
			[destination]
				x="11"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="250489152"
			[results]
				chance="70"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="24160575"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="965694834"
			[results]
				chance="70"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="451400934"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="10,9"
			y="15,15"
		[/move]
	[/command]
	[command]
		[move]
			x="7,8,8,9,9,10"
			y="12,12,13,14,15,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="10"
				y="15"
			[/source]
			[destination]
				x="11"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1521323042"
			[results]
				chance="70"
				damage="12"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="11"
				y="16"
			[/source]
			[destination]
				x="12"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="313627524"
			[results]
				chance="70"
				damage="11"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1344288839"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2129204932"
			[results]
				chance="70"
				damage="11"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1774681213"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1630173739"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1191122986"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="8,9,10,11"
			y="15,16,15,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="11"
				y="15"
			[/source]
			[destination]
				x="12"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="265171255"
			[results]
				chance="70"
				damage="11"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="543322782"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1380124394"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="854948688"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1960476324"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2036459236"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="S0byv has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="9,10,11,12"
			y="15,14,14,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="12"
				y="14"
			[/source]
			[destination]
				x="12"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="530653763"
			[results]
				chance="70"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1336935857"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1395266515"
			[results]
				chance="70"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="966672574"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1186579929"
			[results]
				chance="70"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="10,11,12"
			y="17,17,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="12"
				y="16"
			[/source]
			[destination]
				x="12"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1401417600"
			[results]
				chance="70"
				damage="3"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="0"
			x="10"
			y="16"
		[/recruit]
		[random]
			value="1943222191"
		[/random]
		[random]
			value="1947823441"
		[/random]
		[random]
			value="669291971"
		[/random]
		[random]
			value="1634308038"
		[/random]
		[random]
			value="561601864"
		[/random]
		[random]
			value="1489993993"
		[/random]
		[random]
			value="1295582497"
		[/random]
		[random]
			value="1050285412"
		[/random]
		[random]
			value="146602653"
		[/random]
		[random]
			value="1893718144"
		[/random]
		[random]
			value="1882263163"
		[/random]
		[random]
			value="905682537"
		[/random]
		[random]
			value="1083477257"
		[/random]
		[random]
			value="2137639329"
		[/random]
		[random]
			value="115684660"
			[results]
				checksum="LhGI28qHcsJn9Niqer4ntRo6wD4zsHoKP1Hy+wP.,jg1d-5cL>71745hhbgk5n1,oc<nn6f23854.o1418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Karnar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Filadeus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21,21,21,21,21"
			y="9,8,7,6,5,4"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="other way around :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,23,22,21,20,19,18"
			y="20,21,20,20,19,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wargon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,18,17,16,15,14,13"
			y="24,23,23,22,23,23,23"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DrDabic has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="giocatore has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,20,21,22,23"
			y="8,8,8,7,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,19,19,18,18,18,17"
			y="17,16,15,14,13,12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dark_Beer_Adept has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,12,12,12,12,11,11,10"
			y="16,15,14,13,12,12,11,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message="why you want to kill me?"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Swart has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lobezno has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="11,12,13,14,15,16"
			y="14,14,14,13,13,12"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="16"
				y="12"
			[/source]
			[destination]
				x="17"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="331706406"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1127056684"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="232140434"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="436415737"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1931141533"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,13,14,15,16,17"
			y="14,14,13,13,13,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="17"
				y="13"
			[/source]
			[destination]
				x="17"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="1622737071"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2062387145"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2069337403"
			[results]
				chance="60"
				damage="4"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="10,11,12,13,14,15,16"
			y="16,16,15,15,14,14,13"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="12"
			y="14"
		[/recruit]
		[random]
			value="1249046354"
		[/random]
		[random]
			value="1123101872"
		[/random]
		[random]
			value="1168171943"
		[/random]
		[random]
			value="1004302221"
		[/random]
		[random]
			value="2055541211"
		[/random]
		[random]
			value="718014739"
		[/random]
		[random]
			value="1156892107"
		[/random]
		[random]
			value="755400399"
		[/random]
		[random]
			value="1549123052"
		[/random]
		[random]
			value="1167692936"
		[/random]
		[random]
			value="1319825392"
		[/random]
		[random]
			value="881334709"
		[/random]
		[random]
			value="1207628524"
		[/random]
		[random]
			value="811162029"
		[/random]
		[random]
			value="589366542"
			[results]
				checksum="xNa6Bryn.D--c-i+04IRoaOL-EyQnvClJF7qE383X-fb-Zy1ji46+2f+9l+5<foc<nn6f23854.o1418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmIaF"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Ronfi has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,11,12"
			y="10,10,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="poo has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,10,10,9,8,8"
			y="15,16,17,18,18,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message=":("
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="11,10,10,9,9,8"
			y="15,15,16,17,18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="hu12 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,20,19,18,17"
			y="4,4,4,3,4"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Gen_Italia has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,16,15"
			y="4,4,5"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Hardy804 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,14,13"
			y="5,4,5"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,23,23,22"
			y="7,8,9,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22"
			y="9,10"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="it's my dedication :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="22"
			y="9"
		[/recruit]
		[random]
			value="1335101523"
		[/random]
		[random]
			value="277196559"
		[/random]
		[random]
			value="312745746"
		[/random]
		[random]
			value="479658946"
		[/random]
		[random]
			value="1448955992"
		[/random]
		[random]
			value="1397099575"
		[/random]
		[random]
			value="1444602775"
		[/random]
		[random]
			value="1469664761"
		[/random]
		[random]
			value="1324232861"
		[/random]
		[random]
			value="1025963292"
		[/random]
		[random]
			value="642829535"
		[/random]
		[random]
			value="1209940505"
		[/random]
		[random]
			value="2116876977"
		[/random]
		[random]
			value="1327745696"
		[/random]
		[random]
			value="989991290"
			[results]
				checksum="efk10b5br.lQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9er4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWJe+,PQ3hpR"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,19,20,21"
			y="20,20,19,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21,20,19"
			y="19,18,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,14,15,15,16,17,18"
			y="23,22,22,21,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Haaki has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="rytdog has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,8,9,10"
			y="18,19,20,20"
		[/move]
	[/command]
	[command]
		[move]
			x="9,10,11,12,12,13"
			y="24,23,23,22,21,21"
		[/move]
	[/command]
	[command]
		[move]
			x="13,14"
			y="21,21"
		[/move]
	[/command]
	[command]
		[move]
			x="14,15"
			y="21,22"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="kalamity has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,8,8,9,10,10"
			y="19,18,17,17,16,15"
		[/move]
	[/command]
	[command]
		[move]
			x="12,13,13,12,11,11,10,10,9"
			y="9,9,8,7,7,6,5,4,4"
		[/move]
	[/command]
	[command]
		[move]
			x="12,11,10,10,10,10"
			y="14,14,13,12,11,10"
		[/move]
	[/command]
	[command]
		[move]
			x="17,18,19,20,21"
			y="13,12,12,11,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wsad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="2"
			weapon="0"
			[source]
				x="21"
				y="11"
			[/source]
			[destination]
				x="22"
				y="10"
			[/destination]
		[/attack]
		[random]
			value="1399820112"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="149648546"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1304577832"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1003397643"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1318919595"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1213291281"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="16,17,18,18,19"
			y="13,14,14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="19"
				y="16"
			[/source]
			[destination]
				x="19"
				y="17"
			[/destination]
		[/attack]
		[random]
			value="772750833"
			[results]
				chance="70"
				damage="19"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1909087526"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1862649621"
			[results]
				chance="70"
				damage="19"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="16,17,18,19,19,19,19"
			y="12,13,13,14,15,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Loren has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="11,12,13,14,15,16"
			y="16,15,15,14,14,13"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="12"
			y="14"
		[/recruit]
		[random]
			value="987052458"
		[/random]
		[random]
			value="1952640920"
		[/random]
		[random]
			value="1890802132"
		[/random]
		[random]
			value="1366670546"
		[/random]
		[random]
			value="1571345769"
		[/random]
		[random]
			value="803711562"
		[/random]
		[random]
			value="122512549"
		[/random]
		[random]
			value="579913497"
		[/random]
		[random]
			value="454496478"
		[/random]
		[random]
			value="101159523"
		[/random]
		[random]
			value="1793468139"
		[/random]
		[random]
			value="798930708"
		[/random]
		[random]
			value="1650040504"
		[/random]
		[random]
			value="500661881"
		[/random]
		[random]
			value="682654623"
			[results]
				checksum="xNa6Bryn.D--c-i+05ERoaOL-EyQovClJF7qE383X-fb-Zy1ji46+2f+9l+5<foc<nn6f23854.p5418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmIaF"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Mondop has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="jumbo2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="camus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="2"
			[source]
				x="22"
				y="10"
			[/source]
			[destination]
				x="21"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="649362463"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="886530804"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1685211797"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="328313473"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="91752118"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1952734733"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,22,21"
			y="9,10,11,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="21"
				y="12"
			[/source]
			[destination]
				x="21"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="1043443595"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="680647706"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="21"
			y="9"
		[/recruit]
		[random]
			value="1642261375"
		[/random]
		[random]
			value="1267890912"
		[/random]
		[random]
			value="1802733339"
		[/random]
		[random]
			value="1180902513"
		[/random]
		[random]
			value="1272880143"
		[/random]
		[random]
			value="1957933821"
		[/random]
		[random]
			value="97355178"
		[/random]
		[random]
			value="1439919626"
		[/random]
		[random]
			value="1992192950"
		[/random]
		[random]
			value="1833954283"
		[/random]
		[random]
			value="1711652033"
		[/random]
		[random]
			value="1225445686"
		[/random]
		[random]
			value="983784006"
		[/random]
		[random]
			value="769767189"
		[/random]
		[random]
			value="1239424593"
			[results]
				checksum="afk10b5br.kQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9fn4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWJe+,PQ3hpQ"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="22"
			y="9"
		[/recruit]
		[random]
			value="244712832"
		[/random]
		[random]
			value="743042605"
		[/random]
		[random]
			value="1245332477"
		[/random]
		[random]
			value="1509127539"
		[/random]
		[random]
			value="140060659"
		[/random]
		[random]
			value="1230404681"
		[/random]
		[random]
			value="1733574856"
		[/random]
		[random]
			value="1338338692"
		[/random]
		[random]
			value="725182408"
		[/random]
		[random]
			value="853982120"
		[/random]
		[random]
			value="993588384"
		[/random]
		[random]
			value="1906084921"
		[/random]
		[random]
			value="2126862263"
		[/random]
		[random]
			value="804038557"
		[/random]
		[random]
			value="2003440100"
			[results]
				checksum="gfk10b5br.kQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9et4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWGe+,PQ3hpR"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,12,12,11"
			y="5,5,6,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="X has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,18,17,16,15"
			y="20,21,22,23,23,23"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="15"
				y="23"
			[/source]
			[destination]
				x="15"
				y="22"
			[/destination]
		[/attack]
		[random]
			value="290919896"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="390709310"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1367234374"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rosomak has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Harun has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="15,16,17,18"
			y="22,21,21,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wargon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="george has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="shagal has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,9,8,7,6,6,5"
			y="10,10,10,10,9,8,8"
		[/move]
	[/command]
	[command]
		[move]
			x="16,17,18,19,20"
			y="13,13,12,12,12"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="20"
				y="12"
			[/source]
			[destination]
				x="21"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="1516186800"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="474812751"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2056559713"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2036646942"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Swart has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,19,20,20,21"
			y="16,15,14,13,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="21"
				y="13"
			[/source]
			[destination]
				x="21"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="252889142"
			[results]
				chance="70"
				damage="15"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="21,20,19,18,17"
			y="11,11,12,12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Blindman has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="anneurs has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Partagas has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Yoshi has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,13,14,15,16,17"
			y="14,14,13,13,13,13"
		[/move]
	[/command]
	[command]
		[move]
			x="19,19,19,19,19,18,18"
			y="17,16,15,14,13,12,11"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="12"
			y="14"
		[/recruit]
		[random]
			value="1111785655"
		[/random]
		[random]
			value="992241170"
		[/random]
		[random]
			value="1086058331"
		[/random]
		[random]
			value="690443625"
		[/random]
		[random]
			value="14334867"
		[/random]
		[random]
			value="1153293616"
		[/random]
		[random]
			value="1554518833"
		[/random]
		[random]
			value="330969311"
		[/random]
		[random]
			value="1645652200"
		[/random]
		[random]
			value="1150506767"
		[/random]
		[random]
			value="82485834"
		[/random]
		[random]
			value="862191071"
		[/random]
		[random]
			value="1138638369"
		[/random]
		[random]
			value="1378752854"
		[/random]
		[random]
			value="619784756"
			[results]
				checksum="LhGI37qHcsJn9Niqer4mnRo6wD4zsHoKP1Hy+wP.,jg1d-5cL>71745hhbgk5n1,oc<nn6f23854.p3418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SevOS has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Sigm4 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="jusephe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,10,10"
			y="15,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="cezarus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="alpha1 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="morkyyy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Punkka has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Fredrik has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,10,10,10,9"
			y="20,21,22,23,24"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Juppe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,21"
			y="10,11,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="21"
				y="12"
			[/source]
			[destination]
				x="21"
				y="13"
			[/destination]
		[/attack]
		[random]
			value="79447753"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="133809417"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="495718356"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1098900356"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="206690960"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,22,22,22,21,20"
			y="9,10,11,12,13,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="20"
				y="13"
			[/source]
			[destination]
				x="21"
				y="13"
			[/destination]
		[/attack]
		[random]
			value="447303089"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1844441901"
			[results]
				chance="60"
				damage="5"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,22,21,20"
			y="9,9,10,11,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="20"
				y="11"
			[/source]
			[destination]
				x="20"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="967305337"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1198470882"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1023352200"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="28858315"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,14,13,13,12,11,10"
			y="23,22,22,21,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,12,13,13,13,12,11,10"
			y="7,6,7,8,9,9,10,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="5,6,7,7,8,9"
			y="8,8,9,10,10,11"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="9"
				y="11"
			[/source]
			[destination]
				x="10"
				y="10"
			[/destination]
		[/attack]
		[random]
			value="141414294"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1126427821"
			[results]
				chance="50"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2038616115"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1862597706"
			[results]
				chance="50"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="135155413"
			[results]
				chance="50"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Punkka has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="17,18,18,19"
			y="13,12,11,11"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="19"
				y="11"
			[/source]
			[destination]
				x="20"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="551578801"
			[results]
				chance="70"
				damage="12"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="529591739"
			[results]
				chance="50"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1512754114"
			[results]
				chance="70"
				damage="12"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="542412758"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="20"
				y="12"
			[/source]
			[destination]
				x="20"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="58468816"
			[results]
				chance="70"
				damage="12"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Mike1 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="18,19,20,21"
			y="11,11,10,11"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="21"
				y="11"
			[/source]
			[destination]
				x="21"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="483871974"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1494814654"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Juppe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="17,18,19"
			y="12,12,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="19"
				y="13"
			[/source]
			[destination]
				x="20"
				y="13"
			[/destination]
		[/attack]
		[random]
			value="1528722433"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1387465393"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="714752908"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1586403354"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1034270731"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1609140413"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1856508575"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="oryolalex has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="iowaforever has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="9,9,10,10"
			y="24,23,22,21"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="10"
				y="21"
			[/source]
			[destination]
				x="10"
				y="20"
			[/destination]
		[/attack]
		[random]
			value="357873222"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2074109807"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="59315483"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1214494463"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1630211516"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wargon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="33 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="18,19,20,21,22,23,24"
			y="20,20,20,21,20,21,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Soni has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="giorgos has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,12,12,12,11"
			y="14,13,12,11,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="11"
				y="11"
			[/source]
			[destination]
				x="10"
				y="10"
			[/destination]
		[/attack]
		[random]
			value="885350022"
			[results]
				chance="70"
				damage="15"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1000300956"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1784983737"
			[results]
				chance="70"
				damage="15"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="10,10,10"
			y="13,14,15"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="10"
			y="16"
		[/recruit]
		[random]
			value="238632134"
		[/random]
		[random]
			value="1470599831"
		[/random]
		[random]
			value="1851891122"
		[/random]
		[random]
			value="277438822"
		[/random]
		[random]
			value="6873822"
		[/random]
		[random]
			value="2119126957"
		[/random]
		[random]
			value="1172729995"
		[/random]
		[random]
			value="1693161333"
		[/random]
		[random]
			value="1959510248"
		[/random]
		[random]
			value="305011147"
		[/random]
		[random]
			value="1627429935"
		[/random]
		[random]
			value="1110985153"
		[/random]
		[random]
			value="567579195"
		[/random]
		[random]
			value="639616569"
		[/random]
		[random]
			value="472475538"
			[results]
				checksum="xNa6Bryn.D--c-i+04IRoaOL-EyQnvClJF7qE383X-fb-Zy1ji46+2f+9l+5<foc<nn6f23854.o1418om4H8bFWB0pjc+cZng<m8e6X68+vn>t55bKrqZdmOCaJmIaF"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="pum has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,11,12,13"
			y="15,15,14,14"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rythlion has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="mruk has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="DARKSOUL has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Matrin has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="10"
				y="20"
			[/source]
			[destination]
				x="10"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="909521049"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="74340290"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="hogar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,21,21,20"
			y="13,13,12,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="20"
				y="11"
			[/source]
			[destination]
				x="20"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="345817504"
			[results]
				chance="50"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1646315652"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="787455940"
			[results]
				chance="50"
				damage="4"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="susbus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23,23,22"
			y="12,12,12,11,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="22"
				y="10"
			[/source]
			[destination]
				x="21"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="516988361"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1135128255"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1557709965"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1213362173"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="22"
			y="9"
		[/recruit]
		[random]
			value="1870106956"
		[/random]
		[random]
			value="174995862"
		[/random]
		[random]
			value="1266026332"
		[/random]
		[random]
			value="1078135157"
		[/random]
		[random]
			value="1205487384"
		[/random]
		[random]
			value="1686141379"
		[/random]
		[random]
			value="6484313"
		[/random]
		[random]
			value="1104684713"
		[/random]
		[random]
			value="1430303312"
		[/random]
		[random]
			value="1541154411"
		[/random]
		[random]
			value="170563239"
		[/random]
		[random]
			value="1211895714"
		[/random]
		[random]
			value="1624526497"
		[/random]
		[random]
			value="371570019"
		[/random]
		[random]
			value="2011239306"
			[results]
				checksum="efk10b5br.lQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9er4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWJe+,PQ3hpR"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="21"
			y="9"
		[/recruit]
		[random]
			value="702111724"
		[/random]
		[random]
			value="548734161"
		[/random]
		[random]
			value="135799763"
		[/random]
		[random]
			value="1543431023"
		[/random]
		[random]
			value="1960139209"
		[/random]
		[random]
			value="2005906719"
		[/random]
		[random]
			value="1718426885"
		[/random]
		[random]
			value="1078681893"
		[/random]
		[random]
			value="936558228"
		[/random]
		[random]
			value="776430621"
		[/random]
		[random]
			value="617339624"
		[/random]
		[random]
			value="943042541"
		[/random]
		[random]
			value="1881115335"
		[/random]
		[random]
			value="2047642936"
		[/random]
		[random]
			value="336713305"
			[results]
				checksum="bfk10b5br.lQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9fm4>73a+>+.57mc,6d1edjnNmi-f,a8gbj.r.awWJe+,PQ3hpQ"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message="gg"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Chano has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Majestic_ has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tesafilmchen has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="PrisonHunter has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,18,18,19,20"
			y="11,11,12,13,12"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="0"
			[source]
				x="20"
				y="12"
			[/source]
			[destination]
				x="20"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="2091272204"
			[results]
				chance="70"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="81166095"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="391596643"
			[results]
				chance="70"
				damage="9"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="JudischerZwerg has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="timon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="-1"
			weapon="0"
			[source]
				x="21"
				y="11"
			[/source]
			[destination]
				x="22"
				y="10"
			[/destination]
		[/attack]
		[random]
			value="1008553318"
			[results]
				chance="70"
				damage="11"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="gg :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="gest"
			message="cu"
			side="2"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="CU"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Swart has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="gest has left the game."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="KnightKunibert takes control of side 2."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="xerox has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tedy2 has logged into the lobby"
		[/speak]
	[/command]
[/replay]
[snapshot]
	campaign_type="multiplayer"
	completion="running"
	current_tod="1"
#textdomain wesnoth-multiplayer
	description=_ "Players must traverse all manner of terrain in pursuit of victory on this multi-fronted duel map."
	difficulty="NORMAL"
	end_text_duration="0"
	experience_modifier="70"
	hash="cy9,5.FpN3rBcL.L4e+O18wLdEdI4Tz0IvgfbwAuK9N2059<42Xr0yhIQSuhssS,4T<A9.6ab>JpBPvMvrcHSQVHi2E+1XTwfH7D.FR+I29N,oCK6dipd3xe.OJ>Piko"
	id="multiplayer_Silverhead_Crossing"
	label="2p - Silverhead Crossing"
	map_data="border_size=1
usage=map

Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Wo          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Ww          , Ww          , Ww          , Ww          , Uh          , Xu          , Xu          , Ww          , Hh          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Gs^Fp       , Ww          , Xu          , Xu          , Gs^Fp       , Uu^Uf       , Uh          , Gs^Fp       , Mm          , Gg^Fet      , Ww          , Ww          , Ww          , Ww          , Ww          , Wo          , Ww          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Hh          , Gg          , Gg          , Gg          , Gg          , Uh          , Gg          , Gg          , Gg          , Ggf         , Gg          , Gg          , Gg          , Gs^Fp       , Hh          , Mm          , Gs^Fms      , Ww          , Ww          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Ww          , Mm          , Gs^Fms      , Gg^Ve       , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Wo          , Wwf         , Gg          , Gg          , Gg          , Rr          , Gg^Vc       , Gg          , Wwf         , Chw         , Hh          , Gs^Fp       , Ww          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Wwf         , Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Gs^Fp       , Xu          , Wwf         , Xu          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Chw         , Rr          , Rr          , Wwf         , Ww          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Gs^Fp       , Rd          , Chw         , Kh          , Ch          , Gg          , Gg          , Rd          , Rd^Uf       , Uh          , Xu          , Xu          , Rd^Uf       , Xu          , Wwf         , Wwf         , Gg          , Gg          , Hh          , Hh          , Wwf         , Ww          , Ww          , Xu          
Wo          , Wo          , Wo          , Wo          , Gg          , Ggf         , Hh          , Mm          , Wwf         , Chw         , Rd          , Uu^Vud      , Uu          , Ur          , Uu^Uf       , Ur          , Gs^Fp       , Xu          , Rd          , Gg          , Wwf         , Gg          , Gg          , Gg^Ve       , Gg^Fet      , Wwf         , Gs^Fp       , Ww          , Xu          
Wo          , Wo          , Ww          , Ww          , Ww          , Gg^Ve       , Wwf         , Gg^Fet      , Wwf         , Ggf         , Xu          , Uu          , Xu          , Uu^Uf       , Wwf         , Uh          , Xu          , Rd          , Gg          , Gg^Ve       , Kh          , Wwf         , Gg          , Gg          , Xu          , Wwf         , Wwf         , Xu          , Xu          
Wo          , Wo          , Ww          , Ww          , Gg          , Wwf         , Gg          , Wwf         , Xu          , Xu          , Gg          , Xu          , Gg          , Gg          , Ww          , Gg          , Gg          , Xu          , Gg          , Gg          , Ww          , Chw         , Ch          , Gg          , Xu          , Xu          , Uh          , Xu          , Xu          
Ww          , Ww          , Ww          , Gg          , Gg          , Gs^Fds      , Gg          , Rd          , Gg          , Gg          , Gg^Vc       , Gg          , Gs^Fms      , Ww          , Wo          , Ww          , Ww          , Gg          , Wwf         , Wwf         , Gg          , Ww          , Kh          , Gg          , Rd          , Gs^Fp       , Rd          , Xu          , Xu          
Ww          , Ww          , Gg          , Gg          , 1 Kh        , Gg          , Rd          , Rd          , Mm          , Gs^Fp       , Gg          , Gg          , Gg          , Ww          , Wo          , Wo          , Ww          , Wwf         , Kh          , Gs^Fms      , Ggf         , Gg          , Gg          , Gg          , Hh          , Rd          , Gg          , Xu          , Xu          
Ww          , Ww          , Ggf         , Gg          , Ch          , Ch          , Ggf         , Gg          , Gg          , Hh          , Gg          , Gs^Fp       , Ww          , Ww          , Ww          , Ww          , Wwf         , Ss^Vhs      , Kh          , Gg          , Hh          , Gs^Fds      , Gg          , Mm          , Gg          , Gg          , Ww          , Gg          , Gg          
Ww          , Gg          , Gg          , Rd          , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Hh          , Ww          , Wwf         , Wwf         , Rr          , Rr          , Chw         , Chw         , Wwf         , Gg          , Gg          , Gg          , Wwf         , Gg          , Wwf         , Gs^Fp       , Ww          , Ww          , Ww          
Ww          , Wwf         , Wwf         , Wwf         , Wwf         , Ch          , Kh          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Chw         , Wwf         , Rr          , Wwf         , Wwf         , Wwf         , Gs^Fp       , Wwf         , Wwf         , Wwf         , 2 Kud       , Wwf         , Gg          , Wwf         , Ww          , Wo          , Wo          
Gs^Fds      , Gs^Fms      , Hh          , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Gg          , Wwf         , Kh          , Chw         , Wwf         , Rr          , Mm          , Wwf         , Ww          , Ww          , Gg          , Gg          , Hh          , Gg          , Gg          , Cud         , Cud         , Gg          , Gg          , Ww          , Xu          
Rd          , Rd          , Rd          , Gg          , Rd          , Gg          , Gs^Fp       , Mm          , Hh          , Gg          , Kh          , Ss^Vhs      , Ww          , Ww          , Wo          , Ww          , Ww          , Ww          , Gg          , Gg          , Gg          , Mm          , Gg          , Kud         , Cud         , Rd          , Gg          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Rd          , Rd          , Rd          , Rd          , Gg          , Gg          , Wwf         , Wwf         , Ww          , Ww          , Ww          , Ww          , Ww          , Gs^Fms      , Ggf         , Gg^Ve       , Gs^Fds      , Gg          , Cud         , Cud         , Gg          , Rd          , Xu          , Xu          , Xu          
Xu          , Xu          , Uu^Uf       , Uu^Uf       , Uh          , Gg          , Kud         , Gg          , Wwf         , Wwf         , Xu          , Ww          , Hh          , Gs^Fp       , Gs^Fp       , Hh          , Ww          , Gg          , Hh          , Hh          , Xu          , Rd          , Rd          , Gg          , Rd          , Rd          , Gg          , Uu^Uf       , Uu^Uf       
Xu          , Xu          , Cud         , Wwf         , Xu          , Xu          , Wwf         , Cud         , Kud         , Xu          , Xu          , Xu          , Xu          , Cud         , Xu          , Cud         , Xu          , Xu          , Xu          , Xu          , Gs^Fp       , Gg          , Rd          , Rd          , Gg          , Gg          , Gs^Fp       , Xu          , Xu          
Xu          , Xu          , Cud         , Wwf         , Wwf         , Ww          , Gg          , Cud         , Rd          , Rd          , Uu^Vu       , Ur          , Uu^Uf       , Wwf^Uf      , Xu          , Wwf^Uf      , Uu^Uf       , Ur          , Uu^Vu       , Rd          , Rd          , Gg          , Rd          , Gg          , Uu^Vud      , Uu^Uf       , Cud         , Xu          , Xu          
Wwf         , Wwf         , Wwf         , Wwf         , Gs^Fp       , Gg^Vc       , Rd          , Rd          , Xu          , Ur          , Ur          , Uh          , Uh          , Wwf         , Wwf         , Wwf         , Uh          , Uh          , Ur          , Ur          , Xu          , Rd          , Gg          , Gg          , Gg          , Ur          , Cud         , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Gg          , Ggf         , Mm          , Rd          , Rd          , Xu          , Rd          , Xu          , Wwf         , Wwf         , Ggf         , Wwf         , Wwf         , Xu          , Rd          , Xu          , Rd          , Rd          , Kud         , Gg          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Hh          , Gs^Fp       , Gg          , Gg          , Rd          , Gg          , Gg          , Wwf         , Mm          , Gs^Fp       , Hh          , Gg          , Wwf         , Gg          , Rd          , Gg          , Cud         , Cud         , Cud         , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Rd^Uf       , Gg          , Gs^Fms      , Gg^Ve       , Gg          , Wwf         , Gg          , Gg          , Gg          , Gs^Fms      , Gg          , Wwf         , Gg          , Gg^Ve       , Gs^Fds      , Rd          , Rd^Uf       , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Ur          , Xu          , Xu          , Ggf         , Gg          , Wwf         , Gg          , Hh          , Gg          , Mm          , Hh          , Wwf         , Wwf         , Ggf         , Xu          , Xu          , Ur          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Ur          , Xu          , Rr          , Xu          , Wwf         , Wwf         , Gs^Fp       , Gg          , Xu          , Gg          , Gg          , Gg          , Wwf         , Xu          , Xu          , Ur          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Rr          , Wwf         , Chw         , Wwf         , Rr          , Ur          , Xu          , Uu^Uf       , Xu          , Ur          , Gs^Fp       , Rr          , Wwf         , Wwf         , Chw         , Wwf         , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Wwf         , Xu          , Xu          , Rr          , Rr          , Wwf         , Uh          , Wwf         , Uu^Uf       , Wwf         , Rr          , Rr          , Rr          , Rr          , Wwf         , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Wo          , Wwf         , Ur          , Wwf         , Wo          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Uh          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
"
	mp_countdown="yes"
	mp_countdown_action_bonus="20"
	mp_countdown_init_time="270"
	mp_countdown_reservoir_time="270"
	mp_countdown_turn_bonus="200"
	mp_fog="yes"
	mp_shroud="no"
	mp_use_map_settings="yes"
	mp_village_gold="2"
	name=_ "2p - Silverhead Crossing"
	next_underlying_unit_id="24"
#textdomain wesnoth
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	playing_team="0"
	random_calls="1"
	random_seed="1327609764"
	random_start_time="no"
	snapshot="yes"
	turn_at="8"
	turns="-1"
	unit_wml_ids="Dark Adept,Dark Sorcerer,Drake Burner,Drake Gladiator,Drake Glider,Ghoul,Saurian Skirmisher,Vampire Bat,era_events"
	version="1.6"
	[side]
		action_bonus_count="2"
		aggression="0.5"
		allow_player="yes"
		caution="0.25"
		colour="1"
		controller="human"
		countdown_time="234381"
		current_player="KnightKunibert"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,archer,fighter,scout,archer"
		gold="27"
		hidden="no"
		id="KnightKunibert1"
		income="0"
		leader_value="3"
		name="KnightKunibert"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives=_ "Victory:
@Defeat enemy leader(s)"
		objectives_changed="no"
		recruit="Dark Adept,Ghost,Ghoul,Skeleton,Skeleton Archer,Vampire Bat,Walking Corpse"
		recruitment_pattern="fighter,fighter,archer,fighter,scout,archer"
		save_id="KnightKunibert1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		start_gold="100"
		team_name="west"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^West"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[ai]
			recruitment_pattern="fighter,fighter,archer,fighter,scout,archer"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
		[village]
			x="5"
			y="8"
		[/village]
		[village]
			x="5"
			y="21"
		[/village]
		[village]
			x="9"
			y="4"
		[/village]
		[village]
			x="9"
			y="24"
		[/village]
		[village]
			x="11"
			y="16"
		[/village]
		[village]
			x="17"
			y="12"
		[/village]
		[village]
			x="18"
			y="20"
		[/village]
		[village]
			x="19"
			y="17"
		[/village]
		[village]
			x="24"
			y="20"
		[/village]
		[unit]
			advances_to="Lich,Necromancer"
			alignment="chaotic"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="32"
			current_player="KnightKunibert"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			experience="8"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="48"
			id="KnightKunibert1"
			image="units/undead-necromancers/dark-sorcerer.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Dark Sorcerer"
			leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage"
			level="2"
			max_attacks="1"
			max_experience="63"
			max_hitpoints="48"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			mp_countdown="yes"
			mp_countdown_action_bonus="20"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="270"
			mp_countdown_turn_bonus="200"
			name="KnightKunibert"
			profile="portraits/humans/necromancer.png"
			race="human"
			random_leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter"
			random_traits="no"
			recruit="Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="west"
			terrain_liked="Ss, Hh, Ha, Ww"
			type="Dark Sorcerer"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			user_team_name="wesnoth-multiplayerteamname^West"
			village_gold="2"
			x="13"
			y="14"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "staff"
				icon="attacks/staff-necromantic.png"
				name="staff"
				number="3"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="13"
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="9"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="19"
			id="Vampire Bat-4"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="19"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="4"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="9"
			y="4"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="22"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Dark Adept-5"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="32"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Ela"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="5"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="21"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Necrophage"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="ghoul-hit.wav"
			ellipse="misc/ellipse"
			experience="15"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Ghoul-6"
			image="units/undead/ghoul.png"
#textdomain wesnoth-units
			language_name=_ "Ghoul"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="gruefoot"
			moves="5"
			profile="portraits/undead/ghoul.png"
			race="undead"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Ghoul"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="19"
			y="13"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/undead/ghoul.png"
				[/frame]
				[frame]
					begin="-200"
					end="-125"
					image="units/undead/ghoul-attack-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="claws.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[if]
					hits="hit"
					poisoned_sound_start_time="-100"
					[filter_second]
						[not]
							[filter_wml]
								[status]
									poisoned="yes"
								[/status]
							[/filter_wml]
						[/not]
					[/filter_second]
					[poisoned_sound_frame]
						duration="100"
						sound="poison.ogg"
					[/poisoned_sound_frame]
				[/if]
				[frame]
					begin="-50"
					end="50"
					image="units/undead/ghoul-attack-3.png"
				[/frame]
				[frame]
					begin="50"
					end="125"
					image="units/undead/ghoul-attack-4.png"
				[/frame]
				[frame]
					begin="125"
					end="200"
					image="units/undead/ghoul.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/ghoul-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
						sound="ghoul-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
			[/defend]
			[trait]
				availability="musthave"
#textdomain wesnoth
				description=_ "Fights normally during unfavorable times of day/night"
				female_name=_ "female^fearless"
				id="fearless"
				male_name=_ "fearless"
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="90"
				flat="60"
				forest="50"
				frozen="70"
				fungus="40"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="90"
				cold="60"
				fire="90"
				impact="100"
				pierce="70"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				not_living="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "claws"
				icon="attacks/claws-undead.png"
				name="claws"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[poison]
#textdomain wesnoth
						description=_ "Poison:
This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison can not, of itself, kill a unit."
						id="poison"
						name=_ "poison"
					[/poison]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					availability="musthave"
					description=_ "Immune to drain, poison and plague"
					female_name=_ "female^undead"
					id="undead"
					male_name=_ "undead"
					name=_ "undead"
					[effect]
						add="not_living"
						apply_to="status"
					[/effect]
				[/trait]
				[trait]
					availability="musthave"
					description=_ "Fights normally during unfavorable times of day/night"
					female_name=_ "female^fearless"
					id="fearless"
					male_name=_ "fearless"
					name=_ "fearless"
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-7"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Gwan"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="7"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="10"
			y="21"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="16"
			id="Vampire Bat-8"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="16"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="8"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="24"
			y="20"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-16"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Coc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="9"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-18"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Teollygwyc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="18"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="20"
			y="12"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="31"
			id="Dark Adept-21"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="31"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Jolonna"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="21"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="11"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-22"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Cenycyn"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="22"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="10"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Lich,Necromancer"
			alignment="chaotic"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="32"
			current_player="KnightKunibert"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			experience="8"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="48"
			id="KnightKunibert1"
			image="units/undead-necromancers/dark-sorcerer.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Dark Sorcerer"
			leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage"
			level="2"
			max_attacks="1"
			max_experience="63"
			max_hitpoints="48"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			mp_countdown="yes"
			mp_countdown_action_bonus="20"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="270"
			mp_countdown_turn_bonus="200"
			name="KnightKunibert"
			profile="portraits/humans/necromancer.png"
			race="human"
			random_leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter"
			random_traits="no"
			recruit="Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="west"
			terrain_liked="Ss, Hh, Ha, Ww"
			type="Dark Sorcerer"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			user_team_name="wesnoth-multiplayerteamname^West"
			village_gold="2"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "staff"
				icon="attacks/staff-necromantic.png"
				name="staff"
				number="3"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="13"
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="9"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="19"
			id="Vampire Bat-4"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="19"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="4"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="22"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Dark Adept-5"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="32"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Ela"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="5"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Necrophage"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="ghoul-hit.wav"
			ellipse="misc/ellipse"
			experience="15"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Ghoul-6"
			image="units/undead/ghoul.png"
#textdomain wesnoth-units
			language_name=_ "Ghoul"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="gruefoot"
			moves="5"
			profile="portraits/undead/ghoul.png"
			race="undead"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Ghoul"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/undead/ghoul.png"
				[/frame]
				[frame]
					begin="-200"
					end="-125"
					image="units/undead/ghoul-attack-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="claws.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[if]
					hits="hit"
					poisoned_sound_start_time="-100"
					[filter_second]
						[not]
							[filter_wml]
								[status]
									poisoned="yes"
								[/status]
							[/filter_wml]
						[/not]
					[/filter_second]
					[poisoned_sound_frame]
						duration="100"
						sound="poison.ogg"
					[/poisoned_sound_frame]
				[/if]
				[frame]
					begin="-50"
					end="50"
					image="units/undead/ghoul-attack-3.png"
				[/frame]
				[frame]
					begin="50"
					end="125"
					image="units/undead/ghoul-attack-4.png"
				[/frame]
				[frame]
					begin="125"
					end="200"
					image="units/undead/ghoul.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/ghoul-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
						sound="ghoul-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
			[/defend]
			[trait]
				availability="musthave"
#textdomain wesnoth
				description=_ "Fights normally during unfavorable times of day/night"
				female_name=_ "female^fearless"
				id="fearless"
				male_name=_ "fearless"
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="90"
				flat="60"
				forest="50"
				frozen="70"
				fungus="40"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="90"
				cold="60"
				fire="90"
				impact="100"
				pierce="70"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				not_living="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "claws"
				icon="attacks/claws-undead.png"
				name="claws"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[poison]
#textdomain wesnoth
						description=_ "Poison:
This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison can not, of itself, kill a unit."
						id="poison"
						name=_ "poison"
					[/poison]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					availability="musthave"
					description=_ "Immune to drain, poison and plague"
					female_name=_ "female^undead"
					id="undead"
					male_name=_ "undead"
					name=_ "undead"
					[effect]
						add="not_living"
						apply_to="status"
					[/effect]
				[/trait]
				[trait]
					availability="musthave"
					description=_ "Fights normally during unfavorable times of day/night"
					female_name=_ "female^fearless"
					id="fearless"
					male_name=_ "fearless"
					name=_ "fearless"
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-7"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Gwan"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="7"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="16"
			id="Vampire Bat-8"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="16"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="8"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-16"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Coc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-18"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Teollygwyc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="18"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="31"
			id="Dark Adept-21"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="31"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Jolonna"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="21"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-22"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Cenycyn"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="22"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/side]
	[side]
		action_bonus_count="11"
		aggression="0.5"
		allow_player="yes"
		caution="0.25"
		colour="2"
		controller="human"
		countdown_time="270000"
		current_player="human2"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
		gold="0"
		hidden="no"
		id="gest2"
		income="0"
		leader_value="3"
		name="gest"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives=_ "Victory:
@Defeat enemy leader(s)"
		objectives_changed="yes"
		recruit="Drake Burner,Drake Clasher,Drake Fighter,Drake Glider,Saurian Augur,Saurian Skirmisher"
		recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
		save_id="gest2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		start_gold="100"
		team_name="east"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^East"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[ai]
			recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
		[unit]
			advances_to="Sky Drake"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="s"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="37"
			id="Drake Glider-9"
			image="units/drakes/glider.png"
#textdomain wesnoth-units
			language_name=_ "Drake Glider"
			level="1"
			max_attacks="1"
			max_experience="20"
			max_hitpoints="37"
			max_moves="8"
			movement="8"
			movement_type="drakefly"
			moves="8"
			name="Morutick"
			profile="portraits/drakes/glider.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Drake Glider"
			undead_variation="drake"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="10"
			y="20"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="fire breath"
				[/filter_attack]
				[if]
					direction="n"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-n-1.png:80,projectiles/fire-breath-n-2.png:80,projectiles/fire-breath-n-3.png:80,projectiles/fire-breath-n-4.png:80,projectiles/fire-breath-n-5.png:80"
						halo_x="9"
						halo_y="-34"
					[/missile_frame]
				[/if]
				[else]
					direction="s"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-s-1.png:80,projectiles/fire-breath-s-2.png:80,projectiles/fire-breath-s-3.png:80,projectiles/fire-breath-s-4.png:80,projectiles/fire-breath-s-5.png:80"
						halo_x="9"
						halo_y="15"
					[/missile_frame]
				[/else]
				[else]
					direction="ne,nw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-ne-1.png:80,projectiles/fire-breath-ne-2.png:80,projectiles/fire-breath-ne-3.png:80,projectiles/fire-breath-ne-4.png:80,projectiles/fire-breath-ne-5.png:80"
						halo_x="22"
						halo_y="-22"
					[/missile_frame]
				[/else]
				[else]
					direction="se,sw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-se-1.png:80,projectiles/fire-breath-se-2.png:80,projectiles/fire-breath-se-3.png:80,projectiles/fire-breath-se-4.png:80,projectiles/fire-breath-se-5.png:80"
						halo_x="24"
						halo_y="10"
					[/missile_frame]
				[/else]
				[if]
					hits="no"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-350"
					end="-150"
					image="units/drakes/glider-attack-ranged.png"
				[/frame]
				[frame]
					begin="-150"
					end="0"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="slam"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="club.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/glider-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/glider-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/glider-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/glider-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/glider-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/glider-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/glider-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/glider-die-8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/glider-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
						sound="drake-hit-1.ogg,drake-hit-2.ogg,drake-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/movement_anim]
			[standing_anim]
				start_time="0"
				[filter]
					[filter_location]
						terrain="!,W*,Qx*,Ql*"
						[or]
							terrain="Wwf,Wwr,*^V*"
						[/or]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				layer="60"
				start_time="0"
				submerge="0.01"
				[filter]
					[filter_location]
						terrain="W*,Qx*,Ql*"
						[not]
							terrain="Wwf,Wwr,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="60"
				cave="70"
				deep_water="80"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="70"
				unwalkable="60"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="2"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="90"
				cold="150"
				fire="50"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "slam"
				icon="attacks/slam-drake.png"
				name="slam"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="3"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="3"
				range="ranged"
				type="fire"
				[specials]
					[chance_to_hit]
						active_on="offense"
						cumulative="yes"
#textdomain wesnoth
						description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
						id="marksman"
						name=_ "marksman"
						value="60"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Saurian Skirmisher-23"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="32"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kertras"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="23"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="22"
			y="9"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="nw"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Skirmisher-24"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="18"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Prezz"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="24"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="21"
			y="9"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Sky Drake"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="s"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="37"
			id="Drake Glider-9"
			image="units/drakes/glider.png"
#textdomain wesnoth-units
			language_name=_ "Drake Glider"
			level="1"
			max_attacks="1"
			max_experience="20"
			max_hitpoints="37"
			max_moves="8"
			movement="8"
			movement_type="drakefly"
			moves="8"
			name="Morutick"
			profile="portraits/drakes/glider.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Drake Glider"
			undead_variation="drake"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="fire breath"
				[/filter_attack]
				[if]
					direction="n"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-n-1.png:80,projectiles/fire-breath-n-2.png:80,projectiles/fire-breath-n-3.png:80,projectiles/fire-breath-n-4.png:80,projectiles/fire-breath-n-5.png:80"
						halo_x="9"
						halo_y="-34"
					[/missile_frame]
				[/if]
				[else]
					direction="s"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-s-1.png:80,projectiles/fire-breath-s-2.png:80,projectiles/fire-breath-s-3.png:80,projectiles/fire-breath-s-4.png:80,projectiles/fire-breath-s-5.png:80"
						halo_x="9"
						halo_y="15"
					[/missile_frame]
				[/else]
				[else]
					direction="ne,nw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-ne-1.png:80,projectiles/fire-breath-ne-2.png:80,projectiles/fire-breath-ne-3.png:80,projectiles/fire-breath-ne-4.png:80,projectiles/fire-breath-ne-5.png:80"
						halo_x="22"
						halo_y="-22"
					[/missile_frame]
				[/else]
				[else]
					direction="se,sw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-se-1.png:80,projectiles/fire-breath-se-2.png:80,projectiles/fire-breath-se-3.png:80,projectiles/fire-breath-se-4.png:80,projectiles/fire-breath-se-5.png:80"
						halo_x="24"
						halo_y="10"
					[/missile_frame]
				[/else]
				[if]
					hits="no"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-350"
					end="-150"
					image="units/drakes/glider-attack-ranged.png"
				[/frame]
				[frame]
					begin="-150"
					end="0"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="slam"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="club.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/glider-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/glider-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/glider-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/glider-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/glider-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/glider-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/glider-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/glider-die-8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/glider-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
						sound="drake-hit-1.ogg,drake-hit-2.ogg,drake-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/movement_anim]
			[standing_anim]
				start_time="0"
				[filter]
					[filter_location]
						terrain="!,W*,Qx*,Ql*"
						[or]
							terrain="Wwf,Wwr,*^V*"
						[/or]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				layer="60"
				start_time="0"
				submerge="0.01"
				[filter]
					[filter_location]
						terrain="W*,Qx*,Ql*"
						[not]
							terrain="Wwf,Wwr,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="60"
				cave="70"
				deep_water="80"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="70"
				unwalkable="60"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="2"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="90"
				cold="150"
				fire="50"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "slam"
				icon="attacks/slam-drake.png"
				name="slam"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="3"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="3"
				range="ranged"
				type="fire"
				[specials]
					[chance_to_hit]
						active_on="offense"
						cumulative="yes"
#textdomain wesnoth
						description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
						id="marksman"
						name=_ "marksman"
						value="60"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Saurian Skirmisher-23"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="32"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kertras"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="23"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="nw"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Skirmisher-24"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="18"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Prezz"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="24"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/side]
	[time]
		blue="0"
		green="-20"
		id="dawn"
		image="misc/schedule-dawn.png"
		lawful_bonus="0"
		name=_ "Dawn"
		red="-20"
	[/time]
	[time]
		blue="0"
		green="0"
		id="morning"
		image="misc/schedule-morning.png"
		lawful_bonus="25"
		name=_ "Morning"
		red="0"
	[/time]
	[time]
		blue="0"
		green="0"
		id="afternoon"
		image="misc/schedule-afternoon.png"
		lawful_bonus="25"
		name=_ "Afternoon"
		red="0"
	[/time]
	[time]
		blue="-20"
		green="-20"
		id="dusk"
		image="misc/schedule-dusk.png"
		lawful_bonus="0"
		name=_ "Dusk"
		red="0"
	[/time]
	[time]
		blue="-10"
		green="-40"
		id="first_watch"
		image="misc/schedule-firstwatch.png"
		lawful_bonus="-25"
		name=_ "First Watch"
		red="-40"
	[/time]
	[time]
		blue="-10"
		green="-40"
		id="second_watch"
		image="misc/schedule-secondwatch.png"
		lawful_bonus="-25"
		name=_ "Second Watch"
		red="-40"
	[/time]
	[variables]
		damage_inflicted="11"
		side_number="1"
		turn_number="8"
	[/variables]
	[player]
		can_recruit="Dark Adept,Ghost,Ghoul,Skeleton,Skeleton Archer,Vampire Bat,Walking Corpse"
		gold="-1"
		gold_add="no"
		name="KnightKunibert"
		save_id="KnightKunibert1"
		[unit]
			advances_to="Lich,Necromancer"
			alignment="chaotic"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="32"
			current_player="KnightKunibert"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			experience="8"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="48"
			id="KnightKunibert1"
			image="units/undead-necromancers/dark-sorcerer.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Dark Sorcerer"
			leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage"
			level="2"
			max_attacks="1"
			max_experience="63"
			max_hitpoints="48"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			mp_countdown="yes"
			mp_countdown_action_bonus="20"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="270"
			mp_countdown_turn_bonus="200"
			name="KnightKunibert"
			profile="portraits/humans/necromancer.png"
			race="human"
			random_leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter"
			random_traits="no"
			recruit="Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="west"
			terrain_liked="Ss, Hh, Ha, Ww"
			type="Dark Sorcerer"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			user_team_name="wesnoth-multiplayerteamname^West"
			village_gold="2"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/necromancer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "staff"
				icon="attacks/staff-necromantic.png"
				name="staff"
				number="3"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="13"
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="9"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="19"
			id="Vampire Bat-4"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="19"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="4"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="22"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Dark Adept-5"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="32"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Ela"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="5"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Necrophage"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="ghoul-hit.wav"
			ellipse="misc/ellipse"
			experience="15"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Ghoul-6"
			image="units/undead/ghoul.png"
#textdomain wesnoth-units
			language_name=_ "Ghoul"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="gruefoot"
			moves="5"
			profile="portraits/undead/ghoul.png"
			race="undead"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Ghoul"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/undead/ghoul.png"
				[/frame]
				[frame]
					begin="-200"
					end="-125"
					image="units/undead/ghoul-attack-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="claws.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-125"
						end="-50"
						image="units/undead/ghoul-attack-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[if]
					hits="hit"
					poisoned_sound_start_time="-100"
					[filter_second]
						[not]
							[filter_wml]
								[status]
									poisoned="yes"
								[/status]
							[/filter_wml]
						[/not]
					[/filter_second]
					[poisoned_sound_frame]
						duration="100"
						sound="poison.ogg"
					[/poisoned_sound_frame]
				[/if]
				[frame]
					begin="-50"
					end="50"
					image="units/undead/ghoul-attack-3.png"
				[/frame]
				[frame]
					begin="50"
					end="125"
					image="units/undead/ghoul-attack-4.png"
				[/frame]
				[frame]
					begin="125"
					end="200"
					image="units/undead/ghoul.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/ghoul-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
						sound="ghoul-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/ghoul-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/ghoul-defend-1.png"
				[/frame]
			[/defend]
			[trait]
				availability="musthave"
#textdomain wesnoth
				description=_ "Fights normally during unfavorable times of day/night"
				female_name=_ "female^fearless"
				id="fearless"
				male_name=_ "fearless"
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="90"
				flat="60"
				forest="50"
				frozen="70"
				fungus="40"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="90"
				cold="60"
				fire="90"
				impact="100"
				pierce="70"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				not_living="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "claws"
				icon="attacks/claws-undead.png"
				name="claws"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[poison]
#textdomain wesnoth
						description=_ "Poison:
This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison can not, of itself, kill a unit."
						id="poison"
						name=_ "poison"
					[/poison]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					availability="musthave"
					description=_ "Immune to drain, poison and plague"
					female_name=_ "female^undead"
					id="undead"
					male_name=_ "undead"
					name=_ "undead"
					[effect]
						add="not_living"
						apply_to="status"
					[/effect]
				[/trait]
				[trait]
					availability="musthave"
					description=_ "Fights normally during unfavorable times of day/night"
					female_name=_ "female^fearless"
					id="fearless"
					male_name=_ "fearless"
					name=_ "fearless"
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-7"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Gwan"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="7"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Blood Bat"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="bat-flapping.wav"
			ellipse="misc/ellipse-nozoc"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="16"
			id="Vampire Bat-8"
			image="units/undead/bat-se-3.png"
#textdomain wesnoth-units
			language_name=_ "Vampire Bat"
			level="0"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="16"
			max_moves="9"
			movement="8"
			movement_type="smallfly"
			moves="9"
			race="bats"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Vampire Bat"
			undead_variation="bat"
			underlying_id="8"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="no"
			[attack_anim]
				direction="s,se,sw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-se-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-se-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n,ne,nw"
				offset="0.0~0.9:200,0.9~0.0:160"
				start_time="-200"
				[filter_attack]
					name="fangs"
				[/filter_attack]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-1.png"
					sound="bat-flapping.wav"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="30"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="bite-small.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="70"
						image="units/undead/bat-ne-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="40"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/attack_anim]
			[defend]
				direction="s,sw,se"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-se-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-se-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-se-3.png"
				[/frame]
			[/defend]
			[defend]
				direction="n,nw,ne"
				start_time="-126"
				[if]
					hits="miss"
					offset="0.0~-0.15,-0.15~0.0"
				[/if]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
						sound="bat-hit-1.ogg,bat-hit-2.ogg,bat-hit-3.ogg,bat-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead/bat-ne-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead/bat-ne-3.png"
				[/frame]
			[/defend]
			[standing_anim]
				direction="s,se,sw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-se-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-se-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-se-4.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				direction="n,ne,nw"
				layer="60"
				start_time="0"
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-2.png"
				[/frame]
				[frame]
					duration="50"
					image="units/undead/bat-ne-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/undead/bat-ne-5.png"
				[/frame]
				[frame]
					duration="60"
					image="units/undead/bat-ne-4.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="40"
				cave="40"
				deep_water="40"
				flat="40"
				forest="40"
				frozen="40"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="40"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="40"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="70"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="blade"
				[specials]
					[drains]
#textdomain wesnoth
						description=_ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
						id="drains"
						name=_ "drains"
					[/drains]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-16"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Coc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Dark Adept-18"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="33"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="5"
			name="Teollygwyc"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="18"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="8"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="31"
			id="Dark Adept-21"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="34"
			max_hitpoints="31"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Jolonna"
			profile="portraits/humans/dark-adept+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="21"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept+female-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept+female-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept+female-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept+female-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept+female.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept+female-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
						sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept+female-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept+female-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept+female.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dark Sorcerer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Dark Adept-22"
			ignore_race_traits="yes"
			image="units/undead-necromancers/adept.png"
#textdomain wesnoth-units
			language_name=_ "Dark Adept"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="27"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="6"
			name="Cenycyn"
			profile="portraits/humans/dark-adept.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dark Adept"
			underlying_id="22"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-50"
					end="150"
					image="projectiles/darkmissile-n.png"
					image_diagonal="projectiles/darkmissile-ne.png"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-420"
					image="units/undead-necromancers/adept.png"
				[/frame]
				[frame]
					begin="-420"
					end="-395"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="-395"
					end="-320"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="-320"
					end="-300"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-300"
					end="-250"
					halo="halo/undead/dark-magic-1.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					halo="halo/undead/dark-magic-2.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					halo="halo/undead/dark-magic-3.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					halo="halo/undead/dark-magic-4.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					halo="halo/undead/dark-magic-5.png"
					halo_x="0"
					halo_y="-12"
					image="units/undead-necromancers/adept-magic-3.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-50"
						end="0"
						halo="halo/undead/dark-magic-6.png"
						halo_x="0"
						halo_y="-12"
						image="units/undead-necromancers/adept-magic-3.png"
						sound="magic-dark.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="50"
					image="units/undead-necromancers/adept-magic-2.png"
				[/frame]
				[frame]
					begin="50"
					end="90"
					image="units/undead-necromancers/adept-magic-1.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/undead-necromancers/adept.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/undead-necromancers/adept-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/undead-necromancers/adept-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/undead-necromancers/adept-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/undead-necromancers/adept-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="520"
					image="units/undead-necromancers/adept-die5.png"
				[/frame]
				[frame]
					begin="520"
					end="640"
					image="units/undead-necromancers/adept-die6.png"
				[/frame]
				[frame]
					begin="640"
					end="780"
					image="units/undead-necromancers/adept-die7.png"
				[/frame]
				[frame]
					begin="780"
					end="900"
					image="units/undead-necromancers/adept-die8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/undead-necromancers/adept-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/undead-necromancers/adept-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/undead-necromancers/adept-defend-1.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/dark-adept.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[trait]
#textdomain wesnoth
				female_name=_ "female^quick"
				id="quick"
				male_name=_ "quick"
				[effect]
					apply_to="movement"
					increase="1"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="-5%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^intelligent"
				id="intelligent"
				male_name=_ "intelligent"
				[effect]
					apply_to="max_experience"
					increase="-20%"
				[/effect]
			[/trait]
			[trait]
				female_name=_ "female^resilient"
				id="resilient"
				male_name=_ "resilient"
				[effect]
					apply_to="hitpoints"
					increase_total="4"
				[/effect]
				[effect]
					apply_to="hitpoints"
					increase_total="1"
					times="per level"
				[/effect]
			[/trait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "chill wave"
				icon="attacks/iceball.png"
				name="chill wave"
				number="2"
				range="ranged"
				type="cold"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "shadow wave"
				icon="attacks/dark-missile.png"
				name="shadow wave"
				number="2"
				range="ranged"
				type="arcane"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/player]
	[player]
		can_recruit="Drake Burner,Drake Clasher,Drake Fighter,Drake Glider,Saurian Augur,Saurian Skirmisher"
		gold="-1"
		gold_add="no"
		name="gest"
		save_id="gest2"
		[unit]
			advances_to="Sky Drake"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="s"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="37"
			id="Drake Glider-9"
			image="units/drakes/glider.png"
#textdomain wesnoth-units
			language_name=_ "Drake Glider"
			level="1"
			max_attacks="1"
			max_experience="20"
			max_hitpoints="37"
			max_moves="8"
			movement="8"
			movement_type="drakefly"
			moves="8"
			name="Morutick"
			profile="portraits/drakes/glider.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Drake Glider"
			undead_variation="drake"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="fire breath"
				[/filter_attack]
				[if]
					direction="n"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-n-1.png:80,projectiles/fire-breath-n-2.png:80,projectiles/fire-breath-n-3.png:80,projectiles/fire-breath-n-4.png:80,projectiles/fire-breath-n-5.png:80"
						halo_x="9"
						halo_y="-34"
					[/missile_frame]
				[/if]
				[else]
					direction="s"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-s-1.png:80,projectiles/fire-breath-s-2.png:80,projectiles/fire-breath-s-3.png:80,projectiles/fire-breath-s-4.png:80,projectiles/fire-breath-s-5.png:80"
						halo_x="9"
						halo_y="15"
					[/missile_frame]
				[/else]
				[else]
					direction="ne,nw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-ne-1.png:80,projectiles/fire-breath-ne-2.png:80,projectiles/fire-breath-ne-3.png:80,projectiles/fire-breath-ne-4.png:80,projectiles/fire-breath-ne-5.png:80"
						halo_x="22"
						halo_y="-22"
					[/missile_frame]
				[/else]
				[else]
					direction="se,sw"
					[missile_frame]
						begin="-400"
						end="100"
						halo="projectiles/fire-breath-se-1.png:80,projectiles/fire-breath-se-2.png:80,projectiles/fire-breath-se-3.png:80,projectiles/fire-breath-se-4.png:80,projectiles/fire-breath-se-5.png:80"
						halo_x="24"
						halo_y="10"
					[/missile_frame]
				[/else]
				[if]
					hits="no"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-400"
						end="-350"
						image="units/drakes/glider.png"
						sound="flame-big.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-350"
					end="-150"
					image="units/drakes/glider-attack-ranged.png"
				[/frame]
				[frame]
					begin="-150"
					end="0"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="slam"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="club.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/drakes/glider-attack-close2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="100"
					image="units/drakes/glider-flying.png"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/drakes/glider-attack-close1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/drakes/glider.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/glider-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/glider-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/glider-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/glider-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/glider-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/glider-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/glider-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/glider-die-8.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/glider-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
						sound="drake-hit-1.ogg,drake-hit-2.ogg,drake-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/drakes/glider-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/glider.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/movement_anim]
			[standing_anim]
				start_time="0"
				[filter]
					[filter_location]
						terrain="!,W*,Qx*,Ql*"
						[or]
							terrain="Wwf,Wwr,*^V*"
						[/or]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider.png"
				[/frame]
			[/standing_anim]
			[standing_anim]
				layer="60"
				start_time="0"
				submerge="0.01"
				[filter]
					[filter_location]
						terrain="W*,Qx*,Ql*"
						[not]
							terrain="Wwf,Wwr,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="150"
					image="units/drakes/glider-flying.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="60"
				cave="70"
				deep_water="80"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="70"
				unwalkable="60"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="2"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="90"
				cold="150"
				fire="50"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "slam"
				icon="attacks/slam-drake.png"
				name="slam"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="3"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="3"
				range="ranged"
				type="fire"
				[specials]
					[chance_to_hit]
						active_on="offense"
						cumulative="yes"
#textdomain wesnoth
						description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
						id="marksman"
						name=_ "marksman"
						value="60"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Saurian Skirmisher-23"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="32"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kertras"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="23"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Ambusher"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="nw"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Skirmisher-24"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="18"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Prezz"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="24"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
					range="ranged"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/saurians/skirmisher-attack-ranged-1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack-ranged-2.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw,s,se,sw"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/saurians/skirmisher-attack2.png"
						sound="spear.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="150"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/saurians/skirmisher-attack-n1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="90"
						image="units/saurians/skirmisher-attack-n2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="90"
					end="150"
					image="units/saurians/skirmisher-attack1.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/skirmisher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/skirmisher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/skirmisher.png"
				[/frame]
			[/defend]
			[idle_anim]
				start_time="0"
				[filter]
					[not]
						[filter_wml]
							[status]
								poisoned="yes"
							[/status]
						[/filter_wml]
					[/not]
				[/filter]
				[filter]
					[filter_adjacent]
						count="0"
						is_enemy="yes"
					[/filter_adjacent]
				[/filter]
				[filter]
					[filter_location]
						[not]
							terrain="C*,K*,*^V*"
						[/not]
					[/filter_location]
				[/filter]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-1.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-2.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-8.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-9.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-10.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-11.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="200"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="225"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-12.png"
				[/frame]
				[frame]
					duration="250"
					image="units/saurians/skirmisher-idle-13.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/skirmisher.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="40"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="40"
				hills="40"
				impassable="40"
				mountains="40"
				reef="60"
				sand="40"
				shallow_water="60"
				swamp_water="40"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="110"
				cold="120"
				fire="120"
				impact="110"
				pierce="80"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="4"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/player]
[/snapshot]
[replay_start]
	current_tod="0"
#textdomain wesnoth-multiplayer
	description=_ "Players must traverse all manner of terrain in pursuit of victory on this multi-fronted duel map."
	experience_modifier="70"
	hash="cy9,5.FpN3rBcL.L4e+O18wLdEdI4Tz0IvgfbwAuK9N2059<42Xr0yhIQSuhssS,4T<A9.6ab>JpBPvMvrcHSQVHi2E+1XTwfH7D.FR+I29N,oCK6dipd3xe.OJ>Piko"
	id="multiplayer_Silverhead_Crossing"
	map_data="border_size=1
usage=map

Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Wo          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Ww          , Ww          , Ww          , Ww          , Uh          , Xu          , Xu          , Ww          , Hh          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Gs^Fp       , Ww          , Xu          , Xu          , Gs^Fp       , Uu^Uf       , Uh          , Gs^Fp       , Mm          , Gg^Fet      , Ww          , Ww          , Ww          , Ww          , Ww          , Wo          , Ww          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Hh          , Gg          , Gg          , Gg          , Gg          , Uh          , Gg          , Gg          , Gg          , Ggf         , Gg          , Gg          , Gg          , Gs^Fp       , Hh          , Mm          , Gs^Fms      , Ww          , Ww          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Ww          , Mm          , Gs^Fms      , Gg^Ve       , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Wo          , Wwf         , Gg          , Gg          , Gg          , Rr          , Gg^Vc       , Gg          , Wwf         , Chw         , Hh          , Gs^Fp       , Ww          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Wwf         , Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Gs^Fp       , Xu          , Wwf         , Xu          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Chw         , Rr          , Rr          , Wwf         , Ww          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Gs^Fp       , Rd          , Chw         , Kh          , Ch          , Gg          , Gg          , Rd          , Rd^Uf       , Uh          , Xu          , Xu          , Rd^Uf       , Xu          , Wwf         , Wwf         , Gg          , Gg          , Hh          , Hh          , Wwf         , Ww          , Ww          , Xu          
Wo          , Wo          , Wo          , Wo          , Gg          , Ggf         , Hh          , Mm          , Wwf         , Chw         , Rd          , Uu^Vud      , Uu          , Ur          , Uu^Uf       , Ur          , Gs^Fp       , Xu          , Rd          , Gg          , Wwf         , Gg          , Gg          , Gg^Ve       , Gg^Fet      , Wwf         , Gs^Fp       , Ww          , Xu          
Wo          , Wo          , Ww          , Ww          , Ww          , Gg^Ve       , Wwf         , Gg^Fet      , Wwf         , Ggf         , Xu          , Uu          , Xu          , Uu^Uf       , Wwf         , Uh          , Xu          , Rd          , Gg          , Gg^Ve       , Kh          , Wwf         , Gg          , Gg          , Xu          , Wwf         , Wwf         , Xu          , Xu          
Wo          , Wo          , Ww          , Ww          , Gg          , Wwf         , Gg          , Wwf         , Xu          , Xu          , Gg          , Xu          , Gg          , Gg          , Ww          , Gg          , Gg          , Xu          , Gg          , Gg          , Ww          , Chw         , Ch          , Gg          , Xu          , Xu          , Uh          , Xu          , Xu          
Ww          , Ww          , Ww          , Gg          , Gg          , Gs^Fds      , Gg          , Rd          , Gg          , Gg          , Gg^Vc       , Gg          , Gs^Fms      , Ww          , Wo          , Ww          , Ww          , Gg          , Wwf         , Wwf         , Gg          , Ww          , Kh          , Gg          , Rd          , Gs^Fp       , Rd          , Xu          , Xu          
Ww          , Ww          , Gg          , Gg          , 1 Kh        , Gg          , Rd          , Rd          , Mm          , Gs^Fp       , Gg          , Gg          , Gg          , Ww          , Wo          , Wo          , Ww          , Wwf         , Kh          , Gs^Fms      , Ggf         , Gg          , Gg          , Gg          , Hh          , Rd          , Gg          , Xu          , Xu          
Ww          , Ww          , Ggf         , Gg          , Ch          , Ch          , Ggf         , Gg          , Gg          , Hh          , Gg          , Gs^Fp       , Ww          , Ww          , Ww          , Ww          , Wwf         , Ss^Vhs      , Kh          , Gg          , Hh          , Gs^Fds      , Gg          , Mm          , Gg          , Gg          , Ww          , Gg          , Gg          
Ww          , Gg          , Gg          , Rd          , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Hh          , Ww          , Wwf         , Wwf         , Rr          , Rr          , Chw         , Chw         , Wwf         , Gg          , Gg          , Gg          , Wwf         , Gg          , Wwf         , Gs^Fp       , Ww          , Ww          , Ww          
Ww          , Wwf         , Wwf         , Wwf         , Wwf         , Ch          , Kh          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Chw         , Wwf         , Rr          , Wwf         , Wwf         , Wwf         , Gs^Fp       , Wwf         , Wwf         , Wwf         , 2 Kud       , Wwf         , Gg          , Wwf         , Ww          , Wo          , Wo          
Gs^Fds      , Gs^Fms      , Hh          , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Gg          , Wwf         , Kh          , Chw         , Wwf         , Rr          , Mm          , Wwf         , Ww          , Ww          , Gg          , Gg          , Hh          , Gg          , Gg          , Cud         , Cud         , Gg          , Gg          , Ww          , Xu          
Rd          , Rd          , Rd          , Gg          , Rd          , Gg          , Gs^Fp       , Mm          , Hh          , Gg          , Kh          , Ss^Vhs      , Ww          , Ww          , Wo          , Ww          , Ww          , Ww          , Gg          , Gg          , Gg          , Mm          , Gg          , Kud         , Cud         , Rd          , Gg          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Rd          , Rd          , Rd          , Rd          , Gg          , Gg          , Wwf         , Wwf         , Ww          , Ww          , Ww          , Ww          , Ww          , Gs^Fms      , Ggf         , Gg^Ve       , Gs^Fds      , Gg          , Cud         , Cud         , Gg          , Rd          , Xu          , Xu          , Xu          
Xu          , Xu          , Uu^Uf       , Uu^Uf       , Uh          , Gg          , Kud         , Gg          , Wwf         , Wwf         , Xu          , Ww          , Hh          , Gs^Fp       , Gs^Fp       , Hh          , Ww          , Gg          , Hh          , Hh          , Xu          , Rd          , Rd          , Gg          , Rd          , Rd          , Gg          , Uu^Uf       , Uu^Uf       
Xu          , Xu          , Cud         , Wwf         , Xu          , Xu          , Wwf         , Cud         , Kud         , Xu          , Xu          , Xu          , Xu          , Cud         , Xu          , Cud         , Xu          , Xu          , Xu          , Xu          , Gs^Fp       , Gg          , Rd          , Rd          , Gg          , Gg          , Gs^Fp       , Xu          , Xu          
Xu          , Xu          , Cud         , Wwf         , Wwf         , Ww          , Gg          , Cud         , Rd          , Rd          , Uu^Vu       , Ur          , Uu^Uf       , Wwf^Uf      , Xu          , Wwf^Uf      , Uu^Uf       , Ur          , Uu^Vu       , Rd          , Rd          , Gg          , Rd          , Gg          , Uu^Vud      , Uu^Uf       , Cud         , Xu          , Xu          
Wwf         , Wwf         , Wwf         , Wwf         , Gs^Fp       , Gg^Vc       , Rd          , Rd          , Xu          , Ur          , Ur          , Uh          , Uh          , Wwf         , Wwf         , Wwf         , Uh          , Uh          , Ur          , Ur          , Xu          , Rd          , Gg          , Gg          , Gg          , Ur          , Cud         , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Gg          , Ggf         , Mm          , Rd          , Rd          , Xu          , Rd          , Xu          , Wwf         , Wwf         , Ggf         , Wwf         , Wwf         , Xu          , Rd          , Xu          , Rd          , Rd          , Kud         , Gg          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Hh          , Gs^Fp       , Gg          , Gg          , Rd          , Gg          , Gg          , Wwf         , Mm          , Gs^Fp       , Hh          , Gg          , Wwf         , Gg          , Rd          , Gg          , Cud         , Cud         , Cud         , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Rd^Uf       , Gg          , Gs^Fms      , Gg^Ve       , Gg          , Wwf         , Gg          , Gg          , Gg          , Gs^Fms      , Gg          , Wwf         , Gg          , Gg^Ve       , Gs^Fds      , Rd          , Rd^Uf       , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Ur          , Xu          , Xu          , Ggf         , Gg          , Wwf         , Gg          , Hh          , Gg          , Mm          , Hh          , Wwf         , Wwf         , Ggf         , Xu          , Xu          , Ur          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Ur          , Xu          , Rr          , Xu          , Wwf         , Wwf         , Gs^Fp       , Gg          , Xu          , Gg          , Gg          , Gg          , Wwf         , Xu          , Xu          , Ur          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Rr          , Wwf         , Chw         , Wwf         , Rr          , Ur          , Xu          , Uu^Uf       , Xu          , Ur          , Gs^Fp       , Rr          , Wwf         , Wwf         , Chw         , Wwf         , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Wwf         , Xu          , Xu          , Rr          , Rr          , Wwf         , Uh          , Wwf         , Uu^Uf       , Wwf         , Rr          , Rr          , Rr          , Rr          , Wwf         , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Wo          , Wwf         , Ur          , Wwf         , Wo          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Uh          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          , Xu          
"
	mp_countdown="yes"
	mp_countdown_action_bonus="20"
	mp_countdown_init_time="270"
	mp_countdown_reservoir_time="270"
	mp_countdown_turn_bonus="200"
	mp_fog="yes"
	mp_shroud="no"
	mp_use_map_settings="yes"
	mp_village_gold="2"
	name=_ "2p - Silverhead Crossing"
	next_underlying_unit_id="0"
#textdomain wesnoth
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	random_seed="1327609764"
	random_start_time="no"
	scenario="Ladder guest_ru vs KnightKunibert"
	turns="-1"
	version="1.6"
	[time]
		green="-20"
		id="dawn"
		image="misc/schedule-dawn.png"
		name=_ "Dawn"
		red="-20"
		sound="ambient/morning.ogg"
	[/time]
	[time]
		id="morning"
		image="misc/schedule-morning.png"
		lawful_bonus="25"
		name=_ "Morning"
	[/time]
	[time]
		id="afternoon"
		image="misc/schedule-afternoon.png"
		lawful_bonus="25"
		name=_ "Afternoon"
	[/time]
	[time]
		blue="-20"
		green="-20"
		id="dusk"
		image="misc/schedule-dusk.png"
		name=_ "Dusk"
		sound="ambient/night.ogg"
	[/time]
	[time]
		blue="-10"
		green="-40"
		id="first_watch"
		image="misc/schedule-firstwatch.png"
		lawful_bonus="-25"
		name=_ "First Watch"
		red="-40"
	[/time]
	[time]
		blue="-10"
		green="-40"
		id="second_watch"
		image="misc/schedule-secondwatch.png"
		lawful_bonus="-25"
		name=_ "Second Watch"
		red="-40"
	[/time]
	[music]
		ms_before="12000"
		name="knolls.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="wanderer.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="battle.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="transience.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="the_king_is_dead.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="knalgan_theme.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="the_city_falls.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="nunc_dimittis.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="revelation.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="loyalists.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="breaking_the_chains.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="elvish-theme.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="legends_of_the_north.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="traveling_minstrels.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="underground.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="vengeful.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="frantic.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="the_dangerous_symphony.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="heroes_rite.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="suspense.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="the_deep_path.ogg"
	[/music]
	[music]
		append="yes"
		ms_before="12000"
		name="siege_of_laurelmor.ogg"
	[/music]
	[event]
		name="prestart"
		[music]
			ms_before="12000"
			name="knolls.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="wanderer.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="battle.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="transience.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="revelation.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="loyalists.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="the_king_is_dead.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="knalgan_theme.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="the_city_falls.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="nunc_dimittis.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="breaking_the_chains.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="elvish-theme.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="legends_of_the_north.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="traveling_minstrels.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="underground.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="vengeful.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="frantic.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="the_dangerous_symphony.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="heroes_rite.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="suspense.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="the_deep_path.ogg"
		[/music]
		[music]
			append="yes"
			ms_before="12000"
			name="siege_of_laurelmor.ogg"
		[/music]
	[/event]
	[era]
		id="era_default"
#textdomain wesnoth-multiplayer
		name=_ "Default"
		[multiplayer_side]
			flag_rgb="magenta"
			id="Random"
			image="units/random-dice.png"
			name=_ "Random"
			random_faction="yes"
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Loyalists"
			image="units/human-loyalists/lieutenant.png"
			leader="Lieutenant,Swordsman,Pikeman,Javelineer,Shock Trooper,Longbowman,White Mage,Red Mage"
			name=_ "Loyalists"
			random_leader="Lieutenant,Swordsman,Pikeman,Javelineer,Longbowman,Red Mage"
			recruit="Cavalryman,Horseman,Spearman,Fencer,Heavy Infantryman,Bowman,Mage,Merman Fighter"
			terrain_liked="Gg, Ww, Wo"
			type="Lieutenant"
			[ai]
				recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Rebels"
			image="units/elves-wood/captain.png"
			leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose"
			name=_ "Rebels"
			random_leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,Red Mage"
			recruit="Elvish Fighter,Elvish Archer,Mage,Elvish Shaman,Elvish Scout,Wose,Merman Hunter"
			terrain_liked="Ff, Fa, Ss, Ww"
			type="Elvish Captain"
			[ai]
				recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,scout"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Northerners"
			image="units/orcs/warrior.png"
			leader="Orcish Warrior,Troll,Troll Rocklobber,Orcish Crossbowman,Orcish Slayer"
			name=_ "Northerners"
			recruit="Orcish Grunt,Troll Whelp,Wolf Rider,Orcish Archer,Orcish Assassin,Naga Fighter,Goblin Spearman"
			terrain_liked="Hh, Ha, Mm, Ss"
			type="Orcish Warrior"
			[ai]
				recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Undead"
			image="units/undead-necromancers/dark-sorcerer.png"
			leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage"
			name=_ "Undead"
			random_leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter"
			recruit="Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul"
			terrain_liked="Ss, Hh, Ha, Ww"
			type="Dark Sorcerer"
			[ai]
				recruitment_pattern="fighter,fighter,archer,fighter,scout,archer"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Knalgan Alliance"
			image="units/dwarves/steelclad.png"
			leader="Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper"
			name=_ "Knalgan Alliance"
			random_leader="Dwarvish Steelclad,Dwarvish Thunderguard,Rogue,Trapper"
			recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider"
			terrain_liked="Hh, Ha, Mm"
			type="Dwarvish Steelclad"
			[ai]
				recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[multiplayer_side]
			flag_rgb="magenta"
			id="Drakes"
			image="units/drakes/flare.png"
			leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior,Saurian Oracle,Saurian Soothsayer"
			name=_ "Drakes"
			random_leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior"
			recruit="Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur"
			terrain_liked="Hh, Ha, Ds, Ss"
			type="Drake Flare"
			[ai]
				recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
				[team_formula]
					rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[event]
			name="prestart"
			[store_unit]
				kill="yes"
				variable="leaders_to_make_quick"
				[filter]
					canrecruit="yes"
					[filter_wml]
						max_moves="4"
					[/filter_wml]
				[/filter]
			[/store_unit]
			[set_variable]
				name="i"
				value="0"
			[/set_variable]
			[while]
				[variable]
					less_than="$leaders_to_make_quick.length"
					name="i"
				[/variable]
				[do]
					[set_variables]
						mode="merge"
						name="leaders_to_make_quick[$i].modifications"
						[literal]
							[trait]
#textdomain wesnoth
								female_name=_ "female^quick"
								id="quick"
								male_name=_ "quick"
								[effect]
									apply_to="movement"
									increase="1"
								[/effect]
								[effect]
									apply_to="hitpoints"
									increase_total="-5%"
								[/effect]
							[/trait]
						[/literal]
					[/set_variables]
					[clear_variable]
						name="leaders_to_make_quick[$i].max_moves,leaders_to_make_quick[$i].moves,leaders_to_make_quick[$i].max_hitpoints,leaders_to_make_quick[$i].hitpoints"
					[/clear_variable]
					[unstore_unit]
						variable="leaders_to_make_quick[$i]"
					[/unstore_unit]
					[set_variable]
						add="1"
						name="i"
					[/set_variable]
				[/do]
			[/while]
			[clear_variable]
				name="i"
			[/clear_variable]
			[clear_variable]
				name="leaders_to_make_quick"
			[/clear_variable]
		[/event]
	[/era]
	[side]
		allow_changes="yes"
		allow_player="yes"
		canrecruit="yes"
		colour="1"
		controller="human"
		current_player="KnightKunibert"
		flag_rgb="magenta"
		fog="yes"
		gender="male"
		gold="100"
		id="KnightKunibert1"
		image="units/undead-necromancers/dark-sorcerer.png"
		income="0"
		leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage"
		mp_countdown="yes"
		mp_countdown_action_bonus="20"
		mp_countdown_init_time="270"
		mp_countdown_reservoir_time="270"
		mp_countdown_turn_bonus="200"
		name="KnightKunibert"
		random_leader="Dark Sorcerer,Revenant,Deathblade,Bone Shooter"
		recruit="Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul"
		save_id="KnightKunibert1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		team_name="west"
		terrain_liked="Ss, Hh, Ha, Ww"
		type="Dark Sorcerer"
		user_team_name="wesnoth-multiplayerteamname^West"
		village_gold="2"
		[ai]
			recruitment_pattern="fighter,fighter,archer,fighter,scout,archer"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
	[/side]
	[side]
		allow_changes="yes"
		allow_player="yes"
		canrecruit="yes"
		colour="2"
		controller="network"
		current_player="gest"
		flag_rgb="magenta"
		fog="yes"
		gender="male"
		gold="100"
		id="gest2"
		image="units/drakes/flare.png"
		income="0"
		leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior,Saurian Oracle,Saurian Soothsayer"
		mp_countdown="yes"
		mp_countdown_action_bonus="20"
		mp_countdown_init_time="270"
		mp_countdown_reservoir_time="270"
		mp_countdown_turn_bonus="200"
		name="gest"
		random_leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior"
		recruit="Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur"
		save_id="gest2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		team_name="east"
		terrain_liked="Hh, Ha, Ds, Ss"
		type="Drake Gladiator"
		user_team_name="wesnoth-multiplayerteamname^East"
		village_gold="2"
		[ai]
			recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

def sumarize_values( input_map )
	sum(
		values(input_map)
	);

def lowest_value( input_map )
	choose( input_map, -value ).value;

def highest_value( input_map )
	choose( input_map, value ).value;

def change_numbers_to_percents( input_map )
	map( input_map, 
		(value*100) / highest_value(input_map) 
	);

def add_number_to_values( input_map, number )
	map( input_map, 
		value + number 
	);

#make sure we have only positive values in a map #

def make_positive_only( input_map )
	if( lowest_value( input_map ) < 0, 
		add_number_to_values( 
			input_map, 
			abs(lowest_value(input_map))
		), 
		input_map 
	);

def sumarize_maps_values( map_A, map_B )
	map( map_A + map_B, 
		value + map_A[key]
	);

		#===== Evaluation how good unit is on a map ===== #

# ==1==  evaluate average defense #
#gives map where key is id of terrain, and value is number of hexes of that terrain on a gamemap#

def locations_map(ai*) 
	tomap( 
		map( 
			map.terrain, 
			id 
		) 
	);

#filters terrain map, min_percent it minimal % of map that terrain has to occupy to be considered in later evaluations# 

def filtered_locations_map(ai*, min_percent)
	filter( 
		locations_map(ai) , 
		value >  (map.w * map.h) / ( 100 / min_percent ) 
	);

#returns average defense of the unit #

def unit_average_defense(ai*, unit, terrain_min_percent )
	sum( 
		values( 
			map(
				filtered_locations_map(ai,terrain_min_percent), 
				defense_on( 
					unit, 
					find(map.terrain,id=key).loc
				) *
				value
			) 
		) 
	) / 
	sum(
		values(
			filtered_locations_map(
				ai,
				terrain_min_percent
			)
		)
	);

#returns map of units from units_list and their average defense (more -> better) #

def map_units_average_defense(ai*, units_list, terrain_min_percent) 
	tomap(
		map( 
			units_list, 
			id 
		), 
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	);

def units_average_defense(ai*, units_list, terrain_min_percent)
	sum(
		map( 
			units_list, 'unit', 
			unit_average_defense(
				ai, 
				unit, 
				terrain_min_percent 
			) 
		) 
	) /
	size(
		units_list
	);


# ==2== TODO: evaluate unit effectivness based on movement points and movement cost#


		#===== Evaluation of game state - how good is ai doing ===== #

# ==1== based on unit cost and current amount of gold #
# returns number between 0 and 100 where: 0 we are losing, 100 we are winning #

def units_cost_gold_eval(ai*)
	min(
		[
			(
				(
					sum(
						map(
							allies, 'team', 
							sum(
								map(
									units_of_side[team], 
									cost
								)
							) + 
							teams[team].gold 
						)
					) * 
					100
				) / 
				sum(
					map(
						enemies, 'team', 
						sum(
							map(
								units_of_side[team], 
								cost
							)
						) + 
						max(
							[teams[team].gold, 0]
						) 
					)
				)
			) / 2,
			100
		]
	);

# ==2== based on village possession #

def count_allied_villages(ai*)
	sum(
		map(
			allies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

def count_enemy_villages(ai*)
	sum(
		map(
			enemies, 'side', 
			size(
				villages_of_side[side]
			)
		)
	);

# multipled by 1000 to increase precision #

def village_evaluation(ai*)
	(
		50000 + 
		(
			count_allied_villages(ai) - 
			count_enemy_villages(ai)
		) * 
		(
			50000 /
			size(
				villages
			)
		)
	) /
	1000;

# ==3== combined 2 of the above #

def eval(ai*)
	( 
		units_cost_gold_eval(ai) + 
		village_evaluation(ai)
	) / 
	2;

		#===== Evaluation how effective my units are against the enemy ===== #

#==1==  basic evaluation #

# evaluate how much damage unit can inflict - how much damage unit can get#

def evaluate_attacker_against_opponents(ai*, unit, enemy_units)
	sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( unit, enemy_unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				) 
			)
		)
	);

def evaluate_defender_against_opponents(ai*, unit, enemy_units)
	-sum( 
		map( 
			enemy_units, 'enemy_unit', 
			sum(
				map(
					[
						max_possible_damage_with_retaliation( enemy_unit, unit )
					],
					max(
						[
							self[0] - self[2],
							self[1] - self[3]
						]
					)
				)
			)
		)
	);

def units_hp_map(ai*, units)
	tomap( 
		map(
			units, 
			id
		), 
		map( 
			units, 
			hitpoints
		)
	);

#in case side's gold is more than 50, add units that side can recruit to the side's unit list#

def create_side_unit_list(ai*, side)
	if( 
		teams[side].gold > 50, 
		recruits_of_side[side], 
		[]
	) + 
	units_of_side[side];

def evaluate_my_recruits_as_attackers(ai*)
	tomap( 
		map(
			my_recruits, 
			id
		), 
		map(
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_attacker_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai, 
							enemy_side
						)
					)
				)
			)
		)
	);

def evaluate_my_recruits_as_defenders(ai*)
	tomap(
		map(
			my_recruits, 
			id
		),
		map( 
			my_recruits, 'my_unit',
			sum(
				map(
					enemies, 'enemy_side',
					evaluate_defender_against_opponents(
						ai,
						my_unit,
						create_side_unit_list(
							ai,
							enemy_side
						)
					)
				)
			)
		)
	);


# === 2 ===  now consider abilities and weapon specials  #

def abilities_weights()
	['skirmisher' -> 15, 'ambush' -> 10, 'nightstalk' -> 20, 'regenerates' -> 20, 'healing' -> 15, 'curing' -> 10, 'leadership' -> 20, 'illumination' -> 15, 'teleport' -> 10, 'steadfast' -> 15 ];

def weapon_specials_weights()
	[ 'backstab' -> 20 ,'slow' -> 10 ,'berserk' -> 20 ,'stones' -> 60 ,'plague' -> 10 ,'marksman' -> 30 ,'magical' -> 40 ,'charge' -> 30 ,'drains' -> 30,  'firststrike' -> 10, 'poison' -> 25 ];

def apply_abilities_weights( units_map )
	map( 
		units_map, 
		value +
		(
			value * 
			max(
				map(
					get_unit_type( key ).abilities, 'ability',
					abilities_weights()[ability]
				)
			)
		) / 100
	);

def apply_weapon_specials_weights( units_map )
	map(
		units_map, 
		value +
		(
			value *
			max(
				map(
					get_unit_type( key ).attacks, 'attack',
					vars.weapon_specials[attack.special]
				)
			)
		) / 100
	);

# since undead units don't get random traits and are balanced with that, we need to lower their evaluation a bit to match fairly the living units #

def undead_malus( units_map )
	map( 
		units_map, 
		if(
			get_unit_type(key).undead,
			( value * 90 ) / 100,
			value 
		)
	);

# === 3 ===  pit 1 and 2 together  #

def evaluate_attackers(ai*)
	change_numbers_to_percents(
		apply_abilities_weights(
			apply_weapon_specials_weights(
				undead_malus( 
					make_positive_only(
						evaluate_my_recruits_as_attackers( ai )	
					)
				)
			)
		)
	);

def evaluate_defenders(ai*)
	map(
		map(
			change_numbers_to_percents(
				apply_abilities_weights(
					apply_weapon_specials_weights(
						undead_malus( 
							make_positive_only(
								evaluate_my_recruits_as_defenders( ai )	
							)
						)
					)
				)
			),
			value / 3
		), 
		value +
		map(
			change_numbers_to_percents(
				units_hp_map(
					ai,
					my_recruits
				)
			),
		value * 2 / 3
		)[key]
	);

	#=========== we have evaluation of game state and units, time to combine them: ==========#
		#=========	recruitment_list_builder	=========#

def rlb_apply_eval(eval, attackers_map, defenders_map, offset)
	map(
		sumarize_maps_values(
			map(
				attackers_map, 
				value * (eval+offset)
			),
			map(
				defenders_map,
				value * ( (100 - eval) - offset )
			)
		),
		value / 100
	);

def rlb_remove_lowest( input_map, percent)
	filter(
		input_map, 
		value > 
		(
			(
				percent * sumarize_values(input_map)
			) / 100
		)
	);

def rlb_first_step(eval, attackers_map, defenders_map, offset)
	rlb_remove_lowest(
		rlb_apply_eval(
			eval,
			attackers_map,
			defenders_map,
			offset
		),
		10
	);

def recruitment_list_builder(eval, attackers_map, defenders_map)
	map(
		rlb_first_step(
			eval,
			attackers_map,
			defenders_map,
			40
		),
		(
			(
				value * 100
			) / 
			sumarize_values(
				rlb_first_step(
					eval,
					attackers_map,
					defenders_map,
					40
				)
			)
		)
	);

		# ========== choose the unit to recruit now ========= #

def unit_chooser(ai*,unit_map) 
	choose(
		keys(unit_map), 'unit_type',
		unit_map[unit_type] - 
		(
			(
				100 * 
				size(
					filter(
						my_units, 
						type = unit_type
					)
				)
			) / 
			size(my_units)
		)
	);

def unit_map_cost_filter(ai*, unit_map)
	filter( unit_map,
		get_unit_type(key).cost < my_side.gold
	);

		# ==========	Main formula section 	========== #

def initialize_weapon_specials_map(ai*)
	if(vars.weapon_specials_init != turn,
		[
			set_var('weapon_specials_init', turn),
			set_var('weapon_specials',
				map(
					weapon_specials_weights(),
					if( key = 'magical',
						units_average_defense(ai, enemy_units, 10),
						if( key = 'marksman',
							units_average_defense(ai, enemy_units, 10) - 10,
							value
						)
					)
				)
			)
		],
		[]
	);

def create_recruits_map(ai*)
	if(vars.recruits_map_creator != turn,
		[
			set_var('recruits_map_creator', turn ),
			set_var('recruits_map',
				debug_print('final unit evaluation: ', recruitment_list_builder(
					debug_print('current AI evaluation (0-100): ', eval(ai)),
					debug_print('attackers evaluation: ',evaluate_attackers(ai)),
					debug_print('defenders evaluation: ',evaluate_defenders(ai))
				))
			)
		],
		[]
	);

def castle_space(ai*)
	filter( map( castle_locs( my_leader.loc ), 'location', if( unit_at( location ), 1, 0 ) ), self = 0  ).size;

if(vars.turn_initialized = turn,
		if( my_leader.loc = nearest_keep( my_leader.loc ),
			if( 
				get_unit_type(
					choose(
						vars.recruits_map,
						-get_unit_type(key).cost
					).key
				).cost <
				my_side.gold,
				if( castle_space(self),
					recruit(debug_print(
						unit_chooser(
							self,
							unit_map_cost_filter(
								self,
								vars.recruits_map
							)
						)
					)),
					fallback()
				),
				fallback() 
			),
			if( my_leader.movement_left > 0,
				move( my_leader.loc, nearest_keep( my_leader.loc ) ),
				fallback()
			)
		),
	[set_var(debug_print('turn_initialized'), turn)] +
	initialize_weapon_specials_map(self) +
	create_recruits_map(self)
)

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
	[/side]
[/replay_start]
[statistics]
	mid_scenario="yes"
	[scenario]
		scenario="2p - Silverhead Crossing"
		[team]
			[recruits]
				Dark Adept="8"
				Ghoul="1"
				Vampire Bat="2"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Dark Adept="2"
			[/deaths]
			[killed]
				Drake Burner="1"
				Drake Gladiator="1"
				Drake Glider="3"
				Saurian Skirmisher="4"
			[/killed]
			[attacks]
				[sequence]
					s01="1"
					s110="1"
					s111="1"
					_num="60"
				[/sequence]
				[sequence]
					s01="2"
					s1="5"
					s10="2"
					s11="8"
					s111="1"
					_num="70"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s="10"
					_num="0"
				[/sequence]
				[sequence]
					s101="1"
					_num="60"
				[/sequence]
			[/defends]
			recruit_cost="170"
			recall_cost="0"
			damage_inflicted="317"
			damage_taken="181"
			expected_damage_inflicted="274210"
			expected_damage_taken="190183"
			turn_damage_inflicted="21"
			turn_damage_taken="0"
			turn_expected_damage_inflicted="18690"
			turn_expected_damage_taken="2265"
			save_id="KnightKunibert1"
		[/team]
		[team]
			[recruits]
				Drake Burner="1"
				Drake Glider="4"
				Saurian Skirmisher="6"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Drake Burner="1"
				Drake Gladiator="1"
				Drake Glider="3"
				Saurian Skirmisher="4"
			[/deaths]
			[killed]
				Dark Adept="2"
			[/killed]
			[attacks]
				[sequence]
					s00="1"
					s1101="1"
					_num="40"
				[/sequence]
				[sequence]
					s101="1"
					s1011="1"
					_num="50"
				[/sequence]
				[sequence]
					s001="1"
					s01="2"
					s010="1"
					s0100="1"
					s10="1"
					s11110="1"
					_num="60"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s="2"
					_num="0"
				[/sequence]
				[sequence]
					s="2"
					s0="1"
					s00="1"
					s0011="1"
					s1110="1"
					_num="40"
				[/sequence]
				[sequence]
					s="1"
					s0="1"
					s01="1"
					s10="1"
					s111="1"
					_num="50"
				[/sequence]
				[sequence]
					s="1"
					s01="1"
					s011="1"
					s0110="1"
					s1="2"
					s101="1"
					s110="1"
					_num="60"
				[/sequence]
			[/defends]
			recruit_cost="175"
			recall_cost="0"
			damage_inflicted="181"
			damage_taken="317"
			expected_damage_inflicted="190183"
			expected_damage_taken="274210"
			turn_damage_inflicted="20"
			turn_damage_taken="21"
			turn_expected_damage_inflicted="33660"
			turn_expected_damage_taken="18690"
			save_id="gest2"
		[/team]
	[/scenario]
[/statistics]
