﻿namespace = ep3_governor_yearly

##################################################
#	EP3 Governor Events
#	by Jason Cantalini


#####################################
# Pastures New						#
# by Jason Cantalini				#
# 3001	 							#
#####################################

#Your newly bought lands and the poor local governor inspire you to... avarice
ep3_governor_yearly.3001 = {
	type = character_event
	title = ep3_governor_yearly.3001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
					NOT = { has_trait = cynical }
				}
				desc = ep3_governor_yearly.3001.desc_christian
			}
			desc = ep3_governor_yearly.3001.desc_other
		}
		desc = ep3_governor_yearly.3001.desc_mid
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = { has_cultural_pillar = language_greek }
				}
				desc = ep3_governor_yearly.3001.desc_greek
			}
			desc = ep3_governor_yearly.3001.desc_non_greek
		}
		desc = ep3_governor_yearly.3001.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_garden
				}
				desc = ep3_governor_yearly.3001.desc_garden
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_garden_leisure
				}
				desc = ep3_governor_yearly.3001.desc_garden_leisure
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_garden_fruit
				}
				desc = ep3_governor_yearly.3001.desc_garden_fruit
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_grazing_land
				}
				desc = ep3_governor_yearly.3001.desc_grazing_land
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_horse_pasture
				}
				desc = ep3_governor_yearly.3001.desc_horse_pasture
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_camel_pasture
				}
				desc = ep3_governor_yearly.3001.desc_camel_pasture
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_grain_field
				}
				desc = ep3_governor_yearly.3001.desc_grain_field
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_vineyard
				}
				desc = ep3_governor_yearly.3001.desc_vineyard
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_olive
				}
				desc = ep3_governor_yearly.3001.desc_olive
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_silk
				}
				desc = ep3_governor_yearly.3001.desc_silk
			}
			triggered_desc = {
				trigger = {
					has_character_flag = domicile_new_built_tea
				}
				desc = ep3_governor_yearly.3001.desc_tea
			}
		}
	}
	theme = administrative
	override_background = {
		trigger = {
			OR = {
				has_character_flag = domicile_new_built_garden
				has_character_flag = domicile_new_built_garden_leisure
				has_character_flag = domicile_new_built_garden_fruit
			}
		}
		reference = garden
	}
	override_background = {
		trigger = {
			OR = {
				has_character_flag = domicile_new_built_garden
				has_character_flag = domicile_new_built_garden_leisure
				has_character_flag = domicile_new_built_garden_fruit
			}
		}
		reference = garden
	}
	override_background = {
		trigger = {
			OR = {
				has_character_flag = domicile_new_built_grazing_land
				has_character_flag = domicile_new_built_horse_pasture
				has_character_flag = domicile_new_built_camel_pasture
			}
			scope:root_domicile_province = {
				OR = {
					terrain = drylands
					terrain = desert
					terrain = desert_mountains
					terrain = oasis
					terrain = floodplains
				}
			}
		}
		reference = drylands
	}
	override_background = {
		trigger = {
			OR = {
				has_character_flag = domicile_new_built_grazing_land
				has_character_flag = domicile_new_built_horse_pasture
				has_character_flag = domicile_new_built_camel_pasture
			}
			scope:root_domicile_province = {
				OR = {
					terrain = plains
					terrain = farmlands
					terrain = wetlands
					terrain = jungle
				}
			}
		}
		reference = plains
	}
	override_background = {
		trigger = {
			OR = {
				has_character_flag = domicile_new_built_grazing_land
				has_character_flag = domicile_new_built_horse_pasture
				has_character_flag = domicile_new_built_camel_pasture
			}
			scope:root_domicile_province = {
				OR = {
					terrain = mountains
					terrain = hills
					terrain = forest
					terrain = taiga
				}
			}
		}
		reference = ep2_travel_settlement_hills
	}
	#Farm/orchard type ones
	override_background = {
		trigger = {
			NOR = {
				has_character_flag = domicile_new_built_grazing_land
				has_character_flag = domicile_new_built_horse_pasture
				has_character_flag = domicile_new_built_camel_pasture
				has_character_flag = domicile_new_built_garden
				has_character_flag = domicile_new_built_garden_leisure
				has_character_flag = domicile_new_built_garden_fruit
			}
			scope:root_domicile_province = {
				OR = {
					terrain = desert
					terrain = desert_mountains
					terrain = drylands
					terrain = oasis
					terrain = floodplains
				}
			}
		}
		reference = ep2_travel_settlement_desert
	}
	override_background = {
		trigger = {
			NOR = {
				has_character_flag = domicile_new_built_grazing_land
				has_character_flag = domicile_new_built_horse_pasture
				has_character_flag = domicile_new_built_camel_pasture
				has_character_flag = domicile_new_built_garden
				has_character_flag = domicile_new_built_garden_leisure
				has_character_flag = domicile_new_built_garden_fruit
			}
			scope:root_domicile_province = {
				NOR = {
					terrain = desert
					terrain = desert_mountains
					terrain = drylands
					terrain = oasis
					terrain = floodplains
				}
			}
		}
		reference = ep2_travel_settlement_farm
	}

	left_portrait = {
		character = root
		animation = happy_teacher
	}
	lower_right_portrait = {
		character = scope:governor
	}

	cooldown = {
		years = 10
	}

	trigger = {
		has_ep3_dlc_trigger = yes
		government_has_flag = government_is_administrative
		any_held_title = {
			is_noble_family_title = yes
		}
		domicile.domicile_location.county.holder = {
			government_has_flag = government_is_administrative
			governor_efficiency <= 0.75
			NOR = {
				this = root
				liege ?= root
				top_liege = root
				this = root.top_liege
				is_at_war_with = root
				root = {
					has_dread_level_towards = {
						target = prev
						level >= 2
					}
				}
			}
			highest_held_title_tier >= root.highest_held_title_tier
			highest_held_title_tier >= tier_duchy
		}
		is_available_allow_travelling = yes
		age >= 14
	}

	immediate = {
		domicile.domicile_location = {
			save_scope_as = root_domicile_province
			duchy = {
				save_scope_as = target_theme
			}
		}
		domicile.domicile_location.county.holder = {
			save_scope_as = governor
		}
		save_scope_as = landlord
	}

	#The governor is useless! Time to snap up lots of land
	option = {
		name = ep3_governor_yearly.3001.a
		flavor = ep3_governor_yearly.3001.a.flavor

		custom_tooltip = ep3_governor_yearly.3001.a_govs_low
		change_influence = minor_influence_loss
		
		remove_short_term_gold = medium_gold_value

		#Gotta be a shark if you want hella real domicile
		duel = {
			skills = { stewardship intrigue }
			target = scope:governor
			60 = { #The governor is useless and you are a great landlord
				desc = ep3_governor_yearly.3001.a_success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				modifier = {
					influence_level >= 3
					add = 20
				}
				modifier = {
					influence_level >= 4
					add = 40
				}
				modifier = {
					governor_efficiency >= 1.25
					add = 20
				}
				
				send_interface_toast = {
					title = ep3_governor_yearly.3001.a_success
					left_icon = root
					right_icon = scope:governor
					house = {
						add_house_modifier = {
							modifier = vast_tracts_of_land_modifier
							years = 50
						}
					}
					if = {
						limit = {
							has_lifestyle = intrigue_lifestyle
						}
						add_intrigue_lifestyle_xp = medium_lifestyle_xp
					}
					else = {
						add_stewardship_lifestyle_xp = medium_lifestyle_xp
					}
				}
			}
			40 = { #You look like a treasonous fool
				desc = ep3_governor_yearly.3001.a_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				modifier = {
					influence_level <= 1
					add = 20
				}
				modifier = {
					governor_efficiency <= 0.75
					add = 20
				}
				send_interface_toast = {
					title = ep3_governor_yearly.3001.a_failure
					left_icon = root
					right_icon = scope:governor
					add_prestige = minor_prestige_loss
					custom_tooltip = ep3_governor_yearly.3001.b_gov_response
					#governor chooses how to react
					scope:governor = {
						trigger_event = {
							id = ep3_governor_yearly.3002
							days = 30
						}
					}
				}
				#keep track of how much land the governor notices missing
				add_character_flag = vast_lands_stolen
			}
		}
		
		stress_impact = {
			greedy = minor_stress_impact_loss
			content = major_stress_impact_gain
			humble = medium_stress_impact_gain
			just = major_stress_impact_gain
			generous = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = 1
				ai_boldness = 1
				ai_honor = -1
			}
			modifier = {
				add = -100
				OR = {
					intrigue <= low_skill_rating
					stewardship <= low_skill_rating
					AND = {
						intrigue <= medium_skill_rating
						stewardship <= medium_skill_rating
					}
				}
			}
			modifier = {
				add = 100
				OR = {
					intrigue >= very_high_skill_rating
					stewardship >= very_high_skill_rating
					AND = {
						intrigue >= decent_skill_rating
						stewardship >= decent_skill_rating
					}
				}
			}
			modifier = {
				add = -100
				scope:governor = {
					OR = {
						intrigue >= very_high_skill_rating
						stewardship >= very_high_skill_rating
						AND = {
							intrigue >= medium_skill_rating
							stewardship >= medium_skill_rating
						}
					}
				}
			}
			modifier = {
				add = -100
				scope:governor = {
					OR = {
						intrigue <= low_skill_rating
						stewardship <= low_skill_rating
						AND = {
							intrigue <= medium_skill_rating
							stewardship <= medium_skill_rating
						}
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = humble
					has_trait = just
					has_trait = generous
					has_trait = patient
					short_term_gold <= medium_gold_value
					AND = {
						intrigue <= low_skill_rating
						stewardship <= low_skill_rating
					}
				}
			}
		}
	}
	#Sneak yourself some tenants you maybe shouldn't get
	option = {
		name = ep3_governor_yearly.3001.b
		flavor = ep3_governor_yearly.3001.b.flavor
		house = {
			add_house_modifier = {
				modifier = productive_lands_modifier
				years = 50
			}
		}
		if = {
			limit = {
				has_lifestyle = intrigue_lifestyle
			}
			add_intrigue_lifestyle_xp = minor_lifestyle_xp
		}
		else = {
			add_stewardship_lifestyle_xp = minor_lifestyle_xp
		}
		remove_short_term_gold = minor_gold_value
		change_influence = miniscule_influence_loss
		custom_tooltip = ep3_governor_yearly.3001.b_gov_response
		#governor chooses how to react
		scope:governor = {
			trigger_event = {
				id = ep3_governor_yearly.3002
				days = 30
			}
		}
		
		stress_impact = {
			content = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			just = medium_stress_impact_gain
			patient = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = 1
				ai_boldness = 1
				ai_honor = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = humble
					has_trait = just
					has_trait = patient
				}
			}
		}
	}
	#Offer help to the governor to stop other landlords
	option = {
		name = ep3_governor_yearly.3001.c
		flavor = ep3_governor_yearly.3001.c.flavor

		change_influence = minor_influence_gain
		increase_governance_effect = { VALUE = 10 }
		scope:governor = {
			increase_governance_effect = { VALUE = 5 }
		}
		reverse_add_opinion = {
			target = scope:governor
			modifier = grateful_opinion
			opinion = 20
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			arrogant = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = -1
				ai_boldness = -1
				ai_honor = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = arbitrary
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}
	}
}

#####################################
# Taxpayers to Tenants				#
# by Jason Cantalini				#
# 3002	 							#
#####################################

scripted_trigger ep3_governor_yearly_3002_tax_farmer_trigger = {
	age >= 18
	is_available = yes
	save_temporary_scope_as = tax_farmer
	root.faith = {
		has_dominant_ruling_gender = scope:tax_farmer
	}
	NOT = {
		this = root.cp:councillor_court_chaplain
	}
}

#A landholder is snapping up your taxpayers' properties!
ep3_governor_yearly.3002 = {
	type = character_event
	title = ep3_governor_yearly.3002.t
	desc =  {
		desc = ep3_governor_yearly.3002.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:tax_farmer.culture = { has_cultural_pillar = language_greek }
				}
				desc = ep3_governor_yearly.3002_insult_greek
			}
			triggered_desc = {
				trigger = {
					scope:tax_farmer.culture = { has_cultural_pillar = language_armenian }
					scope:landlord = {
						is_female = no
					}
				}
				desc = ep3_governor_yearly.3002_insult_armenian
			}
			desc = ep3_governor_yearly.3002_insult_generic
		}
		desc = ep3_governor_yearly.3002.desc_mid
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:landlord = { has_character_flag = vast_lands_stolen }
				}
				desc = ep3_governor_yearly.3002_half_duchy
			}
			desc = ep3_governor_yearly.3002_some_of_duchy
		}
		desc = ep3_governor_yearly.3002.desc_outro
	}
			
	theme = administrative
	override_background = {
		reference = study
	}
	left_portrait = {
		character = root
		animation = reading
		camera = camera_event_left_forward
	}
	right_portrait = {
		character = scope:tax_farmer
		animation = debating
	}
	lower_right_portrait = {
		character = scope:landlord
	}

	trigger = {
		scope:landlord = {
			is_alive = yes
		}
	}

	immediate = {
		#need to grab some mook to be the face of tax collection
		if = {
			limit = {
				any_vassal_or_below = {
					OR = {
						any_held_title = {
							this = scope:root_domicile_province.barony
						}
						any_vassal = {
							any_held_title = {
								this = scope:root_domicile_province.barony
							}
						}
					}
					age >= 18
					is_available = yes
					NOR = {
						government_has_flag = government_is_theocracy
						this = root.cp:councillor_court_chaplain
						this = scope:landlord
					}
				}
			}
			random_vassal_or_below = {
				limit = {
					OR = {
						any_held_title = {
							this = scope:root_domicile_province.barony
						}
						any_vassal = {
							any_held_title = {
								this = scope:root_domicile_province.barony
							}
						}
					}
					age >= 18
					is_available = yes
					NOR = {
						government_has_flag = government_is_theocracy
						this = root.cp:councillor_court_chaplain
						this = scope:landlord
					}
				}
				save_scope_as = tax_farmer
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:tax_farmer
				}
			}
			top_liege = {
				random_vassal = {
					limit = {
						is_landless_administrative = yes
						age >= 18
						is_available = yes
						this != scope:landlord
						domicile.domicile_location.duchy = {
							this = scope:target_theme
						}
					}
					save_scope_as = tax_farmer
				}
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:tax_farmer
				}
			}
			random_courtier_or_guest = {
				limit = { ep3_governor_yearly_3002_tax_farmer_trigger = yes }
				save_scope_as = tax_farmer
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:tax_farmer
				}
			}
			random_pool_character = {
				province = root.capital_province
				limit = { ep3_governor_yearly_3002_tax_farmer_trigger = yes }
				save_scope_as = tax_farmer
			}
		}
		if = {
			limit = {
				NOT = {
					exists = scope:tax_farmer
				}
			}
			create_character = {
				template = estate_owner_character
				location = root.capital_province
				save_scope_as = tax_farmer
			}
			scope:tax_farmer = {
				add_character_flag = temp_character
			}
		}
	}

	#I HAVE THE INFLUENCE TO SEE HIS ASS PUT IN JAIL
	option = {
		trigger = {
			OR = {
				influence_level >= 3
				scope:landlord = {
					is_landed = no
				}
			}
		}
		name = ep3_governor_yearly.3002.a
		flavor = ep3_governor_yearly.3002.a.flavor
		reason = influence_level
		#You have to exert yourself more to frame someone who didn't grab much land
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			change_influence = minor_influence_loss
		}
		else = {
			change_influence = medium_influence_loss
		}

		#downgrade the landlord's lands from what they should be - will be actually changed in mirror event
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
		}
		else = {
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = some_smallholds_modifier
						years = 50
					}
				}
			}
		}
		#He's a criminal now
		add_opinion = {
			modifier = stolen_land_opinion
			target = scope:landlord
		}
		if = {
			limit = {
				can_set_relation_rival_trigger = { CHARACTER = scope:landlord }
			}
			if = {
				limit = { has_relation_potential_rival = scope:landlord
				}
				add_character_flag = governor_becomes_rival
			}
			else = {
				add_character_flag = governor_becomes_potential_rival
				show_as_tooltip = {
					progress_towards_rival_effect = {
						REASON = rival_accused_of_stealing_land
						CHARACTER = scope:landlord
						OPINION = 0
					}
				}
				reverse_add_opinion = {
					modifier = angry_opinion
					target = scope:landlord
					opinion = -30
				}
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:landlord
				modifier = angry_opinion
				opinion = -30
			}
		}
		add_character_flag = governor_accuses_crime
		
		
		stress_impact = {
			vengeful = minor_stress_impact_loss
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			humble = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_honor = -1
				ai_vengefulness = 1
			}
			modifier = {
				factor = 3
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = honest
					has_trait = forgiving
					has_trait = compassionate
					has_trait = patient
					has_trait = humble
					influence <= minor_influence_value
				}
			}
		}
	}
	#You're gonna be mean to the peasants regardless
	option = {
		trigger = {
			OR = {
				dread >= 40
				has_trait = sadistic
				has_trait = arbitrary
			}
		}
		name = ep3_governor_yearly.3002.b
		flavor = ep3_governor_yearly.3002.b.flavor

		scope:root_domicile_province.county = {
			add_county_modifier = {
				modifier = taxed_and_pressganged_tenants_modifier
				years = 10
			}
		}
		add_dread = minor_dread_gain
		add_character_flag = governor_uses_force
		#downgrade landlord's new lands again
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
		}
		else = {
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = some_smallholds_modifier
						years = 50
					}
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			content = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = content
					has_trait = generous
					has_trait = forgiving
					has_trait = just
				}
			}
		}
	}
	#You can try to make a scandal of this to save some face
	option = {
		name = ep3_governor_yearly.3002.c
		flavor = ep3_governor_yearly.3002.c.flavor
		
		#governor loses more or less governor efficiency based on scale of lands
		#Show correct amount of lands that landlord got
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			add_character_flag = {
				flag = ep3_governor_yearly_3002_landlord_wins
				years = 10
			}
			custom_tooltip = ep3_governor_yearly.3000_governance_loss
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = vast_tracts_of_land_modifier
						years = 50
					}
				}
			}
		}
		else = {
			add_character_flag = {
				flag = ep3_governor_yearly_3002_landlord_fight
				years = 10
			}
			custom_tooltip = ep3_governor_yearly.3000_miniscule_governance_loss
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
		}

		#Embarrass the landlord
		scope:landlord = {
			add_prestige = minor_prestige_loss
		}

		reverse_add_opinion = {
			modifier = annoyed_opinion
			target = scope:landlord
			opinion = -20
		}
		add_character_flag = governor_scandalizes

		stress_impact = {
			forgiving = minor_stress_impact_gain
			generous = miniscule_stress_impact_gain
			arbitrary = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_honor = 0.5
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = arbitrary
					has_trait = forgiving
				}
			}
		}
	}
	#Well played, landholder. Well played.
	option = {
		name = ep3_governor_yearly.3002.d
		flavor = ep3_governor_yearly.3002.d.flavor

		#governor loses more or less governor efficiency based on scale of lands
		#Show correct amount of lands that landlord got
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			add_character_flag = {
				flag = ep3_governor_yearly_3002_landlord_dominates
				years = 10
			}
			custom_tooltip = ep3_governor_yearly.3000_major_governance_loss
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = vast_tracts_of_land_modifier
						years = 50
					}
				}
			}
		}
		else = {
			add_character_flag = {
				flag = ep3_governor_yearly_3002_landlord_wins
				years = 10
			}
			custom_tooltip = ep3_governor_yearly.3000_governance_loss
			show_as_tooltip = {
				scope:landlord.house = {
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
		}
		change_influence = minor_influence_gain
		scope:landlord = {
			add_opinion = {
				modifier = pleased_opinion
				target = root
				opinion = 20
			}
		}
		add_character_flag = governor_backs_down

		stress_impact = {
			vengeful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
			greedy = miniscule_stress_impact_gain
			arrogant = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_vengefulness = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = vengeful
					has_trait = arrogant
					has_trait = wrathful
					has_trait = diligent
				}
			}
		}
	}
	after = {
		#Get rid of a guy we just created
		if = {
			limit = {
				scope:tax_farmer = {
					has_character_flag = temp_character
				}
				#but only if root isn't a player with watchful eyes of flesh
				is_ai = yes
			}
			scope:tax_farmer = {
				silent_disappearance_effect = yes
			}
		}
		#mirror letter event to end chain
		scope:landlord = {
			trigger_event = {
				id = ep3_governor_yearly.3003
				days = 1
			}
		}
	}
}

# 3003
#The governor has a reply for you
ep3_governor_yearly.3003 = {
	type = letter_event
	opening = ep3_governor_yearly.3003.t
	desc = {
		first_valid = {
			#desc is based on governor's response
			triggered_desc = {
				trigger = {
					scope:governor = { has_character_flag = governor_accuses_crime }
				}
				desc = ep3_governor_yearly.3003.desc_accused_of_crime
			}
			triggered_desc = {
				trigger = {
					scope:governor = { has_character_flag = governor_uses_force }
				}
				desc = ep3_governor_yearly.3003.desc_force_used
			}
			triggered_desc = {
				trigger = {
					scope:governor = { has_character_flag = governor_scandalizes }
				}
				desc = ep3_governor_yearly.3003.desc_scandal
			}
			triggered_desc = {
				trigger = {
					scope:governor = { has_character_flag = governor_backs_down }
				}
				desc = ep3_governor_yearly.3003.desc_backs_down
			}
		}
	}
	sender = scope:governor
	
	trigger = {
		scope:governor = {
			OR = {
				has_character_flag = governor_accuses_crime
				has_character_flag = governor_uses_force
				has_character_flag = governor_scandalizes
				has_character_flag = governor_backs_down
			}
			is_alive = yes
		}
	}

	immediate = {
		#Need to show effects from mirror event and potentially downgrade the landlord's new lands modifier
		if = {
			limit = {
				scope:governor = { has_character_flag = governor_accuses_crime }
			}
			#Need to actually do the modifier switch, since the last event doesn't
			if = {
				limit = {
					scope:landlord = {
						has_character_flag = vast_lands_stolen
					}
				}
				scope:landlord.house = {
					remove_house_modifier = vast_tracts_of_land_modifier
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
			else = {
				scope:landlord.house = {
					remove_house_modifier = productive_lands_modifier
					add_house_modifier = {
						modifier = some_smallholds_modifier
						years = 50
					}
				}
			}
			show_as_tooltip = {
				scope:governor = {
					add_opinion = {
						modifier = stolen_land_opinion
						target = scope:landlord
					}
				}
				if = {
					limit = {
						scope:governor = { has_character_flag = governor_becomes_rival }
					}
					scope:governor = {
						set_relation_rival = {
							target = root
							reason = rival_accused_of_stealing_land
						}
					}
				}
				else_if = {
					limit = {
						scope:governor = { has_character_flag = governor_becomes_potential_rival }
					}
					scope:governor = {
						progress_towards_rival_effect = {
							REASON = rival_accused_of_stealing_land
							CHARACTER = scope:landlord
							OPINION = 0
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:governor = { has_character_flag = governor_uses_force }
			}
			if = {
				limit = {
					scope:landlord = {
						has_character_flag = vast_lands_stolen
					}
				}
				scope:landlord.house = {
					remove_house_modifier = vast_tracts_of_land_modifier
					add_house_modifier = {
						modifier = productive_lands_modifier
						years = 50
					}
				}
			}
			else = {
				scope:landlord.house = {
					remove_house_modifier = productive_lands_modifier
					add_house_modifier = {
						modifier = some_smallholds_modifier
						years = 50
					}
				}
			}
			reverse_add_opinion = {
				modifier = angry_opinion
				target = scope:governor
				opinion = -20
			}
			show_as_tooltip = {
				scope:root_domicile_province.county = {
					add_county_modifier = {
						modifier = taxed_and_pressganged_tenants_modifier
						years = 10
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:governor = { has_character_flag = governor_scandalizes }
			}
			add_prestige = minor_prestige_loss
			reverse_add_opinion = {
				modifier = angry_opinion
				target = scope:governor
				opinion = -20
			}
		}
	}

	option = {
		name = {
			trigger = {
				scope:governor = { has_character_flag = governor_accuses_crime }
			}
			text = ep3_governor_yearly.3003.a_accused_of_crime
		}
		name = {
			trigger = {
				scope:governor = { has_character_flag = governor_uses_force }
			}
			text = ep3_governor_yearly.3003.a_force_used
		}
		name = {
			trigger = {
				scope:governor = { has_character_flag = governor_accuses_crime }
			}
			text = ep3_governor_yearly.3003.a_accused_of_crime
		}
		name = {
			trigger = {
				scope:governor = { has_character_flag = governor_backs_down }
			}
			text = ep3_governor_yearly.3003.a_backs_down
		}
		if = {
			limit = {
				scope:governor = { has_character_flag = governor_backs_down }
			}
			#give landlord some prestige because he got away with his shenanigans
			add_prestige = miniscule_prestige_gain
		}

		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_sociability = 0.25
			}
		}
	}
	after = {
		#clean up flags from the event chain
		if = {
			limit = {
				scope:landlord = {
					has_character_flag = vast_lands_stolen
				}
			}
			scope:landlord = {
				remove_character_flag = vast_lands_stolen
			}
		}
		if = {
			limit = {
				scope:governor = {
					has_character_flag = governor_accuses_crime
				}
			}
			scope:governor = {
				remove_character_flag = governor_accuses_crime
			}
		}
		if = {
			limit = {
				scope:governor = {
					has_character_flag = governor_uses_force
				}
			}
			scope:governor = {
				remove_character_flag = governor_uses_force
			}
		}
		if = {
			limit = {
				scope:governor = {
					has_character_flag = governor_scandalizes
				}
			}
			scope:governor = {
				remove_character_flag = governor_scandalizes
			}
		}
		if = {
			limit = {
				scope:governor = {
					has_character_flag = governor_backs_down
				}
			}
			scope:governor = {
				remove_character_flag = governor_backs_down
			}
		}
	}
}

#####################################
# Still, the Basileus Fights		#
# by Jason Cantalini				#
# 3010	 							#
#####################################

#A governor considers how to react to the emperor's longstanding, dragged-out war
ep3_governor_yearly.3010 = {
	type = character_event
	title = ep3_governor_yearly.3010.t
	desc = {
		desc = ep3_governor_yearly.3010.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:emperor = {
						is_defender_in_war = scope:war
					}
				}
				desc = ep3_governor_yearly.3010.desc_defender
			}
			desc = ep3_governor_yearly.3010.desc_attacker
		}
		desc = ep3_governor_yearly.3010.desc_mid
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						AND = {
							scope:emperor = {
								is_defender_in_war = scope:war
							}
							scope:war = {
								defender_war_score > 20
							}
						}
						AND = {
							scope:emperor = {
								is_attacker_in_war = scope:war
							}
							scope:war = {
								attacker_war_score > 20
							}
						}
					}
				}
				desc = ep3_governor_yearly.3010.desc_winning
			}
			triggered_desc = {
				trigger = {
					OR = {
						AND = {
							scope:emperor = {
								is_defender_in_war = scope:war
							}
							scope:war = {
								defender_war_score < -20
							}
						}
						AND = {
							scope:emperor = {
								is_attacker_in_war = scope:war
							}
							scope:war = {
								attacker_war_score < -20
							}
						}
					}
				}
				desc = ep3_governor_yearly.3010.desc_losing
			}
			desc = ep3_governor_yearly.3010.desc_middling
		}
	}
			
	theme = emperor
	override_background = {
		reference = battlefield
	}
	override_effect_2d = {
   		reference = flies	
   	}
	left_portrait = {
		character = scope:emperor
		triggered_animation = {
			trigger = {
				scope:emperor = {
					is_defender_in_war = scope:war
				}
			}
			animation = stayback
		}
		triggered_animation = {
			trigger = {
				scope:emperor = {
					is_attacker_in_war = scope:war
				}
			}
			animation = inspect_weapon
		}
		camera = camera_event_very_left
	}
	right_portrait = {
		character = scope:foe
		triggered_animation = {
			trigger = {
				scope:emperor = {
					is_defender_in_war = scope:war
				}
			}
			animation = aggressive_mace
		}
		triggered_animation = {
			trigger = {
				scope:emperor = {
					is_attacker_in_war = scope:war
				}
			}
			animation = stayback
		}
		camera = camera_event_very_right
	}

	trigger = {
		is_governor = yes
		is_imprisoned = no
		exists = scope:war
		liege ?= {
			any_character_war = {
				this = scope:war
				attacker_war_score < 80
				defender_war_score < 80
			}
		}
		is_at_war = no
		NOT = {
			any_ally = {
				is_at_war_with = liege
				any_character_war = {
					this = scope:war
				}
			}
		}
		age >= 12
	}

	immediate = {
		save_scope_as = governor
		liege = {
			save_scope_as = emperor
		}
		scope:emperor = {
			add_character_flag = need_military_outfit
		}
		if = {
			limit = {
				scope:emperor = {
					is_defender_in_war = scope:war
				}
			}
			scope:war = {
				primary_attacker = {
					save_scope_as = foe
				}
			}
		}
		else = {
			scope:war = {
				primary_defender = {
					save_scope_as = foe
				}
			}
		}
		scope:foe = {
			add_character_flag = need_military_outfit
		}
	}
	
	#Join the emperor in this war
	option = {
		name = ep3_governor_yearly.3010.a
		flavor = ep3_governor_yearly.3010.a.flavor
		if = {
			limit = {
				scope:emperor = {
					is_ai = yes
				}
			}
			random_list = {
				50 = { #Emperor accepts your help
					desc = ep3_governor_yearly.3010.a.success
					
					modifier = {
						ep3_emperors_war_strength_value < ep3_emperors_foe_war_strength_value
						add = 25
					}
					modifier = {
						ep3_emperors_war_strength_double_value < ep3_emperors_foe_war_strength_value
						add = 100
					}
					modifier = {
						OR = {
							AND = {
								scope:emperor = {
									is_defender_in_war = scope:war
								}
								scope:war = {
									defender_war_score < -20
								}
							}
							AND = {
								scope:emperor = {
									is_attacker_in_war = scope:war
								}
								scope:war = {
									attacker_war_score < -20
								}
							}
						}
						add = 50
					}
					modifier = {
						reverse_opinion = {
							target = scope:emperor
							value >= 50
						}
						add = 25
					}
					modifier = {
						reverse_opinion = {
							target = scope:emperor
							value >= 80
						}
						add = 25
					}
					modifier = {
						scope:emperor = {
							gold <= 0
						}
						add = 50
					}
					modifier = {
						scope:emperor = {
							monthly_character_income < 0
						}
						add = 75
					}
					modifier = {
						scope:emperor = {
							ai_boldness < low_negative_ai_value
						}
						add = 50
					}
					show_as_tooltip = {
						ep3_governor_yearly_3010_war_aid_effect = yes
					}
					trigger_event = {
						id = ep3_governor_yearly.3012
						days = 1
					}
				}
				50 = { #Emperor turns down your help
					desc = ep3_governor_yearly.3010.a.fail
					modifier = {
						current_military_strength < strong_governor_military_value
						add = 25
					}
					modifier = {
						ep3_emperors_war_strength_value > ep3_emperors_foe_war_strength_value
						add = 25
					}
					modifier = {
						ep3_emperors_war_strength_value > ep3_emperors_foe_war_strength_double_value
						add = 100
					}
					modifier = {
						OR = {
							AND = {
								scope:emperor = {
									is_defender_in_war = scope:war
								}
								scope:war = {
									defender_war_score > 20
								}
							}
							AND = {
								scope:emperor = {
									is_attacker_in_war = scope:war
								}
								scope:war = {
									attacker_war_score > 20
								}
							}
						}
						add = 50
					}
					modifier = {
						reverse_opinion = {
							target = scope:emperor
							value <= -30
						}
						add = 25
					}
					modifier = {
						reverse_opinion = {
							target = scope:emperor
							value <= -60
						}
						add = 25
					}
					modifier = {
						is_powerful_vassal = no
						add = 25
					}
					modifier = {
						NOT = {
							house = {
								is_powerful_family = yes
							}
						}
						add = 25
					}
					modifier = {
						scope:emperor = {
							gold >= massive_gold_value
						}
						add = 25
					}
					modifier = {
						scope:emperor = {
							ai_boldness > low_negative_ai_value
						}
						add = 50
					}
					add_character_flag = governor_war_aid_deal_failed
					trigger_event = {
						id = ep3_governor_yearly.3012
						days = 1
					}
				}
			}
		}
		else = {
			#Trigger letter event for player emperor
			scope:emperor = {
				trigger_event = {
					id = ep3_governor_yearly.3011
					days = 1
				}
			}
		}
		stress_impact = {
			brave = miniscule_stress_impact_loss
			diligent = minor_stress_impact_loss
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_boldness = 1
				ai_energy = 1
				ai_honor = 1
			}
			modifier = {
				add = -50
				OR = {
					diplomacy <= low_skill_rating
					intrigue <= low_skill_rating
				}
			}
			#The war has been dragging on for more than 3 years
			modifier = {
				add = 50
				OR = {
					scope:att_governor_5 ?= this
					scope:att_governor_6 ?= this
					scope:def_governor_5 ?= this
					scope:def_governor_6 ?= this
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = content
					has_trait = paranoid
					has_trait = lazy
					has_trait = disloyal
					is_powerful_vassal = no
					AND = {
						scope:emperor = {
							is_defender_in_war = scope:war
						}
						scope:war = {
							defender_war_score > 20
						}
					}
					AND = {
						scope:emperor = {
							is_attacker_in_war = scope:war
						}
						scope:war = {
							attacker_war_score > 20
						}
					}
				}
			}
		}
	}
	#Foment unrest against the weak emperor
	option = {
		name = ep3_governor_yearly.3010.b
		flavor = ep3_governor_yearly.3010.b.flavor
		if = {
			limit = {
				is_powerful_vassal = yes
				
				scope:emperor = {
					has_realm_law = acclamation_succession_law
				}
				NOR = {
					has_claim_on = scope:emperor.primary_title
					AND = {
						culture = {
							has_cultural_parameter = physical_disfigurement_blocks_inheritance
						}
						OR = {
							has_trait = eunuch
							has_trait = disfigured
							has_trait = blind
						}
					}
					AND = {
						scope:emperor.culture = {
							has_cultural_parameter = physical_disfigurement_blocks_inheritance
						}
						OR = {
							has_trait = eunuch
							has_trait = disfigured
							has_trait = blind
						}
					}
				}
			}
			if = {
				limit = {
					OR = {
						AND = {
							scope:emperor = {
								is_defender_in_war = scope:war
							}
							scope:war = {
								defender_war_score > 50
							}
						}
						AND = {
							scope:emperor = {
								is_attacker_in_war = scope:war
							}
							scope:war = {
								attacker_war_score > 50
							}
						}
					}
				}
				change_influence = massive_influence_loss
			}
			else = {
				change_influence = major_influence_loss
			}
			
			scope:emperor = {
				send_interface_message = {
					type = msg_governor_challenges_weakness
					title = msg_claimed_weak_emperors_title.t
					desc = msg_claimed_weak_emperors_title.flavor
					right_icon = root
					
					root = {
						add_unpressed_claim = scope:emperor.primary_title
						progress_towards_rival_effect = {
							REASON = rival_challenged_weak_emperor
							CHARACTER = scope:emperor
							OPINION = -50
						}
					}
				}
			}
		}
		else = {
			if = {
				limit = {
					is_a_faction_member = yes
				}
				scope:emperor = {
					send_interface_message = {
						type = msg_governor_challenges_weakness
						title = msg_claimed_weak_emperors_title.t.2
						desc = msg_claimed_weak_emperors_title.flavor.2
						right_icon = root
						root = { add_joined_faction_discontent = 30 }
					}
				}
			}
			else_if = {
				limit = {
					scope:emperor = {
						has_realm_law = acclamation_succession_law
					}
					is_candidate_for_title_trigger = {
						TITLE = scope:emperor.primary_title
						CANDIDATE = root
					}
					NOT = {
						has_character_flag = decried_weakness_score
						
					}
				}
				custom_tooltip = governor_challenges_weakness_candidate_score
				add_character_flag = {
					flag = decried_weakness_score
					years = 5
				}
			}
			change_influence = medium_influence_gain
			reverse_add_opinion = {
				target = scope:emperor
				modifier = angry_opinion
				opinion = -25
			}
		}
		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			forgiving = medium_stress_impact_gain
			content = major_stress_impact_gain
			humble = major_stress_impact_gain
			trusting = medium_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.5
			}
			#The war has been dragging on for more than 3 years
			modifier = {
				add = 100
				OR = {
					scope:att_governor_5 ?= this
					scope:att_governor_6 ?= this
					scope:def_governor_5 ?= this
					scope:def_governor_6 ?= this
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level <= 2
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = content
					has_trait = humble
					has_trait = trusting
					has_trait = just
					scope:att_governor_1 ?= this
					scope:att_governor_2 ?= this
					scope:def_governor_1 ?= this
					scope:def_governor_2 ?= this
					is_powerful_vassal = no
					AND = {
						scope:emperor = {
							is_defender_in_war = scope:war
						}
						scope:war = {
							defender_war_score >= 0
						}
					}
					AND = {
						scope:emperor = {
							is_attacker_in_war = scope:war
						}
						scope:war = {
							attacker_war_score >= 0
						}
					}
				}
			}
		}
	}
	#The emperor is distracted... time to extend my grasp here
	option = {
		name = ep3_governor_yearly.3010.c
		flavor = ep3_governor_yearly.3010.c.flavor
		increase_governance_effect = { VALUE = 10 }
		add_character_modifier = {
			modifier = ep3_exploited_weak_master_modifier
			years = 10
		}
		stress_impact = {
			greedy = minor_stress_impact_loss
			just = major_stress_impact_gain
			diligent = major_stress_impact_gain
			generous = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_honor = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = diligent
					has_trait = generous
					has_trait = honest
				}
			}
		}
	}
	#I will make pious donations and pray for victory
	option = {
		name = ep3_governor_yearly.3010.d
		add_piety = medium_piety_gain
		remove_short_term_gold = minor_gold_value
		stress_impact = {
			zealous = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
				ai_honor = 0.5
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = ambitious
				}
			}
		}
	}
	after = {
		scope:emperor = {
			remove_character_flag = need_military_outfit
		}
		scope:foe = {
			remove_character_flag = need_military_outfit
		}
	}
}

#Player emperor chooses whether to accept governor's aid deal
ep3_governor_yearly.3011 = {
	type = letter_event
	opening = {
		desc = ep3_governor_yearly.3011.opening
	}
	desc = ep3_governor_yearly.3011.desc
	sender = scope:governor

	immediate = {
	}
	#Accept the exchange
	option = {
		name = ep3_governor_yearly.3011.a
		show_as_tooltip = {
			scope:governor = {
				ep3_governor_yearly_3010_war_aid_effect = yes
			}
		}
		stress_impact = {
			craven = miniscule_stress_impact_loss
			trusting = miniscule_stress_impact_loss
			stubborn = medium_stress_impact_gain
			paranoid = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			brave = miniscule_stress_impact_gain
		}
	}
	#Refuse the exchange
	option = {
		name = ep3_governor_yearly.3011.b
		scope:governor = { add_character_flag = governor_war_aid_deal_failed }
		stress_impact = {
			craven = medium_stress_impact_gain
			trusting = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
	}
	after = {
		scope:governor = {
			trigger_event = {
				id = ep3_governor_yearly.3012
				days = 1
			}
		}
	}
}

#Governor gets emperor's response
ep3_governor_yearly.3012 = {
	type = letter_event
	opening = {
		desc = ep3_governor_yearly.3012.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = governor_war_aid_deal_failed
				}
				desc = ep3_governor_yearly.3012.desc_fail
			}
			desc = ep3_governor_yearly.3012.desc_success
		}
	}
	sender = scope:emperor

	
	#Alright then
	option = {
		
		name = {
			trigger = {
				knows_language = language_greek
				OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
			}
			text = ep3_governor_yearly.3012.kyrie_eleison
		}
		name = {
			trigger = {
				NAND = {
					knows_language = language_greek
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				NOT = {
					has_character_flag = governor_war_aid_deal_failed
				}
			}
			text = ep3_emperor_yearly.3011.a_to_war
		}
		name = {
			trigger = {
				NAND = {
					knows_language = language_greek
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				has_character_flag = governor_war_aid_deal_failed
			}
			text = ep3_emperor_yearly.3011.a_no_war
		}
		if = {
			limit = {
				NOT = {
					has_character_flag = governor_war_aid_deal_failed
				}
			}
			ep3_governor_yearly_3010_war_aid_effect = yes
		}
	}
	after = {
		if = {
			limit = {
				has_character_flag = governor_war_aid_deal_failed
			}
			remove_character_flag = governor_war_aid_deal_failed
		}
	}
}

#####################################
# God Appointed... Him?				#
# by Jason Cantalini				#
# 3020	 							#
#####################################

#The emperor has an unacceptable trait and a governor wants to make a stink about it
ep3_governor_yearly.3020 = {
	type = character_event
	title = ep3_governor_yearly.3020.t
	desc = {
		desc = ep3_governor_yearly.3020.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = condemning_physical_trait
				}
				desc = ep3_governor_yearly.3020.desc_physical
			}
			desc = ep3_governor_yearly.3020.desc_crime
		}
	}
			
	theme = emperor
	override_background = {
		reference = throne_room
	}
	left_portrait = {
		character = scope:emperor
		triggered_animation = {
			trigger = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
			animation = acknowledging # anim uses crucifix scepter
		}
		animation = war_over_tie
	}

	trigger = {
		age >= 12
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		OR = {
			is_governor = yes
			is_landless_administrative = yes
		}
		liege = {
			NOR = {
				has_character_flag = had_ep3_governor_yearly_3020
				has_character_modifier = emperor_repented_for_flaws_modifier
			}
			valid_for_byz_emperor_content_trigger = yes
			save_temporary_scope_as = emperor_temp
			legitimacy_level < 5
			government_has_flag = government_is_administrative
			top_liege = this
			OR = {
				#Emperor has criminal trait
				AND = {
					has_trait = incestuous
					NOT = {
						root = { is_incestuous_trigger = yes }
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = kinslayer
					NOT = {
						root = { has_trait = kinslayer }
					}
				}
				AND = {
					has_trait = adulterer
					NOT = {
						root = { has_trait = adulterer }
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = fornicator
					NOT = {
						root = {
							OR = {
								has_trait = fornicator
								has_trait = adulterer
							}
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = deviant
					NOT = {
						root = { is_deviant_trigger = yes }
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = witch
					NOT = {
						root = { is_witch_trigger = yes }
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = sodomite
					root = {
						NOR = {
							has_trait = sodomite
							any_secret = {
								type = secret_homosexual
							}
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					has_trait = cannibal
					NOT = {
						root = { is_cannibal_trigger = yes }
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:emperor_temp.faith GENDER_CHARACTER = scope:emperor_temp }
					trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = root.faith GENDER_CHARACTER = scope:emperor_temp }
				}
				AND = {
					root.culture = {
						has_cultural_parameter = physical_disfigurement_blocks_inheritance
					}
					OR = {
						has_trait = eunuch_1
						has_trait = beardless_eunuch
						has_trait = blind
						has_trait = maimed
						has_trait = one_eyed
						has_trait = one_legged
						has_trait = hunchbacked
						has_trait = dwarf
						has_trait = incapable
						has_trait = clubfooted
						has_trait = disfigured
					}
				}
			}
		}
		OR = {
			is_ai = no
			opinion = {
				target = liege
				value <= 40
			}
		}
	}
	immediate = {
		save_scope_as = minister
		liege = {
			save_scope_as = emperor
			add_character_flag = {
				flag = had_ep3_governor_yearly_3020
				years = 1
			}
			random_list = {
				1 = {
					trigger = {
						has_trait = incestuous
						NOT = {
							root = { is_incestuous_trigger = yes }
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:incestuous
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = kinslayer
						NOT = {
							root = { has_trait = kinslayer }
						}
					}
					random_character_trait = {
						limit = {
							OR = {
								this = trait:kinslayer_1
								this = trait:kinslayer_2
								this = trait:kinslayer_3
							}
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = adulterer
						NOT = {
							root = { has_trait = adulterer }
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:adulterer
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = fornicator
						NOT = {
							root = {
								OR = {
									has_trait = fornicator
									has_trait = adulterer
								}
							}
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:fornicator
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = deviant
						NOT = {
							root = { is_deviant_trigger = yes }
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:deviant
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = witch
						NOT = {
							root = { is_witch_trigger = yes }
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:witch
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = sodomite
						root = {
							NOR = {
								has_trait = sodomite
								any_secret = {
									type = secret_homosexual
								}
							}
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:sodomite
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						has_trait = cannibal
						NOT = {
							root = { is_cannibal_trigger = yes }
						}
						trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:emperor.faith GENDER_CHARACTER = scope:emperor }
						trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = root.faith GENDER_CHARACTER = scope:emperor }
					}
					random_character_trait = {
						limit = {
							this = trait:cannibal
						}
						save_scope_as = target_trait
					}
				}
				1 = {
					trigger = {
						root.culture = {
							has_cultural_parameter = physical_disfigurement_blocks_inheritance
						}
						OR = {
							has_trait = eunuch
							has_trait = blind
							has_trait = maimed
							has_trait = one_eyed
							has_trait = one_legged
							has_trait = hunchbacked
							has_trait = dwarf
							has_trait = incapable
							has_trait = clubfooted
							has_trait = disfigured
						}
					}
					random_character_trait = {
						limit = {
							OR = {
								this = trait:eunuch_1
								this = trait:beardless_eunuch
								this = trait:blind
								this = trait:maimed
								this = trait:one_eyed
								this = trait:one_legged
								this = trait:hunchbacked
								this = trait:dwarf
								this = trait:incapable
								this = trait:clubfooted
								this = trait:disfigured
							}
						}
						save_scope_as = target_trait
						root ={ add_character_flag = condemning_physical_trait }
					}
				}
			}
		}
	}
	#Secretly spread dissent and make the emperor a laughingstock
	option = {
		name = ep3_governor_yearly.3020.a
		flavor = ep3_governor_yearly.3020.a.flavor
		duel = {
			skill = intrigue
			target = scope:emperor
			55 = { #The gossips go wild heeding your words
				desc = ep3_governor_yearly.3020.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -54
				}
				modifier = {
					add = 30
					influence_level >= 2
				}
				modifier = {
					add = 30
					influence_level >= 4
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_governor_yearly.3020.a.success
					left_icon = scope:emperor
					add_intrigue_lifestyle_xp = medium_lifestyle_xp
					change_influence = medium_influence_gain
					#Emperor gets toast that they're losing influence
					scope:emperor = {
						send_interface_message = {
							type = msg_unflattering_imperial_trait_gossip
							title = msg_unflattering_imperial_trait_gossip.t
							desc = msg_unflattering_imperial_trait_gossip.flavor
							change_influence = minor_influence_loss
							add_stress = miniscule_stress_gain
						}
					}
				}
				
			}
			45 = { #No one pays you any heed
				desc = ep3_governor_yearly.3020.a.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -44
				}
				modifier = {
					add = 30
					scope:emperor = { influence_level >= 2 }
				}
				modifier = {
					add = 30
					scope:emperor = { influence_level >= 4 }
				}
				modifier = {
					add = 30
					scope:emperor = { legitimacy_level >= 3 }
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3020.a.fail
					left_icon = scope:emperor
					add_stress = minor_stress_gain
				}
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			trusting = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_boldness = -1
			}
			modifier = {
				add = 25
				intrigue >= high_skill_rating
				scope:emperor = {
					intrigue <= mediocre_skill_rating
				}
			}
			modifier = {
				add = -50
				intrigue <= mediocre_skill_rating
				scope:emperor = {
					intrigue >= high_skill_rating
				}
			}
			modifier = {
				factor = 0
				OR = {
					intrigue <= low_skill_rating
					scope:emperor = {
						intrigue >= very_high_skill_rating
					}
					scope:emperor = {
						dread >= 90
					}
					scope:emperor = {
						legitimacy_level >= 5
					}
					has_trait = honest
					has_trait = trusting
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}
	#I should write a letter of warning and urge the emperor to seek god's forgiveness
	option = {
		name = ep3_governor_yearly.3020.b
		flavor = ep3_governor_yearly.3020.flavor
		#Faction gains discontent
		if = {
			limit = {
				is_a_faction_member = yes
			}
			add_joined_faction_discontent = 20
			add_prestige = minor_prestige_gain
		}
		else_if = {
			limit = {
				NOR = {
					has_trait = eunuch
					has_trait = blind
					has_trait = maimed
					has_trait = one_eyed
					has_trait = one_legged
					has_trait = hunchbacked
					has_trait = dwarf
					has_trait = incapable
					has_trait = clubfooted
					has_trait = disfigured
					has_character_flag = insulted_trait_candidate_score
					
				}
				is_candidate_for_title_trigger = {
					TITLE = scope:emperor.primary_title
					CANDIDATE = root
				}
			}
			custom_tooltip = governor_insulted_imperial_trait_candidate_score
			add_character_flag = {
				flag = insulted_trait_candidate_score
				years = 5
			}
		}
		else = {
			add_prestige = medium_prestige_gain
			add_piety = minor_piety_gain
		}
		#Increases powerful family rating
		#Emperor loses prestige and legitimacy
		show_as_tooltip = {
			scope:emperor = {
				add_prestige = minor_prestige_loss
				add_legitimacy = minor_legitimacy_loss
			}
		}
		reverse_add_opinion = {
			modifier = insulted_opinion
			target = scope:emperor
			opinion = -30
		}
		scope:emperor = {
			trigger_event = {
				id = ep3_governor_yearly.3021
				days = 1
			}
		}
		stress_impact = {
			zealous = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			craven = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 0.5
				ai_vengefulness = 0.5
			}
			modifier = {
				add = -50
				OR = {
					scope:emperor = {
						dread >= 25
					}
					opinion = {
						target = scope:emperor
						value >= 20
					}
				}
			}
			modifier = {
				add = 50
				OR = {
					scope:emperor = {
						legitimacy_level <= 1
					}
					opinion = {
						target = scope:emperor
						value < -50
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					scope:emperor = {
						dread > 50
					}
					opinion = {
						target = scope:emperor
						value > 0
					}
					has_trait = content
					has_trait = forgiving
					has_trait = compassionate
					has_trait = content
				}
			}
		}
	}
	#I'm just going to do my job and keep my nose clean
	option = {
		name = ep3_governor_yearly.3020.c
		if = {
			limit = {
				is_governor = yes
			}
			increase_governance_effect = { VALUE = 5 }
		}
		else = {
			add_gold = tiny_gold_value
		}
		stress_impact = {
			vengeful = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -0.5
				ai_boldness = -0.5
				ai_zeal = -0.5
				ai_sociability = -0.5
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = paranoid
					has_trait = sadistic
					has_trait = wrathful
					has_trait = zealous
				}
			}
		}
	}
}

#Emperor receives rude message from governor
ep3_governor_yearly.3021 = {
	type = letter_event
	opening = {
		desc = ep3_governor_yearly.3021.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:minister = { has_character_flag = condemning_physical_trait }
				}
				desc = ep3_governor_yearly.3021.desc_physical
			}
			desc = ep3_governor_yearly.3021.desc_crime
		}
	}
	sender = scope:minister

	immediate = {
		show_as_tooltip = {
			scope:minister = {
				if = {
					limit = {
						is_a_faction_member = yes
					}
					add_joined_faction_discontent = 20
					add_prestige = minor_prestige_gain
				}
				else_if = {
					limit = {
						NOR = {
							has_trait = eunuch
							has_trait = blind
							has_trait = maimed
							has_trait = one_eyed
							has_trait = one_legged
							has_trait = hunchbacked
							has_trait = dwarf
							has_trait = incapable
							has_trait = clubfooted
							has_trait = disfigured
						}
						is_candidate_for_title_trigger = {
							TITLE = scope:emperor.primary_title
							CANDIDATE = root
						}
					}
					custom_tooltip = governor_insulted_imperial_trait_candidate_score
					add_character_flag = insulted_trait_candidate_score
				}
				else = {
					add_prestige = medium_prestige_gain
					add_piety = minor_piety_gain
				}
			}
		}
		add_prestige = minor_prestige_loss
		add_legitimacy = minor_legitimacy_loss
		custom_tooltip = ep3_governor_yearly.3021.bad_trait
	}
	
	#I suppose I should seek God's favor
	option = {
		name = ep3_governor_yearly.3021.a
		flavor = ep3_governor_yearly.3021.a.flavor
		add_character_modifier = {
			modifier = emperor_repented_for_flaws_modifier
			years = 10
		}
		custom_tooltip = ep3_governor_yearly.3021.blocker
		add_prestige = medium_prestige_loss
		stress_impact = {
			zealous = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			arrogant = major_stress_impact_gain
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = -1
				ai_honor = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = stubborn
					has_trait = wrathful
					has_trait = arrogant
					has_trait = vengeful
					prestige < major_prestige_value
				}
			}
		}
	}
	#Impertinence!
	option = {
		name = ep3_governor_yearly.3021.b
		stress_impact = {
			humble = miniscule_stress_impact_gain
			zealous = miniscule_stress_impact_gain
			trusting = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_boldness = 1
				ai_rationality = -1
			}
			modifier = {
				factor = 0.5
				OR = {
					has_trait = humble
					has_trait = zealous
					has_trait = trusting
				}
			}
		}
	}
	after = {
		if = {
			limit = {
				scope:minister = {
					has_character_flag = condemning_physical_trait
				}
			}
			scope:minister = {
				remove_character_flag = condemning_physical_trait
			}
		}
	}
}

#####################################
# Quiet Times						#
# by Jason Cantalini				#
# 3030	 							#
#####################################

#The empire has been at peace for years and prosperity is growing
ep3_governor_yearly.3030 = {
	type = character_event
	title = ep3_governor_yearly.3030.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
				}
				desc = ep3_governor_yearly.3030.desc_christian
			}
			desc = ep3_governor_yearly.3030.desc_generic
		}
		desc = ep3_governor_yearly.3030.desc
	}	
	theme = administrative
	override_background = {
		trigger = {
			location.culture ?= { has_graphical_mediterranean_culture_group_trigger = yes }
		}
		reference = estate
	}
	override_background = {
		trigger = {
			NOT = {
				location.culture ?= { has_graphical_mediterranean_culture_group_trigger = yes }
			}
		}
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = writing
	}
	lower_right_portrait = scope:emperor

	trigger = {
		basic_is_valid_for_yearly_events_trigger = yes
		is_landed = yes
		government_allows = administrative
		top_liege != this
		years_from_game_start >= 4
		is_at_war = no
		age >= 12
		capital_county = {
			county_control >= 100
		}
		primary_title = {
			NOT = {
				has_variable = admin_war_aftermath_var
			}
		}
		top_liege = {
			is_at_war = no
			primary_title = {
				NOT = {
					has_variable = admin_war_aftermath_var
				}
			}
			capital_county = {
				county_control >= 100
			}
		}
		OR = {
			liege = root.top_liege
			liege = {
				is_at_war = no
				primary_title = {
					NOT = {
						has_variable = admin_war_aftermath_var
					}
				}
			}
		}
		NOT = {
			any_sub_realm_county = {
				any_province = {
					any_province_epidemic = { }
				}
			}
		}
	}
	immediate = {
		top_liege = {
			save_scope_as = emperor
		}
	}
	#We will become soft if we do not fight
	option = {
		name = ep3_governor_yearly.3030.a
		flavor = ep3_governor_yearly.3030.a.flavor
		trigger = {
			OR = {
				any_neighboring_top_liege_realm_owner = {
					any_realm_county = {
						any_neighboring_county = {
							OR = {
								holder = root
								holder.liege = root
							}
						}
					}
				}
				NOT = {
					has_character_flag = warmongering_admin
				}
			}
		}
		if = {
			limit = {
				NOT = {
					has_character_flag = warmongering_admin
				}
			}
			#You get access to a CB...?
			add_character_flag = warmongering_admin
			custom_tooltip = access_to_admin_raid_tooltip
			custom_tooltip = admin_raid_gives_modifier_tooltip
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_loyal_troops_raid_modifier
				}
			}
			add_character_modifier = ep3_loyal_troops_raid_modifier
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_loyal_troops_2_raid_modifier
				}
			}
			add_character_modifier = ep3_loyal_troops_2_raid_modifier
			remove_character_modifier = ep3_loyal_troops_raid_modifier
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_loyal_troops_3_raid_modifier
				}
			}
			add_character_modifier = ep3_loyal_troops_3_raid_modifier
			remove_character_modifier = ep3_loyal_troops_2_raid_modifier
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_loyal_troops_4_raid_modifier
				}
			}
			add_character_modifier = ep3_loyal_troops_4_raid_modifier
			remove_character_modifier = ep3_loyal_troops_3_raid_modifier
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_loyal_troops_5_raid_modifier
				}
			}
			add_character_modifier = ep3_loyal_troops_5_raid_modifier
			remove_character_modifier = ep3_loyal_troops_4_raid_modifier
		}
		else = {
			add_martial_lifestyle_xp = medium_lifestyle_xp
		}
		stress_impact = {
			lazy = major_stress_impact_gain
			compassionate = medium_stress_impact_gain
			content = major_stress_impact_gain
			calm = medium_stress_impact_gain
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_compassion = -1
				ai_boldness = 1
			}
			modifier = {
				factor = 0
				OR = {
					NOT = {
						any_neighboring_top_liege_realm_owner = {
							any_realm_county = {
								any_neighboring_county = {
									OR = {
										holder = root
										holder.liege = root
									}
								}
							}
						}
					}
					has_trait = lazy
					has_trait = compassionate
					has_trait = content
					has_trait = calm
					has_trait = humble
				}
			}
		}
	}
	#I should further the cause of peace and harmony in my governorship
	option = {
		name = ep3_governor_yearly.3030.b
		increase_governance_effect = { VALUE = 15 }
		add_character_modifier = {
			modifier = ep3_peaceful_administrator_modifier
			years = 10
		}
		stress_impact = {
			lazy = minor_stress_impact_gain
			paranoid = major_stress_impact_gain
			wrathful = medium_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
				ai_vengefulness = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = paranoid
					has_trait = wrathful
					has_trait = sadistic
				}
			}
		}
	}
	#We are free to relish a cozy life with our families!
	option = {
		name = ep3_governor_yearly.3030.c
		
		#Some kind of estate bonus
		#New estate sub-building type?
		if = {
			limit = {
				house = {
					house_head = root
				}
				NOT = {
					has_character_flag = ep3_construct_grand_solar
				}
			}
			add_character_flag = ep3_construct_grand_solar
			custom_tooltip = can_construct_solar_tooltip
			custom_tooltip = solar_estate_effect_tooltip
			add_stress = major_stress_loss
			house = {
				every_house_member = {
					custom = custom.every_house_member
					limit = {
						NOT = {
							has_relation_rival = root
						}
						is_imprisoned = no
						this != root
					}
					add_stress = major_stress_loss
				}
			}
		}
		else = {
			add_stress = major_stress_loss
			house = {
				every_house_member = {
					custom = custom.every_house_member
					limit = {
						NOT = {
							has_relation_rival = root
						}
						is_imprisoned = no
						this != root
					}
					add_stress = major_stress_loss
					add_opinion = {
						modifier = love_opinion
						target = root
						opinion = 20
					}
				}
			}
		}
		stress_impact = {
			diligent = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
			callous = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_energy = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = impatient
					has_trait = callous
					has_trait = ambitious
				}
			}
		}
	}
}

#####################################
# Basileus Autokrator!				#
# by Jason Cantalini				#
# 3040	 							#
#####################################

#Emperor has high legitimacy
ep3_governor_yearly.3040 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = {
						has_cultural_pillar = language_greek
					}
				}
				desc = ep3_governor_yearly.3040.t_greek
			}
			desc = ep3_governor_yearly.3040.t
		}
	}
	desc = ep3_governor_yearly.3040.desc
	theme = emperor
	override_effect_2d = {
 		reference = legend_glow
	}
	override_background = {
		trigger = {
			scope:emperor = { capital_county = title:c_byzantion }
		}
		reference = ep3_constantinople
	}
	override_background = {
		trigger = {
			NOT = {
				scope:emperor = { capital_county = title:c_byzantion }
			}
		}
		reference = throne_room
	}
	left_portrait = {
		character = scope:emperor
		triggered_animation = {
			trigger = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
			animation = acknowledging # anim uses crucifix scepter
		}
		animation = war_over_tie
		camera = camera_event_left_forward
	}
	right_portrait = {
		character = scope:candidate
		animation = throne_room_bow_1
	}

	trigger = {
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		OR = {
			is_governor = yes
			is_landless_administrative = yes
		}
		is_at_war = no
		top_liege = {
		 	is_imprisoned = no
		 	legitimacy_level >= 4
			has_government = administrative_government
		}
		age >= 12
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			top_liege = {
			 	is_imprisoned = no
			 	legitimacy_level >= 5
			}
		}
	}

	immediate = {
		save_scope_as = root_scope
		top_liege = {
			save_scope_as = emperor
		}
		if = {
			limit = {
				scope:emperor.house = {
					any_house_member = {
						this != scope:emperor
						is_ai = yes
						save_temporary_scope_as = aspirant
						is_candidate_for_title_trigger = {
							TITLE = scope:emperor.primary_title
							CANDIDATE = scope:aspirant
						}
						#Ensure they're actually a visible candidate currently in contention
						OR = {
							is_close_family_of = scope:emperor
							AND = {
								is_vassal_of = scope:emperor
								is_landed = yes
							}
							scope:emperor.primary_title = {
								any_succession_appointment_investors = {
									count > 1
									candidate = scope:aspirant
								}
							}
						}
					}
				}
			}
			scope:emperor.house = {
				every_house_member = {
					limit = {
						this != scope:emperor
						is_ai = yes
						save_temporary_scope_as = aspirant
						is_candidate_for_title_trigger = {
							TITLE = scope:emperor.primary_title
							CANDIDATE = scope:aspirant
						}
						#Ensure they're actually a visible candidate currently in contention
						OR = {
							is_close_family_of = scope:emperor
							AND = {
								is_vassal_of = scope:emperor
								is_landed = yes
							}
							scope:emperor.primary_title = {
								any_succession_appointment_investors = {
									count > 1
									candidate = scope:aspirant
								}
							}
						}
					}
					add_to_list = imperial_house_candidates
				}
			}
			ordered_in_list = {
				list = imperial_house_candidates
				order_by = "appointment_candidate_score(scope:emperor.primary_title)"
				position = 0
				save_scope_as = candidate
			}
		}
	}


	#My family should really be closer to his...
	option = {
		trigger = {
			exists = house
			house != scope:emperor.house
		}
		name = ep3_governor_yearly.3040.a
		flavor = ep3_governor_yearly.3040.a.flavor
		
		root = {
			if = {
				limit = {
					NOT = {
						house = {
							has_variable = intermarrying_with_var
							var:intermarrying_with_var = {
								this = scope:emperor.house
							}
						}
					}
				}
				#Increased marriage acceptance
				house = {
					set_variable = {
						name = intermarrying_with_var
						value = scope:emperor.house
						years = 30
					}
				}
				scope:emperor.house = {
					set_variable = {
						name = intermarrying_with_var
						value = root.house
						years = 30
					}
				}
				custom_tooltip = ep3_governor_yearly_3040_marriage_tooltip
				add_character_flag = {
					flag = ep3_intermarrying_gov
					days = 5
				}
				
			}
		}
		scope:emperor.house = {
			every_house_member = {
				custom = custom.every_house_member_emperor
				add_opinion = {
					target = root
					modifier = friendliness_opinion
					opinion = 10
				}
			}
		}
		if = {
			limit = {
				scope:emperor = {
					is_ai = no
				}
			}
			scope:emperor = {
				send_interface_message = {
					type = msg_governor_compliments_legitimacy
					title = msg_governor_compliments_legitimacy.t
					right_icon = root
					
					dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
					reverse_add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 25
					}
					if = {
						limit = {
							root = {
								has_character_flag = ep3_intermarrying_gov
								
							}
						}
						custom_tooltip = ep3_governor_yearly_3040_marriage_tooltip
					}
				}
			}
		}
		else = {
			scope:emperor = {
				dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
				hidden_effect = {
					reverse_add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 25
					}
				}
			}
		}
		
		dynasty = { add_dynasty_prestige = 25 }
		
		stress_impact = {
			paranoid = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_sociability = 1
				ai_energy = 0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value <= 25
				}
			}
			modifier = {
				factor = 0
				OR = {
					opinion = {
						target = scope:emperor
						value <= -25
					}
					has_trait = paranoid
					has_trait = shy
					has_trait = content
				}
			}
		}
	}
	#This family is sticking around, I should get in good with his heir
	option = {
		trigger = {
			exists = scope:candidate
			intrigue > average_skill_rating
		}
		name = ep3_governor_yearly.3040.b
		flavor = ep3_governor_yearly.3040.b.flavor
		if = {
			limit = {
				can_add_hook = {
					target = scope:candidate
					type = favor_hook
				}
			}
			add_hook = {
				type = favor_hook
				target = scope:candidate
			}
		}
		else = {
			reverse_add_opinion = {
				modifier = grateful_opinion
				target = scope:candidate
				opinion = 40
			}
		}
		custom_tooltip = sycophant_boosts_credibility_candidate_score
		scope:candidate = {
			add_character_flag = {
				flag = boosted_by_sycophant_score
				years = 20
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:candidate
				modifier = respect_opinion
				opinion = 30
			}
		}
		change_influence = minor_influence_gain

		stress_impact = {
			impatient = medium_stress_impact_gain
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_rationality = 0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:candidate
					value < 0
				}
			}
			modifier = {
				factor = 0
				OR = {
					opinion = {
						target = scope:candidate
						value <= -50
					}
					has_trait = impatient
					has_trait = just
					has_trait = honest
				}
			}
		}
	}
	#This guy isn't going anywhere. We need to fortify our self-sufficiency
	option = {
		name = ep3_governor_yearly.3040.c
		flavor = ep3_governor_yearly.3040.c.flavor
		add_character_modifier = {
			modifier = independent_administrator_modifier
			years = 20
		}
		if = {
			limit = {
				any_maa_regiment = {
					is_title_maa_regiment = no
					can_upgrade_maa = yes
				}
			}
			random_maa_regiment = {
				limit = {
					is_title_maa_regiment = no
					can_upgrade_maa = yes
				}
				change_maa_regiment_size = {
					size = 1
					reinforce = yes
				}
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_skoutatoi
				}
				capital_province = {
					NOR = {
						terrain = farmlands
						terrain = forest
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = skoutatoi
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_akritai
				}
				capital_province = {
					OR = {
						terrain = forest
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = akritai
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_ballistrai
				}
				capital_province = {
					terrain = farmlands
				}
			}
			create_maa_regiment = {
				type = ballistrai
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_ayrudzi
				}
			}
			create_maa_regiment = {
				type = ayrudzi
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_hussar
				}
			}
			create_maa_regiment = {
				type = hussar
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_monaspa
				}
			}
			create_maa_regiment = {
				type = monaspa
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_cataphract_archers
				}
			}
			create_maa_regiment = {
				type = cataphract_archers
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_mubarizun
				}
			}
			create_maa_regiment = {
				type = mubarizun
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_tawashi
				}
			}
			create_maa_regiment = {
				type = tawashi
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_conrois
				}
			}
			create_maa_regiment = {
				type = conrois
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				OR = {
					culture = { culture_has_archer_cavalry_maa = yes }
					has_trait = nomadic_philosophy
				}	
			}
			create_maa_regiment = {
				type = horse_archers
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_pike_columns
				}
			}
			create_maa_regiment = {
				type = picchieri
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_druzhina
				}
			}
			create_maa_regiment = {
				type = druzhina
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				mpo_can_recruit_nomad_heavy_cavalry_maa_trigger = yes
			}
			create_maa_regiment = {
				type = nomad_lancers
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
			create_maa_regiment = {
				type = heavy_horse_archers
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_advanced_bowmaking
				}
				capital_province = {
					NOR = {
						terrain = desert
						terrain = drylands
						terrain = plains
					}
				}
			}
			create_maa_regiment = {
				type = crossbowmen
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_war_camels
				}
				capital_province = {
					OR = {
						terrain = desert
						terrain = drylands
					}
				}
			}
			create_maa_regiment = {
				type = camel_rider
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = farmlands
						terrain = floodplains
					}
				}
				culture = {
					has_innovation = innovation_quilted_armor
				}
				short_term_gold >= 200
			}
			create_maa_regiment = {
				type = armored_footmen
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = plains
						terrain = drylands
					}
				}
			}
			create_maa_regiment = {
				type = light_horsemen
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = forest
						terrain = taiga
						terrain = hills
					}
				}
			}
			create_maa_regiment = {
				type = bowmen
				check_can_recruit = no
				size = 1
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = jungle
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = light_footmen
				check_can_recruit = no
				size = 1
			}
		}
		else = {
			create_maa_regiment = {
				type = pikemen_unit
				check_can_recruit = no
				size = 1
			}
		}
		remove_short_term_gold = minor_gold_value

		stress_impact = {
			trusting = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_sociability = -0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value >= 40
				}
			}
			modifier = {
				add = 50
				any_neighboring_top_liege_realm_owner = {
					any_realm_county = {
						any_neighboring_county = {
							OR = {
								holder = root
								holder.liege = root
							}
						}
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					short_term_gold <= medium_gold_value
					opinion = {
						target = scope:emperor
						value >= 75
					}
					has_trait = generous
					has_trait = trusting
					has_trait = humble
				}
			}
		}
	}
	#I should use his image to reinforce my governance and drive enlistment
	option = {
		name = ep3_governor_yearly.3040.d
		flavor = ep3_governor_yearly.3040.d.flavor
		trigger = {
			is_governor = yes
		}
		add_prestige = minor_prestige_gain
		if = {
			limit = {
				any_maa_regiment = {
					is_title_maa_regiment = yes
					can_upgrade_maa = yes
				}
			}
			every_maa_regiment = {
				limit = {
					is_title_maa_regiment = yes
					can_upgrade_maa = yes
				}
				change_maa_regiment_size = {
					size = 1
					reinforce = yes
				}
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_cataphract
				}
				short_term_gold >= 300
				capital_province = {
					NOR = {
						terrain = hills
						terrain = mountains
						terrain = desert_mountains
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = cataphract
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_skoutatoi
				}
				capital_province = {
					NOR = {
						terrain = farmlands
						terrain = forest
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = skoutatoi
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_akritai
				}
				capital_province = {
					OR = {
						terrain = forest
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = akritai
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_ballistrai
				}
				capital_province = {
					terrain = farmlands
				}
			}
			create_maa_regiment = {
				type = ballistrai
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_ayrudzi
				}
			}
			create_maa_regiment = {
				type = ayrudzi
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_monaspa
				}
			}
			create_maa_regiment = {
				type = monaspa
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_cataphract_archers
				}
			}
			create_maa_regiment = {
				type = cataphract_archers
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_hussar
				}
			}
			create_maa_regiment = {
				type = hussar
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_mubarizun
				}
			}
			create_maa_regiment = {
				type = mubarizun
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_tawashi
				}
			}
			create_maa_regiment = {
				type = tawashi
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_conrois
				}
			}
			create_maa_regiment = {
				type = conrois
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				OR = {
					culture = { culture_has_archer_cavalry_maa = yes }
					has_trait = nomadic_philosophy
				}
			}
			create_maa_regiment = {
				type = horse_archers
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_pike_columns
				}
			}
			create_maa_regiment = {
				type = picchieri
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_cultural_parameter = unlock_maa_druzhina
				}
			}
			create_maa_regiment = {
				type = druzhina
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				mpo_can_recruit_nomad_heavy_cavalry_maa_trigger = yes
			}
			create_maa_regiment = {
				type = nomad_lancers
				check_can_recruit = no
				title = root.primary_title
				size = 1
			}
		}
		else_if = {
			limit = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
			create_maa_regiment = {
				type = heavy_horse_archers
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_advanced_bowmaking
				}
				capital_province = {
					NOR = {
						terrain = desert
						terrain = drylands
						terrain = plains
					}
				}
			}
			create_maa_regiment = {
				type = crossbowmen
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				culture = {
					has_innovation = innovation_war_camels
				}
				capital_province = {
					OR = {
						terrain = desert
						terrain = drylands
					}
				}
			}
			create_maa_regiment = {
				type = camel_rider
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = farmlands
						terrain = floodplains
					}
				}
				culture = {
					has_innovation = innovation_quilted_armor
				}
				short_term_gold >= 200
			}
			create_maa_regiment = {
				type = armored_footmen
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = plains
						terrain = drylands
					}
				}
			}
			create_maa_regiment = {
				type = light_horsemen
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = forest
						terrain = taiga
						terrain = hills
					}
				}
			}
			create_maa_regiment = {
				type = bowmen
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else_if = {
			limit = {
				capital_province = {
					OR = {
						terrain = jungle
						terrain = wetlands
					}
				}
			}
			create_maa_regiment = {
				type = light_footmen
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		else = {
			create_maa_regiment = {
				type = pikemen_unit
				check_can_recruit = no
				title = root.primary_title
				size = 2
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
				ai_energy = 0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value < -0
				}
			}
			modifier = {
				add = 50
				any_neighboring_top_liege_realm_owner = {
					any_realm_county = {
						any_neighboring_county = {
							OR = {
								holder = root
								holder.liege = root
							}
						}
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					short_term_gold <= medium_gold_value
					has_trait = greedy
					has_trait = ambitious
				}
			}
		}
	}
}

#####################################
# God Appointed... Him?				#
# by Jason Cantalini				#
# 3050	 							#
#####################################

#Emperor has low legitimacy
ep3_governor_yearly.3050 = {
	type = character_event
	title = ep3_governor_yearly.3050.t
	desc = {
		desc = ep3_governor_yearly.3050.desc
		first_valid = {
			#Emperor is a mess
			triggered_desc = {
				trigger = {
					has_character_flag = demon_emperor_madness
				}
				desc = ep3_governor_yearly.3050.mess
			}
			#Emperor is useless
			triggered_desc = {
				trigger = {
					has_character_flag = demon_emperor_sloth
				}
				desc = ep3_governor_yearly.3050.shiftless
			}
			#Emperor is a cowardly worm
			triggered_desc = {
				trigger = {
					has_character_flag = demon_emperor_fear
				}
				desc = ep3_governor_yearly.3050.coward
			}
			#Emperor is a monster
			triggered_desc = {
				trigger = {
					has_character_flag = demon_emperor_cruel
				}
				desc = ep3_governor_yearly.3050.cruel
			}
			#Emperor just plain sucks
			desc = ep3_governor_yearly.3050.generic_bad
		}
		desc = ep3_governor_yearly.3050.outro
	}
	theme = emperor
	override_effect_2d = {
 		reference = flies
	}
	override_background = {
		trigger = {
			scope:emperor.capital_county.culture = {
				OR = {
					has_cultural_pillar = heritage_byzantine
					has_cultural_pillar = heritage_caucasian
					has_cultural_pillar = heritage_latin
					has_graphical_mediterranean_culture_group_trigger = yes 
				}
			}
			NOR = {
				has_character_flag = demon_emperor_cruel
				has_character_flag = demon_emperor_generic
			}
		}
		reference = ep3_byzantine_feast
	}
	override_background = {
		trigger = {
			scope:emperor.capital_county.culture = {
				NOR = {
					has_cultural_pillar = heritage_byzantine
					has_cultural_pillar = heritage_caucasian
					has_cultural_pillar = heritage_latin
					has_graphical_mediterranean_culture_group_trigger = yes 
				}
			}
			NOR = {
				has_character_flag = demon_emperor_cruel
				has_character_flag = demon_emperor_generic
			}
		}
		reference = corridor_night
	}
	override_background = {
		trigger = {
			has_character_flag = demon_emperor_cruel
		}
		reference = bp1_bonfire
	}
	override_background = {
		trigger = {
			has_character_flag = demon_emperor_generic
		}
		reference = bedchamber
	}
	left_portrait = {
		character = scope:emperor
		triggered_animation = {
			trigger = {
				root = {
					has_character_flag = demon_emperor_madness
				}
			}
			animation = aggressive_unarmed
		}
		triggered_animation = {
			trigger = {
				root = {
					has_character_flag = demon_emperor_sloth
				}
			}
			animation = throne_room_kneel_1
		}
		triggered_animation = {
			trigger = {
				root = {
					has_character_flag = demon_emperor_fear
				}
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				root = {
					has_character_flag = demon_emperor_cruel
				}
			}
			animation = manic
		}
		triggered_animation = {
			trigger = {
				root = {
					has_character_flag = demon_emperor_generic
				}
			}
			animation = eccentric
		}
	}
	lower_right_portrait = scope:faith_head

	trigger = {
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		OR = {
			is_governor = yes
			is_landless_administrative = yes
		}
		is_at_war = no
		top_liege = {
			has_legitimacy = yes
		 	legitimacy_level < 2
		 	age >= 8
		}
		age >= 12
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			top_liege = {
			 	is_imprisoned = no
			 	legitimacy_level < 1
			}
		}
	}

	immediate = {
		save_scope_as = root_scope
		top_liege = {
			save_scope_as = emperor
		}
		random_list = {
			3 = {
				trigger = {
					scope:emperor = {
						ai_rationality <= low_negative_ai_value
					}
				}
				modifier = {
					factor = 4
					scope:emperor = {
						ai_rationality <= high_negative_ai_value
					}
				}
				add_character_flag = {
					flag = demon_emperor_madness
					days = 5
				}
				if = {
					limit = {
						scope:emperor = {
							is_adult = yes
						}
					}
					scope:emperor = { add_character_flag = is_naked }
				}
			}
			3 = {
				trigger = {
					scope:emperor = {
						ai_energy <= low_negative_ai_value
					}
				}
				modifier = {
					factor = 4
					scope:emperor = {
						ai_energy <= high_negative_ai_value
					}
				}
				add_character_flag = {
					flag = demon_emperor_sloth
					days = 5
				}
				if = {
					limit = {
						scope:emperor = {
							is_adult = yes
						}
					}
					scope:emperor = { add_character_flag = is_naked }
				}
			}
			3 = {
				trigger = {
					scope:emperor = {
						ai_boldness <= low_negative_ai_value
					}
				}
				modifier = {
					factor = 4
					scope:emperor = {
						ai_boldness <= high_negative_ai_value
					}
				}
				add_character_flag = {
					flag = demon_emperor_fear
					days = 5
				}
			}
			3 = {
				trigger = {
					scope:emperor = {
						ai_compassion <= low_negative_ai_value
					}
				}
				modifier = {
					factor = 4
					scope:emperor = {
						ai_compassion <= high_negative_ai_value
					}
				}
				add_character_flag = {
					flag = demon_emperor_cruel
					days = 5
				}
			}
			1 = {
				modifier = {
					factor = 15
					scope:emperor = {
						ai_honor <= high_negative_ai_value
					}
				}
				add_character_flag = {
					flag = demon_emperor_generic
					days = 5
				}
				if = {
					limit = {
						scope:emperor = {
							is_adult = yes
						}
					}
					scope:emperor = { add_character_flag = is_naked }
				}
			}
		}
		if = {
			limit = {
				maa_regiments_max_count > maa_regiments_count
				any_maa_regiment = {
					is_title_maa_regiment = yes
				}
			}
			ordered_maa_regiment = {
				order_by = maa_size
				limit = {
					is_title_maa_regiment = yes
				}
				position = 0
				save_scope_value_as = {
					name = regiment_size
					value = maa_size
				}
				save_scope_as = regiment
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = zealous
					piety_level >= 3
				}
				exists = root.faith.religious_head
				NOT = {
					root.faith.religious_head = {
						this = root
					}
				}
			}
			root.faith.religious_head = { save_scope_as = faith_head }
		}
	}
	#DEMON!
	option = {
		name = ep3_governor_yearly.3050.a
		trigger = {
			OR = {
				has_trait = zealous
				piety_level >= 3
			}
		}
		reason = piety_level
		add_piety = major_piety_gain
		scope:emperor = {
			add_opinion = {
				modifier = insulted_opinion
				target = root
				opinion = -50
			}
		}
		if = {
			limit = {
				exists = scope:faith_head
			}
			scope:faith_head = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 20
				}
			}
		}
		stress_impact = {
			paranoid = minor_stress_impact_loss
			eccentric = minor_stress_impact_loss
			cynical = major_stress_impact_gain
			calm = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_zeal = 1
				ai_rationality = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = calm
					has_trait = forgiving
				}
			}
		}
	}
	#Why should the troops answer to such a poser... and not me?
	option = {
		name = ep3_governor_yearly.3050.b
		trigger = {
			is_governor = yes
			influence_level >= 3
		}
		reason = influence_level
		add_character_flag = {
			flag = low_legitimacy_admin_factions_flag
			years = 20
		}
		scope:emperor = {
			send_interface_message = {
				type = msg_governor_challenging_illegitimacy
				title = msg_governor_challenging_illegitimacy.t
				desc = msg_governor_challenging_illegitimacy.desc
				right_icon = scope:root_scope
				
				custom_tooltip = ep3_governor_yearly_3050_factions_emp_tooltip
				add_legitimacy = miniscule_legitimacy_loss
			}
		}
		
		if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 1
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 1
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 2
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 2
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 3
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 3
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 4
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 4
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 5
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 5
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 6
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 6
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 7
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 7
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 8
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 8
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 9
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 9
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 10
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 10
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 11
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 11
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 12
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 12
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 13
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 13
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value = 14
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 14
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else_if = {
			limit = {
				exists = scope:regiment
				ep3_governor_yearly_3050_regiment_size_value >= 15
			}
			create_maa_regiment = {
				type_of = scope:regiment
				check_can_recruit = no
				size = 15
			}
			scope:regiment = { destroy_maa_regiment = yes }
		}
		else = {
			add_prestige = medium_prestige_gain
			change_influence = minor_influence_gain
		}
		add_trait = disloyal
		
		stress_impact = {
			disloyal = minor_stress_impact_loss
			loyal = medium_stress_impact_gain
			just = major_stress_impact_gain
			trusting = medium_stress_impact_gain
			humble = major_stress_impact_gain
			content = medium_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_greed = 1
				ai_boldness = 1
				ai_honor = -1
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value < -20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value < -70
				}
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value >= 0
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = trusting
					has_trait = humble
					has_trait = content
					has_trait = loyal
				}
				opinion = {
					target = scope:emperor
					value >= 60
				}
			}
		}
	}
	#He needs my support!
	option = {
		name = ep3_governor_yearly.3050.c
		flavor = ep3_governor_yearly.3050.c.flavor
		scope:emperor = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		
		scope:emperor = {
			send_interface_message = {
				type = msg_governor_supports_rule
				title = msg_governor_supports_rule.t
				desc = msg_governor_supports_rule.desc
				right_icon = scope:root_scope
				
				add_legitimacy = miniscule_legitimacy_gain
				random = {
					chance = 20
					root = { add_trait = loyal }
				}
			}
		}
		stress_impact = {
			loyal = miniscule_stress_impact_loss
			arbitrary = major_stress_impact_gain
			paranoid = medium_stress_impact_gain
			fickle = medium_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 2
				ai_compassion = 0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value < -20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value > 20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value > 70
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = arbitrary
					has_trait = paranoid
					has_trait = fickle
					has_trait = deceitful
				}
				opinion = {
					target = scope:emperor
					value <= 70
				}
			}
		}
	}
	#A perfect time to get involved in imperial politics... and neglect my other duties
	option = {
		name = ep3_governor_yearly.3050.d
		
		if = {
			limit = {
				is_governor = yes
				NOT = { has_character_flag = ep3_governor_yearly_3050_neglect_duties }
			}
			change_influence = medium_influence_gain
			#Lose governor efficiency
			custom_tooltip = ep3_governor_yearly_3050_neglect_duties_tooltip
			add_character_flag = {
				flag = ep3_governor_yearly_3050_neglect_duties
				years = 10
			}
		}
		else_if = {
			limit = {
				NOT = {
					has_character_modifier = ep3_neglecting_house_head_duties_modifier
				}
			}
			change_influence = minor_influence_gain
			add_character_modifier = {
				modifier = ep3_neglecting_house_head_duties_modifier
				years = 10
			}
		}
		else = {
			change_influence = medium_influence_gain
			add_prestige = minor_prestige_loss
		}

		stress_impact = {
			diligent = medium_stress_impact_gain
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_greed = 0.5
				ai_energy = -0.5
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value <= -70
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value < 0
				}
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value >= 50
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = honest
					has_trait = humble
				}
				opinion = {
					target = scope:emperor
					value >= 80
				}
			}
		}
	}
	after = {
		if = {
			limit = {
				scope:emperor = {
					has_character_flag = is_naked
				}
			}
			scope:emperor = {
				remove_character_flag = is_naked
			}
		}
	}
}

#####################################
# A Resplendent Coronation			#
# by Jason Cantalini				#
# 3060	 							#
#####################################

#Admin Imperial Succession event
ep3_governor_yearly.3060 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_holder = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
				}
				desc = ep3_governor_yearly.3060.t_regent
			}
			desc = ep3_governor_yearly.3060.t
		}
	}
	desc = {
		#The old Basileus is dead or usurped
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_holder = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
				}
				desc = ep3_governor_yearly.3060.intro_regent
			}
			triggered_desc = {
				trigger = {
					scope:previous_holder = {
						is_alive = yes
						NOT = {
							has_character_flag = abdicated_from_throne
						}
					}
				}
				desc = ep3_governor_yearly.3060.intro_usurper
			}
			desc = ep3_governor_yearly.3060.intro_deceased
		}
		#Where is new Basileus being acclaimed?
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_holder = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
				}
				desc = ep3_governor_yearly.3060.desc_regent
			}
			triggered_desc = {
				trigger = {
					scope:emperor = {
						has_character_flag = ep3_new_emperor_afield
					}
				}
				desc = ep3_governor_yearly.3060.desc_afield
			}
			desc = ep3_governor_yearly.3060.desc_temple
		}
		#Is it Byzantine or nah?
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_holder = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
				}
				desc = ep3_governor_yearly.3060.desc_regent_acclaim
			}
			triggered_desc = {
				trigger = {
					scope:emperor = {
						religion = {
							this = religion:christianity_religion
						}
						primary_title = {
							this = title:e_byzantium
						}
						#is either a Byzantine themselves or has a byzantine around to indicate any interest in Byzantine traditions
						OR = {
							culture = {
								has_cultural_pillar = heritage_byzantine
								OR = {
									any_parent_culture_or_above = {
										this = culture:greek
									}
									this = culture:greek
								}
							}
							any_vassal = {
								culture = {
									OR = {
										has_cultural_pillar = heritage_byzantine
										any_parent_culture_or_above = {
											this = culture:greek
										}
										this = culture:greek
									}
								}
							}
						}
						is_female = no
					}
				}
				desc = ep3_governor_yearly.3060.desc_byzantine
			}
			triggered_desc = {
				trigger = {
					scope:emperor = {
						religion = {
							this = religion:christianity_religion
						}
						primary_title = {
							this = title:e_byzantium
						}
						OR = {
							culture = {
								has_cultural_pillar = heritage_byzantine
								OR = {
									any_parent_culture_or_above = {
										this = culture:greek
									}
									this = culture:greek
								}
							}
							any_vassal = {
								culture = {
									OR = {
										has_cultural_pillar = heritage_byzantine
										any_parent_culture_or_above = {
											this = culture:greek
										}
										this = culture:greek
									}
								}
							}
						}
						is_female = yes
					}
				}
				desc = ep3_governor_yearly.3060.desc_byzantine_femme
			}
			desc = ep3_governor_yearly.3060.desc_generic
		}
		#Emperor's legitimacy
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_holder = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
				}
				desc = ep3_governor_yearly.3060.desc_regent_legit
			}
			triggered_desc = {
				trigger = {
					scope:emperor = {
						legitimacy_level >= 4
					}
				}
				desc = ep3_governor_yearly.3060.desc_high_legit
			}
			triggered_desc = {
				trigger = {
					scope:emperor = {
						legitimacy_level < 4
						legitimacy_level >= 2
					}
				}
				desc = ep3_governor_yearly.3060.desc_medium_legit
			}
			desc = ep3_governor_yearly.3060.desc_low_legit
		}
	}
	theme = emperor
	override_background = {
		trigger = {
			scope:emperor = {
				capital_county = title:c_byzantion
				OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				NOT = {
					has_character_flag = ep3_new_emperor_afield
				}
			}
		}
		reference = ep3_hagia_sophia
	}
	override_background = {
		trigger = {
			NOT = {
				scope:emperor = {
					capital_county = title:c_byzantion
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
			}
			scope:emperor = {
				tgp_is_ceremonial_regent_trigger = no # Not 'actual' ruler
				NOT = {
					has_character_flag = ep3_new_emperor_afield
				}
			}
		}
		reference = temple
	}
	override_background = {
		trigger = {
			scope:emperor = {
				has_character_flag = ep3_new_emperor_afield
				location = {
					OR = {
						terrain = desert
						terrain = drylands
						terrain = oasis
						terrain = desert_mountains
						terrain = floodplains
					}
				}
			}
		}
		reference = ce1_legendary_oasis
	}
	override_background = {
		trigger = {
			scope:emperor = {
				has_character_flag = ep3_new_emperor_afield
				location = {
					NOR = {
						terrain = desert
						terrain = drylands
						terrain = oasis
						terrain = desert_mountains
						terrain = floodplains
					}
				}
			}
		}
		reference = ce1_legendary_spring
	}
	override_background = {
		trigger = {
			exists = scope:background_throne_room_scope 
			scope:emperor = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
		}
		reference = throne_room_scope
	}
	left_portrait = {
		character = scope:emperor
		triggered_animation = {
			trigger = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
			animation = acknowledging # anim uses crucifix scepter
		}
		animation = war_over_win
	}
	right_portrait = {
		character = scope:ceremonial_liege
		animation = holding_hu
		camera = camera_event_right_forward
	}
	lower_right_portrait = scope:previous_holder
	trigger = {
		exists = scope:emperor
		scope:emperor = {
			is_alive = yes
		}
		top_liege ?= {
			this = scope:emperor
		}
	}
	immediate = {
		play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Byzantine_Flavor/ep3_mx_sting_byzantineflavor_become_emperor"
		tgp_save_realm_ceremonial_liege_effect = yes
		if = {
			limit = {
				scope:ceremonial_liege = scope:emperor
			}
			clear_saved_scope = ceremonial_liege
		}
		scope:ceremonial_liege ?= { save_scope_as = background_throne_room_scope }
		save_scope_as = root_scope
		if = {
			limit = {
				scope:emperor = {
					OR = {
						is_travelling = yes
						is_in_army = yes
					}
					#Is not at sea
					location = {
						exists = holder
					}
				}
			}
			scope:emperor = {
				add_character_flag = {
					flag = ep3_new_emperor_afield
					days = 30
				}
			}
		}
		scope:emperor = {
			location = {
				save_scope_as = emp_location
			}
		}
		if = {
			limit = {
				has_ach_dlc_trigger = yes
				scope:emperor = {
					has_realm_law = uncrowned
				}
			}
			custom_tooltip = admin_coronation_still_req_tt
		}
	}
	#My positive relation? This is amazing news!
	option = {
		name = ep3_governor_yearly.3060.a
		trigger = {
			OR = {
				has_relation_friend = scope:emperor
				has_relation_potential_friend = scope:emperor
				has_relation_lover = scope:emperor
				has_relation_soulmate = scope:emperor
				is_allied_to = scope:emperor
				is_close_family_of = scope:emperor
				house = scope:emperor.house
				is_spouse_of = scope:emperor
			}
			NOR = {
				has_relation_rival = scope:emperor
				reverse_opinion = {
					target = scope:emperor
					value <= -25
				}
			}
		}
		if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			add_gold = medium_gold_value
			change_influence = medium_influence_gain
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			add_gold = medium_gold_value
			change_influence = minor_influence_gain
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			add_gold = minor_gold_value
			reverse_add_opinion = {
				modifier = pleased_opinion
				target = scope:emperor
				opinion = 5
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 2
				}
			}
			add_gold = minor_gold_value
			scope:emperor = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 10
				}
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 1
				}
			}
			scope:emperor = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 15
				}
			}
			add_gold = tiny_gold_value
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		else = {
			scope:emperor = {
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 20
				}
			}
			add_gold = tiny_gold_value
			change_influence = miniscule_influence_loss
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		hidden_effect = {
			add_opinion = {
				modifier = loyalty_opinion
				target = scope:emperor
				opinion = 10
			}
		}
		if = {
			limit = {
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			stress_impact = {
				base = minor_stress_impact_loss
				greedy = miniscule_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				base = medium_stress_impact_loss
				greedy = miniscule_stress_impact_loss
			}
		}
		
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
				ai_energy = 1
			}
			modifier = {
				add = 50
				has_trait = loyal
			}
			modifier = {
				add = 50
				has_trait = greedy
			}
			modifier = {
				add = 50
				scope:emperor = {
					influence_level >= 3
				}
			}
			modifier = {
				add = 50
				scope:emperor = {
					influence_level >= 4
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 2
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 0
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value >= 75
				}
			}
			modifier = {
				add = 25
				opinion = {
					target = scope:emperor
					value >= 25
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value < 0
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value <= -25
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value <= -75
				}
			}
		}
	}
	#I am a detractor of this emperor
	option = {
		name = ep3_governor_yearly.3060.b
		flavor = ep3_governor_yearly.3060.b.flavor
		if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			if = {
				limit = {
					scope:previous_holder = {
						is_alive = yes
						NOR = {
							has_character_flag = abdicated_from_throne
							this = root
						}
					}
				}
				scope:previous_holder = {
					add_opinion = {
						modifier = grateful_opinion
						target = root
						opinion = 80
					}
				}
				if = {
					limit = {
						has_multiple_players = no
						is_ai = no
						scope:previous_holder = {
							is_ruler = no
							NOT = {
								has_relation_rival = root
							}
						}
					}
					add_courtier = scope:previous_holder
					scope:previous_holder = {
						every_traveling_family_member = {
							limit = {
								this != scope:previous_holder
							}
							root = { add_courtier = prev }
							hidden_effect = {
								return_to_court = yes
							}
						}
					}
				}
			}
			change_influence = major_influence_loss
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -80
				}
			}
			#Add modifier
			add_character_modifier = {
				modifier = ep3_head_of_opposition_modifier
				years = 10
			}
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			if = {
				limit = {
					scope:previous_holder = {
						is_alive = yes
						NOR = {
							has_character_flag = abdicated_from_throne
							this = root
						}
					}
				}
				scope:previous_holder = {
					add_opinion = {
						modifier = grateful_opinion
						target = root
						opinion = 60
					}
				}
				if = {
					limit = {
						has_multiple_players = no
						is_ai = no
						scope:previous_holder = {
							is_ruler = no
							NOT = {
								has_relation_rival = root
							}
						}
					}
					add_courtier = scope:previous_holder
					scope:previous_holder = {
						every_traveling_family_member = {
							limit = {
								this != scope:previous_holder
							}
							root = { add_courtier = prev }
							hidden_effect = {
								return_to_court = yes
							}
						}
					}
				}
			}
			change_influence = medium_influence_loss
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -40
				}
			}
			#Add modifier
			add_character_modifier = {
				modifier = ep3_head_of_opposition_modifier
				years = 5
			}
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			if = {
				limit = {
					scope:previous_holder = {
						is_alive = yes
						NOR = {
							has_character_flag = abdicated_from_throne
							this = root
						}
					}
				}
				scope:previous_holder = {
					add_opinion = {
						modifier = grateful_opinion
						target = root
						opinion = 40
					}
				}
				if = {
					limit = {
						has_multiple_players = no
						is_ai = no
						scope:previous_holder = {
							is_ruler = no
							NOT = {
								has_relation_rival = root
							}
						}
					}
					add_courtier = scope:previous_holder
					scope:previous_holder = {
						every_traveling_family_member = {
							root = { add_courtier = prev }
							hidden_effect = {
								return_to_court = yes
							}
						}
					}
				}
			}
			add_prestige = medium_prestige_gain
			change_influence = miniscule_influence_gain
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -50
				}
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 2
				}
			}
			if = {
				limit = {
					scope:previous_holder = {
						is_alive = yes
						NOR = {
							has_character_flag = abdicated_from_throne
							this = root
						}
					}
				}
				scope:previous_holder = {
					add_opinion = {
						modifier = grateful_opinion
						target = root
						opinion = 20
					}
				}
			}
			add_prestige = minor_prestige_gain
			change_influence = minor_influence_gain
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -40
				}
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 1
				}
			}
			if = {
				limit = {
					scope:previous_holder = {
						is_alive = yes
						NOR = {
							has_character_flag = abdicated_from_throne
							this = root
						}
					}
				}
				scope:previous_holder = {
					add_opinion = {
						modifier = grateful_opinion
						target = root
						opinion = 10
					}
				}
			}
			add_prestige = miniscule_prestige_gain
			change_influence = medium_influence_gain
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -40
				}
			}
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		else = {
			change_influence = medium_influence_gain
			scope:emperor = {
				add_opinion = {
					modifier = opposition_opinion
					target = root
					opinion = -20
				}
			}
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		hidden_effect = {
			add_opinion = {
				modifier = contempt_opinion
				target = scope:emperor
				opinion = -20
			}
		}

		if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			stress_impact = {
				trusting = medium_stress_impact_gain
				content = medium_stress_impact_gain
				paranoid = medium_stress_impact_gain
				craven = medium_stress_impact_gain
				humble = medium_stress_impact_gain
				loyal = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				loyal = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_boldness = 1
				ai_vengefulness = 1
				ai_energy = 1
			}
			modifier = {
				add = 50
				has_trait = disloyal
			}
			modifier = {
				add = -50
				house ?= scope:emperor.house
			}
			modifier = {
				add = -100
				scope:emperor = {
					has_hook = root
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					influence_level <= 1
				}
			}
			modifier = {
				add = -50
				scope:emperor = {
					influence_level >= 3
				}
			}
			modifier = {
				add = -50
				scope:emperor = {
					influence_level >= 4
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level <= 2
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level <= 0
				}
			}
			modifier = {
				add = -50
				opinion = {
					target = scope:emperor
					value >= 75
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value > 0
				}
			}
			modifier = {
				add = 25
				opinion = {
					target = scope:emperor
					value <= -25
				}
			}
			modifier = {
				add = 25
				opinion = {
					target = scope:emperor
					value <= -50
				}
			}
			modifier = {
				add = 25
				opinion = {
					target = scope:emperor
					value <= -75
				}
			}
			modifier = {
				factor = 0
				has_trait = loyal
			}
			modifier = {
				factor = 0
				scope:emperor = {
					legitimacy_level >= 4
				}
				OR = {
					has_trait = trusting
					has_trait = content
					has_trait = paranoid
					has_trait = craven
					has_trait = humble
				}
			}
		}
	}
	#I am a supporter of this emperor
	option = {
		name = ep3_governor_yearly.3060.c
		flavor = {
			first_valid = {
				triggered_desc = {
					trigger = {
						scope:emperor = { tgp_is_ceremonial_regent_trigger = yes }
					}
					desc = ep3_governor_yearly.3060.c.flavor_regent
				}
				triggered_desc = {
					trigger = {
						scope:emperor = {
							legitimacy_level >= 4
						}
					}
					desc = ep3_governor_yearly.3060.c.flavor_high_legit
				}
				triggered_desc = {
					trigger = {
						scope:emperor = {
							legitimacy_level <= 1
						}
					}
					desc = ep3_governor_yearly.3060.c.flavor_low_legit
				}
				desc = ep3_governor_yearly.3060.c.flavor_med_legit
			}
		}
		#High legitimacy: gain influence and a little opinion with emp
		#Low legitimacy: lose opinion and gain big opinion with emp
		
		if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			change_influence = medium_influence_gain
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			reverse_add_opinion = {
				modifier = support_opinion
				target = scope:emperor
				opinion = 10
			}
			change_influence = minor_influence_gain
			custom_tooltip = ep3_succession_high_legitimacy_tooltip
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			change_influence = miniscule_influence_loss
			reverse_add_opinion = {
				modifier = support_opinion
				target = scope:emperor
				opinion = 10
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 2
				}
			}
			change_influence = minor_influence_loss
			scope:emperor = {
				add_opinion = {
					modifier = support_opinion
					target = root
					opinion = 20
				}
			}
		}
		else_if = {
			limit = {
				scope:emperor = {
					legitimacy_level >= 1
				}
			}
			scope:emperor = {
				add_opinion = {
					modifier = support_opinion
					target = root
					opinion = 30
				}
			}
			change_influence = medium_influence_loss
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		else = {
			scope:emperor = {
				add_opinion = {
					modifier = support_opinion
					target = root
					opinion = 50
				}
			}
			change_influence = major_influence_loss
			custom_tooltip = ep3_succession_low_legitimacy_tooltip
		}
		hidden_effect = {
			add_opinion = {
				modifier = loyalty_opinion
				target = scope:emperor
				opinion = 10
			}
		}
		if = {
			limit = {
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			stress_impact = {
				arrogant = medium_stress_impact_gain
				paranoid = medium_stress_impact_gain
				craven = medium_stress_impact_gain
				ambitious = medium_stress_impact_gain
				disloyal = medium_stress_impact_gain
				fickle = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				disloyal = medium_stress_impact_gain
			}
		}
		
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
				ai_energy = 1
			}
			modifier = {
				add = 100
				has_trait = loyal
			}
			modifier = {
				add = 50
				house ?= scope:emperor.house
			}
			modifier = {
				add = 100
				scope:emperor = {
					has_hook = root
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					influence_level <= 1
				}
			}
			modifier = {
				add = 50
				scope:emperor = {
					influence_level >= 3
				}
			}
			modifier = {
				add = 50
				scope:emperor = {
					influence_level >= 4
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 3
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 4
				}
			}
			modifier = {
				add = 25
				scope:emperor = {
					legitimacy_level >= 5
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 2
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 1
				}
			}
			modifier = {
				add = -25
				scope:emperor = {
					legitimacy_level <= 0
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:emperor
					value >= 75
				}
			}
			modifier = {
				add = 25
				opinion = {
					target = scope:emperor
					value >= 25
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value < 0
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value <= -25
				}
			}
			modifier = {
				add = -25
				opinion = {
					target = scope:emperor
					value <= -75
				}
			}
			modifier = {
				factor = 0
				has_trait = disloyal
			}
			modifier = {
				factor = 0
				scope:emperor = {
					legitimacy_level <= 1
				}
				OR = {
					has_trait = disloyal
					has_trait = arrogant
					has_trait = craven
					has_trait = paranoid
					has_trait = ambitious
					has_trait = fickle
				}
			}
		}
	}
	#No opinion...
	option = {
		name = {
			trigger = {
				scope:emperor = { tgp_is_ceremonial_regent_trigger = yes } # Not 'actual' ruler
			}
			text = ep3_governor_yearly.3060.d.regent
		}
		name = {
			trigger = {
				scope:emperor = { tgp_is_ceremonial_regent_trigger = no } # Not 'actual' ruler
			}
			text = ep3_governor_yearly.3060.d
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = -1
				ai_sociability = -1
			}
		}
	}
}

scripted_trigger ep3_governor_yearly_3070_racer_trigger = {
	is_alive = yes
	is_adult = yes
	age < 45
	is_available = yes
	ai_energy >= low_negative_ai_value
	NOT = {
		has_character_modifier = obese_modifier
	}
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
	NOT = { is_primary_heir_of = scope:liege }
}

scripted_trigger ep3_governor_yearly_3070_close_governor_trigger = {
	is_governor = yes
	NOR = {
		this = root
		house = root.house
		primary_heir = root
		primary_heir.house ?= {
			this = root.house
		}
	}
	any_sub_realm_county = {
		count >= ep3_governor_yearly_3070_governorship_value
	}
}

#####################################
# A Well-Traveled Tongue			#
# by Jason Cantalini				#
# 3070	 							#
#####################################

#You are very distant from the emperor and a traveler from the imperial court is visiting to mock you
ep3_governor_yearly.3070 = {
	type = character_event
	title = ep3_governor_yearly.3070.t
	desc = {
		desc = ep3_governor_yearly.3070.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					is_landed = yes
				}
				desc = ep3_governor_yearly.3070.landed
			}
			desc = ep3_governor_yearly.3070.unlanded
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:liege.culture = {
						has_cultural_parameter = hosts_chariot_races
					}
				}
				desc = ep3_governor_yearly.3070.chariot
			}
			desc = ep3_governor_yearly.3070.horse
		}
		desc = ep3_governor_yearly.3070.desc
	}
	#Loc for young racer making fun of you
	theme = administrative
	override_background = {
		reference = terrain_travel
	}

	left_portrait = {
		character = scope:rider
		animation = jockey_gallop
		camera = camera_event_horse_left
	}

	right_portrait = {
		character = scope:charioteer
		animation = chariot_neutral
		camera = camera_event_chariot_right
	}

	lower_right_portrait = scope:close_governor
	
	trigger = {
		top_liege != this
		government_allows = administrative
		OR = {
			AND = {
				is_landed = yes
				NOT = {
					any_sub_realm_county = {
						any_neighboring_county = {
							holder = root.liege
						}
					}
				}
			}
			AND = {
				is_landless_administrative = yes
				#This will make absolutely no sense if landless root's domicile is in liege's capital province
				domicile.domicile_location = {
					this != root.top_liege.capital_province
				}
				#Either liege is top liege or root's domicile is in liege's sub realm
				OR = {
					liege = {
						top_liege = this
					}
					liege = {
						top_liege != this
						any_sub_realm_county = {
							this = root.domicile.domicile_location.county
						}
					}
				}
			}
		}
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		is_at_war = no
		trigger_if = {
			limit = {
				is_landed = yes
			}
			capital_province = {
				save_temporary_scope_as = root_capital_temp
			}
		}
		trigger_else = {
			domicile = {
				domicile_location = {
					save_temporary_scope_as = root_capital_temp
				}
			}
		}
		OR = {
			#EMPEROR LIEGE
			#Long range if both imperial capital and root's are coastal
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				liege.capital_county = {
					is_coastal_county = yes
				}
				scope:root_capital_temp.county = {
					is_coastal_county = yes
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 200000
			}
			#Medium range for one or the other
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				OR = {
					liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 150000
			}
			#Short range if neither is coastal
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				NOR = {
					liege.capital_county = {
						is_coastal_county = yes
					}
					scope:root_capital_temp.county = {
						is_coastal_county = yes
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 100000
			}

			#KING LIEGE
			#Long range if both imperial capital and root's are coastal
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 100000
			}
			#Medium range for one or the other
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				OR = {
					liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 75000
			}
			#Short range if neither is coastal
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 50000
			}
		}
		liege = {
			save_temporary_scope_as = temp_liege
			
			any_courtier_or_guest = {
				NOT = {
					is_foreign_court_guest = yes
				}
				is_alive = yes
				is_adult = yes
				age <= 45
				is_available = yes
				ai_energy >= low_negative_ai_value
				NOT = {
					has_character_modifier = obese_modifier
				}
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:temp_liege }
				NOT = { is_primary_heir_of = scope:temp_liege }
			}
		}
	}

	cooldown = {
		years = 10
	}

	immediate = {
		if = {
			limit = {
				is_landed = yes
			}
			capital_province = {
				save_scope_as = root_capital
			}
		}
		else = {
			domicile = {
				domicile_location = {
					save_scope_as = root_capital
				}
			}
		}
		liege = {
			save_scope_as = liege
		}
		scope:liege = {
			if = {
				limit = {
					culture = {
						has_cultural_parameter = hosts_chariot_races
					}
				}
				if = {
					limit = {
						any_court_position_holder = {
							type = charioteer_court_position
							ep3_governor_yearly_3070_racer_trigger = yes
						}
					}
					random_court_position_holder = {
						type = charioteer_court_position
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = charioteer
					}
				}
				else_if = {
					limit = {
						house = {
							any_house_member = {
								is_courtier_of = scope:liege
								ep3_governor_yearly_3070_racer_trigger = yes
							}
						}
					}
					house = {
						random_house_member = {
							limit = {
								is_courtier_of = scope:liege
								ep3_governor_yearly_3070_racer_trigger = yes
							}
							save_scope_as = charioteer
						}
					}
				}
				else_if = {
					limit = {
						any_courtier = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
					}
					random_courtier = {
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = charioteer
					}
				}
				else = {
					random_pool_guest = {
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = charioteer
					}
				}
				scope:charioteer = {
					save_scope_as = racer
				}
			}
			else = {
				if = {
					limit = {
						any_court_position_holder = {
							type = charioteer_court_position
							ep3_governor_yearly_3070_racer_trigger = yes
						}
					}
					random_court_position_holder = {
						type = charioteer_court_position
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = rider
					}
				}
				else_if = {
					limit = {
						house ?= {
							any_house_member = {
								is_courtier_of = scope:liege
								ep3_governor_yearly_3070_racer_trigger = yes
							}
						}
					}
					house = {
						random_house_member = {
							limit = {
								is_courtier_of = scope:liege
								ep3_governor_yearly_3070_racer_trigger = yes
							}
							save_scope_as = rider
						}
					}
				}
				else_if = {
					limit = {
						any_courtier = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
					}
					random_courtier = {
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = rider
					}
				}
				else = {
					random_pool_guest = {
						limit = {
							ep3_governor_yearly_3070_racer_trigger = yes
						}
						save_scope_as = rider
					}
				}
				scope:rider = {
					save_scope_as = racer
				}
			}
		}
		if = {
			limit = {
				scope:liege = {
					any_vassal = {
						ep3_governor_yearly_3070_close_governor_trigger = yes
					}
					any_sub_realm_county = {
						any_neighboring_county = {
							holder = scope:liege
						}
					}
				}
			}
			scope:liege = {
				random_vassal = {
					limit = {
						ep3_governor_yearly_3070_close_governor_trigger = yes
						any_sub_realm_county = {
							any_neighboring_county = {
								holder = scope:liege
							}
						}
					}
					save_scope_as = close_governor
				}
			}
		}
		else_if = {
			limit = {
				scope:liege = {
					any_vassal = {
						ep3_governor_yearly_3070_close_governor_trigger = yes
						save_temporary_scope_as = temp_vassal
						"scope:liege.capital_province.squared_distance(scope:temp_vassal.capital_province)" < 25000
					}
					
				}
			}
			scope:liege = {
				random_vassal = {
					limit = {
						ep3_governor_yearly_3070_close_governor_trigger = yes
						save_temporary_scope_as = temp_vassal
						ep3_governor_yearly_3070_close_governor_trigger = yes
						"scope:liege.capital_province.squared_distance(scope:temp_vassal.capital_province)" < 25000
					}
					save_scope_as = close_governor
				}
			}
		}
	}
	#You're blind if you don't see the opportunities out here
	option = {
		name = ep3_governor_yearly.3070.a
		trigger = {
			has_trait = governor
			has_trait_xp = {
				trait = governor
				value >= 40
			}
		}
		increase_governance_effect = { VALUE = 5 }
		add_prestige = minor_prestige_gain
		root.primary_title = {
			ordered_title_heir = {
				order_by = "appointment_candidate_score(root.primary_title)"
				max = 1
				limit = {
					house = root.house
				}
				root.primary_title = {
					change_appointment_investment = {
						target = prev
						value = appointment_score_minor_value
					}
				}
			}
		}
		stress_impact = {
			fickle = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_greed = -0.5
				ai_energy = -0.5
				ai_honor = 0.5
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = fickle
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}
	}
	#I'll move my domicile
	option = {
		name = ep3_governor_yearly.3070.b
		trigger = {
			is_landed = no
		}
		change_influence = medium_influence_gain
		domicile = {
			move_domicile = scope:liege.capital_province
		}
		house = {
			every_house_member = {
				custom = custom.every_house_member
				limit = {
					NOR = {
						this = root
						this = scope:liege
					}
					age > 3
				}
				change_influence = miniscule_influence_gain
				add_opinion = {
					modifier = uprooted_family_opinion
					target = root
					opinion = -20
				}
			}
		}
		
		every_spouse = {
			change_influence = miniscule_influence_gain
			add_opinion = {
				modifier = uprooted_family_opinion
				target = root
				opinion = -20
			}
		}
		remove_short_term_gold = minor_gold_value
		stress_impact = {
			stubborn = minor_stress_impact_gain
			lazy = medium_stress_impact_gain
			content = medium_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_sociability = 1
				
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = stubborn
					has_trait = lazy
					has_trait = shy
					has_trait = content
					short_term_gold < minor_gold_value
				}
			}
		}
	}
	#I need to get a more relevant appointment...
	option = {
		trigger = {
			exists = scope:close_governor
		}
		name = ep3_governor_yearly.3070.c
		flavor = ep3_governor_yearly.3070.c.flavor
		scope:close_governor.primary_title = {
			change_appointment_investment = {
				target = root
				value = appointment_score_medium_value
			}
		}
		scope:racer = {
			add_hook = {
				type = favor_hook
				target = root
			}
		}

		stress_impact = {
			humble = medium_stress_impact_gain
			content = medium_stress_impact_gain
			patient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_greed = 1
				
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = humble
					has_trait = content
				}
			}
		}
	}
	#He's right... we need to improve the roads or this place will remain irrelevant
	option = {
		name = ep3_governor_yearly.3070.d
		trigger = {
			is_landed = yes
		}
		remove_treasury_or_gold = medium_treasury_or_gold_value
		duel = {
			skills = { stewardship learning }
			value = medium_skill_rating
			55 = { #Your road-building efforts go well
				desc = ep3_governor_yearly.3070.d.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -54
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_governor_yearly.3070.d.success
					increase_governance_effect = { VALUE = 10 }
					change_influence = minor_influence_gain
					every_sub_realm_county = {
						custom = custom.every_sub_realm_county
						change_development_progress = medium_development_progress_gain
					}

				}
			}
			45 = { #Your province remains isolated... but now it's poorer
				desc = ep3_governor_yearly.3070.d.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -44
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3070.d.fail
					change_influence = miniscule_influence_loss
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_rationality = 1
			}
			modifier = {
				add = 50
				OR = {
					stewardship > very_high_skill_rating
					learning > very_high_skill_rating
					AND = {
						stewardship >= high_skill_rating
						learning >= high_skill_rating
					}
				}
			}
			modifier = {
				add = -50
				OR = {
					stewardship < average_skill_rating
					learning < average_skill_rating
					AND = {
						stewardship <= medium_skill_rating
						learning <= medium_skill_rating
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					short_term_treasury_or_gold < medium_treasury_or_gold_value
					stewardship < low_skill_rating
					learning < low_skill_rating
				}
			}
		}
	}
	#My quaint little corner of the world is nice
	option = {
		name = ep3_governor_yearly.3070.e
		if = {
			limit = {
				culture != capital_county.culture
			}
			culture = {
				change_cultural_acceptance = {
					target = root.capital_county.culture
					value = low_positive_culture_acceptance
					desc = cultural_acceptance_gain_content_governor
				}
			}
		}
		else_if = {
			limit = {
				culture = scope:liege.culture
				has_dlc_feature = diverge_culture
				NOT = {
					has_character_flag = diverging_culture_discount
				}
			}
			add_character_flag = diverging_culture_discount
			custom_tooltip = diverging_culture_discount_tooltip
		}
		else_if = {
			limit = {
				culture = scope:liege.culture
			}
			add_piety = minor_piety_gain
		}
		else = {
			add_character_modifier = {
				modifier = contented_governing_countrymen_modifier
				years = 10
				desc = contented_governing_countrymen_modifier_tooltip
			}
		}
		change_influence = minor_influence_loss
		if = {
			limit = {
				OR = {
					culture != capital_county.culture
					culture = scope:liege.culture
				}
			}
			stress_impact = {
				base = medium_stress_impact_loss
				impatient = minor_stress_impact_gain
				ambitious = medium_stress_impact_gain
				greedy = medium_stress_impact_gain
				arrogant = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				base = minor_stress_impact_loss
				impatient = minor_stress_impact_gain
				ambitious = medium_stress_impact_gain
				greedy = medium_stress_impact_gain
				arrogant = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_greed = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = ambitious
					has_trait = arrogant
					has_trait = impatient
				}
			}
		}
	}
}

#####################################
# Taken by the Sea					#
# by Jason Cantalini				#
# 3080	 							#
#####################################

scripted_trigger ep3_governor_yearly_3080_captain_trigger = {
	is_alive = yes
	is_adult = yes
	age <= 55
	is_available = yes
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
	OR = {
		prowess > low_skill_rating
		martial > low_skill_rating
	}
	is_foreign_court_guest = no
	NOR = {
		is_primary_heir_of = root
		is_player_heir_of = root
	}
}

#You are very distant from the emperor and shipments to you are being lost
ep3_governor_yearly.3080 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:liege.capital_county = {
						is_coastal_county = yes
					}
					NOT = {
						any_sub_realm_county = {
							is_coastal_county = no
						}
					}
				}
				desc = ep3_governor_yearly.3080.t_sea
			}
			desc = ep3_governor_yearly.3080.t
		}
	}
	desc = {
		desc = ep3_governor_yearly.3080.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:rebel_faction
				}
				desc = ep3_governor_yearly.3080.desc_faction
			}
			desc = ep3_governor_yearly.3080.desc
		}
	}
	theme = administrative
	override_background = {
		trigger = {
			scope:liege.capital_county = {
				is_coastal_county = yes
			}
			NOT = {
				any_sub_realm_county = {
					is_coastal_county = no
				}
			}
		}
		reference = ocean
	}
	override_background = {
		trigger = {
			OR = {
				scope:liege.capital_county = {
					is_coastal_county = no
				}
				any_sub_realm_county = {
					is_coastal_county = no
				}
			}
		}
		reference = terrain_travel
	}

	left_portrait = {
		character = root
		animation = anger
		camera = camera_event_left_forward
	}

	right_portrait = {
		character = scope:captain
		triggered_animation = {
			trigger = {
				exists = scope:rebel_faction
			}
			animation = throne_room_two_handed_passive_1
		}
		triggered_animation = {
			trigger = {
				NOT = {
					exists = scope:rebel_faction
				}
			}
			animation = survey
		}
		camera = camera_event_right_pointing_left
	}
	lower_right_portrait = scope:liege
	
	trigger = {
		is_landed = yes
		government_has_flag = government_is_administrative
		top_liege != this
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		is_at_war = no
		age >= 8
		capital_province = {
			save_temporary_scope_as = root_capital_temp
		}
		OR = {
			#EMPEROR LIEGE
			#Long range if both imperial capital and root's are coastal
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				liege.capital_county = {
					is_coastal_county = yes
				}
				scope:root_capital_temp.county = {
					is_coastal_county = yes
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 400000
			}
			#Medium range for one or the other
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				OR = {
					liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 300000
			}
			#Short range if neither is coastal
			AND = {
				liege = {
					highest_held_title_tier >= tier_empire
				}
				NOR = {
					liege.capital_county = {
						is_coastal_county = yes
					}
					scope:root_capital_temp.county = {
						is_coastal_county = yes
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 200000
			}

			#KING LIEGE
			#Long range if both imperial capital and root's are coastal
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 200000
			}
			#Medium range for one or the other
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				OR = {
					liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 150000
			}
			#Short range if neither is coastal
			AND = {
				liege = {
					highest_held_title_tier <= tier_kingdom
				}
				liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"liege.capital_province.squared_distance(scope:root_capital_temp)" > 100000
			}
		}
		OR = {
			any_knight = {
				ep3_governor_yearly_3080_captain_trigger = yes
			}
			any_courtier_or_guest = {
				ep3_governor_yearly_3080_captain_trigger = yes
			}
		}
	}

	cooldown = {
		years = 10
	}

	immediate = {
		capital_province = {
			save_scope_as = root_capital
		}
		liege = {
			save_scope_as = liege
		}
		if = {
			limit = {
				any_knight = {
					ep3_governor_yearly_3080_captain_trigger = yes
				}
			}
			random_knight = {
				limit = {
					ep3_governor_yearly_3080_captain_trigger = yes
				}
				save_scope_as = captain
			}
		}
		else_if = {
			limit = {
				any_courtier = {
					ep3_governor_yearly_3080_captain_trigger = yes
				}
			}
			random_courtier = {
				limit = {
					ep3_governor_yearly_3080_captain_trigger = yes
				}
				save_scope_as = captain
			}
		}
		else = {
			random_pool_guest = {
				limit = {
					ep3_governor_yearly_3080_captain_trigger = yes
				}
				save_scope_as = captain
			}
		}
		if = {
			limit = {
				any_targeting_faction = {
					OR = {
						faction_is_type = populist_faction
						faction_is_type = peasant_faction
					}
				}
			}
			random_targeting_faction = {
				limit = {
					OR = {
						faction_is_type = populist_faction
						faction_is_type = peasant_faction
					}
				}
				save_scope_as = rebel_faction
			}
		}
		if = {
			limit = {
				exists = scope:rebel_faction
			}
			capital_county = {
				change_county_control = miniscule_county_control_loss
			}
		}
		else = {
			add_character_flag = {
				flag = ep3_governor_ignored_isolation
				years = 5
			}
			custom_tooltip = ep3_governor_ignored_isolation_tooltip
		}
	}
	#Long-term improvements are needed or this will only happen again
	option = {
		trigger = {
			has_trait = governor
			stewardship >= very_high_skill_rating
		}
		name = ep3_governor_yearly.3080.a
		if = {
			limit = {
				exists = scope:rebel_faction
				NOT = {
					has_character_modifier = ep3_face_of_empire_modifier
				}
			}
			add_character_modifier = {
				modifier = ep3_face_of_empire_modifier
				years = 20
			}
		}
		else = {
			capital_county = {
				change_development_progress = medium_development_progress_gain
			}
		}
		increase_governance_effect = { VALUE = 5 }
		stress_impact = {
			diligent = miniscule_stress_impact_loss
			impatient = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_rationality = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = impatient
					has_trait = fickle
					has_trait = trusting
				}
			}
		}
	}
	#I need to get out of here...
	option = {
		name = ep3_governor_yearly.3080.b
		change_influence = minor_influence_gain
		add_character_modifier = {
			modifier = ep3_anxious_for_new_assignment_modifier
			years = 5
			desc = ep3_anxious_for_new_assignment_desc
		}
		custom_tooltip = ep3_anxious_for_new_assignment_tooltip
		stress_impact = {
			diligent = medium_stress_impact_gain
			just = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			content = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_honor = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = just
					has_trait = humble
					has_trait = calm
					has_trait = content
				}
			}
		}
	}
	#We can take care of the rebels ourselves
	option = {
		trigger = {
			exists = scope:rebel_faction
		}
		name = ep3_governor_yearly.3080.c
		duel = {
			skills = { martial diplomacy }
			value = medium_skill_rating
			55 = { #You subdue them
				desc = ep3_governor_yearly.3080.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -54
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_governor_yearly.3080.c.success
					increase_governance_effect = { VALUE = 10 }
					if = {
						limit = {
							scope:captain = {
								is_acclaimed = yes
							}
						}
						scope:captain.accolade = {
							add_glory = medium_glory_gain
						}
					}
					else = {
						scope:rebel_faction = {
							add_faction_discontent = medium_discontent_loss
						}
					}
					capital_county = {
						change_county_control = minor_county_control_gain
					}
				}
			}
			35 = { #The rebs remain angry
				desc = ep3_governor_yearly.3080.c.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -34
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3080.c.fail
					scope:captain = {
						increase_wounds_effect = { REASON = fight }
					}
					scope:rebel_faction = {
						add_faction_discontent = minor_discontent_gain
					}
				}
			}
			10 = { #The rebs are very very angry
				desc = ep3_governor_yearly.3080.c.crit_fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -9
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3080.c.crit_fail
					
					scope:captain = {
						death = {
							death_reason = death_disappearance
						}
					}
					capital_county = {
						change_county_control = medium_county_control_loss
					}
					scope:rebel_faction = {
						add_faction_discontent = medium_discontent_gain
					}
				}
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_boldness = 1
			}
			modifier = {
				add = -50
				OR = {
					diplomacy < average_skill_rating
					martial < average_skill_rating
					AND = {
						diplomacy <= medium_skill_rating
						martial <= medium_skill_rating
					}
				}
			}
			modifier = {
				add = 50
				OR = {
					diplomacy >= very_high_skill_rating
					martial >= very_high_skill_rating
					AND = {
						diplomacy >= decent_skill_rating
						martial >= decent_skill_rating
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = lazy
					diplomacy < low_skill_rating
					martial < low_skill_rating
					AND = {
						diplomacy <= decent_skill_rating
						martial <= decent_skill_rating
					}
				}
			}
		}
	}

	#Go, find the lost post-haste!
	option = {
		trigger = {
			NOT = { exists = scope:rebel_faction }
		}
		name = ep3_governor_yearly.3080.d
		duel = {
			skills = { diplomacy intrigue }
			value = medium_skill_rating
			55 = { #You manage to recover lost shipments and scrounge replacements up
				desc = ep3_governor_yearly.3080.d.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -54
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_governor_yearly.3080.d.success
					increase_governance_effect = { VALUE = 10 }
					remove_character_flag = ep3_governor_ignored_isolation
					custom_tooltip = ep3_governor_ignored_isolation_removal_tooltip
				}
			}
			35 = { #You find nothing
				desc = ep3_governor_yearly.3080.d.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -34
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3080.d.fail
				}
			}
			10 = { #You waste money on a total debacle
				desc = ep3_governor_yearly.3080.d.crit_fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -9
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3080.d.crit_fail
					
					capital_county = {
						change_development_progress = medium_development_progress_loss
					}
				}
			}
		}
		stress_impact = {
			craven = minor_stress_impact_gain
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_boldness = 0.5
			}
			modifier = {
				add = -50
				OR = {
					diplomacy < average_skill_rating
					intrigue < average_skill_rating
					AND = {
						diplomacy <= medium_skill_rating
						intrigue <= medium_skill_rating
					}
				}
			}
			modifier = {
				add = 50
				OR = {
					diplomacy >= very_high_skill_rating
					intrigue >= very_high_skill_rating
					AND = {
						diplomacy >= decent_skill_rating
						intrigue >= decent_skill_rating
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = lazy
					diplomacy < low_skill_rating
					intrigue < low_skill_rating
					AND = {
						diplomacy <= decent_skill_rating
						intrigue <= decent_skill_rating
					}
				}
			}
		}
	}
	
	#Whaddaya gonna do *shrug*
	option = {
		name = ep3_governor_yearly.3080.e
		stress_impact = {
			base = minor_stress_impact_loss
			diligent = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			lazy = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_greed = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = paranoid
					has_trait = ambitious
					has_trait = greedy
				}
			}
		}
	}
	after = {
		if = {
			limit = {
				scope:captain ?= {
					has_character_flag = need_military_outfit
				}
			}
			scope:captain = {
				remove_character_flag = need_military_outfit
			}
		}
	}
}

#####################################
# The Heart of the Byzantine Empire	#
# by Jason Cantalini				#
# 3090	 							#
#####################################

#Your estate/province is at the center of the action and it's great
ep3_governor_yearly.3090 = {
	type = character_event
	title = ep3_governor_yearly.3090.t
	desc = {
		desc = ep3_governor_yearly.3090.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					is_landed = yes
				}
				desc = ep3_governor_yearly.3090.landed
			}
			desc = ep3_governor_yearly.3090.unlanded
		}
	}
	
	theme = administrative
	override_background = {
		trigger = {
			scope:root_capital.county = {
				culture = {
					OR = {
						has_graphical_mediterranean_culture_group_trigger = yes
						has_graphical_mena_culture_group_trigger = yes
						has_graphical_african_culture_group_trigger = yes
					}
				}
			}
		}
		reference = ep3_city_gate
	}
	override_background = {
		trigger = {
			scope:root_capital.county = {
				culture_has_east_asian_heritage_pillar_trigger = yes
			}
		}
		reference = market
	}
	override_background = {
		trigger = {
			scope:root_capital.county = {
				culture = {
					NOR = {
						has_graphical_mediterranean_culture_group_trigger = yes
						has_graphical_mena_culture_group_trigger = yes
						has_graphical_african_culture_group_trigger = yes
					}
					culture_has_east_asian_heritage_pillar_trigger = no
				}
			}
		}
		reference = tour_arrival
	}

	left_portrait = {
		character = root
		animation = jockey_wave
		camera = camera_event_horse_left
	}
	lower_right_portrait = scope:liege
	
	trigger = {
		age >= 8
		top_liege != this
		government_allows = administrative
		exists = domicile
		trigger_if = {
			limit = {
				is_landed = yes
			}
			capital_province = {
				save_temporary_scope_as = root_capital_temp
			}
		}
		trigger_else = {
			domicile = {
				domicile_location = {
					save_temporary_scope_as = root_capital_temp
				}
			}
		}
		OR = {
			is_landed = yes
			is_landless_administrative = yes
		}
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		is_at_war = no
		
		#Capital is not a border province
		NOT = {
			scope:root_capital_temp.county = {
				any_neighboring_county = {
					holder = {
						top_liege != root.top_liege
					}
				}
			}
		}
		scope:root_capital_temp.county = {
			culture = root.top_liege.capital_county.culture
		}
		
		OR = {
			scope:root_capital_temp = {
				this = root.top_liege.capital_province
			}
			#EMPEROR LIEGE
			#Long range if both imperial capital and root's are coastal
			AND = {
				is_landed = yes
				top_liege = {
					highest_held_title_tier >= tier_empire
				}
				top_liege.capital_county = {
					is_coastal_county = yes
				}
				scope:root_capital_temp.county = {
					is_coastal_county = yes
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 80000
			}
			#Medium range for one or the other
			AND = {
				is_landed = yes
				top_liege = {
					highest_held_title_tier >= tier_empire
				}
				OR = {
					top_liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 70000
			}
			#Short range if neither is coastal
			AND = {
				is_landed = yes
				top_liege = {
					highest_held_title_tier >= tier_empire
				}
				NOR = {
					top_liege.capital_county = {
						is_coastal_county = yes
					}
					scope:root_capital_temp.county = {
						is_coastal_county = yes
					}
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 60000
			}

			#KING top_liege
			#Long range if both imperial capital and root's are coastal
			AND = {
				OR = {
					top_liege = {
						highest_held_title_tier <= tier_kingdom
					}
					is_landless_ruler = yes
				}
				top_liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 40000
			}
			#Medium range for one or the other
			AND = {
				OR = {
					top_liege = {
						highest_held_title_tier <= tier_kingdom
					}
					is_landless_ruler = yes
				}
				OR = {
					top_liege.capital_county = {
						is_coastal_county = no
					}
					scope:root_capital_temp.county = {
						is_coastal_county = no
					}
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 35000
			}
			#Short range if neither is coastal
			AND = {
				OR = {
					top_liege = {
						highest_held_title_tier <= tier_kingdom
					}
					is_landless_ruler = yes
				}
				top_liege.capital_county = {
					is_coastal_county = no
				}
				scope:root_capital_temp.county = {
					is_coastal_county = no
				}
				"top_liege.capital_province.squared_distance(scope:root_capital_temp)" < 30000
			}
		}
		OR = {
			top_liege = {
				highest_held_title_tier <= tier_empire
				realm_size >= 50
			}
			top_liege = {
				highest_held_title_tier <= tier_kingdom
				realm_size >= 20
			}
		}
	}

	cooldown = {
		years = 10
	}

	immediate = {
		if = {
			limit = {
				is_landed = yes
			}
			capital_province = { save_scope_as = root_capital }
		}
		else = {
			domicile.domicile_location = { save_scope_as = root_capital }
		}
		top_liege = { save_scope_as = liege }
	}
	#Broker access to the halls of power in exchange for $$$
	option = {
		name = ep3_governor_yearly.3090.a
		flavor = ep3_governor_yearly.3090.a.flavor
		add_gold = major_gold_value
		change_influence = miniscule_influence_loss
		
		stress_impact = {
			generous = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = compassionate
					has_trait = generous
					short_term_gold < minor_gold_value
				}
			}
		}
	}
	

	#Expand your local investments
	option = {
		name = ep3_governor_yearly.3090.b
		if = {
			limit = {
				NOT = {
					house = {
						has_house_modifier = ep3_invested_in_power_center_modifier
					}
				}
			}
			house = {
				add_house_modifier = {
					modifier = ep3_invested_in_power_center_modifier
					years = 50
				}
			}
			increase_governance_effect = { VALUE = 5 }
		}
		else_if = {
			limit = {
				OR = {
					is_landless_ruler = yes
					domicile.domicile_location = root.capital_province
				}
				NOT = {
					has_character_modifier = ep3_cosmopolitan_domicile_modifier
				}
			}
			add_character_modifier = {
				modifier = ep3_cosmopolitan_domicile_modifier
				years = 10
			}
		}
		else_if = {
			limit = {
				is_landed = yes
			}
			increase_governance_effect = { VALUE = 10 }
			capital_county = {
				change_development_progress = minor_development_progress_gain
			}
		}
		else = {
			add_stewardship_lifestyle_xp = medium_lifestyle_xp
		}
		remove_short_term_gold = minor_gold_value

		stress_impact = {
			impatient = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = fickle
					has_trait = impatient
					short_term_gold < minor_gold_value
				}
			}
		}
	}

	#Host a dinner with some influential persons
	option = {
		name = ep3_governor_yearly.3090.c
		flavor = ep3_governor_yearly.3090.c.flavor
		#Add opinion with local lords and landless admin
		change_influence = medium_influence_gain
		if = {
			limit =	{
				is_landed = yes
			}
			scope:liege = {
				every_vassal = {
					custom = custom.every_realm_vassal_local_estate
					limit = {
						domicile.domicile_location ?= {
							county = {
								holder = {
									OR = {
										this = root
										liege = root
									}
								}
							}
						}
						this != root
					}
					add_opinion = {
						modifier = friendliness_opinion
						target = root
						opinion = 10
					}
				}
			}
			every_vassal = {
				custom = custom.every_vassal
				add_opinion = {
					modifier = friendliness_opinion
					target = root
					opinion = 10
				}
	
			}
		}
		else = {
			scope:liege = {
				every_vassal = {
					custom = custom.every_vassal_same_domicile_location
					limit = {
						domicile.domicile_location ?= scope:root_capital
						this != root
					}
					add_opinion = {
						modifier = friendliness_opinion
						target = root
						opinion = 10
					}
				}
			}
			if = {
				limit = { scope:root_capital.county.holder = root.top_liege }
				scope:liege = {
					add_opinion = {
						target = root
						modifier = friendliness_opinion
						opinion = 10
					}
				}
			}
			if = {
				limit = {
					scope:liege = {
						any_close_family_member = {
							is_adult = yes
							location = scope:root_capital
							this != root
						}
					}
				}
				scope:liege = {
					random_close_family_member = {
						limit = {
							is_adult = yes
							location = scope:root_capital
							this != root
						}
						add_opinion = {
							target = root
							modifier = friendliness_opinion
							opinion = 10
						}
					}
				}
			}
			if = {
				limit = {
					scope:liege = {
						any_councillor = {
							is_adult = yes
							location = scope:root_capital
							this != root
						}
					}
				}
				scope:liege = {
					random_councillor = {
						limit = {
							is_adult = yes
							location = scope:root_capital
							this != root
						}
						add_opinion = {
							target = root
							modifier = friendliness_opinion
							opinion = 10
						}
					}
				}
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = temperate
				}
			}
		}
	}
}

#####################################
# Our Empire, Pandemonium			#
# by Jason Cantalini				#
# 3100	 							#
#####################################

scripted_trigger ep3_governor_yearly_3100_messenger_trigger = {
	is_alive = yes
	is_adult = yes
	age <= 55
	is_travelling = no
	is_in_army = no
	is_imprisoned = no
	has_contagious_deadly_disease_trigger = no
	is_incapable = no
	is_foreign_court_guest = no
	trigger_if = {
		limit = {
			exists = scope:liege_temp
		}
		can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege_temp }
		NOR = {
			is_primary_heir_of = scope:liege_temp
			is_player_heir_of = scope:liege_temp
			is_close_family_of = scope:liege_temp
			is_spouse_of = scope:liege_temp
		}
	}
	trigger_else = {
		can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
		NOR = {
			is_primary_heir_of = scope:liege
			is_player_heir_of = scope:liege
			is_close_family_of = scope:liege
			is_spouse_of = scope:liege
		}
	}
	
}

scripted_trigger ep3_governor_yearly_3100_crappy_liege_trigger = {
	#Liege sucks
	liege = {
		has_active_diarchy = no
		OR = {
			#Bad governor (won't work on emperors)
			governor_efficiency <= 0.6
			#Generally shite
			AND = {
				diplomacy <= low_skill_rating
				martial <= low_skill_rating
				stewardship <= low_skill_rating
				intrigue <= low_skill_rating
				learning <= low_skill_rating
			}

		}
	}
}

#Liege is in debt / region or empire is poorly governed
ep3_governor_yearly.3100 = {
	type = character_event
	title = ep3_governor_yearly.3100.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						liege = {
							gold <= -50
						}
						ep3_governor_yearly_3100_crappy_liege_trigger = yes
					}
				}
				desc = ep3_governor_yearly.3100.intro_liege
			}
			desc = ep3_governor_yearly.3100.intro_governors
		}
		desc = ep3_governor_yearly.3100.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					liege = {
						gold <= -50
					}
				}
				desc = ep3_governor_yearly.3100.desc_liege_debt
			}
			triggered_desc = {
				trigger = {
					ep3_governor_yearly_3100_crappy_liege_trigger = yes
				}
				desc = ep3_governor_yearly.3100.desc_liege_skill
			}
			desc = ep3_governor_yearly.3100.desc_governors
		}
	}
	
	theme = administrative

	left_portrait = {
		character = root
		animation = war_defender
	}
	right_portrait = {
		character = scope:messenger
		animation = obsequious_bow
	}
	lower_right_portrait = scope:liege
	
	trigger = {
		NOT = {
			has_government = celestial_government
		}
		age >= 12
		top_liege != this
		government_allows = administrative
		OR = {
			is_landed = yes
			is_landless_administrative = yes
		}
		has_ep3_dlc_trigger = yes
		basic_is_valid_for_yearly_events_trigger = yes
		is_at_war = no
		OR = {
			#liege is in debt
			liege = {
				gold <= -50
			}
			ep3_governor_yearly_3100_crappy_liege_trigger = yes
			#Governors of empire suck
			liege = {
				any_vassal = {
					government_allows = administrative
					is_landed = yes
					add_to_temporary_list = admin_vassals
				}
				any_in_list = {
					list = admin_vassals
					percent >= 0.5
					governor_efficiency <= 0.8
				}
			}
		}
		liege = {
			save_temporary_scope_as = liege_temp
			OR = {
				any_courtier = {
					ep3_governor_yearly_3100_messenger_trigger = yes
				}
				any_pool_guest = {
					ep3_governor_yearly_3100_messenger_trigger = yes
				}
			}
		}
		governor_efficiency > 0.75
	}

	cooldown = {
		years = 10
	}
	immediate = {
		if = {
			limit = {
				is_landed = yes
			}
			capital_province = {
				save_scope_as = root_capital
			}
		}
		else = {
			domicile = {
				domicile_location = {
					save_scope_as = root_capital
				}
			}
		}
		liege = {
			save_scope_as = liege
			assign_quirk_effect = yes
		}
		#Save random courtier to be messenger
		scope:liege = {
			if = {
				limit = {
					any_courtier = {
						ep3_governor_yearly_3100_messenger_trigger = yes
					}
				}
				random_courtier = {
					limit = {
						ep3_governor_yearly_3100_messenger_trigger = yes
					}
					save_scope_as = messenger
				}
			}
			else = {
				random_pool_guest = {
					limit = {
						ep3_governor_yearly_3100_messenger_trigger = yes
					}
					save_scope_as = messenger
				}
			}
		}

		#Choose negative trait that might be gained
		random_list = {
			5 = {
				trigger = {
					NOR = {
						has_trait = depressed_1
						has_trait = depressed_genetic
						has_trait = ambitious
						has_trait = diligent
					}
					OR = {
						ai_energy <= low_negative_ai_value
						ai_compassion >= low_positive_ai_value
					}
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_depressed
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = reclusive
						has_trait = gregarious
					}
					ai_sociability <= low_negative_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_reclusive
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = irritable
						has_trait = calm
					}
					ai_vengefulness >= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_irritable
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = drunkard
						has_trait = temperate
						AND = {
							faith_forbids_alcohol_trigger = yes
							has_trait = zealous
						}
					}
					ai_energy <= low_negative_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_drunkard
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = hashishiyah
						has_trait = temperate
					}
					ai_energy <= low_negative_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_hashishiyah
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = comfort_eater
						has_trait = temperate
					}
					ai_greed >= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_comfort_eater
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = contrite
						has_trait = arrogant
						has_trait = vengeful
						has_trait = sadistic
						has_trait = callous
					}
					ai_compassion >= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_contrite
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = improvident
						has_trait = greedy
						has_trait = sadistic
						has_trait = callous
					}
					ai_greed <= low_negative_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_improvident
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = rakish
						has_trait = chaste
						has_trait = celibate
						has_sexuality = asexual
					}
					is_adult = yes
					ai_sociability >= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_rakish
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = profligate
						has_trait = temperate
						has_trait = diligent
					}
					ai_rationality <= low_negative_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_profligate
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = flagellant
						has_trait = cynical
					}
					ai_zeal >= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_flagellant
					days = 20
				}
			}
			5 = {
				trigger = {
					NOR = {
						has_trait = gluttonous
						has_trait = inappetetic
					}
					ai_greed <= low_positive_ai_value
				}
				add_character_flag = {
					flag = ep3_governor_yearly_3100_inappetetic
					days = 20
				}
			}
		}
		save_scope_as = root_scope
	}
	#My example should be followed more closely
	option = {
		name = ep3_governor_yearly.3100.a
		trigger = {
			governor_efficiency >= 1.25
		}
		reason = governor_efficiency
		change_influence = major_influence_gain
		add_prestige = medium_prestige_gain
		
		custom_tooltip = ep3_following_governorship_example_tooltip
		if = {
			limit = {
				OR = {
					scope:liege = {
						gold <= -50
					}
					ep3_governor_yearly_3100_crappy_liege_trigger = yes
				}
				is_ai = no
			}
			scope:liege = {
				increase_governance_effect = { VALUE = 20 }
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:liege = {
						gold <= -50
					}
					ep3_governor_yearly_3100_crappy_liege_trigger = yes
				}
			}
			scope:liege = {
				increase_governance_effect = { VALUE = 10 }
			}
		}
		else_if = {
			limit = {
				is_ai = no
			}
			hidden_effect = {
				scope:liege = {
					every_vassal = {
						increase_governance_effect = { VALUE = 10 }
					}
				}
			}
		}
		else = {
			hidden_effect = {
				scope:liege = {
					every_vassal = {
						increase_governance_effect = { VALUE = 5 }
					}
				}
			}
		}
		stress_impact = {
			base = major_stress_impact_gain
			diligent = major_stress_impact_loss
			just = minor_stress_impact_loss
			administrator = minor_stress_impact_loss
			loyal = miniscule_stress_impact_loss
			lazy = major_stress_impact_gain
			content = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
		}
		ai_chance = {
			base = 150
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = 1
			}
			modifier = {
				add = -100
				stress_level >= 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = content
					has_trait = arbitrary
					stress_level >= 2
				}
			}
		}
	}
	#Urge the Emperor to amend this state of affairs
	option = {
		name = ep3_governor_yearly.3100.b
		duel = {
			skill = diplomacy
			value = medium_skill_rating
			55 = { #The emperor is impressed by your conviction
				desc = ep3_governor_yearly.3100.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -54
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = ep3_governor_yearly.3100.b.success
					left_icon = scope:liege
					change_influence = minor_influence_gain
					scope:liege = {
						add_opinion = {
							modifier = respect_opinion
							target = root
							opinion = 10
						}
					}
				}
			}
			45 = { #The emperor is offended
				desc = ep3_governor_yearly.3100.b.fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -44
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = ep3_governor_yearly.3100.b.fail
					left_icon = scope:liege
					scope:liege = {
						add_opinion = {
							modifier = disrespect_opinion
							target = root
							opinion = -30
						}
					}
				}
			}
		}
		hidden_effect = {
			if = {
				limit = {
					ep3_governor_yearly_3100_crappy_liege_trigger = yes
					top_liege = this
					
				}
				scope:liege = {
					send_interface_message = {
						type = msg_governor_upset_about_skill
						title = msg_governor_upset_about_skill.t
						desc = msg_governor_upset_about_skill.desc
						right_icon = scope:root_scope
						
						reverse_add_opinion = {
							modifier = frustrated_opinion
							target = scope:root_scope
							opinion = -10
						}
					}
				}
			}
			else_if = {
				limit = {
					ep3_governor_yearly_3100_crappy_liege_trigger = yes
					top_liege != this
					
				}
				scope:liege = {
					send_interface_message = {
						type = msg_governor_upset_about_governance
						title = msg_governor_upset_about_governance.t
						desc = msg_governor_upset_about_governance.desc
						right_icon = scope:root_scope
						
						reverse_add_opinion = {
							modifier = frustrated_opinion
							target = scope:root_scope
							opinion = -10
						}
					}
				}
			}
			else_if = {
				limit = {
					liege = {
						gold <= -50
					}
				}
				scope:liege = {
					send_interface_message = {
						type = msg_governor_upset_about_insolvency
						title = msg_governor_upset_about_insolvency.t
						desc = msg_governor_upset_about_insolvency.desc
						right_icon = scope:root_scope
						
						reverse_add_opinion = {
							modifier = frustrated_opinion
							target = scope:root_scope
							opinion = -15
						}
					}
				}
			}
			else = {
				scope:liege = {
					send_interface_message = {
						type = msg_governor_upset_about_bad_govs
						title = msg_governor_upset_about_bad_govs.t
						desc = msg_governor_upset_about_bad_govs.desc
						right_icon = scope:root_scope
						
						reverse_add_opinion = {
							modifier = frustrated_opinion
							target = scope:root_scope
							opinion = -10
						}
					}
				}
			}
		}
		stress_impact = {
			stubborn = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_gain
			craven = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_sociability = 1
			}

			modifier = {
				add = 50
				diplomacy >= very_high_skill_rating
			}
			modifier = {
				add = -50
				has_trait = shy
			}
			modifier = {
				add = -50
				diplomacy <= decent_skill_rating
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = humble
					diplomacy < average_skill_rating
				}
			}
		}
	}
	#Things are bad... I need to grab stuff for myself
	option = {
		name = ep3_governor_yearly.3100.c
		flavor = ep3_governor_yearly.3100.c.flavor
		if = {
			limit = {
				is_landed = yes
			}
			add_gold = medium_gold_value
			capital_county = {
				change_development_progress = medium_development_progress_loss
			}
			add_prestige = medium_prestige_loss
		}
		else = {
			add_gold = minor_gold_value
			add_prestige = medium_prestige_loss
		}
		stress_impact = {
			greedy = miniscule_stress_impact_loss
			just = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = -100
			ai_value_modifier = {
				ai_greed = 1
				ai_honor = -1
			}

			modifier = {
				add = -50
				prestige < major_prestige_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = generous
					has_trait = honest
					prestige < medium_prestige_value
				}
			}
		}
	}
	#God, I can't think about this miserable state of affairs...
	option = {
		name = ep3_governor_yearly.3100.d
		flavor = ep3_governor_yearly.3100.d.flavor
		#Reduce governor efficiency
		add_character_modifier = {
			modifier = ep3_ignoring_realm_decline_modifier
			years = 10
			desc = ep3_ignoring_realm_decline_tooltip
		}
		custom_tooltip = ep3_ignoring_realm_decline_years_tooltip
		random_list = {
			45 = {
				add_stress = minor_stress_impact_loss
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_reclusive
					
				}
				add_trait = reclusive
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_irritable
				}
				add_trait = irritable
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_drunkard
				}
				add_trait = drunkard
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_hashishiyah
				}
				add_trait = hashishiyah
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_comfort_eater
				}
				add_trait = comfort_eater
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_flagellant
				}
				add_trait = flagellant
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_contrite
				}
				add_trait = contrite
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_improvident
				}
				add_trait = improvident
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_rakish
				}
				add_trait = rakish
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_hashishiyah
				}
				add_trait = hashishiyah
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_profligate
				}
				add_trait = profligate
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_inappetetic
				}
				add_trait = inappetetic
			}
			5 = {
				trigger = {
					has_character_flag = ep3_governor_yearly_3100_depressed
				}
				add_trait = depressed_1
			}
		}
		stress_impact = {
			lazy = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			depressed_1 = miniscule_stress_impact_loss
			depressed_genetic = miniscule_stress_impact_loss
			diligent = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_greed = -1
			}

			modifier = {
				add = -50
				prestige < major_prestige_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = ambitious
					has_trait = stubborn
					prestige < medium_prestige_value
				}
			}
		}
	}
}
		
