#############################################
#
# Hedge Knights Event Series
#
# Event ID 71000-71999 is reserved
#
#############################################
#Written by Johan Andersson

#Group of Hedge Knights visiting
character_event = {
	id = 71000
	desc = EVTDESC71000	

	is_triggered_only = yes

	only_playable = yes
	min_age = 16
	prisoner = no
	religion_group = christian
	war = no

	picture = GFX_evt_emissary

	trigger = {
		in_command_trigger = no
		is_heretic = no
		NOT = { has_character_flag = hedge_knights_visiting }
		NOT = { has_character_flag = hates_hedge_knights }
		any_courtier = {
			has_job_title = job_chancellor
		}
		NOT = { has_character_flag = in_seclusion }
	}

	weight_multiplier = {
		days = 1
		modifier = {
			factor = 1.25
			trait = gregarious
		}
		modifier = {
			factor = 1.25
			prestige = 100
		}
		modifier = {
			factor = 1.25
			tier = count
		}
		modifier = {
			factor = 0.5
			tier = king
		}
		modifier = {
			factor = 0.2
			tier = emperor
		}
		modifier = {
			factor = 0.8
			trait = stressed
		}
		modifier = {
			factor = 0.8
			trait = depressed
		}
		modifier = {
			factor = 0.75
			trait = lunatic
		}
		modifier = {
			factor = 0.75
			trait = possessed
		}
		modifier = {
			factor = 0.9
			is_ill = yes
		}
		modifier = {
			factor = 0.8
			trait = pneumonic
		}
		modifier = {
			factor = 0.8
			trait = syphilitic
		}
		modifier = {
			factor = 0.5
			trait = leper
		}
		modifier = {
			factor = 0.9
			trait = wounded
		}
		modifier = {
			factor = 0.8
			is_maimed_trigger = yes
		}
		modifier = {
			factor = 0.5
			trait = infirm
		}
		modifier = {
			factor = 0.4
			trait = incapable
		}
		modifier = {
			factor = 0.5
			trait = drunkard
		}
		modifier = {
			factor = 0.5
			trait = has_tuberculosis
		}
		modifier = {
			factor = 0.5
			trait = has_typhoid_fever
		}
		modifier = {
			factor = 0.5
			trait = has_typhus
		}
		modifier = {
			factor = 0.5
			trait = has_bubonic_plague
		}
		modifier = {
			factor = 0.5
			trait = has_measles
		}
		modifier = {
			factor = 0.5
			trait = has_small_pox
		}

	}

	option = {
		name = EVTOPTA71000 #Welcome them with a lavish feast
		trigger = {
			NOT = { trait = shy }
		}
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = gregarious
			}
			modifier = {
				factor = 2
				trait = charitable
			}
			modifier = {
				factor = 0
				trait = greedy
			}
			modifier = {
				factor = 0
				trait = shy
			}
		}
		set_character_flag = hedge_knights_visiting
		treasury = -10
		prestige = 10
		if = {
			limit = {
				not = { trait = gregarious }
			}
			random = {
				chance = 33
				add_trait = gregarious
				hidden_tooltip = {
					character_event = {
						id = 38265 #Notify Gregarious
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTB71000 #Welcome them reluctantly
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				OR = {
					trait = gregarious
					trait = proud
					trait = ambitious
					trait = charitable
				}
			}

		}
		treasury = -5
		set_character_flag = hedge_knights_visiting
	}
	option = {
		name = EVTOPTC71000 #Refuse them Access
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { trait = greedy }
			}
		}
		prestige = -5
		any_courtier = {
			opinion = {
				modifier = tight_ruler
				who = ROOT
			}
		}
		hidden_tooltip = {
			set_character_flag = hates_hedge_knights
		}
	}
}

#Minor Tournament Hedge Knight Injured
character_event = {
	id = 71001
	desc = EVTDESC71001
	picture = GFX_evt_joust

	only_playable = yes
	min_age = 16
	prisoner = no
	has_character_flag = hedge_knights_visiting

	trigger = {
		NOT = {	has_character_flag = hedge_knight_recruited }
		NOT = {	has_character_flag = hedge_knight_woman_seduced	}
	}

	mean_time_to_happen = {
		days = 80
	}

	immediate = {
		clr_character_flag = hedge_knights_visiting
		clr_character_flag = hedge_knight_recruited
		clr_character_flag = hedge_knight_woman_seduced
	}

	option = {
		name = EVTOPTA71001 	# pay for their expenses, and send them on their way
		treasury = -5
		piety = 5

	}
	option = {
		name = EVTOPTB71001 #let them stay at the castle while recovering.
		prestige = -5
		piety = 5
		if = {
			limit = { NOT = { personality_traits = 5 } }
			add_trait = just
		}
	}
}

#One hedge knight distinguishes himself
character_event = {
	id = 71002
	desc = EVTDESC71002
	picture = GFX_evt_joust

	only_playable = yes
	min_age = 16
	prisoner = no
	ai = no
	has_character_flag = hedge_knights_visiting

	trigger =  {
		NOT = {	has_character_flag = hedge_knight_recruited }
		NOT = {	has_character_flag = hedge_knight_woman_seduced	}
	}
	immediate = {
		set_character_flag = hedge_knight_recruited
	}

	mean_time_to_happen = {
		days = 100
		modifier = {
			factor = 0.5
			trait = gregarious
		}
	}

	option = {
		name = EVTOPTA71002  #take him in your service.
		create_character = {
			random_traits = no
			dynasty = random
			female = no
			age = 16
			trait = brave
			trait = ambitious
			trait = humble
			health = 10
			attributes = {
				martial = 10
			}
			culture = ROOT
			religion = ROOT
		}
		treasury = -5
	}
	option = {
		name = EVTOPTB71002 #give him lavish praise.
		prestige = 5
	}
}

#Male courtier insulted by hedge knights
character_event = {
	id = 71003
	desc = EVTDESC71003	
	picture = GFX_evt_joust

	only_playable = yes
	min_age = 16
	prisoner = no
	has_character_flag = hedge_knights_visiting

	trigger = {
	 	any_courtier = {
	 		age = 16
	 		is_female = no
	 		OR = {
	 			trait = cruel
	 			trait = proud
	 			trait = wroth
	 			trait = zealous
	 			trait = envious
	 			prestige = 100
	 		}
	 	}
	}

	mean_time_to_happen = {
		days = 120
		modifier = {
			factor = 0.9
			trait = arbitrary
		}

		modifier = {
			factor = 5
			has_character_flag = hedge_knight_recruited
		}

		modifier = {
			factor = 5
			has_character_flag = hedge_knight_woman_seduced
		}

	}
	option = {
		name = EVTOPTA71003  #Throw them out.
		clr_character_flag = hedge_knights_visiting
		clr_character_flag = hedge_knight_recruited
		clr_character_flag = hedge_knight_woman_seduced
		piety = -10
	}
	option = {
		name = EVTOPTB71003 #Ignore the complaints
	 	random_courtier = {
	 		limit = {
	 			age = 16
	 			is_female = no
	 			OR = {
		 			trait = cruel
		 			trait = proud
		 			trait = wroth
		 			trait = zealous
		 			trait = envious
		 			prestige = 100
		 		}
		 	}
			opinion = {
				modifier = ruler_not_respect_rank
				who = ROOT
				months = 60
			}
	 	}
		if = {
			limit = { any_vassal = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODMINUS }
			hidden_tooltip = {
				random_vassal = { limit = { leads_faction = faction_glory } set_variable = { which = "faction_mood_decrease" value = 1 } }
				character_event = { id = PlusFaction.200 days = 1 }
			}
		}
	}

}

#A young woman has been seduced by a hedge knight
character_event = {
	id = 71004
	desc = EVTDESC71004
	picture = GFX_evt_lovers

	only_playable = yes
	min_age = 16
	prisoner = no
	ai = no
	has_character_flag = hedge_knights_visiting

	trigger = {
		NOT = {	has_character_flag = hedge_knight_recruited }
		NOT = {	has_character_flag = hedge_knight_woman_seduced	}
		any_courtier = {
	 		age = 16
	 		not = { age = 20 }
			has_lover = no
	 		is_female = yes
	 		is_married = no
	 		is_pregnant = no
			fertility = 0.3
	 	}	
	}

	immediate = {
		set_character_flag = hedge_knight_woman_seduced
	}

	mean_time_to_happen = {
		days = 20

		modifier = {
			factor = 5
			has_character_flag = hedge_knight_recruited
		}
	}
	option = {
		name = EVTOPTA71004 #stay


		random_courtier = {
	 		limit = {
	 			age = 16
	 			not = { age = 20 }
	 			is_female = yes
	 			is_married = no
	 			is_pregnant = no
				has_lover = no
	 		}
	 		add_trait = lustful
	 		create_character = {
				random_traits = yes
				dynasty = random
				culture = ROOT
				religion = ROOT
				fertility = 0.6
				female = no
				age = 24
	 		}
			new_character = {
	 			impregnate = PREV
	 			add_lover = PREV
				add_trait = lustful
	 		}
	 	}
	 	piety = -10
	}
	option = {
		name = EVTOPTB71004 #dungeon
		ai_chance = {
			factor = 1
			modifier = {
				factor = 100
				OR = {
					trait = cruel
					trait = zealous
				 }
			}
		}
		random_courtier = {
	 		limit = {
	 			age = 16
	 			not = { age = 20 }
	 			is_female = yes
	 			is_married = no
	 			is_pregnant = no
	 		}
	 		add_trait = lustful
			create_character = {
				random_traits = yes
				dynasty = random
				culture = ROOT
				religion = ROOT
				fertility = 0.6
				female = no
				age = 24
	 		}
			new_character = {
	 			impregnate = PREV
	 			add_lover = PREV
				add_trait = lustful
				opinion = {
					who = ROOT
					modifier = opinion_arrest_attempt
					months = 240
				}
				imprison = root
	 		}
	 	}
	}
}

#Hedge knights leaving
character_event = {
	id = 71005
	desc = EVTDESC71005
	picture = GFX_evt_feast

	only_playable = yes
	min_age = 16
	prisoner = no
	has_character_flag = hedge_knights_visiting

	trigger = {
	 	always = yes
	}
	
	immediate = {
		clr_character_flag = hedge_knights_visiting
		clr_character_flag = hedge_knight_woman_seduced
		clr_character_flag = hedge_knight_recruited
	}

	mean_time_to_happen = {
		days = 40
		modifier = {
			factor = 0.1
			has_character_flag = hedge_knight_recruited
		}
	}
	option = {
		name = EVTOPTA71005 #give them a farewell feast
		prestige = 10
		treasury = -10

	}
	option = {
		name = EVTOPTB71005 #let them leave quitely
		prestige = -5
	}
}

#Marshal has arrested a hedge knight
character_event = {
	id = 71006
	desc = EVTDESC71006
	picture = GFX_evt_melee

	is_triggered_only = yes

	only_playable = yes
	prisoner = no
	religion_group = christian
	war = no

	trigger = {
		in_command_trigger = no
		is_heretic = no
		NOT = { has_character_flag = hedge_knights_visiting }
		NOT = { has_character_flag = hedge_knight_arrested_event }
		any_courtier = {
			has_job_title = job_marshal
		}
	}
	
	immediate = {
		set_character_flag = hedge_knight_arrested_event
	}

	option = {
		name = EVTOPTA71006  #order him released
		job_marshal = {
			prestige = -25
			opinion = {
				modifier = marshal_overruled
				who = ROOT
			}
		}
		piety = 10
		clr_character_flag = hates_hedge_knights
	}
	option = {
		name = EVTOPTB71006 #it is not my concern
		job_marshal = {
			prestige = 25
		}
		prestige = 25
		piety = -10
		set_character_flag = hates_hedge_knights
	}
}
	