------------------------------------------------Variables------------------------------------------------

require( "package/quests/q_variables_define.lua" );
DebugOut( "Collection quest (file : package/quests/q_collection_quests.lua)" );

------------------------------------------------------------------------------------------------

EventManager
{
	minimum_apparition_delay = 3600,
	maximum_apparition_delay = 7200,	
	
	-- minimumapparitiondelay = 3600,
	-- maximumapparitiondelay = 7200,	

	maximum_apparitions = 2,
	
	time_by_maximum_apparitions = 7200,
	
	-- timebymaximumapparitions = 7200,
	-- NB : le nombre minimum d'apparitions par temps sera timebymaximumapparitiondelay/maximumapparitiondelay à condition que cette valeur soit inférieure à maximumapparitions
}

------------------------------------------------------------------

-------------- Event -------------------------------

--------------------------------- Punctual Events ---------------------------------

------- FOOD ---------

function F_gainfood()
	GainFood( G_gainedfood );
	return true;
end

Event
{
	name = "E_gainfood",
	callback_begin = "F_gainfood",
	can_be_triggered_multiple_times = true,
	random_weight = 1,
}

function F_loosefood()
	-- G_lost_food
	
	GainFood( -GetFoodReserveValue()*0.5 );
	return true;
end

Event
{
	name = "E_loosefood",
	callback_begin = "F_loosefood",
	can_be_triggered_multiple_times = true,
	random_weight = 1.5,
}

------- FEERIE ---------

function F_gainfeerie()
	GainFeerie( G_gainedfeerie );
	return true;
end

-- Event
-- {
	-- name = "E_gainfeerie",
	-- callback_begin = "F_gainfeerie",
	-- can_be_triggered_multiple_times = false,
	-- random_weight = 2,
-- }

function F_loosefeerie()
	GainFeerie( -G_lostfeerie );
	return true;
end

-- Event
-- {
	-- name = "E_loosefeerie",
	-- callback_begin = "F_loosefeerie",
	-- can_be_triggered_multiple_times = false,
	-- random_weight = 2,
-- }

------- MORAL ---------

function F_gainmoral()
	GainCharacterMoral( G_gainedmoral );
	return true;
end

-- Event
-- {
	-- name = "E_gainmoral",
	-- callback_begin = "F_gainmoral",
	-- can_be_triggered_multiple_times = false,
	-- random_weight = 2,
-- }

function F_loosemoral()
	GainCharacterMoral( -G_lostmoral );
	return true;
end

-- Event
-- {
	-- name = "E_loosemoral",
	-- callback_begin = "F_loosemoral",
	-- can_be_triggered_multiple_times = false,
	-- random_weight = 2,
-- }

--------------------------------- -------------- ---------------------------------

--------------------------------- Duration Events ---------------------------------

--( improved : bon pour le joueur || worsen : mauvais pour le joueur ) --

------- XP RATIO ---------

function F_xpgain_improved_begin()
	SetXpRatio( GetXpRatio()*G_xp_improved )
	return true;
end

function F_xpgain_improved_end()
	SetXpRatio( GetXpRatio()/G_xp_improved )
	return true
end

Event
{
	name = "E_xpgain_improved",
	delay = G_event_delay,
	duration = G_event_duration,
	callback_begin = "F_xpgain_improved_begin",
	callback_end = "F_xpgain_improved_end",
	random_weight = 2,
}

function F_xpgain_worsen_begin()
	SetXpRatio( GetXpRatio()/G_xp_worsen )
	return true;
end

function F_xpgain_worsen_end()
	SetXpRatio( GetXpRatio()*G_xp_worsen )
	return true
end

-- Event
-- {
	-- name = "E_xpgain_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_xpgain_worsen_begin",
	-- callback_end = "F_xpgain_worsen_end",
	-- random_weight = 2,
-- }

------- GATHER FACTOR ---------

function F_gatherfactor_improved_begin()
	SetGatherFactorEvent( GetGatherFactorEvent()*G_gather_improved )
	return true;
end

function F_gatherfactor_improved_end()
	SetGatherFactorEvent( GetGatherFactorEvent()/G_gather_improved )
	return true
end

-- Event
-- {
	-- name = "E_gatherfactor_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_gatherfactor_improved_begin",
	-- callback_end = "F_gatherfactor_improved_end",
	-- random_weight = 2,
-- }

function F_gatherfactor_worsen_begin()
	SetGatherFactorEvent( GetGatherFactorEvent()/G_gather_worsen )
	return true;
end

function F_gatherfactor_worsen_end()
	SetGatherFactorEvent( GetGatherFactorEvent()*G_gather_worsen )
	return true
end

-- Event
-- {
	-- name = "E_gatherfactor_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_gatherfactor_worsen_begin",
	-- callback_end = "F_gatherfactor_worsen_end",
	-- random_weight = 2,
-- }

------- WORK FACTOR ---------

function F_workfactor_improved_begin()
	SetWorkFactor( GetWorkFactor()*G_work_improved )
	return true;
end

function F_workfactor_improved_end()
	SetWorkFactor( GetWorkFactor()/G_work_improved )
	return true
end

-- Event
-- {
	-- name = "E_workfactor_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_workfactor_improved_begin",
	-- callback_end = "F_workfactor_improved_end",
	-- random_weight = 2,
-- }

function F_workfactor_worsen_begin()
	SetWorkFactor( GetWorkFactor()/G_work_worsen )
	return true;
end

function F_workfactor_worsen_end()
	SetWorkFactor( GetWorkFactor()*G_work_worsen )
	return true
end

Event
{
	name = "E_workfactor_worsen",
	delay = G_event_delay,
	duration = G_event_duration,
	callback_begin = "F_workfactor_worsen_begin",
	callback_end = "F_workfactor_worsen_end",
	random_weight = 2,
}

------- FEERIE GAIN FACTOR ---------

function F_feeriegainfactor_improved_begin()
	SetFaerieGainedFactorEvent(GetFaerieGainedFactorEvent()*G_feerie_improved )
	return true;
end

function F_feeriegainfactor_improved_end()
	SetFaerieGainedFactorEvent( GetFaerieGainedFactorEvent()/G_feerie_improved )
	return true
end

-- Event
-- {
	-- name = "E_feeriegainfactor_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_feeriegainfactor_improved_begin",
	-- callback_end = "F_feeriegainfactor_improved_end",
	-- random_weight = 2,
-- }

function F_feeriegainfactor_worsen_begin()
	SetFaerieGainedFactorEvent( GetFaerieGainedFactorEvent()/G_feerie_worsen )
	return true;
end

function F_feeriegainfactor_worsen_end()
	SetFaerieGainedFactorEvent( GetFaerieGainedFactorEvent()*G_feerie_worsen )
	return true
end

-- Event
-- {
	-- name = "E_feeriegainfactor_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_feeriegainfactor_worsen_begin",
	-- callback_end = "F_feeriegainfactor_worsen_end",
	-- random_weight = 2,
-- }

------- SOCIALZE MORAL INCREASE ---------

function F_socializemoralincrease_improved_begin()
	SetSocializeMoralIncreaseEvent(GetSocializeMoralIncreaseEvent()*G_socialize_improved )
	return true;
end

function F_socializemoralincrease_improved_end()
	SetSocializeMoralIncreaseEvent( GetSocializeMoralIncreaseEvent()/G_socialize_improved )
	return true
end

-- Event
-- {
	-- name = "E_socializemoralincrease_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_socializemoralincrease_improved_begin",
	-- callback_end = "F_socializemoralincrease_improved_end",
	-- random_weight = 2,
-- }

function F_socializemoralincrease_worsen_begin()
	SetSocializeMoralIncreaseEvent( GetSocializeMoralIncreaseEvent()/G_socialize_worsen )
	return true;
end

function F_socializemoralincrease_worsen_end()
	SetSocializeMoralIncreaseEvent( GetSocializeMoralIncreaseEvent()*G_socialize_worsen )
	return true
end

-- Event
-- {
	-- name = "E_socializemoralincrease_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_socializemoralincrease_worsen_begin",
	-- callback_end = "F_socializemoralincrease_worsen_end",
	-- random_weight = 2,
-- }

------- PASSIVE MORAL ---------

function F_passivemoral_improved_begin()
	SetPassiveMoralEvent(GetPassiveMoralEvent()*G_passivemoral_improved )
	return true;
end

function F_passivemoral_improved_end()
	SetPassiveMoralEvent( GetPassiveMoralEvent()/G_passivemoral_improved )
	return true
end

Event
{
	name = "E_passivemoral_improved",
	delay = G_event_delay,
	duration = G_event_duration,
	callback_begin = "F_passivemoral_improved_begin",
	callback_end = "F_passivemoral_improved_end",
	random_weight = 2,
}

function F_passivemoral_worsen_begin()
	SetPassiveMoralEvent( GetPassiveMoralEvent()/G_passivemoral_worsen )
	return true;
end

function F_passivemoral_worsen_end()
	SetPassiveMoralEvent( GetPassiveMoralEvent()*G_passivemoral_worsen )
	return true
end

-- Event
-- {
	-- name = "E_passivemoral_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_passivemoral_worsen_begin",
	-- callback_end = "F_passivemoral_worsen_end",
	-- random_weight = 2,
-- }

------- PASSIVE SPEED ---------

function F_passivespeed_improved_begin()
	SetPassiveCharacterSpeedEvent(GetPassiveCharacterSpeedEvent()*G_speed_improved )
	return true;
end

function F_passivespeed_improved_end()
	SetPassiveCharacterSpeedEvent( GetPassiveCharacterSpeedEvent()/G_speed_improved )
	return true
end

-- Event
-- {
	-- name = "E_passivespeed_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_passivespeed_improved_begin",
	-- callback_end = "F_passivespeed_improved_end",
	-- random_weight = 2,
-- }

function F_passivespeed_worsen_begin()
	SetPassiveCharacterSpeedEvent( GetPassiveCharacterSpeedEvent()/G_speed_worsen )
	return true;
end

function F_passivespeed_worsen_end()
	SetPassiveCharacterSpeedEvent( GetPassiveCharacterSpeedEvent()*G_speed_worsen )
	return true
end

-- Event
-- {
	-- name = "E_passivespeed_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_passivespeed_worsen_begin",
	-- callback_end = "F_passivespeed_worsen_end",
	-- random_weight = 2,
-- }

------- SPIRIT FEAR FACTOR ---------

function F_spiritfearfactor_improved_begin()
	SetSpiritFearFactorEvent(GetSpiritFearFactorEvent()/G_spirit_improved )
	return true;
end

function F_spiritfearfactor_improved_end()
	SetSpiritFearFactorEvent( GetSpiritFearFactorEvent()*G_spirit_improved )
	return true
end

Event
{
	name = "E_spiritfearfactor_improved",
	delay = G_event_delay,
	duration = G_event_duration,
	callback_begin = "F_spiritfearfactor_improved_begin",
	callback_end = "F_spiritfearfactor_improved_end",
	random_weight = 2,
}

function F_spiritfearfactor_worsen_begin()
	SetSpiritFearFactorEvent( GetSpiritFearFactorEvent()*G_spirit_worsen )
	return true;
end

function F_spiritfearfactor_worsen_end()
	SetSpiritFearFactorEvent( GetSpiritFearFactorEvent()/G_spirit_worsen )
	return true
end

-- Event
-- {
	-- name = "E_spiritfearfactor_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_spiritfearfactor_worsen_begin",
	-- callback_end = "F_spiritfearfactor_worsen_end",
	-- random_weight = 2,
-- }

------- MUSICIAN RESISTANCE FACTOR ---------

function F_musicianresistancefactor_improved_begin()
	SetMusicianResistanceFactor(GetMusicianResistanceFactor()/G_musicianresistance_improved )
	return true;
end

function F_musicianresistancefactor_improved_end()
	SetMusicianResistanceFactor( GetMusicianResistanceFactor()*G_musicianresistance_improved )
	return true
end

-- Event
-- {
	-- name = "E_musicianresistancefactor_improved",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_musicianresistancefactor_improved_begin",
	-- callback_end = "F_musicianresistancefactor_improved_end",
	-- random_weight = 2,
-- }

function F_musicianresistancefactor_worsen_begin()
	SetMusicianResistanceFactor( GetMusicianResistanceFactor()*G_musicianresistance_worsen )
	return true;
end

function F_musicianresistancefactor_worsen_end()
	SetMusicianResistanceFactor( GetMusicianResistanceFactor()/G_musicianresistance_worsen )
	return true
end

-- Event
-- {
	-- name = "E_musicianresistancefactor_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_musicianresistancefactor_worsen_begin",
	-- callback_end = "F_musicianresistancefactor_worsen_end",
	-- random_weight = 2,
-- }

------- HUNGER DECREASE ---------

function F_hungerdecrease_improved_begin()
	SetHungerDecrease(GetHungerDecrease()/G_hunger_improved )
	return true;
end

function F_hungerdecrease_improved_end()
	SetHungerDecrease( GetHungerDecrease()*G_hunger_improved )
	return true
end

Event
{
	name = "E_hungerdecrease_improved",
	delay = G_event_delay,
	duration = G_event_duration,
	callback_begin = "F_hungerdecrease_improved_begin",
	callback_end = "F_hungerdecrease_improved_end",
	random_weight = 2,
}

function F_hungerdecrease_worsen_begin()
	SetHungerDecrease( GetHungerDecrease()*G_hunger_worsen )
	return true;
end

function F_hungerdecrease_worsen_end()
	SetHungerDecrease( GetHungerDecrease()/G_hunger_worsen )
	return true
end

-- Event
-- {
	-- name = "E_hungerdecrease_worsen",
	-- delay = G_event_delay,
	-- duration = G_event_duration,
	-- callback_begin = "F_hungerdecrease_worsen_begin",
	-- callback_end = "F_hungerdecrease_worsen_end",
	-- random_weight = 2,
-- }

--------------------------------- -------------- ----------------------------------