[scenario]
	id=Cursed_Isle
	#textdomain wesnoth-trow
	name= _ "Cursed Isle"
	map_data="{campaigns/The_Rise_Of_Wesnoth/maps/Cursed_Isle}"
	{TURNS 37 34 31}

	{DAWN}
	{MORNING}
	{AFTERNOON}
	{DUSK}
	{FIRST_WATCH}
	{SECOND_WATCH}

	next_scenario=Elf_Lords
	victory_when_enemies_defeated=no
	bonus=yes

	[music]
	name="wesnoth-1.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 290 180}
			{DOT 265 180}
			{DOT 240 180}
			{DOT 215 180}
			{DOT 190 180}
			{DOT 165 180}
			{DOT 145 170}
			{DOT 120 170}
			{CROSS 90 166}
		[/part]
	[/story]

	[side]
		type=Noble Commander
		description=Prince Haldric
		user_description= _ "Prince Haldric"
		unrenamable=yes
		side=1
		canrecruit=1
		controller=human
		team_name=Haldric
		fog=yes
	[/side]

	[side]
		type=Spectre
		description=Isorfilad
		user_description= _ "Isorfilad"
		side=2
		canrecruit=1
		{GOLD 130 190 250}
		{INCOME 2 4 8}
		team_name=Undead
#ifdef EASY
		recruit=Ghost,Ghoul,Vampire Bat
#else
		recruit=Ghost,Ghoul,Vampire Bat,Shadow,Necrophage
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			aggression=0.40
			recruitment_pattern=scout,scout,fighter
			{ATTACK_DEPTH 4 5 5}
		[/ai]
		[ai]
			time_of_day=dusk,first_watch,second_watch
			aggression=0.75
			caution=0.0
		[/ai]
		[ai]
			[protect_location]
				x=13
				y=16
				radius=10
				value=10
			[/protect_location]
		[/ai]
	[/side]

	[side]
		type=Spectre
		description=Tinoldor
		user_description= _ "Tinoldor"
		side=3
		canrecruit=1
		{GOLD 130 190 250}
		{INCOME 2 4 8}
		team_name=Undead
#ifdef EASY
		recruit=Ghost,Ghoul,Vampire Bat
#else
		recruit=Ghost,Ghoul,Vampire Bat,Wraith,Necrophage
#endif
		[ai]
			{NO_SCOUTS}
			recruitment_ignore_bad_movement=yes
			aggression=0.40
			recruitment_pattern=scout,scout,fighter
			{ATTACK_DEPTH 4 5 5}
		[/ai]
		[ai]
			time_of_day=dusk,first_watch,second_watch
			aggression=0.75
			caution=0.0
		[/ai]
		[ai]
			[protect_location]
				x=13
				y=16
				radius=10
				value=10
			[/protect_location]
		[/ai]
	[/side]

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

#define TEMP_LOOT X Y
	[event]
	name=moveto
	[filter]
		side=1
		x={X}
		y={Y}
	[/filter]

	{LOOT 50 1}

	[/event]
#enddef

#define TEMP_QUEEN X Y
	[event]
	name=moveto
		[filter]
			side=1
			x={X}
			y={Y}
		[/filter]
		[message]
			speaker=unit
			message= _ "She's... She's beautiful."
		[/message]

		{UNDEAD_INTEL (Vampire Lady) (Midnight Queen) ( _ "Midnight Queen") "unit_image" 2 ({X}) ({Y})}

		{UNDEAD_UNIT (Blood Bat) 3 ({X}) ({Y})}
		{UNDEAD_UNIT (Blood Bat) 2 ({X}) ({Y})}
		{UNDEAD_UNIT (Blood Bat) 3 ({X}) ({Y})}

#ifdef HARD
		{UNDEAD_UNIT (Blood Bat) 2 ({X}) ({Y})}
#endif

		[message]
			description=Midnight Queen
			message= _ "You will be made to serve... Come admire me. Feel my love."
		[/message]
		[message]
			description=Prince Haldric
			message= _ "She is so..."
		[/message]
		[message]
			description=Lady Jessica
			message= _ "Haldric, think with your brain!"
		[/message]
		[message]
			description=Prince Haldric
			message= _ "Get her before she can cause too much trouble!"
		[/message]
		[objectives]
		side=1
			[objective]
				description= _ "Defeat the Vampire Queen"
				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]
		[set_variable]
			name=queen_awake
			value=1
		[/set_variable]
	[/event]

#enddef


#define TEMP_EMPTY X Y
	[event]
		name=moveto
		[filter]
			side=1
			x={X}
			y={Y}
		[/filter]
		[message]
			speaker=unit
			message= _ "The temple is quite empty."
		[/message]
	[/event]
#enddef

	[event]
	name=prestart

		{STARTING_VILLAGES 2 12}
		{STARTING_VILLAGES 3 12}

		{PLACE_IMAGE (misc/temple.png) 11 13}
		{PLACE_IMAGE (misc/temple.png) 10 17}
		{PLACE_IMAGE (misc/temple.png) 9 15}

		{OBJ_POTION_HOLY 29 24 (holy_water1)}

		[set_variable]
			name=queen_awake
			value=0
		[/set_variable]
		[recall]
			description=Lady Jessica
		[/recall]

		[recall]
			description=Burin the Lost
		[/recall]

		[recall]
			description=Sir Ruddry
		[/recall]

		[recall]
			description=Sir Ladoc
		[/recall]

		[recall]
			description=Minister Edmond
		[/recall]

		{RANDOM 1..3}
		[if]
			[variable]
			name=random
			numerical_equals=1
			[/variable]
			[then]
				{TEMP_LOOT 11 13}
#ifdef EASY
				{TEMP_LOOT 10 17}
#else
				{TEMP_EMPTY 10 17}
#endif
				{TEMP_QUEEN 9 15}
			[/then]
		[/if]
		[if]
			[variable]
			name=random
			numerical_equals=2
			[/variable]
			[then]
				{TEMP_LOOT 10 17}
#ifdef EASY
				{TEMP_LOOT 9 15}
#else
				{TEMP_EMPTY 9 15}
#endif
				{TEMP_QUEEN 11 13}
			[/then]
		[/if]
		[if]
			[variable]
			name=random
			numerical_equals=3
			[/variable]
			[then]
				{TEMP_LOOT 9 15}
#ifdef EASY
				{TEMP_LOOT 11 13}
#else
				{TEMP_EMPTY 11 13}
#endif
				{TEMP_QUEEN 10 17}
			[/then]
		[/if]

		{CLEAR_VARIABLE random}

#ifdef EASY
	{OBJ_POTION_HOLY 28 26 (holy_water2)}
#endif

		[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= _ "After a short trip by sea Haldric arrives on the elves' cursed isle. A fog hangs in the air."
		[/message]

		[message]
			description=Burin the Lost
			message= _ "I said no more ships. Double crossing humans! Ahh, I've been with you this far. Who'd have thought, a nautical dwarf."
		[/message]

		[message]
			description=Prince Haldric
			message= _ "I suspect we'll be facing more undead. Be careful."
		[/message]

		[message]
			description=Lady Jessica
			message= _ "These will be the long dead. Not like the undead that my people used, and they are elf-dead. Be careful indeed."
		[/message]

		[message]
			description=Minister Edmond
			message= _ "All Soldiers of Darkness will meet the same fate by my hand."
		[/message]
	[/event]

	[event]
		name=victory
		[message]
			description=Prince Haldric
			message= _ "Those elves are finally at rest. I hope that the curses they laid upon us hold no weight."
		[/message]

		[message]
			description=Lady Jessica
			message= _ "Haldric, you're too paranoid."
		[/message]

		{VARIABLE_OP num_done add 1}

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

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

	[/event]

	[event]
		name=die
		[filter]
			description=Isorfilad
		[/filter]
		[message]
			description=Isorfilad
			message= _ "A curse upon all of your kin that visit this isle."
		[/message]
	[/event]

	[event]
		name=die
		[filter]
			description=Tinoldor
		[/filter]
		[message]
			description=Tinoldor
			message= _ "I wish a blight upon you and yours. May you never see peace."
		[/message]
	[/event]

	[event]
		name=die
		[filter]
			description=Midnight Queen
		[/filter]
		[message]
			description=Midnight Queen
			message= _ "My soul will haunt this place until the end of time! A curse upon you!"
		[/message]
		[set_variable]
			name=queen_awake
			value=0
		[/set_variable]
		[message]
			description=Prince Haldric
			message= _ "Without their Queen the undead are simply fading away!"
		[/message]
		[endlevel]
			result=victory
			bonus=yes
			{CLEAR_VARIABLE queen_awake}
		[/endlevel]
	[/event]

	[event]
	name=die
		[filter]
			team=Undead
		[/filter]
		[filter_second]
			description=Minister Edmond
		[/filter_second]
		[message]
			speaker=second_unit
			message= _ "Back, back to the grave with you!"
		[/message]
	[/event]

	[event]
	name=enemies defeated
		[if]
			[variable]
				name=queen_awake
				numerical_equals=1
			[/variable]
			[then]
				[message]
					description=Lady Jessica
					message= _ "We still have to defeat that Vampire Queen!"
				[/message]
				[objectives]
				side=1
					[objective]
						description= _ "Defeat the Vampire Queen"
						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]
			[/then]
			[else]
				[endlevel]
					result=victory
					bonus=yes
					{CLEAR_VARIABLE queen_awake}
				[/endlevel]
			[/else]
		[/if]

	[/event]

	[event]
		name=time over
		[message]
			description=Prince Haldric
			message= _ "No! The ship that was supposed to pick us up sees that there's still fighting. It's not stopping. We're trapped."
		[/message]
	[/event]
[/scenario]
