[scenario]
	id=Crossing
	#textdomain wesnoth-ei
	name= _ "The Crossing"
	map_data="{campaigns/Eastern_Invasion/maps/The_Crossing}"
	turns=24
	next_scenario=Ogre

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

	{DEFAULT_MUSIC_PLAYLIST}

	{campaigns/Eastern_Invasion/utils/deaths.cfg}

	[side]
	type=Lieutenant
	description=Gweddry
	user_description= _ "Gweddry"
	side=1
	canrecruit=1
	controller=human
	[/side]

	[side]
	type=Revenant
	description=Garnad
	user_description= _ "Garnad"
	side=2
	canrecruit=1
	controller=ai
	recruit=Vampire Bat
	{GOLD 100 150 200}
	[/side]

	[side]
	type=Orcish Warlord
	description=Draka-Kura
	user_description= _ "Draka-Kura"
	side=3
	canrecruit=1
	controller=ai
	recruit=Wolf Rider,Orcish Grunt,Orcish Archer
	{GOLD 150 200 250}
	[/side]

	[side]
	type=Ogre
	description=Grug
	user_description= _ "Grug"
	side=4
	canrecruit=1
	controller=ai
	recruit=Young Ogre
	{GOLD 150 130 100}
		[ai]
			[target]
			side=3
			value=100
			recruitment_pattern=fighter
			[/target]
			{NO_SCOUTS}
		[/ai]
	[/side]

	[event]
	name=prestart
		[objectives]
		side=1
			[objective]
			description= _ "Get Gweddry and Owaec across the river"
			condition=win
			[/objective]
			[objective]
			description= _ "Death of Gweddry"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Dacyn"
			condition=lose
			[/objective]
			[objective]
			description= _ "Death of Owaec"
			condition=lose
			[/objective]
		[/objectives]
	[/event]

	[event]
	name=start
		[recall]
		description=Dacyn
		[/recall]
		[recall]
		description=Owaec
		[/recall]
		[message]
		description=Gweddry
		message= _ "We have come to the Great River. What should we do? Should we attempt to cross it?"
		[/message]
		[message]
		description=Dacyn
		message= _ "We must cross this river. The undead are chasing us, and their hordes are much too great for us to defeat. Reinforcements for the undead will arrive soon. We must be across the river before that happens."
		[/message]
		[message]
		description=Owaec
		message= _ "Across this river lies the Northland. If we can get there, we may be able to get some ogres to help us - but the orcs will definitely attack us before that happens."
		[/message]
		[message]
		description=Grug
		message= _ "Grug say we no help you! We finish must battle orc with!"
		[/message]
		[message]
		description=Draka-Kura
		message= _ "Was that comprehensible to anyone? Silence, foolish ogre. I will deal with you later. Right now there are men trying to cross this river."
		[/message]
		[message]
		description=Grug
		message= _ "Orc foolish! Die you now!"
		[/message]
		[message]
		description=Dacyn
		message= _ "If we show ourselves as enemies of the orcs, they may aid us. But I think we should cross the river before trying to convince these ogres to help."
		[/message]
	[/event]

#define REVENANT X Y
[unit]
type=Revenant
side=2
x={X}
y={Y}
[/unit]
[terrain]
x={X}
y={Y}
letter=C
[/terrain]
#enddef
#define BONESHOOTER X Y
[unit]
type=Bone Shooter
side=2
x={X}
y={Y}
[/unit]
[terrain]
x={X}
y={Y}
letter=C
[/terrain]
#enddef

	[event]
	name=turn 8
		{REVENANT 28 30}
		{REVENANT 30 30}
		{BONESHOOTER 28 31}
#ifdef HARD
		{BONESHOOTER 30 31}
#endif
		[unit]
		type=Lich
		description=Mal-Hakralan
		user_description= _ "Mal-Hakralan"
		side=2
		canrecruit=1
		x=29
		y=31
		[/unit]
		[terrain]
		x,y=29,31
		letter=K
		[/terrain]
		[message]
		description=Dacyn
		message= _ "The undead reinforcements have arrived! We must cross the river immediately!"
		[/message]
#ifdef EASY
		[gold]
		side=2
		amount=500
		[/gold]
#else
#ifdef NORMAL
		[gold]
		side=2
		amount=600
		[/gold]

#else
		[gold]
		side=2
		amount=750
		[/gold]

#endif
#endif
		[allow_recruit]
		side=2
		type=Revenant,Bone Shooter
		[/allow_recruit]
	[/event]

#define CROSSING
[if]
	[variable]
	name=across
	equals=yes
	[/variable]
	[then]
		[message]
		description=Dacyn
		message= _ "Good! We have crossed. Now let's see if we can get the Ogres to join us. They have been convinced to work for the Crown in the past; maybe it can be done again."
		[/message]
		[if]
			[have_unit]
			description=Grug
			[/have_unit]
			[then]
				[message]
				description=Grug
				message= _ "Grug say join you will he."
				[/message]
				#bring grug to your side
				[store_unit]
					[filter]
					description=Grug
					[/filter]
				variable=grug
				kill=yes
				[/store_unit]
				[set_variable]
				name=grug.side
				value=1
				[/set_variable]
				[set_variable]
				name=grug.canrecruit
				value=0
				[/set_variable]
				[unstore_unit]
				variable=grug
				[/unstore_unit]
				[clear_variable]
				name=grug
				[/clear_variable]
				#give you two free ogres
				[unit]
				user_description= _ "Gork"
				side=1
				type=Ogre
				x,y=1,1
				[/unit]
				[unit]
				user_description= _ "Drog"
				side=1
				type=Ogre
				x,y=1,1
				[/unit]
				[allow_recruit]
				type=Young Ogre
				[/allow_recruit]
				[message]
				speaker=narrator
				message= _ "You may now recruit ogres!"
				[/message]
				[endlevel]
				result=victory
				next_scenario=Xenophobia
				bonus=yes
				[/endlevel]
			[/then]
		[/if]
		[endlevel]
		result=victory
		bonus=yes
		[/endlevel]
	[/then]
	[else]
		[message]
		speaker=unit
		message= _ "Hurry up. We must get across before these undead slaughter us!"
		[/message]
		[set_variable]
		name=across
		value=yes
		[/set_variable]
	[/else]
[/if]
#enddef

	#event where you win if you get to the other side
	[event]
	name=moveto
		[filter]
		description=Gweddry
		x=1-44
		y=1-10
		[/filter]
		{CROSSING}
	[/event]

	[event]
	name=moveto
		[filter]
		description=Owaec
		x=1-44
		y=1-10
		[/filter]
		{CROSSING}
	[/event]
[/scenario]
