[unit]
#textdomain wesnoth-utbs
	id=Desert Ranger
	name= _ "Desert Ranger"
	race=elf
	image=units/elves-desert/ranger.png
	hitpoints=42
	movement_type=woodland
# Desert elves move fast across the sands, but are not used to forests
# They are also a bit faster in caves
# Avengers move faster in mountains and shallow water
	[movement_costs]
		sand=1
		forest=2
		cave=2
		tundra=3
		shallow_water=2
		mountains=2
	[/movement_costs]
# Ranger defend better in shallow water and swamp
	[defense]
		sand=40
		forest=50
		shallow_water=70
		swamp_water=60
	[/defense]
	movement=6
	experience=80
	level=2
	alignment=lawful
	advanceto=Desert Avenger
	cost=40
#instead of ambush desert rangers have backstab
	usage=mixed fighter
	unit_description= _ "Desert Rangers are quick and powerful. Skilled in both short and long-range combat, Rangers are truly all-round fighters. Like their kin, they prefer the sword to the bow and are adept at sneaking around and backstabbing their enemies.

Special Notes: While a unit with the same allegiance as the Desert Ranger distracts an enemy, the Ranger may backstab, inflicting double damage, by creeping around behind that enemy."
	die_sound={SOUND_LIST:ELF_HIT}
	{DEFENSE_ANIM_RANGE "units/elves-desert/ranger-defend.png" units/elves-desert/ranger.png {SOUND_LIST:ELF_HIT} melee}
	{DEFENSE_ANIM_RANGE "units/elves-desert/ranger-bow-defend.png" units/elves-desert/ranger.png {SOUND_LIST:ELF_HIT} ranged}
	[death]
		[frame]
			begin=0
			end=100
			image="units/elves-desert/ranger-die1.png"
		[/frame]
		[frame]
			begin=100
			end=200
			image="units/elves-desert/ranger-die2.png"
		[/frame]
		[frame]
			begin=200
			end=300
			image="units/elves-desert/ranger-die3.png"
		[/frame]
		[frame]
			begin=300
			end=400
			image="units/elves-desert/ranger-die4.png"
		[/frame]
	[/death]
# melee attack stayed the same from 7-3 to 7-3
# ranged attack decreased from 7-4 to 6-4
# I decided not to increase melee damage I didn't want the
# backstab attack ability to be too powerful
# For comparison the level 2 Rogue unit has a 6,3 backstab attack
	[attack]
		name=sword
		description= _"sword"
		type=blade
		range=melee
		damage=7
		number=3
		[specials]
			{WEAPON_SPECIAL_BACKSTAB}
		[/specials]
		icon=attacks/sword-elven.png
		[animation]
		[if]
			hits=yes
				[frame]
					begin=-101
					end=100
					image=units/elves-desert/ranger-attack.png
					sound={SOUND_LIST:SWORD_SWISH}
				[/frame]
		[/if]
		[else]
			hits=no
				[frame]
					begin=-101
					end=100
					image=units/elves-desert/ranger-attack.png
					sound={SOUND_LIST:MISS}
				[/frame]
		[/else]
		[/animation]
	[/attack]
	[attack]
		name=bow
		description= _"bow"
		type=pierce
		range=ranged
		damage=6
		number=4
		icon=attacks/bow-elven.png
		[animation]
			[missile_frame]
				begin=-100
				end=0
				image=projectiles/missile-n.png
				image_diagonal=projectiles/missile-ne.png
			[/missile_frame]
			[frame]
				begin=-525
				end=-450
				image=units/elves-desert/ranger-bow.png
			[/frame]
			[if]
				hits=yes
				[frame]
					begin=-450
					end=-300
					image=units/elves-desert/ranger-attack1.png
					sound=bow.ogg
				[/frame]
			[/if]
			[else]
				hits=no
				[frame]
					begin=-450
					end=-300
					image=units/elves-desert/ranger-attack1.png
					sound=bow-miss.ogg
				[/frame]
			[/else]
			[frame]
				begin=-300
				end=-200
				image=units/elves-desert/ranger-attack2.png
			[/frame]
			[frame]
				begin=-200
				end=-100
				image=units/elves-desert/ranger-attack3.png
			[/frame]
			[frame]
				begin=-100
				end=0
				image=units/elves-desert/ranger-attack3.png
			[/frame]
			[frame]
				begin=0
				end=100
				image=units/elves-desert/ranger-bow.png
			[/frame]
		[/animation]
	[/attack]
	[female]
		name= _ "female^Desert Ranger"
		id=Desert Ranger
		race=elf
		gender=female
		image="units/elves-desert/ranger+female.png"
		hitpoints=42
		movement_type=woodland
#desert elves move fast across the sands, but are not used to forests
		[movement_costs]
			sand=1
			forest=2
			cave=2
			tundra=3
		[/movement_costs]
		[defense]
			sand=40
			forest=50
		[/defense]
		movement=6
		experience=80
		level=2
		alignment=lawful
		advanceto=Desert Avenger
		cost=40
		usage=mixed fighter
#instead of ambush desert rangers have backstab
		unit_description="Desert Rangers are quick and powerful. Skilled in both short and long-range combat, Rangers are truly all-round fighters. Like their kin, they prefer the sword to the bow and are adept at sneaking around and backstabbing their enemies."
		die_sound={SOUND_LIST:ELF_FEMALE_HIT}
		{DEFENSE_ANIM_RANGE "units/elves-desert/ranger+female-defend.png" "units/elves-desert/ranger+female.png" {SOUND_LIST:ELF_FEMALE_HIT} melee}
		{DEFENSE_ANIM_RANGE "units/elves-desert/ranger+female-bow-defend.png" "units/elves-desert/ranger+female.png" {SOUND_LIST:ELF_FEMALE_HIT} ranged}
		[death]
			[frame]
				begin=0
				end=100
				image="units/elves-desert/ranger-die1.png"
			[/frame]
			[frame]
				begin=100
				end=200
				image="units/elves-desert/ranger-die2.png"
			[/frame]
			[frame]
				begin=200
				end=300
				image="units/elves-desert/ranger-die3.png"
			[/frame]
			[frame]
				begin=300
				end=400
				image="units/elves-desert/ranger-die4.png"
			[/frame]
		[/death]
# originally 7,3 melee 7,4 ranged
# I decreased ranged damage by 1, decided not to increase melee
# damage because of backstab, don't want it to be too powerful
# For comparison the level 2 Rogue unit has a 6,3 backstab attack
		[attack]
			name=sword
			description= _"sword"
			type=blade
			range=melee
			damage=7
			number=3
			[specials]
				{WEAPON_SPECIAL_BACKSTAB}
			[/specials]
			icon=attacks/sword-elven.png
			[animation]
			[if]
				hits=yes
					[frame]
						begin=-101
						end=100
						image="units/elves-desert/ranger+female-attack.png"
						sound={SOUND_LIST:SWORD_SWISH}
					[/frame]
			[/if]
			[else]
				hits=no
					[frame]
						begin=-101
						end=100
						image="units/elves-desert/ranger+female-attack.png"
						sound={SOUND_LIST:MISS}
					[/frame]
			[/else]
			[/animation]
		[/attack]
		[attack]
			name=bow
			description= _"bow"
			type=pierce
			range=ranged
			damage=6
			number=4
			icon=attacks/bow-elven.png
			[animation]
				[missile_frame]
					begin=-100
					end=0
					image=projectiles/missile-n.png
					image_diagonal=projectiles/missile-ne.png
				[/missile_frame]
				[frame]
					begin=-525
					end=-450
					image="units/elves-desert/ranger+female-bow.png"
				[/frame]
				[if]
					hits=yes
					[frame]
						begin=-450
						end=-300
						image="units/elves-desert/ranger+female-attack1.png"
						sound=bow.ogg
					[/frame]
				[/if]
				[else]
					hits=no
					[frame]
						begin=-450
						end=-300
						image="units/elves-desert/ranger+female-attack1.png"
						sound=bow-miss.ogg
					[/frame]
				[/else]
				[frame]
					begin=-300
					end=-200
					image="units/elves-desert/ranger+female-attack2.png"
				[/frame]
				[frame]
					begin=-200
					end=-100
					image="units/elves-desert/ranger+female-attack3.png"
				[/frame]
				[frame]
					begin=-100
					end=0
					image="units/elves-desert/ranger+female-attack3.png"
				[/frame]
				[frame]
					begin=0
					end=100
					image="units/elves-desert/ranger+female-bow.png"
				[/frame]
			[/animation]
		[/attack]
	[/female]
[/unit]
