label="2S – Die Insel der Stachelh... Runde 7konflikt3"
version="1.6"
completion="running"
campaign_type="multiplayer"
difficulty="NORMAL"
random_seed="12595"
random_calls="0"
next_underlying_unit_id="22"
end_text_duration="0"
[variables]
[/variables]
[replay]
	[command]
		[start]
		[/start]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Wsad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="dualon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="EPIC has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="2"
			x="22"
			y="6"
		[/recruit]
		[random]
			value="12196"
		[/random]
		[random]
			value="15210"
		[/random]
		[random]
			value="25972"
		[/random]
		[random]
			value="19122"
		[/random]
		[random]
			value="20117"
		[/random]
		[random]
			value="20229"
		[/random]
		[random]
			value="29851"
		[/random]
		[random]
			value="28057"
		[/random]
		[random]
			value="27149"
		[/random]
		[random]
			value="4188"
		[/random]
		[random]
			value="5272"
		[/random]
		[random]
			value="983"
		[/random]
		[random]
			value="24050"
		[/random]
		[random]
			value="17679"
		[/random]
		[random]
			value="10402"
			[results]
				checksum="<0CL,>MA07qnKSwEonI1LxtPCvyvIJCEpbxFsqwtpJJCxrnKSQUuOzuQTzBNpzqtPasFJDFNwNCmGSzKQuCQKCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFTypdZF<gID"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="4"
			x="23"
			y="6"
		[/recruit]
		[random]
			value="13313"
		[/random]
		[random]
			value="5746"
		[/random]
		[random]
			value="30558"
		[/random]
		[random]
			value="6608"
		[/random]
		[random]
			value="2318"
		[/random]
		[random]
			value="1285"
		[/random]
		[random]
			value="3003"
		[/random]
		[random]
			value="16572"
		[/random]
		[random]
			value="23421"
		[/random]
		[random]
			value="24155"
		[/random]
		[random]
			value="6929"
		[/random]
		[random]
			value="6383"
		[/random]
		[random]
			value="14213"
		[/random]
		[random]
			value="13982"
		[/random]
		[random]
			value="32375"
			[results]
				checksum="uyqOVzDO<ExdHrVAAKrGB6qDQPwqLuEDUSNIMADRBGxxpOFSryqC1rOBpDQNRqrWuTuTxCUFMDPxfDLuyOdqNHp2JuaZJrXGikJwc0bkdie+c.P93obZj,mcoh3b,IXl"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="7"
			x="23"
			y="5"
		[/recruit]
		[random]
			value="862"
		[/random]
		[random]
			value="30186"
		[/random]
		[random]
			value="23719"
		[/random]
		[random]
			value="6593"
		[/random]
		[random]
			value="18742"
		[/random]
		[random]
			value="5757"
		[/random]
		[random]
			value="11238"
		[/random]
		[random]
			value="867"
		[/random]
		[random]
			value="18291"
		[/random]
		[random]
			value="9888"
		[/random]
		[random]
			value="9774"
		[/random]
		[random]
			value="12978"
		[/random]
		[random]
			value="1100"
		[/random]
		[random]
			value="8192"
		[/random]
		[random]
			value="31117"
			[results]
				checksum="96Wmq3.,tb9Th9Xh+8Om3eb898egWbi26k39>2dlaZge0f-9iPif8c7h8k-+v7e7e8fh19<i8Sem73jI-oaGeRO,h>ybO20xxhh6<5-i30KE4<Yfd6-cbeOq5.ql>pFA"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="0"
			x="24"
			y="5"
		[/recruit]
		[random]
			value="4702"
		[/random]
		[random]
			value="14963"
		[/random]
		[random]
			value="20445"
		[/random]
		[random]
			value="15764"
		[/random]
		[random]
			value="9663"
		[/random]
		[random]
			value="26554"
		[/random]
		[random]
			value="18179"
		[/random]
		[random]
			value="15215"
		[/random]
		[random]
			value="24960"
		[/random]
		[random]
			value="30397"
		[/random]
		[random]
			value="11369"
		[/random]
		[random]
			value="18476"
		[/random]
		[random]
			value="10170"
		[/random]
		[random]
			value="29948"
		[/random]
		[random]
			value="31776"
			[results]
				checksum="F.luxQ8q-vqhspPuqvoeBIvxzyqxRKaVOEMsRHPLsxrnKSQUuPzuQTzBNpzqtPasFJDFNwNCmGSzKQuCLMCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFMypdZF<gxEJR6"
			[/results]
		[/random]
	[/command]
	[command]
		[recruit]
			value="4"
			x="20"
			y="5"
		[/recruit]
		[random]
			value="15755"
		[/random]
		[random]
			value="11794"
		[/random]
		[random]
			value="24366"
		[/random]
		[random]
			value="29748"
		[/random]
		[random]
			value="27327"
		[/random]
		[random]
			value="6714"
		[/random]
		[random]
			value="30374"
		[/random]
		[random]
			value="29753"
		[/random]
		[random]
			value="2222"
		[/random]
		[random]
			value="4785"
		[/random]
		[random]
			value="4528"
		[/random]
		[random]
			value="9229"
		[/random]
		[random]
			value="19348"
		[/random]
		[random]
			value="21272"
		[/random]
		[random]
			value="13430"
			[results]
				checksum="uyqOVzDO<ExdHrVAAKrGB6qDQPwqLuEDUSNIMADRBGxxpOFSryqC1rOBpDQNRqrWuTuTxCUFLDPxfDLuyOdqNHp2JuaZMrXGikJwc0bkdib+c.P93obZj,mcoe3b,IXl"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="what did I wrong last time? did the ulfserker had serious impact on game?"
			side="2"
		[/speak]
	[/command]
	[command]
		[recruit]
			value="5"
			x="21"
			y="5"
		[/recruit]
		[random]
			value="1543"
		[/random]
		[random]
			value="19844"
		[/random]
		[random]
			value="27876"
		[/random]
		[random]
			value="688"
		[/random]
		[random]
			value="9526"
		[/random]
		[random]
			value="4819"
		[/random]
		[random]
			value="1955"
		[/random]
		[random]
			value="30893"
		[/random]
		[random]
			value="24016"
		[/random]
		[random]
			value="20880"
		[/random]
		[random]
			value="26885"
		[/random]
		[random]
			value="30200"
		[/random]
		[random]
			value="4820"
		[/random]
		[random]
			value="30738"
		[/random]
		[random]
			value="16406"
			[results]
				checksum="8ax-d6b6wp8sjgga3aP72g3e+iBm.jefmffY-+6<ip3<5-4egW6m2lahna90i9fl5a1hh7oj8-<F-8mkj.91>I6ygXo9WjoolcACZdd9b,<-lvi-OF>N69sv8joLJwIp"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="22,21,20,19,18,17"
			y="5,5,5,6,6,7"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="330000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="wargreymon has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="4"
			x="4"
			y="23"
		[/recruit]
		[random]
			value="14282"
		[/random]
		[random]
			value="16166"
		[/random]
		[random]
			value="29160"
		[/random]
		[random]
			value="22991"
		[/random]
		[random]
			value="20871"
		[/random]
		[random]
			value="3141"
		[/random]
		[random]
			value="9675"
		[/random]
		[random]
			value="11687"
		[/random]
		[random]
			value="17337"
		[/random]
		[random]
			value="14274"
		[/random]
		[random]
			value="15196"
		[/random]
		[random]
			value="18973"
		[/random]
		[random]
			value="26403"
		[/random]
		[random]
			value="12900"
		[/random]
		[random]
			value="12057"
			[results]
				checksum="FIxBwyUzhyBkwVHKQOq5AMPytSNtRJzMRsDuHBtnQvBFyQAVsL8qJTmQQNRqrWuTuTxCUEQDPxfDLuyOdqNHp2JuaZMrXGikJwc0bkdib+c.P93obZj,mcpd3b,IXl32"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="4"
			x="8"
			y="24"
		[/recruit]
		[random]
			value="26061"
		[/random]
		[random]
			value="22717"
		[/random]
		[random]
			value="14889"
		[/random]
		[random]
			value="16990"
		[/random]
		[random]
			value="21187"
		[/random]
		[random]
			value="23350"
		[/random]
		[random]
			value="14060"
		[/random]
		[random]
			value="7880"
		[/random]
		[random]
			value="10156"
		[/random]
		[random]
			value="30537"
		[/random]
		[random]
			value="1668"
		[/random]
		[random]
			value="26576"
		[/random]
		[random]
			value="15202"
		[/random]
		[random]
			value="11517"
		[/random]
		[random]
			value="23336"
			[results]
				checksum="uyqNVzDO<ExdHrVAAKrGB6qDQPwqLuEDUSNIMADRBGxxpOFSryqC1rOBpDQNRqrWuTuTxCUFNDPxfDLuyOdqNHp2JuaZJrXGikJwc0bkdib+c.P93obZj,mcog3b,IXl"
			[/results]
		[/random]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="think so because he is no save unit and 19 gold...."
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Killer_Bunny has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="he he made kill"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lunar2 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="what u mean?"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="fobnation has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="he killed the thief. and then the berserker was attacked by bandit and brought him to 1 hp. unfortunately he couldnt be then killed, and levelled up after 7 hits :)"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="7"
			x="4"
			y="24"
		[/recruit]
		[random]
			value="7501"
		[/random]
		[random]
			value="20090"
		[/random]
		[random]
			value="29114"
		[/random]
		[random]
			value="2259"
		[/random]
		[random]
			value="4461"
		[/random]
		[random]
			value="23714"
		[/random]
		[random]
			value="8168"
		[/random]
		[random]
			value="11164"
		[/random]
		[random]
			value="31582"
		[/random]
		[random]
			value="6446"
		[/random]
		[random]
			value="10087"
		[/random]
		[random]
			value="22765"
		[/random]
		[random]
			value="13885"
		[/random]
		[random]
			value="30034"
		[/random]
		[random]
			value="27890"
			[results]
				checksum="c4ibeoBjPXdN9277b82>Vg,h+ld6d5,0c<W-1<71YYc5-d+8873Gj8ibkh8k-+v7e7e8fh1l<i8Sem73jI-oaGeRO,h0ybO20xxhh6<5-i30KE4<Yfd6-cbeCq5.ql>p"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="4"
			y="25"
		[/recruit]
		[random]
			value="27920"
		[/random]
		[random]
			value="7512"
		[/random]
		[random]
			value="11254"
		[/random]
		[random]
			value="424"
		[/random]
		[random]
			value="7203"
		[/random]
		[random]
			value="22895"
		[/random]
		[random]
			value="7428"
		[/random]
		[random]
			value="15047"
		[/random]
		[random]
			value="22314"
		[/random]
		[random]
			value="21363"
		[/random]
		[random]
			value="4847"
		[/random]
		[random]
			value="32096"
		[/random]
		[random]
			value="12686"
		[/random]
		[random]
			value="12280"
		[/random]
		[random]
			value="17293"
			[results]
				checksum="8ax-d6b6wp8sjgga3aP72g3e+iBm.jefmffY-+6<ip3<5-4egW6m2lahna90i9fl5a1hh7oj8-<F-,mkj.91>I6ygXo9WjoolcACZdd9b,<-lvi-OF>M69sv8joLJwUp"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="7,8,9,10,11,12"
			y="25,24,24,24,24,24"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="200000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Forest has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="yeah but if ulf kill bandit tthan i could kill ulf and lvl up"
			side="1"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,20,19,18,17,16,15,14,13"
			y="5,4,5,5,6,6,6,5,6"
		[/move]
	[/command]
	[command]
		[move]
			x="17,16,15,14,13,12"
			y="7,7,8,8,9,9"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="with what unit?"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="23,22,22,21,21,21,20"
			y="5,5,6,7,8,9,9"
		[/move]
	[/command]
	[command]
		[move]
			x="24,23,22,21,21"
			y="5,6,6,7,8"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="NarajinX has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="22,21,21,21,21"
			y="6,7,8,9,10"
		[/move]
	[/command]
	[command]
		[move]
			x="23,22,21,20,20,20,20"
			y="6,6,7,7,8,9,10"
		[/move]
	[/command]
	[command]
		[move]
			x="20,20,20,20,20,20,20"
			y="5,6,7,8,9,10,11"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="330000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ghost has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,5,5,5,5,5,5,5"
			y="23,23,22,21,20,19,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,5,5,5,5,6"
			y="25,25,24,23,22,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,4,5,5,5,5,6"
			y="24,23,23,22,21,20,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="8,9,10,10,11,11"
			y="24,24,23,22,22,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="12,13,14,15"
			y="24,24,23,23"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="think there where a nother to ""eat""him, later lvl up"
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="i mean that ulf bring 8 points for level up"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="5"
			x="16"
			y="22"
		[/recruit]
		[random]
			value="10591"
		[/random]
		[random]
			value="28438"
		[/random]
		[random]
			value="30536"
		[/random]
		[random]
			value="8283"
		[/random]
		[random]
			value="14103"
		[/random]
		[random]
			value="30772"
		[/random]
		[random]
			value="13147"
		[/random]
		[random]
			value="6942"
		[/random]
		[random]
			value="6687"
		[/random]
		[random]
			value="13425"
		[/random]
		[random]
			value="12523"
		[/random]
		[random]
			value="25824"
		[/random]
		[random]
			value="27080"
		[/random]
		[random]
			value="25063"
		[/random]
		[random]
			value="26998"
			[results]
				checksum="8ax-d6b6xp8sjgga3aP72g3e+iBm.jefmffY-+6<ip3<5-4egW6m2lahna90i9fl5a1hh7oj8-<F-+mkj.91>I6ygXo9WjoolcACZdd9b,<-lvi1OF>N69sv8joLJwSp"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="245000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[move]
			x="13,12,11,10,9,8"
			y="6,5,6,5,6,5"
		[/move]
	[/command]
	[command]
		[move]
			x="12,11,10,9,8"
			y="9,10,9,9,8"
		[/move]
	[/command]
	[command]
		[move]
			x="21,21,21,21,21"
			y="8,9,10,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="20,19,18,17,16"
			y="9,10,10,11,10"
		[/move]
	[/command]
	[command]
		[move]
			x="21,20,20,20,20"
			y="10,10,11,12,13"
		[/move]
	[/command]
	[command]
		[move]
			x="20,20,20,20,21,21,21,22"
			y="10,11,12,13,14,15,16,16"
		[/move]
	[/command]
	[command]
		[move]
			x="20,20,19,19,18"
			y="11,12,13,14,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="you can kill any my unit after losing two, and attacking with third"
			side="2"
		[/speak]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="330000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[move]
			x="16,17,18,19,20"
			y="22,23,23,24,24"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,5,4,3,2,1"
			y="21,21,20,20,19,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="undeadbean has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20"
			y="24,23"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="5,6,6"
			y="17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,6"
			y="15,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,7"
			y="14,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="7,8,8"
			y="14,13,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="bluey has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="8,9,10"
			y="12,12,11"
		[/move]
	[/command]
	[command]
		undo="no"
		[label]
			colour="107,140,255,0"
			team_name="north"
			text="thx for 8 points"
			visible_in_fog="yes"
			x="10"
			y="11"
		[/label]
	[/command]
	[command]
		sent="yes"
		[move]
			x="1,2,3,4"
			y="19,18,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="7"
			x="15"
			y="21"
		[/recruit]
		[random]
			value="32179"
		[/random]
		[random]
			value="17246"
		[/random]
		[random]
			value="19161"
		[/random]
		[random]
			value="10216"
		[/random]
		[random]
			value="32615"
		[/random]
		[random]
			value="4431"
		[/random]
		[random]
			value="9498"
		[/random]
		[random]
			value="5414"
		[/random]
		[random]
			value="27371"
		[/random]
		[random]
			value="16204"
		[/random]
		[random]
			value="10956"
		[/random]
		[random]
			value="12625"
		[/random]
		[random]
			value="31204"
		[/random]
		[random]
			value="9776"
		[/random]
		[random]
			value="32752"
			[results]
				checksum="c4ibeoBjPXdN9277b82>Vg,h+ld6d5,0c<W-1<71YYc5-d+8873Gj8ibkh8k-+v7e7e8fh19<i8Sem73jI-oaGeRO,h>ybO20xxhh6<5-i30KE4<Yfd6-cbeOq5.ql>p"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="nimzilla has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="denny_crane has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="6,6,6,6,6,7"
			y="19,18,17,16,15,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="11,11,12,12,11,10,9"
			y="21,20,19,18,18,17,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,16,17,17"
			y="23,22,22,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="244000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[move]
			x="8,8"
			y="5,6"
		[/move]
	[/command]
	[command]
		[move]
			x="8,8,9,9"
			y="6,7,8,9"
		[/move]
	[/command]
	[command]
		[move]
			x="9,9,9"
			y="9,10,11"
		[/move]
	[/command]
	[command]
		[move]
			x="8,9,10,11,12"
			y="8,9,9,10,9"
		[/move]
	[/command]
	[command]
		[move]
			x="16,15,14,13,12,11"
			y="10,11,10,11,11,12"
		[/move]
	[/command]
	[command]
		[move]
			x="18,17,16,15,14,13,12"
			y="14,15,14,14,14,14,13"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="12"
			y="11"
		[/recruit]
		[random]
			value="12173"
		[/random]
		[random]
			value="1869"
		[/random]
		[random]
			value="20566"
		[/random]
		[random]
			value="2639"
		[/random]
		[random]
			value="19284"
		[/random]
		[random]
			value="28904"
		[/random]
		[random]
			value="26097"
		[/random]
		[random]
			value="13946"
		[/random]
		[random]
			value="21280"
		[/random]
		[random]
			value="15072"
		[/random]
		[random]
			value="20795"
		[/random]
		[random]
			value="20811"
		[/random]
		[random]
			value="17381"
		[/random]
		[random]
			value="7971"
		[/random]
		[random]
			value="4599"
			[results]
				checksum="F<huxQ8q-vqhtpPuqvoeBIvxzyqxRKaVOEMsRHPLsxrnKSQUuPzuQTzBNpzqtPasFJDFNwNCmGSzKQuCQQCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFMypdZF<grEJR6"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="20,20,20,20,19"
			y="13,14,15,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Hypnotoad has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="21,20,20,20,20"
			y="12,12,13,14,15"
		[/move]
	[/command]
	[command]
		[move]
			x="22,21"
			y="16,17"
		[/move]
	[/command]
	[command]
		[move]
			x="21,21,20"
			y="17,18,18"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="SaZkE04 has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="20,21,22"
			y="18,18,17"
		[/move]
	[/command]
	[command]
		undo="no"
		[clear_labels]
			team_name="north"
		[/clear_labels]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="11"
				y="12"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="9761"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="12894"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="24840"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="13647"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="833"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="328000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="10"
				y="11"
			[/source]
			[destination]
				x="11"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="21809"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="12651"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20,20,20,19,19,18"
			y="23,24,25,26,27,28,28"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="mahil has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="17,17,16,15"
			y="21,22,22,23"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="4,4,4,4,4,4,4,4,3"
			y="17,16,15,14,13,12,11,10,10"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,15,14"
			y="21,20,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="7"
			x="15"
			y="21"
		[/recruit]
		[random]
			value="16406"
		[/random]
		[random]
			value="4499"
		[/random]
		[random]
			value="24251"
		[/random]
		[random]
			value="13530"
		[/random]
		[random]
			value="12905"
		[/random]
		[random]
			value="20454"
		[/random]
		[random]
			value="13090"
		[/random]
		[random]
			value="7109"
		[/random]
		[random]
			value="6788"
		[/random]
		[random]
			value="25920"
		[/random]
		[random]
			value="7506"
		[/random]
		[random]
			value="9410"
		[/random]
		[random]
			value="22064"
		[/random]
		[random]
			value="9882"
		[/random]
		[random]
			value="4971"
			[results]
				checksum="96Wmq3.,tb9Th9Xh+8Om3eb898egWbi26k39>2dlaZge0f-9iPif8c7h8k-+v7e7e8fh19<i8Sem73jI-oaGeRO,h>ybO20xxhh6<5-i30KE4<Yfd6-cbeOq5.ql>pFA"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="7"
			x="15"
			y="22"
		[/recruit]
		[random]
			value="7940"
		[/random]
		[random]
			value="30011"
		[/random]
		[random]
			value="3206"
		[/random]
		[random]
			value="21251"
		[/random]
		[random]
			value="3043"
		[/random]
		[random]
			value="26605"
		[/random]
		[random]
			value="31936"
		[/random]
		[random]
			value="19619"
		[/random]
		[random]
			value="22096"
		[/random]
		[random]
			value="8186"
		[/random]
		[random]
			value="22233"
		[/random]
		[random]
			value="24280"
		[/random]
		[random]
			value="18554"
		[/random]
		[random]
			value="12390"
		[/random]
		[random]
			value="19735"
			[results]
				checksum="86Wmq3.,tb9Th9Xh+8Om3eb898egWbi26k39>2dlaZge0f-9iPif8c7h8k-+v7e7e8fh1b<i8Sem73jI-oaGeRO,h0ybO20xxhh6<5-i30KE4<Yfd6-cbeMq5.ql>pFA"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="7,6,6,5"
			y="15,15,16,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="166000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		[recruit]
			value="0"
			x="11"
			y="10"
		[/recruit]
		[random]
			value="27182"
		[/random]
		[random]
			value="13824"
		[/random]
		[random]
			value="2822"
		[/random]
		[random]
			value="7730"
		[/random]
		[random]
			value="15075"
		[/random]
		[random]
			value="31588"
		[/random]
		[random]
			value="27289"
		[/random]
		[random]
			value="28030"
		[/random]
		[random]
			value="2864"
		[/random]
		[random]
			value="14120"
		[/random]
		[random]
			value="31619"
		[/random]
		[random]
			value="3931"
		[/random]
		[random]
			value="17420"
		[/random]
		[random]
			value="23681"
		[/random]
		[random]
			value="6650"
			[results]
				checksum="F.ouxQ8q-vqhtpPuqvoeBIvxzyqxRKaVOEMsRHPLsxrnKSQUuPzuQTzBNpzqtPasFJDFNwNCmGSzKQuCLJCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFMypdZF<grEJR6"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,11,10"
			y="9,10,10"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="10"
				y="10"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="15663"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="14755"
			[results]
				chance="70"
				damage="5"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="9477"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,12,11,10,9,9"
			y="11,12,13,13,13,12"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="9"
				y="12"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="8823"
			[results]
				chance="30"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="24659"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="28596"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="4448"
			[results]
				chance="70"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="23738"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="9"
				y="11"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="28919"
			[results]
				chance="30"
				damage="16"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="15082"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="32249"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="16508"
			[results]
				chance="50"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="is bandits and thiefs rush good against any race?"
			side="2"
		[/speak]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="11"
				y="12"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="22947"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="7933"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="22171"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="24734"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="10424"
			[results]
				chance="30"
				damage="16"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="probably not undead"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Kheno has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="20,21,22"
			y="15,16,16"
		[/move]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="330000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lobezno has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,18,18,19,19,20"
			y="28,27,26,25,25,24,23"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20,19,18"
			y="23,22,22,21"
		[/move]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="rush mean more gold?"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="yzr has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Deliverator has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="rush mean building a lot of thiefs and bandits and attacking early"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Mordrek has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="bera has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="shinjak has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Zach has logged into the lobby"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="think is ok "
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="slotUSB has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="pkz has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,16,17,18,19,20,21"
			y="22,22,22,21,21,21,21"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,16,17,18,19,20"
			y="21,20,21,20,20,20"
		[/move]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="7"
			x="15"
			y="21"
		[/recruit]
		[random]
			value="22375"
		[/random]
		[random]
			value="13724"
		[/random]
		[random]
			value="16036"
		[/random]
		[random]
			value="21319"
		[/random]
		[random]
			value="30235"
		[/random]
		[random]
			value="23446"
		[/random]
		[random]
			value="12469"
		[/random]
		[random]
			value="4692"
		[/random]
		[random]
			value="13678"
		[/random]
		[random]
			value="29549"
		[/random]
		[random]
			value="1527"
		[/random]
		[random]
			value="24949"
		[/random]
		[random]
			value="27541"
		[/random]
		[random]
			value="13720"
		[/random]
		[random]
			value="9177"
			[results]
				checksum="c4jbeoBjPXdN9277b82>Vg,h+ld6d5,0c<W-1<71YYc5-d+8873Gj8ibkh8k-+v7e7e8fh18<i8Sem73jI-oaGeRO,h>ybO20xxhh6<5,n30KE4<Yfd6-cbePq5.ql>p"
			[/results]
		[/random]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="if enemy bad poisoned is good, you take position and houses and bamdits hard to kill, you see"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="14,15,16,17,18"
			y="19,19,18,19,19"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="3,3,3,4,5,5,6,6,7"
			y="10,9,8,7,7,6,5,4,4"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="133000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Data has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="9,9,9,9,9,9,8"
			y="11,10,9,8,7,6,5"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="ocel has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="11,10"
			y="12,11"
		[/move]
	[/command]
	[command]
		[move]
			x="9,9,8,8,8"
			y="12,11,10,9,8"
		[/move]
	[/command]
	[command]
		[move]
			x="10,11,12"
			y="10,10,9"
		[/move]
	[/command]
	[command]
		[move]
			x="12,13,14,15,16,17,18"
			y="13,14,14,14,14,15,14"
		[/move]
	[/command]
	[command]
		[move]
			x="11,12,12,12,12"
			y="10,10,11,12,13"
		[/move]
	[/command]
	[command]
		[recruit]
			value="7"
			x="12"
			y="11"
		[/recruit]
		[random]
			value="2091"
		[/random]
		[random]
			value="30182"
		[/random]
		[random]
			value="21422"
		[/random]
		[random]
			value="26972"
		[/random]
		[random]
			value="28526"
		[/random]
		[random]
			value="19290"
		[/random]
		[random]
			value="25313"
		[/random]
		[random]
			value="31067"
		[/random]
		[random]
			value="16880"
		[/random]
		[random]
			value="6809"
		[/random]
		[random]
			value="13847"
		[/random]
		[random]
			value="32031"
		[/random]
		[random]
			value="32173"
		[/random]
		[random]
			value="21629"
		[/random]
		[random]
			value="31313"
			[results]
				checksum="c4jbeoBjPXdN9277b82>Vg,h+ld6d5,0c<W-1<71YYc5-d+8873Gj8ibkh8k-+v7e7e8fh1k<i8Sem73jI-oaGeRO,h0ybO20xxhh6<5,n30KE4<Yfd6-cbeDq5.ql>p"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Bobbertface has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Gulinburusti has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="19,19,20"
			y="17,16,15"
		[/move]
	[/command]
	[command]
		[move]
			x="22,23,24"
			y="17,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="."
			side="2"
		[/speak]
	[/command]
	[command]
		[countdown_update]
			team="1"
			value="313000"
		[/countdown_update]
	[/command]
	[command]
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="."
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Outlaw has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="hates_nubs has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Outlaw has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="9,9,8,8,8,8,8,9"
			y="18,17,16,15,14,13,12,12"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="9"
				y="12"
			[/source]
			[destination]
				x="10"
				y="11"
			[/destination]
		[/attack]
		[random]
			value="5777"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="18447"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Maggotman has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="7,8,9,10,11,12,13"
			y="4,3,4,4,5,5,6"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="daskar has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Patches has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,18,18,18,18,17,16,16,17"
			y="21,20,19,18,17,16,16,15,14,14"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="17"
				y="14"
			[/source]
			[destination]
				x="18"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="17506"
			[results]
				chance="30"
				damage="16"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="14141"
			[results]
				chance="50"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="3330"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="24865"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="15,15,15,15,16,17,17,17"
			y="21,20,19,18,17,17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="17"
				y="15"
			[/source]
			[destination]
				x="18"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="21733"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="14627"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="21932"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="18853"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="15914"
			[results]
				chance="30"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="18,18,18,18,18"
			y="19,18,17,16,15"
		[/move]
	[/command]
	[command]
		sent="yes"
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="18"
				y="15"
			[/source]
			[destination]
				x="18"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="11155"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="14887"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="9821"
			[results]
				chance="30"
				damage="8"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="30711"
			[results]
				chance="40"
				damage="9"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="9385"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="MarthaStewart has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[recruit]
			value="2"
			x="15"
			y="21"
		[/recruit]
		[random]
			value="19019"
		[/random]
		[random]
			value="9992"
		[/random]
		[random]
			value="9621"
		[/random]
		[random]
			value="8272"
		[/random]
		[random]
			value="28399"
		[/random]
		[random]
			value="8398"
		[/random]
		[random]
			value="25450"
		[/random]
		[random]
			value="16032"
		[/random]
		[random]
			value="205"
		[/random]
		[random]
			value="18438"
		[/random]
		[random]
			value="28047"
		[/random]
		[random]
			value="24071"
		[/random]
		[random]
			value="12634"
		[/random]
		[random]
			value="12637"
		[/random]
		[random]
			value="19154"
			[results]
				checksum="<0CL,4MA07qnKSwEonI1LxtPCvyvIJCEpbxFsqwtpJJCxrnKSQUuOzuQTzBNpzqtPasFJDFNwNCmGSzKQuCQRCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFTypdZF<gID"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[move]
			x="20,20,20,20,19"
			y="20,19,18,17,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[move]
			x="21,21,20,19,19,18"
			y="21,20,19,19,18,17"
		[/move]
	[/command]
	[command]
		sent="yes"
		[countdown_update]
			team="2"
			value="154000"
		[/countdown_update]
	[/command]
	[command]
		sent="yes"
		[end_turn]
		[/end_turn]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="I wanted to kill your advancing thief. Was that good move?"
			side="2"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="and your misstake is that you attack, who attack loose i sayed some years before i play ladder...."
			side="1"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="if he where dead is ok, now not"
			side="1"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Straw has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,12"
			y="11,12"
		[/move]
	[/command]
	[command]
		[recruit]
			value="0"
			x="12"
			y="11"
		[/recruit]
		[random]
			value="29885"
		[/random]
		[random]
			value="30182"
		[/random]
		[random]
			value="8460"
		[/random]
		[random]
			value="15782"
		[/random]
		[random]
			value="20455"
		[/random]
		[random]
			value="23141"
		[/random]
		[random]
			value="19160"
		[/random]
		[random]
			value="3753"
		[/random]
		[random]
			value="29927"
		[/random]
		[random]
			value="6539"
		[/random]
		[random]
			value="8244"
		[/random]
		[random]
			value="32366"
		[/random]
		[random]
			value="23887"
		[/random]
		[random]
			value="9077"
		[/random]
		[random]
			value="31321"
			[results]
				checksum="F<juxQ8q-vqhtpPuqvoeBIvxzyqxRKaVOEMsRHPLsxrnKSQUuPzuQTzBNpzqtPasFJDFNwNCmGSzKQuCQKCMwz5BGNz0sHXttHryoCqiuuzfBrmxtBFSypdZF<grEJR6"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,11,10,9"
			y="9,10,10,11"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="1"
			weapon="1"
			[source]
				x="9"
				y="11"
			[/source]
			[destination]
				x="9"
				y="12"
			[/destination]
		[/attack]
		[random]
			value="20827"
			[results]
				chance="40"
				damage="34"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="diario has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,9,10,11,12,12"
			y="8,9,8,8,7,6"
		[/move]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="locastor has logged into the lobby"
		[/speak]
	[/command]
	[command]
		[move]
			x="8,9,10,11,12,13,14,14"
			y="5,5,5,5,4,4,4,5"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="12"
				y="6"
			[/source]
			[destination]
				x="13"
				y="6"
			[/destination]
		[/attack]
		[random]
			value="18339"
			[results]
				chance="50"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="20568"
			[results]
				chance="70"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="12349"
			[results]
				chance="50"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="25490"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="25252"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="14"
				y="5"
			[/source]
			[destination]
				x="13"
				y="6"
			[/destination]
		[/attack]
		[random]
			value="13484"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="25265"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="19418"
			[results]
				chance="50"
				damage="12"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="8065"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		[move]
			x="12,13,13,14,15,16"
			y="12,13,14,14,15,15"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="16"
				y="15"
			[/source]
			[destination]
				x="17"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="12613"
			[results]
				chance="40"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="7801"
			[results]
				chance="40"
				damage="6"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="16700"
			[results]
				chance="40"
				damage="10"
				dies="yes"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Maggotman has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="ok, i dont want to play"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="12,13,14,15,16,17"
			y="13,13,12,12,12,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="17"
				y="13"
			[/source]
			[destination]
				x="17"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="11452"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="10259"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="5144"
			[results]
				chance="50"
				damage="7"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="863"
			[results]
				chance="30"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="8972"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="i am tired"
			side="2"
		[/speak]
	[/command]
	[command]
		[move]
			x="20,20,19,18"
			y="15,14,14,13"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="-1"
			weapon="1"
			[source]
				x="18"
				y="13"
			[/source]
			[destination]
				x="17"
				y="14"
			[/destination]
		[/attack]
		[random]
			value="23053"
			[results]
				chance="50"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="you win"
			side="2"
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Patches has logged into the lobby"
		[/speak]
	[/command]
	[command]
		sent="yes"
		undo="no"
		[speak]
			id="konflikt_86pl"
			message="see you next time"
			side="2"
		[/speak]
	[/command]
	[command]
		undo="no"
		[speak]
			id="Lord"
			message="ggcya"
			side="1"
		[/speak]
	[/command]
	[command]
		[move]
			x="22,21,20,19"
			y="16,16,15,16"
		[/move]
	[/command]
	[command]
		[attack]
			defender_weapon="0"
			weapon="0"
			[source]
				x="19"
				y="16"
			[/source]
			[destination]
				x="18"
				y="15"
			[/destination]
		[/attack]
		[random]
			value="27729"
			[results]
				chance="40"
				damage="10"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="12611"
			[results]
				chance="70"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
		[random]
			value="25998"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="20479"
			[results]
				chance="70"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="12545"
			[results]
				chance="40"
				damage="0"
				dies="no"
				hits="no"
			[/results]
		[/random]
		[random]
			value="20939"
			[results]
				chance="70"
				damage="4"
				dies="no"
				hits="yes"
			[/results]
		[/random]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="konflikt_86pl has left the game."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Lord takes control of side 2."
		[/speak]
	[/command]
	[command]
		sent="yes"
		[speak]
			id="server"
			message="Caphriel has logged into the lobby"
		[/speak]
	[/command]
[/replay]
[snapshot]
	campaign_type="multiplayer"
	completion="running"
	current_tod="0"
#textdomain wesnoth-multiplayer
	description=_ "Players must navigate the dispersive terrain of this small but topographically dense island."
	difficulty="NORMAL"
	end_text_duration="0"
	experience_modifier="70"
	hash="24u7p+9>B6j3mmdFFjtQetmyhsjDsvjdGoc9moJJdCnbgH-k0RT,O.<DG03847ComZqcODnz+m379P+k2ibc2A>myx3EZ.9k5hdhQci>pkFHts,>fJCn>sZ2tRevrdQy"
	id="multiplayer_Hornshark_Island"
	label="2S – Die Insel der Stachelhaie"
	map_data="border_size=1
usage=map

Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Ww          , Hh          , Gs^Ft       , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Ww          , Gs^Ft       , Hh          , Ds          , Gs^Fms      , Gs^Fp       , Ww          , Wo          , Wo          , Wo          , Wo          , Ww          , Wo          , Ww          , Ww          , Ww          , Wo          , Ww          , Wo          , Ww          , Ww          , Ds          , Ww          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Ww          , Gg          , Gg          , Ggf         , Gg          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Ww          , Ww          , Ww          , Ww          , Ww          , Ww          , Ds          , Ce          , Ds          , Ds          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Ww          , Ww          , Gg          , Wwf         , Ds          , Wwf         , Ww          , Ww^Vm       , Wo          , Ww          , Ww          , Gg          , Gg          , Gs^Fms      , Gg          , Gs^Ft       , Gg          , Gg          , Ww          , Ce          , Ce          , 1 Ke        , Ce          , Ce          , Ds          , Ww          , Ww          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Gg          , Wwf         , Gg^Fet      , Gg          , Gg          , Ww          , Ww          , Gg          , Gs^Ft       , Gg^Vc       , Ggf         , Gg          , Gg          , Gg          , Gg          , Ww^Bw/      , Ww          , Ww          , Ce          , Ce          , Ww          , Ds          , Ww          , Ww          , Wo          , Wo          
Wo          , Wo          , Ww          , Gg          , Gs^Ft       , Gg          , Hh          , Gs^Fp       , Gg          , Ww          , Gg          , Gg          , Hh          , Ss          , Gg          , Gs^Fp       , Gg          , Gg          , Ww          , Ww          , Gg          , Ww^Bw/      , Ww          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Gg          , Rd          , Gg^Vc       , Ww          , Wwf         , Mm          , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg          , Ww          , Gg          , Gg          , Gg          , Gg          , Ww          , Ww          , Wo          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Hh          , Ggf         , Gs^Ft       , Gg          , Gg          , Wwf         , Ke          , Wwf         , Gg          , Gg          , Ww          , Ww          , Hh          , Gs^Fms      , Ggf         , Gg          , Gs^Ft       , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Ss          , Hh          , Gs^Fms      , Ggf         , Ce          , Ce          , Wwf         , Wwf         , Ww          , Ww^Vm       , Ww          , Gg          , Gg          , Hh^Vc       , Hh          , Hh          , Gs^Ft       , Gg          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Gg          , Gs^Fp       , Mm          , Gg          , Ggf         , Ss^Vhs      , Ss          , Ce          , Hh          , Mm^Xm       , Wwf         , Wwf         , Gg          , Gs^Ft       , Gg          , Gg          , Gs^Fp       , Gg          , Gg^Fet      , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Gg          , Gg          , Gg          , Wwf         , Gg          , Rd          , Mm^Xm       , Rd          , Rd          , Mm^Xm       , Mm          , Hh          , Wwf         , Wwf         , Gg          , Gg          , Gg          , Gg          , Ww          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Gg          , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Gs^Fp       , Gg          , Gg^Ft       , Hh          , Rd          , Gg^Fet      , Wwf         , Mm^Xm       , Mm          , Gs^Fp       , Gg          , Gg          , Ww          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Gg          , Gg          , Gg          , Wwf         , Wwf         , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Gg          , Hh          , Ss^Vhs      , Rd          , Gs^Fms      , Gg          , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Gg^Ft       , Gg          , Gg          , Hh          , Gs^Fms      , Gg          , Gg          , Gg          , Wwf         , Wwf         , Gg          , Wwf         , Wwf         , Gg          , Wwf         , Rd          , Hh          , Gg          , Wwf         , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Gg^Fet      , Hh          , Gg          , Gg          , Gg          , Mm          , Mm^Xm       , Hh          , Wwf         , Gg          , Rd          , Hh          , Mm^Xm       , Wwf         , Gg          , Gg          , Gg          , Gg          , Gg^Vc       , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Gg          , Gg          , Gg^Vc       , Gg          , Gg          , Rd          , Gg          , Wwf         , Wwf         , Gg          , Gg          , Gg^Ft       , Rd          , Gg          , Wwf         , Hh          , Mm          , Gg          , Gs^Fp       , Hh          , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Wwf         , Gg          , Rd          , Rd          , Ss^Vhs      , Hh          , Wwf         , Wwf         , Ggf         , Gg          , Gg          , Gg          , Wwf         , Wwf         , Gg          , Wwf         , Ggf         , Gs^Fms      , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Gg          , Gs^Fms      , Hh          , Gs^Ft       , Mm^Xm       , Mm^Xm       , Wwf         , Gs^Fp       , Mm          , Gg          , Hh          , Gs^Fms      , Hh          , Wwf         , Gg          , Wwf         , Wwf         , Wwf         , Gg          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Gg          , Gg          , Gs^Ft       , Mm          , Hh          , Mm^Xm       , Wwf         , Wwf         , Ww          , Wwf         , Mm^Xm       , Gg          , Gg          , Mm^Xm       , Rd          , Gg          , Hh          , Gg          , Gs^Ft       , Gg          , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Gg          , Hh^Vc       , Hh          , Gg          , Wwf         , Ww          , Ww^Vm       , Wwf         , Wwf         , Hh          , Ce          , Ss          , Ss^Vhs      , Rd          , Gg          , Gg          , Hh          , Gg          , Gg          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Ww          , Gg          , Gg          , Gg          , Ww          , Ww          , Gg          , Gg          , Gg          , Wwf         , Gg          , Ce          , Ce          , Rd          , Mm^Xm       , Gs^Fp       , Gg          , Gg          , Ww          , Ww          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Ce          , Ww^Bw/      , Ww          , Ww          , Ww          , Gg^Ft       , Gg          , Gg          , Gs^Fms      , Wwf         , Wwf         , Ke          , Ggf         , Mm          , Mm          , Mm^Xm       , Gg^Vc       , Gg          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ds          , Ce          , Ww          , Ww          , Ww          , Ce          , Ww^Bw/      , Gg          , Hh          , Gg^Vc       , Gg          , Gg          , Wwf         , Wwf         , Gg^Fet      , Gg          , Hh          , Wwf         , Gg          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Ww          , Ww          , Ds          , Ce          , Ce          , Ce          , 2 Ke        , Ww          , Ww          , Ww          , Gg          , Ww          , Gg          , Ww          , Wwf         , Ww          , Wwf         , Wwf         , Gg          , Wwf         , Ds          , Gg^Ft       , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Ww          , Ww          , Ds          , Ds          , Ce          , Ds          , Ww          , Ww          , Ww          , Ww          , Ww          , Ww          , Ww          , Ww          , Ww          , Wo          , Ww          , Ww          , Wwf         , Gg          , Hh          , Gg^Fet      , Ww          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Ww          , Ww          , Ww          , Ds          , Ww          , Ww          , Wo          , Ww          , Wo          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Wwf         , Wwf         , Gg          , Gg          , Gg          , Ds          , Gs^Ft       , Gs^Fp       , Ww          , Ww          , Wo          , Wo          
Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww^Vm       , Gg          , Ds          , Ds          , Ww          , Gg          , Gg          , Hh          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Ww          , Ww          , Ww          , Ww          , Wo          , Ww          , Ww          , Ww          , Ww          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          , Wo          
"
	mp_countdown="yes"
	mp_countdown_action_bonus="13"
	mp_countdown_init_time="270"
	mp_countdown_reservoir_time="330"
	mp_countdown_turn_bonus="60"
	mp_fog="yes"
	mp_shroud="no"
	mp_use_map_settings="yes"
	mp_village_gold="2"
	name=_ "2p - Hornshark Island"
	next_underlying_unit_id="22"
#textdomain wesnoth
	objectives=_ "Victory:
@Defeat enemy leader(s)"
	observer="yes"
	playing_team="0"
	random_calls="0"
	random_seed="12595"
	random_start_time="no"
	snapshot="yes"
	turn_at="7"
	turns="-1"
	unit_wml_ids="Dwarvish Fighter,Dwarvish Steelclad,Dwarvish Thunderer,Dwarvish Thunderguard,Footpad,Gryphon Rider,Thief,era_events"
	version="1.6"
	[side]
		action_bonus_count="8"
		aggression="0.5"
		allow_player="yes"
		caution="0.25"
		colour="1"
		controller="human"
		countdown_time="186438"
		current_player="Lord"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
		gold="0"
		hidden="no"
		id="Lord1"
		income="0"
		leader_value="3"
		name="Lord"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives=_ "Victory:
@Defeat enemy leader(s)"
		objectives_changed="no"
		recruit="Dwarvish Fighter,Dwarvish Guardsman,Dwarvish Thunderer,Dwarvish Ulfserker,Footpad,Gryphon Rider,Poacher,Thief"
		recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
		save_id="Lord1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		start_gold="100"
		team_name="north"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^North"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[ai]
			recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
		[village]
			x="8"
			y="5"
		[/village]
		[village]
			x="8"
			y="8"
		[/village]
		[village]
			x="10"
			y="11"
		[/village]
		[village]
			x="16"
			y="10"
		[/village]
		[village]
			x="18"
			y="14"
		[/village]
		[village]
			x="20"
			y="10"
		[/village]
		[village]
			x="22"
			y="16"
		[/village]
		[unit]
			advances_to="Dwarvish Dragonguard"
			alignment="neutral"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="0"
			canrecruit="yes"
			colour="1"
			controller="human"
			cost="30"
			current_player="Lord"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			experience="9"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="37"
			id="Lord1"
			image="units/dwarves/thunderguard.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Thunderguard"
			leader="Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper"
			level="2"
			max_attacks="1"
			max_experience="67"
			max_hitpoints="42"
			max_moves="5"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			mp_countdown="yes"
			mp_countdown_action_bonus="13"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="330"
			mp_countdown_turn_bonus="60"
			name="Lord"
			profile="portraits/dwarves/thunderer.png"
			race="dwarf"
			random_leader="Dwarvish Steelclad,Dwarvish Thunderguard,Rogue,Trapper"
			random_traits="no"
			recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider"
			resting="yes"
			save_id="Lord1"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="1"
			team_name="north"
			terrain_liked="Hh, Ha, Mm"
			type="Dwarvish Thunderguard"
			undead_variation="dwarf"
			underlying_id="1"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			user_team_name="wesnoth-multiplayerteamname^North"
			village_gold="2"
			x="9"
			y="11"
			zoc="yes"
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="6"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="28"
				description=_ "thunderstick"
				icon="attacks/thunderstick.png"
				name="thunderstick"
				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]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dwarvish Thunderguard"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="17"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="36"
			id="Dwarvish Thunderer-3"
			image="units/dwarves/thunderer.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Thunderer"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="36"
			max_moves="4"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Aigdurithsol"
			profile="portraits/dwarves/thunderer.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dwarvish Thunderer"
			undead_variation="dwarf"
			underlying_id="3"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			x="18"
			y="13"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="thunderstick"
				[/filter_attack]
				[if]
					direction="s"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="0~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-s-1.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-s-2.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-s-3.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-s.png"
						sound="thunderstick.ogg"
					[/frame]
				[/if]
				[else]
					direction="s"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-s.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="ne,nw"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="20~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-ne-1.png"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-ne-2.png"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-ne-3.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-ne.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="ne,nw"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-ne.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="n"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="20~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-n-1.png"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-n-2.png"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-n-3.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-n.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="n"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-n.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="se,sw"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="0~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-se-1.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-se-2.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-se-3.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-se.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="se,sw"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-se.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="1"
					image="units/dwarves/thunderer-attack-se.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/dwarves/thunderer.png"
				[/frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/dwarves/thunderer-melee1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/dwarves/thunderer-melee2.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/dwarves/thunderer-melee2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="100"
					image="units/dwarves/thunderer-melee1.png"
				[/frame]
				[frame]
					begin="100"
					end="125"
					image="units/dwarves/thunderer.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="200"
					image="units/dwarves/thunderer-die1.png"
				[/frame]
				[frame]
					begin="200"
					end="400"
					image="units/dwarves/thunderer-die2.png"
				[/frame]
				[frame]
					begin="400"
					end="600"
					image="units/dwarves/thunderer-die3.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/dwarves/thunderer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/thunderer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/thunderer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/thunderer.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/dwarves/thunderer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-3.png"
				[/frame]
				[frame]
					duration="800"
					image="units/dwarves/thunderer-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="300"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="300"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/dwarves/thunderer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="6"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="18"
				description=_ "thunderstick"
				name="thunderstick"
				number="1"
				range="ranged"
				type="pierce"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					description=_ "Can rest while moving, takes a quarter less poison damage"
					female_name=_ "female^healthy"
					id="healthy"
					male_name=_ "healthy"
					name=_ "healthy"
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Outlaw"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="35"
			id="Footpad-4"
			image="units/human-outlaws/footpad+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Footpad"
			level="1"
			max_attacks="1"
			max_experience="20"
			max_hitpoints="35"
			max_moves="7"
			movement="7"
			movement_type="elusivefoot"
			moves="7"
			name="Syssacla"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Footpad"
			underlying_id="4"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="24"
			y="17"
			zoc="yes"
			[attack_anim]
				offset="0.0"
				[filter_attack]
					name="sling"
				[/filter_attack]
				[if]
					hits="yes"
					[sling_stone_frame]
						begin="-201"
						end="-200"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="-200"
						end="0"
						halo="projectiles/stone.png"
						halo_x="20~0"
						halo_y="-6~0"
						offset="0.0~1.0"
						y="0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="0"
						end="1"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[frame]
						begin="-400"
						end="-150"
						image="units/human-outlaws/footpad+female-attack1.png"
						sound="sling.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[sling_stone_frame]
						begin="-201"
						end="-200"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="-200"
						end="100"
						halo="projectiles/stone.png"
						halo_x="20~0"
						halo_y="-6~0"
						offset="0.0~1.5"
						y="0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="100"
						end="101"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[frame]
						begin="-400"
						end="-150"
						image="units/human-outlaws/footpad+female-attack1.png"
						sound="sling-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-150"
					end="50"
					image="units/human-outlaws/footpad+female-attack2.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="club"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/human-outlaws/footpad+female.png"
				[/frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-outlaws/footpad+female-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/footpad+female-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/footpad+female-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="200"
					image="units/human-outlaws/footpad+female-melee-3.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/human-outlaws/footpad+female-melee-4.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/human-outlaws/footpad+female.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/human-outlaws/footpad+female-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/human-outlaws/footpad+female-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/human-outlaws/footpad+female.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-outlaws/footpad+female-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/footpad+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/footpad+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "club"
				icon="attacks/club-small.png"
				name="club"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "sling"
				name="sling"
				number="2"
				range="ranged"
				type="impact"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="11"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="9"
			id="Thief-5"
			image="units/human-outlaws/thief.png"
#textdomain wesnoth-units
			language_name=_ "Thief"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="25"
			max_moves="6"
			movement="6"
			movement_type="elusivefoot"
			moves="6"
			name="Addyn"
			profile="portraits/humans/thief.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Thief"
			underlying_id="5"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="10"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-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-outlaws/thief.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-outlaws/thief-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/damage]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dwarvish Steelclad"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="16"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="36"
			id="Dwarvish Fighter-6"
			image="units/dwarves/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="29"
			max_hitpoints="44"
			max_moves="4"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Aigating"
			profile="portraits/dwarves/fighter.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dwarvish Fighter"
			undead_variation="dwarf"
			underlying_id="6"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="19"
			y="16"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="hammer"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/dwarves/fighter-hammer-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="mace.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/dwarves/fighter-hammer-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~-0.15:30,-0.15~0.1:60,0.1~0.5:190,0.5~0.6:30,0.6~0.6:40,0.6~0.15:150,0.15~0.0:40"
				start_time="-350"
				[filter_attack]
					name="axe"
				[/filter_attack]
				[frame]
					duration="40"
					image="units/dwarves/fighter-axe-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-2.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-4.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="axe.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-6.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-7.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-8.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-9.png"
				[/frame]
				[frame]
					duration="20"
					image="units/dwarves/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="axe"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="hammer"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-hammer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="8"
				description=_ "axe"
				name="axe"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="9"
				description=_ "hammer"
				icon="attacks/hammer-dwarven.png"
				name="hammer"
				number="2"
				range="melee"
				type="impact"
			[/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="Outlaw"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="14"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="12"
			id="Footpad-7"
			image="units/human-outlaws/footpad+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Footpad"
			level="1"
			max_attacks="1"
			max_experience="25"
			max_hitpoints="36"
			max_moves="7"
			movement="7"
			movement_type="elusivefoot"
			moves="7"
			name="Jirka"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Footpad"
			underlying_id="7"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="18"
			y="14"
			zoc="yes"
			[attack_anim]
				offset="0.0"
				[filter_attack]
					name="sling"
				[/filter_attack]
				[if]
					hits="yes"
					[sling_stone_frame]
						begin="-201"
						end="-200"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="-200"
						end="0"
						halo="projectiles/stone.png"
						halo_x="20~0"
						halo_y="-6~0"
						offset="0.0~1.0"
						y="0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="0"
						end="1"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[frame]
						begin="-400"
						end="-150"
						image="units/human-outlaws/footpad+female-attack1.png"
						sound="sling.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[sling_stone_frame]
						begin="-201"
						end="-200"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="-200"
						end="100"
						halo="projectiles/stone.png"
						halo_x="20~0"
						halo_y="-6~0"
						offset="0.0~1.5"
						y="0~-5,-5~-8,-8~-9,-9~-10,-10~-9,-9~-8,-8~-5,-5~0"
					[/sling_stone_frame]
					[sling_stone_frame]
						begin="100"
						end="101"
						image="misc/blank-hex.png"
					[/sling_stone_frame]
					[frame]
						begin="-400"
						end="-150"
						image="units/human-outlaws/footpad+female-attack1.png"
						sound="sling-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="-150"
					end="50"
					image="units/human-outlaws/footpad+female-attack2.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="club"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/human-outlaws/footpad+female.png"
				[/frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/human-outlaws/footpad+female-melee-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/footpad+female-melee-2.png"
						sound="staff.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/footpad+female-melee-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="200"
					image="units/human-outlaws/footpad+female-melee-3.png"
				[/frame]
				[frame]
					begin="200"
					end="300"
					image="units/human-outlaws/footpad+female-melee-4.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/human-outlaws/footpad+female.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/human-outlaws/footpad+female-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/human-outlaws/footpad+female-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/human-outlaws/footpad+female.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-outlaws/footpad+female-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/footpad+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/footpad+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/footpad+female-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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="6"
				description=_ "club"
				icon="attacks/club-small.png"
				name="club"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[attack]
				damage="5"
				description=_ "sling"
				name="sling"
				number="2"
				range="ranged"
				type="impact"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					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^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Gryphon Master"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="24"
			die_sound="gryphon-die-1.ogg,gryphon-die-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="sw"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="38"
			id="Gryphon Rider-8"
			image="units/dwarves/gryphon-rider.png"
#textdomain wesnoth-units
			language_name=_ "Gryphon Rider"
			level="1"
			max_attacks="1"
			max_experience="21"
			max_hitpoints="39"
			max_moves="8"
			movement="8"
			movement_type="fly"
			moves="0"
			name="Greaaaa"
			profile="portraits/dwarves/gryphon-rider.png"
			race="gryphon"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Gryphon Rider"
			undead_variation="gryphon"
			underlying_id="8"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="14"
			y="5"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="claws.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="200"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="gryphon-hit-1.ogg,gryphon-hit-2.ogg,gryphon-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/defend]
			[movement_anim]
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/movement_anim]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[standing_anim]
				layer="60"
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="50"
				cave="80"
				deep_water="50"
				flat="50"
				forest="50"
				frozen="50"
				fungus="70"
				hills="50"
				impassable="80"
				mountains="40"
				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="3"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="100"
				cold="100"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="12"
				description=_ "claws"
				icon="attacks/claws-animal.png"
				name="claws"
				number="2"
				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="Dwarvish Steelclad"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="16"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="26"
			id="Dwarvish Fighter-15"
			image="units/dwarves/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="29"
			max_hitpoints="38"
			max_moves="5"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Gomalus"
			profile="portraits/dwarves/fighter.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dwarvish Fighter"
			undead_variation="dwarf"
			underlying_id="15"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="12"
			y="6"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="hammer"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/dwarves/fighter-hammer-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="mace.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/dwarves/fighter-hammer-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~-0.15:30,-0.15~0.1:60,0.1~0.5:190,0.5~0.6:30,0.6~0.6:40,0.6~0.15:150,0.15~0.0:40"
				start_time="-350"
				[filter_attack]
					name="axe"
				[/filter_attack]
				[frame]
					duration="40"
					image="units/dwarves/fighter-axe-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-2.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-4.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="axe.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-6.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-7.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-8.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-9.png"
				[/frame]
				[frame]
					duration="20"
					image="units/dwarves/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="axe"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="hammer"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-hammer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="7"
				description=_ "axe"
				name="axe"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "hammer"
				icon="attacks/hammer-dwarven.png"
				name="hammer"
				number="2"
				range="melee"
				type="impact"
			[/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]
					description=_ "Can rest while moving, takes a quarter less poison damage"
					female_name=_ "female^healthy"
					id="healthy"
					male_name=_ "healthy"
					name=_ "healthy"
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dwarvish Steelclad"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="16"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="1"
			facing="s"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="41"
			id="Dwarvish Fighter-18"
			image="units/dwarves/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="29"
			max_hitpoints="41"
			max_moves="5"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Althaling"
			profile="portraits/dwarves/fighter.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Dwarvish Fighter"
			undead_variation="dwarf"
			underlying_id="18"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="17"
			y="13"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="hammer"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/dwarves/fighter-hammer-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="mace.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/dwarves/fighter-hammer-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~-0.15:30,-0.15~0.1:60,0.1~0.5:190,0.5~0.6:30,0.6~0.6:40,0.6~0.15:150,0.15~0.0:40"
				start_time="-350"
				[filter_attack]
					name="axe"
				[/filter_attack]
				[frame]
					duration="40"
					image="units/dwarves/fighter-axe-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-2.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-4.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="axe.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-6.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-7.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-8.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-9.png"
				[/frame]
				[frame]
					duration="20"
					image="units/dwarves/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="axe"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="hammer"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-hammer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="7"
				description=_ "axe"
				name="axe"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "hammer"
				icon="attacks/hammer-dwarven.png"
				name="hammer"
				number="2"
				range="melee"
				type="impact"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="0"
			cost="13"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="8"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="22"
			id="Thief-20"
			image="units/human-outlaws/thief+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Thief"
			level="1"
			max_attacks="1"
			max_experience="20"
			max_hitpoints="28"
			max_moves="7"
			movement="6"
			movement_type="elusivefoot"
			moves="0"
			name="Raedda"
			profile="portraits/humans/thief+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="1"
			type="Thief"
			underlying_id="20"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="16"
			y="15"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
					sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.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-outlaws/thief+female-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="4"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/damage]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^quick"
					id="quick"
					male_name=_ "quick"
					name=_ "female^quick"
					[effect]
						apply_to="movement"
						increase="1"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="-5%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Dwarvish Steelclad"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="16"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="ne"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="36"
			id="Dwarvish Fighter-22"
			image="units/dwarves/fighter.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Fighter"
			level="1"
			max_attacks="1"
			max_experience="23"
			max_hitpoints="36"
			max_moves="5"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Glaithis"
			profile="portraits/dwarves/fighter.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="1"
			type="Dwarvish Fighter"
			undead_variation="dwarf"
			underlying_id="22"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="12"
			y="11"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="hammer"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-150"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					begin="-150"
					end="-100"
					image="units/dwarves/fighter-hammer-1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="mace.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/fighter-hammer-2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="175"
					image="units/dwarves/fighter-hammer-3.png"
				[/frame]
				[frame]
					begin="175"
					end="200"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				offset="0.0~-0.15:30,-0.15~0.1:60,0.1~0.5:190,0.5~0.6:30,0.6~0.6:40,0.6~0.15:150,0.15~0.0:40"
				start_time="-350"
				[filter_attack]
					name="axe"
				[/filter_attack]
				[frame]
					duration="40"
					image="units/dwarves/fighter-axe-1.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-2.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-3.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-4.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="axe.ogg"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						duration="60"
						image="units/dwarves/fighter-axe-5.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-6.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-7.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-8.png"
				[/frame]
				[frame]
					duration="60"
					image="units/dwarves/fighter-axe-9.png"
				[/frame]
				[frame]
					duration="20"
					image="units/dwarves/fighter.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="axe"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-2.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-2.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_second_attack]
					name="hammer"
				[/filter_second_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-hammer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-hammer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter-hammer.png"
				[/frame]
			[/defend]
			[defend]
				start_time="-126"
				[filter_attack]
					range="ranged"
				[/filter_attack]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/fighter-defend-1.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/fighter-defend-1.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/fighter.png"
				[/frame]
			[/defend]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="7"
				description=_ "axe"
				name="axe"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="8"
				description=_ "hammer"
				icon="attacks/hammer-dwarven.png"
				name="hammer"
				number="2"
				range="melee"
				type="impact"
			[/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^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]
	[/side]
	[side]
		action_bonus_count="10"
		aggression="0.5"
		allow_player="yes"
		caution="0.25"
		colour="2"
		controller="human"
		countdown_time="154000"
		current_player="human2"
		disallow_observers="no"
		fog="yes"
		global_recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
		gold="8"
		hidden="no"
		id="konflikt_86pl2"
		income="0"
		leader_value="3"
		name="konflikt_86pl"
		no_leader="yes"
		number_of_possible_recruits_to_force_recruit="3.1"
		objectives=_ "Victory:
@Defeat enemy leader(s)"
		objectives_changed="yes"
		recruit="Dwarvish Fighter,Dwarvish Guardsman,Dwarvish Thunderer,Dwarvish Ulfserker,Footpad,Gryphon Rider,Poacher,Thief"
		recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
		save_id="konflikt_86pl2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		start_gold="100"
		team_name="south"
#textdomain wesnoth-multiplayer
		user_team_name=_ "teamname^South"
		village_gold="2"
		village_value="1"
		villages_per_scout="8"
		[ai]
			recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
		[village]
			x="5"
			y="17"
		[/village]
		[village]
			x="6"
			y="21"
		[/village]
		[village]
			x="9"
			y="18"
		[/village]
		[village]
			x="11"
			y="21"
		[/village]
		[village]
			x="12"
			y="24"
		[/village]
		[village]
			x="13"
			y="6"
		[/village]
		[village]
			x="17"
			y="21"
		[/village]
		[village]
			x="18"
			y="28"
		[/village]
		[village]
			x="20"
			y="23"
		[/village]
		[unit]
			advances_to="Dwarvish Lord"
			alignment="neutral"
			allow_changes="yes"
			allow_player="yes"
			alpha="256"
			attacks_left="1"
			canrecruit="yes"
			colour="2"
			controller="network"
			cost="32"
			current_player="konflikt_86pl"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			fog="yes"
			gender="male"
			gold="100"
			goto_x="-999"
			goto_y="-999"
			hitpoints="56"
			id="konflikt_86pl2"
			image="units/dwarves/steelclad.png"
			income="0"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Steelclad"
			leader="Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper"
			level="2"
			max_attacks="1"
			max_experience="52"
			max_hitpoints="56"
			max_moves="5"
			movement="4"
			movement_type="dwarvishfoot"
			moves="5"
			mp_countdown="yes"
			mp_countdown_action_bonus="13"
			mp_countdown_init_time="270"
			mp_countdown_reservoir_time="330"
			mp_countdown_turn_bonus="60"
			name="human2"
			profile="portraits/dwarves/fighter.png"
			race="dwarf"
			random_leader="Dwarvish Steelclad,Dwarvish Thunderguard,Rogue,Trapper"
			random_traits="no"
			recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider"
			resting="yes"
			save_id="konflikt_86pl2"
			share_maps="no"
			share_view="yes"
			shroud="no"
			side="2"
			team_name="south"
			terrain_liked="Hh, Ha, Mm"
			type="Dwarvish Steelclad"
			undead_variation="dwarf"
			underlying_id="2"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			user_team_name="wesnoth-multiplayerteamname^South"
			village_gold="2"
			x="15"
			y="23"
			zoc="yes"
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/fighter.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="70"
				cold="90"
				fire="90"
				impact="70"
				pierce="70"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="11"
				description=_ "battle axe"
				icon="attacks/battleaxe.png"
				name="battle axe"
				number="3"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="14"
				description=_ "hammer"
				icon="attacks/hammer-dwarven.png"
				name="hammer"
				number="2"
				range="melee"
				type="impact"
			[/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]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="sw"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="29"
			id="Thief-11"
			image="units/human-outlaws/thief+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Thief"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="29"
			max_moves="6"
			movement="6"
			movement_type="elusivefoot"
			moves="6"
			name="Cealobryan"
			profile="portraits/humans/thief+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="yes"
			side="2"
			type="Thief"
			underlying_id="11"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="5"
			y="17"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
					sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.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-outlaws/thief+female-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/damage]
				[/specials]
			[/attack]
			[modifications]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "female^intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^resilient"
					id="resilient"
					male_name=_ "resilient"
					name=_ "female^resilient"
					[effect]
						apply_to="hitpoints"
						increase_total="4"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
						times="per level"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Gryphon Master"
			alignment="neutral"
			alpha="256"
			attacks_left="1"
			cost="24"
			die_sound="gryphon-die-1.ogg,gryphon-die-2.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="ne"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="9"
			id="Gryphon Rider-12"
			image="units/dwarves/gryphon-rider.png"
#textdomain wesnoth-units
			language_name=_ "Gryphon Rider"
			level="1"
			max_attacks="1"
			max_experience="21"
			max_hitpoints="35"
			max_moves="8"
			movement="8"
			movement_type="fly"
			moves="0"
			name="Kzaaa"
			profile="portraits/dwarves/gryphon-rider.png"
			race="gryphon"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Gryphon Rider"
			undead_variation="gryphon"
			underlying_id="12"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="13"
			y="6"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="claws.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="200"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="gryphon-hit-1.ogg,gryphon-hit-2.ogg,gryphon-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/defend]
			[movement_anim]
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/movement_anim]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[standing_anim]
				layer="60"
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="50"
				cave="80"
				deep_water="50"
				flat="50"
				forest="50"
				frozen="50"
				fungus="70"
				hills="50"
				impassable="80"
				mountains="40"
				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="3"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="100"
				cold="100"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="13"
				description=_ "claws"
				icon="attacks/claws-animal.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[modifications]
				[trait]
#textdomain wesnoth
					female_name=_ "female^strong"
					id="strong"
					male_name=_ "strong"
					name=_ "strong"
					[effect]
						apply_to="attack"
						increase_damage="1"
						range="melee"
					[/effect]
					[effect]
						apply_to="hitpoints"
						increase_total="1"
					[/effect]
				[/trait]
				[trait]
					female_name=_ "female^intelligent"
					id="intelligent"
					male_name=_ "intelligent"
					name=_ "intelligent"
					[effect]
						apply_to="max_experience"
						increase="-20%"
					[/effect]
				[/trait]
			[/modifications]
		[/unit]
		[unit]
			advances_to="Gryphon Master"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="24"
			die_sound="gryphon-die-1.ogg,gryphon-die-2.ogg"
			ellipse="misc/ellipse"
			experience="3"
			facing="ne"
			flag_rgb="magenta"
			flies="true"
			flying="yes"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="21"
			id="Gryphon Rider-13"
			image="units/dwarves/gryphon-rider.png"
#textdomain wesnoth-units
			language_name=_ "Gryphon Rider"
			level="1"
			max_attacks="1"
			max_experience="27"
			max_hitpoints="37"
			max_moves="9"
			movement="8"
			movement_type="fly"
			moves="0"
			name="Kassshh"
			profile="portraits/dwarves/gryphon-rider.png"
			race="gryphon"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Gryphon Rider"
			undead_variation="gryphon"
			underlying_id="13"
			unrenamable="no"
			upkeep="full"
			usage="scout"
			x="17"
			y="14"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="claws"
				[/filter_attack]
				[frame]
					begin="-200"
					end="-100"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[if]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="claws.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="200"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/attack_anim]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
						sound="gryphon-hit-1.ogg,gryphon-hit-2.ogg,gryphon-hit-3.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/gryphon-rider-flying-4.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
			[/defend]
			[movement_anim]
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/movement_anim]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/gryphon-rider.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[standing_anim]
				layer="60"
				start_time="0"
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-1.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-2.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-3.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-4.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-6.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/dwarves/gryphon-rider-flying-8.png"
				[/frame]
			[/standing_anim]
			[defense]
				castle="50"
				cave="80"
				deep_water="50"
				flat="50"
				forest="50"
				frozen="50"
				fungus="70"
				hills="50"
				impassable="80"
				mountains="40"
				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="3"
				hills="1"
				impassable="99"
				mountains="1"
				reef="1"
				sand="1"
				shallow_water="1"
				swamp_water="1"
				unwalkable="1"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="100"
				cold="100"
				fire="100"
				impact="120"
				pierce="100"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="12"
				description=_ "claws"
				icon="attacks/claws-animal.png"
				name="claws"
				number="2"
				range="melee"
				type="blade"
			[/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="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="0"
			cost="13"
			die_sound="human-female-die-1.ogg,human-female-die-2.ogg,human-female-die-3.ogg"
			ellipse="misc/ellipse"
			experience="2"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="female"
			goto_x="-999"
			goto_y="-999"
			hitpoints="6"
			id="Thief-14"
			image="units/human-outlaws/thief+female.png"
#textdomain wesnoth-units
			language_name=_ "female^Thief"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="25"
			max_moves="6"
			movement="6"
			movement_type="elusivefoot"
			moves="0"
			name="Nolona"
			profile="portraits/humans/thief+female.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Thief"
			underlying_id="14"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="18"
			y="15"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief+female-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief+female-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief+female-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief+female.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief+female-defend.png"
					sound="human-female-hit-1.ogg,human-female-hit-2.ogg,human-female-hit-3.ogg"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief+female.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-outlaws/thief+female-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief+female-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief+female-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief+female-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief+female-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief+female.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="5"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/damage]
				[/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="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="25"
			id="Thief-16"
			image="units/human-outlaws/thief.png"
#textdomain wesnoth-units
			language_name=_ "Thief"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="25"
			max_moves="6"
			movement="6"
			movement_type="elusivefoot"
			moves="0"
			name="Rhaedd"
			profile="portraits/humans/thief.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Thief"
			underlying_id="16"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="19"
			y="17"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-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-outlaws/thief.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-outlaws/thief-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="5"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/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]
		[unit]
			advances_to="Rogue"
			alignment="chaotic"
			alpha="256"
			attacks_left="1"
			cost="13"
			die_sound="human-die-1.ogg,human-die-2.ogg,human-die-3.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="nw"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="23"
			id="Thief-17"
			image="units/human-outlaws/thief.png"
#textdomain wesnoth-units
			language_name=_ "Thief"
			level="1"
			max_attacks="1"
			max_experience="15"
			max_hitpoints="23"
			max_moves="7"
			movement="6"
			movement_type="elusivefoot"
			moves="1"
			name="Rheodd"
			profile="portraits/humans/thief.png"
			race="human"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Thief"
			underlying_id="17"
			unrenamable="no"
			upkeep="full"
			usage="fighter"
			x="18"
			y="17"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-150"
					end="-100"
					image="units/human-outlaws/thief.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="100"
						image="units/human-outlaws/thief-attack.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="100"
					end="150"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/attack_anim]
			[death]
				start_time="0"
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-6.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-die-7.png"
				[/frame]
			[/death]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-1-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-1-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-2-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-2-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="miss"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="-42"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="-42"
					end="41"
					image="units/human-outlaws/thief-defend-3-2.png"
				[/frame]
				[frame]
					begin="41"
					end="125"
					image="units/human-outlaws/thief-defend-3-1.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="kill"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-defend.png"
				[/frame]
				[frame]
					begin="125"
					end="126"
					image="units/human-outlaws/thief.png"
				[/frame]
			[/defend]
			[defend]
				hits="hit"
				[frame]
					begin="-126"
					end="-125"
					image="units/human-outlaws/thief.png"
				[/frame]
				[frame]
					begin="-125"
					end="125"
					image="units/human-outlaws/thief-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-outlaws/thief.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-outlaws/thief-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="300"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-12.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-11.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-10.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-9.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-8.png"
				[/frame]
				[frame]
					duration="500"
					image="units/human-outlaws/thief-idle-7.png"
				[/frame]
				[frame]
					duration="150"
					image="units/human-outlaws/thief-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/human-outlaws/thief-idle-5.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-3.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/human-outlaws/thief-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/humans/transparent/thief.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[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="100"
				fire="100"
				impact="120"
				pierce="120"
			[/resistance]
			[variables]
			[/variables]
			[status]
				hidden="yes"
			[/status]
			[attack]
				damage="4"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="3"
				range="melee"
				type="blade"
				[specials]
					[damage]
						active_on="offense"
						backstab="yes"
#textdomain wesnoth
						description=_ "Backstab:
When used offensively, this attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (turned to stone or otherwise paralyzed)."
						id="backstab"
						multiply="2"
						name=_ "backstab"
					[/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^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="Dwarvish Thunderguard"
			alignment="neutral"
			alpha="256"
			attacks_left="0"
			cost="17"
			die_sound="dwarf-die-1.ogg,dwarf-die-2.ogg"
			ellipse="misc/ellipse"
			experience="0"
			facing="se"
			flag_rgb="magenta"
			flying="no"
			gender="male"
			goto_x="-999"
			goto_y="-999"
			hitpoints="39"
			id="Dwarvish Thunderer-21"
			image="units/dwarves/thunderer.png"
#textdomain wesnoth-units
			language_name=_ "Dwarvish Thunderer"
			level="1"
			max_attacks="1"
			max_experience="22"
			max_hitpoints="39"
			max_moves="4"
			movement="4"
			movement_type="dwarvishfoot"
			moves="0"
			name="Glaithasil"
			profile="portraits/dwarves/thunderer.png"
			race="dwarf"
			random_gender="no"
			random_traits="no"
			resting="no"
			side="2"
			type="Dwarvish Thunderer"
			undead_variation="dwarf"
			underlying_id="21"
			unrenamable="no"
			upkeep="full"
			usage="mixed fighter"
			x="15"
			y="21"
			zoc="yes"
			[attack_anim]
				[filter_attack]
					name="thunderstick"
				[/filter_attack]
				[if]
					direction="s"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="0~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-s-1.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-s-2.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-s-3.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-s.png"
						sound="thunderstick.ogg"
					[/frame]
				[/if]
				[else]
					direction="s"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-s.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="ne,nw"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="20~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-ne-1.png"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-ne-2.png"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-ne-3.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-ne.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="ne,nw"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-ne.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="n"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="20~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-n-1.png"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-n-2.png"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-n-3.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-n.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="n"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-n.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[else]
					direction="se,sw"
					hits="yes"
					missile_halo_x="0~0"
					missile_halo_y="0~0"
					missile_offset="0.5~1.1:250,1.1~1.5:200,1.5~1.7:360"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/muzzle-flash-se-1.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="80"
						halo="projectiles/muzzle-flash-se-2.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="70"
						halo="projectiles/muzzle-flash-se-3.png~FL(vertical)"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-4.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-5.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-6.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-7.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-8.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-9.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-10.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-11.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-12.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-13.png"
					[/missile_frame]
					[missile_frame]
						duration="60"
						halo="projectiles/muzzle-flash-14.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-se.png"
						sound="thunderstick.ogg"
					[/frame]
				[/else]
				[else]
					direction="se,sw"
					hits="no"
					missile_offset="0.1"
					missile_start_time="-250"
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-1.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-2.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-3.png"
					[/missile_frame]
					[missile_frame]
						duration="100"
						halo="projectiles/misfire-spark-4.png"
					[/missile_frame]
					[frame]
						begin="-400"
						end="0"
						image="units/dwarves/thunderer-attack-se.png"
						sound="thunderstick-miss.ogg"
					[/frame]
				[/else]
				[frame]
					begin="0"
					end="1"
					image="units/dwarves/thunderer-attack-se.png"
				[/frame]
			[/attack_anim]
			[attack_anim]
				[filter_attack]
					name="dagger"
				[/filter_attack]
				[frame]
					begin="-250"
					end="-200"
					image="units/dwarves/thunderer.png"
				[/frame]
				[frame]
					begin="-200"
					end="-100"
					image="units/dwarves/thunderer-melee1.png"
				[/frame]
				[if]
					hits="yes"
					[frame]
						begin="-100"
						end="50"
						image="units/dwarves/thunderer-melee2.png"
						sound="dagger-swish.wav"
					[/frame]
				[/if]
				[else]
					hits="no"
					[frame]
						begin="-100"
						end="50"
						image="units/dwarves/thunderer-melee2.png"
						sound="miss-1.ogg,miss-2.ogg,miss-3.ogg"
					[/frame]
				[/else]
				[frame]
					begin="50"
					end="100"
					image="units/dwarves/thunderer-melee1.png"
				[/frame]
				[frame]
					begin="100"
					end="125"
					image="units/dwarves/thunderer.png"
				[/frame]
			[/attack_anim]
			[death]
				[frame]
					begin="0"
					end="200"
					image="units/dwarves/thunderer-die1.png"
				[/frame]
				[frame]
					begin="200"
					end="400"
					image="units/dwarves/thunderer-die2.png"
				[/frame]
				[frame]
					begin="400"
					end="600"
					image="units/dwarves/thunderer-die3.png"
				[/frame]
			[/death]
			[defend]
				start_time="-126"
				[frame]
					duration="1"
					image="units/dwarves/thunderer.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-defend.png"
				[/frame]
				[if]
					hits="hit"
					[frame]
						duration="150"
						image="units/dwarves/thunderer-defend.png"
						sound="dwarf-hit-1.ogg,dwarf-hit-2.ogg,dwarf-hit-3.ogg,dwarf-hit-4.ogg"
					[/frame]
				[/if]
				[else]
					hits="miss,kill"
					[frame]
						duration="150"
						image="units/dwarves/thunderer-defend.png"
					[/frame]
				[/else]
				[frame]
					duration="1"
					image="units/dwarves/thunderer.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/dwarves/thunderer-idle-1.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-3.png"
				[/frame]
				[frame]
					duration="800"
					image="units/dwarves/thunderer-idle-4.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="300"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="300"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-5.png"
				[/frame]
				[frame]
					duration="200"
					image="units/dwarves/thunderer-idle-6.png"
				[/frame]
				[frame]
					duration="500"
					image="units/dwarves/thunderer-idle-4.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-2.png"
				[/frame]
				[frame]
					duration="100"
					image="units/dwarves/thunderer-idle-1.png"
				[/frame]
			[/idle_anim]
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="false"
				side="left"
				size="400"
			[/portrait]
			[portrait]
				image="portraits/dwarves/transparent/thunderer.png"
				mirror="true"
				side="right"
				size="400"
			[/portrait]
			[defense]
				castle="40"
				cave="50"
				deep_water="80"
				flat="70"
				forest="70"
				frozen="70"
				fungus="60"
				hills="40"
				impassable="50"
				mountains="30"
				reef="70"
				sand="70"
				shallow_water="80"
				swamp_water="80"
				unwalkable="80"
				village="50"
			[/defense]
			[movement_costs]
				castle="1"
				cave="1"
				deep_water="99"
				flat="1"
				forest="1"
				frozen="2"
				fungus="1"
				hills="1"
				impassable="99"
				mountains="1"
				reef="2"
				sand="1"
				shallow_water="3"
				swamp_water="3"
				unwalkable="99"
				village="1"
			[/movement_costs]
			[resistance]
				arcane="90"
				blade="80"
				cold="90"
				fire="90"
				impact="80"
				pierce="80"
			[/resistance]
			[variables]
			[/variables]
			[status]
			[/status]
			[attack]
				damage="6"
				description=_ "dagger"
				icon="attacks/dagger-human.png"
				name="dagger"
				number="2"
				range="melee"
				type="blade"
			[/attack]
			[attack]
				damage="18"
				description=_ "thunderstick"
				name="thunderstick"
				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]
	[/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="4"
		side_number="1"
		turn_number="7"
	[/variables]
	[player]
		can_recruit="Dwarvish Fighter,Dwarvish Guardsman,Dwarvish Thunderer,Dwarvish Ulfserker,Footpad,Gryphon Rider,Poacher,Thief"
		gold="-1"
		gold_add="no"
		save_id="Lord1"
	[/player]
	[player]
		can_recruit="Dwarvish Fighter,Dwarvish Guardsman,Dwarvish Thunderer,Dwarvish Ulfserker,Footpad,Gryphon Rider,Poacher,Thief"
		gold="-1"
		gold_add="no"
		save_id="konflikt_86pl2"
	[/player]
[/snapshot]
[replay_start]
	current_tod="0"
#textdomain wesnoth-multiplayer
	description=_ "Players must navigate the dispersive terrain of this small but topographically dense island."
	experience_modifier="70"
	hash="24u7p+9>B6j3mmdFFjtQetmyhsjDsvjdGoc9moJJdCnbgH-k0RT,O.<DG03847ComZqcODnz+m379P+k2ibc2A>myx3EZ.9k5hdhQci>pkFHts,>fJCn>sZ2tRevrdQy"
	id="multiplayer_Hornshark_Island"
	map_data="border_size=1
usage=map

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

faiend
"
				[/team_formula]
			[/ai]
		[/multiplayer_side]
		[event]
			name="prestart"
			[store_unit]
				kill="yes"
				variable="leaders_to_make_quick"
				[filter]
					canrecruit="yes"
					[filter_wml]
						max_moves="4"
					[/filter_wml]
				[/filter]
			[/store_unit]
			[set_variable]
				name="i"
				value="0"
			[/set_variable]
			[while]
				[variable]
					less_than="$leaders_to_make_quick.length"
					name="i"
				[/variable]
				[do]
					[set_variables]
						mode="merge"
						name="leaders_to_make_quick[$i].modifications"
						[literal]
							[trait]
#textdomain wesnoth
								female_name=_ "female^quick"
								id="quick"
								male_name=_ "quick"
								[effect]
									apply_to="movement"
									increase="1"
								[/effect]
								[effect]
									apply_to="hitpoints"
									increase_total="-5%"
								[/effect]
							[/trait]
						[/literal]
					[/set_variables]
					[clear_variable]
						name="leaders_to_make_quick[$i].max_moves,leaders_to_make_quick[$i].moves,leaders_to_make_quick[$i].max_hitpoints,leaders_to_make_quick[$i].hitpoints"
					[/clear_variable]
					[unstore_unit]
						variable="leaders_to_make_quick[$i]"
					[/unstore_unit]
					[set_variable]
						add="1"
						name="i"
					[/set_variable]
				[/do]
			[/while]
			[clear_variable]
				name="i"
			[/clear_variable]
			[clear_variable]
				name="leaders_to_make_quick"
			[/clear_variable]
		[/event]
	[/era]
	[side]
		allow_changes="yes"
		allow_player="yes"
		canrecruit="yes"
		colour="1"
		controller="human"
		current_player="Lord"
		flag_rgb="magenta"
		fog="yes"
		gender="male"
		gold="100"
		id="Lord1"
		image="units/dwarves/steelclad.png"
		income="0"
		leader="Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper"
		mp_countdown="yes"
		mp_countdown_action_bonus="13"
		mp_countdown_init_time="270"
		mp_countdown_reservoir_time="330"
		mp_countdown_turn_bonus="60"
		name="Lord"
		random_leader="Dwarvish Steelclad,Dwarvish Thunderguard,Rogue,Trapper"
		recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider"
		save_id="Lord1"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="1"
		team_name="north"
		terrain_liked="Hh, Ha, Mm"
		type="Dwarvish Thunderguard"
		user_team_name="wesnoth-multiplayerteamname^North"
		village_gold="2"
		[ai]
			recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
	[/side]
	[side]
		allow_changes="yes"
		allow_player="yes"
		canrecruit="yes"
		colour="2"
		controller="network"
		current_player="konflikt_86pl"
		flag_rgb="magenta"
		fog="yes"
		gender="male"
		gold="100"
		id="konflikt_86pl2"
		image="units/dwarves/steelclad.png"
		income="0"
		leader="Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper"
		mp_countdown="yes"
		mp_countdown_action_bonus="13"
		mp_countdown_init_time="270"
		mp_countdown_reservoir_time="330"
		mp_countdown_turn_bonus="60"
		name="konflikt_86pl"
		random_leader="Dwarvish Steelclad,Dwarvish Thunderguard,Rogue,Trapper"
		recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider"
		save_id="konflikt_86pl2"
		share_maps="no"
		share_view="yes"
		shroud="no"
		side="2"
		team_name="south"
		terrain_liked="Hh, Ha, Mm"
		type="Dwarvish Steelclad"
		user_team_name="wesnoth-multiplayerteamname^South"
		village_gold="2"
		[ai]
			recruitment_pattern="fighter,fighter,fighter,mixed fighter,archer,scout"
			villages_per_scout="8"
			[team_formula]
				rulebase="fai 'recruitment.fai'
		# ===== Some general functions used later ==== #

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

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

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

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

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

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

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

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

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

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

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

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

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

#returns average defense of the unit #

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

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

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

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


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


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

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

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

# ==2== based on village possession #

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

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

# multipled by 1000 to increase precision #

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

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

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

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

#==1==  basic evaluation #

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

faiend
"
			[/team_formula]
		[/ai]
		[ai]
			villages_per_scout="8"
		[/ai]
	[/side]
[/replay_start]
[statistics]
	mid_scenario="yes"
	[scenario]
		scenario="2S – Die Insel der Stachelhaie"
		[team]
			[recruits]
				Dwarvish Fighter="4"
				Dwarvish Thunderer="1"
				Footpad="2"
				Gryphon Rider="1"
				Thief="2"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
			[/deaths]
			[killed]
				Footpad="2"
				Thief="1"
			[/killed]
			[attacks]
				[sequence]
					s0="1"
					s000="1"
					s001="1"
					s10="1"
					s100="1"
					_num="30"
				[/sequence]
				[sequence]
					s1="1"
					s100="1"
					s11="1"
					_num="40"
				[/sequence]
				[sequence]
					s0="1"
					s01="1"
					s010="1"
					s110="1"
					_num="50"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s="2"
					_num="0"
				[/sequence]
				[sequence]
					s01="1"
					s10="1"
					_num="40"
				[/sequence]
				[sequence]
					s10="1"
					_num="50"
				[/sequence]
			[/defends]
			recruit_cost="159"
			recall_cost="0"
			damage_inflicted="148"
			damage_taken="106"
			expected_damage_inflicted="136856"
			expected_damage_taken="107573"
			turn_damage_inflicted="92"
			turn_damage_taken="24"
			turn_expected_damage_inflicted="74402"
			turn_expected_damage_taken="47672"
			save_id="Lord1"
		[/team]
		[team]
			[recruits]
				Dwarvish Thunderer="1"
				Footpad="2"
				Gryphon Rider="2"
				Thief="5"
			[/recruits]
			[recalls]
			[/recalls]
			[advances]
			[/advances]
			[deaths]
				Footpad="2"
				Thief="1"
			[/deaths]
			[killed]
			[/killed]
			[attacks]
				[sequence]
					s00="1"
					s001="1"
					s010="1"
					s10="1"
					_num="30"
				[/sequence]
				[sequence]
					s10="1"
					_num="40"
				[/sequence]
			[/attacks]
			[defends]
				[sequence]
					s="1"
					_num="0"
				[/sequence]
				[sequence]
					s00="1"
					_num="30"
				[/sequence]
				[sequence]
					s00="1"
					s1="1"
					s11="1"
					_num="40"
				[/sequence]
				[sequence]
					s00="1"
					s01="1"
					_num="50"
				[/sequence]
				[sequence]
					s="1"
					s10="2"
					s101="1"
					s11="1"
					_num="70"
				[/sequence]
			[/defends]
			recruit_cost="158"
			recall_cost="0"
			damage_inflicted="106"
			damage_taken="148"
			expected_damage_inflicted="107573"
			expected_damage_taken="136856"
			turn_damage_inflicted="56"
			turn_damage_taken="119"
			turn_expected_damage_inflicted="70994"
			turn_expected_damage_taken="97478"
			save_id="konflikt_86pl2"
		[/team]
	[/scenario]
[/statistics]
