///////////////////////////////////////////////////////////////////////////////
//	Angry Creature
//	~~~~~~~~~~~~~~
//
//	Description:
//	A hungry creature is hungry.
// 	The player can either fight the creature or feed it to get the tribute
//
//	Rewards:			20000 tribute
//
//	Start date:			20.08.16			By: Boxhead
//	Update date:		27.10.16			By: Boxhead
///////////////////////////////////////////////////////////////////////////////

global AngryCreatureScrollPos = 0
global AngryCreaturePos = 0
global CamPos = 0

global Scroll_AngryCreature = 0
global AngryCreature = 0
global AngryCreatureNotHungry = 0

begin script LC10_AngryCreature
 
start

	AngryCreatureScrollPos = marker at {2220.63,225.46,969.55}
	AngryCreaturePos = marker at {2252.23,226.16,987.35}
	CamPos = marker at {2240.89,232.00,981.84}

	Scroll_AngryCreature = create highlight SILVER name "HELP_TEXT_MULTIPLAYER_TAUNTS_GA_20" remind "HELP_TEXT_CREATURE_CURRENT_SOURCE_09" at {AngryCreatureScrollPos} + {0.00,3.00,0.00}
	AngryCreature = create CREATURE CREATURE_TYPE_JACKAL at {AngryCreaturePos}
	set player 2 creature to AngryCreature
	
	set research ARTEFACT_CREATURE_MAGIC_TYPE_WATER available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_MAGIC_TYPE_LIGHTNING available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_MAGIC_TYPE_FIREBALL available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_MAGIC_TYPE_HEAL available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_ROLE_BUILDER_3 available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_ROLE_GATHERER_3 available to RESEARCH_AVAILABILITY_RESEARCHED player 2
	set research ARTEFACT_CREATURE_ROLE_SOLDIER_3 available to RESEARCH_AVAILABILITY_RESEARCHED player 2

	set creature AngryCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 1.0
	STRENGTH of AngryCreature = 1.0
	ALIGNMENT of AngryCreature = 0.0
	FATNESS of AngryCreature = 0.2
	HEALTH of AngryCreature = 1.0

	disable AngryCreature action availability LA_EAT with LO_PLAYER_VILLAGER
	disable AngryCreature action availability LA_EAT with LO_PLAYER_PLATOON
	disable AngryCreature action availability LA_EAT with LO_ROCKS
	disable AngryCreature action availability LA_EAT with LO_TREES
	disable AngryCreature action availability LA_EAT with LO_TOYS
	disable AngryCreature action availability LA_EAT with LO_POO
	disable AngryCreature action availability LA_EAT with LO_SPELL_ORBS
	disable AngryCreature action availability LA_POO with LO_PLAYER_VILLAGER
	disable AngryCreature action availability LA_POO with LO_PLAYER_PLATOON
	disable AngryCreature action availability LA_POO with LO_PLAYER_DEFENCES
	disable AngryCreature action availability LA_POO with LO_PLAYER_STORAGE_PIT
	disable AngryCreature action availability LA_POO with LO_PLAYER_BUILDING
	disable AngryCreature action availability LA_PLAY
	disable AngryCreature action availability LA_WATER with LO_PLAYER_VILLAGER
	disable AngryCreature action availability LA_WATER with LO_PLAYER_PLATOON
	disable AngryCreature action availability LA_HEAL with LO_OPPONENT_PLATOON
	disable AngryCreature action availability LA_ATTACK with LO_CREATURE_PEN
	disable AngryCreature action availability LA_ATTACK with LO_ROCKS
	disable AngryCreature action availability LA_ATTACK with LO_MINE
	disable AngryCreature action availability LA_ATTACK with LO_ORE_ROCKS
	disable AngryCreature action availability LA_ATTACK with LO_TREES
	disable AngryCreature action availability LA_ATTACK with LO_FIELDS
	disable AngryCreature action availability LA_ATTACK with LO_POO
	disable AngryCreature action availability LA_ATTACK with LO_SPELL_ORBS

	teach AngryCreature all

	set creature AngryCreature role to CR_SOLDIER radius 100 at {AngryCreaturePos}
	
	wait until Scroll_AngryCreature right clicked
	
	delete Scroll_AngryCreature
	
	set AngryCreature focus to {AngryCreatureScrollPos}
	
	run background script LC10_AngryCreature_Intro
	
	
end script LC10_AngryCreature

begin script LC10_AngryCreature_Intro

start

	CinemaIsRunning = 1
	
	set atmos volume 0
	begin cinema
		start music "sleg_withdia" loop 1
		move camera position to {CamPos} time 5
		move camera focus to {AngryCreature} + {0.00,6.00,0.00} time 5
		wait 6 seconds
		move camera position to {CamPos} + {-10.00,5.00,-10.00} time 10
		move camera focus to {AngryCreature} + {0.00,6.00,0.00} time 10
		wait 10 seconds
		move camera position to {CamPos} + {-50.00,55.00,-50.00} time 3
		move camera focus to {AngryCreature} + {0.00,30.00,0.00} time 3
		wait 4 seconds
	end cinema
	set atmos volume 1.0
	
	CinemaIsRunning = 0
	
	Scroll_AngryCreature = create highlight SILVER name "HELP_TEXT_MULTIPLAYER_TAUNTS_GA_20" remind "HELP_TEXT_CREATURE_CURRENT_SOURCE_09" at {AngryCreatureScrollPos} + {0.00,3.00,0.00}
	
	HEALTH of AngryCreature = 1.0
	
	run background script AngryCreatureFoodCheck//if creature is fed
	run background script AngryCreatureQuestCheck//else

end script LC10_AngryCreature_Intro

begin script AngryCreatureActions

start

end script AngryCreatureActions

begin script AngryCreatureFoodCheck

	CreatureFood = 0

start

	begin loop
		CreatureFood = get resource RESOURCE_TYPE_FOOD in AngryCreature
		
		until CreatureFood > 2500
	end loop
	
	AngryCreatureNotHungry = 1

end script AngryCreatureFoodCheck

begin script AngryCreatureQuestCheck

start

	wait until HEALTH of AngryCreature == 0.00 or AngryCreatureNotHungry == 1
	wait 3 seconds
	
	delete Scroll_AngryCreature
	increment tribute by 20000

end script AngryCreatureQuestCheck

//-----------------------------------------------------------------------------
// Angry Creature
//-----------------------------------------------------------------------------