label="2p - Weldyn Channel Turn 7_ardesh"
version="1.6"
completion="victory"
campaign_type="multiplayer"
difficulty="NORMAL"
random_seed="1939481501"
random_calls="0"
next_underlying_unit_id="17"
end_text_duration="0"
[variables]
[/variables]
[replay]
	[command]
		[start]
		[/start]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="batle has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Aslani has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="2"
			x="17"
			y="4"
		[/recruit]
		[random]
			value="1581427566"
		[/random]
		[random]
			value="1341067129"
		[/random]
		[random]
			value="1851973091"
		[/random]
		[random]
			value="32625715"
		[/random]
		[random]
			value="1539684553"
		[/random]
		[random]
			value="1316869558"
		[/random]
		[random]
			value="1860293213"
		[/random]
		[random]
			value="1889368876"
		[/random]
		[random]
			value="183650576"
		[/random]
		[random]
			value="1429719019"
		[/random]
		[random]
			value="797130974"
		[/random]
		[random]
			value="926177908"
		[/random]
		[random]
			value="983369531"
		[/random]
		[random]
			value="53802679"
		[/random]
		[random]
			value="792737931"
			[results]
				checksum="dyxuTOJUoJO8HNrG4rKqKKyCcwwqoNtRxBzMHwQmPyQBpPAuOCIG6zNHsCQFqzuGzwKqqyuyKqqQ5RBJTuEm3frBwnBwBICTrpKGHCIsunwtfvIWc<MGO<7LH5>f.208"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="switch to german?"
			side="2"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="4"
			x="16"
			y="3"
		[/recruit]
		[random]
			value="609960451"
		[/random]
		[random]
			value="1079886379"
		[/random]
		[random]
			value="2023859507"
		[/random]
		[random]
			value="211925206"
		[/random]
		[random]
			value="2114682829"
		[/random]
		[random]
			value="1896193169"
		[/random]
		[random]
			value="1707431580"
		[/random]
		[random]
			value="1570690829"
		[/random]
		[random]
			value="1330137088"
		[/random]
		[random]
			value="901015061"
		[/random]
		[random]
			value="1275180272"
		[/random]
		[random]
			value="1362762803"
		[/random]
		[random]
			value="293215966"
		[/random]
		[random]
			value="444566182"
		[/random]
		[random]
			value="1075572368"
			[results]
				checksum="4zf1OSw,C7F>rbJjCs8AZ92.m<LzFBEHnuR73QRpoMa2r4.k-cpOaw87,.Y8Z.5ndaB-kwWvSlbAfbufC3iaj7hobd->Zhetk<>2fa5>ai01-b1+6Z+40CN5c8b.>X,4"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="5"
			x="15"
			y="4"
		[/recruit]
		[random]
			value="2098083241"
		[/random]
		[random]
			value="248146078"
		[/random]
		[random]
			value="1536609744"
		[/random]
		[random]
			value="689698052"
		[/random]
		[random]
			value="1514242764"
		[/random]
		[random]
			value="2146570195"
		[/random]
		[random]
			value="1769584431"
		[/random]
		[random]
			value="1390618623"
		[/random]
		[random]
			value="211011753"
		[/random]
		[random]
			value="1736783612"
		[/random]
		[random]
			value="1139328145"
		[/random]
		[random]
			value="1918443333"
		[/random]
		[random]
			value="1159990793"
		[/random]
		[random]
			value="321981585"
		[/random]
		[random]
			value="671974746"
			[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"
		[speak]
			id="server"
			message="Morpheus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="jim19901228 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="1"
			x="13"
			y="4"
		[/recruit]
		[random]
			value="133395476"
		[/random]
		[random]
			value="1526878742"
		[/random]
		[random]
			value="995380413"
		[/random]
		[random]
			value="83995069"
		[/random]
		[random]
			value="1775024821"
		[/random]
		[random]
			value="384506509"
		[/random]
		[random]
			value="773693121"
		[/random]
		[random]
			value="1141783937"
		[/random]
		[random]
			value="383593056"
		[/random]
		[random]
			value="395793904"
		[/random]
		[random]
			value="384918913"
		[/random]
		[random]
			value="594604809"
		[/random]
		[random]
			value="2132577516"
		[/random]
		[random]
			value="1524247058"
		[/random]
		[random]
			value="365564494"
			[results]
				checksum="KzLvyin74-,speaEvE02ij,1f-H<ltHpHl.4.Zv+KOuxJJEBpQwGOLzIDBBrtvLGpNIMjJxOsDGJKEAIFmsFKnyPOywu3tJHxVzEnyVqOuyLwrBF>8AJxGsqutBjv5-V"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="syskeop has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="4"
			x="14"
			y="3"
		[/recruit]
		[random]
			value="855538213"
		[/random]
		[random]
			value="1378012391"
		[/random]
		[random]
			value="819479690"
		[/random]
		[random]
			value="540578641"
		[/random]
		[random]
			value="2145393769"
		[/random]
		[random]
			value="983814160"
		[/random]
		[random]
			value="1111653917"
		[/random]
		[random]
			value="964940450"
		[/random]
		[random]
			value="1117209637"
		[/random]
		[random]
			value="491049012"
		[/random]
		[random]
			value="1960320863"
		[/random]
		[random]
			value="1201204706"
		[/random]
		[random]
			value="118590185"
		[/random]
		[random]
			value="197343725"
		[/random]
		[random]
			value="1974897828"
			[results]
				checksum="3Cf1OSv,C7F>rbJjHs8AZ92.m<KzFBEHnuR73QRpoMa2r4.k-cpOaw87,.Y8Z.5ndaB-kwWvSlbAfbufC3iaj7hobd->Zheok<>2fa5>ai01-b1+6Z+40CN5c8b.>X,4"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="5"
			x="15"
			y="2"
		[/recruit]
		[random]
			value="720801440"
		[/random]
		[random]
			value="431161678"
		[/random]
		[random]
			value="638675047"
		[/random]
		[random]
			value="2104290823"
		[/random]
		[random]
			value="286407984"
		[/random]
		[random]
			value="656217079"
		[/random]
		[random]
			value="1953129666"
		[/random]
		[random]
			value="1141946198"
		[/random]
		[random]
			value="2034229471"
		[/random]
		[random]
			value="625125709"
		[/random]
		[random]
			value="1682524839"
		[/random]
		[random]
			value="2032139592"
		[/random]
		[random]
			value="1608939869"
		[/random]
		[random]
			value="646695109"
		[/random]
		[random]
			value="849596394"
			[results]
				checksum="afk10b5br.kQp.+wk<Ab-239eel1N5llg71o3Xl17<1,5g7Z-k6kZlaGnZ68p4>gn6n3e1iafnb5+9fn4>73a+>+.57mc,6d1edjnNmi-f,a8gbj+B.awWJe+,PQ3hpQ"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="15,14,13,13,13"
			y="3,3,4,5,6"
		[/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="andycz has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ktoprzezyje has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="RNT_Brasil has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="6"
			x="17"
			y="19"
		[/recruit]
		[random]
			value="1888774247"
		[/random]
		[random]
			value="1179881314"
		[/random]
		[random]
			value="2015600484"
		[/random]
		[random]
			value="1474061603"
		[/random]
		[random]
			value="1242510989"
		[/random]
		[random]
			value="564618040"
		[/random]
		[random]
			value="2023585451"
		[/random]
		[random]
			value="595494284"
		[/random]
		[random]
			value="365087036"
		[/random]
		[random]
			value="545574499"
		[/random]
		[random]
			value="203010052"
		[/random]
		[random]
			value="251992440"
		[/random]
		[random]
			value="1439954627"
			[results]
				checksum="DTLTPwRQczAcRKLLbq0Mv5QyqrQOOBLOyBMIwFivztGUowQpTBRsw,0zs3P8rB49xHwm.opR7jouswcn.Adz9fQtQo8c1O8LyzFARPPnDHfaE>8vfLObeidgl03fnU6<"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="16"
			y="19"
		[/recruit]
		[random]
			value="1895792073"
		[/random]
		[random]
			value="1610259424"
		[/random]
		[random]
			value="998895577"
		[/random]
		[random]
			value="953768325"
		[/random]
		[random]
			value="1351550024"
		[/random]
		[random]
			value="31293243"
		[/random]
		[random]
			value="821885161"
		[/random]
		[random]
			value="678127979"
		[/random]
		[random]
			value="1273804233"
		[/random]
		[random]
			value="1386503201"
		[/random]
		[random]
			value="554229782"
		[/random]
		[random]
			value="1869298517"
		[/random]
		[random]
			value="1751590237"
		[/random]
		[random]
			value="1099804282"
		[/random]
		[random]
			value="2072308569"
			[results]
				checksum="ACIByNSVYrLXPemyRXKCwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9CumVnpCouMKPBb5TJGPbmz3o>.fjcflW4p97m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Hellscream has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="15"
			y="19"
		[/recruit]
		[random]
			value="494002880"
		[/random]
		[random]
			value="245375229"
		[/random]
		[random]
			value="188667063"
		[/random]
		[random]
			value="2107156468"
		[/random]
		[random]
			value="403028100"
		[/random]
		[random]
			value="387919929"
		[/random]
		[random]
			value="942987259"
		[/random]
		[random]
			value="151336525"
		[/random]
		[random]
			value="1998179354"
		[/random]
		[random]
			value="1941882836"
		[/random]
		[random]
			value="1105104850"
		[/random]
		[random]
			value="1202245730"
		[/random]
		[random]
			value="1973176079"
		[/random]
		[random]
			value="1926990011"
		[/random]
		[random]
			value="1880373709"
			[results]
				checksum="tjfpy66<OvHAptKKQ0oOBBSqxDYSGUuIaHzsLFtQzOWOCBvyFBUsQPVHTIwPFmPFBqCnEs<sBULDPTGRPzPuVKDJsNyMIn,RFNPGrGqf<xPrTryODoP.K+zDJqnmswJN"
			[/results]
		[/random]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="kein Problem :-). Viel Spass !"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="15"
			y="21"
		[/recruit]
		[random]
			value="567703360"
		[/random]
		[random]
			value="1482991611"
		[/random]
		[random]
			value="245974888"
		[/random]
		[random]
			value="813078590"
		[/random]
		[random]
			value="1671658674"
		[/random]
		[random]
			value="205647708"
		[/random]
		[random]
			value="1216106690"
		[/random]
		[random]
			value="2059578604"
		[/random]
		[random]
			value="1148634967"
		[/random]
		[random]
			value="1367443215"
		[/random]
		[random]
			value="1910274310"
		[/random]
		[random]
			value="943034155"
		[/random]
		[random]
			value="325064418"
		[/random]
		[random]
			value="965036392"
		[/random]
		[random]
			value="768726587"
			[results]
				checksum="lxj+sAh20PB1UmsQ56tLoxNPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw-JnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8EE25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="danke.. dir auch :)="
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="13"
			y="19"
		[/recruit]
		[random]
			value="1281656925"
		[/random]
		[random]
			value="330562725"
		[/random]
		[random]
			value="1209146641"
		[/random]
		[random]
			value="350279967"
		[/random]
		[random]
			value="242657681"
		[/random]
		[random]
			value="210297961"
		[/random]
		[random]
			value="1717723183"
		[/random]
		[random]
			value="5448343"
		[/random]
		[random]
			value="1153332116"
		[/random]
		[random]
			value="2042787601"
		[/random]
		[random]
			value="970484735"
		[/random]
		[random]
			value="1922058703"
		[/random]
		[random]
			value="2147358382"
		[/random]
		[random]
			value="1668411188"
		[/random]
		[random]
			value="1642798307"
			[results]
				checksum="ACIByNSVYyLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9vumVnpCouMKPBb5tJGPbmz3o>.fjcflW4pf7m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dragon2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="14"
			y="19"
		[/recruit]
		[random]
			value="956116439"
		[/random]
		[random]
			value="1075695902"
		[/random]
		[random]
			value="154703684"
		[/random]
		[random]
			value="90289716"
		[/random]
		[random]
			value="1406258627"
		[/random]
		[random]
			value="1363850325"
		[/random]
		[random]
			value="440569684"
		[/random]
		[random]
			value="1648916308"
		[/random]
		[random]
			value="1574148286"
		[/random]
		[random]
			value="10809219"
		[/random]
		[random]
			value="1654364651"
		[/random]
		[random]
			value="579996755"
		[/random]
		[random]
			value="2053596820"
		[/random]
		[random]
			value="477365738"
		[/random]
		[random]
			value="354571810"
			[results]
				checksum="DB3s-,zQn1M2yLMrtl,yvEJs+TqLAH7qSCNCNSvmIJ>KNGxwmIQwSVVvQLyBGFwuCzBR9PMVRCroPzMEKTmSKvvPnFtw+MnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8EE"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,16,17,17,17"
			y="20,19,19,18,17"
		[/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="13,12,11,10,9,8,7"
			y="4,3,3,2,2,2,2"
		[/move]
	[/command]
	[command]
		[move]
			x="14,15,16,17,18,19,20,21"
			y="3,3,3,4,4,5,5,6"
		[/move]
	[/command]
	[command]
		[move]
			x="15,16,17,18,18,19"
			y="4,4,5,5,6,7"
		[/move]
	[/command]
	[command]
		[move]
			x="16,17,18,19,20,21,22"
			y="3,4,4,5,5,5,5"
		[/move]
	[/command]
	[command]
		[move]
			x="17,18,19,19,20,21,22"
			y="4,4,5,6,6,7,7"
		[/move]
	[/command]
	[command]
		[move]
			x="15,15,16,17,18,19,20,21"
			y="2,3,3,4,4,5,4,5"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Vizel has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="13,13,13"
			y="6,5,4"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,18,19,20,21"
			y="19,19,20,19,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,17,18,19,20,21,21"
			y="19,19,18,18,17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,15,16,17,18,19,20"
			y="21,20,19,19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,17,17"
			y="17,18,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="14,13,12,11,10,9,8"
			y="19,19,18,18,17,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,14,13,12,12,11"
			y="19,18,18,17,16,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,12,11,10,9,8"
			y="19,18,19,19,19,18"
		[/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="7,7,7,7,7,7,6"
			y="2,3,4,5,6,7,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Hakkapeliitta has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Sturm has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="shian has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,22,22,23,24,24"
			y="6,5,4,4,3,2"
		[/move]
	[/command]
	[command]
		[move]
			x="22,23,23,24"
			y="5,6,7,7"
		[/move]
	[/command]
	[command]
		[move]
			x="22,22"
			y="7,8"
		[/move]
	[/command]
	[command]
		[move]
			x="22,22"
			y="8,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="groonan has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="nettes elo rating :D"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Malwin has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="22,22,23,23"
			y="9,10,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="23,23"
			y="12,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lela has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,20,21,21,21"
			y="7,7,8,9,10"
		[/move]
	[/command]
	[command]
		[move]
			x="21,22,22,22,22,23,23,24"
			y="5,5,6,7,8,9,10,10"
		[/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="sagt nicht viel aus :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="bist Du neu bei ladder ?"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ninjafrog has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23,24,25,26"
			y="16,15,15,15,15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,21,22"
			y="17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,23,24"
			y="16,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21,21,21,21"
			y="20,19,18,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,11,12,12,13,13,14"
			y="16,15,14,13,13,12,11"
		[/move]
	[/command]
	[command]
		undo="no"
		[label]
			colour="107,140,255,0"
			team_name="north"
			text="wose"
			visible_in_fog="yes"
			x="21"
			y="16"
		[/label]
	[/command]
	[command]
		sent="yes"
		[move]
			x="8,7,7,7,6"
			y="17,18,19,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="8,8,7,7,6"
			y="18,17,17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="japp :D"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="das ist mein 10tes spiel :D"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="und hatet davor n jahr oder so pause"
			side="2"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message=":-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="windowmaker has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,18,19,20,20"
			y="19,18,18,17,16"
		[/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="Blindman has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Thunderdraco has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,23,23,23,23"
			y="11,12,13,14,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="23"
				y="15"
			[/source]
			[destination]
				x="24"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="328843642"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="734254994"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="898901345"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="560841811"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="654741889"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="21,21,21,22,23,23,23,23"
			y="10,11,12,12,13,14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="23"
				y="16"
			[/source]
			[destination]
				x="24"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1744002017"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="302432612"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="63644576"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="18184800"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="876113067"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="121400255"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="24,24,24,24,24"
			y="10,11,12,13,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="24"
				y="14"
			[/source]
			[destination]
				x="24"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1994885882"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2005981078"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="790130664"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="194922556"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="244067930"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1141871820"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="24,24,24,24,24,24,24,24"
			y="2,3,4,5,6,7,8,9"
		[/move]
	[/command]
	[command]
		[move]
			x="24,24,23,23,23"
			y="7,8,9,10,11"
		[/move]
	[/command]
	[command]
		[recruit]
			value="4"
			x="17"
			y="4"
		[/recruit]
		[random]
			value="1733254981"
		[/random]
		[random]
			value="366172876"
		[/random]
		[random]
			value="840646309"
		[/random]
		[random]
			value="1149564349"
		[/random]
		[random]
			value="472840426"
		[/random]
		[random]
			value="1548926811"
		[/random]
		[random]
			value="21911233"
		[/random]
		[random]
			value="1796105051"
		[/random]
		[random]
			value="1714139252"
		[/random]
		[random]
			value="771250461"
		[/random]
		[random]
			value="1275917972"
		[/random]
		[random]
			value="1443272410"
		[/random]
		[random]
			value="948972278"
		[/random]
		[random]
			value="1129813874"
		[/random]
		[random]
			value="1596968519"
			[results]
				checksum="4zf1OSw,C7F>rbJjCs8AZ92.m<LzFBEHnuR73QRpoMa2r4.k-cpOaw87,.Y8Z.5ndaB-kwWvSlbAfbufC3iaj7hobd->Zhetk<>2fa5>ai01-b1+6Z+40CN5c8b.>X,4"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Basti_ has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,6"
			y="7,8"
		[/move]
	[/command]
	[command]
		[move]
			x="6,6"
			y="8,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Burp 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="Dauntless_ has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Cougar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,21,22,23,24,24"
			y="16,17,17,18,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="24"
				y="15"
			[/source]
			[destination]
				x="23"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1215261713"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1982507728"
			[results]
				chance="40"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="68131456"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1510239628"
			[results]
				chance="40"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1678539715"
			[results]
				chance="60"
				damage="6"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="RNT_Brasil has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="opan99 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="26,25"
			y="14,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="25"
				y="15"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1541506930"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="607787566"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1646900719"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="872605592"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1586069917"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="495867341"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="43645413"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="990791003"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Tree has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,6,6,6,6,5"
			y="20,19,18,17,16,16"
		[/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="23,24,24,25,26,26"
			y="11,11,12,13,13,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wing3r has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="26"
				y="14"
			[/source]
			[destination]
				x="25"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="686102833"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="359436769"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1659817183"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1620946416"
			[results]
				chance="40"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="569146186"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1163128383"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="24,24,24,24,25,25"
			y="9,10,11,12,13,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="25"
				y="14"
			[/source]
			[destination]
				x="25"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="932528642"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="361766861"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1370101655"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="308335511"
			[results]
				chance="40"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="497138470"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1874923925"
			[results]
				chance="40"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="24,24,24,24,24,24,24,24"
			y="14,13,12,11,10,9,8,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="kmad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,24"
			y="15,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="24"
				y="14"
			[/source]
			[destination]
				x="25"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1621478363"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1655125450"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="518132104"
			[results]
				chance="60"
				damage="6"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="gracz has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="17,18,19,20,21,22,22"
			y="4,4,5,5,6,6,7"
		[/move]
	[/command]
	[command]
		[recruit]
			value="5"
			x="17"
			y="4"
		[/recruit]
		[random]
			value="1040220191"
		[/random]
		[random]
			value="2081905743"
		[/random]
		[random]
			value="113035613"
		[/random]
		[random]
			value="252214834"
		[/random]
		[random]
			value="1799589436"
		[/random]
		[random]
			value="724344447"
		[/random]
		[random]
			value="1085687841"
		[/random]
		[random]
			value="1677295343"
		[/random]
		[random]
			value="262148826"
		[/random]
		[random]
			value="1836565768"
		[/random]
		[random]
			value="1063052086"
		[/random]
		[random]
			value="1545743884"
		[/random]
		[random]
			value="528215449"
		[/random]
		[random]
			value="1587323673"
		[/random]
		[random]
			value="1697612009"
			[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="Discosuperstar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="JustMe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="13,13,13,12"
			y="4,5,6,6"
		[/move]
	[/command]
	[command]
		[move]
			x="12,13,14"
			y="6,6,5"
		[/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="xEE has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="nitranka has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,23"
			y="16,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23"
			y="16,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="23"
				y="15"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="855637712"
			[results]
				chance="70"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="185246120"
			[results]
				chance="80"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1181377811"
			[results]
				chance="70"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="378125357"
			[results]
				chance="80"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="40281177"
			[results]
				chance="80"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="24"
				y="15"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1502013623"
			[results]
				chance="70"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1640394681"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1273159863"
			[results]
				chance="70"
				damage="8"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Manlight has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,24,24"
			y="16,15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="24"
				y="14"
			[/source]
			[destination]
				x="25"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1727992051"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1261848302"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="401985712"
			[results]
				chance="40"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1836454890"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="152082612"
			[results]
				chance="40"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1277470186"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="14,14"
			y="11,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="14,14,15,16,17,18,19"
			y="10,9,9,8,8,8,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="tmb_ayebe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="5,5,5,4"
			y="16,15,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,5,4,3,2"
			y="15,15,14,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,4"
			y="13,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,4"
			y="12,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Darkrai 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="gran has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="eassouth has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="25"
				y="14"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1330842477"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="204656283"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="886424081"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="896907794"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2087751131"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1948787409"
			[results]
				chance="40"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="xplorer has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="26,26,25,24"
			y="14,13,13,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="24"
				y="13"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1494862117"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="321071042"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="981873552"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1721965849"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="414723735"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="418937272"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Haribert09 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dauntless has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="doh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="22,22,22,22,23,23,24"
			y="7,8,9,10,11,12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Various has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="17,18,19,20,21,22,22,23"
			y="4,4,5,5,6,6,7,8"
		[/move]
	[/command]
	[command]
		[move]
			x="14,14,13"
			y="5,4,4"
		[/move]
	[/command]
	[command]
		[recruit]
			value="4"
			x="17"
			y="4"
		[/recruit]
		[random]
			value="884953733"
		[/random]
		[random]
			value="1548447289"
		[/random]
		[random]
			value="1653575555"
		[/random]
		[random]
			value="1184056908"
		[/random]
		[random]
			value="1717088621"
		[/random]
		[random]
			value="1790460371"
		[/random]
		[random]
			value="2042429409"
		[/random]
		[random]
			value="714699809"
		[/random]
		[random]
			value="1394689287"
		[/random]
		[random]
			value="2091926475"
		[/random]
		[random]
			value="1103488238"
		[/random]
		[random]
			value="1662547703"
		[/random]
		[random]
			value="877269649"
		[/random]
		[random]
			value="1668361480"
		[/random]
		[random]
			value="255993091"
			[results]
				checksum="4zf1OSv,C7F>rbJjGs8AZ92.m<LzFBEHnuR73QRpoMa2r4.k-cpOaw87,.Y8Z.5ndaB-kwWvSlbAfbufC3iaj7hobd->Zhepk<>2fa5>ai01-b1+6Z+40CN5c8b.>X,4"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="uc has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="24,24,24,24,24,24,25"
			y="7,8,9,10,11,12,13"
		[/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="noname has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,26"
			y="15,16,15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="26"
				y="14"
			[/source]
			[destination]
				x="25"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1144809614"
			[results]
				chance="40"
				damage="5"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[choose]
			value="0"
		[/choose]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Oink has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="RNT_Brasil has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Blaaatj has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,24,25,25"
			y="15,15,15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="25"
				y="14"
			[/source]
			[destination]
				x="25"
				y="13"
			[/destination]
		[/attack]
		[random]
			value="1425697608"
			[results]
				chance="40"
				damage="14"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Waaagh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="24"
				y="14"
			[/source]
			[destination]
				x="24"
				y="13"
			[/destination]
		[/attack]
		[random]
			value="2049355208"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1237377580"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1694188046"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="103628865"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1800176589"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1420589241"
			[results]
				chance="60"
				damage="8"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="geg_Ma3gau has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,20,21,22,23,24,24"
			y="9,9,9,9,10,10,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="24"
				y="11"
			[/source]
			[destination]
				x="24"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="1996183100"
			[results]
				chance="40"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1664339017"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="509705156"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1264615094"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1790109336"
			[results]
				chance="40"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="426278694"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="2,3,4,5,6"
			y="13,14,14,15,15"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="mutig :-)"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,4,4,5"
			y="13,14,15,16"
		[/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"
		undo="no"
		[speak]
			id="ardesh"
			message="ja :D"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="ich spiele meistens seehr riskant"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="24,23,22,22,23"
			y="12,13,13,14,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="23"
				y="15"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1213435689"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1040882961"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="963044536"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="413387206"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1659702025"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1322253820"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="erklärt auch warum ich so oft verliere"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,23,23,23,23,23,23"
			y="8,9,10,11,12,13,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="23"
				y="14"
			[/source]
			[destination]
				x="24"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="83557074"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="116943883"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="846626958"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="92512672"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1239237908"
			[results]
				chance="60"
				damage="4"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="ardesh"
			message="mist"
			side="2"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="KnightKunibert"
			message="ich auch :-) gg"
			side="1"
		[/speak]
	[/command]
[/replay]
[snapshot]
	campaign_type="multiplayer"
	completion="running"
	current_tod="0"
#textdomain wesnoth-multiplayer
	description=_ "This vital supply route has played a key role in many of Wesnoth's greatest battles."
	difficulty="NORMAL"
	end_text_duration="0"
	experience_modifier="70"
	hash="ni><w8>Ksy9E6lpej<-R7zqNgF0HH1GU14mLcPs+Y0>x<lui3JMr96tqaCJ+gLs7vdDsR,OV+p41UARdwDMp8w8hABAeHRqXh0zHL5LEGp<BJU2ovj4yzohfX.yffdE0"
	id="multiplayer_Weldyn_Channel"
	label="2p - Weldyn Channel"
	map_data="border_size=1
usage=map

Ss          , Hh          , Rp          , Ss          , Gs^Fp       , Hh          , Rp          , Rp          , Hh          , Ss          , Ss          , Gg          , Hh          , Hh          , Gs^Fms      , Ss          , Gg          , Hh          , Ww          , Ww          , Wo          , Wo          , Ww          , Wwf         , Hh          , Hh          , Hh          , Hh          , Ss          , Hh          , Hh          
Gg          , Gg^Fet      , Rp          , Mm          , Gs^Fp       , Ss          , Rp          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Mm          , Gs^Fp       , Gg          , Gs^Fds      , Hh          , Gs^Fp       , Hh          , Gg          , Ww          , Wo          , Wo          , Ww          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Mm          , Ss          , Mm          , Hh          , Gs^Fp       , Ss          
Gg          , Gg          , Gg          , Rp          , Rp          , Rp          , Gg          , Gg^Ve       , Gg          , Hh          , Gg          , Gg          , Re          , Gg          , Re          , Ch          , Mm          , Ww          , Wo          , Wo          , Ww          , Ww          , Mm          , Ss          , Ss^Vhs      , Hh          , Gs^Fp       , Hh          , Gs^Fms      , Gg^Fet      , Gg          
Gs^Fms      , Gg          , Gg          , Gg          , Rp          , Gg          , Gg          , Gg          , Re          , Mm          , Re          , Re          , Re          , Re          , Ch          , 1 Kh        , Ch          , Ww          , Ww          , Ww          , Gs^Fp       , Hh          , Hh          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Hh          , Gg          
Hh          , Gs^Fp       , Rp          , Rp          , Re^Uf       , Gs^Fds      , Re          , Re          , Gg          , Re          , Gg          , Gg          , Gg          , Kh          , Gg          , Ch          , Wwf         , Kh          , Ww^Bw\      , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re^Uf       , Mm          , Gg          , Gg          , Gg          , Gg          
Hh          , Hh          , Rp          , Mm          , Gs^Fp       , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww          , Ww          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg^Vh       , Gg          , Re          , Ss          , Hh          , Gs^Fp       , Re          , Gg          , Gg          
Gs^Fp       , Rp          , Mm          , Hh          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg^Uf       , Hh          , Hh          , Gg^Ve       , Ww          , Ww          , Ww          , Gg          , Ss          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Re^Uf       , Re          , Gg          , Gg          
Rp          , Rp          , Re          , Re          , Gg          , Gg          , Gg^Vh       , Gg          , Gg          , Gs^Fds      , Hh          , Mm          , Gg          , Gs^Fp       , Ww          , Wo          , Ww          , Gg          , Gs^Fp       , Ss^Vhs      , Ww          , Mm          , Hh          , Gg          , Gg^Ve       , Gs^Fms      , Gg          , Re          , Gg          , Gg          , Gg          
Gs^Fp       , Re          , Re          , Gg          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Ww          , Wwf         , Rp          , Gg          , Gg          , Gg          , Gg          , Gg          , Mm          , Gg^Uf       , Hh          
Gg          , Re          , Re          , Hh          , Ss          , Ggf^Uf      , Gg          , Gg          , Gs^Fms      , Ggf         , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Mm^Xm       , Wo          , Wo          , Wo          , Ww          , Wwf         , Wwf         , Rp          , Rp          , Gg          , Gs^Fp       , Hh          , Gg^Fet      , Hh          , Gg          
Wwf         , Gg          , Gg          , Gs^Fms      , Mm          , Hh          , Hh          , Gg          , Gg          , Mm          , Hh          , Ww          , Ww          , Wo          , Wo          , Hh          , Mm^Xm       , Wo          , Wo          , Wo          , Ww          , Gs^Fp       , Rp          , Wwf         , Wwf         , Gg          , Rp          , Rp          , Rp          , Gg          , Gg          
Rp          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Rp          , Gg          , Hh          , Ww          , Ww          , Wo          , Ww          , Wwr         , Mm^Xm       , Wwr         , Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Rp          , Wwf         , Rp          , Wwf         , Wwf         , Wwf         , Rp          , Rp          
Gg          , Rp          , Rp          , Wwf         , Rp          , Rp          , Wwf         , Rp          , Rp          , Gg          , Ww          , Ww          , Wo          , Wo          , Mm^Xm       , Mm^Xm       , Wo          , Ww          , Ww          , Ww          , Hh          , Hh          , Gg          , Rp          , Hh          , Wwf         , Mm          , Gg          , Gg          , Wwf         , Wwf         
Gs^Fds      , Gg          , Gg^Fet      , Rp          , Gs^Fms      , Gg          , Rp          , Wwf         , Wwf         , Gs^Fp       , Ww          , Wo          , Wo          , Wo          , Mm^Xm       , Hh          , Wo          , Wo          , Ww          , Ww          , Gg          , Mm          , Gs^Fms      , Gg          , Gg          , Hh          , Ss          , Gs^Fp       , Re          , Gg          , Gg          
Hh          , Hh          , Mm          , Hh          , Gg          , Gg          , Gg          , Rp          , Rp          , Wwf         , Ww          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Ggf         , Gg          , Gg          , Gg          , Ggf^Uf      , Gg^Fet      , Hh          , Re          , Re          , Gs^Fp       
Gs^Fds      , Ggf^Uf      , Gg          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Hh          , Wwf         , Ww          , Ww          , Gs^Fp       , Ww          , Ww          , Wo          , Ww          , Ww          , Gg          , Gg          , Hh          , Gg          , Gg          , Gg          , Gg^Vh       , Gg          , Gg          , Gg          , Re          , Re          , Rp          
Gg          , Gg          , Re          , Re          , Re          , Gs^Fms      , Gg          , Gg          , Gg          , Mm          , Gg          , Ss^Vhs      , Ss          , Gg          , Ww          , Wo          , Ww          , Gs^Fp       , Hh          , Mm          , Ggf^Uf      , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Mm          , Rp          , Gs^Fp       
Gg          , Gg          , Re          , Re^Uf       , Hh          , Re          , Re          , Gg          , Gg^Vh       , Gg          , Gg          , Gs^Fp       , Gg          , Gg          , Ww          , Ww          , Gg          , Gg^Ve       , Gg          , Hh          , Gg          , Gg          , Gg          , Gg          , Ggf         , Re          , Gs^Fds      , Hh          , Rp          , Rp          , Hh          
Gg          , Gg          , Gg          , Gs^Fp       , Mm          , Ss          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww^Bw\      , Wwf         , Wwf         , Ww          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Re^Uf       , Mm          , Rp          , Hh          , Hh          
Gg          , Gg          , Gg          , Gg          , Gg          , Re^Uf       , Gg          , Gg          , Hh          , Gg          , Gs^Fp       , Gg          , Ww          , Kh          , Ch          , Ch          , Ch          , Kh          , Gg          , Gg          , Re          , Re          , Re          , Re          , Gg          , Gs^Fp       , Rp          , Rp          , Gg          , Gs^Fms      , Gg          
Gs^Fds      , Gg          , Gs^Fp       , Gg          , Gs^Fp       , Gg          , Ss^Vhs      , Gs^Fp       , Mm          , Hh          , Ww          , Ww          , Wo          , Ww          , Mm          , 2 Kh        , Re          , Re          , Re          , Re          , Gg          , Gg^Ve       , Gg          , Gg          , Gg          , Gg          , Rp          , Gg          , Gg          , Gg          , Gg          
Ss          , Gg^Fet      , Ss          , Hh          , Mm          , Hh          , Gs^Fms      , Ss          , Gs^Fp       , Ww          , Wo          , Wo          , Ww          , Ww          , Hh          , Ch          , Gs^Fds      , Gg          , Gs^Fms      , Mm          , Gg^Fet      , Hh          , Mm          , Hh          , Rp          , Rp          , Gs^Fp       , Rp          , Rp          , Gg          , Gg          
Hh          , Hh          , Gs^Fms      , Gs^Fp       , Hh          , Ss          , Mm          , Gg^Fet      , Ww          , Ww          , Wo          , Wo          , Ww          , Hh          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Hh          , Mm          , Hh          , Gs^Fp       , Ss          , Hh          , Gs^Fp       , Rp          , Ss          , Ss          , Hh          , Mm          , Rp          , Gg          
Hh          , Gs^Fms      , Hh          , Ss          , Hh          , Hh          , Wwf         , Ww          , Wo          , Wo          , Ww          , Ww          , Hh          , Gg          , Hh          , Hh          , Ss          , Hh          , Hh          , Gs^Fms      , Ss          , Hh          , Rp          , Rp          , Gg          , Hh          , Hh          , Gs^Fp       , Ss          , Rp          , Hh          
"
	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 - Weldyn Channel"
	next_underlying_unit_id="17"
#textdomain wesnoth
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	playing_team="0"
	random_calls="1"
	random_seed="1939481501"
	random_start_time="no"
	snapshot="yes"
	turn_at="7"
	turns="-1"
	unit_wml_ids="Drake Clasher,Drake Fighter,Elvish Archer,Elvish Captain,Elvish Fighter,Elvish Ranger,Fire Drake,Merman Hunter,Saurian Augur,Saurian Skirmisher,Wose,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="245122"
		current_player="KnightKunibert"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
		gold="26"
		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="Drake Burner,Drake Clasher,Drake Fighter,Drake Glider,Saurian Augur,Saurian Skirmisher"
		recruitment_pattern="fighter,fighter,archer,healer,scout,scout"
		save_id="KnightKunibert1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		start_gold="100"
		team_name="north"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^North"
		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]
		[village]
			x="6"
			y="7"
		[/village]
		[village]
			x="7"
			y="2"
		[/village]
		[village]
			x="13"
			y="6"
		[/village]
		[village]
			x="19"
			y="7"
		[/village]
		[village]
			x="22"
			y="5"
		[/village]
		[village]
			x="24"
			y="2"
		[/village]
		[village]
			x="24"
			y="7"
		[/village]
		[unit]
			advances_to="Inferno Drake"
			alignment="lawful"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="35"
			current_player="KnightKunibert"
			die_sound="drake-die.ogg"
			experience="0"
			facing="nw"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="63"
			id="KnightKunibert1"
			image="units/drakes/fire.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Fire Drake"
			leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior,Saurian Oracle,Saurian Soothsayer"
			level="2"
			max_attacks="1"
			max_experience="56"
			max_hitpoints="63"
			max_moves="5"
			movement="5"
			movement_type="drakefly"
			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/drakes/burner.png"
			race="drake"
			random_leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior"
			random_traits="no"
			recruit="Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="north"
			terrain_liked="Hh, Ha, Ds, Ss"
			type="Fire Drake"
			undead_variation="drake"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			user_team_name="wesnoth-multiplayerteamname^North"
			village_gold="2"
			x="13"
			y="4"
			zoc="yes"
			[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="40"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="9"
				description=_ "claws"
				icon="attacks/claws-drake.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="7"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="5"
				range="ranged"
				type="fire"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Drake Gladiator,Drake Slasher"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="19"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="41"
			id="Drake Clasher-6"
			image="units/drakes/clasher.png"
			language_name=_ "Drake Clasher"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="41"
			max_moves="6"
			movement="5"
			movement_type="drakefoot"
			moves="6"
			name="Gaké"
			profile="portraits/drakes/clasher.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Drake Clasher"
			undead_variation="drake"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="6"
			y="7"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/clasher-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/clasher-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/clasher-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/clasher-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/clasher-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/clasher-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/clasher-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/clasher-die-8.png"
				[/frame]
				[frame]
					begin="1200"
					end="1350"
					image="units/drakes/clasher-die-9.png"
				[/frame]
				[frame]
					begin="1350"
					end="1500"
					image="units/drakes/clasher-die-10.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/clasher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/clasher-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/clasher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="70"
				deep_water="90"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="80"
				cold="150"
				fire="50"
				impact="70"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/scimitar.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="6"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
				[specials]
					[firststrike]
#textdomain wesnoth
						description=_ "First Strike:
This unit always strikes first with this attack, even if they are defending."
						id="firststrike"
						name=_ "firststrike"
					[/firststrike]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/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="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="3"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Augur-15"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Axisesz"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="15"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			x="23"
			y="15"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[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]
			[/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="16"
			facing="se"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="30"
			id="Saurian Skirmisher-16"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="30"
			max_moves="7"
			movement="6"
			movement_type="lizard"
			moves="7"
			name="Hezyx"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="23"
			y="14"
			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="4"
#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^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^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]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="23"
			id="Saurian Augur-17"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="23"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kez"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="17"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			x="17"
			y="4"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[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]
				[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="Inferno Drake"
			alignment="lawful"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="35"
			current_player="KnightKunibert"
			die_sound="drake-die.ogg"
			experience="0"
			facing="nw"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="63"
			id="KnightKunibert1"
			image="units/drakes/fire.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Fire Drake"
			leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior,Saurian Oracle,Saurian Soothsayer"
			level="2"
			max_attacks="1"
			max_experience="56"
			max_hitpoints="63"
			max_moves="5"
			movement="5"
			movement_type="drakefly"
			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/drakes/burner.png"
			race="drake"
			random_leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior"
			random_traits="no"
			recruit="Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="north"
			terrain_liked="Hh, Ha, Ds, Ss"
			type="Fire Drake"
			undead_variation="drake"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			user_team_name="wesnoth-multiplayerteamname^North"
			village_gold="2"
			zoc="yes"
			[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="40"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="9"
				description=_ "claws"
				icon="attacks/claws-drake.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="7"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="5"
				range="ranged"
				type="fire"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Drake Gladiator,Drake Slasher"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="19"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="41"
			id="Drake Clasher-6"
			image="units/drakes/clasher.png"
			language_name=_ "Drake Clasher"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="41"
			max_moves="6"
			movement="5"
			movement_type="drakefoot"
			moves="6"
			name="Gaké"
			profile="portraits/drakes/clasher.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Drake Clasher"
			undead_variation="drake"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/clasher-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/clasher-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/clasher-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/clasher-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/clasher-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/clasher-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/clasher-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/clasher-die-8.png"
				[/frame]
				[frame]
					begin="1200"
					end="1350"
					image="units/drakes/clasher-die-9.png"
				[/frame]
				[frame]
					begin="1350"
					end="1500"
					image="units/drakes/clasher-die-10.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/clasher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/clasher-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/clasher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="70"
				deep_water="90"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="80"
				cold="150"
				fire="50"
				impact="70"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/scimitar.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="6"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
				[specials]
					[firststrike]
#textdomain wesnoth
						description=_ "First Strike:
This unit always strikes first with this attack, even if they are defending."
						id="firststrike"
						name=_ "firststrike"
					[/firststrike]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/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="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="3"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Augur-15"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Axisesz"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="15"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[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]
			[/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="16"
			facing="se"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="30"
			id="Saurian Skirmisher-16"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="30"
			max_moves="7"
			movement="6"
			movement_type="lizard"
			moves="7"
			name="Hezyx"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="16"
			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="4"
#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^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^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]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="23"
			id="Saurian Augur-17"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="23"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kez"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="17"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[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]
				[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="7"
		aggression="0.5"
		allow_player="yes"
		caution="0.25"
		colour="2"
		controller="network"
		countdown_time="270000"
		current_player="ardesh"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,scout"
		gold="58"
		hidden="no"
		id="ardesh2"
		income="0"
		leader_value="3"
		name="ardesh"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives=_ "Victory:
@Defeat enemy leader(s)"
		objectives_changed="yes"
		recruit="Elvish Archer,Elvish Fighter,Elvish Scout,Elvish Shaman,Mage,Merman Hunter,Wose"
		recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,scout"
		save_id="ardesh2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		start_gold="100"
		team_name="south"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^South"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[ai]
			recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,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="Elder Wose"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="20"
			die_sound="wose-die.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="52"
			id="Wose-9"
			image="units/woses/wose.png"
#textdomain wesnoth-units
			language_name=_ "Wose"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="52"
			max_moves="4"
			movement="4"
			movement_type="treefolk"
			moves="4"
			name="Dronnongatum"
			race="wose"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Wose"
			undead_variation="wose"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="25"
			y="14"
			zoc="yes"
			[attack_anim]
				start_time="-500"
				[filter_attack]
					name="crush"
				[/filter_attack]
				[if]
					hits="yes"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-attack.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-miss.ogg"
					[/frame]
				[/else]
				[frame]
					duration="150"
					image="units/woses/wose-attack-2.png"
				[/frame]
				[frame]
					duration="75"
					image="units/woses/wose-attack-1.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[filter_attack]
					type="blade,impact,pierce"
				[/filter_attack]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-13.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-14.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-15.png"
				[/frame]
			[/death]
			[death]
				start_time="0"
				[filter_attack]
					type="arcane,fire,cold"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-8.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-9.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
						sound="wose-hit.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
			[/defend]
			[defense]
				castle="80"
				cave="80"
				deep_water="90"
				flat="80"
				forest="60"
				frozen="80"
				fungus="70"
				hills="70"
				impassable="80"
				mountains="70"
				reef="80"
				sand="80"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="80"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="100"
				cold="90"
				fire="150"
				impact="60"
				pierce="40"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
				[regenerate]
					affect_self="yes"
					description=_ "Regenerates:
The unit will heal itself 8 HP per turn. If it is poisoned, it will remove the poison instead of healing."
					female_name=_ "female^regenerates"
					id="regenerates"
					name=_ "regenerates"
					poison="cured"
					value="8"
				[/regenerate]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="13"
#textdomain wesnoth-units
				description=_ "crush"
				icon="attacks/crush-wose.png"
				name="crush"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Merman Spearman,Merman Netcaster"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="mermen-die.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Merman Hunter-11"
			image="units/merfolk/hunter.png"
			language_name=_ "Merman Hunter"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="7"
			movement="6"
			movement_type="swimmer"
			moves="7"
			name="Mimir"
			profile="portraits/merfolk/hunter.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Merman Hunter"
			undead_variation="swimmer"
			underlying_id="11"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			x="24"
			y="11"
			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/merfolk/hunter.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/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/merfolk/hunter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
						sound="mermen-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="80"
				deep_water="50"
				flat="70"
				forest="70"
				frozen="70"
				fungus="80"
				hills="70"
				impassable="80"
				mountains="80"
				reef="30"
				sand="70"
				shallow_water="40"
				swamp_water="40"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="1"
				flat="2"
				forest="5"
				frozen="2"
				fungus="3"
				hills="5"
				impassable="99"
				mountains="99"
				reef="2"
				sand="2"
				shallow_water="1"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="100"
				cold="80"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "spear"
				name="spear"
				number="2"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="5"
				description=_ "spear"
				name="spear"
				number="3"
				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^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="Elvish Avenger"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="41"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="42"
			id="Elvish Archer-12"
			image="units/elves-wood/ranger.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Ranger"
			level="2"
			max_attacks="1"
			max_experience="50"
			max_hitpoints="42"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Glálith"
			profile="portraits/elves/ranger.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Ranger"
			undead_variation="archer"
			underlying_id="12"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			x="26"
			y="14"
			zoc="yes"
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="60"
				shallow_water="70"
				swamp_water="60"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="2"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
			[/abilities]
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/ranger-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/ranger-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/ranger-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/ranger-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/elves-wood/ranger-sword-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/defend]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Captain,Elvish Hero"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="38"
			id="Elvish Fighter-13"
			image="units/elves-wood/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="38"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			moves="5"
			name="Tinolas"
			profile="portraits/elves/fighter.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Fighter"
			underlying_id="13"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="6"
			y="15"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/fighter-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/fighter-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/fighter-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-175"
					end="-100"
					image="units/elves-wood/fighter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/elves-wood/fighter-melee-2.png"
				[/frame]
				[frame]
					begin="150"
					end="175"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-2.png"
				[/frame]
				[frame]
					duration="125"
					image="units/elves-wood/fighter-idle-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-4.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-8.png"
				[/frame]
				[frame]
					duration="250"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-10.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-11.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-12.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="4"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="3"
				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^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="34"
			id="Elvish Archer-14"
			image="units/elves-wood/archer+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="34"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Calóng"
			profile="portraits/elves/archer+female.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="14"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="5"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer+female-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer+female-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer+female-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer+female-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer+female-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer+female-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-sword-defend.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/elves-wood/archer+female-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-bow-defend.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/elves-wood/archer+female-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="5"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					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="Elder Wose"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="20"
			die_sound="wose-die.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="52"
			id="Wose-9"
			image="units/woses/wose.png"
#textdomain wesnoth-units
			language_name=_ "Wose"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="52"
			max_moves="4"
			movement="4"
			movement_type="treefolk"
			moves="4"
			name="Dronnongatum"
			race="wose"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Wose"
			undead_variation="wose"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				start_time="-500"
				[filter_attack]
					name="crush"
				[/filter_attack]
				[if]
					hits="yes"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-attack.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-miss.ogg"
					[/frame]
				[/else]
				[frame]
					duration="150"
					image="units/woses/wose-attack-2.png"
				[/frame]
				[frame]
					duration="75"
					image="units/woses/wose-attack-1.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[filter_attack]
					type="blade,impact,pierce"
				[/filter_attack]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-13.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-14.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-15.png"
				[/frame]
			[/death]
			[death]
				start_time="0"
				[filter_attack]
					type="arcane,fire,cold"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-8.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-9.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
						sound="wose-hit.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
			[/defend]
			[defense]
				castle="80"
				cave="80"
				deep_water="90"
				flat="80"
				forest="60"
				frozen="80"
				fungus="70"
				hills="70"
				impassable="80"
				mountains="70"
				reef="80"
				sand="80"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="80"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="100"
				cold="90"
				fire="150"
				impact="60"
				pierce="40"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
				[regenerate]
					affect_self="yes"
					description=_ "Regenerates:
The unit will heal itself 8 HP per turn. If it is poisoned, it will remove the poison instead of healing."
					female_name=_ "female^regenerates"
					id="regenerates"
					name=_ "regenerates"
					poison="cured"
					value="8"
				[/regenerate]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="13"
#textdomain wesnoth-units
				description=_ "crush"
				icon="attacks/crush-wose.png"
				name="crush"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Merman Spearman,Merman Netcaster"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="mermen-die.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Merman Hunter-11"
			image="units/merfolk/hunter.png"
			language_name=_ "Merman Hunter"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="7"
			movement="6"
			movement_type="swimmer"
			moves="7"
			name="Mimir"
			profile="portraits/merfolk/hunter.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Merman Hunter"
			undead_variation="swimmer"
			underlying_id="11"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			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/merfolk/hunter.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/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/merfolk/hunter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
						sound="mermen-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="80"
				deep_water="50"
				flat="70"
				forest="70"
				frozen="70"
				fungus="80"
				hills="70"
				impassable="80"
				mountains="80"
				reef="30"
				sand="70"
				shallow_water="40"
				swamp_water="40"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="1"
				flat="2"
				forest="5"
				frozen="2"
				fungus="3"
				hills="5"
				impassable="99"
				mountains="99"
				reef="2"
				sand="2"
				shallow_water="1"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="100"
				cold="80"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "spear"
				name="spear"
				number="2"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="5"
				description=_ "spear"
				name="spear"
				number="3"
				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^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="Elvish Avenger"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="41"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="42"
			id="Elvish Archer-12"
			image="units/elves-wood/ranger.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Ranger"
			level="2"
			max_attacks="1"
			max_experience="50"
			max_hitpoints="42"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Glálith"
			profile="portraits/elves/ranger.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Ranger"
			undead_variation="archer"
			underlying_id="12"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			zoc="yes"
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="60"
				shallow_water="70"
				swamp_water="60"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="2"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
			[/abilities]
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/ranger-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/ranger-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/ranger-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/ranger-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/elves-wood/ranger-sword-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/defend]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Captain,Elvish Hero"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="38"
			id="Elvish Fighter-13"
			image="units/elves-wood/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="38"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			moves="5"
			name="Tinolas"
			profile="portraits/elves/fighter.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Fighter"
			underlying_id="13"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/fighter-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/fighter-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/fighter-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-175"
					end="-100"
					image="units/elves-wood/fighter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/elves-wood/fighter-melee-2.png"
				[/frame]
				[frame]
					begin="150"
					end="175"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-2.png"
				[/frame]
				[frame]
					duration="125"
					image="units/elves-wood/fighter-idle-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-4.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-8.png"
				[/frame]
				[frame]
					duration="250"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-10.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-11.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-12.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="4"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="3"
				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^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="34"
			id="Elvish Archer-14"
			image="units/elves-wood/archer+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="34"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Calóng"
			profile="portraits/elves/archer+female.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="14"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer+female-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer+female-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer+female-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer+female-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer+female-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer+female-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-sword-defend.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/elves-wood/archer+female-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-bow-defend.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/elves-wood/archer+female-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="5"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					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]
	[/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="4"
		side_number="1"
		turn_number="7"
	[/variables]
	[player]
		can_recruit="Drake Burner,Drake Clasher,Drake Fighter,Drake Glider,Saurian Augur,Saurian Skirmisher"
		gold="-1"
		gold_add="no"
		name="KnightKunibert"
		save_id="KnightKunibert1"
		[unit]
			advances_to="Inferno Drake"
			alignment="lawful"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="35"
			current_player="KnightKunibert"
			die_sound="drake-die.ogg"
			experience="0"
			facing="nw"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="63"
			id="KnightKunibert1"
			image="units/drakes/fire.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Fire Drake"
			leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior,Saurian Oracle,Saurian Soothsayer"
			level="2"
			max_attacks="1"
			max_experience="56"
			max_hitpoints="63"
			max_moves="5"
			movement="5"
			movement_type="drakefly"
			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/drakes/burner.png"
			race="drake"
			random_leader="Drake Flare,Fire Drake,Drake Slasher,Drake Gladiator,Drake Warrior"
			random_traits="no"
			recruit="Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur"
			resting="yes"
			save_id="KnightKunibert1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="north"
			terrain_liked="Hh, Ha, Ds, Ss"
			type="Fire Drake"
			undead_variation="drake"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			user_team_name="wesnoth-multiplayerteamname^North"
			village_gold="2"
			zoc="yes"
			[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="40"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="9"
				description=_ "claws"
				icon="attacks/claws-drake.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="7"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="5"
				range="ranged"
				type="fire"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Drake Gladiator,Drake Slasher"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="19"
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="41"
			id="Drake Clasher-6"
			image="units/drakes/clasher.png"
			language_name=_ "Drake Clasher"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="41"
			max_moves="6"
			movement="5"
			movement_type="drakefoot"
			moves="6"
			name="Gaké"
			profile="portraits/drakes/clasher.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Drake Clasher"
			undead_variation="drake"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-spear.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="75"
						image="units/drakes/clasher-attack-sword.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/drakes/clasher-flying.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/drakes/clasher.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="130"
					image="units/drakes/clasher-die-1.png"
				[/frame]
				[frame]
					begin="130"
					end="320"
					image="units/drakes/clasher-die-2.png"
				[/frame]
				[frame]
					begin="320"
					end="450"
					image="units/drakes/clasher-die-3.png"
				[/frame]
				[frame]
					begin="450"
					end="600"
					image="units/drakes/clasher-die-4.png"
				[/frame]
				[frame]
					begin="600"
					end="750"
					image="units/drakes/clasher-die-5.png"
				[/frame]
				[frame]
					begin="750"
					end="900"
					image="units/drakes/clasher-die-6.png"
				[/frame]
				[frame]
					begin="900"
					end="1050"
					image="units/drakes/clasher-die-7.png"
				[/frame]
				[frame]
					begin="1050"
					end="1200"
					image="units/drakes/clasher-die-8.png"
				[/frame]
				[frame]
					begin="1200"
					end="1350"
					image="units/drakes/clasher-die-9.png"
				[/frame]
				[frame]
					begin="1350"
					end="1500"
					image="units/drakes/clasher-die-10.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
				[frame]
					duration="100"
					image="units/drakes/clasher-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/drakes/clasher-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/clasher-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/drakes/clasher.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="70"
				deep_water="90"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="70"
				mountains="60"
				reef="70"
				sand="60"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="80"
				cold="150"
				fire="50"
				impact="70"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/scimitar.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="6"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
				[specials]
					[firststrike]
#textdomain wesnoth
						description=_ "First Strike:
This unit always strikes first with this attack, even if they are defending."
						id="firststrike"
						name=_ "firststrike"
					[/firststrike]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/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="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="3"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Saurian Augur-15"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="27"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Axisesz"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="15"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[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]
			[/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="16"
			facing="se"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="30"
			id="Saurian Skirmisher-16"
			image="units/saurians/skirmisher.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Skirmisher"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="30"
			max_moves="7"
			movement="6"
			movement_type="lizard"
			moves="7"
			name="Hezyx"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Skirmisher"
			undead_variation="saurian"
			underlying_id="16"
			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="4"
#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^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^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]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Saurian Oracle,Saurian Soothsayer"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="hiss-die.wav"
			ellipse="misc/ellipse"
			experience="0"
			facing="ne"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="23"
			id="Saurian Augur-17"
			image="units/saurians/augur.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Augur"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="23"
			max_moves="6"
			movement="6"
			movement_type="lizard"
			moves="6"
			name="Kez"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Saurian Augur"
			undead_variation="saurian"
			underlying_id="17"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			zoc="yes"
			[attack_anim]
				start_time="-300"
				[filter_attack]
					name="curse"
				[/filter_attack]
				[if]
					hits="yes"
					[missile_frame]
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
					[missile_frame]
						begin="0"
						end="50"
						halo="projectiles/whitemissile-impact-1.png"
						offset="0.8"
					[/missile_frame]
					[missile_frame]
						begin="50"
						end="100"
						halo="projectiles/whitemissile-impact-2.png"
						offset="0.92"
					[/missile_frame]
					[missile_frame]
						begin="100"
						end="150"
						halo="projectiles/whitemissile-impact-3.png"
						offset="0.94"
					[/missile_frame]
					[missile_frame]
						begin="150"
						end="200"
						halo="projectiles/whitemissile-impact-4.png"
						offset="0.96"
					[/missile_frame]
					[missile_frame]
						begin="200"
						end="250"
						halo="projectiles/whitemissile-impact-5.png"
						offset="0.98"
					[/missile_frame]
					[missile_frame]
						begin="250"
						end="300"
						halo="projectiles/whitemissile-impact-6.png"
						offset="1.0"
					[/missile_frame]
					[missile_frame]
						begin="300"
						end="350"
						halo="projectiles/whitemissile-impact-7.png"
						offset="1.02"
					[/missile_frame]
					[missile_frame]
						begin="350"
						end="400"
						halo="projectiles/whitemissile-impact-8.png"
						offset="1.04"
					[/missile_frame]
				[/if]
				[else]
					hits="no"
					[missile_frame]
						alpha=".8~0.0:200"
						begin="-200"
						end="0"
						image="projectiles/whitemissile-n.png"
						image_diagonal="projectiles/whitemissile-ne.png"
						offset="0.0~0.8"
					[/missile_frame]
				[/else]
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
					sound="magicmissile.wav"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~0.3,0.3~0.45,0.45~0.3,0.3~0.0"
				start_time="-250"
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/saurians/augur-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="100"
						image="units/saurians/augur-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="100"
					image="units/saurians/augur-melee-3.png"
				[/frame]
				[frame]
					duration="90"
					image="units/saurians/augur-melee-4.png"
				[/frame]
				[frame]
					duration="80"
					image="units/saurians/augur-melee-5.png"
				[/frame]
				[frame]
					duration="50"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/saurians/augur-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
						sound="hiss-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/saurians/augur-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/saurians/augur-defend-1.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-300"
				[frame]
					duration="50"
					halo="halo/saurian-magic-halo-1.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="60"
					halo="halo/saurian-magic-halo-2.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="70"
					halo="halo/saurian-magic-halo-3.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="80"
					halo="halo/saurian-magic-halo-4.png"
					image="units/saurians/augur-magic-2.png"
				[/frame]
				[frame]
					duration="90"
					halo="halo/saurian-magic-halo-5.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-6.png"
					image="units/saurians/augur-magic-1.png"
				[/frame]
				[frame]
					duration="100"
					halo="halo/saurian-magic-halo-7.png"
					image="units/saurians/augur.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/saurians/transparent/augur.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/saurians/transparent/augur.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]
				[heals]
					affect_allies="yes"
					affect_self="no"
#textdomain wesnoth
					description=_ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
					female_name=_ "female^heals +4"
					id="healing"
					name=_ "heals +4"
					poison="slowed"
					value="4"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
					[/affect_adjacent]
				[/heals]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "curse"
				icon="attacks/curse.png"
				name="curse"
				number="3"
				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]
			[modifications]
				[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]
				[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="Elvish Archer,Elvish Fighter,Elvish Scout,Elvish Shaman,Mage,Merman Hunter,Wose"
		gold="-1"
		gold_add="no"
		name="ardesh"
		save_id="ardesh2"
		[unit]
			advances_to="Elder Wose"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="20"
			die_sound="wose-die.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="52"
			id="Wose-9"
			image="units/woses/wose.png"
#textdomain wesnoth-units
			language_name=_ "Wose"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="52"
			max_moves="4"
			movement="4"
			movement_type="treefolk"
			moves="4"
			name="Dronnongatum"
			race="wose"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Wose"
			undead_variation="wose"
			underlying_id="9"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				start_time="-500"
				[filter_attack]
					name="crush"
				[/filter_attack]
				[if]
					hits="yes"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-attack.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="400"
						image="units/woses/wose-attack-1.png"
						sound="wose-miss.ogg"
					[/frame]
				[/else]
				[frame]
					duration="150"
					image="units/woses/wose-attack-2.png"
				[/frame]
				[frame]
					duration="75"
					image="units/woses/wose-attack-1.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[filter_attack]
					type="blade,impact,pierce"
				[/filter_attack]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-13.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-14.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-die-fall-15.png"
				[/frame]
			[/death]
			[death]
				start_time="0"
				[filter_attack]
					type="arcane,fire,cold"
				[/filter_attack]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-8.png"
				[/frame]
				[frame]
					duration="150"
					image="units/woses/wose-die-decay-9.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
				[frame]
					duration="100"
					image="units/woses/wose-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
						sound="wose-hit.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/woses/wose-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/woses/wose.png"
				[/frame]
			[/defend]
			[defense]
				castle="80"
				cave="80"
				deep_water="90"
				flat="80"
				forest="60"
				frozen="80"
				fungus="70"
				hills="70"
				impassable="80"
				mountains="70"
				reef="80"
				sand="80"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="80"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="100"
				cold="90"
				fire="150"
				impact="60"
				pierce="40"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
				[regenerate]
					affect_self="yes"
					description=_ "Regenerates:
The unit will heal itself 8 HP per turn. If it is poisoned, it will remove the poison instead of healing."
					female_name=_ "female^regenerates"
					id="regenerates"
					name=_ "regenerates"
					poison="cured"
					value="8"
				[/regenerate]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="13"
#textdomain wesnoth-units
				description=_ "crush"
				icon="attacks/crush-wose.png"
				name="crush"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Merman Spearman,Merman Netcaster"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="mermen-die.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="33"
			id="Merman Hunter-11"
			image="units/merfolk/hunter.png"
			language_name=_ "Merman Hunter"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="33"
			max_moves="7"
			movement="6"
			movement_type="swimmer"
			moves="7"
			name="Mimir"
			profile="portraits/merfolk/hunter.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Merman Hunter"
			undead_variation="swimmer"
			underlying_id="11"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			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/merfolk/hunter.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/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="spear"
					range="melee"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/hunter.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/merfolk/hunter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/merfolk/hunter.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
						sound="mermen-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/merfolk/hunter.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/merfolk/hunter.png"
				[/frame]
			[/defend]
			[defense]
				castle="60"
				cave="80"
				deep_water="50"
				flat="70"
				forest="70"
				frozen="70"
				fungus="80"
				hills="70"
				impassable="80"
				mountains="80"
				reef="30"
				sand="70"
				shallow_water="40"
				swamp_water="40"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="1"
				flat="2"
				forest="5"
				frozen="2"
				fungus="3"
				hills="5"
				impassable="99"
				mountains="99"
				reef="2"
				sand="2"
				shallow_water="1"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="100"
				cold="80"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "spear"
				name="spear"
				number="2"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="5"
				description=_ "spear"
				name="spear"
				number="3"
				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^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="Elvish Avenger"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="41"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="42"
			id="Elvish Archer-12"
			image="units/elves-wood/ranger.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Ranger"
			level="2"
			max_attacks="1"
			max_experience="50"
			max_hitpoints="42"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Glálith"
			profile="portraits/elves/ranger.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Ranger"
			undead_variation="archer"
			underlying_id="12"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			zoc="yes"
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/ranger.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="60"
				shallow_water="70"
				swamp_water="60"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="2"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[abilities]
				[hides]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					description_inactive=_ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see this unit while it is in forest, except if they have units next to it. Any enemy unit that first discovers this unit immediately loses all its remaining movement."
					female_name=_ "female^ambush"
					female_name_inactive=_ "female^ambush"
					id="ambush"
					name=_ "ambush"
					name_inactive=_ "ambush"
					[filter_self]
						[filter_location]
							terrain="*^Fp,*^Fet,*^Ft,*^Fpa,*^Fd*,*^Fm*"
						[/filter_location]
					[/filter_self]
				[/hides]
			[/abilities]
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/ranger-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/ranger-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/ranger-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/ranger-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/ranger-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/ranger-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="175"
					image="units/elves-wood/ranger-sword-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/ranger-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/ranger-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/ranger-bow.png"
				[/frame]
			[/defend]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Captain,Elvish Hero"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="38"
			id="Elvish Fighter-13"
			image="units/elves-wood/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="38"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			moves="5"
			name="Tinolas"
			profile="portraits/elves/fighter.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Fighter"
			underlying_id="13"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/fighter-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/fighter-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/fighter-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/fighter-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-175"
					end="-100"
					image="units/elves-wood/fighter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/fighter-melee-1.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/elves-wood/fighter-melee-2.png"
				[/frame]
				[frame]
					begin="150"
					end="175"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,elf-hit-1.ogg,elf-hit-2.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/elves-wood/fighter-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/fighter-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/fighter-idle-2.png"
				[/frame]
				[frame]
					duration="125"
					image="units/elves-wood/fighter-idle-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-4.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-5.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-6.png"
				[/frame]
				[frame]
					duration="175"
					image="units/elves-wood/fighter-idle-7.png"
				[/frame]
				[frame]
					duration="200"
					image="units/elves-wood/fighter-idle-8.png"
				[/frame]
				[frame]
					duration="250"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="400"
					image="units/elves-wood/fighter-idle-10.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-9.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-11.png"
				[/frame]
				[frame]
					duration="150"
					image="units/elves-wood/fighter-idle-12.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="40"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="4"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="3"
				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^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="34"
			id="Elvish Archer-14"
			image="units/elves-wood/archer+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="34"
			max_moves="6"
			movement="6"
			movement_type="woodland"
			moves="6"
			name="Calóng"
			profile="portraits/elves/archer+female.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="14"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="bow"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/missile-n.png"
					image_diagonal="projectiles/missile-ne.png"
				[/missile_frame]
				[frame]
					begin="-445"
					end="-380"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer+female-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer+female-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer+female-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer+female-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer+female-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer+female-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer+female-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer+female-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-sword-defend.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/elves-wood/archer+female-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer+female-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer+female-bow-defend.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/elves-wood/archer+female-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer+female-bow.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]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="70"
				deep_water="80"
				flat="60"
				forest="30"
				frozen="70"
				fungus="50"
				hills="50"
				impassable="70"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="99"
				flat="1"
				forest="1"
				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="110"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="5"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					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]
	[/player]
	[label]
		colour="107,140,255,0"
		team_name="north"
		text="wose"
		visible_in_fog="yes"
		x="21"
		y="16"
	[/label]
[/snapshot]
[replay_start]
	current_tod="0"
#textdomain wesnoth-multiplayer
	description=_ "This vital supply route has played a key role in many of Wesnoth's greatest battles."
	experience_modifier="70"
	hash="ni><w8>Ksy9E6lpej<-R7zqNgF0HH1GU14mLcPs+Y0>x<lui3JMr96tqaCJ+gLs7vdDsR,OV+p41UARdwDMp8w8hABAeHRqXh0zHL5LEGp<BJU2ovj4yzohfX.yffdE0"
	id="multiplayer_Weldyn_Channel"
	map_data="border_size=1
usage=map

Ss          , Hh          , Rp          , Ss          , Gs^Fp       , Hh          , Rp          , Rp          , Hh          , Ss          , Ss          , Gg          , Hh          , Hh          , Gs^Fms      , Ss          , Gg          , Hh          , Ww          , Ww          , Wo          , Wo          , Ww          , Wwf         , Hh          , Hh          , Hh          , Hh          , Ss          , Hh          , Hh          
Gg          , Gg^Fet      , Rp          , Mm          , Gs^Fp       , Ss          , Rp          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Mm          , Gs^Fp       , Gg          , Gs^Fds      , Hh          , Gs^Fp       , Hh          , Gg          , Ww          , Wo          , Wo          , Ww          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Mm          , Ss          , Mm          , Hh          , Gs^Fp       , Ss          
Gg          , Gg          , Gg          , Rp          , Rp          , Rp          , Gg          , Gg^Ve       , Gg          , Hh          , Gg          , Gg          , Re          , Gg          , Re          , Ch          , Mm          , Ww          , Wo          , Wo          , Ww          , Ww          , Mm          , Ss          , Ss^Vhs      , Hh          , Gs^Fp       , Hh          , Gs^Fms      , Gg^Fet      , Gg          
Gs^Fms      , Gg          , Gg          , Gg          , Rp          , Gg          , Gg          , Gg          , Re          , Mm          , Re          , Re          , Re          , Re          , Ch          , 1 Kh        , Ch          , Ww          , Ww          , Ww          , Gs^Fp       , Hh          , Hh          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Hh          , Gg          
Hh          , Gs^Fp       , Rp          , Rp          , Re^Uf       , Gs^Fds      , Re          , Re          , Gg          , Re          , Gg          , Gg          , Gg          , Kh          , Gg          , Ch          , Wwf         , Kh          , Ww^Bw\      , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re^Uf       , Mm          , Gg          , Gg          , Gg          , Gg          
Hh          , Hh          , Rp          , Mm          , Gs^Fp       , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww          , Ww          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg^Vh       , Gg          , Re          , Ss          , Hh          , Gs^Fp       , Re          , Gg          , Gg          
Gs^Fp       , Rp          , Mm          , Hh          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg^Uf       , Hh          , Hh          , Gg^Ve       , Ww          , Ww          , Ww          , Gg          , Ss          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Re^Uf       , Re          , Gg          , Gg          
Rp          , Rp          , Re          , Re          , Gg          , Gg          , Gg^Vh       , Gg          , Gg          , Gs^Fds      , Hh          , Mm          , Gg          , Gs^Fp       , Ww          , Wo          , Ww          , Gg          , Gs^Fp       , Ss^Vhs      , Ww          , Mm          , Hh          , Gg          , Gg^Ve       , Gs^Fms      , Gg          , Re          , Gg          , Gg          , Gg          
Gs^Fp       , Re          , Re          , Gg          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Ww          , Wwf         , Rp          , Gg          , Gg          , Gg          , Gg          , Gg          , Mm          , Gg^Uf       , Hh          
Gg          , Re          , Re          , Hh          , Ss          , Ggf^Uf      , Gg          , Gg          , Gs^Fms      , Ggf         , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Mm^Xm       , Wo          , Wo          , Wo          , Ww          , Wwf         , Wwf         , Rp          , Rp          , Gg          , Gs^Fp       , Hh          , Gg^Fet      , Hh          , Gg          
Wwf         , Gg          , Gg          , Gs^Fms      , Mm          , Hh          , Hh          , Gg          , Gg          , Mm          , Hh          , Ww          , Ww          , Wo          , Wo          , Hh          , Mm^Xm       , Wo          , Wo          , Wo          , Ww          , Gs^Fp       , Rp          , Wwf         , Wwf         , Gg          , Rp          , Rp          , Rp          , Gg          , Gg          
Rp          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Rp          , Gg          , Hh          , Ww          , Ww          , Wo          , Ww          , Wwr         , Mm^Xm       , Wwr         , Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Rp          , Wwf         , Rp          , Wwf         , Wwf         , Wwf         , Rp          , Rp          
Gg          , Rp          , Rp          , Wwf         , Rp          , Rp          , Wwf         , Rp          , Rp          , Gg          , Ww          , Ww          , Wo          , Wo          , Mm^Xm       , Mm^Xm       , Wo          , Ww          , Ww          , Ww          , Hh          , Hh          , Gg          , Rp          , Hh          , Wwf         , Mm          , Gg          , Gg          , Wwf         , Wwf         
Gs^Fds      , Gg          , Gg^Fet      , Rp          , Gs^Fms      , Gg          , Rp          , Wwf         , Wwf         , Gs^Fp       , Ww          , Wo          , Wo          , Wo          , Mm^Xm       , Hh          , Wo          , Wo          , Ww          , Ww          , Gg          , Mm          , Gs^Fms      , Gg          , Gg          , Hh          , Ss          , Gs^Fp       , Re          , Gg          , Gg          
Hh          , Hh          , Mm          , Hh          , Gg          , Gg          , Gg          , Rp          , Rp          , Wwf         , Ww          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Ggf         , Gg          , Gg          , Gg          , Ggf^Uf      , Gg^Fet      , Hh          , Re          , Re          , Gs^Fp       
Gs^Fds      , Ggf^Uf      , Gg          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Hh          , Wwf         , Ww          , Ww          , Gs^Fp       , Ww          , Ww          , Wo          , Ww          , Ww          , Gg          , Gg          , Hh          , Gg          , Gg          , Gg          , Gg^Vh       , Gg          , Gg          , Gg          , Re          , Re          , Rp          
Gg          , Gg          , Re          , Re          , Re          , Gs^Fms      , Gg          , Gg          , Gg          , Mm          , Gg          , Ss^Vhs      , Ss          , Gg          , Ww          , Wo          , Ww          , Gs^Fp       , Hh          , Mm          , Ggf^Uf      , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Mm          , Rp          , Gs^Fp       
Gg          , Gg          , Re          , Re^Uf       , Hh          , Re          , Re          , Gg          , Gg^Vh       , Gg          , Gg          , Gs^Fp       , Gg          , Gg          , Ww          , Ww          , Gg          , Gg^Ve       , Gg          , Hh          , Gg          , Gg          , Gg          , Gg          , Ggf         , Re          , Gs^Fds      , Hh          , Rp          , Rp          , Hh          
Gg          , Gg          , Gg          , Gs^Fp       , Mm          , Ss          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Ww^Bw\      , Wwf         , Wwf         , Ww          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Re^Uf       , Mm          , Rp          , Hh          , Hh          
Gg          , Gg          , Gg          , Gg          , Gg          , Re^Uf       , Gg          , Gg          , Hh          , Gg          , Gs^Fp       , Gg          , Ww          , Kh          , Ch          , Ch          , Ch          , Kh          , Gg          , Gg          , Re          , Re          , Re          , Re          , Gg          , Gs^Fp       , Rp          , Rp          , Gg          , Gs^Fms      , Gg          
Gs^Fds      , Gg          , Gs^Fp       , Gg          , Gs^Fp       , Gg          , Ss^Vhs      , Gs^Fp       , Mm          , Hh          , Ww          , Ww          , Wo          , Ww          , Mm          , 2 Kh        , Re          , Re          , Re          , Re          , Gg          , Gg^Ve       , Gg          , Gg          , Gg          , Gg          , Rp          , Gg          , Gg          , Gg          , Gg          
Ss          , Gg^Fet      , Ss          , Hh          , Mm          , Hh          , Gs^Fms      , Ss          , Gs^Fp       , Ww          , Wo          , Wo          , Ww          , Ww          , Hh          , Ch          , Gs^Fds      , Gg          , Gs^Fms      , Mm          , Gg^Fet      , Hh          , Mm          , Hh          , Rp          , Rp          , Gs^Fp       , Rp          , Rp          , Gg          , Gg          
Hh          , Hh          , Gs^Fms      , Gs^Fp       , Hh          , Ss          , Mm          , Gg^Fet      , Ww          , Ww          , Wo          , Wo          , Ww          , Hh          , Gs^Fp       , Gg^Fet      , Gs^Fms      , Hh          , Mm          , Hh          , Gs^Fp       , Ss          , Hh          , Gs^Fp       , Rp          , Ss          , Ss          , Hh          , Mm          , Rp          , Gg          
Hh          , Gs^Fms      , Hh          , Ss          , Hh          , Hh          , Wwf         , Ww          , Wo          , Wo          , Ww          , Ww          , Hh          , Gg          , Hh          , Hh          , Ss          , Hh          , Hh          , Gs^Fms      , Ss          , Hh          , Rp          , Rp          , Gg          , Hh          , Hh          , Gs^Fp       , Ss          , Rp          , Hh          
"
	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 - Weldyn Channel"
	next_underlying_unit_id="0"
#textdomain wesnoth
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	random_seed="1939481501"
	random_start_time="no"
	scenario="Ladder KnightKunibert (ladder members only please)"
	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/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="KnightKunibert"
		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="KnightKunibert1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		team_name="north"
		terrain_liked="Hh, Ha, Ds, Ss"
		type="Fire Drake"
		user_team_name="wesnoth-multiplayerteamname^North"
		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]
	[side]
		allow_changes="yes"
		allow_player="yes"
		canrecruit="yes"
		colour="2"
		controller="network"
		current_player="ardesh"
		flag_rgb="magenta"
		fog="yes"
		gender="male"
		gold="100"
		id="ardesh2"
		image="units/elves-wood/captain.png"
		income="0"
		leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose"
		mp_countdown="yes"
		mp_countdown_action_bonus="20"
		mp_countdown_init_time="270"
		mp_countdown_reservoir_time="270"
		mp_countdown_turn_bonus="200"
		name="ardesh"
		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"
		save_id="ardesh2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		team_name="south"
		terrain_liked="Ff, Fa, Ss, Ww"
		type="Elvish Captain"
		user_team_name="wesnoth-multiplayerteamname^South"
		village_gold="2"
		[ai]
			recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,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 - Weldyn Channel"
		[team]
			[recruits]
				Drake Clasher="1"
				Drake Fighter="1"
				Saurian Augur="4"
				Saurian Skirmisher="3"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Drake Fighter="1"
				Saurian Augur="2"
				Saurian Skirmisher="2"
			[/deaths]
			[killed]
				Elvish Captain="1"
				Elvish Fighter="1"
			[/killed]
			[attacks]
				[sequence]
					s000="1"
					s0011="1"
					s1000="1"
					_num="40"
				[/sequence]
				[sequence]
					s01="1"
					s011="1"
					_num="60"
				[/sequence]
				[sequence]
					s001="1"
					s011="1"
					s100="1"
					s110="1"
					s111="1"
					_num="70"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s0="1"
					s11="1"
					_num="40"
				[/sequence]
				[sequence]
					s00="1"
					s0011="1"
					s10="1"
					_num="60"
				[/sequence]
				[sequence]
					s="2"
					s100="1"
					_num="70"
				[/sequence]
				[sequence]
					s111="1"
					_num="80"
				[/sequence]
			[/defends]
			recruit_cost="145"
			recall_cost="0"
			damage_inflicted="124"
			damage_taken="174"
			expected_damage_inflicted="152816"
			expected_damage_taken="145978"
			turn_damage_inflicted="17"
			turn_damage_taken="8"
			turn_expected_damage_inflicted="16860"
			turn_expected_damage_taken="17575"
			save_id="KnightKunibert1"
		[/team]
		[team]
			[recruits]
				Elvish Archer="2"
				Elvish Fighter="2"
				Merman Hunter="1"
				Wose="1"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
				Elvish Ranger="1"
			[/advances]
			[deaths]
				Elvish Captain="1"
				Elvish Fighter="1"
			[/deaths]
			[killed]
				Drake Fighter="1"
				Saurian Augur="2"
				Saurian Skirmisher="2"
			[/killed]
			[attacks]
				[sequence]
					s0110="1"
					s1="2"
					s101="1"
					_num="40"
				[/sequence]
				[sequence]
					s1101="1"
					s111="1"
					s1111="1"
					_num="60"
				[/sequence]
				[sequence]
					s11="2"
					_num="70"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s001="1"
					s010="1"
					s011="1"
					_num="40"
				[/sequence]
				[sequence]
					s00="1"
					s01="1"
					s011="1"
					s11="1"
					s110="1"
					_num="60"
				[/sequence]
				[sequence]
					s01="1"
					s1="1"
					_num="70"
				[/sequence]
			[/defends]
			recruit_cost="97"
			recall_cost="0"
			damage_inflicted="174"
			damage_taken="124"
			expected_damage_inflicted="145978"
			expected_damage_taken="152816"
			turn_damage_inflicted="44"
			turn_damage_taken="22"
			turn_expected_damage_inflicted="44463"
			turn_expected_damage_taken="37528"
			save_id="ardesh2"
		[/team]
	[/scenario]
[/statistics]
