label="2p - Caves of the Basilisk revoir la partie"
version="1.6"
completion="running"
campaign_type="multiplayer"
difficulty="NORMAL"
random_seed="2000383187"
random_calls="0"
next_underlying_unit_id="50"
end_text_duration="0"
[variables]
	damage_inflicted="7"
	side_number="2"
	turn_number="9"
[/variables]
[player]
	save_id="ai3"
	gold="-1"
	gold_add="false"
	can_recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
[/player]
[player]
	save_id="akkon2"
	gold="-1"
	gold_add="false"
	can_recruit="Elvish Archer,Elvish Fighter,Elvish Scout,Elvish Shaman,Mage,Merman Hunter,Wose"
[/player]
[player]
	save_id="ced1"
	gold="-1"
	gold_add="false"
	can_recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
[/player]
[replay]
	[command]
		[start]
		[/start]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="montoto has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="2"
			x="18"
			y="5"
		[/recruit]
		[random]
			value="986150167"
		[/random]
		[random]
			value="1495257364"
		[/random]
		[random]
			value="874996680"
		[/random]
		[random]
			value="129085034"
		[/random]
		[random]
			value="122244120"
		[/random]
		[random]
			value="1491551506"
		[/random]
		[random]
			value="1238558667"
		[/random]
		[random]
			value="216792401"
		[/random]
		[random]
			value="1950568803"
		[/random]
		[random]
			value="1144959309"
		[/random]
		[random]
			value="1268601710"
		[/random]
		[random]
			value="218029696"
		[/random]
		[random]
			value="989438580"
		[/random]
		[random]
			value="510768129"
		[/random]
		[random]
			value="2066782236"
			[results]
				checksum="RUQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvLyMAS8wEVRB+JCszfJzd4jC+rc<MF13amk4nil5K7b35>-yp,-98,eyb6ac"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="1"
			x="19"
			y="5"
		[/recruit]
		[random]
			value="2028514537"
		[/random]
		[random]
			value="1701591310"
		[/random]
		[random]
			value="211234298"
		[/random]
		[random]
			value="237880994"
		[/random]
		[random]
			value="136553015"
		[/random]
		[random]
			value="1197384465"
		[/random]
		[random]
			value="1733138358"
		[/random]
		[random]
			value="1011549695"
		[/random]
		[random]
			value="1326469499"
		[/random]
		[random]
			value="1855382478"
		[/random]
		[random]
			value="355617554"
		[/random]
		[random]
			value="417544519"
		[/random]
		[random]
			value="2072174879"
		[/random]
		[random]
			value="158702709"
		[/random]
		[random]
			value="1562503828"
			[results]
				checksum="14,Wfc>cu2lH0olW9-5N-m<e6f60hfabkcij<4>i3h3e2.t0a1f<j870h0k565.Y0>ide9Mi80k.d8da021n<.26Z+40CN5c8b.-X,48E.7v3f3XdJFikGGOwGMoVOFH"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="6"
			x="20"
			y="4"
		[/recruit]
		[random]
			value="830404681"
		[/random]
		[random]
			value="230033528"
		[/random]
		[random]
			value="760380802"
		[/random]
		[random]
			value="203155035"
		[/random]
		[random]
			value="1016792738"
		[/random]
		[random]
			value="98139597"
		[/random]
		[random]
			value="30205310"
		[/random]
		[random]
			value="1896653586"
		[/random]
		[random]
			value="404027576"
		[/random]
		[random]
			value="2058719848"
		[/random]
		[random]
			value="1450761248"
		[/random]
		[random]
			value="615261875"
		[/random]
		[random]
			value="149117194"
		[/random]
		[random]
			value="1587314263"
		[/random]
		[random]
			value="1812646340"
			[results]
				checksum="XBfX4cmdHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ep7ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j6D1<4M26i7zO.<CByI"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="6"
			x="22"
			y="4"
		[/recruit]
		[random]
			value="965700573"
		[/random]
		[random]
			value="824196891"
		[/random]
		[random]
			value="560654906"
		[/random]
		[random]
			value="1342432979"
		[/random]
		[random]
			value="1228655652"
		[/random]
		[random]
			value="117232329"
		[/random]
		[random]
			value="1638463972"
		[/random]
		[random]
			value="1148689449"
		[/random]
		[random]
			value="1656804070"
		[/random]
		[random]
			value="321385006"
		[/random]
		[random]
			value="1378722977"
		[/random]
		[random]
			value="269701224"
		[/random]
		[random]
			value="524540041"
		[/random]
		[random]
			value="248032067"
		[/random]
		[random]
			value="367840821"
			[results]
				checksum="XBfX4cmdHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ep8ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j3D1<4M96i7zO.<CyyI"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="4"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="2043925157"
		[/random]
		[random]
			value="1940025032"
		[/random]
		[random]
			value="2146172043"
		[/random]
		[random]
			value="1305618220"
		[/random]
		[random]
			value="1307386997"
		[/random]
		[random]
			value="964388969"
		[/random]
		[random]
			value="2129815111"
		[/random]
		[random]
			value="1868041903"
		[/random]
		[random]
			value="159338300"
		[/random]
		[random]
			value="1210987115"
		[/random]
		[random]
			value="1985274232"
		[/random]
		[random]
			value="1797802272"
		[/random]
		[random]
			value="212192917"
		[/random]
		[random]
			value="1494594654"
		[/random]
		[random]
			value="2119187278"
			[results]
				checksum="KcwfALHM1AKcptV75qVBLNNDjB+ho.t0,fnp91.7>Yl1cF7<01e5yd,9+0e3j4jcb6cifadb1-6cKf37b2ifil7.WgZ2.h<5-XxS+j>k2403-p8TA9v9PQDp80F<5210"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Calandryl has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="2"
			x="24"
			y="5"
		[/recruit]
		[random]
			value="2024423441"
		[/random]
		[random]
			value="1048461038"
		[/random]
		[random]
			value="334456324"
		[/random]
		[random]
			value="1216113972"
		[/random]
		[random]
			value="944902547"
		[/random]
		[random]
			value="126997708"
		[/random]
		[random]
			value="1214802368"
		[/random]
		[random]
			value="103037119"
		[/random]
		[random]
			value="1434384705"
		[/random]
		[random]
			value="31707689"
		[/random]
		[random]
			value="85368583"
		[/random]
		[random]
			value="1154942960"
		[/random]
		[random]
			value="191045989"
		[/random]
		[random]
			value="1296355698"
		[/random]
		[random]
			value="992733545"
			[results]
				checksum="RVQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvKtMAS8wEVRB+JCszfJzd4kC+rc<MF13amk4yil5K7b35>-yp,+<8,eyb6ac"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="21,20,19,18,17"
			y="4,4,4,3,3"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="enjoy"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="halk has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="carvalho has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="18"
			y="19"
		[/recruit]
		[random]
			value="1798862908"
		[/random]
		[random]
			value="1790374444"
		[/random]
		[random]
			value="1403547448"
		[/random]
		[random]
			value="511946038"
		[/random]
		[random]
			value="2068033421"
		[/random]
		[random]
			value="1990324124"
		[/random]
		[random]
			value="505124289"
		[/random]
		[random]
			value="2129586378"
		[/random]
		[random]
			value="13849797"
		[/random]
		[random]
			value="1751222334"
		[/random]
		[random]
			value="2131523470"
		[/random]
		[random]
			value="220432758"
		[/random]
		[random]
			value="1914831685"
		[/random]
		[random]
			value="1830505704"
		[/random]
		[random]
			value="906684844"
			[results]
				checksum="oxj+sAh20PB0NmsQ56tLoxNPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Smozes has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="1770552031"
		[/random]
		[random]
			value="1022125656"
		[/random]
		[random]
			value="1491755337"
		[/random]
		[random]
			value="1487213511"
		[/random]
		[random]
			value="366220303"
		[/random]
		[random]
			value="2085696325"
		[/random]
		[random]
			value="705344869"
		[/random]
		[random]
			value="426734969"
		[/random]
		[random]
			value="1737075585"
		[/random]
		[random]
			value="348235665"
		[/random]
		[random]
			value="1830282418"
		[/random]
		[random]
			value="101537975"
		[/random]
		[random]
			value="268785438"
		[/random]
		[random]
			value="1673122894"
		[/random]
		[random]
			value="606662264"
			[results]
				checksum="DB3s-,zQn1M2yLIrtl,yvEJs+TqLAH7qSCNCNSvmIJ>KNGxwmIQwSVVvQLyBGFwuCzBR9PMVRCroPzMEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="23"
			y="20"
		[/recruit]
		[random]
			value="2005897143"
		[/random]
		[random]
			value="1991840960"
		[/random]
		[random]
			value="1076660881"
		[/random]
		[random]
			value="1638805037"
		[/random]
		[random]
			value="963625777"
		[/random]
		[random]
			value="699729265"
		[/random]
		[random]
			value="513447045"
		[/random]
		[random]
			value="307897466"
		[/random]
		[random]
			value="39459128"
		[/random]
		[random]
			value="879667348"
		[/random]
		[random]
			value="246110143"
		[/random]
		[random]
			value="744803997"
		[/random]
		[random]
			value="1306402318"
		[/random]
		[random]
			value="1983185728"
		[/random]
		[random]
			value="1093039662"
			[results]
				checksum="ACIByNSVYyLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9vumVnpCouMKPBb5TJGPbmz3o>.fjcflW4p97m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="19"
			y="20"
		[/recruit]
		[random]
			value="861701584"
		[/random]
		[random]
			value="613533470"
		[/random]
		[random]
			value="897374830"
		[/random]
		[random]
			value="720115080"
		[/random]
		[random]
			value="457890782"
		[/random]
		[random]
			value="1974035712"
		[/random]
		[random]
			value="211436469"
		[/random]
		[random]
			value="1421516560"
		[/random]
		[random]
			value="526281329"
		[/random]
		[random]
			value="724883514"
		[/random]
		[random]
			value="1729414026"
		[/random]
		[random]
			value="565740457"
		[/random]
		[random]
			value="1604550863"
		[/random]
		[random]
			value="1975524170"
		[/random]
		[random]
			value="1310544454"
			[results]
				checksum="ACIByNSVYzLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9uumVnpCouMKPBb5OJGPbmz3o>.fjcflW4pf7m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23,24,25"
			y="21,20,20,20,21"
		[/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"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message=" u2"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="18,17,16,15,14,13,12"
			y="5,5,5,5,5,5,4"
		[/move]
	[/command]
	[command]
		[move]
			x="22,21,21,21,21,21,22"
			y="4,5,6,7,8,9,9"
		[/move]
	[/command]
	[command]
		[move]
			x="20,21,21,21,21,21,21"
			y="4,5,6,7,8,9,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfopps002Josh002 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="17,17,17,17,17,17"
			y="3,4,5,6,7,8"
		[/move]
	[/command]
	[command]
		[move]
			x="19,18,17,16,15,14,13,12,12"
			y="5,5,6,6,7,7,8,8,9"
		[/move]
	[/command]
	[command]
		[move]
			x="12,12"
			y="9,10"
		[/move]
	[/command]
	[command]
		[move]
			x="24,24,24,24,25,26,26"
			y="5,6,7,8,9,9,10"
		[/move]
	[/command]
	[command]
		[move]
			x="23,24,25,26,27,28,29,30,31"
			y="5,5,6,6,6,5,5,5,6"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28,29,30"
			y="19,20,20,21,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,24,24,25,25"
			y="20,19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,19,19,19,19,20"
			y="20,19,18,17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="rio has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,18,18,17,16"
			y="19,18,17,16,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,16"
			y="15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="seano has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="25,24,23,22,21"
			y="21,20,20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="18"
			y="19"
		[/recruit]
		[random]
			value="1921167638"
		[/random]
		[random]
			value="1692231181"
		[/random]
		[random]
			value="541896580"
		[/random]
		[random]
			value="86934431"
		[/random]
		[random]
			value="1346485973"
		[/random]
		[random]
			value="405798641"
		[/random]
		[random]
			value="2100651736"
		[/random]
		[random]
			value="630762176"
		[/random]
		[random]
			value="220578361"
		[/random]
		[random]
			value="1247395213"
		[/random]
		[random]
			value="1046584881"
		[/random]
		[random]
			value="272756385"
		[/random]
		[random]
			value="1198555844"
		[/random]
		[random]
			value="306419899"
		[/random]
		[random]
			value="826156365"
			[results]
				checksum="lxj+sAh20PB1VmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw-InBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="374260378"
		[/random]
		[random]
			value="42539317"
		[/random]
		[random]
			value="315301491"
		[/random]
		[random]
			value="787815614"
		[/random]
		[random]
			value="383617756"
		[/random]
		[random]
			value="1406357886"
		[/random]
		[random]
			value="868145384"
		[/random]
		[random]
			value="157301747"
		[/random]
		[random]
			value="951105419"
		[/random]
		[random]
			value="1410041964"
		[/random]
		[random]
			value="244236178"
		[/random]
		[random]
			value="150107745"
		[/random]
		[random]
			value="1815840605"
		[/random]
		[random]
			value="197404266"
		[/random]
		[random]
			value="780869921"
			[results]
				checksum="oxj+sAh20PB1VmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw-InBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8EE25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="R has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,12,12,12,12,12,11,11"
			y="4,5,6,7,8,9,10,11"
		[/move]
	[/command]
	[command]
		[move]
			x="12,12"
			y="10,9"
		[/move]
	[/command]
	[command]
		[move]
			x="12,11,10,9,8"
			y="9,10,10,11,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="StuckInPurgatory has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfgen001Trev01 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,7,6,6,6"
			y="11,12,12,13,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="angafalath has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfopps002Josh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,20"
			y="10,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ozkriff has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="20,20,19,19"
			y="10,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="22,22,22,23,23"
			y="9,10,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="31,31,31,31,31,31"
			y="6,7,8,9,10,11"
		[/move]
	[/command]
	[command]
		[move]
			x="26,27,28,29,30"
			y="10,11,11,12,12"
		[/move]
	[/command]
	[command]
		[move]
			x="31,31"
			y="11,10"
		[/move]
	[/command]
	[command]
		[move]
			x="17,17,17,18"
			y="8,7,6,5"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,30"
			y="20,19"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="i suspect you made a few trees ..."
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,30,30,30,31"
			y="19,18,17,16,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="alph has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Emrizzle has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="allans has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Khorne_Flakes has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="25,25,26,27,28,29"
			y="17,18,18,18,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,17,16,15,14,13"
			y="19,20,19,20,19,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,12,11"
			y="19,18,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28,29,30,31"
			y="19,19,18,18,17,18,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="22"
			y="20"
		[/recruit]
		[random]
			value="565804380"
		[/random]
		[random]
			value="527280291"
		[/random]
		[random]
			value="2026950575"
		[/random]
		[random]
			value="1268977747"
		[/random]
		[random]
			value="1690683868"
		[/random]
		[random]
			value="1314327429"
		[/random]
		[random]
			value="2120739851"
		[/random]
		[random]
			value="884027245"
		[/random]
		[random]
			value="2069927954"
		[/random]
		[random]
			value="1828009572"
		[/random]
		[random]
			value="1157514877"
		[/random]
		[random]
			value="401732168"
		[/random]
		[random]
			value="1655124955"
		[/random]
		[random]
			value="1284882054"
		[/random]
		[random]
			value="1435088806"
			[results]
				checksum="tjfpy66<OvHApsEKQ0oOBBSqxDYSGUuIaHzsLFtQzOWOCBvyFBUsQPVHTIwPFmPFBqCnEs<sBULDPTGRPzPuVKDJsNyMJx,RFNPGrGqf<xPrTryODoP.K+zDJqnmswJI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,22,22"
			y="21,20,19,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,22"
			y="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"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Eseth has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="so lets see it"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Neves has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,32,33,34,35,36,37,38"
			y="10,10,10,10,10,10,11,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="isril has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="38,38,39"
			y="10,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="30,30,30,31"
			y="12,11,10,10"
		[/move]
	[/command]
	[command]
		[recruit]
			value="7"
			x="24"
			y="5"
		[/recruit]
		[random]
			value="1255370437"
		[/random]
		[random]
			value="2045728956"
		[/random]
		[random]
			value="1757210182"
		[/random]
		[random]
			value="629464316"
		[/random]
		[random]
			value="444457677"
		[/random]
		[random]
			value="1336713654"
		[/random]
		[random]
			value="569582200"
		[/random]
		[random]
			value="1344511089"
		[/random]
		[random]
			value="127924695"
		[/random]
		[random]
			value="578972190"
		[/random]
		[random]
			value="1570151196"
		[/random]
		[random]
			value="1666430282"
		[/random]
		[random]
			value="1972050865"
		[/random]
		[random]
			value="721464214"
		[/random]
		[random]
			value="156953084"
			[results]
				checksum=",Ad3Y5f-Gtmnsp5jHbEoRiVrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNQsM8mwoFomIhFlq1.CLW<<ddNv5EsLNHBNzkOI"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="7"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="411209145"
		[/random]
		[random]
			value="2119580436"
		[/random]
		[random]
			value="1353680539"
		[/random]
		[random]
			value="980791345"
		[/random]
		[random]
			value="1316607877"
		[/random]
		[random]
			value="1481605234"
		[/random]
		[random]
			value="1559763535"
		[/random]
		[random]
			value="739275426"
		[/random]
		[random]
			value="1000551869"
		[/random]
		[random]
			value="1384330752"
		[/random]
		[random]
			value="1460739640"
		[/random]
		[random]
			value="1157504953"
		[/random]
		[random]
			value="1319649448"
		[/random]
		[random]
			value="421712545"
		[/random]
		[random]
			value="218010780"
			[results]
				checksum=",Ad3Y5f-Gtmsop5jHbEoRiSrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNLoM8mwoFomIhFlq1.CLB<<ddNv5EsLNHBNzhOI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SpoOkyMagician has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,5"
			y="14,14"
		[/move]
	[/command]
	[command]
		[move]
			x="23,22,21"
			y="13,13,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rio has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,18"
			y="13,12"
		[/move]
	[/command]
	[command]
		[move]
			x="21,20,19"
			y="14,13,13"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,19,18,17,16,15"
			y="15,16,16,17,17,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,21,21,21"
			y="20,20,19,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21"
			y="18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21,20"
			y="17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lester_Burnham2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="31,31,31"
			y="17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="31,31,31"
			y="15,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="29,30,31,32,33"
			y="17,16,16,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Mourad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,22,22,22,21"
			y="16,17,18,19,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="18"
			y="19"
		[/recruit]
		[random]
			value="1670089265"
		[/random]
		[random]
			value="214982943"
		[/random]
		[random]
			value="557446309"
		[/random]
		[random]
			value="1269108833"
		[/random]
		[random]
			value="972840025"
		[/random]
		[random]
			value="256439893"
		[/random]
		[random]
			value="962341010"
		[/random]
		[random]
			value="1730791104"
		[/random]
		[random]
			value="1772309774"
		[/random]
		[random]
			value="1863837300"
		[/random]
		[random]
			value="379471488"
		[/random]
		[random]
			value="109784723"
		[/random]
		[random]
			value="2117691042"
		[/random]
		[random]
			value="923661486"
		[/random]
		[random]
			value="1111795700"
			[results]
				checksum="rQV6GBwD,UJ+7fMAQJ+xOoaC2U6DfS5lmb>+9w26zYBFaluj9yjnQ1omih>hik67n,e0IoZ07o9kcp0Ad568,m9n<X,+m-08797o60sxBFgnkEzrk-i.-tciji+H>s3M"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[move]
			x="39,40"
			y="12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfopps02Josh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfgen001Trev1 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="LemonJuice has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="24,25,25,26,26,27"
			y="5,6,7,7,8,9"
		[/move]
	[/command]
	[command]
		[move]
			x="23,24,25,26,27,28,29"
			y="5,5,6,6,7,6,7"
		[/move]
	[/command]
	[command]
		[recruit]
			value="2"
			x="24"
			y="5"
		[/recruit]
		[random]
			value="1627458472"
		[/random]
		[random]
			value="683484625"
		[/random]
		[random]
			value="441796848"
		[/random]
		[random]
			value="1761244293"
		[/random]
		[random]
			value="1700084194"
		[/random]
		[random]
			value="201067140"
		[/random]
		[random]
			value="1238470329"
		[/random]
		[random]
			value="1355667227"
		[/random]
		[random]
			value="2092688755"
		[/random]
		[random]
			value="1082698265"
		[/random]
		[random]
			value="573675401"
		[/random]
		[random]
			value="2095705965"
		[/random]
		[random]
			value="872846991"
		[/random]
		[random]
			value="675779553"
		[/random]
		[random]
			value="1698584063"
			[results]
				checksum="RUQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvKsMAS8wEVRB+JCszfJzd4kC+rc<MF13amk4nil5K7b35>-yp,+>8,eyb6ac"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="18,19,20,21,22,23"
			y="5,5,4,5,5,6"
		[/move]
	[/command]
	[command]
		[move]
			x="19,20,21"
			y="13,13,14"
		[/move]
	[/command]
	[command]
		[move]
			x="21,22"
			y="14,13"
		[/move]
	[/command]
	[command]
		[move]
			x="22,23"
			y="13,14"
		[/move]
	[/command]
	[command]
		[move]
			x="18,19"
			y="12,13"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,17,16,15"
			y="19,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="33,34,35"
			y="17,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="894285743"
		[/random]
		[random]
			value="860957054"
		[/random]
		[random]
			value="517464106"
		[/random]
		[random]
			value="231011888"
		[/random]
		[random]
			value="695039775"
		[/random]
		[random]
			value="613514446"
		[/random]
		[random]
			value="39664447"
		[/random]
		[random]
			value="1406098859"
		[/random]
		[random]
			value="351733815"
		[/random]
		[random]
			value="174518021"
		[/random]
		[random]
			value="60995061"
		[/random]
		[random]
			value="1794529319"
		[/random]
		[random]
			value="419544162"
		[/random]
		[random]
			value="852896439"
		[/random]
		[random]
			value="2134796316"
			[results]
				checksum="DB3s-,zQn1M2yLIrtl,yvEJs+TqLAH7qSCNCNSvmIJ>KNGxwmIQwSVVvQLyBGFwuCzBR9PMVRCroPzMEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rekko has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,16,16,15,14,13"
			y="18,17,16,16,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"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Krimburuk has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="29,30,30,31,31,32"
			y="7,7,8,9,10,10"
		[/move]
	[/command]
	[command]
		[move]
			x="31,32,33,34,35,35"
			y="10,10,10,10,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="27,27,27,28,28,28"
			y="9,10,11,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="24,25,26,26,26,27,28,29"
			y="5,6,6,7,8,9,9,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Die_Toten_Hosen has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sharapova has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="40,39,38,37,36"
			y="12,12,11,11,11"
		[/move]
	[/command]
	[command]
		[move]
			x="23,24"
			y="6,5"
		[/move]
	[/command]
	[command]
		[recruit]
			value="1"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="245690061"
		[/random]
		[random]
			value="248551181"
		[/random]
		[random]
			value="737414288"
		[/random]
		[random]
			value="1107661989"
		[/random]
		[random]
			value="531150513"
		[/random]
		[random]
			value="1541121200"
		[/random]
		[random]
			value="125265062"
		[/random]
		[random]
			value="165262217"
		[/random]
		[random]
			value="556344205"
		[/random]
		[random]
			value="7046000"
		[/random]
		[random]
			value="1733697296"
		[/random]
		[random]
			value="301561308"
		[/random]
		[random]
			value="223498912"
		[/random]
		[random]
			value="965483894"
		[/random]
		[random]
			value="152623218"
			[results]
				checksum="15,Wfc>cu2lH0olW9-5N-m<e6f60hfabkcij<4>i3h3e2.t0a1f<j870h0k565.Y0>ide9Pi80k.d8da021n<.26Z+40CN5c8b.-X,48E.7v3k3XdJFikGGNwGMoVOFH"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="24,24,25,25,26"
			y="5,6,7,8,8"
		[/move]
	[/command]
	[command]
		[move]
			x="23,22"
			y="14,14"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="sdf has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="31,32,33,33,34"
			y="13,13,14,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28,29,30"
			y="19,19,18,18,17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,14,13,12"
			y="20,19,19,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,13,12,12,11"
			y="16,15,14,13,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Budah has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="3"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="1709090988"
		[/random]
		[random]
			value="480465339"
		[/random]
		[random]
			value="1402739158"
		[/random]
		[random]
			value="23341942"
		[/random]
		[random]
			value="465937358"
		[/random]
		[random]
			value="1498885516"
		[/random]
		[random]
			value="1953686310"
		[/random]
		[random]
			value="1865953095"
		[/random]
		[random]
			value="1506275642"
		[/random]
		[random]
			value="331764950"
		[/random]
		[random]
			value="736244410"
		[/random]
		[random]
			value="168040215"
		[/random]
		[random]
			value="667570273"
		[/random]
		[random]
			value="140641255"
		[/random]
		[random]
			value="1084170589"
			[results]
				checksum="rQV6GBwD,UJ+7fNAQJ+xOoaC5U6DfS5lmb>+9w26zYBFaluj9yjnQ1omih>hik67n,e0IoZ07o9kcp0Ad568,m9n<X,+m+08797o60sxBFgnkEzrk-i.-tciji+H>s4C"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lisard has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="wers has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23,23,23,23"
			y="21,20,20,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]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="20comer has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="none has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,19,20"
			y="13,14,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="20"
				y="14"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1218626526"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="973322235"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1276024598"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1552227324"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="762285292"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="22,22,21"
			y="14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="21"
				y="16"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1663193520"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="966128227"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="79796628"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1184598647"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="617850609"
			[results]
				chance="40"
				damage="9"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="filippe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Ahalya has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="plk2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="36,36,35,34,33,32,31"
			y="11,12,13,13,14,14,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="15"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="87361694"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="488741338"
			[results]
				chance="60"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="244523077"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2066464890"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="5folhas has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Krimburuk has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="28,29,30,30"
			y="13,14,14,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="30"
				y="15"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="864853222"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="114120645"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="717055238"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="891819319"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1082097493"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rythlion has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="29,29,29,29,30,31,32,32"
			y="10,11,12,13,13,14,14,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="32"
				y="15"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="186060205"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="738848574"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1633775325"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1821347530"
			[results]
				chance="40"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1470322521"
			[results]
				chance="40"
				damage="5"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="cern has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="35,35,34,33,32,32,31"
			y="12,13,13,14,14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="16"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1626400742"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1883613950"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1298402532"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="745880157"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="233050044"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1365459131"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="32,32,32,32"
			y="10,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="26,26,25,25,24"
			y="8,7,7,6,5"
		[/move]
	[/command]
	[command]
		[move]
			x="23,23,24,25,26,26,27,28,29"
			y="5,6,6,7,7,8,9,9,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Death-to-Analog has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="7"
			x="18"
			y="5"
		[/recruit]
		[random]
			value="1614845769"
		[/random]
		[random]
			value="181588507"
		[/random]
		[random]
			value="109416280"
		[/random]
		[random]
			value="405391282"
		[/random]
		[random]
			value="924048128"
		[/random]
		[random]
			value="562990670"
		[/random]
		[random]
			value="1266642211"
		[/random]
		[random]
			value="1237854479"
		[/random]
		[random]
			value="217935814"
		[/random]
		[random]
			value="431745146"
		[/random]
		[random]
			value="185347002"
		[/random]
		[random]
			value="1603989282"
		[/random]
		[random]
			value="2064049055"
		[/random]
		[random]
			value="1155576125"
		[/random]
		[random]
			value="767280556"
			[results]
				checksum=",Ad3Y5f-Gtmspp5jHbEoRiSrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNLpM8mwoFomIhFlq1.CLW<<ddNv5EsLNHBNzkOI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="BigDaddy has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="5,6,6,7,8,9,9,10"
			y="14,13,12,12,11,11,10,9"
		[/move]
	[/command]
	[command]
		[move]
			x="24,23"
			y="5,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="Spazen has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="34,33"
			y="15,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="33"
				y="16"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="301761056"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="653080621"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="377842953"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1525547748"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,30,31,32,32"
			y="16,17,18,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="32"
				y="16"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1446754856"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="341465615"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2054671103"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1114382562"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="35,35,34,33"
			y="17,16,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="33"
				y="15"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1940318087"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2026953078"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="466355795"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="540607606"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1590622051"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2006360018"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1742993823"
			[results]
				chance="40"
				damage="6"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Emrizzles has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,24,25,25"
			y="19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,16,17,18,19,20"
			y="14,15,16,16,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="20"
				y="15"
			[/source]
			[destination]
				x="20"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="1527312351"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="900140588"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="893149370"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2033384126"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="joueur6 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,23,23,23,22,21"
			y="17,18,19,20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="103759062"
		[/random]
		[random]
			value="2018695364"
		[/random]
		[random]
			value="1754214208"
		[/random]
		[random]
			value="1203380822"
		[/random]
		[random]
			value="709014480"
		[/random]
		[random]
			value="715427851"
		[/random]
		[random]
			value="1665841338"
		[/random]
		[random]
			value="1874616023"
		[/random]
		[random]
			value="138388656"
		[/random]
		[random]
			value="38515178"
		[/random]
		[random]
			value="426017748"
		[/random]
		[random]
			value="1877986290"
		[/random]
		[random]
			value="1782248249"
		[/random]
		[random]
			value="2018052491"
		[/random]
		[random]
			value="1827577394"
			[results]
				checksum="oxj+sAh20PB0KmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw+PnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,12,12,12,13,14,15,16"
			y="19,18,17,16,16,15,15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,12,12,12,13"
			y="13,13,14,15,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="12,11"
			y="18,19"
		[/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"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[move]
			x="18,17,16,15,14,13,12"
			y="5,6,6,7,7,8,8"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="20"
				y="14"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="2055292715"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1055454018"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1903219266"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1352808526"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="922392042"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Akkarin has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="21"
				y="16"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="2108810415"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1899163332"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1587156911"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="540149834"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1099524460"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="rytdog has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="29,29,29,29,29,30,30,30,31"
			y="10,11,12,13,14,14,15,16,17"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="17"
			[/source]
			[destination]
				x="32"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1108374187"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1202839035"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="9515121"
			[results]
				chance="60"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1269583039"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2003119670"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="32,33,34,34"
			y="13,13,13,14"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="34"
				y="14"
			[/source]
			[destination]
				x="33"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1326732948"
			[results]
				chance="60"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="77587794"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="237351324"
			[results]
				chance="60"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="261279791"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1367852123"
			[results]
				chance="60"
				damage="10"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="30,30,30,30,30,30"
			y="15,16,17,18,19,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Sonnenwind has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,31,32,33"
			y="16,17,17,17"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="33"
				y="17"
			[/source]
			[destination]
				x="33"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="153730440"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2103147460"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="399546555"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1561001343"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="474330852"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="605175523"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfopps2Josh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Alex has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,31"
			y="15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="16"
			[/source]
			[destination]
				x="32"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1363137734"
			[results]
				chance="60"
				damage="22"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Krimzon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,22,21"
			y="5,4,4"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Mule has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Whiteagle has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="6"
			x="20"
			y="4"
		[/recruit]
		[random]
			value="1395353471"
		[/random]
		[random]
			value="1510082996"
		[/random]
		[random]
			value="447330288"
		[/random]
		[random]
			value="1604050764"
		[/random]
		[random]
			value="944196282"
		[/random]
		[random]
			value="290305412"
		[/random]
		[random]
			value="2097113811"
		[/random]
		[random]
			value="579460804"
		[/random]
		[random]
			value="1109621303"
		[/random]
		[random]
			value="1626992977"
		[/random]
		[random]
			value="1438425807"
		[/random]
		[random]
			value="139173718"
		[/random]
		[random]
			value="59998476"
		[/random]
		[random]
			value="1513044895"
		[/random]
		[random]
			value="363259573"
			[results]
				checksum="XBfX4cmcHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ei>ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j3D1<4M26i7zO.<BtyI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Juin has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="10,9,8,8,7,6,6"
			y="9,10,10,11,12,12,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="PinguinSteve has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,6,6"
			y="13,14,15"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="20"
				y="15"
			[/source]
			[destination]
				x="20"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="480189636"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1742446983"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="763453160"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1610421670"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wolfgen001Trev has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="dog has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28,29,30"
			y="19,19,18,18,17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="30"
				y="16"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="2137032945"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1845521043"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1125045468"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1634365853"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="sry for the luck on my side"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="33,32"
			y="16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="32"
				y="15"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1332721207"
			[results]
				chance="60"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1873393642"
			[results]
				chance="60"
				damage="6"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Asgraf has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="25,24,23,22"
			y="17,17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="22"
				y="16"
			[/source]
			[destination]
				x="21"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1979453656"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="499197476"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="its a game only"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Eskon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23,24,25"
			y="21,20,20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,16,17,18,19,20"
			y="14,15,16,16,16,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="20"
				y="16"
			[/source]
			[destination]
				x="21"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="257816930"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="737850569"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1382027667"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1470810400"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="guni has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,14,15,16"
			y="16,15,15,14"
		[/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"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="20"
				y="14"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="434947571"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1878228016"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1246477187"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1149514301"
			[results]
				chance="40"
				damage="6"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="21,21"
			y="16,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="21"
				y="15"
			[/source]
			[destination]
				x="20"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1989216304"
			[results]
				chance="40"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="536942064"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="769208732"
			[results]
				chance="40"
				damage="7"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="34,34,33"
			y="14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="33"
				y="16"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1011537789"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1607021209"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="802128576"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1591443047"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="860142568"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="30,30,30,31,32,32"
			y="20,19,18,18,17,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="32"
				y="16"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="2131849683"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="677492462"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2037939278"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="698996112"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="633444787"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="33,32,31"
			y="17,16,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="16"
			[/source]
			[destination]
				x="32"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1041601002"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1772446324"
			[results]
				chance="30"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="570475709"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="554281041"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2050933649"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1193398261"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="17"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="166199498"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="367229659"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1732125981"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1118212510"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="514922339"
			[results]
				chance="60"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,12,12,12,12"
			y="8,9,10,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="11,10,9,9,9"
			y="11,11,12,13,14"
		[/move]
	[/command]
	[command]
		[recruit]
			value="4"
			x="18"
			y="5"
		[/recruit]
		[random]
			value="1952097465"
		[/random]
		[random]
			value="1569106110"
		[/random]
		[random]
			value="621897703"
		[/random]
		[random]
			value="1928027762"
		[/random]
		[random]
			value="2110478469"
		[/random]
		[random]
			value="177530311"
		[/random]
		[random]
			value="965548341"
		[/random]
		[random]
			value="693036791"
		[/random]
		[random]
			value="1682824243"
		[/random]
		[random]
			value="195438224"
		[/random]
		[random]
			value="1837426419"
		[/random]
		[random]
			value="1294164254"
		[/random]
		[random]
			value="1190961681"
		[/random]
		[random]
			value="1130187310"
		[/random]
		[random]
			value="2122370694"
			[results]
				checksum="rhRteuCm>Im>OtyS+7ckzAuBMm0+Z8dI9a<pk8651Wl8Z5w.cldpBX>77bllckl2Y+5>aaii6<81mkljb2ifil7.WgZ2.h<5-XxS+j>k2403-p8TA9v1-xH1iTk+k58Y"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="20,21,21,21,21,21,21,21"
			y="4,5,6,7,8,9,10,11"
		[/move]
	[/command]
	[command]
		[move]
			x="6,6"
			y="15,14"
		[/move]
	[/command]
	[command]
		[move]
			x="21,20,19"
			y="4,4,5"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="still there?"
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="not sure i am connected"
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="give me a sign"
			side="1"
		[/speak]
	[/command]
	[command]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="that is where i got lost"
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="you turn"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20"
			y="16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="20"
				y="15"
			[/source]
			[destination]
				x="21"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="1429819774"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1793758769"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="907064619"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2027050407"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Slasher has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22"
			y="16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="22"
				y="15"
			[/source]
			[destination]
				x="21"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="930958722"
			[results]
				chance="40"
				damage="3"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="yes"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Kybas has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="good"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="benito has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="32,32,32,31,31,31,31"
			y="15,14,13,13,12,11,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="retto has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Ramen_noodlez has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,29,29,29,29,30"
			y="16,17,18,19,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="25,24,23,22,21"
			y="21,20,20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Margoti has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="0"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="1340468752"
		[/random]
		[random]
			value="722318032"
		[/random]
		[random]
			value="370275905"
		[/random]
		[random]
			value="1954071873"
		[/random]
		[random]
			value="1514787138"
		[/random]
		[random]
			value="1398984190"
		[/random]
		[random]
			value="828453092"
		[/random]
		[random]
			value="364514142"
		[/random]
		[random]
			value="1325084434"
		[/random]
		[random]
			value="1950185726"
		[/random]
		[random]
			value="726098762"
		[/random]
		[random]
			value="64953558"
		[/random]
		[random]
			value="798050301"
		[/random]
		[random]
			value="961534043"
		[/random]
		[random]
			value="1843657854"
			[results]
				checksum="oxj+sAh20PB0JmsQ56tLoxNPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw+MnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8EE25"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="LunaLoony has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="18,19,20,21,22,23,24,25,26"
			y="5,6,6,7,6,6,6,7,6"
		[/move]
	[/command]
	[command]
		[move]
			x="19,20,21,22,23,24"
			y="5,4,4,4,5,5"
		[/move]
	[/command]
	[command]
		[recruit]
			value="4"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="149994947"
		[/random]
		[random]
			value="1845031593"
		[/random]
		[random]
			value="651629131"
		[/random]
		[random]
			value="462791376"
		[/random]
		[random]
			value="849672734"
		[/random]
		[random]
			value="1811831680"
		[/random]
		[random]
			value="727751104"
		[/random]
		[random]
			value="516028392"
		[/random]
		[random]
			value="532065721"
		[/random]
		[random]
			value="632435621"
		[/random]
		[random]
			value="510123383"
		[/random]
		[random]
			value="1117482637"
		[/random]
		[random]
			value="688209192"
		[/random]
		[random]
			value="1800700700"
		[/random]
		[random]
			value="128361943"
			[results]
				checksum="rhRteuCm>Im>OtyS+7ckzAuBMm0+Z8dI9a<pk8651Wl8Z5w.cldpBX>77bllckl2Y+5>aaii6<81mkljb2ifil7.WgZ2.h<5-XxS+j>k2403-p8TA9v1-xH1iTk+k58Y"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="33,33,33,34,35,35"
			y="16,15,14,13,13,12"
		[/move]
	[/command]
	[command]
		[move]
			x="32,31,31,31,31"
			y="16,16,15,14,13"
		[/move]
	[/command]
	[command]
		[move]
			x="31,30,30,30,30,30,30,30"
			y="17,16,15,14,13,12,11,10"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="30"
				y="10"
			[/source]
			[destination]
				x="31"
				y="10"
			[/destination]
		[/attack]
		[random]
			value="540375113"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="200569226"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1485870695"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1468428906"
			[results]
				chance="60"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="829166035"
			[results]
				chance="40"
				damage="5"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Cissi has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="6,7,7,7,7,8,9,10"
			y="14,15,16,17,18,18,19,19"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="10"
				y="19"
			[/source]
			[destination]
				x="11"
				y="19"
			[/destination]
		[/attack]
		[random]
			value="451068815"
			[results]
				chance="40"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1212007945"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1087861851"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="105632255"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1361698376"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="9,9,10,10,11,12,12"
			y="14,15,15,16,17,17,18"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="12"
				y="18"
			[/source]
			[destination]
				x="11"
				y="19"
			[/destination]
		[/attack]
		[random]
			value="792092943"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="45990181"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="72231870"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1429872859"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1036079910"
			[results]
				chance="40"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1442497889"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,12,11"
			y="12,11,11"
		[/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="ArcGurenLagann has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28,29,30"
			y="19,19,18,18,17,17,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="30"
				y="16"
			[/source]
			[destination]
				x="31"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1744220996"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="823385390"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1541976563"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1317083385"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,19,18,17,16,15,14,13"
			y="15,16,16,17,17,18,18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="13"
				y="18"
			[/source]
			[destination]
				x="12"
				y="18"
			[/destination]
		[/attack]
		[random]
			value="1599815733"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1243386438"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2084014046"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="118711898"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="11"
				y="19"
			[/source]
			[destination]
				x="10"
				y="19"
			[/destination]
		[/attack]
		[random]
			value="2060112346"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="844088410"
			[results]
				chance="60"
				damage="2"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="22,22,21,20,19"
			y="15,16,17,17,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="1228784278"
		[/random]
		[random]
			value="782490917"
		[/random]
		[random]
			value="1595479332"
		[/random]
		[random]
			value="1866898757"
		[/random]
		[random]
			value="622620853"
		[/random]
		[random]
			value="1447290468"
		[/random]
		[random]
			value="470086250"
		[/random]
		[random]
			value="40860599"
		[/random]
		[random]
			value="1092606396"
		[/random]
		[random]
			value="930728922"
		[/random]
		[random]
			value="515904163"
		[/random]
		[random]
			value="175900221"
		[/random]
		[random]
			value="2061919136"
		[/random]
		[random]
			value="287317355"
		[/random]
		[random]
			value="781185991"
			[results]
				checksum="ACIByNSVYmLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9zumVnpCouMKPBb5oJGPbmz3o>.fjcflW4pf7m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="18"
			y="19"
		[/recruit]
		[random]
			value="1798344969"
		[/random]
		[random]
			value="2029961184"
		[/random]
		[random]
			value="1826770272"
		[/random]
		[random]
			value="273482174"
		[/random]
		[random]
			value="1329768004"
		[/random]
		[random]
			value="149372874"
		[/random]
		[random]
			value="314342773"
		[/random]
		[random]
			value="274890752"
		[/random]
		[random]
			value="1080101796"
		[/random]
		[random]
			value="830246937"
		[/random]
		[random]
			value="450790974"
		[/random]
		[random]
			value="994537284"
		[/random]
		[random]
			value="1117564292"
		[/random]
		[random]
			value="1231976965"
		[/random]
		[random]
			value="1952791686"
			[results]
				checksum="ACIByNSVYzLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9uumVnpCouMKPBb5OJGPbmz3o>.fjcflW4pf7m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,20,19,18,17"
			y="21,20,20,19,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="thekarl has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Khorne_Flakes 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]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Toxe3 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,22,23,23,22"
			y="11,11,12,13,13"
		[/move]
	[/command]
	[command]
		[recruit]
			value="6"
			x="22"
			y="4"
		[/recruit]
		[random]
			value="1978423751"
		[/random]
		[random]
			value="1244134094"
		[/random]
		[random]
			value="434456232"
		[/random]
		[random]
			value="636052047"
		[/random]
		[random]
			value="141879518"
		[/random]
		[random]
			value="323053452"
		[/random]
		[random]
			value="272340293"
		[/random]
		[random]
			value="1106115869"
		[/random]
		[random]
			value="2126476324"
		[/random]
		[random]
			value="1598702645"
		[/random]
		[random]
			value="1185395104"
		[/random]
		[random]
			value="1108742743"
		[/random]
		[random]
			value="1065742144"
		[/random]
		[random]
			value="66453659"
		[/random]
		[random]
			value="874127112"
			[results]
				checksum="XBfX4cmdHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ep8ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j3D1<4M96i7zO.<CyyI"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="slotUSB has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,23,24,24,24,25,26,26"
			y="5,6,6,7,8,9,9,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="NocheCerrada has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="30,31"
			y="10,10"
		[/move]
	[/command]
	[command]
		[move]
			x="26,27,28,29,30,31,32,33,34"
			y="6,7,6,7,7,8,8,9,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Molodogho has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="palango has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,32"
			y="16,15"
		[/move]
	[/command]
	[command]
		[move]
			x="35,35,34,33,32,31,31"
			y="12,13,13,14,14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="16"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="78428883"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="442190186"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1502559068"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="869349377"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="804412294"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="31,31,31,30"
			y="13,14,15,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="30"
				y="15"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1429220261"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1029023850"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="482352048"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1251123807"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="688754011"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="32,31,31"
			y="15,16,17"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="17"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="1436142455"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="590811001"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="102846336"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1877313126"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1234700994"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="986761527"
			[results]
				chance="60"
				damage="3"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="10,9,8,8,7"
			y="19,20,19,18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Pentarctagon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,12,11,10,9"
			y="18,17,17,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Hassan has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="laure2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Sturm 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="neila has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Overlama has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="alen has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="VXWiktorVX has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dauntasa has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,30,31,32,32"
			y="20,19,19,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="32"
				y="17"
			[/source]
			[destination]
				x="31"
				y="17"
			[/destination]
		[/attack]
		[random]
			value="235601680"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2116974668"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1378723985"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="48782706"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="30"
				y="16"
			[/source]
			[destination]
				x="31"
				y="17"
			[/destination]
		[/attack]
		[random]
			value="1403489752"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1183342969"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="211771917"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1352860242"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,25,26,27,28"
			y="19,20,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="13,12,11,10,9,8"
			y="18,18,19,18,19,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="8"
				y="18"
			[/source]
			[destination]
				x="7"
				y="18"
			[/destination]
		[/attack]
		[random]
			value="1857009629"
			[results]
				chance="60"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="70975117"
			[results]
				chance="60"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1860212110"
			[results]
				chance="60"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1554693857"
			[results]
				chance="60"
				damage="7"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="19,20,21,22,23,24"
			y="18,18,19,19,20,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,19,19,19,20"
			y="19,18,18,17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="isril has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,18,19,20,21"
			y="20,19,20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="1"
			x="23"
			y="20"
		[/recruit]
		[random]
			value="1097392586"
		[/random]
		[random]
			value="456299468"
		[/random]
		[random]
			value="1771357434"
		[/random]
		[random]
			value="1761148720"
		[/random]
		[random]
			value="1159760900"
		[/random]
		[random]
			value="1793096002"
		[/random]
		[random]
			value="1226502862"
		[/random]
		[random]
			value="1723105303"
		[/random]
		[random]
			value="151864411"
		[/random]
		[random]
			value="1192552855"
		[/random]
		[random]
			value="249478675"
		[/random]
		[random]
			value="1563115836"
		[/random]
		[random]
			value="1262283"
		[/random]
		[random]
			value="1318944725"
		[/random]
		[random]
			value="919727741"
			[results]
				checksum="ACIByNSVYmLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9zumVnpCouMKPBb5OJGPbmz3o>.fjcflW4p97m5p7"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="conor has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dauntasa has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="poor horse"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="rucu has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Conqueors has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,32,33,33"
			y="16,15,16,17"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="33"
				y="17"
			[/source]
			[destination]
				x="32"
				y="17"
			[/destination]
		[/attack]
		[random]
			value="1994599390"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2015573606"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1167055270"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="413303195"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1306368140"
			[results]
				chance="60"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Deo has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="26,27,28,28,29,29,30,31,31"
			y="10,11,11,12,13,14,14,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="16"
			[/source]
			[destination]
				x="30"
				y="16"
			[/destination]
		[/attack]
		[random]
			value="654698832"
			[results]
				chance="60"
				damage="20"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="helmut has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="isril has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="this one is not poor"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="30,30,30,30,30,30"
			y="15,16,17,18,19,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Kefeus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,31,31,31,31"
			y="17,16,15,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="tishbe has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="34,34,35,36,36,35,34,34,33"
			y="9,10,11,11,12,13,13,14,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lucifer626 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="22,21,21,21,21,21,21"
			y="4,5,6,7,8,9,10"
		[/move]
	[/command]
	[command]
		[recruit]
			value="3"
			x="18"
			y="5"
		[/recruit]
		[random]
			value="1177554125"
		[/random]
		[random]
			value="215352566"
		[/random]
		[random]
			value="1378071162"
		[/random]
		[random]
			value="1272015163"
		[/random]
		[random]
			value="1789478076"
		[/random]
		[random]
			value="1774205234"
		[/random]
		[random]
			value="82269105"
		[/random]
		[random]
			value="343775603"
		[/random]
		[random]
			value="1853713889"
		[/random]
		[random]
			value="605941999"
		[/random]
		[random]
			value="1155122634"
		[/random]
		[random]
			value="1582312036"
		[/random]
		[random]
			value="126923761"
		[/random]
		[random]
			value="217762905"
		[/random]
		[random]
			value="1591020043"
			[results]
				checksum="eKEMoMtJ2Sm2IxNK-ruIvyJD8uFQquOORqLQAKsDuHBwnqvBFyQvVsL8qHTmQQNRqrWuTuTxDUFQDPxfDLuyOcqNHBnCR5lymlS<1Ip648,gYgdg-Lb7,b2<2j8d74eh"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Pandora has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Arakan007 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="9,8"
			y="17,17"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="8"
				y="17"
			[/source]
			[destination]
				x="8"
				y="18"
			[/destination]
		[/attack]
		[random]
			value="1508458683"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1155859713"
			[results]
				chance="30"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="734738691"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="452315695"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="589973062"
			[results]
				chance="60"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1132060432"
			[results]
				chance="60"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="32,32,32,32,32,31,30"
			y="17,18,19,20,21,22,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="30"
				y="21"
			[/source]
			[destination]
				x="30"
				y="20"
			[/destination]
		[/attack]
		[random]
			value="1111452878"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1471224147"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="818977176"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1048782866"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="790429143"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="23,24,25"
			y="20,20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="24,24,25,25"
			y="19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="28,29"
			y="20,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="29"
				y="21"
			[/source]
			[destination]
				x="30"
				y="20"
			[/destination]
		[/attack]
		[random]
			value="1787994684"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1523189659"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1636932270"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="713106647"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Richardus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="eloco has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="subLime has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="8,9"
			y="18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="9"
				y="18"
			[/source]
			[destination]
				x="8"
				y="17"
			[/destination]
		[/attack]
		[random]
			value="538205237"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1709051322"
			[results]
				chance="30"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="672444586"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2074159117"
			[results]
				chance="30"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="linduxed has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="NocheCerrada has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Richardus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20"
			y="15,16"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Araja has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20"
			y="16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Astus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="30,31"
			y="20,21"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="21"
			[/source]
			[destination]
				x="30"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="190510370"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="99364314"
			[results]
				chance="50"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2103359613"
			[results]
				chance="30"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1495192883"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="2027411183"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="33,32,32,31,31,30"
			y="17,17,18,19,20,20"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="30"
				y="20"
			[/source]
			[destination]
				x="30"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="1982168140"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="618667593"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="368458326"
			[results]
				chance="30"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1582441076"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="153323952"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Richardus has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="33,32,32,32,32,33"
			y="15,15,16,17,18,19"
		[/move]
	[/command]
	[command]
		[move]
			x="31,31,30"
			y="16,17,17"
		[/move]
	[/command]
	[command]
		[move]
			x="30,31"
			y="17,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Micha has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="33,32,31"
			y="19,19,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Rigor has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,31,31,31"
			y="13,14,15,16"
		[/move]
	[/command]
	[command]
		[move]
			x="18,17,16,15,14"
			y="5,6,6,7,7"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Micha has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="hogar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,8,8,8,7,6,6,6"
			y="17,16,15,14,14,13,12,11"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Serious_Sam has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Arakan007 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="11,10,9,8,7,7"
			y="11,11,11,11,12,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="isril has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,20,20,19,19"
			y="10,10,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="19,18"
			y="13,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="A_monkey has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="5"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="1938537282"
		[/random]
		[random]
			value="2062664290"
		[/random]
		[random]
			value="316096664"
		[/random]
		[random]
			value="743956691"
		[/random]
		[random]
			value="1759766979"
		[/random]
		[random]
			value="246200285"
		[/random]
		[random]
			value="811487093"
		[/random]
		[random]
			value="969952384"
		[/random]
		[random]
			value="2006718626"
		[/random]
		[random]
			value="1687058998"
		[/random]
		[random]
			value="288737129"
		[/random]
		[random]
			value="1799217668"
		[/random]
		[random]
			value="1490308737"
		[/random]
		[random]
			value="1513604366"
		[/random]
		[random]
			value="1313933073"
			[results]
				checksum="irp,4nc1oNO1LLyKmJLIEhoF>vyBA6mszOAMDTywuzyODCrTtRLwFwmIsr1QENmxPFHFw.RFKFnqypNKoM8mwoFomIhFlq1.CLW<<ddBfkHDONNHvMSO1I9LGCHpACmL"
			[/results]
		[/random]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Sirmonius_III has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Dead_Fish has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Refugee has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="30,30,31,32,32"
			y="21,22,23,22,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="32"
				y="21"
			[/source]
			[destination]
				x="31"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="727630756"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="372271325"
			[results]
				chance="30"
				damage="7"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="29,30"
			y="21,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="6"
			x="24"
			y="19"
		[/recruit]
		[random]
			value="2065349249"
		[/random]
		[random]
			value="975112996"
		[/random]
		[random]
			value="1773134670"
		[/random]
		[random]
			value="613899494"
		[/random]
		[random]
			value="1644251350"
		[/random]
		[random]
			value="987965894"
		[/random]
		[random]
			value="1977527862"
		[/random]
		[random]
			value="1759715378"
		[/random]
		[random]
			value="559284548"
		[/random]
		[random]
			value="1459821948"
		[/random]
		[random]
			value="23724665"
		[/random]
		[random]
			value="506524098"
		[/random]
		[random]
			value="1422221954"
			[results]
				checksum="DTLTPwRQczAcRKLLbq0Mv5QyqrQOOBLOyBMIwFivztGUowQpTBRsw,0zs3P8rB49xHwm.opR7jouswcn.Adz9fQtQo8c1O8LyzFARPPnDHfaE>8vfLObeidgl03fnU6<"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,10,9,9"
			y="19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,15,15"
			y="14,14,13"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="goesw2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="VXWiktorW has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,14"
			y="13,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,22,23"
			y="21,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SSSR has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="30,29"
			y="20,21"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="29"
				y="21"
			[/source]
			[destination]
				x="30"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="2144665894"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1393993326"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="2077820988"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1385827209"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="585069183"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="69746857"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1552918449"
			[results]
				chance="50"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Neves has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,30"
			y="21,20"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="30"
				y="20"
			[/source]
			[destination]
				x="30"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="1682136613"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="386609469"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="923099999"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="443536352"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="1226825638"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="1848131497"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="589285690"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="jules has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,32,32,32,32,31"
			y="18,18,19,20,21,22"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="31"
				y="22"
			[/source]
			[destination]
				x="30"
				y="21"
			[/destination]
		[/attack]
		[random]
			value="222175432"
			[results]
				chance="40"
				damage="25"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="WIF_Konrad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,31,30,30,30,30,30,30"
			y="10,11,11,12,13,14,15,16"
		[/move]
	[/command]
	[command]
		[move]
			x="23,24,24,25,25,26"
			y="5,5,6,7,8,8"
		[/move]
	[/command]
	[command]
		[recruit]
			value="5"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="675527842"
		[/random]
		[random]
			value="21156082"
		[/random]
		[random]
			value="1658653090"
		[/random]
		[random]
			value="91666821"
		[/random]
		[random]
			value="435102609"
		[/random]
		[random]
			value="91003688"
		[/random]
		[random]
			value="1914402051"
		[/random]
		[random]
			value="1634702492"
		[/random]
		[random]
			value="365630901"
		[/random]
		[random]
			value="1956944749"
		[/random]
		[random]
			value="552035253"
		[/random]
		[random]
			value="1413618831"
		[/random]
		[random]
			value="11375174"
		[/random]
		[random]
			value="866597404"
		[/random]
		[random]
			value="218362544"
			[results]
				checksum="jup,4nc1oNO1LLyKmJLIEhoF>vyBA6mszOAMDTywuzyODCrTtRLwFwmIsr1QENmxPFHFw.RFKFnqypNLtM8mwoFomIhFlq1.CLW<<ddBfkHDONNHvHQO1I9LGCHpACmL"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="duh has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="14,13,12,12,12"
			y="7,8,8,9,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SpoOkyMagician has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="7,7,8,9,10,11"
			y="13,12,11,11,10,11"
		[/move]
	[/command]
	[command]
		[move]
			x="6,6,7,7,7,8,8,9"
			y="11,10,10,9,8,7,6,6"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="joan has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Konradyn has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="31,30"
			y="19,19"
		[/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="Synik has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="ok, i have no chances"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SpoOkyMagician has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="i concede"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Araja has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="akkon"
			message="gg"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="die2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="ced"
			message="gg"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="270000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="l3l0 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="akkon has left the game."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ced takes control of side 2."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Elfador has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ced droids side 2."
		[/speak]
	[/command]
[/replay]
[snapshot]
[/snapshot]
[replay_start]
	completion="running"
	current_tod="0"
	experience_modifier="70"
	id="multiplayer_Basilisk"
	map_data="border_size=1
usage=map

_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm^Xm       , Mm^Xm       , Mm^Xm       , Gs^Fp       , Mm^Xm       , Gs^Fp       , Hh          , Gs^Fms      , Ww          , Ww          , Ww          , Gs^Fp       , Gs^Fms      , Hh          , Mm^Xm       , Gs^Fp       , Mm^Xm       , Mm^Xm       , Mm          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Gs^Fp       , Mm          , Gg^Fet      , Mm          , Gs^Fp       , Mm^Xm       , Gs^Fms      , Gg^Ve       , Gg          , Hh          , Mm          , Ww          , Gs^Fp       , Hh          , Gg          , Mm          , Gg^Fet      , Mm^Xm       , Mm          , Mm          , Hh          , Gs^Fp       , Ggf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Hh          , Ggf         , Gg          , Hh          , Gg^Ve       , Hh          , Gs^Fms      , Mm          , Mm          , Ggf         , Gg          , Gg          , Ch          , 1 Kh        , Ch          , Gg          , Hh          , Gg          , Gg          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gs^Fms      , Wwf         , Wwf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Kh          , Ch          , Gg          , Wwf         , Gg          , Ch          , Kh          , Gs^Fp       , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Mm          , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Gg          , Re          , Gg          , Gg          , Gg          , Gg          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Hh          , Gs^Fp       , Gg^Ve       , Gg          , Ggf         , Mm          , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Xu          , Xu          , Wwf         , Gg          , Gg          , Gs^Fp       , Hh          , Gs^Fp       , Gg          , Gg          , Re          , Re          , Xu          , Re          , Re^Uf       , Gg          , Re          , Wwf         , Gg          , Gs^Fms      , Gg          , Re          , Re          , Re          , Xu          , Gg          , Gg          , Hh          , Gg          , Gg          , Gs^Fp       , Wwf         , Wwf         , Xu          , Uh          , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Mm          , Gg          , Gg          , Re^Uf       , Mm          , Gg          , Re          , Re          , Ww          , Xu          , Uh          , Uu^Vud      , Xu          , Re          , Wwf         , Wwf         , Re          , Gg          , Re          , Re          , Wwf         , Xu          , Xu          , Re^Uf       , Re          , Gg          , Gg          , Hh          , Ggf         , Hh          , Wwf         , Xu          , Wwf         , Uu          , Uu^Uf       , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Gs^Fp       , Hh          , Hh          , Gg          , Gg          , Hh          , Gs^Fms      , Gg          , Re          , Ww          , Wo          , Ww          , Wwf         , Wwf         , Uh          , Uu^Uf       , Wwf         , Ww          , Ss^Vhs      , Re          , Xu          , Wwf         , Ur          , Ur          , Re          , Re          , Gs^Fms      , Hh          , Gg^Uf       , Gg          , Gg          , Re          , Re^Uf       , Wwf         , Wwf         , Uu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Wwf         , Wwf         , Ggf         , Ggf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Ww          , Ww          , Ww          , Xu          , Uh          , Xu          , Ur          , Ww          , Ww          , Ww          , Xu          , Ww          , Uh          , Uu^Vu       , Re          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Gg          , Gg          , Gg          , Re          , Gs^Fp       , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Gs^Fms      , Gs^Fp       , Re^Uf       , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Ss^Vhs      , Gg          , Re          , Wwf         , Uh          , Xu          , Ur          , Xu          , Wwf         , Ww          , Wo          , Uu          , Uh          , Ww          , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Gs^Fms      , Hh          , Hh          , Gg          , Gg          , Re          , Re          , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Mm          , Hh          , Re          , Re          , Gg          , Gg          , Hh          , Gs^Fp       , Ss          , Gg          , Hh          , Re          , Wwf         , Xu          , Xu          , Ur          , Wwf         , Wwf         , Ww          , Uu^Uf       , Ww          , Ww          , Wwf         , Uu^Uf       , Xu          , Uh          , Wwf         , Re          , Hh          , Hh          , Mm          , Gs^Fp       , Hh          , Gs^Fp       , Gg          , Re          , Re          , Wwf         , Wwf         , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Wwf         , Re^Uf       , Re          , Gg          , Gg          , Gs^Fp       , Re^Uf       , Gs^Fms      , Mm          , Gs^Fp       , Hh          , Re          , Re          , Uh          , Xu          , Uu^Uf       , Ww          , Ww          , Uu          , Uu^Uf       , Ww          , Wwf         , Xu          , Ur          , Xu          , Xu          , Wwf         , Re          , Re          , Gs^Fp       , Gg          , Ss          , Gg          , Gg          , Gg          , Gg          , Gg          , Re^Uf       , Mm          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Re          , Gg          , Gg          , Gg          , Gg          , Hh          , Gg          , Hh          , Gg          , Gg          , Gg          , Re          , Uu^Vu       , Xu          , Ww          , Uh          , Ww          , Wo          , Ww          , Wwf         , Xu          , Ur          , Xu          , Uh          , Ww          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ggf         , Hh          , Hh          , Gs^Fp       , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Wwf         , Hh          , Hh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Ur          , Uh          , Xu          , Xu          , Ss^Vhs      , Ww          , Wwf         , Ur          , Uh          , Uh          , Wwf         , Ww          , Wo          , Ww          , Re          , Re          , Gg          , Gg          , Gs^Fms      , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Wwf         , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Gs^Fp       , Re          , Gg          , Ggf         , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Xu          , Ur          , Wwf         , Wwf         , Re          , Re          , Re          , Ww          , Wwf         , Uu^Uf       , Xu          , Wwf         , Uh          , Ww          , Ww          , Ww          , Re          , Ss^Vhs      , Gg          , Hh          , Mm          , Hh          , Re^Uf       , Gg          , Gg          , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Uu^Uf       , Uu          , Wwf         , Wwf         , Wwf         , Re          , Hh          , Mm          , Gs^Fp       , Gg          , Gg          , Uh          , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Wwf         , Re          , Re          , Re^Uf       , Uu^Vud      , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Gs^Fms      , Ggf         , Gs^Fp       , Gg          , Gg          , Wwf         , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Uh          , Xu          , Xu          , Wwf         , Re          , Re^Uf       , Ggf         , Gg^Uf       , Gs^Fp       , Gg          , Gg          , Re          , Gg          , Re          , Gg          , Gs^Fp       , Gg          , Wwf         , Gg          , Gg          , Gg          , Re          , Re          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wwf         , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Xu          , Xu          , Wwf         , Re          , Gs^Fms      , Gg          , Gg^Ve       , Ggf         , Gg          , Gg          , Gg          , Ggf         , Gg          , Kh          , Gg          , Gg          , Wwf         , Gg          , Gg          , Kh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Re          , Mm          , Hh          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Gs^Fms      , Gg          , Ch          , Ch          , Wwf         , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Gg^Fet      , Gg          , Gg^Ve       , Gg          , Gg          , Gs^Fp       , Gg          , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Wwf         , Re          , Re          , Gs^Fp       , Re          , Gg          , Hh          , Hh          , Gs^Fms      , Gg          , Gg          , Hh          , Mm          , 2 Kh        , Gs^Fp       , Gg          , Gg          , Gg^Ve       , Gs^Fp       , Gg          , Hh          , Hh          , Gs^Fp       , Hh          , Gs^Fms      , Gg          , Wwf         , Wwf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Wwf         , Re          , Re          , Re          , Gs^Fp       , Mm          , Mm          , Mm          , Mm          , Gs^Fms      , Gg^Fet      , Hh          , Ww          , Hh          , Hh          , Gs^Fms      , Hh          , Mm          , Hh          , Mm^Xm       , Mm          , Mm          , Hh          , Gs^Fp       , Mm          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm          , Hh          , Hh          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm          , Mm^Xm       , Ww          , Ww          , Mm          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm          , Mm^Xm       , Mm          , Hh          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm^Xm       , _off^_usr   , Mm          , _off^_usr   , Gs^Fp       , _off^_usr   , Mm^Xm       , _off^_usr   , Ww          , _off^_usr   , Gs^Fp       , _off^_usr   , Hh          , _off^_usr   , Gs^Fp       , _off^_usr   , Mm^Xm       , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
"
	mp_countdown="yes"
	mp_countdown_action_bonus="20"
	mp_countdown_init_time="270"
	mp_countdown_turn_bonus="200"
	mp_fog="yes"
	mp_shroud="no"
	mp_use_map_settings="no"
	mp_village_gold="2"
	name="2p - Caves of the Basilisk"
	next_underlying_unit_id="39"
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	random_calls="0"
	random_seed="2000383187"
	savegame="yes"
	turn="9"
	turn_at="9"
	turns="-1"
	version="1.6"
	[snapshot]
		campaign_type="multiplayer"
		completion="running"
		current_tod="3"
		description="These caves were once the lair of Chak'kso Ney'yks, a legendary Elder Basilisk. The petrified forms of his victims remain as monuments to his savage power."
		difficulty="NORMAL"
		end_text_duration="0"
		experience_modifier="70"
		hash="McPgEzp.LJt7h.t1Qr.c0wdN6DSMrFSDz4LpPy.MjaHg-SJ4NO6RN7,AJkIOwBZE.K6Gt>F,tbOGluI+4Fgcg7SDu,wQihAGrihF1c3lurN0vQXAvq<LoFHYPrX2RHE1"
		id="multiplayer_Basilisk"
		label="2p - Caves of the Basilisk"
		map_data="border_size=1
usage=map

_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm^Xm       , Mm^Xm       , Mm^Xm       , Gs^Fp       , Mm^Xm       , Gs^Fp       , Hh          , Gs^Fms      , Ww          , Ww          , Ww          , Gs^Fp       , Gs^Fms      , Hh          , Mm^Xm       , Gs^Fp       , Mm^Xm       , Mm^Xm       , Mm          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Gs^Fp       , Mm          , Gg^Fet      , Mm          , Gs^Fp       , Mm^Xm       , Gs^Fms      , Gg^Ve       , Gg          , Hh          , Mm          , Ww          , Gs^Fp       , Hh          , Gg          , Mm          , Gg^Fet      , Mm^Xm       , Mm          , Mm          , Hh          , Gs^Fp       , Ggf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Hh          , Ggf         , Gg          , Hh          , Gg^Ve       , Hh          , Gs^Fms      , Mm          , Mm          , Ggf         , Gg          , Gg          , Ch          , 1 Kh        , Ch          , Gg          , Hh          , Gg          , Gg          , Gs^Fp       , Gg          , Gg          , Gg          , Gg          , Gs^Fms      , Wwf         , Wwf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Kh          , Ch          , Gg          , Wwf         , Gg          , Ch          , Kh          , Gs^Fp       , Mm          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Mm          , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Gg          , Re          , Gg          , Gg          , Gg          , Gg          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Hh          , Gs^Fp       , Gg^Ve       , Gg          , Ggf         , Mm          , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Xu          , Xu          , Wwf         , Gg          , Gg          , Gs^Fp       , Hh          , Gs^Fp       , Gg          , Gg          , Re          , Re          , Xu          , Re          , Re^Uf       , Gg          , Re          , Wwf         , Gg          , Gs^Fms      , Gg          , Re          , Re          , Re          , Xu          , Gg          , Gg          , Hh          , Gg          , Gg          , Gs^Fp       , Wwf         , Wwf         , Xu          , Uh          , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Mm          , Gg          , Gg          , Re^Uf       , Mm          , Gg          , Re          , Re          , Ww          , Xu          , Uh          , Uu^Vud      , Xu          , Re          , Wwf         , Wwf         , Re          , Gg          , Re          , Re          , Wwf         , Xu          , Xu          , Re^Uf       , Re          , Gg          , Gg          , Hh          , Ggf         , Hh          , Wwf         , Xu          , Wwf         , Uu          , Uu^Uf       , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Gs^Fp       , Hh          , Hh          , Gg          , Gg          , Hh          , Gs^Fms      , Gg          , Re          , Ww          , Wo          , Ww          , Wwf         , Wwf         , Uh          , Uu^Uf       , Wwf         , Ww          , Ss^Vhs      , Re          , Xu          , Wwf         , Ur          , Ur          , Re          , Re          , Gs^Fms      , Hh          , Gg^Uf       , Gg          , Gg          , Re          , Re^Uf       , Wwf         , Wwf         , Uu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Wwf         , Wwf         , Ggf         , Ggf         , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Ww          , Ww          , Ww          , Xu          , Uh          , Xu          , Ur          , Ww          , Ww          , Ww          , Xu          , Ww          , Uh          , Uu^Vu       , Re          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Gg          , Gg          , Gg          , Re          , Gs^Fp       , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Gs^Fms      , Gs^Fp       , Re^Uf       , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Ss^Vhs      , Gg          , Re          , Wwf         , Uh          , Xu          , Ur          , Xu          , Wwf         , Ww          , Wo          , Uu          , Uh          , Ww          , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Gs^Fms      , Hh          , Hh          , Gg          , Gg          , Re          , Re          , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Mm          , Hh          , Re          , Re          , Gg          , Gg          , Hh          , Gs^Fp       , Ss          , Gg          , Hh          , Re          , Wwf         , Xu          , Xu          , Ur          , Wwf         , Wwf         , Ww          , Uu^Uf       , Ww          , Ww          , Wwf         , Uu^Uf       , Xu          , Uh          , Wwf         , Re          , Hh          , Hh          , Mm          , Gs^Fp       , Hh          , Gs^Fp       , Gg          , Re          , Re          , Wwf         , Wwf         , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Wwf         , Re^Uf       , Re          , Gg          , Gg          , Gs^Fp       , Re^Uf       , Gs^Fms      , Mm          , Gs^Fp       , Hh          , Re          , Re          , Uh          , Xu          , Uu^Uf       , Ww          , Ww          , Uu          , Uu^Uf       , Ww          , Wwf         , Xu          , Ur          , Xu          , Xu          , Wwf         , Re          , Re          , Gs^Fp       , Gg          , Ss          , Gg          , Gg          , Gg          , Gg          , Gg          , Re^Uf       , Mm          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Re          , Gg          , Gg          , Gg          , Gg          , Hh          , Gg          , Hh          , Gg          , Gg          , Gg          , Re          , Uu^Vu       , Xu          , Ww          , Uh          , Ww          , Wo          , Ww          , Wwf         , Xu          , Ur          , Xu          , Uh          , Ww          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Ggf         , Hh          , Hh          , Gs^Fp       , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Wwf         , Hh          , Hh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Re          , Re          , Ur          , Uh          , Xu          , Xu          , Ss^Vhs      , Ww          , Wwf         , Ur          , Uh          , Uh          , Wwf         , Ww          , Wo          , Ww          , Re          , Re          , Gg          , Gg          , Gs^Fms      , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Wwf         , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Gs^Fp       , Re          , Gg          , Ggf         , Gg          , Gg          , Gg          , Gg          , Gs^Fp       , Xu          , Ur          , Wwf         , Wwf         , Re          , Re          , Re          , Ww          , Wwf         , Uu^Uf       , Xu          , Wwf         , Uh          , Ww          , Ww          , Ww          , Re          , Ss^Vhs      , Gg          , Hh          , Mm          , Hh          , Re^Uf       , Gg          , Gg          , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Uu^Uf       , Uu          , Wwf         , Wwf         , Wwf         , Re          , Hh          , Mm          , Gs^Fp       , Gg          , Gg          , Uh          , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Wwf         , Re          , Re          , Re^Uf       , Uu^Vud      , Xu          , Xu          , Re          , Re          , Gg          , Gg          , Gg          , Gs^Fms      , Ggf         , Gs^Fp       , Gg          , Gg          , Wwf         , Wwf         , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , Xu          , Wwf         , Uh          , Xu          , Xu          , Wwf         , Re          , Re^Uf       , Ggf         , Gg^Uf       , Gs^Fp       , Gg          , Gg          , Re          , Gg          , Re          , Gg          , Gs^Fp       , Gg          , Wwf         , Gg          , Gg          , Gg          , Re          , Re          , Re          , Re          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wwf         , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Xu          , Xu          , Wwf         , Re          , Gs^Fms      , Gg          , Gg^Ve       , Ggf         , Gg          , Gg          , Gg          , Ggf         , Gg          , Kh          , Gg          , Gg          , Wwf         , Gg          , Gg          , Kh          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Gg          , Wwf         , Xu          , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Xu          , Wwf         , Wwf         , Re          , Mm          , Hh          , Gg          , Gg          , Gg          , Gg^Ve       , Gg          , Gs^Fms      , Gg          , Ch          , Ch          , Wwf         , Ch          , Ch          , Gg          , Gg          , Gg          , Gg          , Gg^Fet      , Gg          , Gg^Ve       , Gg          , Gg          , Gs^Fp       , Gg          , Wwf         , Xu          , Xu          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Xu          , Wwf         , Re          , Re          , Gs^Fp       , Re          , Gg          , Hh          , Hh          , Gs^Fms      , Gg          , Gg          , Hh          , Mm          , 2 Kh        , Gs^Fp       , Gg          , Gg          , Gg^Ve       , Gs^Fp       , Gg          , Hh          , Hh          , Gs^Fp       , Hh          , Gs^Fms      , Gg          , Wwf         , Wwf         , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Wwf         , Re          , Re          , Re          , Gs^Fp       , Mm          , Mm          , Mm          , Mm          , Gs^Fms      , Gg^Fet      , Hh          , Ww          , Hh          , Hh          , Gs^Fms      , Hh          , Mm          , Hh          , Mm^Xm       , Mm          , Mm          , Hh          , Gs^Fp       , Mm          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm          , Hh          , Hh          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm          , Mm^Xm       , Ww          , Ww          , Mm          , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm^Xm       , Mm          , Mm^Xm       , Mm          , Hh          , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , Mm^Xm       , _off^_usr   , Mm          , _off^_usr   , Gs^Fp       , _off^_usr   , Mm^Xm       , _off^_usr   , Ww          , _off^_usr   , Gs^Fp       , _off^_usr   , Hh          , _off^_usr   , Gs^Fp       , _off^_usr   , Mm^Xm       , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
_off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   , _off^_usr   
"
		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="no"
		mp_village_gold="2"
		name="2p - Caves of the Basilisk"
		next_underlying_unit_id="39"
		objectives="Victory:
@Defeat enemy leader(s)"
		observer="no"
		playing_team="1"
		random_calls="0"
		random_seed="2000383187"
		random_start_time="yes"
		snapshot="yes"
		turn_at="9"
		turns="-1"
		unit_wml_ids="Armageddon Drake,Cavalryman,Direwolf Rider,Elder Wose,Elvish Archer,Elvish Captain,Elvish Fighter,Elvish Marksman,Elvish Shaman,Fencer,Grand Knight,Grand Marshal,Horseman,Iron Mauler,Mermaid Siren,Merman Fighter,Merman Hunter,Naga Myrmidon,Red Mage,Saurian Flanker,Saurian Oracle,Sea Serpent,Sky Drake,Spearman,era_events"
		version="1.6"
		[side]
			action_bonus_count="0"
			aggression="0.5"
			allow_player="yes"
			caution="0.25"
			colour="1"
			controller="human"
			countdown_time="270000"
			current_player="ced"
			disallow_observers="no"
			fog="yes"
			global_recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
			gold="11"
			hidden="no"
			id="ced1"
			income="0"
			leader_value="3"
			name="ced"
			no_leader="yes"
			number_of_possible_recruits_to_force_recruit="3.1"
			objectives="Victory:
@Defeat enemy leader(s)"
			objectives_changed="no"
			recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
			recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
			save_id="ced1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			start_gold="100"
			team_name="1"
			user_team_name="Team 1"
			village_gold="2"
			village_value="1"
			villages_per_scout="8"
			[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]
			[ai]
				villages_per_scout="8"
			[/ai]
			[village]
				x="11"
				y="11"
			[/village]
			[village]
				x="12"
				y="4"
			[/village]
			[village]
				x="17"
				y="3"
			[/village]
			[village]
				x="17"
				y="8"
			[/village]
			[village]
				x="22"
				y="9"
			[/village]
			[village]
				x="26"
				y="10"
			[/village]
			[village]
				x="30"
				y="20"
			[/village]
			[village]
				x="31"
				y="6"
			[/village]
			[village]
				x="31"
				y="10"
			[/village]
			[village]
				x="31"
				y="16"
			[/village]
			[unit]
				advances_to="Arch Mage,Silver Mage"
				alignment="neutral"
				allow_changes="yes"
				allow_player="yes"
				alpha="256"
				attacks_left="1"
				canrecruit="yes"
				colour="1"
				controller="human"
				cost="40"
				current_player="ced"
				die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				fog="yes"
				gender="female"
				gold="100"
				goto_x="-999"
				goto_y="-999"
				hitpoints="42"
				id="ced1"
				image="units/human-magi/red-mage+female.png"
				income="0"
#textdomain wesnoth-units
				language_name=_ "female^Red Mage"
				leader="Lieutenant,Swordsman,Pikeman,Javelineer,Shock Trooper,Longbowman,White Mage,Red Mage"
				level="2"
				max_attacks="1"
				max_experience="70"
				max_hitpoints="42"
				max_moves="5"
				movement="5"
				movement_type="smallfoot"
				moves="3"
				mp_countdown="yes"
				mp_countdown_action_bonus="20"
				mp_countdown_init_time="270"
				mp_countdown_reservoir_time="270"
				mp_countdown_turn_bonus="200"
				name="ced"
				profile="portraits/humans/mage-red+female.png"
				race="human"
				random_leader="Lieutenant,Swordsman,Pikeman,Javelineer,Longbowman,Red Mage"
				random_traits="no"
				recruit="Cavalryman,Horseman,Spearman,Fencer,Heavy Infantryman,Bowman,Mage,Merman Fighter"
				resting="no"
				save_id="ced1"
				share_maps="no"
				share_view="yes"
				shroud="no"
				side="1"
				team_name="1"
				terrain_liked="Gg, Ww, Wo"
				type="Red Mage"
				underlying_id="1"
				unrenamable="no"
				upkeep="full"
				usage="mixed fighter"
				user_team_name="Team 1"
				village_gold="2"
				x="19"
				y="5"
				zoc="yes"
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="50"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="3"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="100"
					cold="100"
					fire="90"
					impact="100"
					pierce="100"
				[/resistance]
				[portrait]
					image="portraits/humans/transparent/mage-red+female.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/humans/transparent/mage-red+female.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
				[/status]
				[attack]
					damage="6"
					description=_ "staff"
					icon="attacks/staff-magic.png"
					name="staff"
					number="2"
					range="melee"
					type="impact"
				[/attack]
				[attack]
					damage="8"
					description=_ "fireball"
					name="fireball"
					number="4"
					range="ranged"
					type="fire"
					[specials]
						[chance_to_hit]
							cumulative="no"
#textdomain wesnoth
							description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
							id="magical"
							name=_ "magical"
							value="70"
						[/chance_to_hit]
					[/specials]
				[/attack]
				[modifications]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Duelist"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="16"
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="s"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="28"
				id="Fencer-16"
				image="units/human-loyalists/fencer.png"
#textdomain wesnoth-units
				language_name=_ "Fencer"
				level="1"
				max_attacks="1"
				max_experience="29"
				max_hitpoints="28"
				max_moves="7"
				movement="6"
				movement_type="elusivefoot"
				moves="0"
				name="Glidd"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Fencer"
				underlying_id="16"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="9"
				y="14"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="saber"
					[/filter_attack]
					[frame]
						begin="-300"
						end="-250"
						image="units/human-loyalists/fencer-attack-1.png"
						offset="0.0~-0.07"
					[/frame]
					[frame]
						begin="-250"
						end="-200"
						image="units/human-loyalists/fencer-attack-2.png"
						offset="-0.07~-0.15"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-200"
							end="-150"
							image="units/human-loyalists/fencer-attack-3.png"
							offset="-0.15~-0.25"
							sound="sword-1.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-200"
							end="-150"
							image="units/human-loyalists/fencer-attack-3.png"
							offset="-0.15~-0.25"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="-150"
						end="-100"
						image="units/human-loyalists/fencer-attack-4.png"
						offset="-0.25~-0.2"
					[/frame]
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/fencer-attack-5.png"
						offset="-0.2~-0.1"
					[/frame]
					[frame]
						begin="-50"
						end="0"
						image="units/human-loyalists/fencer-attack-6.png"
						offset="-0.1~0.25"
					[/frame]
					[frame]
						begin="0"
						end="50"
						image="units/human-loyalists/fencer-attack-7.png"
						offset="0.25~0.55"
					[/frame]
					[frame]
						begin="50"
						end="100"
						image="units/human-loyalists/fencer-attack-8.png"
						offset="0.55~0.25"
					[/frame]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/fencer-attack-9.png"
						offset="0.25~0.1"
					[/frame]
					[frame]
						begin="150"
						end="200"
						image="units/human-loyalists/fencer-attack-1.png"
						offset="0.1~0.0"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="100"
						image="units/human-loyalists/fencer-die1.png"
					[/frame]
					[frame]
						begin="100"
						end="200"
						image="units/human-loyalists/fencer-die2.png"
					[/frame]
					[frame]
						begin="200"
						end="300"
						image="units/human-loyalists/fencer-die3.png"
					[/frame]
					[frame]
						begin="300"
						end="400"
						image="units/human-loyalists/fencer-die4.png"
					[/frame]
					[frame]
						begin="400"
						end="500"
						image="units/human-loyalists/fencer-die5.png"
					[/frame]
				[/death]
				[defend]
					hits="miss"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="-42"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
					[frame]
						begin="-42"
						end="41"
						image="units/human-loyalists/fencer-defend-1-2.png"
					[/frame]
					[frame]
						begin="41"
						end="125"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
				[/defend]
				[defend]
					hits="hit"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="-25"
						image="units/human-loyalists/fencer-defend.png"
					[/frame]
					[frame]
						begin="-25"
						end="125"
						image="units/human-loyalists/fencer-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer.png"
					[/frame]
				[/defend]
				[defend]
					hits="kill"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="125"
						image="units/human-loyalists/fencer-defend.png"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer.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/human-loyalists/fencer-idle-1.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-2.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-3.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-4.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-5.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-6.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-7.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-6.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-5.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-4.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-3.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-2.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-1.png"
					[/frame]
				[/idle_anim]
				[defense]
					castle="30"
					cave="50"
					deep_water="70"
					flat="40"
					forest="30"
					frozen="60"
					fungus="30"
					hills="30"
					impassable="50"
					mountains="30"
					reef="50"
					sand="60"
					shallow_water="60"
					swamp_water="60"
					unwalkable="80"
					village="30"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="2"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="2"
					swamp_water="2"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="130"
					cold="90"
					fire="100"
					impact="120"
					pierce="120"
				[/resistance]
				[abilities]
					[skirmisher]
						affect_self="yes"
#textdomain wesnoth
						description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
						female_name=_ "female^skirmisher"
						id="skirmisher"
						name=_ "skirmisher"
					[/skirmisher]
				[/abilities]
				[variables]
				[/variables]
				[status]
					hidden="yes"
				[/status]
				[attack]
					damage="5"
#textdomain wesnoth-units
					description=_ "saber"
					icon="attacks/saber-human.png"
					name="saber"
					number="4"
					range="melee"
					type="blade"
				[/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^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Dragoon"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="17"
				die_sound="horse-die.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="n"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="36"
				id="Cavalryman-17"
				image="units/human-loyalists/cavalryman.png"
#textdomain wesnoth-units
				language_name=_ "Cavalryman"
				level="1"
				max_attacks="1"
				max_experience="22"
				max_hitpoints="36"
				max_moves="9"
				movement="8"
				movement_type="mounted"
				moves="8"
				name="Owecyn"
				profile="portraits/humans/cavalryman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Cavalryman"
				undead_variation="mounted"
				underlying_id="17"
				unrenamable="no"
				upkeep="full"
				usage="scout"
				x="6"
				y="14"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="sword"
					[/filter_attack]
					[frame]
						begin="-225"
						end="-200"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/cavalryman-moving.png"
						sound="horse-canter.wav"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-150"
							end="150"
							image="units/human-loyalists/cavalryman-attack.png"
							sound="sword-1.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-150"
							end="150"
							image="units/human-loyalists/cavalryman-attack.png"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="150"
						end="200"
						image="units/human-loyalists/cavalryman-moving.png"
					[/frame]
					[frame]
						begin="200"
						end="225"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="200"
						image="units/human-loyalists/cavalryman-die-1.png"
					[/frame]
					[frame]
						begin="200"
						end="400"
						image="units/human-loyalists/cavalryman-die-2.png"
					[/frame]
				[/death]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/cavalryman-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/human-loyalists/cavalryman-defend.png"
							sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
						[/frame]
					[/if]
					[else]
						hits="miss,kill"
						[frame]
							duration="150"
							image="units/human-loyalists/cavalryman-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
				[/defend]
				[movement_anim]
					[frame]
						begin="0"
						end="150"
						image="units/human-loyalists/cavalryman-moving.png"
					[/frame]
				[/movement_anim]
				[defense]
					castle="60"
					cave="80"
					deep_water="80"
					flat="60"
					forest="70"
					frozen="70"
					fungus="80"
					hills="60"
					impassable="80"
					mountains="80"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="1"
					cave="4"
					deep_water="99"
					flat="1"
					forest="3"
					frozen="2"
					fungus="4"
					hills="2"
					impassable="99"
					mountains="99"
					reef="3"
					sand="2"
					shallow_water="4"
					swamp_water="4"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="70"
					cold="80"
					fire="100"
					impact="60"
					pierce="120"
				[/resistance]
				[variables]
				[/variables]
				[status]
					hidden="yes"
				[/status]
				[attack]
					damage="6"
					description=_ "sword"
					icon="attacks/sword-human.png"
					name="sword"
					number="3"
					range="melee"
					type="blade"
				[/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^intelligent"
						id="intelligent"
						male_name=_ "intelligent"
						name=_ "intelligent"
						[effect]
							apply_to="max_experience"
							increase="-20%"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Merman Warrior"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="14"
				die_sound="mermen-die.ogg"
				ellipse="misc/ellipse"
				experience="19"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="13"
				id="Merman Fighter-19"
				image="units/merfolk/fighter.png"
#textdomain wesnoth-units
				language_name=_ "Merman Fighter"
				level="1"
				max_attacks="1"
				max_experience="25"
				max_hitpoints="42"
				max_moves="6"
				movement="6"
				movement_type="swimmer"
				moves="0"
				name="Kinir"
				profile="portraits/merfolk/fighter.png"
				race="merman"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Merman Fighter"
				undead_variation="swimmer"
				underlying_id="19"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="21"
				y="15"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="trident"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-150"
						image="units/merfolk/fighter.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-150"
							end="100"
							image="units/merfolk/fighter.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-150"
							end="100"
							image="units/merfolk/fighter.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/merfolk/fighter.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/merfolk/fighter.png"
					[/frame]
					[frame]
						duration="100"
						image="units/merfolk/fighter.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/merfolk/fighter.png"
							sound="mermen-hit.wav"
						[/frame]
					[/if]
					[else]
						hits="miss,kill"
						[frame]
							duration="150"
							image="units/merfolk/fighter.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/merfolk/fighter.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]
				[/status]
				[attack]
					damage="7"
					description=_ "trident"
					name="trident"
					number="3"
					range="melee"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
#textdomain wesnoth
						female_name=_ "female^resilient"
						id="resilient"
						male_name=_ "resilient"
						name=_ "resilient"
						[effect]
							apply_to="hitpoints"
							increase_total="4"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
							times="per level"
						[/effect]
					[/trait]
					[trait]
						female_name=_ "female^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Duelist"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="16"
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				ellipse="misc/ellipse"
				experience="3"
				facing="ne"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="27"
				id="Fencer-21"
				image="units/human-loyalists/fencer.png"
#textdomain wesnoth-units
				language_name=_ "Fencer"
				level="1"
				max_attacks="1"
				max_experience="24"
				max_hitpoints="33"
				max_moves="6"
				movement="6"
				movement_type="elusivefoot"
				moves="0"
				name="Demyrcyn"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Fencer"
				underlying_id="21"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="31"
				y="16"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="saber"
					[/filter_attack]
					[frame]
						begin="-300"
						end="-250"
						image="units/human-loyalists/fencer-attack-1.png"
						offset="0.0~-0.07"
					[/frame]
					[frame]
						begin="-250"
						end="-200"
						image="units/human-loyalists/fencer-attack-2.png"
						offset="-0.07~-0.15"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-200"
							end="-150"
							image="units/human-loyalists/fencer-attack-3.png"
							offset="-0.15~-0.25"
							sound="sword-1.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-200"
							end="-150"
							image="units/human-loyalists/fencer-attack-3.png"
							offset="-0.15~-0.25"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="-150"
						end="-100"
						image="units/human-loyalists/fencer-attack-4.png"
						offset="-0.25~-0.2"
					[/frame]
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/fencer-attack-5.png"
						offset="-0.2~-0.1"
					[/frame]
					[frame]
						begin="-50"
						end="0"
						image="units/human-loyalists/fencer-attack-6.png"
						offset="-0.1~0.25"
					[/frame]
					[frame]
						begin="0"
						end="50"
						image="units/human-loyalists/fencer-attack-7.png"
						offset="0.25~0.55"
					[/frame]
					[frame]
						begin="50"
						end="100"
						image="units/human-loyalists/fencer-attack-8.png"
						offset="0.55~0.25"
					[/frame]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/fencer-attack-9.png"
						offset="0.25~0.1"
					[/frame]
					[frame]
						begin="150"
						end="200"
						image="units/human-loyalists/fencer-attack-1.png"
						offset="0.1~0.0"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="100"
						image="units/human-loyalists/fencer-die1.png"
					[/frame]
					[frame]
						begin="100"
						end="200"
						image="units/human-loyalists/fencer-die2.png"
					[/frame]
					[frame]
						begin="200"
						end="300"
						image="units/human-loyalists/fencer-die3.png"
					[/frame]
					[frame]
						begin="300"
						end="400"
						image="units/human-loyalists/fencer-die4.png"
					[/frame]
					[frame]
						begin="400"
						end="500"
						image="units/human-loyalists/fencer-die5.png"
					[/frame]
				[/death]
				[defend]
					hits="miss"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="-42"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
					[frame]
						begin="-42"
						end="41"
						image="units/human-loyalists/fencer-defend-1-2.png"
					[/frame]
					[frame]
						begin="41"
						end="125"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer-defend-1-1.png"
					[/frame]
				[/defend]
				[defend]
					hits="hit"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="-25"
						image="units/human-loyalists/fencer-defend.png"
					[/frame]
					[frame]
						begin="-25"
						end="125"
						image="units/human-loyalists/fencer-defend.png"
						sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer.png"
					[/frame]
				[/defend]
				[defend]
					hits="kill"
					[frame]
						begin="-126"
						end="-125"
						image="units/human-loyalists/fencer.png"
					[/frame]
					[frame]
						begin="-125"
						end="125"
						image="units/human-loyalists/fencer-defend.png"
					[/frame]
					[frame]
						begin="125"
						end="126"
						image="units/human-loyalists/fencer.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/human-loyalists/fencer-idle-1.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-2.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-3.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-4.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-5.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-6.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-7.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-6.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-5.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-4.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-3.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-2.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/fencer-idle-1.png"
					[/frame]
				[/idle_anim]
				[defense]
					castle="30"
					cave="50"
					deep_water="70"
					flat="40"
					forest="30"
					frozen="60"
					fungus="30"
					hills="30"
					impassable="50"
					mountains="30"
					reef="50"
					sand="60"
					shallow_water="60"
					swamp_water="60"
					unwalkable="80"
					village="30"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="2"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="2"
					swamp_water="2"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="130"
					cold="90"
					fire="100"
					impact="120"
					pierce="120"
				[/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]
				[/status]
				[attack]
					damage="4"
#textdomain wesnoth-units
					description=_ "saber"
					icon="attacks/saber-human.png"
					name="saber"
					number="4"
					range="melee"
					type="blade"
				[/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^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="Swordsman,Pikeman,Javelineer"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="14"
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				ellipse="misc/ellipse"
				experience="2"
				facing="n"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="32"
				id="Spearman-29"
				image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
				language_name=_ "Spearman"
				level="1"
				max_attacks="1"
				max_experience="24"
				max_hitpoints="41"
				max_moves="5"
				movement="5"
				movement_type="smallfoot"
				moves="0"
				name="Owudoc"
				profile="portraits/humans/spearman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Spearman"
				underlying_id="29"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="32"
				y="16"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="javelin"
					[/filter_attack]
					[missile_frame]
						begin="-150"
						end="0"
						image="projectiles/spear-n.png"
						image_diagonal="projectiles/spear-ne.png"
					[/missile_frame]
					[frame]
						begin="-250"
						end="-150"
						image="units/human-loyalists/spearman-death1.png"
						sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
					[/frame]
					[frame]
						begin="-150"
						end="-100"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
						[/frame]
					[/else]
					[frame]
						begin="-50"
						end="50"
						image="units/human-loyalists/spearman-attack-ranged2.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="s"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[frame]
						begin="-150"
						end="-50"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="n"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="ne,nw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="se,sw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="125"
						image="units/human-loyalists/spearman-death1.png"
					[/frame]
					[frame]
						begin="125"
						end="250"
						image="units/human-loyalists/spearman-death2.png"
					[/frame]
					[frame]
						begin="250"
						end="375"
						image="units/human-loyalists/spearman-death3.png"
					[/frame]
					[frame]
						begin="375"
						end="500"
						image="units/human-loyalists/spearman-death4.png"
					[/frame]
				[/death]
				[defend]
					[frame]
						begin="-100"
						end="-90"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
					[frame]
						begin="-90"
						end="90"
						image="units/human-loyalists/spearman-defend.png"
					[/frame]
					[frame]
						begin="90"
						end="100"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
				[/defend]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="50"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="3"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="100"
					cold="100"
					fire="100"
					impact="100"
					pierce="100"
				[/resistance]
				[variables]
				[/variables]
				[status]
				[/status]
				[attack]
					damage="7"
					description=_ "spear"
					icon="attacks/spear.png"
					name="spear"
					number="3"
					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]
				[attack]
					damage="6"
#textdomain wesnoth-units
					description=_ "javelin"
					icon="attacks/javelin-human.png"
					name="javelin"
					number="1"
					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^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="Swordsman,Pikeman,Javelineer"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="14"
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				ellipse="misc/ellipse"
				experience="9"
				facing="nw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="25"
				id="Spearman-30"
				image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
				language_name=_ "Spearman"
				level="1"
				max_attacks="1"
				max_experience="29"
				max_hitpoints="35"
				max_moves="6"
				movement="5"
				movement_type="smallfoot"
				moves="0"
				name="Cary"
				profile="portraits/humans/spearman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Spearman"
				underlying_id="30"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="33"
				y="16"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="javelin"
					[/filter_attack]
					[missile_frame]
						begin="-150"
						end="0"
						image="projectiles/spear-n.png"
						image_diagonal="projectiles/spear-ne.png"
					[/missile_frame]
					[frame]
						begin="-250"
						end="-150"
						image="units/human-loyalists/spearman-death1.png"
						sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
					[/frame]
					[frame]
						begin="-150"
						end="-100"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
						[/frame]
					[/else]
					[frame]
						begin="-50"
						end="50"
						image="units/human-loyalists/spearman-attack-ranged2.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="s"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[frame]
						begin="-150"
						end="-50"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="n"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="ne,nw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="se,sw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="125"
						image="units/human-loyalists/spearman-death1.png"
					[/frame]
					[frame]
						begin="125"
						end="250"
						image="units/human-loyalists/spearman-death2.png"
					[/frame]
					[frame]
						begin="250"
						end="375"
						image="units/human-loyalists/spearman-death3.png"
					[/frame]
					[frame]
						begin="375"
						end="500"
						image="units/human-loyalists/spearman-death4.png"
					[/frame]
				[/death]
				[defend]
					[frame]
						begin="-100"
						end="-90"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
					[frame]
						begin="-90"
						end="90"
						image="units/human-loyalists/spearman-defend.png"
					[/frame]
					[frame]
						begin="90"
						end="100"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
				[/defend]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="50"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="3"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="100"
					cold="100"
					fire="100"
					impact="100"
					pierce="100"
				[/resistance]
				[variables]
				[/variables]
				[status]
				[/status]
				[attack]
					damage="8"
					description=_ "spear"
					icon="attacks/spear.png"
					name="spear"
					number="3"
					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]
				[attack]
					damage="6"
#textdomain wesnoth-units
					description=_ "javelin"
					icon="attacks/javelin-human.png"
					name="javelin"
					number="1"
					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^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Dragoon"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="17"
				die_sound="horse-die.ogg"
				ellipse="misc/ellipse"
				experience="2"
				facing="nw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="23"
				id="Cavalryman-34"
				image="units/human-loyalists/cavalryman.png"
#textdomain wesnoth-units
				language_name=_ "Cavalryman"
				level="1"
				max_attacks="1"
				max_experience="22"
				max_hitpoints="39"
				max_moves="8"
				movement="8"
				movement_type="mounted"
				moves="0"
				name="Oweonnyc"
				profile="portraits/humans/cavalryman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Cavalryman"
				undead_variation="mounted"
				underlying_id="34"
				unrenamable="no"
				upkeep="full"
				usage="scout"
				x="31"
				y="17"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="sword"
					[/filter_attack]
					[frame]
						begin="-225"
						end="-200"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/cavalryman-moving.png"
						sound="horse-canter.wav"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-150"
							end="150"
							image="units/human-loyalists/cavalryman-attack.png"
							sound="sword-1.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-150"
							end="150"
							image="units/human-loyalists/cavalryman-attack.png"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="150"
						end="200"
						image="units/human-loyalists/cavalryman-moving.png"
					[/frame]
					[frame]
						begin="200"
						end="225"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="200"
						image="units/human-loyalists/cavalryman-die-1.png"
					[/frame]
					[frame]
						begin="200"
						end="400"
						image="units/human-loyalists/cavalryman-die-2.png"
					[/frame]
				[/death]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/cavalryman-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/human-loyalists/cavalryman-defend.png"
							sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
						[/frame]
					[/if]
					[else]
						hits="miss,kill"
						[frame]
							duration="150"
							image="units/human-loyalists/cavalryman-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/human-loyalists/cavalryman.png"
					[/frame]
				[/defend]
				[movement_anim]
					[frame]
						begin="0"
						end="150"
						image="units/human-loyalists/cavalryman-moving.png"
					[/frame]
				[/movement_anim]
				[defense]
					castle="60"
					cave="80"
					deep_water="80"
					flat="60"
					forest="70"
					frozen="70"
					fungus="80"
					hills="60"
					impassable="80"
					mountains="80"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="1"
					cave="4"
					deep_water="99"
					flat="1"
					forest="3"
					frozen="2"
					fungus="4"
					hills="2"
					impassable="99"
					mountains="99"
					reef="3"
					sand="2"
					shallow_water="4"
					swamp_water="4"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="70"
					cold="80"
					fire="100"
					impact="60"
					pierce="120"
				[/resistance]
				[variables]
				[/variables]
				[status]
				[/status]
				[attack]
					damage="7"
					description=_ "sword"
					icon="attacks/sword-human.png"
					name="sword"
					number="3"
					range="melee"
					type="blade"
				[/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^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Swordsman,Pikeman,Javelineer"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="14"
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="s"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="34"
				id="Spearman-36"
				image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
				language_name=_ "Spearman"
				level="1"
				max_attacks="1"
				max_experience="24"
				max_hitpoints="34"
				max_moves="6"
				movement="5"
				movement_type="smallfoot"
				moves="1"
				name="Lan"
				profile="portraits/humans/spearman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Spearman"
				underlying_id="36"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="12"
				y="12"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="javelin"
					[/filter_attack]
					[missile_frame]
						begin="-150"
						end="0"
						image="projectiles/spear-n.png"
						image_diagonal="projectiles/spear-ne.png"
					[/missile_frame]
					[frame]
						begin="-250"
						end="-150"
						image="units/human-loyalists/spearman-death1.png"
						sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
					[/frame]
					[frame]
						begin="-150"
						end="-100"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="-50"
							image="units/human-loyalists/spearman-attack-ranged.png"
						[/frame]
					[/else]
					[frame]
						begin="-50"
						end="50"
						image="units/human-loyalists/spearman-attack-ranged2.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="s"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[frame]
						begin="-150"
						end="-50"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-50"
							end="100"
							image="units/human-loyalists/spearman-attack-s-2.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman-attack-s-1.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="n"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-n.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="ne,nw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack-ne.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					direction="se,sw"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-100"
						image="units/human-loyalists/spearman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/human-loyalists/spearman-attack.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/spearman.png"
					[/frame]
				[/attack_anim]
				[death]
					[frame]
						begin="0"
						end="125"
						image="units/human-loyalists/spearman-death1.png"
					[/frame]
					[frame]
						begin="125"
						end="250"
						image="units/human-loyalists/spearman-death2.png"
					[/frame]
					[frame]
						begin="250"
						end="375"
						image="units/human-loyalists/spearman-death3.png"
					[/frame]
					[frame]
						begin="375"
						end="500"
						image="units/human-loyalists/spearman-death4.png"
					[/frame]
				[/death]
				[defend]
					[frame]
						begin="-100"
						end="-90"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
					[frame]
						begin="-90"
						end="90"
						image="units/human-loyalists/spearman-defend.png"
					[/frame]
					[frame]
						begin="90"
						end="100"
						image="units/human-loyalists/spearman-defend-2.png"
					[/frame]
				[/defend]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/humans/transparent/spearman.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="50"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="3"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="100"
					cold="100"
					fire="100"
					impact="100"
					pierce="100"
				[/resistance]
				[variables]
				[/variables]
				[status]
					hidden="yes"
				[/status]
				[attack]
					damage="7"
					description=_ "spear"
					icon="attacks/spear.png"
					name="spear"
					number="3"
					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]
				[attack]
					damage="6"
#textdomain wesnoth-units
					description=_ "javelin"
					icon="attacks/javelin-human.png"
					name="javelin"
					number="1"
					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^intelligent"
						id="intelligent"
						male_name=_ "intelligent"
						name=_ "intelligent"
						[effect]
							apply_to="max_experience"
							increase="-20%"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Merman Warrior"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="14"
				die_sound="mermen-die.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="s"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="39"
				id="Merman Fighter-38"
				image="units/merfolk/fighter.png"
#textdomain wesnoth-units
				language_name=_ "Merman Fighter"
				level="1"
				max_attacks="1"
				max_experience="25"
				max_hitpoints="39"
				max_moves="7"
				movement="6"
				movement_type="swimmer"
				moves="0"
				name="Faroa"
				profile="portraits/merfolk/fighter.png"
				race="merman"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Merman Fighter"
				undead_variation="swimmer"
				underlying_id="38"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="21"
				y="11"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="trident"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-150"
						image="units/merfolk/fighter.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-150"
							end="100"
							image="units/merfolk/fighter.png"
							sound="spear.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-150"
							end="100"
							image="units/merfolk/fighter.png"
							sound="spear-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="150"
						image="units/merfolk/fighter.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/merfolk/fighter.png"
					[/frame]
					[frame]
						duration="100"
						image="units/merfolk/fighter.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/merfolk/fighter.png"
							sound="mermen-hit.wav"
						[/frame]
					[/if]
					[else]
						hits="miss,kill"
						[frame]
							duration="150"
							image="units/merfolk/fighter.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/merfolk/fighter.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="6"
					description=_ "trident"
					name="trident"
					number="3"
					range="melee"
					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="Knight,Lancer"
				alignment="lawful"
				alpha="256"
				attacks_left="0"
				cost="23"
				die_sound="horse-die.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="ne"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="39"
				id="Horseman-39"
				image="units/human-loyalists/horseman.png"
#textdomain wesnoth-units
				language_name=_ "Horseman"
				level="1"
				max_attacks="1"
				max_experience="25"
				max_hitpoints="39"
				max_moves="8"
				movement="8"
				movement_type="mounted"
				moves="0"
				name="Cyn"
				profile="portraits/humans/horseman.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="no"
				side="1"
				type="Horseman"
				undead_variation="mounted"
				underlying_id="39"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="18"
				y="5"
				zoc="yes"
				[attack_anim]
					hits="no"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-250"
						end="-225"
						image="units/human-loyalists/horseman.png"
						sound="horse-canter.wav"
					[/frame]
					[frame]
						begin="-225"
						end="-150"
						image="units/human-loyalists/horseman-moving.png"
					[/frame]
					[frame]
						begin="-150"
						end="100"
						image="units/human-loyalists/horseman-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
					[frame]
						begin="100"
						end="175"
						image="units/human-loyalists/horseman-moving.png"
					[/frame]
					[frame]
						begin="175"
						end="200"
						image="units/human-loyalists/horseman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					hits="yes"
					[filter_attack]
						name="spear"
					[/filter_attack]
					[frame]
						begin="-250"
						end="-200"
						image="units/human-loyalists/horseman.png"
						sound="horse-canter.wav"
					[/frame]
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/horseman-moving.png"
					[/frame]
					[frame]
						begin="-150"
						end="100"
						image="units/human-loyalists/horseman-attack.png"
						sound="spear.ogg"
					[/frame]
					[frame]
						begin="100"
						end="150"
						image="units/human-loyalists/horseman-moving.png"
					[/frame]
					[frame]
						begin="150"
						end="200"
						image="units/human-loyalists/horseman.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/human-loyalists/horseman.png"
					[/frame]
					[frame]
						duration="100"
						image="units/human-loyalists/horseman-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/human-loyalists/horseman-defend.png"
							sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
						[/frame]
					[/if]
					[else]
						hits="miss,kill"
						[frame]
							duration="150"
							image="units/human-loyalists/horseman-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/human-loyalists/horseman.png"
					[/frame]
				[/defend]
				[movement_anim]
					[frame]
						begin="0"
						end="150"
						image="units/human-loyalists/horseman-moving.png"
					[/frame]
				[/movement_anim]
				[defense]
					castle="60"
					cave="80"
					deep_water="80"
					flat="60"
					forest="70"
					frozen="70"
					fungus="80"
					hills="60"
					impassable="80"
					mountains="80"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="1"
					cave="4"
					deep_water="99"
					flat="1"
					forest="3"
					frozen="2"
					fungus="4"
					hills="2"
					impassable="99"
					mountains="99"
					reef="3"
					sand="2"
					shallow_water="4"
					swamp_water="4"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="80"
					cold="100"
					fire="100"
					impact="70"
					pierce="120"
				[/resistance]
				[variables]
				[/variables]
				[status]
				[/status]
				[attack]
					damage="10"
					description=_ "spear"
					name="spear"
					number="2"
					range="melee"
					type="pierce"
					[specials]
						[damage]
							active_on="offense"
							apply_to="both"
#textdomain wesnoth
							description=_ "Charge:
When used offensively, this attack deals double damage to the target. It also causes this unit to take double damage from the target's counterattack."
							id="charge"
							multiply="2"
							name=_ "charge"
						[/damage]
					[/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^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
		[/side]
		[side]
			action_bonus_count="8"
			aggression="0.5"
			allow_player="yes"
			caution="0.25"
			colour="9"
			controller="network"
			countdown_time="270000"
			current_player="akkon"
			disallow_observers="no"
			fog="yes"
			global_recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,scout"
			gold="27"
			hidden="no"
			id="akkon2"
			income="0"
			leader_value="3"
			name="akkon"
			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="akkon2"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="2"
			start_gold="100"
			team_name="2"
			user_team_name="Team 2"
			village_gold="2"
			village_value="1"
			villages_per_scout="8"
			[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]
			[ai]
				villages_per_scout="8"
			[/ai]
			[village]
				x="11"
				y="19"
			[/village]
			[village]
				x="15"
				y="20"
			[/village]
			[village]
				x="16"
				y="14"
			[/village]
			[village]
				x="20"
				y="15"
			[/village]
			[village]
				x="25"
				y="17"
			[/village]
			[village]
				x="25"
				y="21"
			[/village]
			[unit]
				advances_to="Elvish Marshal"
				alignment="neutral"
				allow_changes="yes"
				allow_player="yes"
				alpha="256"
				attacks_left="1"
				canrecruit="yes"
				colour="9"
				controller="network"
				cost="32"
				current_player="akkon"
				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"
				experience="0"
				facing="se"
				flag_rgb="magenta"
				flying="no"
				fog="yes"
				gender="male"
				gold="100"
				goto_x="-999"
				goto_y="-999"
				hitpoints="47"
				id="akkon2"
				image="units/elves-wood/captain.png"
				income="0"
#textdomain wesnoth-units
				language_name=_ "Elvish Captain"
				leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose"
				level="2"
				max_attacks="1"
				max_experience="63"
				max_hitpoints="47"
				max_moves="5"
				movement="5"
				movement_type="woodland"
				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="akkon"
				profile="portraits/elves/captain.png"
				race="elf"
				random_leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,Red Mage"
				random_traits="no"
				recruit="Elvish Fighter,Elvish Archer,Mage,Elvish Shaman,Elvish Scout,Wose,Merman Hunter"
				resting="yes"
				save_id="akkon2"
				share_maps="no"
				share_view="yes"
				shroud="no"
				side="2"
				team_name="2"
				terrain_liked="Ff, Fa, Ss, Ww"
				type="Elvish Captain"
				underlying_id="2"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				user_team_name="Team 2"
				village_gold="2"
				x="25"
				y="21"
				zoc="yes"
				[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]
				[abilities]
					[leadership]
						affect_self="no"
						cumulative="no"
#textdomain wesnoth
						description=_ "Leadership:
This unit can lead our own units that are next to it, making them fight better.

Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
						female_name=_ "female^leadership"
						id="leadership"
						name=_ "leadership"
						value="50"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="0"
							[/filter]
						[/affect_adjacent]
					[/leadership]
					[leadership]
						affect_self="no"
						cumulative="no"
						id="leadership"
						value="25"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="1"
							[/filter]
						[/affect_adjacent]
					[/leadership]
				[/abilities]
				[portrait]
					image="portraits/elves/transparent/captain.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/captain.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
				[/status]
				[attack]
					damage="7"
#textdomain wesnoth-units
					description=_ "sword"
					icon="attacks/sword-elven.png"
					name="sword"
					number="4"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="5"
					description=_ "bow"
					icon="attacks/bow-elven.png"
					name="bow"
					number="3"
					range="ranged"
					type="pierce"
				[/attack]
				[modifications]
				[/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="ne"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="39"
				id="Elvish Fighter-25"
				image="units/elves-wood/fighter.png"
				language_name=_ "Elvish Fighter"
				level="1"
				max_attacks="1"
				max_experience="28"
				max_hitpoints="39"
				max_moves="5"
				movement="5"
				movement_type="woodland"
				moves="5"
				name="Celith"
				profile="portraits/elves/fighter.png"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Fighter"
				underlying_id="25"
				unrenamable="no"
				upkeep="full"
				usage="fighter"
				x="16"
				y="14"
				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="6"
					description=_ "sword"
					icon="attacks/sword-elven.png"
					name="sword"
					number="4"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="3"
					description=_ "bow"
					icon="attacks/bow-elven.png"
					name="bow"
					number="3"
					range="ranged"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
#textdomain wesnoth
						female_name=_ "female^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
					[trait]
						female_name=_ "female^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="Elvish Ranger,Elvish Marksman"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="17"
				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="1"
				facing="ne"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="28"
				id="Elvish Archer-26"
				image="units/elves-wood/archer.png"
#textdomain wesnoth-units
				language_name=_ "Elvish Archer"
				level="1"
				max_attacks="1"
				max_experience="31"
				max_hitpoints="28"
				max_moves="7"
				movement="6"
				movement_type="woodland"
				moves="7"
				name="Amir"
				profile="portraits/elves/archer.png"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Archer"
				undead_variation="archer"
				underlying_id="26"
				unrenamable="no"
				upkeep="full"
				usage="archer"
				x="20"
				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-bow.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="-305"
						end="-230"
						image="units/elves-wood/archer-bow-attack2.png"
					[/frame]
					[frame]
						begin="-230"
						end="-130"
						image="units/elves-wood/archer-bow-attack3.png"
					[/frame]
					[frame]
						begin="-130"
						end="0"
						image="units/elves-wood/archer-bow-attack4.png"
					[/frame]
					[frame]
						begin="0"
						end="65"
						image="units/elves-wood/archer-bow.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					[filter_attack]
						name="sword"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-175"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						begin="-175"
						end="-75"
						image="units/elves-wood/archer-sword-1.png"
					[/frame]
					[if]
						hits="no"
						[frame]
							begin="-75"
							end="75"
							image="units/elves-wood/archer-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-sword-2.png"
							sound="sword-1.ogg"
						[/frame]
					[/else]
					[frame]
						begin="75"
						end="125"
						image="units/elves-wood/archer-sword-3.png"
					[/frame]
					[frame]
						begin="125"
						end="175"
						image="units/elves-wood/archer-sword-4.png"
					[/frame]
					[frame]
						begin="175"
						end="200"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[filter_attack]
						range="melee"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-sword-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-sword-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/defend]
				[defend]
					start_time="-126"
					[filter_attack]
						range="ranged"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-bow.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-bow-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-bow-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-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.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/archer.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="6"
					description=_ "bow"
					icon="attacks/bow-elven.png"
					name="bow"
					number="4"
					range="ranged"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
#textdomain wesnoth
						female_name=_ "female^dextrous"
						id="dextrous"
						male_name=_ "dextrous"
						name=_ "dextrous"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="ranged"
						[/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 Ranger,Elvish Marksman"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="17"
				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="13"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="6"
				id="Elvish Archer-27"
				image="units/elves-wood/archer.png"
#textdomain wesnoth-units
				language_name=_ "Elvish Archer"
				level="1"
				max_attacks="1"
				max_experience="25"
				max_hitpoints="28"
				max_moves="7"
				movement="6"
				movement_type="woodland"
				moves="7"
				name="Unor"
				profile="portraits/elves/archer.png"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Archer"
				undead_variation="archer"
				underlying_id="27"
				unrenamable="no"
				upkeep="full"
				usage="archer"
				x="32"
				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/archer-bow.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="-305"
						end="-230"
						image="units/elves-wood/archer-bow-attack2.png"
					[/frame]
					[frame]
						begin="-230"
						end="-130"
						image="units/elves-wood/archer-bow-attack3.png"
					[/frame]
					[frame]
						begin="-130"
						end="0"
						image="units/elves-wood/archer-bow-attack4.png"
					[/frame]
					[frame]
						begin="0"
						end="65"
						image="units/elves-wood/archer-bow.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					[filter_attack]
						name="sword"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-175"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						begin="-175"
						end="-75"
						image="units/elves-wood/archer-sword-1.png"
					[/frame]
					[if]
						hits="no"
						[frame]
							begin="-75"
							end="75"
							image="units/elves-wood/archer-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-sword-2.png"
							sound="sword-1.ogg"
						[/frame]
					[/else]
					[frame]
						begin="75"
						end="125"
						image="units/elves-wood/archer-sword-3.png"
					[/frame]
					[frame]
						begin="125"
						end="175"
						image="units/elves-wood/archer-sword-4.png"
					[/frame]
					[frame]
						begin="175"
						end="200"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[filter_attack]
						range="melee"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-sword-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-sword-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/defend]
				[defend]
					start_time="-126"
					[filter_attack]
						range="ranged"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-bow.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-bow-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-bow-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-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.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/archer.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^quick"
						id="quick"
						male_name=_ "quick"
						name=_ "quick"
						[effect]
							apply_to="movement"
							increase="1"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="-5%"
						[/effect]
					[/trait]
					[trait]
						female_name=_ "female^intelligent"
						id="intelligent"
						male_name=_ "intelligent"
						name=_ "intelligent"
						[effect]
							apply_to="max_experience"
							increase="-20%"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Elvish Druid,Elvish Sorceress"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="15"
				die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="female"
				goto_x="-999"
				goto_y="-999"
				hitpoints="26"
				id="Elvish Shaman-31"
				image="units/elves-wood/shaman.png"
#textdomain wesnoth-units
				language_name=_ "female^Elvish Shaman"
				level="1"
				max_attacks="1"
				max_experience="22"
				max_hitpoints="26"
				max_moves="6"
				movement="5"
				movement_type="woodland"
				moves="6"
				name="Urebrien"
				profile="portraits/elves/shaman.png~RIGHT()"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Shaman"
				underlying_id="31"
				unrenamable="no"
				upkeep="full"
				usage="healer"
				x="11"
				y="19"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="entangle"
					[/filter_attack]
					[missile_frame]
						begin="-200"
						end="50"
						image="projectiles/entangle.png"
						image_diagonal="projectiles/entangle.png"
						offset="1.0"
					[/missile_frame]
					[frame]
						begin="-450"
						end="-375"
						halo="halo/elven/nature-halo1.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-375"
						end="-300"
						halo="halo/elven/nature-halo2.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-300"
						end="-225"
						halo="halo/elven/nature-halo3.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-225"
						end="-150"
						halo="halo/elven/nature-halo4.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
					[/frame]
					[frame]
						begin="-150"
						end="-75"
						halo="halo/elven/nature-halo5.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
					[/frame]
					[if]
						hits="hit"
						slowed_sound_start_time="-100"
						[filter_second]
							[not]
								[filter_wml]
									[status]
										slowed="yes"
									[/status]
								[/filter_wml]
							[/not]
						[/filter_second]
						[slowed_sound_frame]
							duration="100"
							sound="slowed.wav"
						[/slowed_sound_frame]
					[/if]
					[frame]
						begin="-75"
						end="0"
						halo="halo/elven/nature-halo6.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
						sound="entangle.wav"
					[/frame]
					[frame]
						begin="-0"
						end="50"
						halo="halo/elven/nature-halo7.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="50"
						end="100"
						halo="halo/elven/nature-halo8.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="100"
						end="150"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					[filter_attack]
						name="staff"
					[/filter_attack]
					[frame]
						begin="-175"
						end="-100"
						image="units/elves-wood/shaman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/elves-wood/shaman-attack.png"
							sound="staff.wav"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/elves-wood/shaman-attack.png"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="175"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/shaman-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/shaman-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/shaman-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/defend]
				[healing_anim]
					start_time="-200"
					[frame]
						duration="55"
						image="units/elves-wood/shaman-heal1.png"
					[/frame]
					[frame]
						duration="55"
						image="units/elves-wood/shaman-heal2.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-1.png"
						image="units/elves-wood/shaman-heal3.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-2.png"
						image="units/elves-wood/shaman-heal4.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-3.png"
						image="units/elves-wood/shaman-heal5.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-4.png"
						image="units/elves-wood/shaman-heal6.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-5.png"
						image="units/elves-wood/shaman-heal7.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-6.png"
						image="units/elves-wood/shaman-heal8.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-7.png"
						image="units/elves-wood/shaman-heal9.png"
					[/frame]
					[frame]
						duration="30"
						image="units/elves-wood/shaman-heal9.png"
					[/frame]
				[/healing_anim]
				[portrait]
					image="portraits/elves/transparent/shaman.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/shaman.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]
				[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/druidstaff.png"
					name="staff"
					number="2"
					range="melee"
					type="impact"
				[/attack]
				[attack]
					damage="3"
					description=_ "entangle"
					name="entangle"
					number="2"
					range="ranged"
					type="impact"
					[specials]
						[slow]
#textdomain wesnoth
							description=_ "Slow:
This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled. A unit that is slowed will feature a snail icon in its sidebar information when it is selected."
							id="slow"
							name=_ "slows"
						[/slow]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						female_name=_ "female^quick"
						id="quick"
						male_name=_ "quick"
						name=_ "female^quick"
						[effect]
							apply_to="movement"
							increase="1"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="-5%"
						[/effect]
					[/trait]
					[trait]
						female_name=_ "female^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "female^strong"
						[effect]
							apply_to="attack"
							increase_damage="1"
							range="melee"
						[/effect]
						[effect]
							apply_to="hitpoints"
							increase_total="1"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Elvish Druid,Elvish Sorceress"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="15"
				die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
				ellipse="misc/ellipse"
				experience="1"
				facing="nw"
				flag_rgb="magenta"
				flying="no"
				gender="female"
				goto_x="-999"
				goto_y="-999"
				hitpoints="27"
				id="Elvish Shaman-35"
				image="units/elves-wood/shaman.png"
#textdomain wesnoth-units
				language_name=_ "female^Elvish Shaman"
				level="1"
				max_attacks="1"
				max_experience="18"
				max_hitpoints="27"
				max_moves="5"
				movement="5"
				movement_type="woodland"
				moves="5"
				name="Náviel"
				profile="portraits/elves/shaman.png~RIGHT()"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Shaman"
				underlying_id="35"
				unrenamable="no"
				upkeep="full"
				usage="healer"
				x="22"
				y="16"
				zoc="yes"
				[attack_anim]
					[filter_attack]
						name="entangle"
					[/filter_attack]
					[missile_frame]
						begin="-200"
						end="50"
						image="projectiles/entangle.png"
						image_diagonal="projectiles/entangle.png"
						offset="1.0"
					[/missile_frame]
					[frame]
						begin="-450"
						end="-375"
						halo="halo/elven/nature-halo1.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-375"
						end="-300"
						halo="halo/elven/nature-halo2.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-300"
						end="-225"
						halo="halo/elven/nature-halo3.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="-225"
						end="-150"
						halo="halo/elven/nature-halo4.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
					[/frame]
					[frame]
						begin="-150"
						end="-75"
						halo="halo/elven/nature-halo5.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
					[/frame]
					[if]
						hits="hit"
						slowed_sound_start_time="-100"
						[filter_second]
							[not]
								[filter_wml]
									[status]
										slowed="yes"
									[/status]
								[/filter_wml]
							[/not]
						[/filter_second]
						[slowed_sound_frame]
							duration="100"
							sound="slowed.wav"
						[/slowed_sound_frame]
					[/if]
					[frame]
						begin="-75"
						end="0"
						halo="halo/elven/nature-halo6.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman-attack2.png"
						sound="entangle.wav"
					[/frame]
					[frame]
						begin="-0"
						end="50"
						halo="halo/elven/nature-halo7.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="50"
						end="100"
						halo="halo/elven/nature-halo8.png"
						halo_x="0"
						halo_y="-12"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						begin="100"
						end="150"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					[filter_attack]
						name="staff"
					[/filter_attack]
					[frame]
						begin="-175"
						end="-100"
						image="units/elves-wood/shaman.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-100"
							end="100"
							image="units/elves-wood/shaman-attack.png"
							sound="staff.wav"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-100"
							end="100"
							image="units/elves-wood/shaman-attack.png"
							sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
						[/frame]
					[/else]
					[frame]
						begin="100"
						end="175"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[frame]
						duration="1"
						image="units/elves-wood/shaman.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/shaman-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/shaman-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/shaman-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/shaman.png"
					[/frame]
				[/defend]
				[healing_anim]
					start_time="-200"
					[frame]
						duration="55"
						image="units/elves-wood/shaman-heal1.png"
					[/frame]
					[frame]
						duration="55"
						image="units/elves-wood/shaman-heal2.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-1.png"
						image="units/elves-wood/shaman-heal3.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-2.png"
						image="units/elves-wood/shaman-heal4.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-3.png"
						image="units/elves-wood/shaman-heal5.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-4.png"
						image="units/elves-wood/shaman-heal6.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-5.png"
						image="units/elves-wood/shaman-heal7.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-6.png"
						image="units/elves-wood/shaman-heal8.png"
					[/frame]
					[frame]
						duration="55"
						halo="halo/elven/shaman-heal-halo-7.png"
						image="units/elves-wood/shaman-heal9.png"
					[/frame]
					[frame]
						duration="30"
						image="units/elves-wood/shaman-heal9.png"
					[/frame]
				[/healing_anim]
				[portrait]
					image="portraits/elves/transparent/shaman.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/shaman.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]
				[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/druidstaff.png"
					name="staff"
					number="2"
					range="melee"
					type="impact"
				[/attack]
				[attack]
					damage="3"
					description=_ "entangle"
					name="entangle"
					number="2"
					range="ranged"
					type="impact"
					[specials]
						[slow]
#textdomain wesnoth
							description=_ "Slow:
This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled. A unit that is slowed will feature a snail icon in its sidebar information when it is selected."
							id="slow"
							name=_ "slows"
						[/slow]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						female_name=_ "female^strong"
						id="strong"
						male_name=_ "strong"
						name=_ "female^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=_ "female^intelligent"
						[effect]
							apply_to="max_experience"
							increase="-20%"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Elvish Ranger,Elvish Marksman"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="17"
				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="se"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="-999"
				goto_y="-999"
				hitpoints="26"
				id="Elvish Archer-37"
				image="units/elves-wood/archer.png"
#textdomain wesnoth-units
				language_name=_ "Elvish Archer"
				level="1"
				max_attacks="1"
				max_experience="31"
				max_hitpoints="33"
				max_moves="7"
				movement="6"
				movement_type="woodland"
				moves="7"
				name="Galdorfindel"
				profile="portraits/elves/archer.png"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="2"
				type="Elvish Archer"
				undead_variation="archer"
				underlying_id="37"
				unrenamable="no"
				upkeep="full"
				usage="archer"
				x="30"
				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-bow.png"
					[/frame]
					[if]
						hits="yes"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow.ogg"
						[/frame]
					[/if]
					[else]
						hits="no"
						[frame]
							begin="-380"
							end="-305"
							image="units/elves-wood/archer-bow-attack1.png"
							sound="bow-miss.ogg"
						[/frame]
					[/else]
					[frame]
						begin="-305"
						end="-230"
						image="units/elves-wood/archer-bow-attack2.png"
					[/frame]
					[frame]
						begin="-230"
						end="-130"
						image="units/elves-wood/archer-bow-attack3.png"
					[/frame]
					[frame]
						begin="-130"
						end="0"
						image="units/elves-wood/archer-bow-attack4.png"
					[/frame]
					[frame]
						begin="0"
						end="65"
						image="units/elves-wood/archer-bow.png"
					[/frame]
				[/attack_anim]
				[attack_anim]
					[filter_attack]
						name="sword"
					[/filter_attack]
					[frame]
						begin="-200"
						end="-175"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						begin="-175"
						end="-75"
						image="units/elves-wood/archer-sword-1.png"
					[/frame]
					[if]
						hits="no"
						[frame]
							begin="-75"
							end="75"
							image="units/elves-wood/archer-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-sword-2.png"
							sound="sword-1.ogg"
						[/frame]
					[/else]
					[frame]
						begin="75"
						end="125"
						image="units/elves-wood/archer-sword-3.png"
					[/frame]
					[frame]
						begin="125"
						end="175"
						image="units/elves-wood/archer-sword-4.png"
					[/frame]
					[frame]
						begin="175"
						end="200"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/attack_anim]
				[defend]
					start_time="-126"
					[filter_attack]
						range="melee"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-sword-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-sword-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-sword.png"
					[/frame]
				[/defend]
				[defend]
					start_time="-126"
					[filter_attack]
						range="ranged"
					[/filter_attack]
					[frame]
						duration="1"
						image="units/elves-wood/archer-bow.png"
					[/frame]
					[frame]
						duration="100"
						image="units/elves-wood/archer-bow-defend.png"
					[/frame]
					[if]
						hits="hit"
						[frame]
							duration="150"
							image="units/elves-wood/archer-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/archer-bow-defend.png"
						[/frame]
					[/else]
					[frame]
						duration="1"
						image="units/elves-wood/archer-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.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/archer.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^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]
		[/side]
		[side]
			action_bonus_count="0"
			aggression="0.5"
			allow_player="no"
			caution="0.25"
			colour="5"
			controller="network"
			countdown_time="270000"
			current_player="ai3"
			disallow_observers="no"
			fog="yes"
			global_recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
			gold="-145"
			hidden="yes"
			id="ai3"
			income="0"
			leader_value="3"
			name="Ordinateur"
			no_leader="yes"
			number_of_possible_recruits_to_force_recruit="3.1"
			objectives="Victory:
@Defeat enemy leader(s)"
			objectives_changed="yes"
			recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
			recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
			save_id="ai3"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="3"
			start_gold="100"
			team_name="3"
			user_team_name="Team 3"
			village_gold="2"
			village_value="1"
			villages_per_scout="4"
			[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]
			[unit]
				advances_to="Hurricane Drake"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="30"
				description="Dans le ciel noir soufflaient les vents du nord,
La lune luisait aux confins de l'aurore,
Brave était le dracan qui osa lâcher
Son toit pour voler au basilic l'or.

Par cette nuit noire aux cieux si agités,
Il renonça à tout ce qu'il savait,
Fou mais brave, dans la cave du basilic
Il courut, et en lui le feu brûlait.

Hélas, son feu intérieur ne brûle plus.
Le basilic, dans un grand rugissement,
Lui glaça le sang et le fit statue,
Ce qui pour toujours sera son vécu.

Dans le ciel noir soufflaient les vents du nord,
Les années ont passé, ces jours sont morts,
Ici gît le dracan qui osa lâcher
Son toit pour voler au basilic l'or.
(inscrit par Flametrooper)"
				die_sound="drake-die.ogg"
				experience="0"
				facing="se"
				flies="false"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Sky Drake-3"
				image="units/drakes/sky.png"
#textdomain wesnoth-units
				language_name=_ "Sky Drake"
				level="2"
				max_attacks="1"
				max_experience="56"
				max_hitpoints="1"
				max_moves="0"
				movement="9"
				movement_type="fly"
				moves="0"
				profile="portraits/drakes/glider.png"
				race="drake"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Sky Drake"
				undead_variation="drake"
				underlying_id="3"
				unrenamable="yes"
				upkeep="full"
				usage="scout"
				x="27"
				y="14"
				zoc="yes"
				[defense]
					castle="50"
					cave="70"
					deep_water="50"
					flat="50"
					forest="50"
					frozen="50"
					fungus="60"
					hills="50"
					impassable="80"
					mountains="50"
					reef="50"
					sand="50"
					shallow_water="50"
					swamp_water="50"
					unwalkable="50"
					village="50"
				[/defense]
				[movement_costs]
					castle="1"
					cave="3"
					deep_water="1"
					flat="1"
					forest="1"
					frozen="1"
					fungus="2"
					hills="1"
					impassable="99"
					mountains="1"
					reef="1"
					sand="1"
					shallow_water="1"
					swamp_water="1"
					unwalkable="1"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="130"
					blade="90"
					cold="150"
					fire="50"
					impact="80"
					pierce="110"
				[/resistance]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="6"
					description=_ "slam"
					icon="attacks/slam-drake.png"
					name="slam"
					number="3"
					range="melee"
					type="impact"
				[/attack]
				[attack]
					damage="5"
					description=_ "fire breath"
					icon="attacks/fire-breath-drake.png"
					name="fire breath"
					number="3"
					range="ranged"
					type="fire"
					[specials]
						[chance_to_hit]
							active_on="offense"
							cumulative="yes"
#textdomain wesnoth
							description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
							id="marksman"
							name=_ "marksman"
							value="60"
						[/chance_to_hit]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="chaotic"
				alpha="256"
				attacks_left="1"
				cost="46"
				description="Le puissant guerrier saurien Xikkrisx de Syrsszk fut envoyé dans cette région par les anciens du clan Rysssrylosszkk (traduction : « Le Clan des Chasses-Ennemis-dans-Rivières-Brûlantes »), qui se préparaient à attaquer un avant-poste humain et qui avaient grand besoin de la magie puissante d'Oxsrrsk, un mystique saurien vu pour la dernière fois se dirigeant vers le lac Ruaskkolin. Xikkrisx découvrit le corps pétrifié d'Oxsrrsk, ainsi qu'un parchemin soigneusement enroulé visiblement tombé dans une petite crevasse du sol de la caverne. Il le déroula et lut un bref passage au milieu du texte : « Après avoir été enchaîné et expulsé du Monde Supérieur, l'esprit furieux de Chak'kso chercha à se libérer pour excercer sur plusieurs régions du Monde Supérieur une influence corruptrice canalisée par des « voies de pierre » qui s'enfoncent de la surface jusqu'à la Marche d'En-bas. Sa fureur transforma des œufs de lézards supérieurs, conditionnant leurs corps et leur esprits à faire vivre la haine de Chak'kso. Désorienté, Xikkrisx se concentra sur la tâche à accomplir. Pensant que les anciens pourraient peut-être trouver un moyen de libérer Oxsrrsk, il entreprit la longue et difficile tâche de ramener la statue dans les terres du clan Rysssrylosszkk. Épuisé, mais très proche du lac, Xikkrisx posa la statue dans une petite caverne et s'allongea pour se reposer. Il fut réveillé par un grondement à glacer le sang."
				die_sound="hiss-die.wav"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flies="false"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Saurian Flanker-4"
				image="units/saurians/flanker.png"
#textdomain wesnoth-units
				language_name=_ "Saurian Flanker"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="7"
				movement_type="lizard"
				moves="0"
				name="Xikkrisx"
				profile="portraits/saurians/skirmisher.png"
				race="lizard"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Saurian Flanker"
				undead_variation="saurian"
				underlying_id="4"
				unrenamable="yes"
				upkeep="full"
				usage="scout"
				x="40"
				y="8"
				zoc="yes"
				[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]
				[advancement]
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[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]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="8"
#textdomain wesnoth-units
					description=_ "spear"
					icon="attacks/spear.png"
					name="spear"
					number="4"
					range="melee"
					type="pierce"
				[/attack]
				[attack]
					damage="7"
					description=_ "spear"
					icon="attacks/spear.png"
					name="spear"
					number="2"
					range="ranged"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="chaotic"
				alpha="256"
				attacks_left="1"
				cost="27"
				description="Oxsrrsk était un puissant oracle saurien qui, lors d'un raid contre le clan rival Xraxss, avait trouvé dans les coffres du défunt oracle Hesx-Rzzak un parchemin des plus fascinants. Intitulé « Ney'yks des regards granitiques », il parlait d'une créature connue sous le nom de « Chak'kso Ney'yks », qui dans une langue vielle saurienne signifiait « Aîné des fils de Chak'kso ». Les légendes elfes décrivaient Chak'kso comme un démon majeur de la terre, ou un puissant demi-dieu de la Marche d'En-bas, qui avait cherché jadis à pétrifier toute vie terrestre tellement sa haine pour les créatures de chair était grande. Il fut finalement vaincu et dépossédé de ses pouvoirs magiques ; mais des siècles après son bannissement, dans une région bien éloignée de la surface terrestre, une nouvelle espèce apparut, capable de transformer en pierre toute créature de chair. Il y eut une époque où les basilics, comme on les nommait, faisaient des ravages dans le monde des vivants, transformant des milliers d'êtres en statues. Les basilics furent tous vaincus, mais au prix fort. Tous, apparemment, sauf un : celui connu sous le nom de « Ney'yks », ou bien « L'Aîné des fils ». Pleinement convaincu de ses capacités à localiser et à asservir cette puissante créature, Oxsrrsk se mit en route..."
				die_sound="hiss-die.wav"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flies="false"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Saurian Oracle-5"
				image="units/saurians/oracle.png"
				language_name=_ "Saurian Oracle"
				level="2"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="6"
				movement_type="lizard"
				moves="0"
				name="Oxsrrsk"
				profile="portraits/saurians/augur.png"
				race="lizard"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Saurian Oracle"
				undead_variation="saurian"
				underlying_id="5"
				unrenamable="yes"
				upkeep="full"
				usage="archer"
				x="39"
				y="8"
				zoc="yes"
				[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]
				[advancement]
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[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]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="4"
#textdomain wesnoth-units
					description=_ "staff"
					icon="attacks/staff-magic.png"
					name="staff"
					number="3"
					range="melee"
					type="impact"
				[/attack]
				[attack]
					damage="8"
					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]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Elvish Sharpshooter"
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="41"
				description="Corps svelte et mains qui dansent
- - Sept diamants et onze
Ses adversaires n'avaient aucune chance
- - Sept diamants et onze
Maldragon l'archer
Au milieu des statues 
A été tué
- - Sept diamants et l'elfe
(inscrit par Gauteamus)"
				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"
				experience="0"
				facing="se"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Elvish Marksman-6"
				image="units/elves-wood/marksman.png"
#textdomain wesnoth-units
				language_name=_ "Elvish Marksman"
				level="2"
				max_attacks="1"
				max_experience="56"
				max_hitpoints="1"
				max_moves="0"
				movement="6"
				movement_type="woodland"
				moves="0"
				profile="portraits/elves/marksman.png"
				race="elf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Elvish Marksman"
				undead_variation="archer"
				underlying_id="6"
				unrenamable="yes"
				upkeep="full"
				usage="archer"
				x="2"
				y="11"
				zoc="yes"
				[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]
				[portrait]
					image="portraits/elves/transparent/marksman.png"
					mirror="true"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/elves/transparent/marksman.png"
					mirror="false"
					side="right"
					size="400"
				[/portrait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="6"
					description=_ "sword"
					icon="attacks/sword-elven.png"
					name="sword"
					number="2"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="9"
					description=_ "longbow"
					icon="attacks/bow-elven-magic.png"
					name="longbow"
					number="4"
					range="ranged"
					type="pierce"
					[specials]
						[chance_to_hit]
							active_on="offense"
							cumulative="yes"
#textdomain wesnoth
							description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
							id="marksman"
							name=_ "marksman"
							value="60"
						[/chance_to_hit]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="chaotic"
				alpha="256"
				attacks_left="1"
				cost="41"
				description="Blum Duk le gobelin était renommé dans son clan pour son courage et pour avoir domestiqué un des loups noirs des montagnes. Seuls son autorité et ses compétences maintenaient vivants les gobelins de la région malgré les menaces des humains et des elfes. La rumeur disait que son loup avait tué cinquante hommes et une centaine d'elfes.
Quand il apprit qu'un monstre horrible vivait dans les parages, il parut tout naturel qu'il parte l'affronter seul. Tous s'attendaient à ce qu'il tue la créature facilement et rapporte sa carcasse pour un festin.
Un grand choc l'attendait. Blum Duk se mit à trembler dès qu'il vit le basilic. Il essaya de s'enfuir sur son loup, mais il ne put pas bouger. Comme la créature venait sur lui, il cria ces derniers mots : « Bon Gog, mon chien, tes pattes sont-elles en pierre ?!? »
(inscrit par Elvish Pillager)"
				die_sound="wolf-die.wav"
				experience="0"
				facing="se"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Direwolf Rider-7"
				image="units/goblins/direwolver.png"
#textdomain wesnoth-units
				language_name=_ "Direwolf Rider"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="10"
				movement_type="orcishfoot"
				moves="0"
				name="Blum Duk"
				race="wolf"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Direwolf Rider"
				undead_variation="mounted"
				underlying_id="7"
				unrenamable="yes"
				upkeep="full"
				usage="scout"
				x="10"
				y="17"
				zoc="yes"
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="60"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="70"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="2"
					fungus="3"
					hills="1"
					impassable="99"
					mountains="2"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="100"
					blade="100"
					cold="100"
					fire="100"
					impact="100"
					pierce="100"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="9"
#textdomain wesnoth-units
					description=_ "fangs"
					icon="attacks/fangs-animal.png"
					name="fangs"
					number="4"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="4"
					description=_ "claws"
					icon="attacks/claws-animal.png"
					name="claws"
					number="4"
					range="melee"
					type="blade"
					[specials]
						[poison]
#textdomain wesnoth
							description=_ "Poison:
This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison can not, of itself, kill a unit."
							id="poison"
							name=_ "poison"
						[/poison]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="100"
				description="Rah Ihn Mar, champion des Collines Brûlantes, poursuivit jusqu'au lac Ruaskkolin Terowydlithrol le héros elfe, connu parmi les siens sous le nom de « L'Exécuteur de dragons ». On raconte que Terowydlithrol tua un dragon de feu qui menaçait un village elfe et initia une « contre-attaque » dans laquelle périrent 37 dracans supposés faire allégeance au dragon et campant sur un ravin avoisinant. Sachant ces dracans innocents, Rah Ihn Mar arriva au lac pour traquer et tuer Terowydlithrol, arrivé la veille dans la région. Consummé par la vengeance, Rah Ihn Mar commença sa chasse..."
				die_sound="drake-die.ogg"
				ellipse="misc/ellipse"
				experience="0"
				facing="se"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Armageddon Drake-8"
				image="units/drakes/armageddon.png"
#textdomain wesnoth-units
				language_name=_ "Armageddon Drake"
				level="4"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="5"
				movement_type="drakefly"
				moves="0"
				name="Rah Ihn Mar"
				profile="portraits/drakes/burner.png"
				race="drake"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Armageddon Drake"
				undead_variation="drake"
				underlying_id="8"
				unrenamable="yes"
				upkeep="full"
				usage="archer"
				x="11"
				y="14"
				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="0"
					impact="80"
					pierce="110"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="15"
#textdomain wesnoth-units
					description=_ "claws"
					icon="attacks/claws-drake.png"
					name="claws"
					number="2"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="12"
					description=_ "fire breath"
					icon="attacks/fire-breath-drake.png"
					name="fire breath"
					number="6"
					range="ranged"
					type="fire"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="chaotic"
				alpha="256"
				attacks_left="1"
				cost="40"
				description="Il avait vécu là depuis toujours, dans les profondeurs de l'eau, se nourrissant des poissons, des grenouilles et des ondins qui entraient dans son domaine. C'était son lac et celui d'aucun autre, et même s'il n'était pas grand, il en était le maître. Alors vint le basilic qui regarda le serpent dans les yeux. Et le serpent ne mourut pas, mais il n'était plus vivant. Ainsi le nouveau seigneur du lac était venu.
(inscrit par Turin)"
				die_sound="water-blast.wav"
				experience="0"
				facing="sw"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Sea Serpent-9"
				image="units/monsters/seaserpent.png"
				language_name=_ "Sea Serpent"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="8"
				movement_type="deepsea"
				moves="0"
				profile="portraits/monsters/sea-serpent.png"
				race="monster"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Sea Serpent"
				undead_variation="swimmer"
				underlying_id="9"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="22"
				y="12"
				zoc="yes"
				[defense]
					castle="70"
					cave="80"
					deep_water="40"
					flat="70"
					forest="70"
					frozen="70"
					fungus="80"
					hills="70"
					impassable="80"
					mountains="80"
					reef="50"
					sand="70"
					shallow_water="50"
					swamp_water="40"
					unwalkable="80"
					village="70"
				[/defense]
				[movement_costs]
					castle="1"
					cave="3"
					deep_water="1"
					flat="4"
					forest="5"
					frozen="2"
					fungus="3"
					hills="5"
					impassable="99"
					mountains="99"
					reef="2"
					sand="4"
					shallow_water="2"
					swamp_water="2"
					unwalkable="99"
					village="2"
				[/movement_costs]
				[resistance]
					arcane="100"
					blade="80"
					cold="40"
					fire="100"
					impact="70"
					pierce="100"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="18"
#textdomain wesnoth-units
					description=_ "fangs"
					icon="attacks/fangs-animal.png"
					name="fangs"
					number="2"
					range="melee"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="58"
				description="Vaillant héros de l'âge d'or de Wesnoth, ce grand cavalier et excellent meneur d'hommes arriva dans ce lieu maudit lors d'un raid contre des orcs. Pris par surprise par ces odieuses créatures, beaucoup de ses compagnons furent occis, mais lui se battit vaillamment et tua de nombreux ennemis. Mais hélas ! l'horrible basilic se tourna vers lui et le changea en pierre au moment où il tuait le dernier orc. Il ne reste plus qu'un raide témoignage de sa prestance et de sa grande force passées.
(inscrit par Fynmiir)"
				die_sound="horse-die.ogg"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Grand Knight-10"
				image="units/human-loyalists/grand-knight.png"
				language_name=_ "Grand Knight"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="7"
				movement_type="mounted"
				moves="0"
				profile="portraits/humans/grand-knight.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Grand Knight"
				undead_variation="mounted"
				underlying_id="10"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="25"
				y="14"
				zoc="yes"
				[defense]
					castle="60"
					cave="80"
					deep_water="80"
					flat="60"
					forest="70"
					frozen="70"
					fungus="80"
					hills="60"
					impassable="80"
					mountains="80"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="1"
					cave="4"
					deep_water="99"
					flat="1"
					forest="3"
					frozen="2"
					fungus="4"
					hills="2"
					impassable="99"
					mountains="99"
					reef="3"
					sand="2"
					shallow_water="4"
					swamp_water="4"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="80"
					cold="100"
					fire="100"
					impact="70"
					pierce="120"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="12"
#textdomain wesnoth-units
					description=_ "sword"
					icon="attacks/greatsword-human.png"
					name="sword"
					number="4"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="17"
					description=_ "lance"
					name="lance"
					number="2"
					range="melee"
					type="pierce"
					[specials]
						[damage]
							active_on="offense"
							apply_to="both"
#textdomain wesnoth
							description=_ "Charge:
When used offensively, this attack deals double damage to the target. It also causes this unit to take double damage from the target's counterattack."
							id="charge"
							multiply="2"
							name=_ "charge"
						[/damage]
					[/specials]
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				advances_to="Ancient Wose"
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="31"
				description="Bramwythl le wose a toujours été considéré comme lent et taciturne, même par les autres woses. Plus que tout autre, il aimait simplement rester debout sous le soleil, les bras levés, admirant la beauté du ciel. Une fois, il confia même à un camarade que son plus grand souhait serait de pouvoir baigner pour toujours dans la gloire du soleil.
Cependant, peu de temps après, la communauté wose locale apprit l'arrivée d'un monstre horrible, assez puissant pour détruire facilement le peu d'entre eux qui vivaient dans les parages. Ils s'en allèrent rapidement (pour des woses, en tout cas), mais Bramwythl resta en arrière ; dans leur hâte, aucun ne pensa à aller le prévenir du danger.
Il fut complètement pris par surprise par le basilic et changé en pierre avant même de reconnaître la bête. Sa silhouette pétrifiée est encore là aujourd'hui, chauffée par les rayons du soleil, sous la voûte céleste. Son souhait le plus cher lui avait été accordé.
(inscrit par Elvish Pillager)"
				die_sound="wose-die.ogg"
				experience="0"
				facing="se"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Elder Wose-11"
				image="units/woses/wose-elder.png"
#textdomain wesnoth-units
				language_name=_ "Elder Wose"
				level="2"
				max_attacks="1"
				max_experience="70"
				max_hitpoints="1"
				max_moves="0"
				movement="4"
				movement_type="treefolk"
				moves="0"
				name="Bramwythl"
				race="wose"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Elder Wose"
				undead_variation="wose"
				underlying_id="11"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="32"
				y="6"
				zoc="yes"
				[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"
					stoned="on"
				[/status]
				[attack]
					damage="19"
#textdomain wesnoth-units
					description=_ "crush"
					icon="attacks/crush-wose.png"
					name="crush"
					number="2"
					range="melee"
					type="impact"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="50"
				description="Le général Talael Ryndoc est venu ici pour se battre en duel contre le maréchal Aethec Corryn, mais les deux hommes ne se sont jamais trouvés. "
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Iron Mauler-12"
				image="units/human-loyalists/siegetrooper.png"
				language_name=_ "Iron Mauler"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="4"
				movement_type="armoredfoot"
				moves="0"
				name="Talael Ryndoc"
				profile="portraits/humans/iron-mauler.png~RIGHT()"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Iron Mauler"
				underlying_id="12"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="34"
				y="11"
				zoc="yes"
				[defense]
					castle="50"
					cave="60"
					deep_water="80"
					flat="70"
					forest="60"
					frozen="80"
					fungus="60"
					hills="60"
					impassable="60"
					mountains="80"
					reef="80"
					sand="80"
					shallow_water="90"
					swamp_water="90"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="4"
					fungus="2"
					hills="3"
					impassable="99"
					mountains="99"
					reef="3"
					sand="2"
					shallow_water="4"
					swamp_water="4"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="50"
					cold="110"
					fire="110"
					impact="90"
					pierce="60"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[portrait]
					image="portraits/humans/transparent/iron-mauler.png"
					mirror="false"
					side="right"
					size="400"
				[/portrait]
				[trait]
					description=_ "Fights normally during unfavorable times of day/night"
					female_name=_ "female^fearless"
					id="fearless"
					male_name=_ "fearless"
				[/trait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="25"
#textdomain wesnoth-units
					description=_ "mace"
					name="mace"
					number="2"
					range="melee"
					type="impact"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="66"
				description="Les dernières paroles du maréchal Aethec Corryn furent : « Talael Ryndoc ! Je n'arrête pas de courir après vous ! Je vais retourner à la cour de Haldric et l'informer que vous êtes bien trop lâche pour participer à notre duel ! Votre disgrâce sera plus infamante que la mort que je vous aurais donnée ! »

Sans doute aurait-il mieux fait de ne pas crier si fort ... "
				die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Grand Marshal-13"
				image="units/human-loyalists/marshal.png"
				language_name=_ "Grand Marshal"
				level="4"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="6"
				movement_type="smallfoot"
				moves="0"
				name="Aethec Corryn"
				profile="portraits/humans/marshal.png"
				race="human"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Grand Marshal"
				underlying_id="13"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="15"
				y="11"
				zoc="yes"
				[defense]
					castle="40"
					cave="60"
					deep_water="80"
					flat="60"
					forest="50"
					frozen="80"
					fungus="50"
					hills="50"
					impassable="60"
					mountains="40"
					reef="70"
					sand="70"
					shallow_water="80"
					swamp_water="80"
					unwalkable="80"
					village="40"
				[/defense]
				[movement_costs]
					castle="1"
					cave="2"
					deep_water="99"
					flat="1"
					forest="2"
					frozen="3"
					fungus="2"
					hills="2"
					impassable="99"
					mountains="3"
					reef="2"
					sand="2"
					shallow_water="3"
					swamp_water="3"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="80"
					blade="80"
					cold="100"
					fire="100"
					impact="80"
					pierce="80"
				[/resistance]
				[abilities]
					[leadership]
						affect_self="no"
						cumulative="no"
#textdomain wesnoth
						description=_ "Leadership:
This unit can lead our own units that are next to it, making them fight better.

Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
						female_name=_ "female^leadership"
						id="leadership"
						name=_ "leadership"
						value="100"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="0"
							[/filter]
						[/affect_adjacent]
					[/leadership]
					[leadership]
						affect_self="no"
						cumulative="no"
						id="leadership"
						value="75"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="1"
							[/filter]
						[/affect_adjacent]
					[/leadership]
					[leadership]
						affect_self="no"
						cumulative="no"
						id="leadership"
						value="50"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="2"
							[/filter]
						[/affect_adjacent]
					[/leadership]
					[leadership]
						affect_self="no"
						cumulative="no"
						id="leadership"
						value="25"
						[affect_adjacent]
							adjacent="n,ne,se,s,sw,nw"
							[filter]
								level="3"
							[/filter]
						[/affect_adjacent]
					[/leadership]
				[/abilities]
				[advancement]
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[portrait]
					image="portraits/humans/transparent/marshal.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/humans/transparent/marshal.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="10"
#textdomain wesnoth-units
					description=_ "sword"
					icon="attacks/greatsword-human.png"
					name="sword"
					number="4"
					range="melee"
					type="blade"
				[/attack]
				[attack]
					damage="8"
					description=_ "crossbow"
					icon="attacks/crossbow-human.png"
					name="crossbow"
					number="3"
					range="ranged"
					type="pierce"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="neutral"
				alpha="256"
				attacks_left="1"
				cost="48"
				description="Ce vaillant guerrier, connu sous le nom de Rilhon chez les nagas, entendit parler d'un fabuleux trésor perdu dans ces cavernes humides : une lance dont la pointe proviendrait d'une dent de Chak'kso Ney'yks, un ancestral basilic tué il y a bien longtemps par le héros elfe, Eloralduil. D'après la légende, l'arme reposerait quelque part au fond du lac Ruaskkolin, nommé ainsi en hommage au fameux serpent qui y séjournait. Alors qu'il s'était préparé pour combattre le serpent, Rilhon eut deux énormes surprises : la forme pétrifiée de Ruaskkolin et Chak'kso Ney'yks, extrêmement bien portant et qui avait, comme c'est étrange, encore toutes ses dents.
(inscrit par Paterson)"
				die_sound="naga-die.ogg"
				experience="0"
				facing="se"
				flag_rgb="magenta"
				flying="no"
				gender="male"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Naga Myrmidon-14"
				image="units/nagas/myrmidon.png"
				language_name=_ "Naga Myrmidon"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="7"
				movement_type="naga"
				moves="0"
				name="Rilhon"
				profile="portraits/nagas/fighter.png"
				race="naga"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Naga Myrmidon"
				undead_variation="swimmer"
				underlying_id="14"
				unrenamable="yes"
				upkeep="full"
				usage="fighter"
				x="20"
				y="12"
				zoc="yes"
				[defense]
					castle="50"
					cave="60"
					deep_water="50"
					flat="50"
					forest="60"
					frozen="80"
					fungus="60"
					hills="60"
					impassable="60"
					mountains="60"
					reef="30"
					sand="40"
					shallow_water="40"
					swamp_water="40"
					unwalkable="80"
					village="60"
				[/defense]
				[movement_costs]
					castle="2"
					cave="2"
					deep_water="1"
					flat="2"
					forest="3"
					frozen="2"
					fungus="2"
					hills="3"
					impassable="99"
					mountains="5"
					reef="2"
					sand="1"
					shallow_water="1"
					swamp_water="1"
					unwalkable="99"
					village="1"
				[/movement_costs]
				[resistance]
					arcane="100"
					blade="100"
					cold="120"
					fire="100"
					impact="100"
					pierce="100"
				[/resistance]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="9"
#textdomain wesnoth-units
					description=_ "sword"
					icon="attacks/sword-orcish.png"
					name="sword"
					number="5"
					range="melee"
					type="blade"
				[/attack]
				[modifications]
					[trait]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/effect]
					[/trait]
				[/modifications]
			[/unit]
			[unit]
				alignment="lawful"
				alpha="256"
				attacks_left="1"
				cost="52"
				description="À travers vagues et lits pierreux
Bleue et blanche
Elle avançait et reculait les marées
Et enseignait aux poissons la langue des planètes
Gris vert
De la magie
Coulant de son esprit vers les fils du varech et les coquilles d'escargots
Un tour de queue et un geste de ses mains
Elle envoyait ses chants courir le sable sur leurs pieds d'aiguille
Et maintenant
Et maintenant la plus étrange pause
Depuis des siècles
Plus un œil ne bouge

(inscrit par MJQ)"
				die_sound="mermaid-die.ogg"
				experience="0"
				facing="sw"
				flag_rgb="magenta"
				flying="no"
				gender="female"
				goto_x="0"
				goto_y="0"
				hitpoints="1"
				id="Mermaid Siren-15"
				image="units/merfolk/siren.png"
				language_name=_ "Mermaid Siren"
				level="3"
				max_attacks="1"
				max_experience="105"
				max_hitpoints="1"
				max_moves="0"
				movement="7"
				movement_type="swimmer"
				moves="0"
				profile="portraits/merfolk/initiate.png"
				race="merman"
				random_gender="no"
				random_traits="no"
				resting="yes"
				side="3"
				type="Mermaid Siren"
				undead_variation="swimmer"
				underlying_id="15"
				unrenamable="yes"
				upkeep="full"
				usage="mixed fighter"
				x="17"
				y="11"
				zoc="yes"
				[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]
				[advancement]
#textdomain wesnoth
					description=_ "Max HP bonus +3, Max XP +20%"
					id="amla_default"
					image="misc/icon-amla-tough.png"
					max_times="100"
					strict_amla="yes"
					[effect]
						apply_to="hitpoints"
						heal_full="yes"
						increase_total="3"
					[/effect]
					[effect]
						apply_to="max_experience"
						increase="20%"
					[/effect]
					[effect]
						apply_to="status"
						remove="poisoned"
					[/effect]
					[effect]
						apply_to="status"
						remove="slowed"
					[/effect]
				[/advancement]
				[portrait]
					image="portraits/merfolk/transparent/initiate.png"
					mirror="false"
					side="left"
					size="400"
				[/portrait]
				[portrait]
					image="portraits/merfolk/transparent/initiate.png"
					mirror="true"
					side="right"
					size="400"
				[/portrait]
				[variables]
				[/variables]
				[status]
					hidden="yes"
					stoned="on"
				[/status]
				[attack]
					damage="12"
#textdomain wesnoth-units
					description=_ "naia touch"
					icon="attacks/touch-faerie.png"
					name="naia touch"
					number="1"
					range="melee"
					type="impact"
					[specials]
						[chance_to_hit]
							cumulative="no"
#textdomain wesnoth
							description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
							id="magical"
							name=_ "magical"
							value="70"
						[/chance_to_hit]
					[/specials]
				[/attack]
				[attack]
					damage="15"
#textdomain wesnoth-units
					description=_ "water spray"
					icon="attacks/waterspray.png"
					name="water spray"
					number="3"
					range="ranged"
					type="impact"
					[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]
						id="remove_hp"
						[effect]
							apply_to="hitpoints"
							increase_total="-100%"
						[/effect]
						[effect]
							apply_to="movement"
							set="0"
						[/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]
		[music]
			ms_after="0"
			ms_before="12000"
			name="knolls.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="wanderer.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="battle.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="transience.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="revelation.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="loyalists.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="the_king_is_dead.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="knalgan_theme.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="the_city_falls.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="nunc_dimittis.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="breaking_the_chains.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="elvish-theme.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="legends_of_the_north.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="traveling_minstrels.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="underground.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="vengeful.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="frantic.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="the_dangerous_symphony.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="heroes_rite.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="suspense.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="the_deep_path.ogg"
		[/music]
		[music]
			append="yes"
			ms_after="0"
			ms_before="12000"
			name="siege_of_laurelmor.ogg"
		[/music]
		[variables]
			damage_inflicted="7"
			side_number="2"
			turn_number="9"
		[/variables]
		[player]
			can_recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
			gold="-1"
			gold_add="no"
			save_id="ai3"
		[/player]
		[player]
			can_recruit="Elvish Archer,Elvish Fighter,Elvish Scout,Elvish Shaman,Mage,Merman Hunter,Wose"
			gold="-1"
			gold_add="no"
			save_id="akkon2"
		[/player]
		[player]
			can_recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
			gold="-1"
			gold_add="no"
			save_id="ced1"
		[/player]
		[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]
	[/snapshot]
	[replay]
		[command]
			[start]
			[/start]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="montoto has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[recruit]
				value="2"
				x="18"
				y="5"
			[/recruit]
			[random]
				value="986150167"
			[/random]
			[random]
				value="1495257364"
			[/random]
			[random]
				value="874996680"
			[/random]
			[random]
				value="129085034"
			[/random]
			[random]
				value="122244120"
			[/random]
			[random]
				value="1491551506"
			[/random]
			[random]
				value="1238558667"
			[/random]
			[random]
				value="216792401"
			[/random]
			[random]
				value="1950568803"
			[/random]
			[random]
				value="1144959309"
			[/random]
			[random]
				value="1268601710"
			[/random]
			[random]
				value="218029696"
			[/random]
			[random]
				value="989438580"
			[/random]
			[random]
				value="510768129"
			[/random]
			[random]
				value="2066782236"
				[results]
					checksum="RUQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvLyMAS8wEVRB+JCszfJzd4jC+rc<MF13amk4nil5K7b35>-yp,-98,eyb6ac"
				[/results]
			[/random]
		[/command]
		[command]
			[recruit]
				value="1"
				x="19"
				y="5"
			[/recruit]
			[random]
				value="2028514537"
			[/random]
			[random]
				value="1701591310"
			[/random]
			[random]
				value="211234298"
			[/random]
			[random]
				value="237880994"
			[/random]
			[random]
				value="136553015"
			[/random]
			[random]
				value="1197384465"
			[/random]
			[random]
				value="1733138358"
			[/random]
			[random]
				value="1011549695"
			[/random]
			[random]
				value="1326469499"
			[/random]
			[random]
				value="1855382478"
			[/random]
			[random]
				value="355617554"
			[/random]
			[random]
				value="417544519"
			[/random]
			[random]
				value="2072174879"
			[/random]
			[random]
				value="158702709"
			[/random]
			[random]
				value="1562503828"
				[results]
					checksum="14,Wfc>cu2lH0olW9-5N-m<e6f60hfabkcij<4>i3h3e2.t0a1f<j870h0k565.Y0>ide9Mi80k.d8da021n<.26Z+40CN5c8b.-X,48E.7v3f3XdJFikGGOwGMoVOFH"
				[/results]
			[/random]
		[/command]
		[command]
			[recruit]
				value="6"
				x="20"
				y="4"
			[/recruit]
			[random]
				value="830404681"
			[/random]
			[random]
				value="230033528"
			[/random]
			[random]
				value="760380802"
			[/random]
			[random]
				value="203155035"
			[/random]
			[random]
				value="1016792738"
			[/random]
			[random]
				value="98139597"
			[/random]
			[random]
				value="30205310"
			[/random]
			[random]
				value="1896653586"
			[/random]
			[random]
				value="404027576"
			[/random]
			[random]
				value="2058719848"
			[/random]
			[random]
				value="1450761248"
			[/random]
			[random]
				value="615261875"
			[/random]
			[random]
				value="149117194"
			[/random]
			[random]
				value="1587314263"
			[/random]
			[random]
				value="1812646340"
				[results]
					checksum="XBfX4cmdHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ep7ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j6D1<4M26i7zO.<CByI"
				[/results]
			[/random]
		[/command]
		[command]
			[recruit]
				value="6"
				x="22"
				y="4"
			[/recruit]
			[random]
				value="965700573"
			[/random]
			[random]
				value="824196891"
			[/random]
			[random]
				value="560654906"
			[/random]
			[random]
				value="1342432979"
			[/random]
			[random]
				value="1228655652"
			[/random]
			[random]
				value="117232329"
			[/random]
			[random]
				value="1638463972"
			[/random]
			[random]
				value="1148689449"
			[/random]
			[random]
				value="1656804070"
			[/random]
			[random]
				value="321385006"
			[/random]
			[random]
				value="1378722977"
			[/random]
			[random]
				value="269701224"
			[/random]
			[random]
				value="524540041"
			[/random]
			[random]
				value="248032067"
			[/random]
			[random]
				value="367840821"
				[results]
					checksum="XBfX4cmdHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ep8ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j3D1<4M96i7zO.<CyyI"
				[/results]
			[/random]
		[/command]
		[command]
			[recruit]
				value="4"
				x="23"
				y="5"
			[/recruit]
			[random]
				value="2043925157"
			[/random]
			[random]
				value="1940025032"
			[/random]
			[random]
				value="2146172043"
			[/random]
			[random]
				value="1305618220"
			[/random]
			[random]
				value="1307386997"
			[/random]
			[random]
				value="964388969"
			[/random]
			[random]
				value="2129815111"
			[/random]
			[random]
				value="1868041903"
			[/random]
			[random]
				value="159338300"
			[/random]
			[random]
				value="1210987115"
			[/random]
			[random]
				value="1985274232"
			[/random]
			[random]
				value="1797802272"
			[/random]
			[random]
				value="212192917"
			[/random]
			[random]
				value="1494594654"
			[/random]
			[random]
				value="2119187278"
				[results]
					checksum="KcwfALHM1AKcptV75qVBLNNDjB+ho.t0,fnp91.7>Yl1cF7<01e5yd,9+0e3j4jcb6cifadb1-6cKf37b2ifil7.WgZ2.h<5-XxS+j>k2403-p8TA9v9PQDp80F<5210"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Calandryl has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[recruit]
				value="2"
				x="24"
				y="5"
			[/recruit]
			[random]
				value="2024423441"
			[/random]
			[random]
				value="1048461038"
			[/random]
			[random]
				value="334456324"
			[/random]
			[random]
				value="1216113972"
			[/random]
			[random]
				value="944902547"
			[/random]
			[random]
				value="126997708"
			[/random]
			[random]
				value="1214802368"
			[/random]
			[random]
				value="103037119"
			[/random]
			[random]
				value="1434384705"
			[/random]
			[random]
				value="31707689"
			[/random]
			[random]
				value="85368583"
			[/random]
			[random]
				value="1154942960"
			[/random]
			[random]
				value="191045989"
			[/random]
			[random]
				value="1296355698"
			[/random]
			[random]
				value="992733545"
				[results]
					checksum="RVQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvKtMAS8wEVRB+JCszfJzd4kC+rc<MF13amk4yil5K7b35>-yp,+<8,eyb6ac"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="21,20,19,18,17"
				y="4,4,4,3,3"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="enjoy"
				side="1"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="halk has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="carvalho has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="18"
				y="19"
			[/recruit]
			[random]
				value="1798862908"
			[/random]
			[random]
				value="1790374444"
			[/random]
			[random]
				value="1403547448"
			[/random]
			[random]
				value="511946038"
			[/random]
			[random]
				value="2068033421"
			[/random]
			[random]
				value="1990324124"
			[/random]
			[random]
				value="505124289"
			[/random]
			[random]
				value="2129586378"
			[/random]
			[random]
				value="13849797"
			[/random]
			[random]
				value="1751222334"
			[/random]
			[random]
				value="2131523470"
			[/random]
			[random]
				value="220432758"
			[/random]
			[random]
				value="1914831685"
			[/random]
			[random]
				value="1830505704"
			[/random]
			[random]
				value="906684844"
				[results]
					checksum="oxj+sAh20PB0NmsQ56tLoxNPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Smozes has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="24"
				y="19"
			[/recruit]
			[random]
				value="1770552031"
			[/random]
			[random]
				value="1022125656"
			[/random]
			[random]
				value="1491755337"
			[/random]
			[random]
				value="1487213511"
			[/random]
			[random]
				value="366220303"
			[/random]
			[random]
				value="2085696325"
			[/random]
			[random]
				value="705344869"
			[/random]
			[random]
				value="426734969"
			[/random]
			[random]
				value="1737075585"
			[/random]
			[random]
				value="348235665"
			[/random]
			[random]
				value="1830282418"
			[/random]
			[random]
				value="101537975"
			[/random]
			[random]
				value="268785438"
			[/random]
			[random]
				value="1673122894"
			[/random]
			[random]
				value="606662264"
				[results]
					checksum="DB3s-,zQn1M2yLIrtl,yvEJs+TqLAH7qSCNCNSvmIJ>KNGxwmIQwSVVvQLyBGFwuCzBR9PMVRCroPzMEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="1"
				x="23"
				y="20"
			[/recruit]
			[random]
				value="2005897143"
			[/random]
			[random]
				value="1991840960"
			[/random]
			[random]
				value="1076660881"
			[/random]
			[random]
				value="1638805037"
			[/random]
			[random]
				value="963625777"
			[/random]
			[random]
				value="699729265"
			[/random]
			[random]
				value="513447045"
			[/random]
			[random]
				value="307897466"
			[/random]
			[random]
				value="39459128"
			[/random]
			[random]
				value="879667348"
			[/random]
			[random]
				value="246110143"
			[/random]
			[random]
				value="744803997"
			[/random]
			[random]
				value="1306402318"
			[/random]
			[random]
				value="1983185728"
			[/random]
			[random]
				value="1093039662"
				[results]
					checksum="ACIByNSVYyLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9vumVnpCouMKPBb5TJGPbmz3o>.fjcflW4p97m5p7"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="1"
				x="19"
				y="20"
			[/recruit]
			[random]
				value="861701584"
			[/random]
			[random]
				value="613533470"
			[/random]
			[random]
				value="897374830"
			[/random]
			[random]
				value="720115080"
			[/random]
			[random]
				value="457890782"
			[/random]
			[random]
				value="1974035712"
			[/random]
			[random]
				value="211436469"
			[/random]
			[random]
				value="1421516560"
			[/random]
			[random]
				value="526281329"
			[/random]
			[random]
				value="724883514"
			[/random]
			[random]
				value="1729414026"
			[/random]
			[random]
				value="565740457"
			[/random]
			[random]
				value="1604550863"
			[/random]
			[random]
				value="1975524170"
			[/random]
			[random]
				value="1310544454"
				[results]
					checksum="ACIByNSVYzLXPemyRXKFwqFrLmVQqEv0TwtBGgNMvJHtOMFtHrtKmNzMnuxEPDq6BPSLFIOJqR+ProSyETFwFyA9uumVnpCouMKPBb5OJGPbmz3o>.fjcflW4pf7m5p7"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,22,23,24,25"
				y="21,20,20,20,21"
			[/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"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			undo="no"
			[speak]
				id="akkon"
				message=" u2"
				side="2"
			[/speak]
		[/command]
		[command]
			[move]
				x="18,17,16,15,14,13,12"
				y="5,5,5,5,5,5,4"
			[/move]
		[/command]
		[command]
			[move]
				x="22,21,21,21,21,21,22"
				y="4,5,6,7,8,9,9"
			[/move]
		[/command]
		[command]
			[move]
				x="20,21,21,21,21,21,21"
				y="4,5,6,7,8,9,10"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfopps002Josh002 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="17,17,17,17,17,17"
				y="3,4,5,6,7,8"
			[/move]
		[/command]
		[command]
			[move]
				x="19,18,17,16,15,14,13,12,12"
				y="5,5,6,6,7,7,8,8,9"
			[/move]
		[/command]
		[command]
			[move]
				x="12,12"
				y="9,10"
			[/move]
		[/command]
		[command]
			[move]
				x="24,24,24,24,25,26,26"
				y="5,6,7,8,9,9,10"
			[/move]
		[/command]
		[command]
			[move]
				x="23,24,25,26,27,28,29,30,31"
				y="5,5,6,6,6,5,5,5,6"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[move]
				x="24,25,26,27,28,29,30"
				y="19,20,20,21,20,20,20"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="23,24,24,25,25"
				y="20,19,18,18,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="19,19,19,19,19,20"
				y="20,19,18,17,16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="rio has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="18,18,18,18,17,16"
				y="19,18,17,16,16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="16,16"
				y="15,14"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="seano has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="25,24,23,22,21"
				y="21,20,20,20,21"
			[/move]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="18"
				y="19"
			[/recruit]
			[random]
				value="1921167638"
			[/random]
			[random]
				value="1692231181"
			[/random]
			[random]
				value="541896580"
			[/random]
			[random]
				value="86934431"
			[/random]
			[random]
				value="1346485973"
			[/random]
			[random]
				value="405798641"
			[/random]
			[random]
				value="2100651736"
			[/random]
			[random]
				value="630762176"
			[/random]
			[random]
				value="220578361"
			[/random]
			[random]
				value="1247395213"
			[/random]
			[random]
				value="1046584881"
			[/random]
			[random]
				value="272756385"
			[/random]
			[random]
				value="1198555844"
			[/random]
			[random]
				value="306419899"
			[/random]
			[random]
				value="826156365"
				[results]
					checksum="lxj+sAh20PB1VmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw-InBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="24"
				y="19"
			[/recruit]
			[random]
				value="374260378"
			[/random]
			[random]
				value="42539317"
			[/random]
			[random]
				value="315301491"
			[/random]
			[random]
				value="787815614"
			[/random]
			[random]
				value="383617756"
			[/random]
			[random]
				value="1406357886"
			[/random]
			[random]
				value="868145384"
			[/random]
			[random]
				value="157301747"
			[/random]
			[random]
				value="951105419"
			[/random]
			[random]
				value="1410041964"
			[/random]
			[random]
				value="244236178"
			[/random]
			[random]
				value="150107745"
			[/random]
			[random]
				value="1815840605"
			[/random]
			[random]
				value="197404266"
			[/random]
			[random]
				value="780869921"
				[results]
					checksum="oxj+sAh20PB1VmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw-InBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8EE25"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[countdown_update]
				team="2"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			sent="yes"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="R has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="12,12,12,12,12,12,11,11"
				y="4,5,6,7,8,9,10,11"
			[/move]
		[/command]
		[command]
			[move]
				x="12,12"
				y="10,9"
			[/move]
		[/command]
		[command]
			[move]
				x="12,11,10,9,8"
				y="9,10,10,11,11"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="StuckInPurgatory has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfgen001Trev01 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="8,7,6,6,6"
				y="11,12,12,13,14"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="angafalath has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfopps002Josh has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="21,20"
				y="10,10"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="ozkriff has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="20,20,19,19"
				y="10,11,12,13"
			[/move]
		[/command]
		[command]
			[move]
				x="22,22,22,23,23"
				y="9,10,11,12,13"
			[/move]
		[/command]
		[command]
			[move]
				x="31,31,31,31,31,31"
				y="6,7,8,9,10,11"
			[/move]
		[/command]
		[command]
			[move]
				x="26,27,28,29,30"
				y="10,11,11,12,12"
			[/move]
		[/command]
		[command]
			[move]
				x="31,31"
				y="11,10"
			[/move]
		[/command]
		[command]
			[move]
				x="17,17,17,18"
				y="8,7,6,5"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[move]
				x="30,30"
				y="20,19"
			[/move]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="i suspect you made a few trees ..."
				side="1"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="30,30,30,30,31"
				y="19,18,17,16,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="alph has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Emrizzle has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="allans has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Khorne_Flakes has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="25,25,26,27,28,29"
				y="17,18,18,18,17,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="18,17,16,15,14,13"
				y="19,20,19,20,19,19"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="13,12,11"
				y="19,18,19"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="24,25,26,27,28,29,30,31"
				y="19,19,18,18,17,18,17,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="5"
				x="22"
				y="20"
			[/recruit]
			[random]
				value="565804380"
			[/random]
			[random]
				value="527280291"
			[/random]
			[random]
				value="2026950575"
			[/random]
			[random]
				value="1268977747"
			[/random]
			[random]
				value="1690683868"
			[/random]
			[random]
				value="1314327429"
			[/random]
			[random]
				value="2120739851"
			[/random]
			[random]
				value="884027245"
			[/random]
			[random]
				value="2069927954"
			[/random]
			[random]
				value="1828009572"
			[/random]
			[random]
				value="1157514877"
			[/random]
			[random]
				value="401732168"
			[/random]
			[random]
				value="1655124955"
			[/random]
			[random]
				value="1284882054"
			[/random]
			[random]
				value="1435088806"
				[results]
					checksum="tjfpy66<OvHApsEKQ0oOBBSqxDYSGUuIaHzsLFtQzOWOCBvyFBUsQPVHTIwPFmPFBqCnEs<sBULDPTGRPzPuVKDJsNyMJx,RFNPGrGqf<xPrTryODoP.K+zDJqnmswJI"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,22,22,22"
				y="21,20,19,18"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="22,22,22"
				y="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"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Eseth has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			undo="no"
			[speak]
				id="akkon"
				message="so lets see it"
				side="2"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Neves has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="31,32,33,34,35,36,37,38"
				y="10,10,10,10,10,10,11,10"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="isril has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="38,38,39"
				y="10,11,12"
			[/move]
		[/command]
		[command]
			[move]
				x="30,30,30,31"
				y="12,11,10,10"
			[/move]
		[/command]
		[command]
			[recruit]
				value="7"
				x="24"
				y="5"
			[/recruit]
			[random]
				value="1255370437"
			[/random]
			[random]
				value="2045728956"
			[/random]
			[random]
				value="1757210182"
			[/random]
			[random]
				value="629464316"
			[/random]
			[random]
				value="444457677"
			[/random]
			[random]
				value="1336713654"
			[/random]
			[random]
				value="569582200"
			[/random]
			[random]
				value="1344511089"
			[/random]
			[random]
				value="127924695"
			[/random]
			[random]
				value="578972190"
			[/random]
			[random]
				value="1570151196"
			[/random]
			[random]
				value="1666430282"
			[/random]
			[random]
				value="1972050865"
			[/random]
			[random]
				value="721464214"
			[/random]
			[random]
				value="156953084"
				[results]
					checksum=",Ad3Y5f-Gtmnsp5jHbEoRiVrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNQsM8mwoFomIhFlq1.CLW<<ddNv5EsLNHBNzkOI"
				[/results]
			[/random]
		[/command]
		[command]
			[recruit]
				value="7"
				x="23"
				y="5"
			[/recruit]
			[random]
				value="411209145"
			[/random]
			[random]
				value="2119580436"
			[/random]
			[random]
				value="1353680539"
			[/random]
			[random]
				value="980791345"
			[/random]
			[random]
				value="1316607877"
			[/random]
			[random]
				value="1481605234"
			[/random]
			[random]
				value="1559763535"
			[/random]
			[random]
				value="739275426"
			[/random]
			[random]
				value="1000551869"
			[/random]
			[random]
				value="1384330752"
			[/random]
			[random]
				value="1460739640"
			[/random]
			[random]
				value="1157504953"
			[/random]
			[random]
				value="1319649448"
			[/random]
			[random]
				value="421712545"
			[/random]
			[random]
				value="218010780"
				[results]
					checksum=",Ad3Y5f-Gtmsop5jHbEoRiSrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNLoM8mwoFomIhFlq1.CLB<<ddNv5EsLNHBNzhOI"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="SpoOkyMagician has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="6,5"
				y="14,14"
			[/move]
		[/command]
		[command]
			[move]
				x="23,22,21"
				y="13,13,14"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Rio has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="19,18"
				y="13,12"
			[/move]
		[/command]
		[command]
			[move]
				x="21,20,19"
				y="14,13,13"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[move]
				x="20,19,18,17,16,15"
				y="15,16,16,17,17,18"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="22,21,21,21"
				y="20,20,19,18"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,21"
				y="18,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,21,20"
				y="17,16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Lester_Burnham2 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="31,31,31"
				y="17,16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="31,31,31"
				y="15,14,13"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="29,30,31,32,33"
				y="17,16,16,16,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Mourad has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="22,22,22,22,22,21"
				y="16,17,18,19,20,21"
			[/move]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="3"
				x="18"
				y="19"
			[/recruit]
			[random]
				value="1670089265"
			[/random]
			[random]
				value="214982943"
			[/random]
			[random]
				value="557446309"
			[/random]
			[random]
				value="1269108833"
			[/random]
			[random]
				value="972840025"
			[/random]
			[random]
				value="256439893"
			[/random]
			[random]
				value="962341010"
			[/random]
			[random]
				value="1730791104"
			[/random]
			[random]
				value="1772309774"
			[/random]
			[random]
				value="1863837300"
			[/random]
			[random]
				value="379471488"
			[/random]
			[random]
				value="109784723"
			[/random]
			[random]
				value="2117691042"
			[/random]
			[random]
				value="923661486"
			[/random]
			[random]
				value="1111795700"
				[results]
					checksum="rQV6GBwD,UJ+7fMAQJ+xOoaC2U6DfS5lmb>+9w26zYBFaluj9yjnQ1omih>hik67n,e0IoZ07o9kcp0Ad568,m9n<X,+m-08797o60sxBFgnkEzrk-i.-tciji+H>s3M"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[countdown_update]
				team="2"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			sent="yes"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			[move]
				x="39,40"
				y="12,12"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfopps02Josh has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfgen001Trev1 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="LemonJuice has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="24,25,25,26,26,27"
				y="5,6,7,7,8,9"
			[/move]
		[/command]
		[command]
			[move]
				x="23,24,25,26,27,28,29"
				y="5,5,6,6,7,6,7"
			[/move]
		[/command]
		[command]
			[recruit]
				value="2"
				x="24"
				y="5"
			[/recruit]
			[random]
				value="1627458472"
			[/random]
			[random]
				value="683484625"
			[/random]
			[random]
				value="441796848"
			[/random]
			[random]
				value="1761244293"
			[/random]
			[random]
				value="1700084194"
			[/random]
			[random]
				value="201067140"
			[/random]
			[random]
				value="1238470329"
			[/random]
			[random]
				value="1355667227"
			[/random]
			[random]
				value="2092688755"
			[/random]
			[random]
				value="1082698265"
			[/random]
			[random]
				value="573675401"
			[/random]
			[random]
				value="2095705965"
			[/random]
			[random]
				value="872846991"
			[/random]
			[random]
				value="675779553"
			[/random]
			[random]
				value="1698584063"
				[results]
					checksum="RUQsCRORlSP,DLsxDMMfFuzJRDJCyOyPpHMVsOIMzEOKRzPuHEfJqwNzzmyJIhVwVwSxvKsMAS8wEVRB+JCszfJzd4kC+rc<MF13amk4nil5K7b35>-yp,+>8,eyb6ac"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="18,19,20,21,22,23"
				y="5,5,4,5,5,6"
			[/move]
		[/command]
		[command]
			[move]
				x="19,20,21"
				y="13,13,14"
			[/move]
		[/command]
		[command]
			[move]
				x="21,22"
				y="14,13"
			[/move]
		[/command]
		[command]
			[move]
				x="22,23"
				y="13,14"
			[/move]
		[/command]
		[command]
			[move]
				x="18,19"
				y="12,13"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[move]
				x="18,17,16,15"
				y="19,20,20,20"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="33,34,35"
				y="17,17,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="24"
				y="19"
			[/recruit]
			[random]
				value="894285743"
			[/random]
			[random]
				value="860957054"
			[/random]
			[random]
				value="517464106"
			[/random]
			[random]
				value="231011888"
			[/random]
			[random]
				value="695039775"
			[/random]
			[random]
				value="613514446"
			[/random]
			[random]
				value="39664447"
			[/random]
			[random]
				value="1406098859"
			[/random]
			[random]
				value="351733815"
			[/random]
			[random]
				value="174518021"
			[/random]
			[random]
				value="60995061"
			[/random]
			[random]
				value="1794529319"
			[/random]
			[random]
				value="419544162"
			[/random]
			[random]
				value="852896439"
			[/random]
			[random]
				value="2134796316"
				[results]
					checksum="DB3s-,zQn1M2yLIrtl,yvEJs+TqLAH7qSCNCNSvmIJ>KNGxwmIQwSVVvQLyBGFwuCzBR9PMVRCroPzMEKTmSKvvPnFtw+QnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Rekko has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="15,16,16,15,14,13"
				y="18,17,16,16,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"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Krimburuk has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="29,30,30,31,31,32"
				y="7,7,8,9,10,10"
			[/move]
		[/command]
		[command]
			[move]
				x="31,32,33,34,35,35"
				y="10,10,10,10,11,12"
			[/move]
		[/command]
		[command]
			[move]
				x="27,27,27,28,28,28"
				y="9,10,11,11,12,13"
			[/move]
		[/command]
		[command]
			[move]
				x="24,25,26,26,26,27,28,29"
				y="5,6,6,7,8,9,9,10"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Die_Toten_Hosen has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="sharapova has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="40,39,38,37,36"
				y="12,12,11,11,11"
			[/move]
		[/command]
		[command]
			[move]
				x="23,24"
				y="6,5"
			[/move]
		[/command]
		[command]
			[recruit]
				value="1"
				x="23"
				y="5"
			[/recruit]
			[random]
				value="245690061"
			[/random]
			[random]
				value="248551181"
			[/random]
			[random]
				value="737414288"
			[/random]
			[random]
				value="1107661989"
			[/random]
			[random]
				value="531150513"
			[/random]
			[random]
				value="1541121200"
			[/random]
			[random]
				value="125265062"
			[/random]
			[random]
				value="165262217"
			[/random]
			[random]
				value="556344205"
			[/random]
			[random]
				value="7046000"
			[/random]
			[random]
				value="1733697296"
			[/random]
			[random]
				value="301561308"
			[/random]
			[random]
				value="223498912"
			[/random]
			[random]
				value="965483894"
			[/random]
			[random]
				value="152623218"
				[results]
					checksum="15,Wfc>cu2lH0olW9-5N-m<e6f60hfabkcij<4>i3h3e2.t0a1f<j870h0k565.Y0>ide9Pi80k.d8da021n<.26Z+40CN5c8b.-X,48E.7v3k3XdJFikGGNwGMoVOFH"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="24,24,25,25,26"
				y="5,6,7,8,8"
			[/move]
		[/command]
		[command]
			[move]
				x="23,22"
				y="14,14"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="sdf has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="31,32,33,33,34"
				y="13,13,14,15,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="24,25,26,27,28,29,30"
				y="19,19,18,18,17,17,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="15,14,13,12"
				y="20,19,19,18"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="13,13,12,12,11"
				y="16,15,14,13,13"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Budah has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="3"
				x="24"
				y="19"
			[/recruit]
			[random]
				value="1709090988"
			[/random]
			[random]
				value="480465339"
			[/random]
			[random]
				value="1402739158"
			[/random]
			[random]
				value="23341942"
			[/random]
			[random]
				value="465937358"
			[/random]
			[random]
				value="1498885516"
			[/random]
			[random]
				value="1953686310"
			[/random]
			[random]
				value="1865953095"
			[/random]
			[random]
				value="1506275642"
			[/random]
			[random]
				value="331764950"
			[/random]
			[random]
				value="736244410"
			[/random]
			[random]
				value="168040215"
			[/random]
			[random]
				value="667570273"
			[/random]
			[random]
				value="140641255"
			[/random]
			[random]
				value="1084170589"
				[results]
					checksum="rQV6GBwD,UJ+7fNAQJ+xOoaC5U6DfS5lmb>+9w26zYBFaluj9yjnQ1omih>hik67n,e0IoZ07o9kcp0Ad568,m9n<X,+m+08797o60sxBFgnkEzrk-i.-tciji+H>s4C"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Lisard has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="wers has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,22,23,23,23,23"
				y="21,20,20,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]
			sent="yes"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="20comer has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="none has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="19,19,20"
				y="13,14,14"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="20"
					y="14"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1218626526"
				[results]
					chance="40"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="973322235"
				[results]
					chance="40"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1276024598"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1552227324"
				[results]
					chance="40"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="762285292"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="22,22,21"
				y="14,15,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="21"
					y="16"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1663193520"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="966128227"
				[results]
					chance="40"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="79796628"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1184598647"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="617850609"
				[results]
					chance="40"
					damage="9"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="filippe has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Ahalya has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="plk2 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="36,36,35,34,33,32,31"
				y="11,12,13,13,14,14,15"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="15"
				[/source]
				[destination]
					x="31"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="87361694"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="488741338"
				[results]
					chance="60"
					damage="10"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="244523077"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2066464890"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="5folhas has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Krimburuk has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="28,29,30,30"
				y="13,14,14,15"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="30"
					y="15"
				[/source]
				[destination]
					x="31"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="864853222"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="114120645"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="717055238"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="891819319"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1082097493"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Rythlion has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="29,29,29,29,30,31,32,32"
				y="10,11,12,13,13,14,14,15"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="32"
					y="15"
				[/source]
				[destination]
					x="31"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="186060205"
				[results]
					chance="40"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="738848574"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1633775325"
				[results]
					chance="40"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1821347530"
				[results]
					chance="40"
					damage="8"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1470322521"
				[results]
					chance="40"
					damage="5"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="cern has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="35,35,34,33,32,32,31"
				y="12,13,13,14,14,15,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="16"
				[/source]
				[destination]
					x="30"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="1626400742"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1883613950"
				[results]
					chance="30"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1298402532"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="745880157"
				[results]
					chance="30"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="233050044"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1365459131"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="32,32,32,32"
				y="10,11,12,13"
			[/move]
		[/command]
		[command]
			[move]
				x="26,26,25,25,24"
				y="8,7,7,6,5"
			[/move]
		[/command]
		[command]
			[move]
				x="23,23,24,25,26,26,27,28,29"
				y="5,6,6,7,7,8,9,9,10"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Death-to-Analog has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[recruit]
				value="7"
				x="18"
				y="5"
			[/recruit]
			[random]
				value="1614845769"
			[/random]
			[random]
				value="181588507"
			[/random]
			[random]
				value="109416280"
			[/random]
			[random]
				value="405391282"
			[/random]
			[random]
				value="924048128"
			[/random]
			[random]
				value="562990670"
			[/random]
			[random]
				value="1266642211"
			[/random]
			[random]
				value="1237854479"
			[/random]
			[random]
				value="217935814"
			[/random]
			[random]
				value="431745146"
			[/random]
			[random]
				value="185347002"
			[/random]
			[random]
				value="1603989282"
			[/random]
			[random]
				value="2064049055"
			[/random]
			[random]
				value="1155576125"
			[/random]
			[random]
				value="767280556"
				[results]
					checksum=",Ad3Y5f-Gtmspp5jHbEoRiSrOCpxE4IDyxOzzQOG.nCLyyGDmUtLNvFrwCUxRLwFwmIsr1QENmxPFHFw.RFKFnqypNLpM8mwoFomIhFlq1.CLW<<ddNv5EsLNHBNzkOI"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="BigDaddy has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="5,6,6,7,8,9,9,10"
				y="14,13,12,12,11,11,10,9"
			[/move]
		[/command]
		[command]
			[move]
				x="24,23"
				y="5,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="Spazen has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="34,33"
				y="15,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="33"
					y="16"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="301761056"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="653080621"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="377842953"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1525547748"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[move]
				x="30,30,31,32,32"
				y="16,17,18,17,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="32"
					y="16"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1446754856"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="341465615"
				[results]
					chance="40"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="2054671103"
				[results]
					chance="40"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1114382562"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[move]
				x="35,35,34,33"
				y="17,16,15,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="33"
					y="15"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1940318087"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2026953078"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="466355795"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="540607606"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1590622051"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2006360018"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1742993823"
				[results]
					chance="40"
					damage="6"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Emrizzles has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="24,24,25,25"
				y="19,18,18,17"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="16,16,17,18,19,20"
				y="14,15,16,16,16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="20"
					y="15"
				[/source]
				[destination]
					x="20"
					y="14"
				[/destination]
			[/attack]
			[random]
				value="1527312351"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="900140588"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="893149370"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2033384126"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="joueur6 has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="23,23,23,23,22,21"
				y="17,18,19,20,20,21"
			[/move]
		[/command]
		[command]
			sent="yes"
			[recruit]
				value="0"
				x="24"
				y="19"
			[/recruit]
			[random]
				value="103759062"
			[/random]
			[random]
				value="2018695364"
			[/random]
			[random]
				value="1754214208"
			[/random]
			[random]
				value="1203380822"
			[/random]
			[random]
				value="709014480"
			[/random]
			[random]
				value="715427851"
			[/random]
			[random]
				value="1665841338"
			[/random]
			[random]
				value="1874616023"
			[/random]
			[random]
				value="138388656"
			[/random]
			[random]
				value="38515178"
			[/random]
			[random]
				value="426017748"
			[/random]
			[random]
				value="1877986290"
			[/random]
			[random]
				value="1782248249"
			[/random]
			[random]
				value="2018052491"
			[/random]
			[random]
				value="1827577394"
				[results]
					checksum="oxj+sAh20PB0KmsQ56tLoxMPdOFGJz.MMAvVvoQO,ECJMwDzBrzrTwAoECqSJHEvSS3IzTALqvFArEKTmSKvvPnFtw+PnBRSqBwbD3xFMMEJCCHO+YDPPnPywBn8FA25"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[move]
				x="11,12,12,12,13,14,15,16"
				y="19,18,17,16,16,15,15,14"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="11,12,12,12,13"
				y="13,13,14,15,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="12,11"
				y="18,19"
			[/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"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			[move]
				x="18,17,16,15,14,13,12"
				y="5,6,6,7,7,8,8"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="20"
					y="14"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="2055292715"
				[results]
					chance="40"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1055454018"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1903219266"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1352808526"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="922392042"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Akkarin has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="21"
					y="16"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="2108810415"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1899163332"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1587156911"
				[results]
					chance="40"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="540149834"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1099524460"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="rytdog has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="29,29,29,29,29,30,30,30,31"
				y="10,11,12,13,14,14,15,16,17"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="17"
				[/source]
				[destination]
					x="32"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="1108374187"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1202839035"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="9515121"
				[results]
					chance="60"
					damage="9"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1269583039"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="2003119670"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="32,33,34,34"
				y="13,13,13,14"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="34"
					y="14"
				[/source]
				[destination]
					x="33"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1326732948"
				[results]
					chance="60"
					damage="10"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="77587794"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="237351324"
				[results]
					chance="60"
					damage="10"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="261279791"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1367852123"
				[results]
					chance="60"
					damage="10"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="30,30,30,30,30,30"
				y="15,16,17,18,19,20"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Sonnenwind has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="31,31,32,33"
				y="16,17,17,17"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="33"
					y="17"
				[/source]
				[destination]
					x="33"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="153730440"
				[results]
					chance="50"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="2103147460"
				[results]
					chance="30"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="399546555"
				[results]
					chance="50"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1561001343"
				[results]
					chance="30"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="474330852"
				[results]
					chance="50"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="605175523"
				[results]
					chance="50"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfopps2Josh has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Alex has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="31,31"
				y="15,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="16"
				[/source]
				[destination]
					x="32"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="1363137734"
				[results]
					chance="60"
					damage="22"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Krimzon has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="23,22,21"
				y="5,4,4"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Mule has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Whiteagle has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[recruit]
				value="6"
				x="20"
				y="4"
			[/recruit]
			[random]
				value="1395353471"
			[/random]
			[random]
				value="1510082996"
			[/random]
			[random]
				value="447330288"
			[/random]
			[random]
				value="1604050764"
			[/random]
			[random]
				value="944196282"
			[/random]
			[random]
				value="290305412"
			[/random]
			[random]
				value="2097113811"
			[/random]
			[random]
				value="579460804"
			[/random]
			[random]
				value="1109621303"
			[/random]
			[random]
				value="1626992977"
			[/random]
			[random]
				value="1438425807"
			[/random]
			[random]
				value="139173718"
			[/random]
			[random]
				value="59998476"
			[/random]
			[random]
				value="1513044895"
			[/random]
			[random]
				value="363259573"
				[results]
					checksum="XBfX4cmcHYau810h3t9co8gj2UWo-1,n-62ad7l9i<dX9dX-4o9W2w2-6hZd9kbd.d07gZj2f,ei>ybXfdk5k4Nw>d595,cp6dzgA.Zj4982<j3D1<4M26i7zO.<BtyI"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Juin has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="10,9,8,8,7,6,6"
				y="9,10,10,11,12,12,13"
			[/move]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="PinguinSteve has logged into the lobby"
			[/speak]
		[/command]
		[command]
			[move]
				x="6,6,6"
				y="13,14,15"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="20"
					y="15"
				[/source]
				[destination]
					x="20"
					y="14"
				[/destination]
			[/attack]
			[random]
				value="480189636"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1742446983"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="763453160"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1610421670"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Wolfgen001Trev has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="dog has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="24,25,26,27,28,29,30"
				y="19,19,18,18,17,17,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="30"
					y="16"
				[/source]
				[destination]
					x="31"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="2137032945"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1845521043"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1125045468"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1634365853"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="sry for the luck on my side"
				side="1"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="33,32"
				y="16,15"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="32"
					y="15"
				[/source]
				[destination]
					x="31"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="1332721207"
				[results]
					chance="60"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1873393642"
				[results]
					chance="60"
					damage="6"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Asgraf has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="25,24,23,22"
				y="17,17,17,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="22"
					y="16"
				[/source]
				[destination]
					x="21"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="1979453656"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="499197476"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			undo="no"
			[speak]
				id="akkon"
				message="its a game only"
				side="2"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="Eskon has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="21,22,23,24,25"
				y="21,20,20,20,21"
			[/move]
		[/command]
		[command]
			sent="yes"
			[move]
				x="16,16,17,18,19,20"
				y="14,15,16,16,16,16"
			[/move]
		[/command]
		[command]
			sent="yes"
			[attack]
				defender_weapon="-1"
				weapon="1"
				[source]
					x="20"
					y="16"
				[/source]
				[destination]
					x="21"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="257816930"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="737850569"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1382027667"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1470810400"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			sent="yes"
			[speak]
				id="server"
				message="guni has logged into the lobby"
			[/speak]
		[/command]
		[command]
			sent="yes"
			[move]
				x="13,14,15,16"
				y="16,15,15,14"
			[/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"
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="20"
					y="14"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="434947571"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1878228016"
				[results]
					chance="40"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1246477187"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1149514301"
				[results]
					chance="40"
					damage="6"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="21,21"
				y="16,15"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="21"
					y="15"
				[/source]
				[destination]
					x="20"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1989216304"
				[results]
					chance="40"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="536942064"
				[results]
					chance="40"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="769208732"
				[results]
					chance="40"
					damage="7"
					dies="yes"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="34,34,33"
				y="14,15,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="33"
					y="16"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1011537789"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1607021209"
				[results]
					chance="50"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="802128576"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1591443047"
				[results]
					chance="50"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="860142568"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="30,30,30,31,32,32"
				y="20,19,18,18,17,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="32"
					y="16"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="2131849683"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="677492462"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2037939278"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="698996112"
				[results]
					chance="60"
					damage="5"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="633444787"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="33,32,31"
				y="17,16,16"
			[/move]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="16"
				[/source]
				[destination]
					x="32"
					y="15"
				[/destination]
			[/attack]
			[random]
				value="1041601002"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1772446324"
				[results]
					chance="30"
					damage="6"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="570475709"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="554281041"
				[results]
					chance="30"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="2050933649"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1193398261"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
		[/command]
		[command]
			[attack]
				defender_weapon="0"
				weapon="0"
				[source]
					x="31"
					y="17"
				[/source]
				[destination]
					x="30"
					y="16"
				[/destination]
			[/attack]
			[random]
				value="166199498"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="367229659"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="1732125981"
				[results]
					chance="60"
					damage="0"
					dies="no"
					hits="no"
				[/results]
			[/random]
			[random]
				value="1118212510"
				[results]
					chance="60"
					damage="4"
					dies="no"
					hits="yes"
				[/results]
			[/random]
			[random]
				value="514922339"
				[results]
					chance="60"
					damage="7"
					dies="no"
					hits="yes"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="12,12,12,12,12"
				y="8,9,10,11,12"
			[/move]
		[/command]
		[command]
			[move]
				x="11,10,9,9,9"
				y="11,11,12,13,14"
			[/move]
		[/command]
		[command]
			[recruit]
				value="4"
				x="18"
				y="5"
			[/recruit]
			[random]
				value="1952097465"
			[/random]
			[random]
				value="1569106110"
			[/random]
			[random]
				value="621897703"
			[/random]
			[random]
				value="1928027762"
			[/random]
			[random]
				value="2110478469"
			[/random]
			[random]
				value="177530311"
			[/random]
			[random]
				value="965548341"
			[/random]
			[random]
				value="693036791"
			[/random]
			[random]
				value="1682824243"
			[/random]
			[random]
				value="195438224"
			[/random]
			[random]
				value="1837426419"
			[/random]
			[random]
				value="1294164254"
			[/random]
			[random]
				value="1190961681"
			[/random]
			[random]
				value="1130187310"
			[/random]
			[random]
				value="2122370694"
				[results]
					checksum="rhRteuCm>Im>OtyS+7ckzAuBMm0+Z8dI9a<pk8651Wl8Z5w.cldpBX>77bllckl2Y+5>aaii6<81mkljb2ifil7.WgZ2.h<5-XxS+j>k2403-p8TA9v1-xH1iTk+k58Y"
				[/results]
			[/random]
		[/command]
		[command]
			[move]
				x="20,21,21,21,21,21,21,21"
				y="4,5,6,7,8,9,10,11"
			[/move]
		[/command]
		[command]
			[move]
				x="6,6"
				y="15,14"
			[/move]
		[/command]
		[command]
			[move]
				x="21,20,19"
				y="4,4,5"
			[/move]
		[/command]
		[command]
			[countdown_update]
				team="1"
				value="270000"
			[/countdown_update]
		[/command]
		[command]
			[end_turn]
			[/end_turn]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="still there?"
				side="1"
			[/speak]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="not sure i am connected"
				side="1"
			[/speak]
		[/command]
		[command]
			undo="no"
			[speak]
				id="ced"
				message="give me a sign"
				side="1"
			[/speak]
		[/command]
	[/replay]
	[statistics]
		mid_scenario="yes"
		[scenario]
			scenario="2p - Caves of the Basilisk"
			[team]
				damage_inflicted="0"
				damage_taken="0"
				expected_damage_inflicted="0"
				expected_damage_taken="0"
				recall_cost="0"
				recruit_cost="0"
				turn_damage_inflicted="0"
				turn_damage_taken="0"
				turn_expected_damage_inflicted="0"
				turn_expected_damage_taken="0"
				[recruits]
				[/recruits]
				[recalls]
				[/recalls]
				[advances]
				[/advances]
				[deaths]
				[/deaths]
				[killed]
				[/killed]
				[attacks]
				[/attacks]
				[defends]
				[/defends]
			[/team]
			[team]
				damage_inflicted="187"
				damage_taken="194"
				expected_damage_inflicted="172059"
				expected_damage_taken="186118"
				recall_cost="0"
				recruit_cost="175"
				turn_damage_inflicted="0"
				turn_damage_taken="0"
				turn_expected_damage_inflicted="0"
				turn_expected_damage_taken="0"
				[recruits]
					Elvish Archer="6"
					Elvish Fighter="2"
					Elvish Shaman="2"
					Merman Hunter="1"
				[/recruits]
				[recalls]
				[/recalls]
				[advances]
				[/advances]
				[deaths]
					Elvish Archer="3"
					Elvish Fighter="1"
					Merman Hunter="1"
				[/deaths]
				[killed]
					Fencer="1"
					Horseman="1"
					Merman Fighter="1"
				[/killed]
				[attacks]
					[sequence]
						_num="40"
						s00="1"
						s0001="2"
						s0100="1"
						s0110="1"
						s1000="1"
						s1001="1"
					[/sequence]
					[sequence]
						_num="60"
						s11="1"
						s1101="1"
					[/sequence]
				[/attacks]
				[defends]
					[sequence]
						_num="30"
						s00="2"
						s10="1"
					[/sequence]
					[sequence]
						_num="40"
						s0="1"
						s01="1"
						s10="1"
						s11="4"
					[/sequence]
					[sequence]
						_num="50"
						s11="1"
					[/sequence]
					[sequence]
						_num="60"
						s="1"
						s00="1"
						s01="1"
						s10="1"
						s11="3"
					[/sequence]
				[/defends]
			[/team]
			[team]
				damage_inflicted="194"
				damage_taken="187"
				expected_damage_inflicted="186118"
				expected_damage_taken="172059"
				recall_cost="0"
				recruit_cost="212"
				turn_damage_inflicted="32"
				turn_damage_taken="36"
				turn_expected_damage_inflicted="61403"
				turn_expected_damage_taken="27816"
				[recruits]
					Cavalryman="2"
					Fencer="3"
					Horseman="2"
					Merman Fighter="3"
					Spearman="3"
				[/recruits]
				[recalls]
				[/recalls]
				[advances]
				[/advances]
				[deaths]
					Fencer="1"
					Horseman="1"
					Merman Fighter="1"
				[/deaths]
				[killed]
					Elvish Archer="3"
					Elvish Fighter="1"
					Merman Hunter="1"
				[/killed]
				[attacks]
					[sequence]
						_num="40"
						s00="2"
						s100="2"
						s11="1"
						s110="2"
						s111="2"
					[/sequence]
					[sequence]
						_num="50"
						s1001="1"
					[/sequence]
					[sequence]
						_num="60"
						s000="2"
						s001="1"
						s010="1"
						s1="1"
						s111="1"
						s1110="1"
						s1111="1"
					[/sequence]
				[/attacks]
				[defends]
					[sequence]
						_num="0"
						s="8"
					[/sequence]
					[sequence]
						_num="60"
						s011="1"
					[/sequence]
				[/defends]
			[/team]
		[/scenario]
	[/statistics]
	[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]
		action_bonus_count="0"
		aggression="0.5"
		allow_changes="no"
		allow_player="yes"
		caution="0.25"
		colour="1"
		controller="human"
		countdown_time="270000"
		current_player="ced"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
		gold="11"
		hidden="no"
		id="ced1"
		income="0"
		leader_value="3"
		name="ced"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives="Victory:
@Defeat enemy leader(s)"
		objectives_changed="no"
		recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
		recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
		save_id="ced1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		start_gold="100"
		team_name="1"
		user_team_name="Team 1"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[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]
		[ai]
			villages_per_scout="8"
		[/ai]
		[village]
			x="11"
			y="11"
		[/village]
		[village]
			x="12"
			y="4"
		[/village]
		[village]
			x="17"
			y="3"
		[/village]
		[village]
			x="17"
			y="8"
		[/village]
		[village]
			x="22"
			y="9"
		[/village]
		[village]
			x="26"
			y="10"
		[/village]
		[village]
			x="30"
			y="20"
		[/village]
		[village]
			x="31"
			y="6"
		[/village]
		[village]
			x="31"
			y="10"
		[/village]
		[village]
			x="31"
			y="16"
		[/village]
		[unit]
			advances_to="Arch Mage,Silver Mage"
			alignment="neutral"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="40"
			current_player="ced"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="female"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="42"
			id="ced1"
			image="units/human-magi/red-mage+female.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "female^Red Mage"
			leader="Lieutenant,Swordsman,Pikeman,Javelineer,Shock Trooper,Longbowman,White Mage,Red Mage"
			level="2"
			max_attacks="1"
			max_experience="70"
			max_hitpoints="42"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="3"
			mp_countdown="yes"
			mp_countdown_action_bonus="20"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="270"
			mp_countdown_turn_bonus="200"
			name="ced"
			profile="portraits/humans/mage-red+female.png"
			race="human"
			random_leader="Lieutenant,Swordsman,Pikeman,Javelineer,Longbowman,Red Mage"
			random_traits="no"
			recruit="Cavalryman,Horseman,Spearman,Fencer,Heavy Infantryman,Bowman,Mage,Merman Fighter"
			resting="no"
			save_id="ced1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="1"
			terrain_liked="Gg, Ww, Wo"
			type="Red Mage"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			user_team_name="Team 1"
			village_gold="2"
			x="19"
			y="5"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="90"
				impact="100"
				pierce="100"
			[/resistance]
			[portrait]
				image="portraits/humans/transparent/mage-red+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/mage-red+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="8"
				description=_ "fireball"
				name="fireball"
				number="4"
				range="ranged"
				type="fire"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Duelist"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="28"
			id="Fencer-16"
			image="units/human-loyalists/fencer.png"
#textdomain wesnoth-units
			language_name=_ "Fencer"
			level="1"
			max_attacks="1"
			max_experience="29"
			max_hitpoints="28"
			max_moves="7"
			movement="6"
			movement_type="elusivefoot"
			moves="0"
			name="Glidd"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Fencer"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="9"
			y="14"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="saber"
				[/filter_attack]
				[frame]
					begin="-300"
					end="-250"
					image="units/human-loyalists/fencer-attack-1.png"
					offset="0.0~-0.07"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					image="units/human-loyalists/fencer-attack-2.png"
					offset="-0.07~-0.15"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/fencer-attack-3.png"
						offset="-0.15~-0.25"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/fencer-attack-3.png"
						offset="-0.15~-0.25"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-loyalists/fencer-attack-4.png"
					offset="-0.25~-0.2"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					image="units/human-loyalists/fencer-attack-5.png"
					offset="-0.2~-0.1"
				[/frame]
				[frame]
					begin="-50"
					end="0"
					image="units/human-loyalists/fencer-attack-6.png"
					offset="-0.1~0.25"
				[/frame]
				[frame]
					begin="0"
					end="50"
					image="units/human-loyalists/fencer-attack-7.png"
					offset="0.25~0.55"
				[/frame]
				[frame]
					begin="50"
					end="100"
					image="units/human-loyalists/fencer-attack-8.png"
					offset="0.55~0.25"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/fencer-attack-9.png"
					offset="0.25~0.1"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/human-loyalists/fencer-attack-1.png"
					offset="0.1~0.0"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/human-loyalists/fencer-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/human-loyalists/fencer-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/human-loyalists/fencer-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/human-loyalists/fencer-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="500"
					image="units/human-loyalists/fencer-die5.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-loyalists/fencer-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="-25"
					image="units/human-loyalists/fencer-defend.png"
				[/frame]
				[frame]
					begin="-25"
					end="125"
					image="units/human-loyalists/fencer-defend.png"
					sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-loyalists/fencer-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer.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/human-loyalists/fencer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-1.png"
				[/frame]
			[/idle_anim]
			[defense]
				castle="30"
				cave="50"
				deep_water="70"
				flat="40"
				forest="30"
				frozen="60"
				fungus="30"
				hills="30"
				impassable="50"
				mountains="30"
				reef="50"
				sand="60"
				shallow_water="60"
				swamp_water="60"
				unwalkable="80"
				village="30"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="130"
				cold="90"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[abilities]
				[skirmisher]
					affect_self="yes"
#textdomain wesnoth
					description=_ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
					female_name=_ "female^skirmisher"
					id="skirmisher"
					name=_ "skirmisher"
				[/skirmisher]
			[/abilities]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
#textdomain wesnoth-units
				description=_ "saber"
				icon="attacks/saber-human.png"
				name="saber"
				number="4"
				range="melee"
				type="blade"
			[/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^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dragoon"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="17"
			die_sound="horse-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="36"
			id="Cavalryman-17"
			image="units/human-loyalists/cavalryman.png"
#textdomain wesnoth-units
			language_name=_ "Cavalryman"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="36"
			max_moves="9"
			movement="8"
			movement_type="mounted"
			moves="8"
			name="Owecyn"
			profile="portraits/humans/cavalryman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Cavalryman"
			undead_variation="mounted"
			underlying_id="17"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="6"
			y="14"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-225"
					end="-200"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/cavalryman-moving.png"
					sound="horse-canter.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="150"
						image="units/human-loyalists/cavalryman-attack.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="150"
						image="units/human-loyalists/cavalryman-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="150"
					end="200"
					image="units/human-loyalists/cavalryman-moving.png"
				[/frame]
				[frame]
					begin="200"
					end="225"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="200"
					image="units/human-loyalists/cavalryman-die-1.png"
				[/frame]
				[frame]
					begin="200"
					end="400"
					image="units/human-loyalists/cavalryman-die-2.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/cavalryman-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/human-loyalists/cavalryman-defend.png"
						sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/human-loyalists/cavalryman-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/human-loyalists/cavalryman-moving.png"
				[/frame]
			[/movement_anim]
			[defense]
				castle="60"
				cave="80"
				deep_water="80"
				flat="60"
				forest="70"
				frozen="70"
				fungus="80"
				hills="60"
				impassable="80"
				mountains="80"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="4"
				deep_water="99"
				flat="1"
				forest="3"
				frozen="2"
				fungus="4"
				hills="2"
				impassable="99"
				mountains="99"
				reef="3"
				sand="2"
				shallow_water="4"
				swamp_water="4"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="70"
				cold="80"
				fire="100"
				impact="60"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "sword"
				icon="attacks/sword-human.png"
				name="sword"
				number="3"
				range="melee"
				type="blade"
			[/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^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Merman Warrior"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="14"
			die_sound="mermen-die.ogg"
			ellipse="misc/ellipse"
			experience="19"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="13"
			id="Merman Fighter-19"
			image="units/merfolk/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Merman Fighter"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="42"
			max_moves="6"
			movement="6"
			movement_type="swimmer"
			moves="0"
			name="Kinir"
			profile="portraits/merfolk/fighter.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Merman Fighter"
			undead_variation="swimmer"
			underlying_id="19"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="21"
			y="15"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="trident"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/merfolk/fighter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/fighter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/fighter.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/merfolk/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/merfolk/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/merfolk/fighter.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/merfolk/fighter.png"
						sound="mermen-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/merfolk/fighter.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/merfolk/fighter.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]
			[/status]
			[attack]
				damage="7"
				description=_ "trident"
				name="trident"
				number="3"
				range="melee"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Duelist"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="16"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Fencer-21"
			image="units/human-loyalists/fencer.png"
#textdomain wesnoth-units
			language_name=_ "Fencer"
			level="1"
			max_attacks="1"
			max_experience="24"
			max_hitpoints="33"
			max_moves="6"
			movement="6"
			movement_type="elusivefoot"
			moves="0"
			name="Demyrcyn"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Fencer"
			underlying_id="21"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="31"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="saber"
				[/filter_attack]
				[frame]
					begin="-300"
					end="-250"
					image="units/human-loyalists/fencer-attack-1.png"
					offset="0.0~-0.07"
				[/frame]
				[frame]
					begin="-250"
					end="-200"
					image="units/human-loyalists/fencer-attack-2.png"
					offset="-0.07~-0.15"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/fencer-attack-3.png"
						offset="-0.15~-0.25"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-200"
						end="-150"
						image="units/human-loyalists/fencer-attack-3.png"
						offset="-0.15~-0.25"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-loyalists/fencer-attack-4.png"
					offset="-0.25~-0.2"
				[/frame]
				[frame]
					begin="-100"
					end="-50"
					image="units/human-loyalists/fencer-attack-5.png"
					offset="-0.2~-0.1"
				[/frame]
				[frame]
					begin="-50"
					end="0"
					image="units/human-loyalists/fencer-attack-6.png"
					offset="-0.1~0.25"
				[/frame]
				[frame]
					begin="0"
					end="50"
					image="units/human-loyalists/fencer-attack-7.png"
					offset="0.25~0.55"
				[/frame]
				[frame]
					begin="50"
					end="100"
					image="units/human-loyalists/fencer-attack-8.png"
					offset="0.55~0.25"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/fencer-attack-9.png"
					offset="0.25~0.1"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/human-loyalists/fencer-attack-1.png"
					offset="0.1~0.0"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="100"
					image="units/human-loyalists/fencer-die1.png"
				[/frame]
				[frame]
					begin="100"
					end="200"
					image="units/human-loyalists/fencer-die2.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/human-loyalists/fencer-die3.png"
				[/frame]
				[frame]
					begin="300"
					end="400"
					image="units/human-loyalists/fencer-die4.png"
				[/frame]
				[frame]
					begin="400"
					end="500"
					image="units/human-loyalists/fencer-die5.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-loyalists/fencer-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer-defend-1-1.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="-25"
					image="units/human-loyalists/fencer-defend.png"
				[/frame]
				[frame]
					begin="-25"
					end="125"
					image="units/human-loyalists/fencer-defend.png"
					sound="human-hit-1.ogg,human-hit-2.ogg,human-hit-3.ogg,human-hit-4.ogg,human-hit-5.ogg"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-loyalists/fencer.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-loyalists/fencer-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-loyalists/fencer.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/human-loyalists/fencer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/fencer-idle-1.png"
				[/frame]
			[/idle_anim]
			[defense]
				castle="30"
				cave="50"
				deep_water="70"
				flat="40"
				forest="30"
				frozen="60"
				fungus="30"
				hills="30"
				impassable="50"
				mountains="30"
				reef="50"
				sand="60"
				shallow_water="60"
				swamp_water="60"
				unwalkable="80"
				village="30"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="130"
				cold="90"
				fire="100"
				impact="120"
				pierce="120"
			[/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]
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "saber"
				icon="attacks/saber-human.png"
				name="saber"
				number="4"
				range="melee"
				type="blade"
			[/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^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="Swordsman,Pikeman,Javelineer"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="14"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="n"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="32"
			id="Spearman-29"
			image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
			language_name=_ "Spearman"
			level="1"
			max_attacks="1"
			max_experience="24"
			max_hitpoints="41"
			max_moves="5"
			movement="5"
			movement_type="smallfoot"
			moves="0"
			name="Owudoc"
			profile="portraits/humans/spearman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Spearman"
			underlying_id="29"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="32"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="javelin"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-250"
					end="-150"
					image="units/human-loyalists/spearman-death1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-loyalists/spearman-attack-ranged.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
				[/else]
				[frame]
					begin="-50"
					end="50"
					image="units/human-loyalists/spearman-attack-ranged2.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="s"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[frame]
					begin="-150"
					end="-50"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="se,sw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="125"
					image="units/human-loyalists/spearman-death1.png"
				[/frame]
				[frame]
					begin="125"
					end="250"
					image="units/human-loyalists/spearman-death2.png"
				[/frame]
				[frame]
					begin="250"
					end="375"
					image="units/human-loyalists/spearman-death3.png"
				[/frame]
				[frame]
					begin="375"
					end="500"
					image="units/human-loyalists/spearman-death4.png"
				[/frame]
			[/death]
			[defend]
				[frame]
					begin="-100"
					end="-90"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
				[frame]
					begin="-90"
					end="90"
					image="units/human-loyalists/spearman-defend.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="7"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="3"
				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]
			[attack]
				damage="6"
#textdomain wesnoth-units
				description=_ "javelin"
				icon="attacks/javelin-human.png"
				name="javelin"
				number="1"
				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^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="Swordsman,Pikeman,Javelineer"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="14"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="9"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="25"
			id="Spearman-30"
			image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
			language_name=_ "Spearman"
			level="1"
			max_attacks="1"
			max_experience="29"
			max_hitpoints="35"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="0"
			name="Cary"
			profile="portraits/humans/spearman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Spearman"
			underlying_id="30"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="33"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="javelin"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-250"
					end="-150"
					image="units/human-loyalists/spearman-death1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-loyalists/spearman-attack-ranged.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
				[/else]
				[frame]
					begin="-50"
					end="50"
					image="units/human-loyalists/spearman-attack-ranged2.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="s"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[frame]
					begin="-150"
					end="-50"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="se,sw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="125"
					image="units/human-loyalists/spearman-death1.png"
				[/frame]
				[frame]
					begin="125"
					end="250"
					image="units/human-loyalists/spearman-death2.png"
				[/frame]
				[frame]
					begin="250"
					end="375"
					image="units/human-loyalists/spearman-death3.png"
				[/frame]
				[frame]
					begin="375"
					end="500"
					image="units/human-loyalists/spearman-death4.png"
				[/frame]
			[/death]
			[defend]
				[frame]
					begin="-100"
					end="-90"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
				[frame]
					begin="-90"
					end="90"
					image="units/human-loyalists/spearman-defend.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="8"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="3"
				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]
			[attack]
				damage="6"
#textdomain wesnoth-units
				description=_ "javelin"
				icon="attacks/javelin-human.png"
				name="javelin"
				number="1"
				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^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dragoon"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="17"
			die_sound="horse-die.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="23"
			id="Cavalryman-34"
			image="units/human-loyalists/cavalryman.png"
#textdomain wesnoth-units
			language_name=_ "Cavalryman"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="39"
			max_moves="8"
			movement="8"
			movement_type="mounted"
			moves="0"
			name="Oweonnyc"
			profile="portraits/humans/cavalryman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Cavalryman"
			undead_variation="mounted"
			underlying_id="34"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="31"
			y="17"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-225"
					end="-200"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/cavalryman-moving.png"
					sound="horse-canter.wav"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="150"
						image="units/human-loyalists/cavalryman-attack.png"
						sound="sword-1.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="150"
						image="units/human-loyalists/cavalryman-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="150"
					end="200"
					image="units/human-loyalists/cavalryman-moving.png"
				[/frame]
				[frame]
					begin="200"
					end="225"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="200"
					image="units/human-loyalists/cavalryman-die-1.png"
				[/frame]
				[frame]
					begin="200"
					end="400"
					image="units/human-loyalists/cavalryman-die-2.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/cavalryman-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/human-loyalists/cavalryman-defend.png"
						sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/human-loyalists/cavalryman-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/human-loyalists/cavalryman.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/human-loyalists/cavalryman-moving.png"
				[/frame]
			[/movement_anim]
			[defense]
				castle="60"
				cave="80"
				deep_water="80"
				flat="60"
				forest="70"
				frozen="70"
				fungus="80"
				hills="60"
				impassable="80"
				mountains="80"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="4"
				deep_water="99"
				flat="1"
				forest="3"
				frozen="2"
				fungus="4"
				hills="2"
				impassable="99"
				mountains="99"
				reef="3"
				sand="2"
				shallow_water="4"
				swamp_water="4"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="70"
				cold="80"
				fire="100"
				impact="60"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="7"
				description=_ "sword"
				icon="attacks/sword-human.png"
				name="sword"
				number="3"
				range="melee"
				type="blade"
			[/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^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Swordsman,Pikeman,Javelineer"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="34"
			id="Spearman-36"
			image="units/human-loyalists/spearman.png"
#textdomain wesnoth-units
			language_name=_ "Spearman"
			level="1"
			max_attacks="1"
			max_experience="24"
			max_hitpoints="34"
			max_moves="6"
			movement="5"
			movement_type="smallfoot"
			moves="1"
			name="Lan"
			profile="portraits/humans/spearman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Spearman"
			underlying_id="36"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="12"
			y="12"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="javelin"
				[/filter_attack]
				[missile_frame]
					begin="-150"
					end="0"
					image="projectiles/spear-n.png"
					image_diagonal="projectiles/spear-ne.png"
				[/missile_frame]
				[frame]
					begin="-250"
					end="-150"
					image="units/human-loyalists/spearman-death1.png"
					sound="throw-1.wav,throw-2.wav,throw-3.wav,throw-4.wav"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-loyalists/spearman-attack-ranged.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="-50"
						image="units/human-loyalists/spearman-attack-ranged.png"
					[/frame]
				[/else]
				[frame]
					begin="-50"
					end="50"
					image="units/human-loyalists/spearman-attack-ranged2.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="s"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[frame]
					begin="-150"
					end="-50"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-50"
						end="100"
						image="units/human-loyalists/spearman-attack-s-2.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman-attack-s-1.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="n"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-n.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="ne,nw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack-ne.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				direction="se,sw"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-loyalists/spearman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-loyalists/spearman-attack.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/spearman.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="125"
					image="units/human-loyalists/spearman-death1.png"
				[/frame]
				[frame]
					begin="125"
					end="250"
					image="units/human-loyalists/spearman-death2.png"
				[/frame]
				[frame]
					begin="250"
					end="375"
					image="units/human-loyalists/spearman-death3.png"
				[/frame]
				[frame]
					begin="375"
					end="500"
					image="units/human-loyalists/spearman-death4.png"
				[/frame]
			[/death]
			[defend]
				[frame]
					begin="-100"
					end="-90"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
				[frame]
					begin="-90"
					end="90"
					image="units/human-loyalists/spearman-defend.png"
				[/frame]
				[frame]
					begin="90"
					end="100"
					image="units/human-loyalists/spearman-defend-2.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/spearman.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="7"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="3"
				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]
			[attack]
				damage="6"
#textdomain wesnoth-units
				description=_ "javelin"
				icon="attacks/javelin-human.png"
				name="javelin"
				number="1"
				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^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Merman Warrior"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="mermen-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="39"
			id="Merman Fighter-38"
			image="units/merfolk/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Merman Fighter"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="39"
			max_moves="7"
			movement="6"
			movement_type="swimmer"
			moves="0"
			name="Faroa"
			profile="portraits/merfolk/fighter.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Merman Fighter"
			undead_variation="swimmer"
			underlying_id="38"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="21"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="trident"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/merfolk/fighter.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/fighter.png"
						sound="spear.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-150"
						end="100"
						image="units/merfolk/fighter.png"
						sound="spear-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/merfolk/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/merfolk/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/merfolk/fighter.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/merfolk/fighter.png"
						sound="mermen-hit.wav"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/merfolk/fighter.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/merfolk/fighter.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="6"
				description=_ "trident"
				name="trident"
				number="3"
				range="melee"
				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="Knight,Lancer"
			alignment="lawful"
			alpha="256"
			attacks_left="0"
			cost="23"
			die_sound="horse-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="39"
			id="Horseman-39"
			image="units/human-loyalists/horseman.png"
#textdomain wesnoth-units
			language_name=_ "Horseman"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="39"
			max_moves="8"
			movement="8"
			movement_type="mounted"
			moves="0"
			name="Cyn"
			profile="portraits/humans/horseman.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Horseman"
			undead_variation="mounted"
			underlying_id="39"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="18"
			y="5"
			zoc="yes"
			[attack_anim]
				hits="no"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-225"
					image="units/human-loyalists/horseman.png"
					sound="horse-canter.wav"
				[/frame]
				[frame]
					begin="-225"
					end="-150"
					image="units/human-loyalists/horseman-moving.png"
				[/frame]
				[frame]
					begin="-150"
					end="100"
					image="units/human-loyalists/horseman-attack.png"
					sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
				[/frame]
				[frame]
					begin="100"
					end="175"
					image="units/human-loyalists/horseman-moving.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/human-loyalists/horseman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				hits="yes"
				[filter_attack]
					name="spear"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/human-loyalists/horseman.png"
					sound="horse-canter.wav"
				[/frame]
				[frame]
					begin="-200"
					end="-150"
					image="units/human-loyalists/horseman-moving.png"
				[/frame]
				[frame]
					begin="-150"
					end="100"
					image="units/human-loyalists/horseman-attack.png"
					sound="spear.ogg"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/human-loyalists/horseman-moving.png"
				[/frame]
				[frame]
					begin="150"
					end="200"
					image="units/human-loyalists/horseman.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/human-loyalists/horseman.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-loyalists/horseman-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/human-loyalists/horseman-defend.png"
						sound="horse-hit-1.ogg,horse-hit-2.ogg,horse-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/human-loyalists/horseman-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/human-loyalists/horseman.png"
				[/frame]
			[/defend]
			[movement_anim]
				[frame]
					begin="0"
					end="150"
					image="units/human-loyalists/horseman-moving.png"
				[/frame]
			[/movement_anim]
			[defense]
				castle="60"
				cave="80"
				deep_water="80"
				flat="60"
				forest="70"
				frozen="70"
				fungus="80"
				hills="60"
				impassable="80"
				mountains="80"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="4"
				deep_water="99"
				flat="1"
				forest="3"
				frozen="2"
				fungus="4"
				hills="2"
				impassable="99"
				mountains="99"
				reef="3"
				sand="2"
				shallow_water="4"
				swamp_water="4"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="80"
				cold="100"
				fire="100"
				impact="70"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="10"
				description=_ "spear"
				name="spear"
				number="2"
				range="melee"
				type="pierce"
				[specials]
					[damage]
						active_on="offense"
						apply_to="both"
#textdomain wesnoth
						description=_ "Charge:
When used offensively, this attack deals double damage to the target. It also causes this unit to take double damage from the target's counterattack."
						id="charge"
						multiply="2"
						name=_ "charge"
					[/damage]
				[/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^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/side]
	[side]
		action_bonus_count="8"
		aggression="0.5"
		allow_changes="no"
		allow_player="yes"
		caution="0.25"
		colour="9"
		controller="network"
		countdown_time="270000"
		current_player="akkon"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,archer,archer,mixed fighter,healer,scout"
		gold="27"
		hidden="no"
		id="akkon2"
		income="0"
		leader_value="3"
		name="akkon"
		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="akkon2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		start_gold="100"
		team_name="2"
		user_team_name="Team 2"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[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]
		[ai]
			villages_per_scout="8"
		[/ai]
		[village]
			x="11"
			y="19"
		[/village]
		[village]
			x="15"
			y="20"
		[/village]
		[village]
			x="16"
			y="14"
		[/village]
		[village]
			x="20"
			y="15"
		[/village]
		[village]
			x="25"
			y="17"
		[/village]
		[village]
			x="25"
			y="21"
		[/village]
		[unit]
			advances_to="Elvish Marshal"
			alignment="neutral"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="9"
			controller="network"
			cost="32"
			current_player="akkon"
			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"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="47"
			id="akkon2"
			image="units/elves-wood/captain.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Elvish Captain"
			leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose"
			level="2"
			max_attacks="1"
			max_experience="63"
			max_hitpoints="47"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			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="akkon"
			profile="portraits/elves/captain.png"
			race="elf"
			random_leader="Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,Red Mage"
			random_traits="no"
			recruit="Elvish Fighter,Elvish Archer,Mage,Elvish Shaman,Elvish Scout,Wose,Merman Hunter"
			resting="yes"
			save_id="akkon2"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="2"
			team_name="2"
			terrain_liked="Ff, Fa, Ss, Ww"
			type="Elvish Captain"
			underlying_id="2"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			user_team_name="Team 2"
			village_gold="2"
			x="25"
			y="21"
			zoc="yes"
			[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]
			[abilities]
				[leadership]
					affect_self="no"
					cumulative="no"
#textdomain wesnoth
					description=_ "Leadership:
This unit can lead our own units that are next to it, making them fight better.

Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
					female_name=_ "female^leadership"
					id="leadership"
					name=_ "leadership"
					value="50"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="0"
						[/filter]
					[/affect_adjacent]
				[/leadership]
				[leadership]
					affect_self="no"
					cumulative="no"
					id="leadership"
					value="25"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="1"
						[/filter]
					[/affect_adjacent]
				[/leadership]
			[/abilities]
			[portrait]
				image="portraits/elves/transparent/captain.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/captain.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="7"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="5"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="3"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
			[/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="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="39"
			id="Elvish Fighter-25"
			image="units/elves-wood/fighter.png"
			language_name=_ "Elvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="28"
			max_hitpoints="39"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			moves="5"
			name="Celith"
			profile="portraits/elves/fighter.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Fighter"
			underlying_id="25"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="16"
			y="14"
			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="6"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="3"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="3"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^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="Elvish Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			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="1"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="28"
			id="Elvish Archer-26"
			image="units/elves-wood/archer.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="31"
			max_hitpoints="28"
			max_moves="7"
			movement="6"
			movement_type="woodland"
			moves="7"
			name="Amir"
			profile="portraits/elves/archer.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="26"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="20"
			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-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer-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-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-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.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer.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="6"
				description=_ "bow"
				icon="attacks/bow-elven.png"
				name="bow"
				number="4"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^dextrous"
					id="dextrous"
					male_name=_ "dextrous"
					name=_ "dextrous"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="ranged"
					[/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 Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			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="13"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="6"
			id="Elvish Archer-27"
			image="units/elves-wood/archer.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="28"
			max_moves="7"
			movement="6"
			movement_type="woodland"
			moves="7"
			name="Unor"
			profile="portraits/elves/archer.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="27"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="32"
			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/archer-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer-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-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-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.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer.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^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Druid,Elvish Sorceress"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="26"
			id="Elvish Shaman-31"
			image="units/elves-wood/shaman.png"
#textdomain wesnoth-units
			language_name=_ "female^Elvish Shaman"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="26"
			max_moves="6"
			movement="5"
			movement_type="woodland"
			moves="6"
			name="Urebrien"
			profile="portraits/elves/shaman.png~RIGHT()"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Shaman"
			underlying_id="31"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			x="11"
			y="19"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="entangle"
				[/filter_attack]
				[missile_frame]
					begin="-200"
					end="50"
					image="projectiles/entangle.png"
					image_diagonal="projectiles/entangle.png"
					offset="1.0"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-375"
					halo="halo/elven/nature-halo1.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-375"
					end="-300"
					halo="halo/elven/nature-halo2.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-300"
					end="-225"
					halo="halo/elven/nature-halo3.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-225"
					end="-150"
					halo="halo/elven/nature-halo4.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
				[/frame]
				[frame]
					begin="-150"
					end="-75"
					halo="halo/elven/nature-halo5.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
				[/frame]
				[if]
					hits="hit"
					slowed_sound_start_time="-100"
					[filter_second]
						[not]
							[filter_wml]
								[status]
									slowed="yes"
								[/status]
							[/filter_wml]
						[/not]
					[/filter_second]
					[slowed_sound_frame]
						duration="100"
						sound="slowed.wav"
					[/slowed_sound_frame]
				[/if]
				[frame]
					begin="-75"
					end="0"
					halo="halo/elven/nature-halo6.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
					sound="entangle.wav"
				[/frame]
				[frame]
					begin="-0"
					end="50"
					halo="halo/elven/nature-halo7.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="50"
					end="100"
					halo="halo/elven/nature-halo8.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					begin="-175"
					end="-100"
					image="units/elves-wood/shaman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/shaman-attack.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/shaman-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/shaman-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/shaman-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/shaman-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-200"
				[frame]
					duration="55"
					image="units/elves-wood/shaman-heal1.png"
				[/frame]
				[frame]
					duration="55"
					image="units/elves-wood/shaman-heal2.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-1.png"
					image="units/elves-wood/shaman-heal3.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-2.png"
					image="units/elves-wood/shaman-heal4.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-3.png"
					image="units/elves-wood/shaman-heal5.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-4.png"
					image="units/elves-wood/shaman-heal6.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-5.png"
					image="units/elves-wood/shaman-heal7.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-6.png"
					image="units/elves-wood/shaman-heal8.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-7.png"
					image="units/elves-wood/shaman-heal9.png"
				[/frame]
				[frame]
					duration="30"
					image="units/elves-wood/shaman-heal9.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/elves/transparent/shaman.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/shaman.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]
			[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/druidstaff.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="3"
				description=_ "entangle"
				name="entangle"
				number="2"
				range="ranged"
				type="impact"
				[specials]
					[slow]
#textdomain wesnoth
						description=_ "Slow:
This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled. A unit that is slowed will feature a snail icon in its sidebar information when it is selected."
						id="slow"
						name=_ "slows"
					[/slow]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "female^strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Druid,Elvish Sorceress"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="15"
			die_sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="27"
			id="Elvish Shaman-35"
			image="units/elves-wood/shaman.png"
#textdomain wesnoth-units
			language_name=_ "female^Elvish Shaman"
			level="1"
			max_attacks="1"
			max_experience="18"
			max_hitpoints="27"
			max_moves="5"
			movement="5"
			movement_type="woodland"
			moves="5"
			name="Náviel"
			profile="portraits/elves/shaman.png~RIGHT()"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Shaman"
			underlying_id="35"
			unrenamable="no"
			upkeep="full"
			usage="healer"
			x="22"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="entangle"
				[/filter_attack]
				[missile_frame]
					begin="-200"
					end="50"
					image="projectiles/entangle.png"
					image_diagonal="projectiles/entangle.png"
					offset="1.0"
				[/missile_frame]
				[frame]
					begin="-450"
					end="-375"
					halo="halo/elven/nature-halo1.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-375"
					end="-300"
					halo="halo/elven/nature-halo2.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-300"
					end="-225"
					halo="halo/elven/nature-halo3.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="-225"
					end="-150"
					halo="halo/elven/nature-halo4.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
				[/frame]
				[frame]
					begin="-150"
					end="-75"
					halo="halo/elven/nature-halo5.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
				[/frame]
				[if]
					hits="hit"
					slowed_sound_start_time="-100"
					[filter_second]
						[not]
							[filter_wml]
								[status]
									slowed="yes"
								[/status]
							[/filter_wml]
						[/not]
					[/filter_second]
					[slowed_sound_frame]
						duration="100"
						sound="slowed.wav"
					[/slowed_sound_frame]
				[/if]
				[frame]
					begin="-75"
					end="0"
					halo="halo/elven/nature-halo6.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman-attack2.png"
					sound="entangle.wav"
				[/frame]
				[frame]
					begin="-0"
					end="50"
					halo="halo/elven/nature-halo7.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="50"
					end="100"
					halo="halo/elven/nature-halo8.png"
					halo_x="0"
					halo_y="-12"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					begin="100"
					end="150"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="staff"
				[/filter_attack]
				[frame]
					begin="-175"
					end="-100"
					image="units/elves-wood/shaman.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/shaman-attack.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/elves-wood/shaman-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/elves-wood/shaman.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/shaman-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/shaman-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/shaman-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/shaman.png"
				[/frame]
			[/defend]
			[healing_anim]
				start_time="-200"
				[frame]
					duration="55"
					image="units/elves-wood/shaman-heal1.png"
				[/frame]
				[frame]
					duration="55"
					image="units/elves-wood/shaman-heal2.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-1.png"
					image="units/elves-wood/shaman-heal3.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-2.png"
					image="units/elves-wood/shaman-heal4.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-3.png"
					image="units/elves-wood/shaman-heal5.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-4.png"
					image="units/elves-wood/shaman-heal6.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-5.png"
					image="units/elves-wood/shaman-heal7.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-6.png"
					image="units/elves-wood/shaman-heal8.png"
				[/frame]
				[frame]
					duration="55"
					halo="halo/elven/shaman-heal-halo-7.png"
					image="units/elves-wood/shaman-heal9.png"
				[/frame]
				[frame]
					duration="30"
					image="units/elves-wood/shaman-heal9.png"
				[/frame]
			[/healing_anim]
			[portrait]
				image="portraits/elves/transparent/shaman.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/shaman.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]
			[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/druidstaff.png"
				name="staff"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="3"
				description=_ "entangle"
				name="entangle"
				number="2"
				range="ranged"
				type="impact"
				[specials]
					[slow]
#textdomain wesnoth
						description=_ "Slow:
This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled. A unit that is slowed will feature a snail icon in its sidebar information when it is selected."
						id="slow"
						name=_ "slows"
					[/slow]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "female^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=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Ranger,Elvish Marksman"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="17"
			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="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="26"
			id="Elvish Archer-37"
			image="units/elves-wood/archer.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Archer"
			level="1"
			max_attacks="1"
			max_experience="31"
			max_hitpoints="33"
			max_moves="7"
			movement="6"
			movement_type="woodland"
			moves="7"
			name="Galdorfindel"
			profile="portraits/elves/archer.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Elvish Archer"
			undead_variation="archer"
			underlying_id="37"
			unrenamable="no"
			upkeep="full"
			usage="archer"
			x="30"
			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-bow.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-380"
						end="-305"
						image="units/elves-wood/archer-bow-attack1.png"
						sound="bow-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-305"
					end="-230"
					image="units/elves-wood/archer-bow-attack2.png"
				[/frame]
				[frame]
					begin="-230"
					end="-130"
					image="units/elves-wood/archer-bow-attack3.png"
				[/frame]
				[frame]
					begin="-130"
					end="0"
					image="units/elves-wood/archer-bow-attack4.png"
				[/frame]
				[frame]
					begin="0"
					end="65"
					image="units/elves-wood/archer-bow.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="sword"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-175"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					begin="-175"
					end="-75"
					image="units/elves-wood/archer-sword-1.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-75"
						end="75"
						image="units/elves-wood/archer-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-sword-2.png"
						sound="sword-1.ogg"
					[/frame]
				[/else]
				[frame]
					begin="75"
					end="125"
					image="units/elves-wood/archer-sword-3.png"
				[/frame]
				[frame]
					begin="125"
					end="175"
					image="units/elves-wood/archer-sword-4.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_attack]
					range="melee"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-sword-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-sword-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-sword.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/elves-wood/archer-bow.png"
				[/frame]
				[frame]
					duration="100"
					image="units/elves-wood/archer-bow-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/elves-wood/archer-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/archer-bow-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/elves-wood/archer-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.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/archer.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^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]
	[/side]
	[side]
		action_bonus_count="0"
		aggression="0.5"
		allow_changes="no"
		allow_player="no"
		caution="0.25"
		colour="5"
		controller="ai"
		countdown_time="270000"
		current_player="ai3"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
		gold="-145"
		hidden="yes"
		id="ai3"
		income="0"
		leader_value="3"
		name=_ "Computer player"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives="Victory:
@Defeat enemy leader(s)"
		objectives_changed="yes"
		recruit="Bowman,Cavalryman,Fencer,Heavy Infantryman,Horseman,Mage,Merman Fighter,Spearman"
		recruitment_pattern="fighter,fighter,fighter,archer,mixed fighter,scout"
		save_id="ai3"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="3"
		start_gold="100"
		team_name="3"
		user_team_name="Team 3"
		village_gold="2"
		village_value="1"
		villages_per_scout="4"
		[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]
		[unit]
			advances_to="Hurricane Drake"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="30"
			description="Dans le ciel noir soufflaient les vents du nord,
La lune luisait aux confins de l'aurore,
Brave était le dracan qui osa lâcher
Son toit pour voler au basilic l'or.

Par cette nuit noire aux cieux si agités,
Il renonça à tout ce qu'il savait,
Fou mais brave, dans la cave du basilic
Il courut, et en lui le feu brûlait.

Hélas, son feu intérieur ne brûle plus.
Le basilic, dans un grand rugissement,
Lui glaça le sang et le fit statue,
Ce qui pour toujours sera son vécu.

Dans le ciel noir soufflaient les vents du nord,
Les années ont passé, ces jours sont morts,
Ici gît le dracan qui osa lâcher
Son toit pour voler au basilic l'or.
(inscrit par Flametrooper)"
			die_sound="drake-die.ogg"
			experience="0"
			facing="se"
			flies="false"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Sky Drake-3"
			image="units/drakes/sky.png"
#textdomain wesnoth-units
			language_name=_ "Sky Drake"
			level="2"
			max_attacks="1"
			max_experience="56"
			max_hitpoints="1"
			max_moves="0"
			movement="9"
			movement_type="fly"
			moves="0"
			profile="portraits/drakes/glider.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Sky Drake"
			undead_variation="drake"
			underlying_id="3"
			unrenamable="yes"
			upkeep="full"
			usage="scout"
			x="27"
			y="14"
			zoc="yes"
			[defense]
				castle="50"
				cave="70"
				deep_water="50"
				flat="50"
				forest="50"
				frozen="50"
				fungus="60"
				hills="50"
				impassable="80"
				mountains="50"
				reef="50"
				sand="50"
				shallow_water="50"
				swamp_water="50"
				unwalkable="50"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="1"
				flat="1"
				forest="1"
				frozen="1"
				fungus="2"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="130"
				blade="90"
				cold="150"
				fire="50"
				impact="80"
				pierce="110"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="6"
				description=_ "slam"
				icon="attacks/slam-drake.png"
				name="slam"
				number="3"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="3"
				range="ranged"
				type="fire"
				[specials]
					[chance_to_hit]
						active_on="offense"
						cumulative="yes"
#textdomain wesnoth
						description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
						id="marksman"
						name=_ "marksman"
						value="60"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="46"
			description="Le puissant guerrier saurien Xikkrisx de Syrsszk fut envoyé dans cette région par les anciens du clan Rysssrylosszkk (traduction : « Le Clan des Chasses-Ennemis-dans-Rivières-Brûlantes »), qui se préparaient à attaquer un avant-poste humain et qui avaient grand besoin de la magie puissante d'Oxsrrsk, un mystique saurien vu pour la dernière fois se dirigeant vers le lac Ruaskkolin. Xikkrisx découvrit le corps pétrifié d'Oxsrrsk, ainsi qu'un parchemin soigneusement enroulé visiblement tombé dans une petite crevasse du sol de la caverne. Il le déroula et lut un bref passage au milieu du texte : « Après avoir été enchaîné et expulsé du Monde Supérieur, l'esprit furieux de Chak'kso chercha à se libérer pour excercer sur plusieurs régions du Monde Supérieur une influence corruptrice canalisée par des « voies de pierre » qui s'enfoncent de la surface jusqu'à la Marche d'En-bas. Sa fureur transforma des œufs de lézards supérieurs, conditionnant leurs corps et leur esprits à faire vivre la haine de Chak'kso. Désorienté, Xikkrisx se concentra sur la tâche à accomplir. Pensant que les anciens pourraient peut-être trouver un moyen de libérer Oxsrrsk, il entreprit la longue et difficile tâche de ramener la statue dans les terres du clan Rysssrylosszkk. Épuisé, mais très proche du lac, Xikkrisx posa la statue dans une petite caverne et s'allongea pour se reposer. Il fut réveillé par un grondement à glacer le sang."
			die_sound="hiss-die.wav"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Saurian Flanker-4"
			image="units/saurians/flanker.png"
#textdomain wesnoth-units
			language_name=_ "Saurian Flanker"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="7"
			movement_type="lizard"
			moves="0"
			name="Xikkrisx"
			profile="portraits/saurians/skirmisher.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Saurian Flanker"
			undead_variation="saurian"
			underlying_id="4"
			unrenamable="yes"
			upkeep="full"
			usage="scout"
			x="40"
			y="8"
			zoc="yes"
			[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]
			[advancement]
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[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]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="8"
#textdomain wesnoth-units
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="4"
				range="melee"
				type="pierce"
			[/attack]
			[attack]
				damage="7"
				description=_ "spear"
				icon="attacks/spear.png"
				name="spear"
				number="2"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="27"
			description="Oxsrrsk était un puissant oracle saurien qui, lors d'un raid contre le clan rival Xraxss, avait trouvé dans les coffres du défunt oracle Hesx-Rzzak un parchemin des plus fascinants. Intitulé « Ney'yks des regards granitiques », il parlait d'une créature connue sous le nom de « Chak'kso Ney'yks », qui dans une langue vielle saurienne signifiait « Aîné des fils de Chak'kso ». Les légendes elfes décrivaient Chak'kso comme un démon majeur de la terre, ou un puissant demi-dieu de la Marche d'En-bas, qui avait cherché jadis à pétrifier toute vie terrestre tellement sa haine pour les créatures de chair était grande. Il fut finalement vaincu et dépossédé de ses pouvoirs magiques ; mais des siècles après son bannissement, dans une région bien éloignée de la surface terrestre, une nouvelle espèce apparut, capable de transformer en pierre toute créature de chair. Il y eut une époque où les basilics, comme on les nommait, faisaient des ravages dans le monde des vivants, transformant des milliers d'êtres en statues. Les basilics furent tous vaincus, mais au prix fort. Tous, apparemment, sauf un : celui connu sous le nom de « Ney'yks », ou bien « L'Aîné des fils ». Pleinement convaincu de ses capacités à localiser et à asservir cette puissante créature, Oxsrrsk se mit en route..."
			die_sound="hiss-die.wav"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flies="false"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Saurian Oracle-5"
			image="units/saurians/oracle.png"
			language_name=_ "Saurian Oracle"
			level="2"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="6"
			movement_type="lizard"
			moves="0"
			name="Oxsrrsk"
			profile="portraits/saurians/augur.png"
			race="lizard"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Saurian Oracle"
			undead_variation="saurian"
			underlying_id="5"
			unrenamable="yes"
			upkeep="full"
			usage="archer"
			x="39"
			y="8"
			zoc="yes"
			[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]
			[advancement]
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[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]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="4"
#textdomain wesnoth-units
				description=_ "staff"
				icon="attacks/staff-magic.png"
				name="staff"
				number="3"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="8"
				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]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Elvish Sharpshooter"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="41"
			description="Corps svelte et mains qui dansent
- - Sept diamants et onze
Ses adversaires n'avaient aucune chance
- - Sept diamants et onze
Maldragon l'archer
Au milieu des statues 
A été tué
- - Sept diamants et l'elfe
(inscrit par Gauteamus)"
			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"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Elvish Marksman-6"
			image="units/elves-wood/marksman.png"
#textdomain wesnoth-units
			language_name=_ "Elvish Marksman"
			level="2"
			max_attacks="1"
			max_experience="56"
			max_hitpoints="1"
			max_moves="0"
			movement="6"
			movement_type="woodland"
			moves="0"
			profile="portraits/elves/marksman.png"
			race="elf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Elvish Marksman"
			undead_variation="archer"
			underlying_id="6"
			unrenamable="yes"
			upkeep="full"
			usage="archer"
			x="2"
			y="11"
			zoc="yes"
			[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]
			[portrait]
				image="portraits/elves/transparent/marksman.png"
				mirror="true"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/elves/transparent/marksman.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="6"
				description=_ "sword"
				icon="attacks/sword-elven.png"
				name="sword"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="9"
				description=_ "longbow"
				icon="attacks/bow-elven-magic.png"
				name="longbow"
				number="4"
				range="ranged"
				type="pierce"
				[specials]
					[chance_to_hit]
						active_on="offense"
						cumulative="yes"
#textdomain wesnoth
						description=_ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
						id="marksman"
						name=_ "marksman"
						value="60"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="41"
			description="Blum Duk le gobelin était renommé dans son clan pour son courage et pour avoir domestiqué un des loups noirs des montagnes. Seuls son autorité et ses compétences maintenaient vivants les gobelins de la région malgré les menaces des humains et des elfes. La rumeur disait que son loup avait tué cinquante hommes et une centaine d'elfes.
Quand il apprit qu'un monstre horrible vivait dans les parages, il parut tout naturel qu'il parte l'affronter seul. Tous s'attendaient à ce qu'il tue la créature facilement et rapporte sa carcasse pour un festin.
Un grand choc l'attendait. Blum Duk se mit à trembler dès qu'il vit le basilic. Il essaya de s'enfuir sur son loup, mais il ne put pas bouger. Comme la créature venait sur lui, il cria ces derniers mots : « Bon Gog, mon chien, tes pattes sont-elles en pierre ?!? »
(inscrit par Elvish Pillager)"
			die_sound="wolf-die.wav"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Direwolf Rider-7"
			image="units/goblins/direwolver.png"
#textdomain wesnoth-units
			language_name=_ "Direwolf Rider"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="10"
			movement_type="orcishfoot"
			moves="0"
			name="Blum Duk"
			race="wolf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Direwolf Rider"
			undead_variation="mounted"
			underlying_id="7"
			unrenamable="yes"
			upkeep="full"
			usage="scout"
			x="10"
			y="17"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="60"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="70"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="2"
				fungus="3"
				hills="1"
				impassable="99"
				mountains="2"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="100"
				cold="100"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="9"
#textdomain wesnoth-units
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="4"
				description=_ "claws"
				icon="attacks/claws-animal.png"
				name="claws"
				number="4"
				range="melee"
				type="blade"
				[specials]
					[poison]
#textdomain wesnoth
						description=_ "Poison:
This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison can not, of itself, kill a unit."
						id="poison"
						name=_ "poison"
					[/poison]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="100"
			description="Rah Ihn Mar, champion des Collines Brûlantes, poursuivit jusqu'au lac Ruaskkolin Terowydlithrol le héros elfe, connu parmi les siens sous le nom de « L'Exécuteur de dragons ». On raconte que Terowydlithrol tua un dragon de feu qui menaçait un village elfe et initia une « contre-attaque » dans laquelle périrent 37 dracans supposés faire allégeance au dragon et campant sur un ravin avoisinant. Sachant ces dracans innocents, Rah Ihn Mar arriva au lac pour traquer et tuer Terowydlithrol, arrivé la veille dans la région. Consummé par la vengeance, Rah Ihn Mar commença sa chasse..."
			die_sound="drake-die.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Armageddon Drake-8"
			image="units/drakes/armageddon.png"
#textdomain wesnoth-units
			language_name=_ "Armageddon Drake"
			level="4"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="5"
			movement_type="drakefly"
			moves="0"
			name="Rah Ihn Mar"
			profile="portraits/drakes/burner.png"
			race="drake"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Armageddon Drake"
			undead_variation="drake"
			underlying_id="8"
			unrenamable="yes"
			upkeep="full"
			usage="archer"
			x="11"
			y="14"
			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="0"
				impact="80"
				pierce="110"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="15"
#textdomain wesnoth-units
				description=_ "claws"
				icon="attacks/claws-drake.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="12"
				description=_ "fire breath"
				icon="attacks/fire-breath-drake.png"
				name="fire breath"
				number="6"
				range="ranged"
				type="fire"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="40"
			description="Il avait vécu là depuis toujours, dans les profondeurs de l'eau, se nourrissant des poissons, des grenouilles et des ondins qui entraient dans son domaine. C'était son lac et celui d'aucun autre, et même s'il n'était pas grand, il en était le maître. Alors vint le basilic qui regarda le serpent dans les yeux. Et le serpent ne mourut pas, mais il n'était plus vivant. Ainsi le nouveau seigneur du lac était venu.
(inscrit par Turin)"
			die_sound="water-blast.wav"
			experience="0"
			facing="sw"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Sea Serpent-9"
			image="units/monsters/seaserpent.png"
			language_name=_ "Sea Serpent"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="8"
			movement_type="deepsea"
			moves="0"
			profile="portraits/monsters/sea-serpent.png"
			race="monster"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Sea Serpent"
			undead_variation="swimmer"
			underlying_id="9"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="22"
			y="12"
			zoc="yes"
			[defense]
				castle="70"
				cave="80"
				deep_water="40"
				flat="70"
				forest="70"
				frozen="70"
				fungus="80"
				hills="70"
				impassable="80"
				mountains="80"
				reef="50"
				sand="70"
				shallow_water="50"
				swamp_water="40"
				unwalkable="80"
				village="70"
			[/defense]
			[movement_costs]
				castle="1"
				cave="3"
				deep_water="1"
				flat="4"
				forest="5"
				frozen="2"
				fungus="3"
				hills="5"
				impassable="99"
				mountains="99"
				reef="2"
				sand="4"
				shallow_water="2"
				swamp_water="2"
				unwalkable="99"
				village="2"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="80"
				cold="40"
				fire="100"
				impact="70"
				pierce="100"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="18"
#textdomain wesnoth-units
				description=_ "fangs"
				icon="attacks/fangs-animal.png"
				name="fangs"
				number="2"
				range="melee"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="58"
			description="Vaillant héros de l'âge d'or de Wesnoth, ce grand cavalier et excellent meneur d'hommes arriva dans ce lieu maudit lors d'un raid contre des orcs. Pris par surprise par ces odieuses créatures, beaucoup de ses compagnons furent occis, mais lui se battit vaillamment et tua de nombreux ennemis. Mais hélas ! l'horrible basilic se tourna vers lui et le changea en pierre au moment où il tuait le dernier orc. Il ne reste plus qu'un raide témoignage de sa prestance et de sa grande force passées.
(inscrit par Fynmiir)"
			die_sound="horse-die.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Grand Knight-10"
			image="units/human-loyalists/grand-knight.png"
			language_name=_ "Grand Knight"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="7"
			movement_type="mounted"
			moves="0"
			profile="portraits/humans/grand-knight.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Grand Knight"
			undead_variation="mounted"
			underlying_id="10"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="25"
			y="14"
			zoc="yes"
			[defense]
				castle="60"
				cave="80"
				deep_water="80"
				flat="60"
				forest="70"
				frozen="70"
				fungus="80"
				hills="60"
				impassable="80"
				mountains="80"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="4"
				deep_water="99"
				flat="1"
				forest="3"
				frozen="2"
				fungus="4"
				hills="2"
				impassable="99"
				mountains="99"
				reef="3"
				sand="2"
				shallow_water="4"
				swamp_water="4"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="80"
				cold="100"
				fire="100"
				impact="70"
				pierce="120"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="12"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/greatsword-human.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="17"
				description=_ "lance"
				name="lance"
				number="2"
				range="melee"
				type="pierce"
				[specials]
					[damage]
						active_on="offense"
						apply_to="both"
#textdomain wesnoth
						description=_ "Charge:
When used offensively, this attack deals double damage to the target. It also causes this unit to take double damage from the target's counterattack."
						id="charge"
						multiply="2"
						name=_ "charge"
					[/damage]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Ancient Wose"
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="31"
			description="Bramwythl le wose a toujours été considéré comme lent et taciturne, même par les autres woses. Plus que tout autre, il aimait simplement rester debout sous le soleil, les bras levés, admirant la beauté du ciel. Une fois, il confia même à un camarade que son plus grand souhait serait de pouvoir baigner pour toujours dans la gloire du soleil.
Cependant, peu de temps après, la communauté wose locale apprit l'arrivée d'un monstre horrible, assez puissant pour détruire facilement le peu d'entre eux qui vivaient dans les parages. Ils s'en allèrent rapidement (pour des woses, en tout cas), mais Bramwythl resta en arrière ; dans leur hâte, aucun ne pensa à aller le prévenir du danger.
Il fut complètement pris par surprise par le basilic et changé en pierre avant même de reconnaître la bête. Sa silhouette pétrifiée est encore là aujourd'hui, chauffée par les rayons du soleil, sous la voûte céleste. Son souhait le plus cher lui avait été accordé.
(inscrit par Elvish Pillager)"
			die_sound="wose-die.ogg"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Elder Wose-11"
			image="units/woses/wose-elder.png"
#textdomain wesnoth-units
			language_name=_ "Elder Wose"
			level="2"
			max_attacks="1"
			max_experience="70"
			max_hitpoints="1"
			max_moves="0"
			movement="4"
			movement_type="treefolk"
			moves="0"
			name="Bramwythl"
			race="wose"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Elder Wose"
			undead_variation="wose"
			underlying_id="11"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="32"
			y="6"
			zoc="yes"
			[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"
				stoned="on"
			[/status]
			[attack]
				damage="19"
#textdomain wesnoth-units
				description=_ "crush"
				icon="attacks/crush-wose.png"
				name="crush"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="50"
			description="Le général Talael Ryndoc est venu ici pour se battre en duel contre le maréchal Aethec Corryn, mais les deux hommes ne se sont jamais trouvés. "
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Iron Mauler-12"
			image="units/human-loyalists/siegetrooper.png"
			language_name=_ "Iron Mauler"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="4"
			movement_type="armoredfoot"
			moves="0"
			name="Talael Ryndoc"
			profile="portraits/humans/iron-mauler.png~RIGHT()"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Iron Mauler"
			underlying_id="12"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="34"
			y="11"
			zoc="yes"
			[defense]
				castle="50"
				cave="60"
				deep_water="80"
				flat="70"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="60"
				mountains="80"
				reef="80"
				sand="80"
				shallow_water="90"
				swamp_water="90"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="4"
				fungus="2"
				hills="3"
				impassable="99"
				mountains="99"
				reef="3"
				sand="2"
				shallow_water="4"
				swamp_water="4"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="50"
				cold="110"
				fire="110"
				impact="90"
				pierce="60"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[portrait]
				image="portraits/humans/transparent/iron-mauler.png"
				mirror="false"
				side="right"
				size="400"
			[/portrait]
			[trait]
				description=_ "Fights normally during unfavorable times of day/night"
				female_name=_ "female^fearless"
				id="fearless"
				male_name=_ "fearless"
			[/trait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="25"
#textdomain wesnoth-units
				description=_ "mace"
				name="mace"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="66"
			description="Les dernières paroles du maréchal Aethec Corryn furent : « Talael Ryndoc ! Je n'arrête pas de courir après vous ! Je vais retourner à la cour de Haldric et l'informer que vous êtes bien trop lâche pour participer à notre duel ! Votre disgrâce sera plus infamante que la mort que je vous aurais donnée ! »

Sans doute aurait-il mieux fait de ne pas crier si fort ... "
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Grand Marshal-13"
			image="units/human-loyalists/marshal.png"
			language_name=_ "Grand Marshal"
			level="4"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="6"
			movement_type="smallfoot"
			moves="0"
			name="Aethec Corryn"
			profile="portraits/humans/marshal.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Grand Marshal"
			underlying_id="13"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="15"
			y="11"
			zoc="yes"
			[defense]
				castle="40"
				cave="60"
				deep_water="80"
				flat="60"
				forest="50"
				frozen="80"
				fungus="50"
				hills="50"
				impassable="60"
				mountains="40"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="40"
			[/defense]
			[movement_costs]
				castle="1"
				cave="2"
				deep_water="99"
				flat="1"
				forest="2"
				frozen="3"
				fungus="2"
				hills="2"
				impassable="99"
				mountains="3"
				reef="2"
				sand="2"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="80"
				blade="80"
				cold="100"
				fire="100"
				impact="80"
				pierce="80"
			[/resistance]
			[abilities]
				[leadership]
					affect_self="no"
					cumulative="no"
#textdomain wesnoth
					description=_ "Leadership:
This unit can lead our own units that are next to it, making them fight better.

Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
					female_name=_ "female^leadership"
					id="leadership"
					name=_ "leadership"
					value="100"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="0"
						[/filter]
					[/affect_adjacent]
				[/leadership]
				[leadership]
					affect_self="no"
					cumulative="no"
					id="leadership"
					value="75"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="1"
						[/filter]
					[/affect_adjacent]
				[/leadership]
				[leadership]
					affect_self="no"
					cumulative="no"
					id="leadership"
					value="50"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="2"
						[/filter]
					[/affect_adjacent]
				[/leadership]
				[leadership]
					affect_self="no"
					cumulative="no"
					id="leadership"
					value="25"
					[affect_adjacent]
						adjacent="n,ne,se,s,sw,nw"
						[filter]
							level="3"
						[/filter]
					[/affect_adjacent]
				[/leadership]
			[/abilities]
			[advancement]
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[portrait]
				image="portraits/humans/transparent/marshal.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/marshal.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="10"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/greatsword-human.png"
				name="sword"
				number="4"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "crossbow"
				icon="attacks/crossbow-human.png"
				name="crossbow"
				number="3"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="48"
			description="Ce vaillant guerrier, connu sous le nom de Rilhon chez les nagas, entendit parler d'un fabuleux trésor perdu dans ces cavernes humides : une lance dont la pointe proviendrait d'une dent de Chak'kso Ney'yks, un ancestral basilic tué il y a bien longtemps par le héros elfe, Eloralduil. D'après la légende, l'arme reposerait quelque part au fond du lac Ruaskkolin, nommé ainsi en hommage au fameux serpent qui y séjournait. Alors qu'il s'était préparé pour combattre le serpent, Rilhon eut deux énormes surprises : la forme pétrifiée de Ruaskkolin et Chak'kso Ney'yks, extrêmement bien portant et qui avait, comme c'est étrange, encore toutes ses dents.
(inscrit par Paterson)"
			die_sound="naga-die.ogg"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Naga Myrmidon-14"
			image="units/nagas/myrmidon.png"
			language_name=_ "Naga Myrmidon"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="7"
			movement_type="naga"
			moves="0"
			name="Rilhon"
			profile="portraits/nagas/fighter.png"
			race="naga"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Naga Myrmidon"
			undead_variation="swimmer"
			underlying_id="14"
			unrenamable="yes"
			upkeep="full"
			usage="fighter"
			x="20"
			y="12"
			zoc="yes"
			[defense]
				castle="50"
				cave="60"
				deep_water="50"
				flat="50"
				forest="60"
				frozen="80"
				fungus="60"
				hills="60"
				impassable="60"
				mountains="60"
				reef="30"
				sand="40"
				shallow_water="40"
				swamp_water="40"
				unwalkable="80"
				village="60"
			[/defense]
			[movement_costs]
				castle="2"
				cave="2"
				deep_water="1"
				flat="2"
				forest="3"
				frozen="2"
				fungus="2"
				hills="3"
				impassable="99"
				mountains="5"
				reef="2"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="100"
				blade="100"
				cold="120"
				fire="100"
				impact="100"
				pierce="100"
			[/resistance]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="9"
#textdomain wesnoth-units
				description=_ "sword"
				icon="attacks/sword-orcish.png"
				name="sword"
				number="5"
				range="melee"
				type="blade"
			[/attack]
			[modifications]
				[trait]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			alignment="lawful"
			alpha="256"
			attacks_left="1"
			cost="52"
			description="À travers vagues et lits pierreux
Bleue et blanche
Elle avançait et reculait les marées
Et enseignait aux poissons la langue des planètes
Gris vert
De la magie
Coulant de son esprit vers les fils du varech et les coquilles d'escargots
Un tour de queue et un geste de ses mains
Elle envoyait ses chants courir le sable sur leurs pieds d'aiguille
Et maintenant
Et maintenant la plus étrange pause
Depuis des siècles
Plus un œil ne bouge

(inscrit par MJQ)"
			die_sound="mermaid-die.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="0"
			goto_y="0"
			hitpoints="1"
			id="Mermaid Siren-15"
			image="units/merfolk/siren.png"
			language_name=_ "Mermaid Siren"
			level="3"
			max_attacks="1"
			max_experience="105"
			max_hitpoints="1"
			max_moves="0"
			movement="7"
			movement_type="swimmer"
			moves="0"
			profile="portraits/merfolk/initiate.png"
			race="merman"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="3"
			type="Mermaid Siren"
			undead_variation="swimmer"
			underlying_id="15"
			unrenamable="yes"
			upkeep="full"
			usage="mixed fighter"
			x="17"
			y="11"
			zoc="yes"
			[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]
			[advancement]
#textdomain wesnoth
				description=_ "Max HP bonus +3, Max XP +20%"
				id="amla_default"
				image="misc/icon-amla-tough.png"
				max_times="100"
				strict_amla="yes"
				[effect]
					apply_to="hitpoints"
					heal_full="yes"
					increase_total="3"
				[/effect]
				[effect]
					apply_to="max_experience"
					increase="20%"
				[/effect]
				[effect]
					apply_to="status"
					remove="poisoned"
				[/effect]
				[effect]
					apply_to="status"
					remove="slowed"
				[/effect]
			[/advancement]
			[portrait]
				image="portraits/merfolk/transparent/initiate.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/merfolk/transparent/initiate.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[variables]
			[/variables]
			[status]
				hidden="yes"
				stoned="on"
			[/status]
			[attack]
				damage="12"
#textdomain wesnoth-units
				description=_ "naia touch"
				icon="attacks/touch-faerie.png"
				name="naia touch"
				number="1"
				range="melee"
				type="impact"
				[specials]
					[chance_to_hit]
						cumulative="no"
#textdomain wesnoth
						description=_ "Magical:
This attack always has a 70% chance to hit regardless of the defensive ability of the unit being attacked."
						id="magical"
						name=_ "magical"
						value="70"
					[/chance_to_hit]
				[/specials]
			[/attack]
			[attack]
				damage="15"
#textdomain wesnoth-units
				description=_ "water spray"
				icon="attacks/waterspray.png"
				name="water spray"
				number="3"
				range="ranged"
				type="impact"
				[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]
					id="remove_hp"
					[effect]
						apply_to="hitpoints"
						increase_total="-100%"
					[/effect]
					[effect]
						apply_to="movement"
						set="0"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
	[/side]
[/replay_start]
[statistics]
	mid_scenario="yes"
	[scenario]
		scenario="2p - Caves of the Basilisk"
		[team]
			[recruits]
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
			[/deaths]
			[killed]
			[/killed]
			[attacks]
			[/attacks]
			[defends]
			[/defends]
			recruit_cost="0"
			recall_cost="0"
			damage_inflicted="0"
			damage_taken="0"
			expected_damage_inflicted="0"
			expected_damage_taken="0"
			turn_damage_inflicted="0"
			turn_damage_taken="0"
			turn_expected_damage_inflicted="0"
			turn_expected_damage_taken="0"
			save_id="ai3"
		[/team]
		[team]
			[recruits]
				Elvish Archer="7"
				Elvish Fighter="5"
				Elvish Shaman="2"
				Merman Hunter="1"
				Wose="1"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Elvish Archer="6"
				Elvish Fighter="2"
				Merman Hunter="1"
			[/deaths]
			[killed]
				Cavalryman="1"
				Fencer="1"
				Horseman="1"
				Merman Fighter="2"
			[/killed]
			[attacks]
				[sequence]
					s0000="2"
					s0101="1"
					_num="30"
				[/sequence]
				[sequence]
					s00="1"
					s000="1"
					s0000="1"
					s0001="3"
					s0010="1"
					s0011="1"
					s0100="1"
					s0110="1"
					s1="1"
					s1000="1"
					s1001="1"
					_num="40"
				[/sequence]
				[sequence]
					s0="1"
					_num="50"
				[/sequence]
				[sequence]
					s11="2"
					s1101="1"
					s1111="1"
					_num="60"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s00="3"
					s10="2"
					_num="30"
				[/sequence]
				[sequence]
					s0="1"
					s00="2"
					s0000="1"
					s01="1"
					s10="1"
					s11="5"
					_num="40"
				[/sequence]
				[sequence]
					s10="2"
					s11="1"
					s1101="1"
					_num="50"
				[/sequence]
				[sequence]
					s="3"
					s00="1"
					s01="1"
					s10="1"
					s11="6"
					_num="60"
				[/sequence]
			[/defends]
			recruit_cost="254"
			recall_cost="0"
			damage_inflicted="326"
			damage_taken="315"
			expected_damage_inflicted="339739"
			expected_damage_taken="324342"
			turn_damage_inflicted="0"
			turn_damage_taken="0"
			turn_expected_damage_inflicted="0"
			turn_expected_damage_taken="0"
			save_id="akkon2"
		[/team]
		[team]
			[recruits]
				Cavalryman="2"
				Fencer="3"
				Heavy Infantryman="1"
				Horseman="3"
				Mage="2"
				Merman Fighter="4"
				Spearman="3"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Cavalryman="1"
				Fencer="1"
				Horseman="1"
				Merman Fighter="2"
			[/deaths]
			[killed]
				Elvish Archer="6"
				Elvish Fighter="2"
				Merman Hunter="1"
			[/killed]
			[attacks]
				[sequence]
					s010="2"
					_num="30"
				[/sequence]
				[sequence]
					s00="2"
					s000="1"
					s0010="1"
					s1="1"
					s100="3"
					s101="2"
					s11="1"
					s110="2"
					s111="2"
					_num="40"
				[/sequence]
				[sequence]
					s1001="1"
					_num="50"
				[/sequence]
				[sequence]
					s000="3"
					s0001="1"
					s001="2"
					s010="1"
					s011="1"
					s1="2"
					s1101="1"
					s111="1"
					s1110="1"
					s1111="1"
					_num="60"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s="17"
					_num="0"
				[/sequence]
				[sequence]
					s0="1"
					s1="1"
					_num="30"
				[/sequence]
				[sequence]
					s0="1"
					_num="50"
				[/sequence]
				[sequence]
					s011="1"
					_num="60"
				[/sequence]
			[/defends]
			recruit_cost="308"
			recall_cost="0"
			damage_inflicted="315"
			damage_taken="326"
			expected_damage_inflicted="324342"
			expected_damage_taken="339739"
			turn_damage_inflicted="0"
			turn_damage_taken="0"
			turn_expected_damage_inflicted="0"
			turn_expected_damage_taken="0"
			save_id="ced1"
		[/team]
	[/scenario]
[/statistics]
