################################################
#
# Events for Summer Fair
#
# ID 74000 - 74999 is reserved
#
# Satirical Puppet Show ID: 4105
# Dancing bear ID: 4170
#
#################################################
#
# Designed by Johan Andersson
# Written by Sara Wendel-Ortqvist

#Dancing Monkey
character_event = {
	id = 74000
	desc = "EVTDESC74000"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74000 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74000
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 0.5
			trait = charitable
		}
		modifier = {
			factor = 2
			trait = greedy
		}
	}

	option = {
		name = "EVTOPTA74000"
		trigger = {
			NOR = {
				trait = kind
				trait = charitable
				trait = honest
			}
		}
		if = {
			limit = {
				NOR = {
					trait = stressed
					trait = depressed
				}
			}
			random = {
				chance = 10
				add_trait = stressed
				hidden_tooltip = {
					character_event = {
						id = 38282 #Notify Stressed
					}
				}
			}
		}
	}

	option = {
		name = "EVTOPTB74000"
		trigger = {
			OR = {
				trait = kind
				trait = charitable
				trait = honest
			}
			any_vassal = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				OR = {
					trait = kind
					trait = charitable
					trait = honest
				}
			}
		}
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				OR = {
					trait = kind
					trait = charitable
					trait = honest
				}
			}
			opinion = {
				modifier = honest_pos
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTC74000"
		trigger = {
			trait = arbitrary
		}
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}

	option = {
		name = "EVTOPTE74000"
		prestige = 5
		treasury = -5
	}
}

#Archery
character_event = {
	id = 74005
	desc = "EVTDESC74005"
	picture = GFX_evt_jugglers
	
	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin
	
	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		NOT = { trait = paranoid }
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74005 }	
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74005
	}	

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}	
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 0.75
			trait = arbitrary
		}
		
		modifier = {
			factor = 2.5
			trait = gregarious
		}
	}

	option = {
		name = "EVTOPTA74005"
		trigger = {
			NOT = { trait = trusting }
			NOT = { trait = paranoid }
		}
		add_trait = paranoid
	}

	option = {
		name = "EVTOPTC74005"
		trigger = {
			NOT = { trait = charitable }
		}
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}

	option = {
		name = "EVTOPTD74005"
		trigger = {
			NOT = { trait = greedy }
		}
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
			}
			opinion = {
				modifier = charitable_pos
				who = ROOT
				years = 5
			}
		}
		wealth = -5
	}
}

#Jesters
character_event = {
	id = 74010
	desc = "EVTDESC74010"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}			

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74010 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74010
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}	
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 3
			trait = wroth
		}
		
		modifier = {
			factor = 0.8
			trait = kind
		}
		
		modifier = {
			factor = 0.75
			trait = gregarious
		}
	}

	option = {
		name = "EVTOPTA74010"
		trigger = {
			NOR = {
				trait = wroth
				trait = cruel
			}
		}
		prestige = 5
	}

	option = {
		name = "EVTOPTE74010"
		trigger = {
			OR = {
				trait = wroth
				trait = cruel
			}
		}
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}

	option = {
		name = "EVTOPTG74010"
		trigger = {
			trait = charitable
			NOR = {
				trait = wroth
				trait = cruel
			}
		}
		treasury = -10
		prestige = 10
	}
}

#Mummers
character_event = {
	id = 74015
	desc = "EVTDESC74015"
	picture = GFX_evt_jugglers
	
	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin
	
	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			reverse_opinion = { who = ROOT value = 10 } 
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74015 }	
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74015
	}
	
	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 5
			trait = cynical
		}
		modifier = {
			factor = 3
			trait = wroth
		}

		modifier = {
			factor = 0.8
			trait = kind
		}
		modifier = {
			factor = 0.75
			trait = gregarious
		}
	}

	option = {
		name = "EVTOPTA74015"
		trigger = {
			NOT = { trait = gregarious }
		}
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}

	option = {
		name = "EVTOPTD74015"
		piety = 10
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				reverse_opinion = { who = ROOT value = 10 } 
			}
			opinion = {
				modifier = gregarious_neg
				who = ROOT
				years = 2
			}
		}
	}

	option = {
		name = "EVTOPTE74015"
		trigger = {
			NOT = { trait = gregarious }
			NOT = { trait = shy }
		}
		random = {
			chance = 25
			add_trait = gregarious
			hidden_tooltip = {
				character_event = {
					id = 38265 #Notify Gregarious
				}
			}
		}
	}
}

#Summer Fair
character_event = {
	id = 74020
	desc = "EVTDESC74020"
	picture = "GFX_evt_market"
	
	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin
	
	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			NOT = {
				is_priest = yes
			}
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}
		
		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74020 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74020
	}
	
	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 5
			trait = cynical
		}
		
		modifier = {
			factor = 3
			trait = wroth
		}
		
		modifier = {
			factor = 0.75
			trait = gregarious
		}
		
		modifier = {
			factor = 2.5
			trait = charitable
		}
	}

	option = {
		name = "EVTOPTA74020"
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				NOT = {
					is_priest = yes
				}
			}
			opinion = {
				modifier = opinion_angry
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTC74020"
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}
}

#Strolling Players
character_event = {
	id = 74025
	desc = "EVTDESC74025"
	picture = GFX_evt_jugglers
	
	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	is_married = yes
	has_character_flag = summer_fair_begin
	
	trigger = {
		has_character_modifier = holding_summer_fair		
		learning = 10
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			learning = 10
			is_adult = yes
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74025 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74025
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}	
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 0.75
			trait = gregarious
		}
		
		modifier = {
			factor = 2.5
			trait = charitable
		}
	}
	
	option = {
		name = "EVTOPTA74025"
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				learning = 10
				is_adult = yes
			}
			opinion = {
				modifier = opinion_approves
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTB74025"
		trigger = {
			NOT = { has_character_flag = learning_boost_fair }
		}
		change_learning = 1
		set_character_flag = learning_boost_fair
	}

	option = {
		name = "EVTOPTD74025"
		spouse = {
			opinion = {
				modifier = opinion_delighted
				who = ROOT
				years = 5
			}
		}
	}
}

#Jugglers
character_event = {
	id = 74030
	desc = "EVTDESC74030"
	picture = "GFX_evt_jugglers"
	
	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin
	
	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			is_priest = yes
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74030 }	
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74030
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
		
		modifier = {
			factor = 0.75
			trait = cynical
		}
		
		modifier = {
			factor = 5
			trait = honest
		}
	}

	option = {
		name = "EVTOPTA74030"
		prestige = 10
		piety = -10
	}

	option = {
		name = "EVTOPTB74030"
		piety = -5
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_priest = yes
			}
			opinion = {
				modifier = opinion_disapprove
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTD74030"
		prestige = -10
		piety = 5
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_priest = yes
			}
			opinion = {
				modifier = opinion_approves
				who = ROOT
				years = 5
			}
		}
	}
}

#Jumping Jews of Jerusalem
character_event = {
	id = 74035
	desc = "EVTDESC74035"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	religion_group = christian
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		is_heretic = no
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			trait = gregarious
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}			

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}		
		NOT = { has_character_flag = fair_event_74035 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74035
	}

	mean_time_to_happen = {
		days = 360
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}

		modifier = {
			factor = 0.5
			trait = gregarious
		}

		modifier = {
			factor = 1.5
			trait = shy
		}
	}

	option = {
		name = "EVTOPTA74035"
		trigger = {
			NOT = { trait = gregarious }
		}
		treasury = 5
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				trait = gregarious
			}
			opinion = {
				modifier = opinion_disgruntled
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTB74035"
		trigger = {
			NOT = { trait = gregarious }
			OR = {
				trait = wroth
				trait = cruel
			}
		}
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}

	option = {
		name = "EVTOPTC74035"
		if = {
			limit = {
				NOT = { trait = gregarious }
			}
			random = {
				chance = 25
				add_trait = gregarious
				hidden_tooltip = {
					character_event = {
						id = 38265 #Notify Gregarious
					}
				}
			}
		}
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				trait = gregarious
			}
			opinion = {
				modifier = opinion_approves
				who = ROOT
				years = 5
			}
		}
	}
}

#Mages and Divinators visits the fair
character_event = {
	id = 74040
	desc = "EVTDESC74040"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			is_priest = yes
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}			

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}		
		NOT = { has_character_flag = fair_event_74040 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74040
	}

	mean_time_to_happen = {
		days = 240
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
	}

	option = {
		name = "EVTOPTA74040" #Allow them
		trigger = {
			OR = {	
				ai = no
				NOT = { trait = zealous }
			}
		}	
		piety = -5
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_priest = yes
			}
			opinion = {
				modifier = opinion_irritated
				who = ROOT
				years = 5
			}
		}
		if = {
			limit = { trait = zealous }
			remove_trait = zealous
		}
	}
	option = {
		name = "EVTOPTB74040" #Banish them
		piety = 5
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}
}

#Errant monk disturbing the fair
character_event = {
	id = 74042
	desc = "EVTDESC74042"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			is_priest = yes
		}
		capital_scope = {
			NOT = { has_province_modifier = peasants_upset }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74042 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74042
	}

	mean_time_to_happen = {
		days = 240
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
	}

	option = {
		name = "EVTOPTA74042" #Allow him
		trigger = {
			NOT = { trait = zealous }
		}
		piety = -5
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_priest = yes
			}
			opinion = {
				modifier = opinion_irritated
				who = ROOT
				years = 5
			}
		}
	}
	option = {
		name = "EVTOPTB74042" #Banish him
		piety = 5
		capital_scope = {
			add_province_modifier = {
				name = peasants_upset
				duration = 365
			}
		}
	}
}

#Peddler are arrested by Marshal for selling stolen goods
character_event = {
	id = 74044
	desc = "EVTDESC74044"
	picture = GFX_evt_market

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		job_marshal = {
			martial = 12
		}
		any_demesne_province = {
			is_capital = yes
			NOT = {
				has_province_modifier = public_execution
			}
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74044 }	
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74044
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
	}

	option = {
		name = "EVTOPTA74044"
		random_demesne_province = {
			limit = {
				is_capital = yes
			}
			add_province_modifier = {
				name = public_execution
				duration = 1825
			}
		}
		random = {
			chance = 25

			add_trait = cruel
			hidden_tooltip = {
				character_event = {
					id = 38259 #Notify Cruel
				}
			}
		}
	}
	option = {
		name = "EVTOPTB74044"
		treasury = 5
	}
}

#Too many Peasants enter the city
character_event = {
	id = 74045
	desc = "EVTDESC74045"
	picture = GFX_evt_jugglers

	min_age = 20
	capable_only = yes
	prisoner = no
	only_rulers = yes
	has_character_flag = summer_fair_begin

	trigger = {
		has_character_modifier = holding_summer_fair
		any_vassal = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			tier = baron
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_74045 }	
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_74045
	}

	mean_time_to_happen = {
		days = 180
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}	
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}			
	}

	option = {
		name = "EVTOPTA74045" #Tell him to accept the peasants
		ai_chance = {
			factor = 100
		}
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				tier = baron
			}
			opinion = {
				modifier = opinion_angry
				who = ROOT
				years = 5
			}
		}
	}
	option = {
		name = "EVTOPTB74045" #Restrict peasant access
		ai_chance = {
			factor = 5
		}
		random_demesne_province = {
			limit = {
				is_capital = yes
			}
			add_province_modifier = {
				name = restricted_peasant_access
				duration = 730
			}
		}
	}
}

#The summer Fair is over
character_event = {
	id = 74047
	desc = "EVTDESC74047"
	picture = GFX_evt_market

	is_triggered_only = yes

	option = {
		name = "EVTOPTA74047"
		clr_character_flag = prosperity_increase
		remove_character_modifier = holding_summer_fair
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
			clr_character_flag = fair_event_happened
			clr_character_flag = summer_fair_begin
			set_character_flag = recent_summer_fair
			clr_character_flag = fair_event_74000
			clr_character_flag = fair_event_74005
			clr_character_flag = fair_event_74010
			clr_character_flag = fair_event_74015
			clr_character_flag = fair_event_74020
			clr_character_flag = fair_event_74025
			clr_character_flag = fair_event_74030
			clr_character_flag = fair_event_74035
			clr_character_flag = fair_event_74040
			clr_character_flag = fair_event_74042
			clr_character_flag = fair_event_74044
			clr_character_flag = fair_event_74045
			clr_character_flag = fair_event_4105
			clr_character_flag = fair_event_4170
		}
		prestige = 10
		hidden_tooltip = { change_variable = { which = "lifestyle_stewardship" value = 1 } }
		if = {
			limit = {
				OR = {
					NOT = { has_character_flag = fair_mood_boost }
					had_character_flag = {
						flag = fair_mood_boost
						days = 1825
					}
				}
			}
			if = {
				limit = { any_vassal = { leads_faction = faction_prosperity } }
				custom_tooltip = { text = PROSPERITYFACTIONMOODPLUS }
				hidden_tooltip = {
					random_vassal = { limit = { leads_faction = faction_prosperity } set_variable = { which = "faction_mood_increase" value = 2 } }
					character_event = { id = PlusFaction.200 days = 1 } #recalculate faction moods
				}
			}
			set_character_flag = fair_mood_boost
		}
	}
}

character_event = {
	id = 74050
	desc = "EVTDESC74050"
	picture = GFX_evt_jugglers
	
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	has_character_flag = planning_summer_fair
	war = no
	
	trigger = {
		month = 4
		NOT = {
			month = 7
		}
		is_not_busy_trigger = yes
	}
	
	immediate = {
		add_character_modifier = {
			name = holding_summer_fair
			duration = -1
		}
		set_character_flag = summer_fair_begin
		set_character_flag = held_recent_summer_fair
		hidden_tooltip = {
			character_event = { id = 74999 days = 150 }	# Safety catch flag clearing
			add_character_modifier = {
				name = do_not_disturb
				days = 65
				hidden = yes
			}
			character_event = {
				id = 74047
				days = 65
			}
		}
		clr_character_flag = planning_summer_fair
	}
	
	mean_time_to_happen = {
		days = 1
	}

	option = {
		name = "EVTOPTA74050"
	}
}

#stop fair if we go to war.
character_event = {
	id = 74998
	desc = "EVTDESC74998"
	picture = "GFX_evt_market"
	
	prisoner = no
	min_age = 16
	only_rulers = yes
	
	trigger = {
		war = yes
		OR = {
			has_character_modifier = holding_summer_fair
			has_character_flag = planning_summer_fair
		}
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		remove_character_modifier = holding_summer_fair
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
			clr_character_flag = planning_summer_fair
			clr_character_flag = summer_fair_begin
			clr_character_flag = fair_event_happened
			clr_character_flag = prosperity_increase
		}
	}

	option = {
		name = "CURSES"
	}
}

# Safety catch - clears character flags and modifiers
character_event = {
	id = 74999

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		remove_character_modifier = holding_summer_fair
		clr_character_flag = summer_fair_begin
		clr_character_flag = fair_event_happened
		clr_character_flag = prosperity_increase
	}
}

#Satirical Puppet Show
character_event = {
	id = 4105
	desc = "EVTDESC4105"
	picture = GFX_evt_jugglers

	only_playable = yes
	capable_only = yes
	prisoner = no
	war = no
	has_character_flag = summer_fair_begin

	trigger = {
		in_command_trigger = no
		has_character_modifier = holding_summer_fair
		any_vassal = {
			war = no
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			reverse_opinion = { who = ROOT value = 20 }
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}		
		NOT = { has_character_flag = fair_event_4105 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_4105
	}

	mean_time_to_happen = {
		days = 200
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
	}

	option = {
		name = "EVTOPTA4105"
		trigger = {
			NOT = { trait = kind }
			NOT = { trait = gregarious }
		}
		random_vassal = {
			limit = {
				war = no
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				reverse_opinion = {
					who = ROOT
					value = 20
				}
			}
			opinion = {
				modifier = opinion_disgruntled
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTC4105"
		trigger = {
			trait = kind
			NOT = { trait = gregarious }
		}
		random_vassal = {
			limit = {
				war = no
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				reverse_opinion = {
					who = ROOT
					value = 20
				}
			}
			opinion = {
				modifier = opinion_relieved
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTD4105"
		trigger = {
			trait = gregarious
		}
		random_vassal = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				reverse_opinion = {
					who = ROOT
					value = 20
				}
			}
			opinion = {
				modifier = gregarious_pos
				who = ROOT
				years = 5
			}
		}
	}
}

#Performing Bear
character_event = {
	id = 4170
	desc = "EVTDESC4170"
	picture = "GFX_evt_jugglers"

	only_playable = yes
	capable_only = yes
	prisoner = no
	war = no
	has_character_flag = summer_fair_begin

	trigger = {
		in_command_trigger = no
		has_character_modifier = holding_summer_fair
		any_courtier = {
			prisoner = no
			NOT = { trait = incapable }
			NOT = { is_inaccessible_trigger = yes }
			is_adult = yes
			is_female = no
		}
		
		OR = {
			NOT = { has_character_flag = fair_event_happened }
			had_character_flag = {
				flag = fair_event_happened
				days = 3
			}
		}

		had_character_flag = {
			flag = summer_fair_begin
			days = 3
		}
		NOT = { has_character_flag = fair_event_4170 }
	}
	
	immediate = {
		set_character_flag = fair_event_happened
		set_character_flag = fair_event_4170
	}

	mean_time_to_happen = {
		days = 200
		
		modifier = {
			factor = 0.33
			NOT = { has_character_flag = fair_event_happened }
		}
		
		modifier = {
			factor = 1.5
			has_character_flag = fair_event_happened
		}
	}

	option = {
		name = "EVTOPTA4170"
		trigger = {
			NOT = { trait = proud }
			NOT = { trait = craven }
			NOT = { trait = brave }
		}
		random_courtier = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_female = no
			}
			opinion = {
				modifier = opinion_approves
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTC4170"
		trigger = {
			trait = craven
		}
		prestige = -5
	}

	option = {
		name = "EVTOPTD4170"
		trigger = {
			trait = proud
			NOT = { trait = craven }
			NOT = { trait = brave }
		}
		random_courtier = {
			limit = {
				prisoner = no
				NOT = { trait = incapable }
				NOT = { is_inaccessible_trigger = yes }
				is_adult = yes
				is_female = no
			}
			opinion = {
				modifier = opinion_disappointed
				who = ROOT
				years = 5
			}
		}
	}

	option = {
		name = "EVTOPTE4170"
		trigger = {
			trait = brave
		}
		prestige = 5
	}
}

#Capital Prospers -- mod event specifically for summer fairs
character_event = {
	id = 4300
	desc = "EVTDESC4300"
	picture = GFX_evt_market

	only_playable = yes
	capable_only = yes
	prisoner = no
	has_character_flag = summer_fair_begin

	trigger = {
		war = no
		in_command_trigger = no
		has_character_modifier = holding_summer_fair
		NOT = { has_character_flag = prosperity_increase }
		capital_scope = {
			NOR = { 
				has_province_modifier = province_prosperity_2 
				has_province_modifier = prosperity_modifier_3
			}
		}
	}

	mean_time_to_happen = {
		days = 250
		modifier = {
			factor = 2.0
			capital_scope = { has_province_modifier = province_prosperity_1 }
		}
		modifier = {
			factor = 0.75
			capital_scope = { has_province_modifier = province_poverty_1 }
		}
		modifier = {
			factor = 0.5
			capital_scope = { has_province_modifier = province_poverty_2 }
		}
	}

	option = {
		name = "EXCELLENT"
		set_character_flag = prosperity_increase
		capital_scope = {
			prov_prosperity_increase_effect = yes
		}
	}
}
