﻿#Events for statecraft lifestyle rank up

namespace = stewardship_domain

# Stewardship (Domain) Events
	#1041		 - Guild Dispute, by Sean Hughes
	#1042		 - Domineering Guild, by Sean Hughes
	#1052		 - Granary Infestation, by Sean Hughes
	#1053		 - Corrupt Tax Collector, by Sean Hughes
	#1073		 - Culture Clash, by Sean Hughes
	#5031 		 - Reduce revolt risk by being diligent, by Linnéa Thimrén
	#6001		 - Marshland Clearing, by Petter Vilberg
	#6002		 - Forest Clearing, by Petter Vilberg
	#6011 - 6017 - Haggle with Masons, by Petter Vilberg

# Stewardship (Domain) Special Events
	#1001-1006	- Bad harvest, by Linnéa Thimrén and Sean Hughes
	#1101-1199	- Charter fair, by Linnéa Thimrén
	#1301-1399	- Building a Road chain, by Petter Vilberg
	#1401-1499	- A Missing Village, by Petter Vilberg
	#1500-1599 	- Domesday Book, by Stephen Arthur and Sean Hughes
	#3010		- Visit displeased county, by Stephen Arthur
	#8001-8099	- The Irrigation Project, by Petter Vilberg

##########################################
# Guild Dispute
# by Sean Hughes
# 1041
##########################################

scripted_trigger stewardship_domain_1041_valid_county = {
	tier = tier_county 						# Only County titles.
	any_in_de_facto_hierarchy = { 			#
		exists = title_province				# With at least one Barony...
		title_province = {					#
			has_holding_type = city_holding # ...which is a City
		}
	}
}

#Two guilds have come to an impasse over trade rights.
stewardship_domain.1041 = {
	type = character_event
	title = stewardship_domain.1041.t
	desc = stewardship_domain.1041.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	trigger = {
		culture = {
			has_innovation = innovation_guilds
		}
		NOT = { has_character_flag = had_stewardship_domain_1041_event }	
		
		#Must hold a county with a city in it.
		any_held_title = {
			stewardship_domain_1041_valid_county = yes
		}
	}

	weight_multiplier = {
		base = 1

		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_stewardship_domain_1041_event
			days = 3650
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_held_title = {
			limit = {
				stewardship_domain_1041_valid_county = yes
			}
			save_scope_as = guild_county
		}
	}

	#Favor the blacksmith's guild over the merchant's guild.
	option = {
		name = stewardship_domain.1041.b
		flavor = stewardship_domain.1041.b.flavor

		scope:guild_county = {
			add_county_modifier = {
				modifier = governance_1041_blacksmiths_guild_modifier
				days = 3650
			}
		}

		stress_impact = {
			just = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_greed = 200
				ai_boldness = 100
				ai_vengefulness = 100
			}
		}
	}
	
	#Favor the merchant's guild over the blacksmith's guild.
	option = {
		name = stewardship_domain.1041.c
		flavor = stewardship_domain.1041.c.flavor

		scope:guild_county = {
			add_county_modifier = {
				modifier = governance_1041_merchants_guild_modifier
				days = 3650
			}
		}

		stress_impact = {
			just = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_greed = 200
				ai_boldness = -100
				ai_vengefulness = -100
			}
		}
	}

	#Meet with representatives from each guild to negotiate a deal they will both accept.
	option = {
		name = stewardship_domain.1041.a

		add_stewardship_lifestyle_xp = medium_lifestyle_xp
		duel = {
			skill = stewardship
			value = 10
		
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = stewardship_domain.1041.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					left_icon = scope:guild_county
					title = stewardship_domain.1041.a.success
					scope:guild_county = {
						add_county_modifier = {
							modifier = governance_1041_cooperative_guilds_modifier
							days = 3650
						}
					}

				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = stewardship_domain.1041.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					left_icon = scope:guild_county
					title = stewardship_domain.1041.a.failure
					scope:guild_county = {
						add_county_modifier = {
							modifier = governance_1041_quarreling_guilds_modifier
							days = 3650
						}
					}
				}
			}
		}

		stress_impact = {
			shy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = {
					value = stewardship
					add = -10
				}
				multiplier = 1000 # -10,000 at 0 Stewardship, +0 at 10 Stewardship, +10,000 at 20 Stewardship
			}

			ai_value_modifier = {
				ai_compassion = 100
			}
		}
	}

	#Sieze control of the means of production
	option = {
		name = stewardship_domain.1041.d

		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		scope:guild_county = {
			change_county_control = 20
		}



		ai_chance = {
			base = 100

			#If this option would have little-to-no effect, the AI will avoid it.
			modifier = {
				AND = {
					ai_rationality >= 10
					scope:guild_county = {
						county_control >= 80
					}
				}
				add = -50
			}

			ai_value_modifier = {
				ai_greed = 50
				ai_vengefulness = 100
			}
		}
	}
}

##########################################
# Domineering Guild
# by Sean Hughes
# 1042
##########################################

scripted_trigger stewardship_domain_1042_valid_county = {
	trigger_if = {
		limit = {
			tier = tier_county
			OR = {
				has_county_modifier = governance_1041_blacksmiths_guild_modifier
				has_county_modifier = governance_1041_merchants_guild_modifier
			}
			NOR = {
				has_county_modifier = governance_1042_influential_guild_modifier
				has_county_modifier = governance_1042_domineering_guild_modifier
			}
		}
		always = yes
	}
	trigger_else = {
		always = no
	}
}

stewardship_domain.1042 = {
	type = character_event
	title = stewardship_domain.1042.t
	desc = stewardship_domain.1042.desc
	left_portrait = root
	theme = stewardship_domain_focus
	
	trigger = {
		culture = {
			has_innovation = innovation_guilds
		}
		NOT = { has_character_flag = had_stewardship_domain_1042_event }

		#Must own a county which received a modifier from stewardship_domain.1041
		any_held_title = {
			stewardship_domain_1042_valid_county = yes
		}
	}

	weight_multiplier = {
		base = 1
		
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_stewardship_domain_1042_event
			days = 3650
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}

		#Save the scope of our county for the event.
		random_held_title = {
			limit = {
				stewardship_domain_1042_valid_county = yes
			}
			save_scope_as = guild_county
		}
	}

	#Negotiate lower prices with the dominant guild.
	option = {
		name = stewardship_domain.1042.a

		add_stewardship_lifestyle_xp = medium_lifestyle_xp		
		duel = {
			skill = stewardship
			value = 10
		
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				desc = stewardship_domain.1042.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					left_icon = scope:guild_county
					title = stewardship_domain.1042.a.success
					scope:guild_county = {
						add_county_modifier = {
							modifier = governance_1042_influential_guild_modifier
							days = 1825
						}
					}
				}
			}
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -59
				}
				desc = stewardship_domain.1042.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					left_icon = scope:guild_county
					title = stewardship_domain.1042.a.failure
					scope:guild_county = {
						add_county_modifier = {
							modifier = governance_1042_domineering_guild_modifier
							days = 1825
						}
					}
				}
			}
		}

		stress_impact = {
			shy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = {
					value = stewardship
					add = -10
				}
				multiplier = 1000 # -10,000 at 0 Stewardship, +0 at 10 Stewardship, +10,000 at 20 Stewardship
			}

			ai_value_modifier = {
				ai_compassion = 100
			}
		}
	}

	#Allow the dominant guild to continue charging exorbitant prices, as long as you get a share.
	option = {
		name = stewardship_domain.1042.b

		add_gold = major_gold_value
		scope:guild_county = {
			add_county_modifier = {
				modifier = governance_1042_domineering_guild_modifier
				days = 3650
			}
		}

		stress_impact = {
			just = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_greed = 500
				ai_rationality = -500
				ai_compassion = -200
			}
		}
	}
	
	#Revoke the privileges you granted the guild to bring them in line.
	option = {
		name = stewardship_domain.1042.c

		add_stewardship_lifestyle_xp = medium_lifestyle_xp

		scope:guild_county = {
			if = {
				limit = {
					has_county_modifier = governance_1041_blacksmiths_guild_modifier
				}
				remove_county_modifier = governance_1041_blacksmiths_guild_modifier
			}
			else_if = {
				limit = {
					has_county_modifier = governance_1041_merchants_guild_modifier
				}
				remove_county_modifier = governance_1041_merchants_guild_modifier
			}
		}

		stress_impact = {
			stubborn = medium_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_rationality = 200
				ai_vengefulness = 100
				ai_greed = -100
			}
		}
	}
}

##########################################
# Granary Infestation
# by Sean Hughes
# 1052
##########################################

stewardship_domain.1052 = {
	type = character_event
	title = stewardship_domain.1052.t
	desc = stewardship_domain.1052.desc
	theme = stewardship_domain_focus
	left_portrait = root
	
	trigger = {
		#Only feudal governments have serfs and freemen.
		has_government = feudal_government

		NOT = { has_character_flag = had_stewardship_domain_1052_event }
		any_held_title = {
			tier = tier_county
			county_control <= 80
		}
	}

	weight_multiplier = {
		base = 1
		
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_stewardship_domain_1052_event
			days = 3650
		}
		if = {
			limit = {
				is_ai = no
				is_adult = yes
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}

		random_held_title = {
			limit = {
				tier = tier_county
				county_control <= 80
			}
			save_scope_as = target_county
		}
	}

	#Force the troubled freefolk into bondage as your serfs.
	option = {
		name = stewardship_domain.1052.a
		scope:target_county = {
			change_county_control = 25
			add_county_modifier = {
				modifier = governance_1052_resentful_serfs_modifier
				days = 1825
			}
		}

		stress_impact = {
			generous = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			forgiving = minor_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -100
				ai_greed = 100
			}
		}
	}

	#Be generous and give the troubled freefolk some charity.
	option = {
		name = stewardship_domain.1052.b
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= medium_gold_value
			}
		}

		remove_short_term_gold = medium_gold_value
		add_piety = minor_piety_gain
		scope:target_county = {
			add_county_modifier = {
				modifier = governance_1052_grateful_freefolk_modifier
				days = 1825
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			gluttonous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 100
				ai_greed = -100
			}
		}
	}
	
	#Lean on the church to aid the troubled freefolk.
	option = {
		name = stewardship_domain.1052.c
		add_piety = minor_piety_loss
		scope:target_county = {
			add_county_modifier = {
				modifier = governance_1052_grateful_freefolk_modifier
				days = 1825
			}
		}

		stress_impact = {
			zealous = medium_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 50
				ai_zeal = -100
			}
		}
	}
}

##################################
# Corrupt Tax Collector
# 1053
# by Sean Hughes
##################################

#One of your tax collectors have been embezzling funds, but you don't know who. How do you deal with the problem?
stewardship_domain.1053 = {
	type = character_event
	title = stewardship_domain.1053.t
	desc = stewardship_domain.1053.desc
	theme = stewardship_domain_focus
	left_portrait = root
	
	trigger = {
		#Must have a county for the event to occur in.
		any_held_title = {
			tier = tier_county
		}

		#Must have a reason to take at least one of the two opt-out options.
		OR = {
			#Either we have a county whose control we can increase...
			any_held_title = {
				tier = tier_county
				county_control <= 90
			}
			#Or we're the type of person who wants to increase their Dread.
			OR = {
				has_trait = arbitrary
				has_trait = sadistic
				has_trait = vengeful
			}
		}

		#Must not have had this event in the past 5 years.
		NOT = { has_character_flag = had_stewardship_domain_1053_event }
	}

	weight_multiplier = {
		base = 0.5

		#More likely to occur if you're the type of character who can capitalize on an intrigue/dread flavored event.
		compare_modifier = {
			factor = intrigue
			multiplier = 0.05 # +0.5 at 10 Intrigue, +1 at 20.
		}
		modifier = {
			add = 0.2
			has_trait = vengeful
		}
		modifier = {
			add = 0.2
			has_trait = sadistic
		}
		modifier = {
			add = 0.1
			has_trait = arbitrary
		}

		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		#Flag the event as having occurred.
		add_character_flag = {
			flag = had_stewardship_domain_1053_event
			days = 3650
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}

		#Find a county that we can ideally increase the control of.
		random_held_title = {
			limit = {
				tier = tier_county
				county_control <= 90
			}
			alternative_limit = {
				tier = tier_county
			}

			weight = {
				base = 1
				modifier = {
					add = 100
					county_control <= 70
				}
			}			

			save_scope_as = target_county
		}
	}

	#Option A: Intrigue Skill Challenge to root out the culprit and bring them to justice.
	option = {
		name = stewardship_domain.1053.a

		add_stewardship_lifestyle_xp = medium_lifestyle_xp
		duel = {
			skill = intrigue
			value = 10

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = stewardship_domain.1053.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain.1053.a.success
					left_icon = scope:target_county

					#Add positive tax bonus to the county.
					scope:target_county = {
						add_county_modifier = {
							modifier = governance_1053_reliable_tax_collectors_modifier
							years = 5
						}
					}

					#Gain a prestige bonus for finding the culprit yourself.
					add_prestige = medium_prestige_gain
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = stewardship_domain.1053.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain.1053.a.failure
					left_icon = scope:target_county

					#Add negative tax penalty to the county.
					scope:target_county = {
						add_county_modifier = {
							modifier = governance_1053_corrupt_tax_collectors_modifier
							years = 5
						}
					}
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 33

			# Rational characters know when they have a good chance of winning the duel
			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = {
					value = intrigue
					add = -10
				}
				multiplier = 1000 # -10,000 at 0 Stewardship, +0 at 10 Stewardship, +10,000 at 20 Stewardship
			}

			ai_value_modifier = {
				ai_energy = 100
			}
		}
	}

	#Option C: Assume direct control over taxation and increase county authority.
	option = {
		name = stewardship_domain.1053.c

		scope:target_county = {
			change_county_control = 20
		}

		ai_chance = {
			base = 33

			ai_value_modifier = {
				ai_greed = 100
			}
		}
	}

	#Option D: Kill all of the tax collectors, we'll get the culprit for sure that way!
	option = {
		name = stewardship_domain.1053.d

		add_dread = medium_dread_gain

		stress_impact = {
			just = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 33

			ai_value_modifier = {
				ai_honor = -200
				ai_compassion = -100
				ai_vengefulness = 200
				ai_boldness = 100
			}
		}
	}
}



##################################
# Culture Clash
# 1073
# by Sean Hughes
##################################

#One of your other-cultured counties longs to be ruled by a same-county lord.
stewardship_domain.1073 = {
	type = character_event
	title = stewardship_domain.1073.t
	desc = stewardship_domain.1073.desc
	theme = stewardship_domain_focus
	left_portrait = scope:target_ruler

	trigger = {
		NOT = { has_character_flag = had_event_stewardship_domain_1073 }
		#Must hold a county...
		any_held_title = {
			tier = tier_county
			#Which has a culture other than your own...
			culture = {
				NOT = { this = root.culture }
				save_temporary_scope_as = border_province_culture
			}
			#And is the same culture as one of the rulers who neighbors that county.
			any_neighboring_county = {
				holder = {
					NOT = {this = root}
					culture = scope:border_province_culture
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_event_stewardship_domain_1073
			years = 5
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_held_title = {
			#Find and save a county which meets the trigger requirements.
			limit = {
				tier = tier_county
				culture = {
					NOT = { this = root.culture }
					save_temporary_scope_as = border_province_culture
				}
				any_neighboring_county = {
					holder = {
						NOT = {this = root}
						culture = scope:border_province_culture
					}
				}
			}
			save_scope_as = target_county

			#Save the target county's current culture.
			culture = {
				save_scope_as = target_county_culture
			}

			#Save the scope of a neighboring ruler who shares a culture with the target county.
			random_neighboring_county = {
				limit = {
					holder = {
						NOT = {this = root}
						culture = scope:target_county_culture
					}
				}
				holder = {
					save_scope_as = target_ruler
				}
			}
		}

		# We have to save ourselves as a scope for effect localization.
		save_scope_as = me
	}

	#Option A: Convince the county to adopt your culture instead.
	option = {
		name = stewardship_domain.1073.a


		add_stewardship_lifestyle_xp = medium_lifestyle_xp
		duel = {
			skill = diplomacy
			value = 10

			50 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = stewardship_domain.1073.a.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain.1073.a.success
					left_icon = scope:target_county

					scope:target_county = {
						#Set the county's culture to your own.
						set_county_culture = root.culture
					}
				}
			}

			50 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = stewardship_domain.1073.a.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain.1073.a.failure
					left_icon = scope:target_county

					# Lower the county's Opinion of you.
					scope:target_county = {
						add_county_modifier = {
							modifier = governance_1073_traditions_disrespected_modifier
							years = 5
						}
					}

					# Lower the opinion of the neighboring ruler.
					scope:target_ruler = {
						add_opinion = {
							modifier = angry_opinion
							target = root
							opinion = -10
						}
					}
				}
			}
		}

		stress_impact = {
			humble = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			# Rational characters know when they have a good chance of winning the duel
			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = {
					value = diplomacy
					add = -10
				}
				multiplier = 1000 # -10,000 at 0 Stewardship, +0 at 10 Stewardship, +10,000 at 20 Stewardship
			}

			ai_value_modifier = {
				ai_compassion = 200
				ai_greed = 100
				ai_boldness = 100
			}
		}
	}

	#Option C: Take a hands-off approach and let the county just keep doing their thing.
	option = {
		name = stewardship_domain.1073.c

		scope:target_county = {
			#Add a modifier which lowers unrest but makes it harder to change the county's culture.
			add_county_modifier = {
				modifier = governance_1073_conversion_resistance_modifier
				years = 5
			}
			custom_tooltip = stewardship_domain.1073.c.warning
		}

		stress_impact = {
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_compassion = 200
				ai_energy = -200
			}
		}
	}

	#Option D: I am their ruler, they should be glad to serve me!
	option = {
		name = stewardship_domain.1073.d

		#Gain prestige.
		add_prestige = medium_prestige_gain


		scope:target_county = {
				add_county_modifier = {
				modifier = governance_1073_traditions_disrespected_modifier
				years = 5
			}
		}

		stress_impact = {
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_boldness = 200
				ai_greed = 100
			}
		}
	}
}


##################################
# Reduce revolt risk by being diligent
# 5031
# by Linnéa Thimrén
##################################

stewardship_domain.5031 = {
	type = character_event
	title = stewardship_domain.5031.t
	desc = stewardship_domain.5031.desc	
	left_portrait = root
	theme = stewardship_domain_focus

	
	trigger = {
		NOT = { has_character_flag = had_reduced_revolt_risk_event }
		any_held_title = {
			tier = tier_county
			county_opinion < 0
		}
	}


	weight_multiplier = {
		base = 1
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_reduced_revolt_risk_event
			days = 3650
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_held_title = {
			limit = {
				tier = tier_county
				county_opinion < 0
			}
			weight = {
				base = 0
				modifier = {
					add = {
						value = county_opinion
						multiply = -1
					}
				}
			}
			save_scope_as = county
		}
	}

	option = { #I'll sort it out!
		name = stewardship_domain.5031.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_decreased_revolt_risk_modifier
				years = 10
			}
		}
		ai_chance = {
			base = 50
		}
		stress_impact = {
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}
	}
	
	option = { #silence them
		name = stewardship_domain.5031.b
		add_dread = minor_dread_gain
		scope:county = {
			add_county_modifier = {
				modifier = governance_increased_taxes
				years = 10
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = -0.5
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			content = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
	}
}

#####################
# Marshland Clearing
# 6001
# by Petter Vilberg
#####################
scripted_trigger stewardship_domain_6001_marshland_barony_trigger = {
	holder = {
		NOT = { this = root }
		is_available_adult = yes
	}
	title_province = {
		terrain = wetlands
		county = {
			holder = root
			NOR = {
				has_county_modifier = governance_reduced_troop_levy_modifier
				has_county_modifier = governance_troops_levied_for_construction_modifier
				has_county_modifier = governance_increased_troop_levy_modifier
			}
		}
	}
}

stewardship_domain.6001 = {
	type = character_event
	title = stewardship_domain.6001.t
	desc = stewardship_domain.6001.desc	
	theme = stewardship_domain_focus
	left_portrait = scope:baron
	right_portrait = scope:steward
	
	trigger = {
		NOT = { has_character_flag = had_event_stewardship_domain_6001 }
		any_sub_realm_barony = {
			stewardship_domain_6001_marshland_barony_trigger = yes
		}
		exists = cp:councillor_steward
	}

	weight_multiplier = {
		base = 1
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_event_stewardship_domain_6001
			years = 5
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_6001_marshland_barony_trigger = yes
			}
			save_scope_as = barony
			holder = {
				save_scope_as = baron
			}
			title_province = {
				county = {
					save_scope_as = county
				}
			}
		}
		cp:councillor_steward = {
			save_scope_as = steward
		}
	}

	option = { #Take as much as you need
		name = stewardship_domain.6001.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_reduced_troop_levy_modifier
				years = 10
			}
		}
	}

	option = { #The entirety of County could use this
		name = stewardship_domain.6001.b
		scope:county = {
			add_county_modifier = {
				modifier = governance_troops_levied_for_construction_modifier
				years = 10
			}
		}
	}
	
	option = { #No, more troops!
		name = stewardship_domain.6001.c
		scope:county = {
			add_county_modifier = {
				modifier = governance_increased_troop_levy_modifier
				years = 10
			}
		}
	}
}


#####################
# Forest Clearing
# 6002
# by Petter Vilberg
#####################
scripted_trigger stewardship_domain_6002_forest_barony_trigger = {
	holder = {
		NOT = { this = root }
		is_available_adult = yes
	}
	title_province = {
		terrain = forest
		county = {
			holder = root
			NOR = {
				has_county_modifier = governance_reduced_troop_levy_modifier
				has_county_modifier = governance_troops_levied_for_construction_modifier
				has_county_modifier = governance_increased_troop_levy_modifier
			}
		}
	}
}

stewardship_domain.6002 = {
	type = character_event
	title = stewardship_domain.6002.t
	desc = stewardship_domain.6002.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:baron
	right_portrait = scope:steward
	
	trigger = {
		NOT = { has_character_flag = had_event_stewardship_domain_6002 }
		any_sub_realm_barony = {
			stewardship_domain_6002_forest_barony_trigger = yes
		}
		exists = cp:councillor_steward
	}

	weight_multiplier = {
		base = 1
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}

	immediate = {
		add_character_flag = {
			flag = had_event_stewardship_domain_6002
			years = 5
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_6002_forest_barony_trigger = yes
			}
			save_scope_as = barony
			holder = {
				save_scope_as = baron
			}
			title_province = {
				county = {
					save_scope_as = county
				}
			}
		}
		cp:councillor_steward = {
			save_scope_as = steward
		}
	}

	option = { #Take as much as you need
		name = stewardship_domain.6001.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_reduced_troop_levy_modifier
				years = 10
			}
		}
	}

	option = { #The entirety of County could use this
		name = stewardship_domain.6001.b
		scope:county = {
			add_county_modifier = {
				modifier = governance_troops_levied_for_construction_modifier
				years = 10
			}
		}
	}
	
	option = { #No, more troops!
		name = stewardship_domain.6001.c
		scope:county = {
			add_county_modifier = {
				modifier = governance_increased_troop_levy_modifier
				years = 10
			}
		}
	}
}


######################
# Haggle with Masons
# 6011 - 6017
# by Petter Vilberg
######################

scripted_trigger stewardship_domain_6011_county_trigger = {
	holder = root
	NOR = {
		has_county_modifier = governance_stonemason_cooperation_modifier
		has_county_modifier = governance_emphasised_corvee_modifier
	}
}

stewardship_domain.6011 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6011.desc
	
	theme = stewardship_domain_focus
	right_portrait = scope:steward
	
	trigger = {
		NOT = { has_character_flag = had_event_stewardship_domain_6011 }
		any_sub_realm_county = {
			stewardship_domain_6011_county_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		upweight_for_focus_modifier = { FOCUS = stewardship_domain_focus }
	}


	immediate = {
		add_character_flag = {
			flag = had_event_stewardship_domain_6011
			years = 10
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event_stewardship
				years = ongoing_lifestyle_event_delay
			}
		}
		else = {
			add_character_flag = {
				flag = had_recent_lifestyle_ongoing_event
				years = ongoing_lifestyle_event_delay
			}
		}
		random_sub_realm_county = {
			limit = {
				stewardship_domain_6011_county_trigger = yes
			}
			save_scope_as = county
		}
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
	}

	option = {
		name = stewardship_domain.6011.a
		duel = {
			skill = stewardship
			value = 12
			desc = outcome_in_a_few_days
			12 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = stewardship_domain_6011_great_deal
				show_as_tooltip = {
					add_prestige = medium_prestige_gain
					scope:county = {
						add_county_modifier = {
							modifier = governance_stonemason_cooperation_modifier
							years = 20
						}
						change_county_control = medium_county_control_gain
					}
				}
				trigger_event = {
					id = stewardship_domain.6012
					days = { 10 20 }
				}
			}
			20 = {
				desc = stewardship_domain_6011_fair_deal
				custom_tooltip = stewardship_domain.6011.offer_tt
				show_as_tooltip = {
					remove_short_term_gold = medium_gold_value
					add_prestige = minor_prestige_gain
					scope:county = {
						add_county_modifier = {
							modifier = governance_stonemason_cooperation_modifier
							years = 20
						}
					}
				}
				trigger_event = {
					id = stewardship_domain.6013
					days = { 10 20 }
				}
			}
			12 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				desc = stewardship_domain_6011_bad_deal
				custom_tooltip = stewardship_domain.6011.offer_tt
				show_as_tooltip = {
					remove_short_term_gold = major_gold_value
					scope:county = {
						add_county_modifier = {
							modifier = governance_stonemason_cooperation_modifier
							years = 20
						}
					}
				}
				trigger_event = {
					id = stewardship_domain.6014
					days = { 10 20 }
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 500
				has_trait = arrogant
			}
		}
	}

	option = {
		name = stewardship_domain.6011.b
		trigger = {
			exists = scope:steward
		}
		scope:steward = {
			duel = {
				skill = stewardship
				value = 12
				desc = outcome_in_a_few_days
				12 = {		
					compare_modifier = {
						value = scope:duel_value
						multiplier = 1
					}
					desc = stewardship_domain_6011_great_deal
					root = {
						show_as_tooltip = {
							scope:county = {
								add_county_modifier = {
									modifier = governance_stonemason_cooperation_modifier
									years = 20
								}
								change_county_control = medium_county_control_gain
							}
						}
						trigger_event = {
							id = stewardship_domain.6015
							days = { 10 20 }
						}
					}
				}
				24 = {
					desc = stewardship_domain_6011_fair_deal
					custom_tooltip = stewardship_domain.6011.offer_tt
					root = {
						show_as_tooltip = {
							remove_short_term_gold = medium_gold_value
							scope:county = {
								add_county_modifier = {
									modifier = governance_stonemason_cooperation_modifier
									years = 20
								}
							}
						}
						trigger_event = {
							id = stewardship_domain.6016
							days = { 10 20 }
						}
					}
				}
				12 = {		
					compare_modifier = {
						value = scope:duel_value
						multiplier = -1
					}
					desc = stewardship_domain_6011_bad_deal
					root = {
						custom_tooltip = stewardship_domain.6011.offer_tt
						show_as_tooltip = {
							remove_short_term_gold = major_gold_value
							scope:county = {
								add_county_modifier = {
									modifier = governance_stonemason_cooperation_modifier
									years = 20
								}
							}
						}
						trigger_event = {
							id = stewardship_domain.6017
							days = { 10 20 }
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 500
				stewardship < scope:steward.stewardship
			}
			opinion_modifier = {
				opinion_target = scope:steward
				multiplier = 3
			}
		}
	}
	
	option = { #Why would I need masons when I have serfs?
		name = stewardship_domain.6011.c
		scope:county = {
			add_county_modifier = {
				modifier = governance_emphasised_corvee_modifier
				years = 20
			}
		}
		ai_chance = {
			base = 30
		}
	}
}


#Root negotiates: Best outcome
stewardship_domain.6012 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6012.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain.6012.a
		add_prestige = medium_prestige_gain
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
			change_county_control = medium_county_control_gain
		}
	}
}

#Root negotiates: Good outcome
stewardship_domain.6013 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6013.desc
	theme = stewardship_domain_focus
	left_portrait = root
	
	
	option = {
		name = stewardship_domain.6013.a
		remove_short_term_gold = medium_gold_value
		add_prestige = minor_prestige_gain
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -90
				short_term_gold < medium_gold_value
			}
		}
	}

	option = {
		name = stewardship_domain.6013.b
		scope:county = {
			change_county_control = medium_county_control_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				add = 100
				scope:county.county_control < full_county_control
			}
		}
	}
}


#Root negotiates: Bad outcome
stewardship_domain.6014 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6014.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain.6014.a
		remove_short_term_gold = major_gold_value
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -90
				short_term_gold < major_gold_value
			}
		}
	}

	option = {
		name = stewardship_domain.6014.b
		scope:county = {
			change_county_control = minor_county_control_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				scope:county.county_control < full_county_control
			}
			modifier = {
				add = 500
				short_term_gold < major_gold_value
			}
		}
	}
}

#Steward negotiates: Best outcome
stewardship_domain.6015 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6015.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward
	
	option = {
		name = stewardship_domain.6015.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
			change_county_control = medium_county_control_gain
		}
	}
}

#Steward negotiates: Good outcome
stewardship_domain.6016 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6016.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward
	
	option = {
		name = stewardship_domain.6016.a
		remove_short_term_gold = medium_gold_value
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -90
				short_term_gold < medium_gold_value
			}
		}
	}

	option = {
		name = stewardship_domain.6016.b
		scope:county = {
			change_county_control = medium_county_control_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				add = 100
				scope:county.county_control < full_county_control
			}
		}
	}
}

#Steward negotiates: Bad outcome
stewardship_domain.6017 = {
	type = character_event
	title = stewardship_domain.6011.t
	desc = stewardship_domain.6017.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward
	
	option = {
		name = stewardship_domain.6017.a
		remove_short_term_gold = major_gold_value
		scope:county = {
			add_county_modifier = {
				modifier = governance_stonemason_cooperation_modifier
				years = 20
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -90
				short_term_gold < major_gold_value
			}
		}
	}

	option = {
		name = stewardship_domain.6017.b
		scope:county = {
			change_county_control = minor_county_control_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				scope:county.county_control < full_county_control
			}
			modifier = {
				add = 500
				short_term_gold < major_gold_value
			}
		}
	}
}

###END OF STONEMASON HAGGLING CHAIN

###########################################################
# Events converted from the old Progress Event system.
# These events are all challenging event chains which should reward a perk point or some other significant benefit for successfully completing them.

namespace = stewardship_domain_special


##########################################
# Bad harvest
# by Linnéa Thimrén and Sean Hughes
# 1001-1006
##########################################

scripted_trigger stewardship_domain_special_1001_valid_county_trigger = {
	# Must not be our own county.
	holder = {
		NOT = { this = root }
	}

	# Development should not be capped out on either end, to make the event's impact more meaningful.
	development_level >= terrible_development_level
	development_level < great_development_level
}

stewardship_domain_special.1001 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = stewardship_domain_special.1001.desc
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:county_holder
		animation = sadness
	}
	
	trigger = {
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_1001_this_lifetime }
		any_sub_realm_county = {
			stewardship_domain_special_1001_valid_county_trigger = yes
		}
	}

	weight_multiplier = { # Much more likely when the player is poor (it is more impactful then).
		base = 0.5
		modifier = {
			add = 0.25
			gold < major_gold_value_check
		}
		modifier = {
			add = 0.50
			gold < medium_gold_value_check
		}
		modifier = {
			add = 0.75
			gold < minor_gold_value_check
		}
	}

	immediate = {
		random_sub_realm_county = {
			limit = {
				holder = {
					is_vassal_of = root
				}
				stewardship_domain_special_1001_valid_county_trigger = yes
			}
			alternative_limit = {
				stewardship_domain_special_1001_valid_county_trigger = yes
			}

			weight = {
				base = 1

				# More likely to pick low-stewardship vassals.
				compare_modifier = {
					value = {
						value = holder.stewardship 		# Base stewardship skill
						add = -15						# So someone with 8 stewardship becomes -7, while someone with 18 becomes +3
						multiply = -10					# So someone with 8 stewardship becomes +70, while someone with 18 becomes -30
						min = -49
					}
				}

				# More likely to select rulers who are important to the player.
				modifier = {
					add = 100
					holder = {
						is_of_major_interest_to_root_trigger = yes
					}
				}
				modifier = {
					add = 10
					holder = {
						is_of_minor_interest_to_root_trigger = yes
					}
				}

				# These modifiers will stack with 'is_of_major_interest_to_root_trigger', which is okay because they make the event is extra-impactful.
				modifier = {
					add = 100
					AND = {
						exists = root.player_heir
						holder = root.player_heir
					}

				}
				modifier = {
					add = 50
					holder = {
						is_powerful_vassal_of = root
					}
				}
			}
			save_scope_as = development_county
			holder = {
				save_scope_as = county_holder
			}
		}

		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 500
		}
		add_character_flag = had_stewardship_domain_special_1001_this_lifetime
	}

	# Option A: I'll see what I can do!
	option = {
		name = stewardship_domain_special.1001.a
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		custom_tooltip = stewardship_domain_special.1001.a.tt

		stress_impact = {
			lazy = minor_stress_gain
		}

		ai_chance = {
			base = 33

			# If energy + compassion + boldness are high, investigate.
			ai_value_modifier = {
				ai_energy = 100
				ai_compassion = 50
				ai_boldness = 50
			}
		}

		trigger_event = {
			id = stewardship_domain_special.1002
			days = { 15 30 }
		}
	}

	# Option B: I'll squeeze every drop I can out of them!
	option = {
		name = stewardship_domain_special.1001.b
		add_gold = major_gold_value
		scope:county_holder = {
			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -20
			}
		}
		scope:development_county = {
			change_development_progress_with_overflow = -50
			add_county_modifier = {
				modifier = governance_bad_guidance_modifier
				days = 1825
			}
		}

		stress_impact = {
			compassionate = medium_stress_gain
			forgiving = minor_stress_gain
			just = minor_stress_gain
		}

		ai_chance = {
			base = 50

			# If greed exceeds compassion + forgiveness.
			ai_value_modifier = {
				ai_compassion = -100
				ai_vengefulness = 100
				ai_greed = 200
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}

	# Option C: Let your vassal deal with it.
	option = {
		name = stewardship_domain_special.1001.c

		stress_impact = {
			base = medium_stress_loss
			lazy = minor_stress_loss
			diligent = minor_stress_gain
		}

		ai_chance = {
			base = 0

			# Only if laziness exceeds greed.
			ai_value_modifier = {
				ai_energy = -200
				ai_greed = -200
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#What will you do to help?
stewardship_domain_special.1002 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = {
		desc = stewardship_domain_special.1002.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:vassal_reaction = flag:repentant
				}
				desc = stewardship_domain_special.1002.desc.repentant
			}
			triggered_desc = {
				trigger = {
					scope:vassal_reaction = flag:blaming
				}
				desc = stewardship_domain_special.1002.desc.blaming
			}
			desc = stewardship_domain_special.1002.desc.uncaring
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:county_holder
		triggered_animation = {
			trigger = {
				scope:vassal_reaction = flag:repentant			
			}
			animation = beg
		}
		triggered_animation = {
			trigger = {
				scope:vassal_reaction = flag:uncaring			
			}
			animation = dismissal
		}
		triggered_animation = {
			trigger = {
				scope:vassal_reaction = flag:blaming			
			}
			animation = angry
		}
	}

	immediate = {
		# Get the vassal's reaction to the event
		scope:county_holder = {
			random_list = {
				33 = { # Repentant, wants to make things right.
					trigger = {
						OR = {
							ai_vengefulness < low_positive_ai_value
							has_trait = humble
						}

						NOT = { has_trait = arrogant }
						NOT = { has_trait = lazy }
						NOT = { has_trait = wrathful }
					}

					compare_modifier = {
						value = ai_vengefulness
						min = 0
					}
					compare_modifier = {
						value = ai_compassion
						min = 0
					}

					modifier = {
						add = 50
						has_trait = just
					}
					modifier = {
						add = 50
						has_trait = humble
					}

					save_scope_value_as = {
						name = vassal_reaction
						value = flag:repentant
					}
				}
				33 = { # Uncaring, doesn't want to bother with managing things properly.
					trigger = {
						OR = {
							ai_energy <= low_negative_ai_value
							has_trait = lazy
						}
						NOT = { has_trait = wrathful }
						NOT = { has_trait = humble }
					}

					compare_modifier = {
						value = ai_energy
						multiplier = -1
						min = 0
					}
					compare_modifier = {
						value = ai_greed
						multiplier = -1
						min = 0
					}
					modifier = {
						add = 50
						has_trait = arbitrary
					}

					save_scope_value_as = {
						name = vassal_reaction
						value = flag:uncaring
					}
				}
				33 = { # Blaming, refuses to admit own mistakes.
					trigger = {
						OR = {
							ai_vengefulness >= low_positive_ai_value
							has_trait = arrogant
							has_trait = wrathful
						}
						NOT = { has_trait = humble }
					}

					compare_modifier = {
						value = ai_vengefulness
						min = 0
					}
					compare_modifier = {
						value = ai_greed
						min = 0
					}
					modifier = {
						add = 50
						has_trait = arrogant
					}
					modifier = {
						add = 50
						has_trait = wrathful
					}

					save_scope_value_as = {
						name = vassal_reaction
						value = flag:blaming
					}
				}
			}
			# Fallback in case the random list produced no reaction.
			if = {
				limit = { NOT = {exists = scope:vassal_reaction} }
				save_scope_value_as = {
					name = vassal_reaction
					value = flag:uncaring
				}
			}
		}
	}

	# Option A: Hold them responsible
	option = {
		name = stewardship_domain_special.1002.a

		scope:county_holder = {
			duel = {
				skill = stewardship
				value = 10
				desc = outcome_in_a_few_weeks

				50 = {
					desc = stewardship_domain_special.1002.a.success

					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					modifier = {
						add = 50
						scope:vassal_reaction = flag:repentant
					}

					show_as_tooltip = {
						root = { add_stewardship_lifestyle_perk_points = 1 }
						add_stewardship_lifestyle_perk_points = 1
						
						scope:development_county = {
							add_county_modifier = {
								modifier = governance_good_guidance_modifier
								days = 1825
							}
						}
					}
					root = {
						trigger_event = {
							id = stewardship_domain_special.1003
							days = { 14 21 }
						}
					}
				}
				50 = {
					desc = stewardship_domain_special.1002.a.failure

					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					modifier = {
						add = 50
						scope:vassal_reaction = flag:uncaring
					}

					show_as_tooltip = {
						scope:county_holder = {
							add_prestige = medium_prestige_loss
						}
						scope:development_county = {
							add_county_modifier = {
								modifier = governance_poor_guidance_modifier
								days = 1825
							}
						}
					}
					root = {
						trigger_event = {
							id = stewardship_domain_special.1004
							days = { 14 21 }
						}
					}
				}
			}
		}

		stress_impact = {
			paranoid = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}

		ai_chance = {
			base = 33

			ai_value_modifier = {
				ai_energy = -200
				ai_vengefulness = -100
				ai_compassion = 100
			}
		}

	}

	option = { #Step in and take charge
		name = stewardship_domain_special.1002.b
		duel = {
			skill = stewardship
			value = 10
			desc = outcome_in_a_few_weeks

			50 = {
				desc = stewardship_domain_special.1002.b.success

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}

				show_as_tooltip = {
					add_stewardship_lifestyle_perk_points = 1
					scope:development_county = {
						add_county_modifier = {
							modifier = governance_good_guidance_modifier
							days = 1825
						}
					}
				}
				trigger_event = {
					id = stewardship_domain_special.1005
					days = { 14 21 }
				}
			}
			50 = {
				desc = stewardship_domain_special.1002.b.failure

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}

				show_as_tooltip = {
					add_prestige = medium_prestige_loss
					add_stewardship_lifestyle_xp = massive_lifestyle_xp
					scope:development_county = {
						add_county_modifier = {
							modifier = governance_poor_guidance_modifier
							days = 1825
						}
					}
				}
				trigger_event = {
					id = stewardship_domain_special.1006
					days = { 14 21 }
				}
			}
		}

		stress_impact = {
			lazy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 33

			ai_value_modifier = {
				ai_energy = 200
				ai_vengefulness = 100
				ai_compassion = -100
			}
		}

	}

	# Option C: Sieze the county for yourself!
	option = {
		name = stewardship_domain_special.1002.c

		# Transfer the title to yourself.
		custom_tooltip = stewardship_domain_special.1002.c.tt
		hidden_effect = {
			create_title_and_vassal_change = change
			scope:change = {
				set_title_and_vassal_change_type = revoked
				set_add_claim_on_loss = no

			}
			scope:development_county = {
				change_title_holder = {
					holder = root
					change = scope:change
					take_baronies = no
				}
			}
			resolve_title_and_vassal_change = scope:change
		}


		# Opinion effects
		add_tyranny = minor_tyranny_gain
		scope:county_holder = {
			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -40
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event

		stress_impact = {
			generous = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}

		ai_chance = {
			base = 33

			ai_value_modifier = {
				ai_greed = 200
				ai_vengefulness = 100
				ai_compassion = -200
			}
		}
	}
}

#They handle it - rank up and good modifier
stewardship_domain_special.1003 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = stewardship_domain_special.1003.desc
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:county_holder
		animation = happiness
	}

	option = {
		name = stewardship_domain_special.1003.a
		add_stewardship_lifestyle_perk_points = 1
		scope:county_holder = {
			add_stewardship_lifestyle_perk_points = 1
		}
		scope:development_county = {
			add_county_modifier = {
				modifier = governance_good_guidance_modifier
				days = 1825
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#They handle it - bad modifier
stewardship_domain_special.1004 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = stewardship_domain_special.1004.desc
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:county_holder
		animation = sadness
	}

	option = {
		name = stewardship_domain_special.1004.a
		scope:county_holder = {
			add_prestige = medium_prestige_loss
		}
		scope:development_county = {
			add_county_modifier = {
				modifier = governance_poor_guidance_modifier
				days = 1825
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#You handle it - rank up and good modifier
stewardship_domain_special.1005 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = stewardship_domain_special.1005.desc
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = stewardship_domain_special.1005.a
		add_stewardship_lifestyle_perk_points = 1
		scope:development_county = {
			add_county_modifier = {
				modifier = governance_good_guidance_modifier
				days = 1825
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#You handle it - prestige loss and bad modifier
stewardship_domain_special.1006 = {
	type = character_event
	title = stewardship_domain_special.1001.t
	desc = stewardship_domain_special.1006.desc
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = root
		animation = sadness
	}

	option = {
		name = stewardship_domain_special.1006.a
		add_prestige = medium_prestige_loss
		add_stewardship_lifestyle_xp = massive_lifestyle_xp
		scope:development_county = {
			add_county_modifier = {
				modifier = governance_poor_guidance_modifier
				days = 1825
			}
		}

		# Ends event chain.
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}



##########################################
# Charter fair
# by Linnéa Thimrén
# 1101-1106
##########################################

scripted_trigger stewardship_domain_special_1101_city_barony_trigger = {
	county = {
		NOR = {
			has_county_modifier = governance_annual_charter_fair_city_modifier
			has_county_modifier = governance_annual_charter_fair_church_modifier
		}
	}
	title_province = {
		has_building_with_flag = city
	}
	save_temporary_scope_as = second_baron_check
	holder = {
		NOT = { this = scope:local_baron }
		is_ai = yes
		liege = { this = root }
	}
}

scripted_trigger stewardship_domain_special_1101_church_barony_trigger = {
	title_province = {
		has_building_with_flag = temple
	}
	holder = {
		is_ai = yes
		liege = { this = root }
		save_temporary_scope_as = local_baron
	}
	title_province = {
		county = {
			OR = { #We want two baronies that are relatively close to each other!
				holder = {
					any_sub_realm_barony = {
						stewardship_domain_special_1101_city_barony_trigger = yes
					}
				}
				any_neighboring_county = {
					holder = {
						any_sub_realm_barony = {
							stewardship_domain_special_1101_city_barony_trigger = yes
						}
					}
				}
			}
			save_temporary_scope_as = county
		}
	}
	save_temporary_scope_as = barony_check
}

stewardship_domain_special.1101 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = stewardship_domain_special.1101.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:local_baron
	right_portrait = scope:second_local_baron
	
	trigger = {
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_1101_this_lifetime}
		any_sub_realm_barony = {
			stewardship_domain_special_1101_church_barony_trigger = yes
		}
	}

	immediate = {
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_special_1101_church_barony_trigger = yes
			}
			save_scope_as = barony
			holder = {
				save_scope_as = local_baron
			}
			title_province = { #To find another barony relatively close by
				county = {
					save_scope_as = county
					if = {
						limit = {
							holder = {
								any_sub_realm_barony = {
									stewardship_domain_special_1101_city_barony_trigger = yes
								}
							}
						}
						holder = {
							random_sub_realm_barony = {
								limit = {
									stewardship_domain_special_1101_city_barony_trigger = yes
								}
								save_scope_as = second_barony
								holder = {
									save_scope_as = second_local_baron
								}
							}
						}
					}
					else = {
						random_neighboring_county = {
							limit = {
								holder = {
									any_sub_realm_barony = {
										stewardship_domain_special_1101_city_barony_trigger = yes
									}
								}
							}
							holder = {
								random_sub_realm_barony = {
									limit = {
										stewardship_domain_special_1101_city_barony_trigger = yes
									}
									save_scope_as = second_barony
									holder = {
										save_scope_as = second_local_baron
									}
								}
							}
						}
					}
				}
			}
		}

		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 500
		}
		add_character_flag = had_stewardship_domain_special_1101_this_lifetime
	}

	option = { #For the people
		name = stewardship_domain_special.1101.a
		custom_tooltip = stewardship_domain_special.1101.all_goes_well
		show_as_tooltip = {
			scope:second_barony = {
				county = {
					add_county_modifier = {
						modifier = governance_annual_charter_fair_city_modifier
						days = 3650
					}
					add_county_modifier = {
						modifier = invested_in_province_modifier
						days = 3650
					}
				}
			}
			scope:second_local_baron = {
				add_opinion = {
					target = root
					modifier = pleased_opinion
					opinion = 20
				}
			}
		}
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		trigger_event = {
			id = stewardship_domain_special.1102
			days = { 30 60 }
		}
		stress_impact = {
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.75
			}
		}
	}

	option = { #For the church
		name = stewardship_domain_special.1101.b
		custom_tooltip = stewardship_domain_special.1101.all_goes_well
		show_as_tooltip = {
			scope:barony = {
				county = {
					add_county_modifier = {
						modifier = governance_annual_charter_fair_church_modifier
						days = 3650
					}
				}
			}
			add_piety = medium_piety_gain
			scope:local_baron = {
				add_opinion = {
					target = root
					modifier = pleased_opinion
					opinion = 20
				}
			}
		}
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		trigger_event = {
			id = stewardship_domain_special.1105
			days = { 30 60 }
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = zealous
			}
			ai_value_modifier = {
				ai_zeal = 0.75
			}
		}
	}

	option = { #Nah
		name = stewardship_domain_special.1101.c
	}
}


#For the people - county_control
stewardship_domain_special.1102 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = stewardship_domain_special.1102.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:second_local_baron

	immediate = {
		if = {
			limit = {
				scope:second_local_baron = { is_alive = no }
			}
			scope:second_barony = {
				holder = { save_scope_as = second_local_baron }
			}
		}
	}

	option = { #Silk!
		name = stewardship_domain_special.1102.a
		custom_tooltip = stewardship_domain_special.1102.a.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:silk
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county = {
							development_level >= bad_development_level
							county_control > medium_county_control
						}
					}
					modifier = {
						add = 20
						scope:county = {
							development_level >= medium_development_level
							county_control > full_county_control
						}
					}
					modifier = {
						add = 40
						scope:county = {
							development_level >= good_development_level
							county_control > full_county_control
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}

	option = { #Local crops!
		name = stewardship_domain_special.1102.b
		custom_tooltip = stewardship_domain_special.1102.b.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:crops
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county = {
							county_control < full_county_control
						}
					}
					modifier = {
						add = 20
						scope:county = {
							county_control < medium_county_control
						}
					}
					modifier = {
						add = 40
						scope:county = {
							county_control < low_county_control
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	option = { #Technological marvels!
		name = stewardship_domain_special.1102.c
		custom_tooltip = stewardship_domain_special.1102.c.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:technology
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county = {
							development_level <= medium_development_level
						}
					}
					modifier = {
						add = 20
						scope:county = {
							development_level <= bad_development_level
						}
					}
					modifier = {
						add = 40
						scope:county = {
							development_level <= terrible_development_level
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}

	after = {
		if = {
			limit = {
				exists = scope:good_outcome
			}
			trigger_event = {
				id = stewardship_domain_special.1103
				days = { 30 60 }
			}
		}
		else = {
			trigger_event = {
				id = stewardship_domain_special.1104
				days = { 30 60 }
			}
		}
	}
}

#Good outcome
stewardship_domain_special.1103 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:silk
				}
				desc = stewardship_domain_special.1103.desc_silk
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:crops
				}
				desc = stewardship_domain_special.1103.desc_crops
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:technology
				}
				desc = stewardship_domain_special.1103.desc_technology
			}
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:second_local_baron
		animation = happiness
	}

	immediate = {
		if = {
			limit = {
				scope:second_local_baron = { is_alive = no }
			}
			scope:second_barony = {
				holder = { save_scope_as = second_local_baron }
			}
		}
	}

	option = {
		name = stewardship_domain_special.1103.a
		add_stewardship_lifestyle_perk_points = 1
		scope:county = {
			add_county_modifier = {
				modifier = governance_annual_charter_fair_city_modifier
				days = 3650
			}
		}
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#Bad outcome
stewardship_domain_special.1104 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:silk
				}
				desc = stewardship_domain_special.1104.desc_silk
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:crops
				}
				desc = stewardship_domain_special.1104.desc_crops
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:technology
				}
				desc = stewardship_domain_special.1104.desc_technology
			}
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:second_local_baron
		animation = sadness
	}

	immediate = {
		if = {
			limit = {
				scope:second_local_baron = { is_alive = no }
			}
			scope:second_barony = {
				holder = { save_scope_as = second_local_baron }
			}
		}
	}

	option = {
		name = stewardship_domain_special.1104.a
		scope:second_local_baron = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -20
			}
		}
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}


#For the church
stewardship_domain_special.1105 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = stewardship_domain_special.1105.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:local_baron

	immediate = {
		if = {
			limit = {
				scope:local_baron = { is_alive = no }
			}
			scope:barony = {
				holder = { save_scope_as = local_baron }
			}
		}
	}

	option = { #Religious objects!
		name = stewardship_domain_special.1105.a
		custom_tooltip = stewardship_domain_special.1105.a.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:religious_objects
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= minor_fervor_value
						}
					}
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= medium_fervor_value
						}
					}
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= major_fervor_value
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 0.5
			}
		}
	}

	option = { #Food!
		name = stewardship_domain_special.1105.b
		custom_tooltip = stewardship_domain_special.1105.b.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:religious_food
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county = {
							development_level <= medium_development_level
						}
					}
					modifier = {
						add = 20
						scope:county = {
							development_level <= bad_development_level
						}
					}
					modifier = {
						add = 40
						scope:county = {
							development_level <= terrible_development_level
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	option = { #Other religions!
		name = stewardship_domain_special.1105.c
		custom_tooltip = stewardship_domain_special.1105.c.tt
		save_scope_value_as = {
			name = option_chosen
			value = flag:religious_other
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= minor_fervor_value
						}
					}
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= medium_fervor_value
						}
					}
					modifier = {
						add = 10
						scope:county.faith = {
							fervor >= major_fervor_value
						}
					}
					save_scope_value_as = {
						name = good_outcome
						value = yes
					}
				}
				10 = {

				}
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.25
				ai_rationality = 0.25
			}
		}
	}

	after = {
		if = {
			limit = {
				exists = scope:good_outcome
			}
			trigger_event = {
				id = stewardship_domain_special.1106
				days = { 30 60 }
			}
		}
		else = {
			trigger_event = {
				id = stewardship_domain_special.1107
				days = { 30 60 }
			}
		}
	}
}

#Good outcome
stewardship_domain_special.1106 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_other
				}
				desc = stewardship_domain_special.1106.desc_religious_objects
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_food
				}
				desc = stewardship_domain_special.1106.desc_religious_food
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_objects
				}
				desc = stewardship_domain_special.1106.desc_religious_other
			}
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:local_baron
		animation = happiness
	}

	immediate = {
		if = {
			limit = {
				scope:local_baron = { is_alive = no }
			}
			scope:barony = {
				holder = { save_scope_as = local_baron }
			}
		}
	}

	option = {
		name = stewardship_domain_special.1106.a
		add_stewardship_lifestyle_perk_points = 1
		scope:county = {
			add_county_modifier = {
				modifier = governance_annual_charter_fair_church_modifier
				days = 3650
			}
		}

		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

#Bad outcome
stewardship_domain_special.1107 = {
	type = character_event
	title = stewardship_domain_special.1101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_other
				}
				desc = stewardship_domain_special.1107.desc_religious_objects
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_food
				}
				desc = stewardship_domain_special.1107.desc_religious_food
			}
			triggered_desc = {
				trigger = {
					scope:option_chosen = flag:religious_objects
				}
				desc = stewardship_domain_special.1107.desc_religious_other
			}
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = {
		character = scope:local_baron
		animation = sadness
	}

	immediate = {
		if = {
			limit = {
				scope:local_baron = { is_alive = no }
			}
			scope:barony = {
				holder = { save_scope_as = local_baron }
			}
		}
	}

	option = {
		name = stewardship_domain_special.1107.a

		scope:local_baron = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -20
			}
		}
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}


##############
# Building a Road chain
#1301-1399
# by Petter Vilberg
##############

scripted_trigger stewardship_domain_special_1301_county_trigger = {
	holder = root
	NOR = {
		has_county_modifier = governance_excellent_new_road_modifier
		has_county_modifier = governance_good_new_road_modifier
		has_county_modifier = governance_standard_new_road_modifier
		has_county_modifier = governance_poor_new_road_modifier
	}
}

#Setup - name Steward, Peasant Leader, or neither

stewardship_domain_special.1301 = {
	type = character_event
	title = stewardship_domain_special.1301.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:steward }
				desc = stewardship_domain_special.1301.steward_opening
			}
			desc = stewardship_domain_special.1301.no_steward_opening
		}
		desc = stewardship_domain_special.1301.desc
	}
	
	left_portrait = scope:steward
	right_portrait = scope:peasant_leader
	theme = stewardship_domain_focus
	
	trigger = {
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_1301_this_lifetime }

		is_landed = yes
		any_sub_realm_county = {
			stewardship_domain_special_1301_county_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Standard progress event stuff
		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 730
		}
		add_character_flag = had_stewardship_domain_special_1301_this_lifetime
		#Chain-specific:
		random_sub_realm_county = {
			limit = {
				stewardship_domain_special_1301_county_trigger = yes
			}
			save_scope_as = project_county
		}
		create_character = {
			location = root.capital_province
			template = peasant_leader_stewardship_character
			save_scope_as = peasant_leader
		}
		scope:peasant_leader = {
			add_character_flag = {
				flag = blocked_from_leaving
				years = 2
			}
		}
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
		save_scope_value_as = {
			name = road_quality
			value = 0
		}
		save_scope_value_as = {
			name = road_progress
			value = 0
		}
	}

	option = { #This peasant leader sounds good
		name = stewardship_domain_special.1301.a

		custom_tooltip = stewardship_lifestyle_rank_up_indication
		custom_tooltip = stewardship_domain_special.1301.a.peasant_leader_tt

		scope:peasant_leader = {
			save_scope_as = project_leader
		}
		stewardship_domain_special_1301_road_building_event_effect = yes

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #My Steward will handle this
		name = stewardship_domain_special.1301.b
		trigger = {
			exists = scope:steward
		}

		custom_tooltip = stewardship_lifestyle_rank_up_indication
		custom_tooltip = stewardship_domain_special.1301.a.steward_tt

		scope:steward = {
			save_scope_as = project_leader
		}
		stewardship_domain_special_1301_road_building_event_effect = yes

		ai_chance = {
			base = 50
			opinion_modifier = {
				opinion_target = scope:steward
			}
		}
	}
	
	option = { #No thanks
		name = stewardship_domain_special.1301.c
		flavor = stewardship_domain_special.1301.c.tt

		add_prestige = medium_prestige_gain

		remove_character_flag = is_in_stewardship_domain_special_event
	}
}



#Stretch with no village or farms
stewardship_domain_special.1311 = {
	type = character_event
	title = stewardship_domain_special.1311.t
	desc = stewardship_domain_special.1311.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1311 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1311
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Take workers from both places
		name = stewardship_domain_special.1311.a
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}

	option = { #Hire help
		name = stewardship_domain_special.1311.b
		remove_short_term_gold = minor_gold_value
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
	
	option = { #Claim land for myself
		name = stewardship_domain_special.1311.c
		remove_short_term_gold = medium_gold_value
		scope:project_county = {
			add_county_modifier = {
					modifier = stewardship_domain_personal_ownership_modifier
					years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}

#Merchants already using road
stewardship_domain_special.1312 = {
	type = character_event
	title = stewardship_domain_special.1312.t
	desc = stewardship_domain_special.1312.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1312 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1312
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Or they could be contributing to my coffers
		name = stewardship_domain_special.1312.a
		add_gold = medium_gold_value
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.decrease_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_decrease_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			diligent = minor_stress_impact_gain
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}

	option = { #What an original idea. I like it!
		name = stewardship_domain_special.1312.b
		scope:project_county = {
			change_county_control = medium_county_control_loss
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_2
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
}


#Robbers on the road
stewardship_domain_special.1313 = {
	type = character_event
	title = stewardship_domain_special.1313.t
	desc = stewardship_domain_special.1313.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1313 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1313
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = {
		name = stewardship_domain_special.1313.a
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_roadside_guard_patrols_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}

	option = {
		name = stewardship_domain_special.1313.b
		scope:project_county = {
			change_county_control = medium_county_control_loss
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}


#Levies wearing down the road
stewardship_domain_special.1314 = {
	type = character_event
	title = stewardship_domain_special.1314.t
	desc = {
		desc = stewardship_domain_special.1314.war
		desc = stewardship_domain_special.1314.end
	}
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOR = {
			exists = scope:had_1314
			exists = scope:had_1315
		}
		is_at_war = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1314
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Don't bother
		name = stewardship_domain_special.1314.a
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.decrease_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_decrease_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}

	option = { #Unfortunate, but necessary
		name = stewardship_domain_special.1314.b
		remove_short_term_gold = medium_gold_value
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}


#Levies helping trample the new road
stewardship_domain_special.1315 = {
	type = character_event
	title = stewardship_domain_special.1315.t
	desc = {
		desc = stewardship_domain_special.1314.war
		desc = stewardship_domain_special.1315.end
	}
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOR = {
			exists = scope:had_1314
			exists = scope:had_1315
		}
		is_at_war = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1315
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Great, get them to the frontlines!
		name = stewardship_domain_special.1315.a
		add_character_modifier = {
			modifier = stewardship_domain_improved_military_infrastructure_modifier
			years = 5
		}
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 15
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}

	option = { #Have them intentionally do this
		name = stewardship_domain_special.1315.b
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_2
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_quality_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}


#Merchants improving the road
stewardship_domain_special.1316 = {
	type = character_event
	title = stewardship_domain_special.1316.t
	desc = stewardship_domain_special.1316.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1316 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1316
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Put it in the road
		name = stewardship_domain_special.1316.a
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
	}

	option = { #Put it in my coffers
		name = stewardship_domain_special.1316.b
		add_gold = medium_gold_value
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			diligent = minor_stress_impact_gain
		}
	}

}

#Construction of a tavern
stewardship_domain_special.1317 = {
	type = character_event
	title = stewardship_domain_special.1317.t
	desc = stewardship_domain_special.1317.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1317 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1317
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #A great idea!
		name = stewardship_domain_special.1317.a
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_crown_lands_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			temperate = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
	}
	
	option = { #Get them back to work on the road
		name = stewardship_domain_special.1317.b
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}

#Work is progressing smoothly
stewardship_domain_special.1318 = {
	type = character_event
	title = stewardship_domain_special.1318.t
	desc = stewardship_domain_special.1318.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1318 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1318
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #Expand the project!
		name = stewardship_domain_special.1318.a
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_expanded_public_works_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}

	option = { #Focus on doing a good job
		name = stewardship_domain_special.1318.b
		scope:project_county = {
			add_county_modifier = {
				modifier = stewardship_domain_pecuniary_oversight_modifier
				years = 10
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
	
	option = { #Time to cut costs
		name = stewardship_domain_special.1318.c
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_cutting_costs_modifier
				days = 3650
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
	}
}

#The peasants are efficient
stewardship_domain_special.1319 = {
	type = character_event
	title = stewardship_domain_special.1319.t
	desc = stewardship_domain_special.1319.desc
	
	left_portrait = cp:councillor_steward
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1319 }
		exists = cp:councillor_steward
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1319
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
		}
	}

	option = { #Building bonus!
		name = stewardship_domain_special.1319.a
		add_character_modifier = {
			modifier = governance_building_lessons_learned_modifier
			days = 3650
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			arrogant = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #Don't you dare sink to their level
		name = stewardship_domain_special.1319.b
		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			target = cp:councillor_steward
			modifier = respect_opinion
			opinion = 15
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 500
				has_trait = arrogant
			}
		}
	}
}


#The peasant leader really helps
stewardship_domain_special.1320 = {
	type = character_event
	title = stewardship_domain_special.1320.t
	desc = stewardship_domain_special.1320.desc
	
	left_portrait = scope:peasant_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1320 }
		scope:project_leader = scope:peasant_leader
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1320
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:project_leader }
			}
			if = {
				limit = {
					exists = scope:peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
				}
			}
			else = {
				create_character = {
					location = root.capital_province
					template = peasant_leader_stewardship_character
					save_scope_as = peasant_leader
				}
				scope:peasant_leader = {
					save_scope_as = project_leader
					add_character_flag = {
						flag = blocked_from_leaving
						years = 2
					}
				}
			}
		}
	}

	option = { #You know best
		name = stewardship_domain_special.1320.a
		remove_short_term_gold = medium_gold_value
		scope:peasant_leader = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_2
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_increase_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			arrogant = medium_stress_impact_gain
		}
	}

	option = { #Takes too long and is too expensive
		name = stewardship_domain_special.1320.b
		scope:peasant_leader = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -15
			}
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.decrease_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_decrease_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			impatient = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
	}
}


#The Steward struggles
stewardship_domain_special.1321 = {
	type = character_event
	title = stewardship_domain_special.1321.t
	desc = stewardship_domain_special.1321.desc
	
	left_portrait = scope:steward
	right_portrait = scope:peasant_leader
	theme = stewardship_domain_focus
	
	trigger = {
		NOT = { exists = scope:had_1321 }
		AND = {
			exists = scope:steward
			exists = scope:steward
			scope:project_leader = scope:steward
		}
		scope:peasant_leader = {
			is_alive = yes
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_value_as = {
			name = had_1321
			value = yes
		}
		stewardship_domain_special_1301_automatic_progress_effect = yes
		if = {
			limit = {
				exists = scope:peasant_leader
			}
			scope:peasant_leader = {
				save_scope_as = project_leader
			}
		}
		else = {
			create_character = {
				location = root.capital_province
				template = peasant_leader_stewardship_character
				save_scope_as = peasant_leader
			}
			scope:peasant_leader = {
				save_scope_as = project_leader
				add_character_flag = {
					flag = blocked_from_leaving
					years = 2
				}
			}
		}
	}

	option = { #Side with Steward
		name = stewardship_domain_special.1321.a
		reverse_add_opinion = {
			target = scope:steward
			modifier = respect_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:peasant_leader
			modifier = respect_opinion
			opinion = -20
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:steward
			}
			modifier = {
				add = 100
				has_trait = arrogant
			}
		}
	}

	option = { #Side with peasant leader
		name = stewardship_domain_special.1321.b
		reverse_add_opinion = {
			target = scope:peasant_leader
			modifier = respect_opinion
			opinion = 20
		}
		reverse_add_opinion = {
			target = scope:steward
			modifier = respect_opinion
			opinion = -20
		}
		custom_tooltip = stewardship_domain_special.1301.increase_road_progress_1
		custom_tooltip = stewardship_domain_special.1301.increase_road_quality_1
		hidden_effect = {
			stewardship_domain_special_1301_increase_road_progress_effect = yes
			stewardship_domain_special_1301_decrease_road_quality_effect = yes
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		stress_impact = {
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
			opinion_modifier = {
				opinion_target = scope:peasant_leader
			}
		}
	}
}


#Whoever is in charge has been incapacitated
stewardship_domain_special.1391 = {
	type = character_event
	title = stewardship_domain_special.1391.t
	desc = stewardship_domain_special.1391.desc
	
	left_portrait = scope:project_leader
	right_portrait = scope:scope_for_portrait
	theme = stewardship_domain_focus
	
	trigger = {
		OR = {
			NOT = { exists = scope:project_leader }
			AND = {
				exists = scope:project_leader
				scope:project_leader = {
					OR = {
						is_alive = no
						has_trait = incapable
						is_imprisoned = yes
					}
				}
			}
		}
	}

	immediate = {
		if = {
			limit = {
				OR = {
					NOT = { exists = scope:peasant_leader }
					scope:peasant_leader = {
						is_alive = no
					}
				}
			}
			create_character = {
				location = root.capital_province
				template = peasant_leader_stewardship_character
				save_scope_as = new_peasant_leader
			}
			scope:new_peasant_leader = {
				save_scope_as = peasant_leader
				save_scope_as = scope_for_portrait
				add_character_flag = {
					flag = blocked_from_leaving
					years = 2
				}
			}
		}
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
				save_scope_as = scope_for_portrait
			}
		}
	}

	option = { #Assign the new peasant to oversee it
		name = stewardship_domain_special.1391.a
		trigger = {
			exists = scope:new_peasant_leader
		}
		scope:new_peasant_leader = {
			save_scope_as = project_leader
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #Assign the peasant to oversee it
		name = stewardship_domain_special.1391.a
		trigger = {
			NOT = { exists = scope:new_peasant_leader }
			scope:peasant_leader = { is_alive = yes }
		}
		scope:peasant_leader = {
			save_scope_as = project_leader
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #Assign a councillor to oversee it
		trigger = {
			exists = scope:steward
		}
		name = stewardship_domain_special.1391.b
		scope:steward = {
			save_scope_as = project_leader
		}
		stewardship_domain_special_1301_road_building_event_effect = yes
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = arrogant
			}
		}
	}
}


#The County has been lost
stewardship_domain_special.1392 = {
	type = character_event
	title = stewardship_domain_special.1392.t
	desc = stewardship_domain_special.1392.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	trigger = {
		scope:project_county = {
			NOT = { holder = root }
		}
	}

	option = { #At least not all is lost
		name = stewardship_domain_special.1392.a
		add_gold = medium_gold_value
		hidden_effect = {
			remove_character_flag = is_in_stewardship_domain_special_event
		}
	}
}

#Conclusion
stewardship_domain_special.1395 = {
	hidden = yes

	trigger = {
		scope:road_progress >= 4
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = scope:road_progress
			offset = -4
		}
	}

	immediate = {
		random_list = {
			
			2 = { #Amazing road
				compare_modifier = {
					value = scope:road_quality
					multiplier = 2
				}
				compare_modifier = {
					value = scope:project_leader.stewardship
					trigger = {
						exists = scope:project_leader
					}
					multiplier = 0.2
				}
				root = {
					trigger_event = stewardship_domain_special.1399
				}
			}
			

			5 = { #Great road
				compare_modifier = {
					value = scope:road_quality
					multiplier = 1.5
				}
				compare_modifier = {
					value = scope:project_leader.stewardship
					trigger = {
						exists = scope:project_leader
					}
					multiplier = 0.2
				}
				root = {
					trigger_event = stewardship_domain_special.1398
				}
			}
			
			10 = { #Standard road
				compare_modifier = {
					value = scope:road_quality
				}
				compare_modifier = {
					value = scope:project_leader.stewardship
					trigger = {
						exists = scope:project_leader
					}
					multiplier = 0.2
				}
				root = {
					trigger_event = stewardship_domain_special.1397
				}
			}
			
			10 = { #Poor road
				compare_modifier = {
					value = scope:road_quality
					multiplier = -1
				}
				root = {
					trigger_event = stewardship_domain_special.1396
				}
			}
		}
	}
}


#Poor Road
stewardship_domain_special.1396 = {
	type = character_event
	title = stewardship_domain_special.1396.t
	desc = stewardship_domain_special.1396.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	option = {
		name = stewardship_domain_special.1396.a

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_poor_new_road_modifier
				years = 30
			}
		}
	}

	after = {
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}


#Standard Road
stewardship_domain_special.1397 = {
	type = character_event
	title = stewardship_domain_special.1396.t
	desc = stewardship_domain_special.1397.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	option = {
		name = stewardship_domain_special.1397.a

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_standard_new_road_modifier
				years = 30
			}
		}
		ai_chance = {
			base = 1
		}
	}

	option = {
		name = stewardship_domain_special.1397.b
		trigger = {
			scope:peasant_leader = {
				is_alive = yes
				is_ruler = no
			}
		}

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_standard_new_road_modifier
				years = 30
			}
		}

		if = {
			limit = {
				scope:peasant_leader = {
					is_alive = yes
					is_ruler = no
				}
			}
			add_courtier = scope:peasant_leader
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		remove_character_flag = is_in_stewardship_domain_special_event
		scope:peasant_leader = {
			if = {
				limit = {
					is_alive = yes
				}
				remove_character_flag = blocked_from_leaving
			}
		}
	}
}


#Good Road
stewardship_domain_special.1398 = {
	type = character_event
	title = stewardship_domain_special.1396.t
	desc = stewardship_domain_special.1398.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	option = {
		name = stewardship_domain_special.1398.a

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_good_new_road_modifier
				years = 30
			}
		}
		ai_chance = {
			base = 1
		}
	}

	option = {
		name = stewardship_domain_special.1398.b
		trigger = {
			scope:peasant_leader = {
				is_alive = yes
			}
		}

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_good_new_road_modifier
				years = 30
			}
		}

		if = {
			limit = {
				scope:peasant_leader = {
					is_alive = yes
					is_ruler = no
				}
			}
			add_courtier = scope:peasant_leader
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		remove_character_flag = is_in_stewardship_domain_special_event
		scope:peasant_leader = {
			if = {
				limit = {
					is_alive = yes
				}
				remove_character_flag = blocked_from_leaving
			}
		}
	}
}


#Amazing Road
stewardship_domain_special.1399 = {
	type = character_event
	title = stewardship_domain_special.1396.t
	desc = stewardship_domain_special.1399.desc
	
	left_portrait = scope:project_leader
	theme = stewardship_domain_focus
	
	option = {
		name = stewardship_domain_special.1399.a

		add_stewardship_lifestyle_perk_points = 1		
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_excellent_new_road_modifier
				years = 30
			}
		}
		ai_chance = {
			base = 1
		}
	}

	option = {
		name = stewardship_domain_special.1399.b
		trigger = {
			scope:peasant_leader = {
				is_alive = yes
				is_ruler = no
			}
		}

		add_stewardship_lifestyle_perk_points = 1
		scope:project_county = {
			add_county_modifier = {
				modifier = governance_excellent_new_road_modifier
				years = 30
			}
		}

		if = {
			limit = { scope:peasant_leader = { NOT = { is_courtier_of = root } } }
			add_courtier = scope:peasant_leader
		}

		ai_chance = {
			base = 100
		}
	}

	after = {
		remove_character_flag = is_in_stewardship_domain_special_event
	}
}

###END OF ROAD CONSTRUCTION CHAIN



####################
# A Missing Village
# 1401 - 1499
# by Petter Vilberg
####################


#A village seems to go missing from the records
scripted_trigger stewardship_domain_special_1401_suitable_barony = {
	NOT = { this = root.capital_barony }
	title_province = {
		county = {
			holder = root
			NOR = {
				# County doesn't currently have any modifiers from this event.
				has_county_modifier = governance_land_cleared_for_settlement_modifier
				has_county_modifier = governance_self_sufficient_county_modifier
				has_county_modifier = governance_time_reclaiming_land_modifier
				has_county_modifier = governance_forbidden_resettlement_modifier
				has_county_modifier = governance_ordered_resettlement_modifier
				has_county_modifier = governance_improved_taxation_county_modifier
				has_county_modifier = governance_increased_tax_evasion_modifier
				has_county_modifier = governance_abandoned_villages_modifier
				has_county_modifier = governance_lenient_tax_policy_modifier
				has_county_modifier = governance_harsh_tax_policy_modifier
				has_county_modifier = governance_overtaxed_modifier
			}
		}
	}
}


stewardship_domain_special.1401 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1401.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	trigger = {
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_1401_this_lifetime }

		any_sub_realm_barony = {
			stewardship_domain_special_1401_suitable_barony = yes
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Standard progress event stuff
		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 365
		}
		add_character_flag = had_stewardship_domain_special_1401_this_lifetime

		#Other effects:
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_special_1401_suitable_barony = yes
			}
			save_scope_as = barony
			title_province = {
				county = {
					save_scope_as = county
				}
			}
		}
	}

	option = { #Send the collector to find out
		name = stewardship_domain_special.1401.a
		custom_tooltip = stewardship_domain_special.1401.a.tt
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		stress_impact = {
			paranoid = minor_stress_impact_gain
		}
		hidden_effect = {
			random_list = {
				50 = { #Collector wants to show the village
					trigger_event = {
						id = stewardship_domain_special.1411
						days = { 20 30 }
					}
				}
				50 = { #The village is abandoned
					save_scope_value_as = {
						name = collector_investigates
						value = yes
					}
					trigger_event = {
						id = stewardship_domain_special.1421
						days = { 20 30 }
					}
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Investigate personally
		name = stewardship_domain_special.1401.b
		custom_tooltip = stewardship_domain_special.1401.b.tt
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		stress_impact = {
			lazy = medium_stress_impact_gain
		}
		hidden_effect = {
			random_list = {
				50 = { #The village is abandoned
					trigger_event = {
						id = stewardship_domain_special.1421
						days = { 20 30 }
					}
				}
				50 = { #Villagers DO pay their taxes
					trigger_event = {
						id = stewardship_domain_special.1431
						days = { 20 30 }
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
			}
		}
	}
	
	option = { #No thanks
		name = stewardship_domain_special.1401.c

		stress_impact = {
			base = medium_stress_impact_loss
			greedy = major_stress_impact_gain
			ambitious = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
			lazy = minor_stress_impact_loss
			
			
		}

		remove_character_flag = is_in_stewardship_domain_special_event
		ai_chance = {
			base = 0
		}
	}
}


#The tax collector wants to show off the village
stewardship_domain_special.1411 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1411.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = scope:collector
	
	immediate = {
		create_character = {
			employer = root
			template = tax_collector_character
			save_scope_as = collector
		}
		scope:collector = {
			add_character_flag = {
				flag = blocked_from_leaving
				years = 1
			}
		}
	}

	option = { #Fine
		name = stewardship_domain_special.1411.a
		scope:collector = {
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = 20
			}
		}
		custom_tooltip = stewardship_domain_special.1411.a.tt
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1413
				days = { 5 10 }
			}
		}
		stress_impact = {
			impatient = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
				ai_honor = 0.5
			}
		}
	}

	option = { #This has been pointless, punish the tax collector
		name = stewardship_domain_special.1411.b
		flavor = stewardship_domain_special.1411.b.tt
		show_as_tooltip = {
			scope:collector = {
				death = {
					death_reason = death_execution
					killer = root
				}
			}
		}
		
		if = {
			limit = {
				scope:county = {
					county_control < 95
				}
			}
			scope:county = {
				change_county_control = 20
			}
		}
		else = {
			add_dread = minor_dread_gain
		}
		
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1412
				days = { 5 10 }
			}
		}
		stress_impact = {
			just = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}
}


#Leaving the village
stewardship_domain_special.1412 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1412.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = scope:collector
	
	immediate = {
		scope:collector = {
			death = {
				death_reason = death_execution
				killer = root
			}
		}
	}

	option = { #Next year's collector will settle the debt
		name = stewardship_domain_special.1412.a
		
		scope:county = {
			change_county_control = 20
		}

		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1441
				days = { 10 20 }
			}
		}
		stress_impact = {
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = { #Drive the peasants out
		name = stewardship_domain_special.1412.b
		flavor = stewardship_domain_special.1412.b.flavor

		add_gold = major_gold_value
		scope:county = {
			change_development_progress_with_overflow = -75
		}

		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1414
				days = { 10 20 }
			}
		}

		stress_impact = {
			compassionate = massive_stress_impact_gain
	
			forgiving = major_stress_impact_gain
			generous = major_stress_impact_gain
			
			gregarious = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}
}

#Collector is showing you around
stewardship_domain_special.1413 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1413.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = scope:collector
	
	option = { #Exceptions must occasionally be made
		name = stewardship_domain_special.1413.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_lenient_tax_policy_modifier
				years = 10
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1442
				days = { 20 30 }
			}
		}
	}
	
	option = { #The law is the law, nothing to be done
		name = stewardship_domain_special.1413.b
		scope:county = {
			change_development_progress_with_overflow = -50
			add_county_modifier = {
				modifier = governance_harsh_tax_policy_modifier
				years = 10
			}
		}

		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1442
				days = { 20 30 }
			}
		}
	}

	option = { #You were complicit in treachery, collector!
		name = stewardship_domain_special.1413.c
		show_as_tooltip = {
			scope:collector = {
				death = {
					death_reason = death_execution
					killer = root
				}
			}
		}
		custom_tooltip = stewardship_domain_special.1413.c.tt
		trigger_event = {
			id = stewardship_domain_special.1412
			days = { 2 3 }
		}
	}
}


#Burn the village
stewardship_domain_special.1414 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1414.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = burning_building
	}
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1414.a
		
		scope:county = {
			add_county_modifier = {
				modifier = governance_land_cleared_for_settlement_modifier
				years = 10
			}
		}
		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event

		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = stewardship_domain_special.1451
					days = { 1825 7300 }
				}
			}
		}
	}	
}


#Village is abandoned
stewardship_domain_special.1421 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:collector_investigates }
				desc = stewardship_domain_special.1421.collector_opening
			}
			desc = stewardship_domain_special.1421.self_opening
		}
		desc = stewardship_domain_special.1421.desc
	}
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = root

	immediate = {
		scope:county = {
			change_development_progress_with_overflow = -50
		}
	}

	option = { #Investigate
		name = stewardship_domain_special.1421.a
		custom_tooltip = stewardship_domain_special.1421.a.tt

		stress_impact = {
			craven = medium_stress_impact_gain
		}

		hidden_effect = {
			random_list = {
				50 = { #Child
					trigger_event = {
						id = stewardship_domain_special.1422
						days = { 3 8 }
					}	
				}
				50 = { #Pile of corpses
					trigger_event = {
						id = stewardship_domain_special.1424
						days = { 3 8 }
					}
				}
			}
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_boldness = 1
			}
		}
	}

	option = { #Flee
		name = stewardship_domain_special.1421.b

		scope:county = {
			change_county_control = minor_county_control_loss
		}

		hidden_effect = {
			trigger_event = { #Good thing that's over
				id = stewardship_domain_special.1423
				days = { 30 60 }
			}
		}

		stress_impact = {
			brave = major_stress_impact_gain
		}

		ai_chance = {
			base = 75
		}
	}

}


#A child is found
stewardship_domain_special.1422 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1422.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = scope:foundling

	immediate = {
		create_character = {
			location = scope:county.title_province
			template = peasant_villager_foundling_character
			save_scope_as = foundling
		}
	}

	option = { #Bring the child to court
		name = stewardship_domain_special.1422.a
		add_courtier = scope:foundling
		scope:foundling = {
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 50
			}
		}
		
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1423
				days = { 10 20 }
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}

	option = { #Leave the child with some villagers
		name = stewardship_domain_special.1422.b
		scope:county = {
			add_county_modifier = {
				modifier = governance_self_sufficient_county_modifier
				years = 10
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1423
				days = { 10 20 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	
	option = { #Burn the village, and the child
		name = stewardship_domain_special.1422.c
		scope:foundling = {
			death = {
				death_reason = death_disappearance
				killer = root
			}
		}
		scope:county = {
			change_development_progress_with_overflow = -50
			add_county_modifier = {
				modifier = governance_land_cleared_for_settlement_modifier
				days = 3650
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1414
				days = { 5 10 }
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
			}
		}
	}
}


#Thinking about that village
stewardship_domain_special.1423 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					AND = {
						exists = scope:foundling
						scope:foundling = {
							is_courtier_of = root
						}
					}
				}
				desc = stewardship_domain_special.1423.foundling
			}
			desc = stewardship_domain_special.1423.no_foundling
		}
		desc = stewardship_domain_special.1423.desc
	}
	
	theme = stewardship_domain_focus
	left_portrait = scope:foundling
	
	option = { #Forbid it from resettlement
		name = stewardship_domain_special.1423.a
		
		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event
		scope:county = {
			change_county_control = minor_county_control_gain
			add_county_modifier = {
				modifier = governance_forbidden_resettlement_modifier
				days = 3650
			}
		}
		stress_impact = {
			diligent = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5	
			}
		}
	}

	option = { #Let time reclaim it
		name = stewardship_domain_special.1423.b

		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event

		scope:county = {
			add_county_modifier = {
				modifier = governance_time_reclaiming_land_modifier
				days = 3650
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
}

#A Pile of Corpses
stewardship_domain_special.1424 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = {
		desc = stewardship_domain_special.1424.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:collector_investigates }
				desc = stewardship_domain_special.1424.collector_end
			}
			desc = stewardship_domain_special.1424.self_end
		}
	}
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = root
	
	option = { #Burn this place to the ground
		name = stewardship_domain_special.1424.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_land_cleared_for_settlement_modifier
				days = 3650
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1426
				days = { 5 15 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 0.5
			}
		}
	}

	option = { #Bury the bodies and order resettlement
		name = stewardship_domain_special.1424.b
		scope:county = {
			change_county_control = medium_county_control_gain
			add_county_modifier = {
				modifier = governance_ordered_resettlement_modifier
				days = 3650
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1425
				days = { 20 30 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_rationality = 0.5
			}
		}
	}
}

#Resettlement ordered
stewardship_domain_special.1425 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1425.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = courtyard
	}
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1425.a

		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event

		if = {
			limit = {
				NOT = { has_trait = ill }
			}
			random = {
				chance = 50
				add_trait = ill
			}
		}
	}
}

#Village burned
stewardship_domain_special.1426 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1426.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = burning_building
	}
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1426.a

		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event
	}
}


#The village is present - and paying tax!
stewardship_domain_special.1431 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1431.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = market
	}
	left_portrait = scope:collector
	
	immediate = {
		create_character = {
			employer = root
			template = tax_collector_character
			save_scope_as = collector
		}
		scope:collector = {
			add_character_flag = {
				flag = blocked_from_leaving
				years = 1
			}
		}
	}

	option = { #The Collector will pay for this...
		name = stewardship_domain_special.1431.a

		stress_impact = {
			greedy = medium_stress_impact_gain
		}

		custom_tooltip = stewardship_domain_special.1431.a.tt
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1432
				days = { 10 20 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
	
	option = { #Extra taxes this year, then
		name = stewardship_domain_special.1431.b

		add_gold = medium_gold_value
		scope:county = {
			add_county_modifier = {
				modifier = governance_overtaxed_modifier
				years = 5
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1432
				days = { 10 20 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}
}


#Confront the collector
stewardship_domain_special.1432 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1432.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = market
	}
	left_portrait = scope:collector
	
	option = { #Prison
		name = stewardship_domain_special.1432.a
		imprison = {
			target = scope:collector
			type = dungeon
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1441
				days = { 20 30 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}

	option = { #Recruitment
		name = stewardship_domain_special.1432.b
		random_list = {
			75 = {
				desc = stewardship_domain_special.1432.b.collector_loyal
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.1432.b.collector_loyal
					left_icon = scope:collector
					if = {
						limit = {
							can_add_hook = {
								target = scope:collector
								type = indebted_hook
							}
						}
						add_hook = {
							target = scope:collector
							type = indebted_hook
						}
					}
				}
				hidden_effect = {
					trigger_event = {
						id = stewardship_domain_special.1441
						days = { 20 30 }
					}
				}
			}
			25 = {
				desc = stewardship_domain_special.1432.b.collector_bad
				# No need for a toast, because we trigger a follow-up event.
				custom_tooltip = stewardship_domain_special.1432.b.collector_bad.tt
				hidden_effect = {
					trigger_event = {
						id = stewardship_domain_special.1433
						days = { 5 10 }
					}
				}
			}
		}
		stress_impact = {
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
				ai_compassion = 0.5
			}
		}
	}
	
	option = { #Death
		name = stewardship_domain_special.1432.c
		scope:collector = {
			death = {
				death_reason = death_execution
				killer = root
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1441
				days = { 20 30 }
			}
		}
		stress_impact = {
			forgiving = major_stress_impact_gain
		}
		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}
}


#The Collector turns on you!
stewardship_domain_special.1433 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1433.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = market
	}
	left_portrait = scope:collector
	
	option = { #Death
		name = stewardship_domain_special.1433.a
		scope:collector = {
			death = {
				death_reason = death_execution
				killer = root
			}
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1441
				days = { 20 30 }
			}
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_vengefulness = 1
			}
		}
	}

	option = { #Dungeon
		name = stewardship_domain_special.1433.b
		imprison = {
			target = scope:collector
			type = dungeon
		}
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.1441
				days = { 20 30 }
			}
		}
		stress_impact = {
			vengeful = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}
}



#Harsh but fair conclusions
stewardship_domain_special.1441 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1441.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1441.a
		
		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event
		hidden_effect = {
			random_list = {
				40 = {
					trigger_event = { #Improved taxation follow-up
						id = stewardship_domain_special.1443
						days = { 1825 5475 }
					}
				}
				60 = {
					trigger_event = { #Abandoned villages follow-up
						id = stewardship_domain_special.1445
						days = { 1825 5475 }
					}
				}
			}
		}
	}
}

#Merciful conclusion
stewardship_domain_special.1442 = {
	type = character_event
	title = stewardship_domain_special.1401.t
	desc = stewardship_domain_special.1442.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1441.a

		add_stewardship_lifestyle_perk_points = 1

		remove_character_flag = is_in_stewardship_domain_special_event
		hidden_effect = {
			random_list = {
				60 = {
					trigger_event = { #Improved taxation follow-up
						id = stewardship_domain_special.1443
						days = { 1825 5475 }
					}
				}
				40 = {
					trigger_event = { #More tax evasion follow-up
						id = stewardship_domain_special.1444
						days = { 1825 5475 }
					}
				}
			}
		}
	}
}

#Follow-up: Better taxation
stewardship_domain_special.1443 = {
	type = character_event
	title = stewardship_domain_special.1443.t
	desc = {
		desc = stewardship_domain_special.1443.opening
		desc = stewardship_domain_special.1443.end
	}
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1443.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_improved_taxation_county_modifier
				days = 3650
			}
		}
	}
}

#Follow-up: More tax dodging
stewardship_domain_special.1444 = {
	type = character_event
	title = stewardship_domain_special.1444.t
	desc = {
		desc = stewardship_domain_special.1443.opening
		desc = stewardship_domain_special.1444.end
	}
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1444.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_increased_tax_evasion_modifier
				days = 3650
			}
		}
	}
}

#Abandoned villages follow-up
stewardship_domain_special.1445 = {
	type = character_event
	title = stewardship_domain_special.1445.t
	desc = {
		desc = stewardship_domain_special.1443.opening
		desc = stewardship_domain_special.1445.end
	}
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1445.a
		scope:county = {
			add_county_modifier = {
				modifier = governance_abandoned_villages_modifier
				days = 3650
			}
		}
	}
}

#Follow-up: Nightmares
stewardship_domain_special.1451 = {
	type = character_event
	title = stewardship_domain_special.1451.t
	desc = stewardship_domain_special.1451.desc
	
	theme = stewardship_domain_focus
	left_portrait = root
	
	option = {
		name = stewardship_domain_special.1451.a
		stress_impact = {
			base = medium_stress_gain
			callous = minor_stress_impact_loss
		}
	}

	option = {
		name = stewardship_domain_special.1451.b
		trigger = {
			has_trait = sadistic
		}
		trait = sadistic
		exclusive = yes
		stress_impact = {
			sadistic = medium_stress_loss
		}
	}
}


### END OF MISSING VILLAGE CHAIN

#####################################
# Domesday Book						#
# 1500-1599						 	#
# by Stephen Arthur and Sean Hughes #
#####################################

#Trigger used to check if event title should be "The Domesday Book" (if true) or "The Great Survey" (if false).
scripted_trigger stewardship_domain_special_1500_domesday_true_name = {
	OR = {
		has_culture = culture:anglo_saxon
		has_culture = culture:norman
		has_culture = culture:english
	}
}

#Initial kickoff event.
stewardship_domain_special.1500 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}	

	desc = stewardship_domain_special.1500.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = terrain
	}

	left_portrait = scope:domesday_steward
	
	trigger = {
		#Standard special event triggers.
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_1500_this_lifetime }

		#We must have enough gold in our treasury to quality for at least 2 of the 3 event options.
		OR = {
			AND = {
				is_ai = no
				gold >= medium_gold_value
			}
			AND = {
				is_ai = yes
				short_term_gold >= medium_gold_value
			}
		}

		#We must have an AI steward assigned.
		exists = cp:councillor_steward
		cp:councillor_steward = {
			is_ai = yes
		}
	}

	weight_multiplier = {
		base = 0.75

		# More likely if the character has multiple counties with low Control.
		modifier = {
			add = 0.25
			any_held_title = {
				tier = tier_county
				county_control <= 80
			}
		}

		modifier = {
			add = 0.5
			any_held_title = {
				count >= 3
				tier = tier_county
				holder = root
				county_control <= 80
			}
		}
	}

	immediate = {
		#Save our steward as an event scope.
		cp:councillor_steward = {
			save_scope_as = domesday_steward
		}

		#Flag this character as having received this event.
		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 500
		}
		add_character_flag = had_stewardship_domain_special_1500_this_lifetime
		set_variable = {
			name = last_stewardship_domain_special_event
			value = flag:domesday_book
		}

		#Initialize variables we will be using during the event.
		set_variable = {
			name = stewardship_domain_special_1500_domesday_assessors_protected
			value = no
		}
		set_variable = {
			name = stewardship_domain_special_1500_domesday_is_active
			value = yes
		}
	}

	#Option 1: Longer and expensive survey, but higher quality.
	option = {
		name = stewardship_domain_special.1500.a
		flavor = stewardship_domain_special.1500.a.tt

		#AI must have enough gold budgeted to take this option.
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= major_gold_value
			}
		}

		#Save the value of the gold this character spent on the survey for the Corrupt Steward event (if it occurs).
		remove_short_term_gold = major_gold_value
		save_scope_value_as = {
			name = domesday_gold_paid
			value = major_gold_value
		}

		# Display the possible event outcomes to the player.
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		
		# Tell the player what the effects of the
		show_as_tooltip = {
			random_list = {
				desc = outcome_in_a_few_months
				1 = {
					desc = stewardship_domain_special.1500.quality_based_taxes
					show_chance = no

					# Indicated that each county will get proportionally higher taxes.
					every_sub_realm_county = {
						custom = stewardship_domain_special.1590.every_county
						custom_tooltip = stewardship_domain_special.1500.every_county_control
						custom_tooltip = stewardship_domain_special.1500.every_county_summary
					}
				}
				0 = {
					desc = stewardship_domain_special.1500.survey_not_completed
					show_chance = no

					# Failure outcome
					scope:domesday_steward = {
						add_prestige = medium_prestige_loss
					}
				}
			}
		}

		hidden_effect = {
			#We start at the 'Excellent' quality level (20) for the expensive survey.
			set_variable = {
				name = stewardship_domain_special_1500_domesday_quality
				value = 20
			}

			#Trigger 2nd setup event which asks about protecting our assessors.
			trigger_event = {
				id = stewardship_domain_special.1501
				days = { 7 14 }
			}

			#Starts up the random event cycle, with the 1st event occuring after 30-45 days.
			set_variable = {
				name = stewardship_domain_special_1500_remaining_random_events
				value = 4 #4 random events for the longer/expensive option.
			}
			trigger_event = {
				on_action = stewardship_lifestyle_domesday
				days = { 30 45 }
			}
		}

		stress_impact = {
			lazy = medium_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 100
				ai_boldness = 50
			}
		}
	}

	#Option 2: Faster and cheaper survey option, but outcome may be of a lower quality.
	option = {
		name = stewardship_domain_special.1500.b
		flavor = stewardship_domain_special.1500.b.tt

		#Save the value of the gold this character spent on the surveyfor the Corrupt Steward event (if it occurs).
		remove_short_term_gold = medium_gold_value
		save_scope_value_as = {
			name = domesday_gold_paid
			value = medium_gold_value
		}

		#Display the possible event outcomes to the player.
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		show_as_tooltip = {
			random_list = {
				desc = outcome_in_a_few_months
				1 = {
					desc = stewardship_domain_special.1500.quality_based_taxes
					show_chance = no

					# Indicated that each county will get proportionally higher taxes.
					every_sub_realm_county = {
						custom = stewardship_domain_special.1590.every_county
						custom_tooltip = stewardship_domain_special.1500.every_county_control
						custom_tooltip = stewardship_domain_special.1500.every_county_summary
					}
				}
				0 = {
					desc = stewardship_domain_special.1500.survey_not_completed
					show_chance = no

					# Failure outcome
					scope:domesday_steward = {
						add_prestige = medium_prestige_loss
					}
				}
			}
		}

		hidden_effect = {
			#We start at the 'High' quality level (15) for the cheaper survey.
			set_variable = {
				name = stewardship_domain_special_1500_domesday_quality
				value = 15
			}

			#Trigger 2nd setup event which asks about protecting our assessors.
			trigger_event = {
				id = stewardship_domain_special.1501
				days = { 7 14 }
			}

			#Starts up the random event cycle, with the 1st event occuring after 30-45 days.
			set_variable = {
				name = stewardship_domain_special_1500_remaining_random_events
				value = 3 #3 random events for the shorter/cheaper option.
			}
			trigger_event = {
				on_action = stewardship_lifestyle_domesday
				days = { 30 45 }
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 100
				ai_greed = 50
			}
		}

	}
	
	#Option 3: Reject survey proposal to gain a small opinion bonus with all other vassals.
	option = {
		name = stewardship_domain_special.1500.c

		#Your steward is disappointed that you rejected their idea.
		scope:domesday_steward = {
			add_opinion = {
				modifier = disappointed_opinion
				target = root
				opinion = -10
			}
		}

		#All other vassals are happy that you trust their word and give them more autonomy.
		every_vassal = {
			limit = {
				NOT = { this = scope:domesday_steward }
			}
			custom = stewardship_domain_special.1500.c.tt
			add_opinion = {
				modifier = trust_opinion
				target = root
				opinion = 10
			}
		}

		stress_impact = {
			diligent = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -50
				ai_energy = -100
				ai_compassion = 100
			}
		}
	}
}

###############################
# Domesday Book: Send Guards? #
###############################

# 2nd setup event. Determines how well your assessors are protected.
stewardship_domain_special.1501 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = stewardship_domain_special.1501.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = armory
	}

	left_portrait = scope:domesday_marshal

	
	#If we have no marshal we skip this event. Worst outcome, as the assessors go unprotected and you receive no Prestige as compensation.
	trigger = {
		exists = cp:councillor_marshal
		var:stewardship_domain_special_1500_domesday_is_active = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Save our marshal's scope for loc and portraits.
		cp:councillor_marshal = {
			save_scope_as = domesday_marshal
		}
	}

	#Option 1: I am the king, my surveyors need no guards!
	option = {
		name = stewardship_domain_special.1501.a

		#Gain prestige(though if your assessors end up getting attacked you will lose this later).
		add_prestige = minor_prestige_gain

		#Inform the player their assessors will be unprotected.
		custom_tooltip = stewardship_domain_special.1501.a.tt

		if = {
			limit = {
				any_sub_realm_county = {
					county_control <= 70
				}
			}
			stress_impact = {
				paranoid = medium_stress_impact_gain
				humble = minor_stress_impact_gain
				just = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				paranoid = minor_stress_impact_gain
				humble = minor_stress_impact_gain
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = -50
				ai_greed = 50
			}
		}
	}

	#Option 2: Organize milita patrols for a chance to receive free guards.
	option = {
		name = stewardship_domain_special.1501.b
		duel = {
			skill = martial
			value = 10
			50 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2.5
					min = -49
				}
				# Successfully organize a milita patrol.
				desc = stewardship_domain_special.1501.b.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.1501.b.success
					left_icon = root

					#Assessors will be protected.
					custom_tooltip = stewardship_domain_special.1501.c.tt
					set_variable = {
						name = stewardship_domain_special_1500_domesday_assessors_protected
						value = yes
					}
				}
			}
			50 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2.5
					min = -49
				}
				#Fail to organize a milita patrol
				desc = stewardship_domain_special.1501.b.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.1501.b.failure
					left_icon = root

					#Assessors will not be protected.
					custom_tooltip = stewardship_domain_special.1501.a.tt
				}
			}
		}

		ai_chance = {
			base = 50

			# Rational characters know when they have a good chance of winning the duel
			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = {
					value = martial
					add = -10
				}
				multiplier = 500 # -5,000 at 0 Martial, +0 at 10 Martial, +5,000 at 20 Martial
			}

			ai_value_modifier = {
				ai_greed = 100
				ai_energy = 50
			}
		}


	}
	
	#Option 3: Pay a premium to guarantee your assessors will be safe.
	option = {
		name = stewardship_domain_special.1501.c

		#AI must have enough gold budgeted to take this option.
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= medium_gold_value
			}
		}

		#Pay the costs to equip and dispatch your knights.
		remove_short_term_gold = medium_gold_value

		#Your marshal likes that you approved of their idea.
		reverse_add_opinion = {
			modifier = pleased_opinion
			target = scope:domesday_marshal
			opinion = 20
		}

		#Your assessors will be protected.
		custom_tooltip = stewardship_domain_special.1501.c.tt
		set_variable = {
			name = stewardship_domain_special_1500_domesday_assessors_protected
			value = yes
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = -100
			}
		}
	}

}

###############################################
# Domesday Book: Random Event Shared Triggers #
###############################################

#Only fire random events as long as the chain is active and we have random events remaining (if all random events are invalid, we skip to the final event).
scripted_trigger stewardship_domain_special_1510_allow_random_events = {
	var:stewardship_domain_special_1500_domesday_is_active = yes
	var:stewardship_domain_special_1500_remaining_random_events > 0
}

#Used in county-focused events to check if a county is a valid target for a random event.
scripted_trigger stewardship_domain_special_1500_valid_county = {
	save_temporary_scope_as = this_county

	#Ensure that this county hasn't already been excluded from the assessment.
	NOT = {
		any_in_list = {
			list = excluded_counties
			this = scope:this_county
		}
	}

	#Ensure that this county hasn't already appeared in this event chain in the last year.
	NOT = { exists = var:stewardship_domain_special_1500_was_event_county }
}

#Used in character-focused events to check if a vassal is a valid target for a random event.
scripted_trigger stewardship_domain_special_1500_valid_vassal = {
	save_temporary_scope_as = this_vassal

	#Vassals must be at least Count tier and available to participate in the event.
	is_available_ai_adult = yes
	highest_held_title_tier >= 2

	NOR = {
		#Vassal must not own any provinces which have already been excluded.
		any_in_list = {
			list = excluded_counties
			
			holder = scope:this_vassal
		}

		#The steward who started this event chain will not protest having their own holdings surveyed.
		this = scope:domesday_steward

		#Vassal must not have already participated in this event chain within the last year.
		has_character_flag = stewardship_domain_special_1500_selected_vassal
	}

	#Cowed characters will not object to their liege's assessors.
	dread_modified_ai_boldness = {
		dreaded_character = root
		value > -75
	}
}

###############################
# Domesday Book: Upset Priest #
###############################

scripted_trigger stewardship_domain_special_1510_upset_priest = {
	OR = {
		AND = {
			root.faith = {
				has_doctrine = doctrine_theocracy_temporal
			}
			root.cp:councillor_court_chaplain = this
		}
		AND = {
			NOT = {
				root.faith = {
					has_doctrine = doctrine_theocracy_temporal
				}
			}
			stewardship_domain_special_1500_valid_vassal = yes
		}
	}
	
}

#A priest is upset that your tax assessors have disrupted their religious services.
stewardship_domain_special.1510 = {
	type = letter_event
	opening = {
		desc = stewardship_domain_special.1510.opening
	}
	desc = {
		desc = stewardship_domain_special.1510.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					faith = {
						has_doctrine = doctrine_theocracy_temporal
					}
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				desc = stewardship_domain_special.1510.desc_ending_not_endorsed
			}
			desc = stewardship_domain_special.1510.desc_ending
		}
	}
	sender = scope:upset_priest

	trigger = {
		#Ensures a valid target exists for this event.
		OR = {
			AND = {
				faith = {
					has_doctrine = doctrine_theocracy_temporal
				}
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = {
					stewardship_domain_special_1510_upset_priest = yes
				}
			}
			AND = {
				NOT = {
					faith = {
						has_doctrine = doctrine_theocracy_temporal
					}
				}
				any_vassal = {
					stewardship_domain_special_1510_upset_priest = yes
				}
			}
		}
		stewardship_domain_special_1510_allow_random_events = yes

		#Do not allow this random event to fire twice in a row.
		OR = {
			NOT = { has_variable = stewardship_domain_special_1500_last_random_event }
			AND = {
				has_variable = stewardship_domain_special_1500_last_random_event
				NOT = { var:stewardship_domain_special_1500_last_random_event = flag:upset_priest }
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		if = {
			limit = {
				faith = {
					has_doctrine = doctrine_theocracy_temporal
				}
			}
			cp:councillor_court_chaplain = {
				#Selected character may not participate in another Domesday random event for 1 year.
				add_character_flag = {
					flag = stewardship_domain_special_1500_selected_vassal
					days = 365
				}
				save_scope_as = upset_priest
			}
		}
		else = {
			random_vassal = {
				limit = {
					stewardship_domain_special_1510_upset_priest = yes
				}

				#Selected character may not participate in another Domesday random event for 1 year.
				add_character_flag = {
					flag = stewardship_domain_special_1500_selected_vassal
					days = 365
				}
				save_scope_as = upset_priest
			}
		}
		

		#Flag this event as the last random event to fire.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:upset_priest
		}
	}

	#Option 1: Assess the priest's holdings priest despite their objections.
	option = {
		name = stewardship_domain_special.1510.a

		#Increase the survey quality due to thoroughness.
		stewardship_domain_special_1500_increase_quality_effect = yes

		#Priest doesn't like this their concerns being disregarded.
		scope:upset_priest = {
			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -20
			}
		}

		stress_impact = {
			zealous = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = -200
				ai_greed = 200
			}
		}
	}

	#Option 2: Exclude the priest's holdings for an immediate piety bonus.
	option = {
		name = stewardship_domain_special.1510.b

		#Add the priest's counties to the exclusion list, and lower the survey quality.
		custom_tooltip = stewardship_domain_special.1510.b.tt
		stewardship_domain_special_1500_decrease_quality_effect = yes
		scope:upset_priest = {
			every_sub_realm_county = {
				limit = {
					holder = scope:upset_priest
				}
				add_to_list = excluded_counties
			}
		}

		#Gain piety for allowing the chuch to manage church affairs.
		add_piety = medium_piety_gain

		stress_impact = {
			cynical = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 200
				ai_greed = -200
			}
		}
	}
	
	#Option 3: Succeed as a Learning skill challenge to survey the holdings with no penalty.
	option = {
		name = stewardship_domain_special.1510.c
		duel = {
			skill = learning
			target = scope:upset_priest
			15 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = stewardship_domain_special.1510.c.success

				#Increase survey quality due to thoroughness.
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.1510.c.success
					left_icon = scope:upset_priest

					stewardship_domain_special_1500_increase_quality_effect = yes
				}
			}
			10 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.8
				}
				desc = stewardship_domain_special.1510.c.failure

				#Add the priest's holdings to the exclusion list, and lower the survey quality.
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.1510.c.failure
					left_icon = scope:upset_priest

					custom_tooltip = stewardship_domain_special.1510.b.tt
					stewardship_domain_special_1500_decrease_quality_effect = yes
				}	
			}
		}

		stress_impact = {
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			# Rational characters know when they have a good chance of winning the duel
			compare_modifier = {
				trigger = {
					ai_rationality >= 10
				}
				value = learning
				multiplier = 500
			}
			compare_modifier = {
				trigger = {
					ai_rationality >= 10
					exists = player_heir
				}
				value = player_heir.learning
				multiplier = -500
			}

			ai_value_modifier = {
				ai_zeal = 50
				ai_greed = 100
				ai_boldness = 100
			}
		}
	}

	after = {
		#Decrement our event counter.
		change_variable = {
			name = stewardship_domain_special_1500_remaining_random_events
			subtract = 1
		}
		#Trigger the next event in the chain after a short delay.
		trigger_event = {
			on_action = stewardship_lifestyle_domesday
			days = { 30 45 }
		}
	}
}

##################################
# Domesday Book: Concerned Noble #
##################################

scripted_trigger stewardship_domain_special_1520_objecting_noble = {
	stewardship_domain_special_1500_valid_vassal = yes
	OR = { # Do not select Republican/Theocratic vassals.
		has_government = feudal_government
		has_government = clan_government
		has_government = tribal_government
	}
}

#A noble is concerned about the threat your tax assessors pose to to their privacy.
stewardship_domain_special.1520 = {
	type = letter_event
	opening = {
		desc = stewardship_domain_special.1520.opening
	}
	desc = stewardship_domain_special.1520.desc
	sender = scope:concerned_noble
	
	trigger = {
		#Ensure a valid target exists for this event.
		any_vassal = {
			stewardship_domain_special_1520_objecting_noble = yes
		}
		stewardship_domain_special_1510_allow_random_events = yes

		#Do not allow this random event to fire twice in a row.
		OR = {
			NOT = { has_variable = stewardship_domain_special_1500_last_random_event }
			AND = {
				has_variable = stewardship_domain_special_1500_last_random_event
				NOT = { var:stewardship_domain_special_1500_last_random_event = flag:concerned_noble }
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		random_vassal = {
			limit = {
				stewardship_domain_special_1520_objecting_noble = yes
			}

			weight = {
				base = 50

				#Characters in your realm with a lot of clout are more likely to asset themselves.
				modifier = {
					is_powerful_vassal_of = root
					add = 100
				}
				compare_modifier = {
					value = highest_held_title_tier
					multiplier = 25
				}

				#Intimidated characters are less likely to assert themselves.
				modifier = {
					dread_modified_ai_boldness = {
						dreaded_character = root
						value <= -40
					}
					factor = 0.5
				}

				#Dishonorable characters more likely to have something they want to hide.
				compare_modifier = {
					value = ai_honor
					multiplier = -1
				}
			}

			#Selected character may not participate in another Domesday event for 1 year.
			add_character_flag = {
				flag = stewardship_domain_special_1500_selected_vassal
				days = 365
			}
			save_scope_as = concerned_noble
		}

		#Flag this event as being the last random event to fire.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:concerned_noble
		}
	}

	#Option 1: Exclude the noble's holdings for a large opinion bonus.
	option = {
		name = stewardship_domain_special.1520.a

		#Add the noble's counties to the exclusion list and lower the survey quality.
		custom_tooltip = stewardship_domain_special.1520.a.tt
		stewardship_domain_special_1500_decrease_quality_effect = yes
		scope:concerned_noble = {
			every_sub_realm_county = {
				add_to_list = excluded_counties
			}
		}

		#The noble is grateful that you respected their privacy.
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:concerned_noble
			opinion = 25
		}

		stress_impact = {
			just = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			#Rational AIs are twice as likely to accept this option if the noble is one of their powerful vasssals.
			modifier = {
				ai_rationality >= 10
				scope:concerned_noble = {
					is_powerful_vassal_of = root
				}
				add = 50
			}

			ai_value_modifier = {
				ai_compassion = 200
				ai_greed = -200
			}
		}
	}

	#Option 2: Assert your authority over the noble's holdings and assess them anyway.
	option = {
		name = stewardship_domain_special.1520.b

		#Increase survey quality due to thoroughness.
		stewardship_domain_special_1500_increase_quality_effect = yes

		#Noble is upset you violated their privacy.
		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:concerned_noble
			opinion = -10
		}

		stress_impact = {
			fickle = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = 1
				ai_greed = 1
				ai_compassion = -1
			}
		}

	}
	
	#Option 3: Replace your assessors with spies to see what the noble is hiding.
	option = {
		name = stewardship_domain_special.1520.c

		#Only available if the noble has a secret you do not know about.
		trigger = {
			scope:concerned_noble = {
				any_secret = {
					NOT = { is_known_by = root }
				}
			}
		}

		#By substituting your assessors with spies, you're compromising the quality of the survey.
		stewardship_domain_special_1500_decrease_quality_effect = yes

		#Noble is upset that you're violating their privacy.
		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:concerned_noble
			opinion = -10
		}
		
		#Learn one of the noble's secrets.
		custom_tooltip = stewardship_domain_special.1520.c.tt
		hidden_effect = {
			send_interface_toast = {
				type = event_toast_effect_good
				title = stewardship_domain_special.1520.c.tt
				left_icon =scope:concerned_noble

				scope:concerned_noble = {
					random_secret = {
						limit = {
							NOT = { is_known_by = root }
						}
						reveal_to = root
					}
				}					
			}			
		}
		
		stress_impact = {
			trusting = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = -2
				ai_compassion = -1
				ai_vengefulness = 1
			}
		}
	}

	after = {
		#Decrement our event counter.
		change_variable = {
			name = stewardship_domain_special_1500_remaining_random_events
			subtract = 1
		}
		#Trigger the next event in the chain after a short delay.
		trigger_event = {
			on_action = stewardship_lifestyle_domesday
			days = { 30 45 }
		}
	}
}

#################################
# Domesday Book: Unhappy Guilds #
#################################

scripted_trigger stewardship_domain_special_1530_unhappy_city = {

	#Ensure the province's county is a valid event target.
	title_province = {
		exists = county
		county = {
			stewardship_domain_special_1500_valid_county = yes
			holder = root
		}
		has_building_with_flag = city
	}

	holder = {
		exists = this
		NOT = { this = root}
		has_government = republic_government
		is_available = yes
	}
}

#The guilds in one of your cities are upset at being assessed.
stewardship_domain_special.1530 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = stewardship_domain_special.1530.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = market
	}
	left_portrait = scope:city_mayor

	trigger = {
		# Guilds must exist in this society.
		culture = {
			has_innovation = innovation_guilds
		}

		# Ensure our event target is valid.
		any_sub_realm_barony = {
			stewardship_domain_special_1530_unhappy_city = yes
		}
		stewardship_domain_special_1510_allow_random_events = yes

		# Ensure this event doesn't fire twice in a row.
		OR = {
			NOT = { has_variable = stewardship_domain_special_1500_last_random_event }
			AND = {
				has_variable = stewardship_domain_special_1500_last_random_event
				NOT = { var:stewardship_domain_special_1500_last_random_event = flag:unhappy_guilds }
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Save the city, the county the city is in, and the city's mayor.
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_special_1530_unhappy_city = yes
			}
			save_scope_as = guild_town

			title_province = {
				county = {
					#Prevent this county as appearing again in this event chain for 1 year.
					set_variable = {
						name = stewardship_domain_special_1500_was_event_county
						value = yes
						days = 365
					}
					save_scope_as = guild_county
				}
			}
			holder = {
				save_scope_as = city_mayor
			}
		}

		#Flag this event as being the last random event to occur.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:unhappy_guilds
		}
	}

	#Option 1: Assess the guilds, increasing quality but making them angry.
	option = {
		name = stewardship_domain_special.1530.a

		#Quality increased due to thoroughness.
		stewardship_domain_special_1500_increase_quality_effect = yes

		#Guilds are unhappy about being assessed and will slow down construction.
		scope:guild_county = {
			add_county_modifier = {
				modifier = stewardship_domain_special_1500_resentful_guilds
				days = 1825
			}
		}


		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_greed = 200
				ai_rationality = 50
				ai_compassion = -100
			}
		}
	}

	#Option 2: Exclude the guilds, decreasing quality but gaining discounted buildings.
	option = {
		name = stewardship_domain_special.1530.b

		#Exclude this county from the survey and lower it's quality.
		stewardship_domain_special_1500_decrease_quality_effect = yes
		scope:guild_county = {
			add_to_list = excluded_counties

			#Add a modifier to the county which gives it cheaper and faster construction for 5 years.
			add_county_modifier = {
				modifier = stewardship_domain_special_1500_guild_services
				days = 1825
			}
		}

		stress_impact = {
			stubborn = minor_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = 100
				ai_rationality = -50
				ai_vengefulness = -100
			}
		}
	}
	
	#Option 3: Disband the guilds to increasing county control.
	option = {
		name = stewardship_domain_special.1530.c

		#No quality change here, just improved control.
		scope:guild_county = {
			change_county_control = 20
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			forgiving = medium_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = -100
				ai_greed = 100
				ai_vengefulness = 200
			}
		}

	}

	after = {
		#Decrement our event counter.
		change_variable = {
			name = stewardship_domain_special_1500_remaining_random_events
			subtract = 1
		}
		#Trigger the next event in the chain after a short delay.
		trigger_event = {
			on_action = stewardship_lifestyle_domesday
			days = { 30 45 }
		}
	}
}

##########################
# Domesday Book: Bandits #
##########################

#Bandits attack the assessors in one of your low-control counties.
stewardship_domain_special.1540 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = {
		#Variant A: Assessors were unprotected, bandits succeeded.
		triggered_desc = {
			trigger = { var:stewardship_domain_special_1500_domesday_assessors_protected = no }
			desc = stewardship_domain_special.1540.desc.a
		}
		#Variant B: Assessors were protected, bandits were defeated.
		triggered_desc = {
			trigger = { var:stewardship_domain_special_1500_domesday_assessors_protected = yes }
			desc = stewardship_domain_special.1540.desc.b
		}
	}
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = army_camp
	}
	left_portrait = root
	
	trigger = {
		#Event simply can't occur if all of your counties are above 70 control.
		any_sub_realm_county = {
			county_control <= 70
			stewardship_domain_special_1500_valid_county = yes
		}
		stewardship_domain_special_1510_allow_random_events = yes

		#Ensure event will not occur twice in a row.
		OR = {
			NOT = { has_variable = stewardship_domain_special_1500_last_random_event }
			AND = {
				has_variable = stewardship_domain_special_1500_last_random_event
				NOT = { var:stewardship_domain_special_1500_last_random_event = flag:bandits }
			}
		}
	}

	weight_multiplier = {
		base = 0.25

		#Increasingly more likely to occur the lower control you have in a county.
		modifier = {
			any_sub_realm_county = {
				county_control <= 50
			}
			add = 0.50 #0.75
		}
		modifier = {
			any_sub_realm_county = {
				county_control <= 30
			}
			add = 0.75 #1.50
		}
		modifier = {
			any_sub_realm_county = {
				county_control <= 10
			}
			add = 1.00 #2.50
		}
	}

	immediate = {
		random_sub_realm_county = {
			limit = {
				#Ensure the county picked meets all requirements.
				county_control <= 70
				stewardship_domain_special_1500_valid_county = yes
			}

			#More likely to occur in a county with lower authority.
			weight = {
				base = 100
				compare_modifier = {
					value = county_control
					multiplier = -1.4 # 2% weight at 70 authority. 100% weight at 0 authority.
				}
			}

			#Prevent this county from appearing again in this event chain for 1 year.
			set_variable = {
				name = stewardship_domain_special_1500_was_event_county
				value = yes
				days = 365
			}

			save_scope_as = domesday_robbed_county
		}

		#Flag this event as the last random event to occur.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:bandits
		}
	}

	#Option A-1: Exclude this county from the survey, lowering quality level and suffering a significant prestige hit.
	option = {
		name = stewardship_domain_special.1540.a

		#Only available if assessors were unprotected.
		trigger = {
			var:stewardship_domain_special_1500_domesday_assessors_protected = no
		}

		#Exclude this county from the survey and lower it's quality.
		scope:domesday_robbed_county = {
			add_to_list = excluded_counties
		}
		stewardship_domain_special_1500_decrease_quality_effect = yes

		#Lose prestige due to your weakness/inability to protect assessors.
		add_prestige = medium_prestige_loss

		stress_impact = {
			just = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
			brave = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = -100
				ai_boldness = -100
			}
		}
	}

	#Option A-2: Send out additional assessors, and guard them this time.
	option = {
		name = stewardship_domain_special.1540.b

		#Only available if assessors were unprotected.
		trigger = {
			var:stewardship_domain_special_1500_domesday_assessors_protected = no
		}

		#Pay gold for soldiers, plus lose some prestige for letting your assessors die in the first place.
		remove_short_term_gold = minor_gold_value
		add_prestige = minor_prestige_loss

		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = 100
				ai_greed = -50
				ai_rationality = -50
				ai_compassion = -100
			}
		}
	}
	
	#Option B: Gain bonus authority in the province due to defeating the bandits.
	option = {
		name = stewardship_domain_special.1540.c

		#Only available if assessors were protected.
		trigger = {
			var:stewardship_domain_special_1500_domesday_assessors_protected = yes
		}

		#Add authority to the province.
		scope:domesday_robbed_county = {
			change_county_control = 20
		}
	}

	after = {
		#Decrement our event counter.
		change_variable = {
			name = stewardship_domain_special_1500_remaining_random_events
			subtract = 1
		}
		#Trigger the next event in the chain after a short delay.
		trigger_event = {
			on_action = stewardship_lifestyle_domesday
			days = { 30 45 }
		}
	}
}

##################################
# Domesday Book: Corrupt Steward #
##################################

#Steward who proposed the idea has been lining his pockets with bribes!
stewardship_domain_special.1550 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = stewardship_domain_special.1550.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:domesday_steward
	
	trigger = {
		#The steward who proposed the idea must still exist.
		exists = scope:domesday_steward

		scope:domesday_steward = {
			# The steward must still be your steward
			is_councillor_of = root
			is_ai = yes

			#The steward must be greedy and dishonorable to succumb to corruption.
			ai_greed >= medium_positive_greed
			ai_honor <= low_negative_honor

			#Steward must not have already been caught taking bribes.
			NOT = {has_character_flag = stewardship_domain_special_1500_selected_vassal}

			#Don't fire this event immediately after starting the event chain.
			trigger_if = {
				limit = {
					has_variable = last_stewardship_domain_special_event
				}
				NOT = { var:last_stewardship_domain_special_event = flag:domesday_book }
				NOT = { var:last_stewardship_domain_special_event = flag:corrupt_steward }
			}
		}
		stewardship_domain_special_1510_allow_random_events = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Flag this event as the last random event to occur.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:corrupt_steward
		}

		#Steward may not particpate in this event chain again.
		scope:domesday_steward = {
			add_character_flag = {
				flag = stewardship_domain_special_1500_selected_vassal
				days = 365
			}
		}
	}

	#Option A: Cancel the survey project, and demand the steward refund you for the costs.
	option = {
		name = stewardship_domain_special.1550.a

		#Refund the player for whatever they paid for the survey.
		scope:domesday_steward = {
			#Since we can't depend on the steward having this much money on-hand, we secretly give them the balance owed.
			hidden_effect = {
				add_gold = scope:domesday_gold_paid
			}
			#Afterwards, we make the steward pay the player with the money they just received.
			pay_short_term_gold = {
				gold = scope:domesday_gold_paid
				target = root
			}
			#Functionally the steward doesn't loses money, but to a player it appears that they do, creating a sense of justice served.
		}

		#Steward loses prestige for taking bribes
		scope:domesday_steward = {
			add_prestige = medium_prestige_loss
		}

		#Cancel the survey project. Character forfeits the opportunity to rank-up.
		set_variable = {
			name = stewardship_domain_special_1500_domesday_is_active
			value = no
		}

		stress_impact = {
			stubborn = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_greed = 300
				ai_energy = -100
			}
		}
	}

	#Option B: Make the steward use the bribes to re-assess all compromised holdings.
	option = {
		name = stewardship_domain_special.1550.b

		#Steward loses prestige for taking bribes.
		scope:domesday_steward = {
			add_prestige = medium_prestige_loss
		}

		#Quality increases due to thoroughness.
		stewardship_domain_special_1500_increase_quality_effect = yes

		stress_impact = {
			greedy = minor_stress_impact_gain
			just = minor_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = -100
				ai_compassion = 50
				ai_vengefulness = -100
			}
		}
	}
	
	#Option C: Imprison the steward for betraying you
	option = {
		name = stewardship_domain_special.1550.c

		#Steward loses prestige for taking bribes.
		scope:domesday_steward = {
			add_prestige = medium_prestige_loss
		}

		#Steward is imprisoned.
		imprison = {
			target = scope:domesday_steward
			type = house_arrest
		}

		custom_tooltip = stewardship_domain_special.1590.poor_quality.d.tt

		stress_impact = {
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_vengefulness = 200
				ai_rationality = 50
				ai_honor = 50
			}
		}
	}

	after = {
		if = {
			#If we haven't elected to cancel the survey, continue with the event chain.
			limit = {
				var:stewardship_domain_special_1500_domesday_is_active = yes
			}
	
			#Decrement our event counter.
			change_variable = {
				name = stewardship_domain_special_1500_remaining_random_events
				subtract = 1
			}
			#Trigger the next event in the chain after a short delay.
			trigger_event = {
				on_action = stewardship_lifestyle_domesday
				days = { 30 45 }
			}
		}
		else = {
			#Otherwise, run event cleanup.
			stewardship_domain_special_1500_domesday_cleanup = yes
		}
	}
}

##################################
# Domesday Book: Upset Merchants #
##################################

scripted_trigger stewardship_domain_special_1560_upset_merchants = {

	#Ensure the province's county is a valid event target.
	title_province = {
		exists = county
		county = {
			stewardship_domain_special_1500_valid_county = yes
			holder = root
		}
		has_building_with_flag = city
	}

	holder = {
		exists = this
		NOT = { this = root}
		has_government = republic_government
		is_available = yes
	}
}

#Traveling merchants are upset at having their property assessed.
stewardship_domain_special.1560 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = stewardship_domain_special.1560.desc
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = market
	}

	left_portrait = scope:city_mayor
	
	trigger = {
		#Has a city province that is owned by vassal mayor.
		any_sub_realm_barony = {
			stewardship_domain_special_1560_upset_merchants = yes
		}
		stewardship_domain_special_1510_allow_random_events = yes

		#Ensure this event does not fire twice in a row.
		OR = {
			NOT = { has_variable = stewardship_domain_special_1500_last_random_event }
			AND = {
				has_variable = stewardship_domain_special_1500_last_random_event
				NOT = { var:stewardship_domain_special_1500_last_random_event = flag:upset_merchants }
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		#Save the city, the county the city is in, and the city's mayor.
		random_sub_realm_barony = {
			limit = {
				stewardship_domain_special_1560_upset_merchants = yes
			}
			save_scope_as = trade_city
			title_province = {
				county = {
					#Flag this county as having appeared in a random event.
					set_variable = {
						name = stewardship_domain_special_1500_was_event_county
						value = yes
						days = 365
					}

					save_scope_as = trade_county
				}
			}
			holder = {
				save_scope_as = city_mayor
			}
		}
		#Flag this event as being the last random event to occur.
		set_variable = {
			name = stewardship_domain_special_1500_last_random_event
			value = flag:upset_merchants
		}
	}

	#Option A: Survey everyone in my realm, resident or no!
	option = {
		name = stewardship_domain_special.1560.a

		#Increase quality due to thoroughness.
		stewardship_domain_special_1500_increase_quality_effect = yes

		#Apply a modifier which reduces trade in the county.
		scope:trade_county = {
			add_county_modifier = {
				modifier = stewardship_domain_special_1500_avoided_by_merchants
				days = 1825
			}
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = 100
				ai_greed = 100
				ai_compassion = -100
			}
		}
	}

	#Option B: Exclude all travelers in my realm from assessment.
	option = {
		name = stewardship_domain_special.1560.c

		#Lower the quality of the survey.
		stewardship_domain_special_1500_decrease_quality_effect = yes

		#Encourage travel to this county.
		scope:trade_county = {
			add_county_modifier = {
				modifier = stewardship_domain_special_1500_encouraged_travellers
				days = 1825
			}
		}

		stress_impact = {
			stubborn = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = 200
			}
		}
	}

	#Option C: Exclude the merchants, for a fee...
	option = {
		name = stewardship_domain_special.1560.b

		#Lower the quality of the survey (county isn't excluded, because this is just the merchants).
		stewardship_domain_special_1500_decrease_quality_effect = yes

		#Give the character gold from the merchants.
		add_gold = medium_gold_value

		stress_impact = {
			generous = minor_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_honor = -200
				ai_greed = 500
			}
		}

	}

	after = {
		#Decrement our event counter.
		change_variable = {
			name = stewardship_domain_special_1500_remaining_random_events
			subtract = 1
		}
		#Trigger the next event in the chain after a short delay.
		trigger_event = {
			on_action = stewardship_lifestyle_domesday
			days = { 30 45 }
		}
	}
}

###############################
# Domesday Book: Final Result #
###############################

#Receive the completed survey results. Results
stewardship_domain_special.1590 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					stewardship_domain_special_1500_domesday_true_name = yes
				}
				desc = stewardship_domain_special.1500.t.b
			}
			desc = stewardship_domain_special.1500.t.a
		}
	}
	desc = {
		desc = stewardship_domain_special.1590.desc.start
		first_valid = {
			#If no counties were included in the survey, receive special description text.
			triggered_desc = {
				trigger = {
					NOT = {
						any_in_list = {
							list = non_excluded_counties

							exists = this
						}
					}
				}
				desc = stewardship_domain_special.1590.none.desc
			}
			#Otherwise, description text depends on quality level of the survey.
			triggered_desc = {
				trigger = {
					var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_perfect_quality
					NOT = { has_trait = lazy }
				}
				desc = stewardship_domain_special.1590.perfect.desc
			}
			triggered_desc = {
				trigger = {
					var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_excellent_quality
				}
				desc = stewardship_domain_special.1590.excellent.desc
			}
			triggered_desc = {
				trigger = {
					var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_high_quality
				}
				desc = stewardship_domain_special.1590.good.desc
			}
			triggered_desc = {
				trigger = {
					var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_mediocre_quality
				}
				desc = stewardship_domain_special.1590.mediocre.desc
			}
			desc = stewardship_domain_special.1590.poor.desc
		}
		first_valid = {
			#Final description line depends on the quality of the survey and whether or not you still have a steward.
			triggered_desc = {
				trigger = {
					NOT = { exists = scope:domesday_final_steward }
				}
				desc = stewardship_domain_special.1590.no_steward.desc
			}
			triggered_desc = {
				trigger = {
					var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_high_quality
				}
				desc = stewardship_domain_special.1590.high_quality.desc
			}
			desc = stewardship_domain_special.1590.low_quality.desc
		}
	}
	
	theme = stewardship_domain_focus
	override_background = {
		event_background = wilderness # Based on your capital county
	}
	left_portrait = scope:domesday_final_steward
	
	immediate = {
		#Calculate which counties have been successfully surveyed.
		every_sub_realm_county = {
			if = {
				limit = {
					save_temporary_scope_as = this_county
					NOT = {
						any_in_list = {
							list = excluded_counties

							this = scope:this_county
						}
					}
				}
				add_to_list = non_excluded_counties
			}
		}

		#If we have managed to exclude all provinces from the survey, we suffer a drastic loss in quality.
		if = {
			limit = {
				NOT = {
					any_in_list = {
						list = non_excluded_counties

						exists = this
					}
				}
			}
			change_variable = {
				name = stewardship_domain_special_1500_domesday_quality
				subtract = 20
			}
		}

		#Next we check if we still have a steward to manage the compination.
		if = { #If we still have a steward, save their scope for loc and effect applications.
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = domesday_final_steward
			}
		}
		else = { #If we have no current steward to manage the compilation, we also suffer a drastic loss in quality.
			change_variable = {
				name = stewardship_domain_special_1500_domesday_quality
				subtract = 10
			}
		}

		#If the survey is at least usable, apply the mediocre quality assessment to all our counties.
		if = {
			limit = {
				var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_mediocre_quality
			}
			stewardship_domain_special_1500_apply_domesday_effects = yes
		}

	}

	########################
	# High quality options #
	########################

	#Selfishly keep the records for yourself.
	option = {
		name = stewardship_domain_special.1590.high_quality.a
		trigger = {
			var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_high_quality
		}

		add_stewardship_lifestyle_perk_points = 1

		if = {
			limit = {
				var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_perfect_quality
				NOT = { has_trait = lazy }
			}
			set_nickname_effect = { NICKNAME = nick_the_meticulous }
			add_prestige = medium_prestige_gain
		}

		#Gain +1 Stewardship and +1 Ingrigue for 5 years.
		add_character_modifier = {
			modifier = stewardship_domain_special_1500_hoarding_assessment_records
			days = 1825
		}

		stress_impact = {
			generous = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_greed = 200
				ai_compassion = -100
			}
		}
	}

	#Generously distribute the records to the populace.
	option = {
		name = stewardship_domain_special.1590.high_quality.b
		trigger = {
			var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_high_quality
		}

		add_stewardship_lifestyle_perk_points = 1

		if = {
			limit = {
				var:stewardship_domain_special_1500_domesday_quality >= stewardship_domain_special_1500_domesday_perfect_quality
				NOT = { has_trait = lazy }
			}
			set_nickname_effect = { NICKNAME = nick_the_meticulous }
			add_prestige = medium_prestige_gain
		}

		if = {
			limit = {
				any_in_list = {
					list = excluded_counties
					exists = this
				}
			}
			every_in_list = {
				list = non_excluded_counties
				custom = stewardship_domain_special.1590.every_nonexcluded_county

				add_county_modifier = {
					modifier = stewardship_domain_special_1500_distributed_assessment_records
					days = 1825
				}
			}
		}
		else = {
			every_in_list = {
				list = non_excluded_counties
				custom = stewardship_domain_special.1590.every_county

				add_county_modifier = {
					modifier = stewardship_domain_special_1500_distributed_assessment_records
					days = 1825
				}
			}
		}

		#If you publicize the results of the survey...
		if = {
			limit = {
				exists = scope:domesday_final_steward
			}
			scope:domesday_final_steward = {
				#Steward gains a prestige bonus for doing such a great job.
				add_prestige = medium_prestige_gain
				#Steward is happy you made their accomplishment public.
				add_opinion = {
					modifier = pleased_opinion
					target = root
					opinion = 20
				}
			}
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_greed = -100
				ai_compassion = 200
			}
		}
	}

	########################
	# Poor quality options #
	########################

	#Share the blame with your steward.
	option = {
		name = stewardship_domain_special.1590.poor_quality.a
		trigger = {
			var:stewardship_domain_special_1500_domesday_quality < stewardship_domain_special_1500_domesday_high_quality
		}

		#Both you and your steward lose prestige.
		if = {
			limit = {
				exists = scope:domesday_final_steward
			}
			scope:domesday_final_steward = {
				if = {
					#Do not apply penalties if the steward is a player.
					limit = {
						is_ai = yes
					}
					add_prestige = minor_prestige_loss
				}
			}
		}
		add_prestige = minor_prestige_loss

		stress_impact = {
			vengeful = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = 2
				ai_vengefulness = -2
			}
		}
	}

	#Pin all the blame on your steward and fire them.
	option = {
		name = stewardship_domain_special.1590.poor_quality.b
		trigger = {
			exists = scope:domesday_final_steward
			var:stewardship_domain_special_1500_domesday_quality < stewardship_domain_special_1500_domesday_high_quality
		}

		#Your steward loses extra prestige and is mad at you for blaming them.
		scope:domesday_final_steward = {
			#Fire your steward in a more tooltip-friendly way.
			custom_tooltip = stewardship_domain_special.1590.poor_quality.d.tt
			hidden_effect = {
				if = {
					limit = {
						scope:domesday_final_steward = { is_councillor_of = root }
					}
					root = {
						fire_councillor = scope:domesday_final_steward
					}
				}
			}
			# Additional prestige/opiion penalties.
			if = {
				#Do not apply penalties if the steward is a player.
				limit = {
					is_ai = yes
				}

				# Prestige hit and opinion effects for being fired.
				add_prestige = medium_prestige_loss
			}
			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -20
			}
		}

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_vengefulness = 2
				ai_compassion = -2
			}
		}
	}
	
	 #Pin all the blame on your steward and execute them.
	option = {
		name = stewardship_domain_special.1590.poor_quality.c
		trigger = {
			var:stewardship_domain_special_1500_domesday_quality < stewardship_domain_special_1500_domesday_high_quality

			exists = scope:domesday_final_steward
			#Disallow if the steward is a player.
			scope:domesday_final_steward = {
				is_ai = yes
			}
		}

		#Execute your steward, with all of the normal bonuses and penalties that execution entails.
		execute_prisoner_effect = {
			VICTIM = scope:domesday_final_steward
			EXECUTIONER = root
		}

		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = -2
				ai_rationality = -2
				ai_vengefulness = 4
			}
		}
	}

	######################
	# Stewardless option #
	######################

	#Bemoan the fact that you have no steward.
	option = {
		name = stewardship_domain_special.1590.poor_quality.a
		trigger = {
			NOT = { exists = scope:domesday_final_steward }
		}
		exclusive = yes

		add_prestige = minor_prestige_loss
	}

	#################
	# Debug Options #
	#################

	#These options are only to be enabled for testing exlcusion mechanics.
	option = {
		trigger = {
			always = no
		}
		name = "DEBUG: Excluded County List"

		#Adds 20 authority to every county in the exclusion list.
		every_in_list = {
			list = excluded_counties

			change_county_control = 20
		}
	}

	option = {
		trigger = {
			always = no
		}
		name = "DEBUG: Non-Excluded County List"

		#Adds 20 authority to every county which has not been added to the exclusion list.
		every_in_list = {
			list = non_excluded_counties

			change_county_control = 20
		}
	}

	after = {
		#Remove all flags and variables we no longer need.
		stewardship_domain_special_1500_domesday_cleanup = yes
	}
}

### END OF DOMESDAY CHAIN ###


###########################
# Visit Displeased County
#
# by Stephen Arthur
###########################

scripted_trigger stewardship_domain_special_3010_baron_trigger = {
	NOT = { this = root}
	is_available_ai_adult = yes
	highest_held_title_tier = tier_barony
}

scripted_trigger stewardship_domain_special_3010_county_trigger = {
	county_holder_opinion < 0
	NOR = {
		this = root.capital_county
		has_county_modifier = county_increased_opinion_modifier
	}

	any_in_de_jure_hierarchy = {
		tier = tier_barony
		exists = holder
		holder = {
			stewardship_domain_special_3010_baron_trigger = yes
		}
	}
}

stewardship_domain_special.3010 = {
	type = character_event
	title = stewardship_domain_special.3010.t
	desc = stewardship_domain_special.3010.desc
	theme = stewardship_domain_focus
	left_portrait = root

	trigger = {
		is_at_war = no
		is_landed = yes
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_3010_this_lifetime }
		any_held_title = {
			tier = tier_county
			stewardship_domain_special_3010_county_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 100
		}	
		add_character_flag = had_stewardship_domain_special_3010_this_lifetime

		random_held_title = {
			limit = {
				tier = tier_county
				stewardship_domain_special_3010_county_trigger =yes
			}
			save_scope_as = stewardship_domain_special_3010_county
			random_in_de_jure_hierarchy = {
				limit = {
					holder = {
						stewardship_domain_special_3010_baron_trigger = yes
					}
				}
				holder = {
					save_scope_as = stewardship_domain_special_3010_baron
				}
			}
		}	
	}

	# Visit displeased county
	option = {
		name = stewardship_domain_special.3010.a
		custom_tooltip = stewardship_lifestyle_rank_up_indication		

		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 100
		}		
		trigger_event = {
			id = stewardship_domain_special.3012
		}	
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
				ai_boldness = 0.5
				ai_rationality = 0.25
			}
		}			
	}

	# Do not visit displeased county
	option = {
		name = stewardship_domain_special.3010.b
		add_prestige = miniscule_prestige_gain
	}
}

# Visiting the Displeased County

stewardship_domain_special.3012 = {
	type = character_event
	title = stewardship_domain_special.3012.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3010_baron
				}
				desc = stewardship_domain_special.3012.desc.a
			}
			desc = stewardship_domain_special.3012.desc.b
		}
	}
	
	theme = stewardship_domain_focus
	left_portrait = scope:stewardship_domain_special_3010_baron		

	# Appeal to the People
	option = {
		name = stewardship_domain_special.3012.b
		stress_impact = {
			shy = minor_stress_impact_gain
		}		
		duel = {
			skill = diplomacy
			value = medium_skill_rating
			20 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
					min = -19
				}
				desc = stewardship_domain_special.3012.b.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.3012.b.success
					left_icon = root

					add_prestige = medium_prestige_gain
					scope:stewardship_domain_special_3010_county = {
						add_county_modifier = {
							modifier = county_increased_opinion_modifier
							years = 10
						}
					}
				}
				hidden_effect = {
					save_scope_value_as = {
						name = stewardship_domain_special_3012_popular_appeal_success
						value = yes
					}								
				}
				trigger_event = {
					id = stewardship_domain_special.3014
				}					
			}
			5 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -4
				}
				desc = stewardship_domain_special.3012.b.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.3012.b.failure
					left_icon = root

					add_prestige = minor_prestige_loss
					stress_impact = {
						arrogant = minor_stress_impact_gain
					}
				}

				hidden_effect = {			
					random_list = {
						50 = {
							save_scope_value_as = {
								name = stewardship_domain_special_3012_popular_appeal_fail_learn_success
								value = yes
							}
						}
						50 = {
							save_scope_value_as = {
								name = stewardship_domain_special_3012_popular_appeal_fail_learn_fail
								value = yes
							}
						}						
					}
				}
				trigger_event = {
					id = stewardship_domain_special.3014
				}					
			}
		}	

		stress_impact = {
			shy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
				ai_boldness = 0.5
				ai_rationality = 0.25
			}
		}		
	}

	# Intimidate
	option = {
		name = stewardship_domain_special.3012.c
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}			
		
		scope:stewardship_domain_special_3010_county = {
			change_development_progress_with_overflow = -75
			add_county_modifier = {
				modifier = county_increased_opinion_modifier
				years = 10
			}
		}
		add_dread = minor_dread_gain

		hidden_effect = {				
			save_scope_value_as = {
				name = stewardship_domain_special_3012_intimidate_success
				value = yes
			}	
		}

		stress_impact = {
			compassionate = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			humble = medium_stress_impact_gain
			calm = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}

		trigger_event = {
			id = stewardship_domain_special.3014
		}						
	
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}			
	}	

	# Throw Some Gold Around
	option = {
		name = stewardship_domain_special.3012.a
		remove_short_term_gold = medium_gold_value
		hidden_effect = {
			save_scope_value_as = {
				name = stewardship_domain_special_3012_spent_gold
				value = yes
			}	
		}
		scope:stewardship_domain_special_3010_county = {
			add_county_modifier = {
				modifier = county_increased_opinion_modifier
				years = 10
			}
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		trigger_event = {
			id = stewardship_domain_special.3014
		}					
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = -0.5
			}
		}			
	}	

}

stewardship_domain_special.3014 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						exists = scope:stewardship_domain_special_3012_spent_gold
						exists = scope:stewardship_domain_special_3012_popular_appeal_success
						exists = scope:stewardship_domain_special_3012_intimidate_success
					}
				}
				desc = stewardship_domain_special.3014.t.a
			}
			desc = stewardship_domain_special.3014.t.b
		}
	}		
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3012_spent_gold
				}
				desc = stewardship_domain_special.3014.spent_gold.desc
			}
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3012_popular_appeal_fail_learn_success
				}
				desc = stewardship_domain_special.3014.popular_appeal_fail_learn_success.desc
			}
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3012_popular_appeal_success
				}
				desc = stewardship_domain_special.3014.popular_appeal_success.desc
			}
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3012_intimidate_success
				}
				desc = stewardship_domain_special.3014.intimidate_success.desc
			}			
			triggered_desc = {
				trigger = {
					exists = scope:stewardship_domain_special_3012_popular_appeal_fail_learn_fail
				}
				desc = stewardship_domain_special.3014.popular_appeal_fail_learn_fail.desc
			}												
		}
	}
	theme = stewardship_domain_focus
	left_portrait = root

	# gold success
	option = {
		trigger = {
			exists = scope:stewardship_domain_special_3012_spent_gold
		}
		name = stewardship_domain_special.3014.a
		
		add_stewardship_lifestyle_xp = major_lifestyle_xp
	}

	# diplomacy fail but learn
	option = {
		name = stewardship_domain_special.3014.b
		trigger = {
			exists = scope:stewardship_domain_special_3012_popular_appeal_fail_learn_success
		}	
		add_stewardship_lifestyle_xp = major_lifestyle_xp
	}

	# diplomacy success
	option = {
		name = stewardship_domain_special.3014.c
		trigger = {
			exists = scope:stewardship_domain_special_3012_popular_appeal_success
		}			
		add_stewardship_lifestyle_perk_points = 1
	}

	# dread success
	option = {
		name = stewardship_domain_special.3014.e
		trigger = {
			exists = scope:stewardship_domain_special_3012_intimidate_success
		}
		add_stewardship_lifestyle_xp = major_lifestyle_xp	
	}

	# diplomacy fail and learn nothing
	option = {
		name = stewardship_domain_special.3014.f
		trigger = {
			exists = scope:stewardship_domain_special_3012_popular_appeal_fail_learn_fail
		}		
		custom_tooltip = stewardship_domain_special.3014.f.tt
	}

	after = {
		hidden_effect = {
			remove_character_flag = is_in_stewardship_domain_special_event
		}
	}	
}


#########################
# The Irrigation Project
# 8001-8099
# by Petter Vilberg
#########################

scripted_trigger stewardship_domain_special_8001_county_trigger = {
	holder = root
	NOR = {
		has_county_modifier = governance_aqueduct_modifier
		has_county_modifier = governance_small_aqueduct_modifier
		has_county_modifier = governance_irrigation_modifier
		has_county_modifier = governance_small_irrigation_modifier
	}
}

stewardship_domain_special.8001 = {
	type = character_event
	title = stewardship_domain_special.8001.t
	desc = stewardship_domain_special.8001.desc
	
	left_portrait = cp:councillor_steward
	theme = stewardship_domain_focus
	
	trigger = {
		has_focus = stewardship_domain_focus
		NOT = { has_character_flag = is_in_stewardship_domain_special_event }
		NOT = { has_character_flag = had_stewardship_domain_special_8001_this_lifetime }

		is_landed = yes
		any_sub_realm_county = {
			stewardship_domain_special_8001_county_trigger = yes
		}
		exists = cp:councillor_steward
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {

		cp:councillor_steward = { save_scope_as = steward }
		# Standard special event effects
		add_character_flag = {
			flag = is_in_stewardship_domain_special_event
			days = 730
		}
		add_character_flag = had_stewardship_domain_special_8001_this_lifetime

		# Save our scope
		random_sub_realm_county = {
			limit = {
				stewardship_domain_special_8001_county_trigger = yes
			}
			save_scope_as = county
		}
	}

	option = { #Build an aqueduct!
		name = stewardship_domain_special.8001.a
		remove_short_term_gold = medium_gold_value
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		custom_tooltip = stewardship_domain_special.8001.if_successful
		show_as_tooltip = {
			scope:county = {
				add_county_modifier = {
					modifier = governance_aqueduct_modifier
					days = 7300
				}
			}
		}
		save_scope_value_as = {
			name = project_type
			value = flag:aqueduct
		}
		trigger_event = {
			id = stewardship_domain_special.8011
			days = { 18 30 }
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Irrigation ditches
		name = stewardship_domain_special.8001.b
		custom_tooltip = stewardship_lifestyle_rank_up_indication
		custom_tooltip = stewardship_domain_special.8001.if_successful
		show_as_tooltip = {
			scope:county = {
				add_county_modifier = {
					modifier = governance_irrigation_modifier
					days = 7300
				}
			}
		}
		save_scope_value_as = {
			name = project_type
			value = flag:irrigation_ditches
		}
		trigger_event = {
			id = stewardship_domain_special.8021
			days = { 18 30 }
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { #No thanks
		name = stewardship_domain_special.8001.c

		remove_character_flag = is_in_stewardship_domain_special_event
		ai_chance = {
			base = 0
		}
	}
}


####
# AQUEDUCT CHAIN
# 8010
####

#Architect "assistant" is running over budget
stewardship_domain_special.8011 = {
	type = character_event
	title = stewardship_domain_special.8011.t
	desc = stewardship_domain_special.8011.desc
	
	theme = stewardship_domain_focus
	left_portrait = cp:councillor_steward

	immediate = {
		cp:councillor_steward = { save_scope_as = steward }
	}

	option = { #Replace the useless cur
		name = stewardship_domain_special.8011.a
		flavor = stewardship_domain_special.8011.a.tt
		add_prestige = minor_prestige_loss
		duel = {
			skill = stewardship
			value = 15
			desc = outcome_in_a_few_months
			10 = { #Straight to conclusion 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
					right_icon = cp:councillor_steward

					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			20 = { #Replacement also runs over budget 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				desc = stewardship_domain_special.8001.continued_problems
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.8001.continued_problems
					left_icon = scope:county
					right_icon = cp:councillor_steward

					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8012
					days = { 60 90 }
				}
			}
			10 = { #Troubled Construction
				desc = stewardship_domain_special.8001.troubled_construction
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.8001.troubled_construction
					left_icon = scope:county
					right_icon = cp:councillor_steward
 					
 					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8013
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_greed = 1
			}
			modifier = {
				add = 100
				short_term_gold < medium_gold_value
			}
		}
	}

	option = { #Pay what is needed
		name = stewardship_domain_special.8011.b
		remove_short_term_gold = medium_gold_value
		duel = {
			skill = stewardship
			value = high_skill_rating
			desc = outcome_in_a_few_months
			10 = { #Straight to conclusion 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
					right_icon = cp:councillor_steward

					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			25 = { #Troubled Construction 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				desc = stewardship_domain_special.8001.troubled_construction
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.8001.troubled_construction
					left_icon = scope:county
					right_icon = cp:councillor_steward
	
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8013
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -100
				NOT = {
					short_term_gold > medium_gold_value
				}
			}
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}
}


#Replacement also runs over budget
stewardship_domain_special.8012 = {
	type = character_event
	title = stewardship_domain_special.8012.t
	desc = stewardship_domain_special.8012.desc
	
	theme = stewardship_domain_focus
	left_portrait = cp:councillor_steward

	option = { #Fine, pay the cost
		name = stewardship_domain_special.8012.a
		flavor = stewardship_domain_special.8012.a.tt
		remove_short_term_gold = medium_gold_value
		custom_tooltip = stewardship_domain_special.8001.project_completed
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Levy troops for corvée
		name = stewardship_domain_special.8012.b
		add_character_modifier = {
			modifier = governance_levied_peasants_for_construction_modifier
			days = 1825
		}
		custom_tooltip = stewardship_domain_special.8001.project_completed
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
		}
	}
}


#Troubled construction
stewardship_domain_special.8013 = {
	type = character_event
	title = stewardship_domain_special.8013.t
	desc = stewardship_domain_special.8013.desc
	
	theme = stewardship_domain_focus
	left_portrait = cp:councillor_steward

	option = { #I will manage matters more closely
		name = stewardship_domain_special.8013.a
		stress_impact = {
			base = medium_stress_gain
		}
		duel = {
			skill = stewardship
			value = 10
			desc = outcome_in_a_few_months
			21 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			7 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				desc = stewardship_domain_special.8001.slow_progress
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = stewardship_domain_special.8001.slow_progress
					left_icon = scope:county
					
						custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8023
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			lazy = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
			}
		}
	}

	option = { #Conscript more peasants!
		name = stewardship_domain_special.8013.b
		add_character_modifier = {
			modifier = governance_levied_peasants_for_construction_modifier
			days = 1825
		}
		random_list = {
			desc = outcome_in_a_few_months
			70 = {
				desc = stewardship_domain_special.8001.progress_is_made
				custom_tooltip = stewardship_domain_special.8001.project_completed
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			30 = {
				desc = stewardship_domain_special.8001.high_death_count
				custom_tooltip = stewardship_domain_special.8001.project_continues
				trigger_event = {
					id = stewardship_domain_special.8022
					days = { 60 90 }
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}
}



######
# IRRIGATION PROJECT PATH
# 8020
######

stewardship_domain_special.8021 = {
	type = character_event
	title = stewardship_domain_special.8021.t
	desc = stewardship_domain_special.8021.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward

	immediate = {
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
	}

	option = { #Work the peasants twice as hard
		name = stewardship_domain_special.8021.a
		scope:county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 15
			}
		}
		random_list = {
			desc = outcome_in_a_few_months
			20 = { #Jump straight to conclusion
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
								
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			80 = { #High death count
				desc = stewardship_domain_special.8001.high_death_count
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.8001.high_death_count
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8022
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			patient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Take your time
		name = stewardship_domain_special.8021.b
		duel = {
			skill = stewardship
			value = high_skill_rating
			desc = outcome_in_a_few_years
			12 = { #Straight to conclusion 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 365 720 }
				}
			}
			30 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				desc = stewardship_domain_special.8001.slow_progress
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = stewardship_domain_special.8001.slow_progress
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8023
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			impatient = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #There are always corners to cut!
		name = stewardship_domain_special.8021.c
		scope:county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 10
			}
		}
		duel = {
			skill = stewardship
			value = high_skill_rating
			desc = outcome_in_a_few_months
			2 = { #Straight to conclusion 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			12 = { #Slow progress 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				desc = stewardship_domain_special.8001.slow_progress
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = stewardship_domain_special.8001.slow_progress
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8023
					days = { 60 90 }
				}
			}
			12 = { #High death count 		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				desc = stewardship_domain_special.8001.high_death_count
				send_interface_toast = {
					type = event_toast_effect_bad
					title = stewardship_domain_special.8001.high_death_count
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8022
					days = { 60 90 }
				}
			}
		}
		ai_chance = {
			base = 50
		}
	}
}


#High death count
stewardship_domain_special.8022 = {
	type = character_event
	title = stewardship_domain_special.8022.t
	desc = stewardship_domain_special.8022.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward
	
	immediate = {
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
	}


	option = { #Oversee it personally
		name = stewardship_domain_special.8022.a
		stress_impact = {
			base = medium_stress_gain
		}
		duel = {
			skill = stewardship
			value = decent_skill_rating
			desc = outcome_in_a_few_months
			24 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			10 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
					min = -9
				}
				desc = stewardship_domain_special.8001.slow_progress
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = stewardship_domain_special.8001.slow_progress
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8023
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
			}
		}
	}
	
	
	option = { #Do they not live to serve me?
		name = stewardship_domain_special.8022.b
		scope:county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 20
			}
		}
		add_dread = medium_dread_gain
		scope:county = {
			add_county_modifier = {
				modifier = governance_peasants_overworked_modifier
				days = 3650
			}
		}
		random_list = {
			desc = outcome_in_a_few_months
			70 = {
				desc = stewardship_domain_special.8001.progress_is_made
				send_interface_toast = {
					type = event_toast_effect_good
					title = stewardship_domain_special.8001.progress_is_made
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_completed
				}
				trigger_event = {
					id = stewardship_domain_special.8031
					days = { 60 90 }
				}
			}
			30 = {
				desc = stewardship_domain_special.8001.slow_progress
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = stewardship_domain_special.8001.slow_progress
					left_icon = scope:county
				
					custom_tooltip = stewardship_domain_special.8001.project_continues
				}
				trigger_event = {
					id = stewardship_domain_special.8023
					days = { 60 90 }
				}
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}
	
	option = { #Levy replacements
		name = stewardship_domain_special.8022.c
		flavor = stewardship_domain_special.8022.c.tt
		add_character_modifier = {
			modifier = governance_levied_peasants_for_construction_modifier
			days = 1825
		}
		custom_tooltip = stewardship_domain_special.8001.project_completed
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
}


#Slow Progress
stewardship_domain_special.8023 = {
	type = character_event
	title = stewardship_domain_special.8023.t
	desc = stewardship_domain_special.8023.desc
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward

	immediate = {
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
	}

	option = { #Replace the overseers
		name = stewardship_domain_special.8023.a
		scope:county = {
			add_county_modifier = {
				modifier = stewardship_domain_county_worked_to_death_modifier
				years = 5
			}
		}
		add_dread = minor_dread_gain
		custom_tooltip = stewardship_domain_special.8001.project_continues
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -0.5
			}
		}
	}

	option = { #Hire whoever many are needed
		name = stewardship_domain_special.8023.b
		remove_short_term_gold = medium_gold_value
		custom_tooltip = stewardship_domain_special.8001.project_continues
		hidden_effect = {
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -0.5
			}
		}
	}
	
	option = { #Scope down
		name = stewardship_domain_special.8023.c
		custom_tooltip = stewardship_domain_special.8023.c.tt
		custom_tooltip = stewardship_domain_special.8001.project_continues
		hidden_effect = {
			save_scope_value_as = {
				name = scoped_down
				value = yes
			}
			trigger_event = {
				id = stewardship_domain_special.8031
				days = { 60 90 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
}


#######
# Conclusion
# 8031
#######

stewardship_domain_special.8031 = {
	type = character_event
	title = stewardship_domain_special.8031.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:project_type = flag:aqueduct }
				desc = stewardship_domain_special.8031.aqueduct
			}
			desc = stewardship_domain_special.8031.irrigation
		}
		desc = stewardship_domain_special.8031.interlude
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:scoped_down }
				desc = stewardship_domain_special.8031.scoped_down
			}
			desc = stewardship_domain_special.8031.full_scope
		}
		desc = stewardship_domain_special.8031.conclusion
	}	
	
	theme = stewardship_domain_focus
	left_portrait = scope:steward

	option = {
		name = stewardship_domain_special.8031.a
		
		add_stewardship_lifestyle_perk_points = 1

		if = {
			limit = {
				scope:project_type = flag:irrigation_ditches
				exists = scope:scoped_down
			}
			scope:county = {
				add_county_modifier = {
					modifier = governance_small_irrigation_modifier
					days = 7300
				}
			}
		}
		else_if = {
			limit = {
				scope:project_type = flag:aqueduct
				exists = scope:scoped_down
			}
			scope:county = {
				add_county_modifier = {
					modifier = governance_small_aqueduct_modifier
					days = 7300
				}
			}
		}
		else_if = {
			limit = {
				scope:project_type = flag:aqueduct
			}
			scope:county = {
				add_county_modifier = {
					modifier = governance_aqueduct_modifier
					days = 7300
				}
			}
		}
		else = {
			scope:county = {
				add_county_modifier = {
					modifier = governance_irrigation_modifier
					days = 7300
				}
			}
		}

		hidden_effect = {
			remove_character_flag = is_in_stewardship_domain_special_event
		}
	}
}

### END OF IRRIGATION PROJECT CHAIN