[scenario]
	id=Troll_Hole
	#textdomain wesnoth-trow
	name= _ "Troll Hole"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/Troll_Hole}"
	{TURNS 39 36 33}

	{UNDERGROUND}

	next_scenario=Elf_Lords
	bonus=yes

	[music]
	name="underground.ogg"
	[/music]

	{campaigns/The_Rise_Of_Wesnoth/utils/trow-deaths.cfg}

	[story]
		[part]
			background=story/the_great_continent.png
			show_title=yes
			{DOT 315 180}
			{DOT 320 205}
			{DOT 340 215}
			{DOT 365 215}
			{DOT 390 215}
			{DOT 415 215}
			{CROSS 425 226}
		[/part]
	[/story]

	[side]
		type=Noble Commander
		description=Prince Haldric
		user_description= _ "Prince Haldric"
		unrenamable=yes
		side=1
		canrecruit=1
		controller=human
		shroud=yes
		team_name=Haldric
		{INCOME 8 4 2}
	[/side]

	[side]
		type=Troll Warrior
		description=Erart
		user_description= _ "Erart"
		side=2
		canrecruit=1
		{GOLD 100 160 220}
		{INCOME 2 4 8}
		team_name=Troll
#ifdef EASY
		recruit=Troll Whelp
#else
		recruit=Troll Whelp,Troll,Troll Rocklobber
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=fighter
			aggression=0.75
			{ATTACK_DEPTH 4 5 5}
		[/ai]
	[/side]

	[side]
		type=Troll Warrior
		description=Raol
		user_description= _ "Raol"
		side=3
		canrecruit=1
		{GOLD 100 160 220}
		{INCOME 2 4 8}
		team_name=Troll
#ifdef EASY
		recruit=Troll Whelp
#else
		recruit=Troll Whelp,Troll,Troll Rocklobber
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=fighter
			aggression=0.75
			{ATTACK_DEPTH 4 5 5}
		[/ai]
	[/side]

	[side]
		type=Troll Warrior
		description=Rilg
		user_description= _ "Rilg"
		side=4
		canrecruit=1
		{GOLD 100 160 220}
		{INCOME 2 4 8}
		team_name=Troll
#ifdef EASY
		recruit=Troll Whelp
#else
		recruit=Troll Whelp,Troll,Troll Rocklobber
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=fighter
			aggression=0.75
			{ATTACK_DEPTH 4 5 5}
		[/ai]
	[/side]

	[side]
		type=Troll Warrior
		description=Gulg
		user_description= _ "Gulg"
		side=5
		canrecruit=1
		{GOLD 100 160 220}
		{INCOME 2 4 8}
		team_name=Troll
#ifdef EASY
		recruit=Troll Whelp
#else
		recruit=Troll Whelp,Troll,Troll Rocklobber
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			recruitment_pattern=fighter
			aggression=0.75
			{ATTACK_DEPTH 4 5 5}
		[/ai]
	[/side]

	{campaigns/The_Rise_Of_Wesnoth/utils/trow-nlmsg.cfg}

	[event]
	name=prestart

		{STARTING_VILLAGES 2 10}
		{STARTING_VILLAGES 3 10}
		{STARTING_VILLAGES 4 10}
		{STARTING_VILLAGES 5 10}

		{PLACE_IMAGE (misc/rocks.png) 3 14}
		{PLACE_IMAGE (misc/rocks.png) 25 19}
		{PLACE_IMAGE (misc/rocks.png) 15 3}
		{PLACE_IMAGE (misc/rocks.png) 17 27}

		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 15 11}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 3 15 20}

#ifdef MEDIUM
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 4 11 15}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 5 19 17}
#endif
#ifdef HARD

		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 4 11 15}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 5 19 17}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 2 11 17}
		{UNIT (Tentacle of the Deep) (Tentacle) ( _ "Tentacle") 3 19 15}
#endif

		{RANDOM 1..4}
		[if]
			[variable]
			name=random
			numerical_equals=1
			[/variable]
			[then]
				[kill]
				description=Erart
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 3 5 5}
				[kill]
				description=Raol
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 2 25 5}
			[/then]
		[/if]
		[if]
			[variable]
			name=random
			numerical_equals=2
			[/variable]
			[then]
				[kill]
				description=Raol
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 2 25 5}
				[kill]
				description=Rilg
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 5 5 25}
			[/then]
		[/if]
		[if]
			[variable]
			name=random
			numerical_equals=3
			[/variable]
			[then]
				[kill]
				description=Rilg
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 5 5 25}
				[kill]
				description=Gulg
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 4 25 25}
			[/then]
		[/if]
		[if]
			[variable]
			name=random
			numerical_equals=4
			[/variable]
			[then]
				[kill]
				description=Gulg
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 4 25 25}
				[kill]
				description=Erart
				[/kill]
				{GUARD_UNIT (Giant Spider) (Fang) ( _ "Fang") 3 5 5}
			[/then]
		[/if]

		[recall]
			description=Lady Jessica
			x=14
			y=15
		[/recall]
		[recall]
			description=Burin the Lost
			x=16
			y=14
		[/recall]
		[recall]
			description=Minister Edmond
			x=15
			y=16
		[/recall]

		[objectives]
		side=1
			[objective]
				description= _ "Defeat all enemy leaders"
				condition=win
			[/objective]
			[objective]
				description= _ "Death of Prince Haldric"
				condition=lose
			[/objective]
			[objective]
				description= _ "Death of Lady Jessica"
				condition=lose
			[/objective]
			[objective]
				description= _ "Turns run out"
				condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
		name=start
		[message]
			speaker=narrator
			message= _ "It isn't long before Haldric and his companions enter the Brown Hills. An elven guide leads them to a gaping cave mouth, and they descend into the darkness."
		[/message]

		[message]
			description=Prince Haldric
			message= _ "So, does anybody know anything about trolls?"
		[/message]

		[message]
			description=Burin the Lost
			message= _ "I indeed do. They are green, and mean, and will try to crush you like a bug. They heal very quickly."
		[/message]

		[message]
			description=Lady Jessica
			message= _ "Hmm... Do we really need to know that much about the trolls? I think it's safe to say that the elves wouldn't have sent us down here if they were at all friendly."
		[/message]

		[message]
			description=Prince Haldric
			message= _ "Fair enough. Well, let's get them!"
		[/message]
	[/event]

	[event]
		name=time over
		[message]
			description=Prince Haldric
			message= _ "We have failed... More of the trolls' kin are arriving through the entrance."
		[/message]
	[/event]

	[event]
		name=die
		[filter]
			description=Erart
		[/filter]
		{LOOT 50 1}
	[/event]

	[event]
		name=die
		[filter]
			description=Raol
		[/filter]
		{LOOT 50 1}
	[/event]

	[event]
		name=die
		[filter]
			description=Rilg
		[/filter]
		{LOOT 50 1}
	[/event]

	[event]
		name=die
		[filter]
			description=Gulg
		[/filter]
		{LOOT 50 1}
	[/event]

	[event]
		name=victory
		[message]
			description=Prince Haldric
			message= _ "The trolls are beaten. No wonder why the elves are getting us to do their dirty linens."
		[/message]

		{VARIABLE_OP num_done add 1}

		[set_variable]
			name=troll_hole
			value=1
		[/set_variable]

		[set_variable]
			name=last_done
			value="Hole"
		[/set_variable]

		{CLEAR_VARIABLE random}
	[/event]

[/scenario]
