namespace = ep3_landless_admin

##################################################
#	EP3 Landless Admin
#	by Veronica Pazos
#	1000	On the Door
#	1010	In Good Estate
#	1020	For a Bit of Gold
#	1030	A Secret for a Secret
#	1040	Next in Line
#	1050	Just Below Us

# On the Door
# This guy could be a cool councillor
# 1000

ep3_landless_admin.1000 = {
	type = character_event
	title = ep3_landless_admin.1000.t
	desc = ep3_landless_admin.1000.desc
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = gregarious
					has_trait = generous
				}
			}
			animation = ecstasy
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:proposed_councillor
		animation = scheme
	}
	cooldown = { years = 5 }

	trigger = {
		is_landless_administrative = yes
		is_available = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			NOT = {
				any_courtier = {
					has_any_high_skill_rating = yes
					count < 3
				}
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					is_available_healthy_ai_adult = yes
					has_any_high_skill_rating = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					is_available_healthy_ai_adult = yes
					has_any_high_skill_rating = yes
				}
				save_scope_as = proposed_councillor
			}
		}
		else = {
			create_character = {
				template = administrator_character
				gender_female_chance = root_faith_dominant_gender_adjusted_female_chance
				dynasty = none
				location = root.location
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = proposed_councillor
			}
		}
	}

	# You're hired!
	option = {
		name = ep3_landless_admin.1000.a
		add_courtier = scope:proposed_councillor
		pay_short_term_gold = {
			target = scope:proposed_councillor
			gold = medium_gold_value
		}
		stress_impact = { # You feel like you're getting robbed
			greedy = medium_stress_impact_gain
			avaricious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = arrogant
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}

	# Try to recruit them for free
	option = {
		name = ep3_landless_admin.1000.b
		duel = {
			skill = stewardship
			target = scope:proposed_councillor
			5 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 1
				}
				modifier = {
					influence_level >= 3
					add = 10
				}
				desc = ep3_landless_admin.1000.b.success
				send_interface_toast = {
					title = ep3_landless_admin.1000.b.success
					left_icon = scope:proposed_councillor
					add_courtier = scope:proposed_councillor
				}
			}
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = 2
				}
				desc = ep3_landless_admin.1000.b.mid
				send_interface_toast = {
					title = ep3_landless_admin.1000.b.mid
					left_icon = scope:proposed_councillor
					add_courtier = scope:proposed_councillor
					custom_tooltip = obligation_hook_tt
					add_hook = {
						target = scope:proposed_councillor
						type = obligation_hook
					}
					pay_short_term_gold = {
						target = scope:proposed_councillor
						gold = minor_gold_value
					}
				}
			}
			20 = {
				desc = ep3_landless_admin.1000.b.failure
				send_interface_toast = {
					title = ep3_landless_admin.1000.b.failure
					left_icon = scope:proposed_councillor
					reverse_add_opinion = {
						target = scope:proposed_councillor
						modifier = insulted_opinion
						opinion = -15
					}
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -25
				has_trait = greedy
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}

	# I'm good, thanks
	option = {
		name = ep3_landless_admin.1000.c
		stress_impact = { # Why wouldn't you hire this poor person
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}
}

# In Good Estate
# You have upgraded your estate a bunch, locals are impressed
# 1010

ep3_landless_admin.1010 = {
	type = character_event
	title = ep3_landless_admin.1010.t
	desc = ep3_landless_admin.1010.desc
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = paranoid
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				has_trait = arrogant
			}
			animation = laugh
		}
		animation = personality_content
	}
	right_portrait = {
		character = scope:local
		animation = admiration
	}
	lower_right_portrait = scope:child
	cooldown = { years = 10 }

	trigger = {
		government_allows = administrative
		is_landed_or_landless_administrative = yes
		domicile ?= {
			has_domicile_building_or_higher = estate_main_03
		}
		is_available = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			domicile ?= {
				has_domicile_building_or_higher = estate_main_05
			}
		}
	}

	immediate = {
		domicile = { save_scope_as = my_estate }
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					any_child = {
						is_adult = no
					}
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					is_available_healthy_ai_adult = yes
					has_no_particular_noble_roots_trigger = yes
					any_child = {
						is_adult = no
					}
				}
				save_scope_as = local
				random_child = {
					limit = { is_adult = no }
					save_scope_as = child
				}
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				dynasty = none
				location = root.location
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = local
			}
			hidden_effect = {
				scope:local = {
					move_to_pool = yes
				}
			}
			create_character = {
				template = peasant_toddler_character
				culture = root.culture
				faith = root.faith
				location = root.location
				save_scope_as = child
			}
			if = { #Set the previous character as their parent
				limit = {
					scope:local ?= {
						is_female = no
					}
				}
				hidden_effect = {
					scope:child = {
						set_father = scope:local
					}
				}
			}
			else = {
				hidden_effect = {
					scope:child = {
						set_mother = scope:local
					}
				}
			}
		}
	}
	
	# Paranoid - they're clearly spying on me!
	option = {
		name = ep3_landless_admin.1010.a
		trigger = {
			has_trait = paranoid 
		}
		add_character_modifier = {
			modifier = ep3_extra_security_modifier
			years = 10
		}
		scope:local = {
			add_opinion = {
				target = root
				modifier = confused_opinion
				opinion = -20
			}
		}		
		stress_impact = { 
			paranoid = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = paranoid
			}
		}
	}

	# Thanks friend, would you like to contribute?
	option = {
		name = ep3_landless_admin.1010.b
		add_character_modifier = {
			modifier = ep3_good_estate_modifier
			years = 10
		}
		
		stress_impact = { 
			greedy = medium_stress_impact_loss
			generous = medium_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = greedy
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
		}
	}

	# Tell everyone pls
	option = {
		name = ep3_landless_admin.1010.c
		change_influence = minor_influence_gain
		
		stress_impact = {
			arrogant = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				influence_level <= 2
			}
			modifier = {
				factor = 2
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}

	# That's sick, do you wanna join me?
	option = {
		name = ep3_landless_admin.1010.d
		add_courtier = scope:local
		add_courtier = scope:child
		add_piety = miniscule_piety_gain
		stress_impact = { 
			gregarious = medium_stress_impact_loss
			generous = medium_stress_impact_loss
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = callous
				}
			}
		}
	}
}

# For a Bit of Gold
# Upgrade a building in your estate
# 1020

scripted_trigger ep3_landless_admin_1020_can_upgrade_market_trigger = {
	has_domicile_building_or_higher = market_01
	NOT = { has_domicile_building_or_higher = market_06 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = market_05 }
		root = { estate_can_construct_market_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = market_04 }
		root = { estate_can_construct_market_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = market_03 }
		root = { estate_can_construct_market_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = market_02 }
		root = { estate_can_construct_market_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_garden_trigger = {
	has_domicile_building_or_higher = garden_01
	NOR = {
		has_domicile_building_or_higher = garden_leisure_06
		has_domicile_building_or_higher = garden_fruit_06
	}
	trigger_if = {
		limit = { has_domicile_building_or_higher = garden_leisure_05 }
		root = { estate_can_construct_garden_leisure_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = garden_leisure_04 }
		root = { estate_can_construct_garden_leisure_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = garden_03 }
		root = { estate_can_construct_garden_leisure_04_trigger = yes }
	}
	trigger_else = { always = yes }
	trigger_if = {
		limit = { has_domicile_building_or_higher = garden_fruit_05 }
		root = { estate_can_construct_garden_fruit_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = garden_fruit_04 }
		root = { estate_can_construct_garden_fruit_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = garden_03 }
		root = { estate_can_construct_garden_fruit_04_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_guardhouse_trigger = {
	has_domicile_building_or_higher = guardhouse_01
	NOT = { has_domicile_building_or_higher = guardhouse_04 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = guardhouse_03 }
		root = { estate_can_construct_guardhouse_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = guardhouse_02 }
		root = { estate_can_construct_guardhouse_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_workshop_trigger = {
	has_domicile_building_or_higher = workshop_01
	NOR = {
		has_domicile_building_or_higher = workshop_carpenter_06
		has_domicile_building_or_higher = workshop_mason_06
	}
	trigger_if = {
		limit = { has_domicile_building_or_higher = workshop_carpenter_05 }
		root = { estate_can_construct_workshop_carpenter_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_carpenter_04 }
		root = { estate_can_construct_workshop_carpenter_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_carpenter_03 }
		root = { estate_can_construct_workshop_carpenter_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_02 }
		root = { estate_can_construct_workshop_carpenter_03_trigger = yes }
	}
	trigger_else = { always = yes }
	trigger_if = {
		limit = { has_domicile_building_or_higher = workshop_mason_05 }
		root = { estate_can_construct_workshop_mason_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_mason_04 }
		root = { estate_can_construct_workshop_mason_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_mason_03 }
		root = { estate_can_construct_workshop_mason_04_trigger = yes }
	}
	# No workshop_02 here, as we default to building a carpenter.
	trigger_else = { always = yes }
	trigger_if = {
		limit = { has_domicile_building_or_higher = workshop_textile_05 }
		root = { estate_can_construct_workshop_textile_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_textile_04 }
		root = { estate_can_construct_workshop_textile_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = workshop_textile_03 }
		root = { estate_can_construct_workshop_textile_04_trigger = yes }
	}
	# No workshop_02 here, as we default to building a carpenter.
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_barracks_trigger = {
	has_domicile_building_or_higher = barracks_01
	NOT = { has_domicile_building_or_higher = barracks_06 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = barracks_05 }
		root = { estate_can_construct_barracks_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = barracks_04 }
		root = { estate_can_construct_barracks_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = barracks_03 }
		root = { estate_can_construct_barracks_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = barracks_02 }
		root = { estate_can_construct_barracks_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_vineyard_trigger = {
	has_domicile_building_or_higher = vineyard_01
	NOT = { has_domicile_building_or_higher = vineyard_06 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = vineyard_05 }
		root = { estate_can_construct_vineyard_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = vineyard_04 }
		root = { estate_can_construct_vineyard_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = vineyard_03 }
		root = { estate_can_construct_vineyard_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = vineyard_02 }
		root = { estate_can_construct_vineyard_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_olive_trigger = {
	has_domicile_building_or_higher = olive_01
	NOT = { has_domicile_building_or_higher = olive_06 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = olive_05 }
		root = { estate_can_construct_olive_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = olive_04 }
		root = { estate_can_construct_olive_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = olive_03 }
		root = { estate_can_construct_olive_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = olive_02 }
		root = { estate_can_construct_olive_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

scripted_trigger ep3_landless_admin_1020_can_upgrade_tea_trigger = {
	has_domicile_building_or_higher = japanese_tea_plantation_01
	NOT = { has_domicile_building_or_higher = japanese_tea_plantation_06 }
	trigger_if = {
		limit = { has_domicile_building_or_higher = japanese_tea_plantation_05 }
		root = { estate_can_construct_japanese_tea_plantation_06_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = japanese_tea_plantation_04 }
		root = { estate_can_construct_japanese_tea_plantation_05_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = japanese_tea_plantation_03 }
		root = { estate_can_construct_japanese_tea_plantation_04_trigger = yes }
	}
	trigger_else_if = {
		limit = { has_domicile_building_or_higher = japanese_tea_plantation_02 }
		root = { estate_can_construct_japanese_tea_plantation_03_trigger = yes }
	}
	trigger_else = { always = yes }
}

ep3_landless_admin.1020 = {
	type = character_event
	title = ep3_landless_admin.1020.t
	desc = {
		desc = ep3_landless_admin.1020.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:market
				}
				desc = ep3_landless_admin.1020.desc.market
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:garden
				}
				desc = ep3_landless_admin.1020.desc.garden
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:guardhouse
				}
				desc = ep3_landless_admin.1020.desc.guardhouse
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:workshop
				}
				desc = ep3_landless_admin.1020.desc.workshop
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:barracks
				}
				desc = ep3_landless_admin.1020.desc.barracks
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:vineyard
				}
				desc = ep3_landless_admin.1020.desc.vineyard
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:olive
				}
				desc = ep3_landless_admin.1020.desc.olive
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:tea
				}
				desc = ep3_landless_admin.1020.desc.tea
			}
		}
		desc = ep3_landless_admin.1020.desc.outro
	}
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = callous
			}
			animation = dismissal
		}
		animation = happiness
	}
	right_portrait = {
		character = scope:steward
		animation = steward
	}
	cooldown = { years = 10 }

	trigger = {
		government_allows = administrative
		is_landed_or_landless_administrative = yes
		is_available = yes
		# I'm sorry
		## ^Original source of shame removed on charges of [redacted]. The Council disapproves of such... lacking hygiene.
		domicile ?= {
			OR = {
				ep3_landless_admin_1020_can_upgrade_market_trigger = yes
				ep3_landless_admin_1020_can_upgrade_garden_trigger = yes
				ep3_landless_admin_1020_can_upgrade_guardhouse_trigger = yes
				ep3_landless_admin_1020_can_upgrade_workshop_trigger = yes
				ep3_landless_admin_1020_can_upgrade_barracks_trigger = yes
				ep3_landless_admin_1020_can_upgrade_vineyard_trigger = yes
				ep3_landless_admin_1020_can_upgrade_olive_trigger = yes
			}
		}
		domicile.domicile_location = {
			has_ongoing_construction = no
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			NOT = {
				any_courtier = {
					has_any_high_skill_rating = yes
					count < 3
				}
			}
		}
	}

	immediate = {
		random_list = {
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_market_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:market
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_garden_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:garden
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_guardhouse_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:guardhouse
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_workshop_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:workshop
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_barracks_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:barracks
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_vineyard_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:vineyard
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_olive_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:olive
				}
			}
			1 = {
				trigger = {
					domicile = { ep3_landless_admin_1020_can_upgrade_tea_trigger = yes }
				}
				set_variable = {
					name = domicile_building
					value = flag:tea
				}
			}
		}
		if = {
			limit = {
				exists = cp:councillor_steward 
			}
			cp:councillor_steward = { save_scope_as = steward }
		}
		else_if = {
			limit = {
				any_courtier = {
					is_available_healthy_ai_adult = yes
					this != root
				}
			}
			ordered_courtier = {
				limit = {
					is_available_healthy_ai_adult = yes
					this != root
				}
				order_by = stewardship
				save_scope_as = steward
			}
		}
		else = {
			create_character = {
				template = stewardship_court_position_holder_template
				gender_female_chance = root_faith_dominant_gender_adjusted_female_chance
				dynasty = none
				location = root.location
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = steward
			}
		}
		scope:steward = { assign_quirk_effect = yes }
	}

	# Market
	option = {
		name = ep3_landless_admin.1020.a
		trigger = { var:domicile_building = flag:market }
		domicile = {
			switch = {
				trigger = has_domicile_building
				market_01 = { add_domicile_building = market_02 }
				market_02 = { add_domicile_building = market_03 }
				market_03 = { add_domicile_building = market_04 }
				market_04 = { add_domicile_building = market_05 }
				market_05 = { add_domicile_building = market_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			greedy = medium_stress_impact_gain
			avaricious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = arrogant
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}

	# Garden
	option = {
		name = ep3_landless_admin.1020.b
		trigger = { var:domicile_building = flag:garden }
		domicile = {
			switch = {
				trigger = has_domicile_building
				garden_01 = { add_domicile_building = garden_02 }
				garden_02 = { add_domicile_building = garden_03 }
				garden_03 = { add_domicile_building = garden_leisure_04 }
				garden_leisure_04 = { add_domicile_building = garden_leisure_05 }
				garden_leisure_05 = { add_domicile_building = garden_leisure_06 }
				garden_fruit_04 = { add_domicile_building = garden_fruit_05 }
				garden_fruit_05 = { add_domicile_building = garden_fruit_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -25
				has_trait = greedy
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}

	# Guardhouse
	option = {
		name = ep3_landless_admin.1020.c
		trigger = { var:domicile_building = flag:guardhouse }
		domicile = {
			switch = {
				trigger = has_domicile_building
				guardhouse_01 = { add_domicile_building = guardhouse_02 }
				guardhouse_02 = { add_domicile_building = guardhouse_03 }
				guardhouse_03 = { add_domicile_building = guardhouse_04 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}
	
	# Workshop
	option = {
		name = ep3_landless_admin.1020.d
		trigger = { var:domicile_building = flag:workshop }
		domicile = {
			switch = {
				trigger = has_domicile_building
				workshop_01 = { add_domicile_building = workshop_02 }
				workshop_02 = { add_domicile_building = workshop_carpenter_03 }
				workshop_carpenter_03 = { add_domicile_building = workshop_carpenter_04 }
				workshop_carpenter_04 = { add_domicile_building = workshop_carpenter_05 }
				workshop_carpenter_05 = { add_domicile_building = workshop_carpenter_06 }
				workshop_mason_03 = { add_domicile_building = workshop_mason_04 }
				workshop_mason_04 = { add_domicile_building = workshop_mason_05 }
				workshop_mason_05 = { add_domicile_building = workshop_mason_06 }
				workshop_textile_03 = { add_domicile_building = workshop_textile_04 }
				workshop_textile_04 = { add_domicile_building = workshop_textile_05 }
				workshop_textile_05 = { add_domicile_building = workshop_textile_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}
	
	# Barracks
	option = {
		name = ep3_landless_admin.1020.e
		trigger = { var:domicile_building = flag:barracks }
		domicile = {
			switch = {
				trigger = has_domicile_building
				barracks_01 = { add_domicile_building = barracks_02 }
				barracks_02 = { add_domicile_building = barracks_03 }
				barracks_03 = { add_domicile_building = barracks_04 }
				barracks_04 = { add_domicile_building = barracks_05 }
				barracks_05 = { add_domicile_building = barracks_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}
	
	# Vineyard
	option = {
		name = ep3_landless_admin.1020.f
		trigger = { var:domicile_building = flag:vineyard }
		domicile = {
			switch = {
				trigger = has_domicile_building
				vineyard_01 = { add_domicile_building = vineyard_02 }
				vineyard_02 = { add_domicile_building = vineyard_03 }
				vineyard_03 = { add_domicile_building = vineyard_04 }
				vineyard_04 = { add_domicile_building = vineyard_05 }
				vineyard_05 = { add_domicile_building = vineyard_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}
	
	# Olive
	option = {
		name = ep3_landless_admin.1020.g
		trigger = { var:domicile_building = flag:olive }
		domicile = {
			switch = {
				trigger = has_domicile_building
				olive_01 = { add_domicile_building = olive_02 }
				olive_02 = { add_domicile_building = olive_03 }
				olive_03 = { add_domicile_building = olive_04 }
				olive_04 = { add_domicile_building = olive_05 }
				olive_05 = { add_domicile_building = olive_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}


	
	# Tea
	option = {
		name = ep3_landless_admin.1020.j
		trigger = { var:domicile_building = flag:tea }
		domicile = {
			switch = {
				trigger = has_domicile_building
				olive_01 = { add_domicile_building = japanese_tea_plantation_02 }
				olive_02 = { add_domicile_building = japanese_tea_plantation_03 }
				olive_03 = { add_domicile_building = japanese_tea_plantation_04 }
				olive_04 = { add_domicile_building = japanese_tea_plantation_05 }
				olive_05 = { add_domicile_building = japanese_tea_plantation_06 }
			}
		}
		remove_short_term_gold = major_gold_value
		change_influence = medium_influence_loss
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				has_trait = generous
			}
			modifier = {
				factor = 0
				short_term_gold <= major_gold_value
			}
		}
	}
	
	# There's other stuff I want to build
	option = {
		name = ep3_landless_admin.1020.h
		flavor = ep3_landless_admin.1020.h.flavor
		add_gold = medium_gold_value
		
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	after = { remove_variable = domicile_building }
}

# A Secret for a Secret
# You get offered a hook on your liege
# 1030

scripted_trigger ep3_landless_admin_1030_courtier_trigger = {
	is_available_healthy_ai_adult = yes
	OR = {
		has_relation_rival = root.liege
		opinion = {
			target = root.liege
			value <= -50
		}
		AND = {
			OR = {
				has_trait = disloyal
				has_trait = deceitful
				has_trait = callous
			}
			NOT = { is_spouse_of = root.liege } # It'd look weird for their spouse to just rock up to you
		}
	}
}

ep3_landless_admin.1030 = {
	type = character_event
	title = ep3_landless_admin.1030.t
	desc = ep3_landless_admin.1030.desc
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = paranoid
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = loyal
					has_trait = just
					has_trait = honest
				}
			}
			animation = dismissal
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:courtier
		animation = scheme
	}
	lower_right_portrait = scope:liege
	cooldown = { years = 10 }

	trigger = {
		government_allows = administrative
		is_landed_or_landless_administrative = yes
		is_available = yes
		liege ?= {
			is_ai = yes
			any_secret = {
				NOT = { 
					any_secret_knower = { this = root } 
				}
			}
			any_courtier_or_guest = {
				ep3_landless_admin_1030_courtier_trigger = yes
			}
		}
		can_add_hook = {
			target = root.liege
			type = strong_blackmail_hook
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		liege = {
			save_scope_as = liege
			random_secret = {
				limit = {
					NOT = { 
						any_secret_knower = { this = root } 
					}
				}
				save_scope_as = secret
			}
			random_courtier_or_guest = {
				limit = { ep3_landless_admin_1030_courtier_trigger = yes }
				weight = {
					base = 1
					modifier = {
						add = 5
						has_relation_nemesis = root.liege
					}
					modifier = {
						add = 5
						has_relation_rival = root.liege
					}
					modifier = {
						add = 2
						has_trait = deceitful
					}
					modifier = {
						add = 2
						has_trait = disloyal
					}
					modifier = {
						add = 2
						has_trait = callous
					}
				}
				save_scope_as = courtier
			}					
		}
		scope:courtier = { get_quirk_character_effect = yes }
	}
	
	# Paranoid - WHAT DO YOU THINK YOU'RE DOING???
	option = {
		name = ep3_landless_admin.1030.a
		trigger = {
			has_trait = paranoid 
		}
		add_character_modifier = {
			modifier = ep3_no_secrets_modifier
			years = 15
		}
		stress_impact = { 
			paranoid = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = paranoid
			}
		}
	}
	
	# Honorable - How dare you?
	option = {
		name = ep3_landless_admin.1030.b
		trigger = {
			OR = {
				has_trait = loyal
				has_trait = just
				has_trait = honest
			}
			NOT = { has_trait = paranoid }
		}
		add_character_modifier = {
			modifier = ep3_no_secrets_modifier
			years = 15
		}
		stress_impact = { 
			loyal = medium_stress_impact_loss
			just = medium_stress_impact_loss
			honest = medium_stress_impact_loss
			deceitful = medium_stress_impact_gain
			disloyal = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = loyal
					has_trait = just
					has_trait = honest
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = disloyal
					has_trait = deceitful
					has_trait = callous
				}
			}
		}
	}

	# Sure!
	option = {
		name = ep3_landless_admin.1030.c
		add_hook = {
			target = scope:liege
			type = strong_blackmail_hook
			secret = scope:secret
		}
		if = {
			limit = {
				any_secret = {
					NOT = { 
						any_secret_knower = { this = scope:liege } 
					}
				}
			}
			random_secret = {
				limit = {
					NOT = { 
						any_secret_knower = { this = scope:liege } 
					}
				}
				expose_secret = scope:courtier
			}
		}
		else = {
			scope:courtier = {
				add_hook = {
					type = favor_hook
					target = root
				}
			}
		}
		stress_impact = { 
			greedy = medium_stress_impact_loss
			generous = medium_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = greedy
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
		}
	}

	# Try to get it for free hihi
	option = {
		name = ep3_landless_admin.1030.d
		duel = {
			target = scope:courtier
			skill = intrigue
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				modifier = {
					influence_level >= 3
					add = 10
				}
				desc = ep3_landless_admin.1030.d.success
				send_interface_toast = {
					title = ep3_landless_admin.1030.d.success
					left_icon = scope:courtier
					add_hook = {
						target = scope:liege
						type = strong_blackmail_hook
						secret = scope:secret
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				desc = ep3_landless_admin.1030.d.failure
				send_interface_toast = {
					title = ep3_landless_admin.1030.d.failure
					left_icon = scope:courtier
					scope:courtier = {	
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -15
						}
					}	
				}
			}
		}
		stress_impact = {
			arrogant = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				influence_level <= 2
			}
			modifier = {
				factor = 2
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}

	# I'm good ty
	option = {
		name = ep3_landless_admin.1030.e
		
		stress_impact = { 
			gregarious = medium_stress_impact_loss
			generous = medium_stress_impact_loss
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = callous
				}
			}
		}
	}
}

# Next in Line
# Lie about a rival candidate
# 1040

scripted_trigger ep3_landless_admin_1040_spymaster_trigger = {
	is_available_healthy_ai_adult = yes
}

ep3_landless_admin.1040 = {
	type = character_event
	title = ep3_landless_admin.1040.t
	desc = {
		desc = ep3_landless_admin.1040.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:rival = { is_child_of = root }
				}
				desc = ep3_landless_admin.1040.desc.child
			}
			triggered_desc = {
				trigger = {
					scope:rival = { is_spouse_of = root }
				}
				desc = ep3_landless_admin.1040.desc.spouse
			}
			triggered_desc = {
				trigger = {
					scope:rival = { is_close_or_extended_family_of = root }
				}
				desc = ep3_landless_admin.1040.desc.family
			}
		}
	}
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = paranoid
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = loyal
					has_trait = just
					has_trait = honest
				}
			}
			animation = dismissal
		}
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:spymaster
		animation = scheme
	}
	lower_right_portrait = scope:rival
	cooldown = { years = 5 }
	override_background = { reference = garden }

	trigger = {
		is_governor = yes
		NOT = { government_has_flag = government_has_merit }
		is_available = yes
		exists = location.county.duchy.holder
		location.county.duchy.holder ?= { # There's a governor in your location, doesn't matter whether it's you or not
			is_governor = yes
		}
		primary_title = {
			is_noble_family_title = no
		}
		OR = {
			exists = cp:councillor_spymaster
			any_courtier = {
				ep3_landless_admin_1040_spymaster_trigger = yes
			}
		}
		OR = {
			AND = {
				exists = root.player_heir
				primary_title.current_heir = {
					NOT = { this = root.player_heir }
				}
			}
			primary_title = {
				any_title_heir = {
					count >= 1
					NOR = {
						this = root.top_liege
						this = root.player_heir
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			exists = root.player_heir
			primary_title.current_heir = {
				this != root.player_heir
			}
		}
	}

	immediate = {
		primary_title = { save_scope_as = my_title }
		if = { # If the next sucessor is not your player heir we grab them
			limit = { 
				exists = root.player_heir
				primary_title.current_heir = {
					this != root.player_heir
				}
			}
			primary_title.current_heir = { save_scope_as = rival }
		}
		else_if = { # If you're a governor we grab your current title
			limit = {
				is_governor = yes
			}
			primary_title = {
				ordered_title_heir = {
					limit = {
						NOR = {
							this = root.top_liege
							this = root.player_heir
						}
					}
					order_by = "appointment_candidate_score(root.primary_title)"
					save_scope_as = rival
				}
			}
		}
		else = { # If you are landless we grab the governor of your location
			location.county.duchy.holder = {
				save_scope_as = rival
			}
		}
		if = {
			limit = { exists = cp:councillor_spymaster }
			cp:councillor_spymaster = { save_scope_as = spymaster }
		}
		else = {
			ordered_courtier = {
				limit = { ep3_landless_admin_1040_spymaster_trigger = yes }
				order_by = intrigue
				save_scope_as = spymaster
			}
		}
	}
	
	# Deceitful - Harm them for free
	option = {
		name = ep3_landless_admin.1040.a
		trigger = {
			has_trait = deceitful 
		}
		custom_tooltip =  ep3_landless_admin.1040.tt
		hidden_effect = {
			scope:my_title = {
				change_appointment_investment = {
					investor = root
					target = scope:rival
					value = {
						subtract = appointment_score_medium_value
					}
				}
			}
		}
		stress_impact = { 
			deceitful = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = deceitful
			}
		}
	}
	
	# Lazy - I'd rather take a nap
	option = {
		name = ep3_landless_admin.1040.b
		trigger = {
			has_trait = lazy
		}
		add_character_modifier = {
			modifier = ep3_well_rested_modifier
			years = 2
		}
		stress_impact = { 
			lazy = medium_stress_impact_loss
			deceitful = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = lazy
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = deceitful
					has_trait = ambitious
				}
			}
		}
	}

	# Spend influence to harm them
	option = {
		name = ep3_landless_admin.1040.c
		trigger = {
			NOT = { has_trait = deceitful }
		}
		change_influence = medium_influence_loss
		custom_tooltip =  ep3_landless_admin.1040.tt
		hidden_effect = {
			scope:my_title = {
				change_appointment_investment = {
					investor = root
					target = scope:rival
					value = {
						subtract = appointment_score_medium_value
					}
				}
			}
		}
		stress_impact = { 
			ambitious = medium_stress_impact_loss
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = ambitious
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = honest
				}
			}
		}
	}

	# Duel them to harm them for free
	option = {
		name = ep3_landless_admin.1040.d
		trigger = {
			NOT = { has_trait = deceitful }
		}
		duel = {
			target = scope:rival
			skills = { diplomacy intrigue }
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				desc = ep3_landless_admin.1040.d.success
				send_interface_toast = {
					title = ep3_landless_admin.1040.d.success
					left_icon = scope:rival
					custom_tooltip =  ep3_landless_admin.1040.tt
					hidden_effect = {
						scope:my_title = {
							change_appointment_investment = {
								investor = root
								target = scope:rival
								value = {
									subtract = appointment_score_medium_value
								}
							}
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				desc = ep3_landless_admin.1040.d.failure
				send_interface_toast = {
					title = ep3_landless_admin.1040.d.failure
					left_icon = scope:rival
					change_influence = minor_influence_loss
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	# Nah
	option = {
		name = ep3_landless_admin.1040.e
		
		stress_impact = { 
			gregarious = medium_stress_impact_loss
			generous = medium_stress_impact_loss
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.5
				influence_level <= 1
			}
		}
	}
}

# Just Below Us
# There's something in your basement
# 1050

scripted_trigger ep3_landless_admin_1050_servant_trigger = {
	is_available_healthy_ai_adult = yes
	has_no_particular_noble_roots_trigger = yes
	NOT = { is_close_or_extended_family_of = root }
	NOT = { is_spouse_of = root }
}

ep3_landless_admin.1050 = {
	type = character_event
	title = ep3_landless_admin.1050.t
	desc = {
		desc = ep3_landless_admin.1050.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:prison
				}
				desc = ep3_landless_admin.1050.desc.prison
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:servants
				}
				desc = ep3_landless_admin.1050.desc.servants
			}
			triggered_desc = {
				trigger = {
					var:domicile_building = flag:wine
				}
				desc = ep3_landless_admin.1050.desc.wine
			}
		}
		desc = ep3_landless_admin.1050.desc.outro
	}
	theme = administrative
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_trait = paranoid
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				has_trait_schemy_trigger = yes
			}
			animation = scheme
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = brave
					has_trait = arrogant
					has_trait = reckless
				}
			}
			animation = laugh
		}
		animation = thinking
	}
	right_portrait = {
		character = scope:servant
		animation = lantern
	}
	cooldown = { years = 25 }
	override_background = { reference = ce1_catacombs }
	override_effect_2d = {
		reference = fog
	}

	trigger = {
		government_allows = administrative
		is_landed_or_landless_administrative = yes
		is_available = yes
		domicile ?= {
			OR = {
				has_domicile_building_or_higher = prison_01
				has_domicile_building_or_higher = servants_quarters_01
				has_domicile_building_or_higher = wine_cellar_01
			}
		}
	}

	weight_multiplier = {
		base = 1
		
	}

	immediate = {
		random_list = {
			1 = {
				trigger = {
					domicile ?= {
						has_domicile_building_or_higher = prison_01
					}
				}
				set_variable = {
					name = domicile_building
					value = flag:prison
				}
			}
			1 = {
				trigger = {
					domicile ?= {
						has_domicile_building_or_higher = servants_quarters_01
					}
				}
				set_variable = {
					name = domicile_building
					value = flag:servants
				}
			}
			1 = {
				trigger = {
					domicile ?= {
						has_domicile_building_or_higher = wine_cellar_01
					}
				}
				set_variable = {
					name = domicile_building
					value = flag:wine
				}
			}
		}
		if = { # If you have an appropriate courtier we grab them
			limit = {
				any_courtier_or_guest = {
					ep3_landless_admin_1050_servant_trigger = yes
				}
			}
			random_courtier_or_guest = {
				limit = {
					ep3_landless_admin_1050_servant_trigger = yes
				}
				save_scope_as = servant
			}
		}
		else_if = { # Otherwise we grab a pool character
			limit = {
				any_pool_character = {
					province = root.domicile.domicile_location
					ep3_landless_admin_1050_servant_trigger = yes
				}
			}
			random_pool_character = {	
				province = root.domicile.domicile_location
				limit = {
					ep3_landless_admin_1050_servant_trigger = yes
				}
				save_scope_as = servant 
			}
		}
		else = { # And if not we create them
			create_character = {
				template = servant_character
				culture = root.domicile.domicile_location.culture
				faith = root.domicile.domicile_location.faith
				location = root.domicile.domicile_location
				save_scope_as = servant
			}
		}
	}
	
	# Paranoid - Who built this!?
	option = {
		name = ep3_landless_admin.1050.a
		trigger = {
			has_trait = paranoid
		}
		add_character_modifier = {
			modifier = ep3_tunnel_investigation_modifier
			years = 15
		}
		stress_impact = { 
			paranoid = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = paranoid
			}
		}
	}

	# Deceitful - A perfect opportunity
	option = {
		name = ep3_landless_admin.1050.b
		trigger = {
			has_trait_schemy_trigger = yes
		}
		custom_tooltip = ep3_secret_tunnels_abduct
		set_variable = ep3_secret_tunnels_var
		stress_impact = { 
			deceitful = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
			disloyal = medium_stress_impact_loss
			callous = medium_stress_impact_loss
			vengeful = medium_stress_impact_loss
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = deceitful
					has_trait = ambitious
					has_trait = disloyal
					has_trait = callous
					has_trait = vengeful
				}
			}
			modifier = {
				factor = 0
				has_trait = honest
			}
		}
	}

	# Prison - Fill it up
	option = {
		name = ep3_landless_admin.1050.c
		trigger = {
			var:domicile_building = flag:prison
		}
		duel = {
			value = medium_skill_rating
			skill = prowess
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				modifier = {
					dread >= 75
					add = 10
				}
				desc = ep3_landless_admin.1050.c.success
				send_interface_toast = {
					title = ep3_landless_admin.1050.c.success
					left_icon = root
					add_character_modifier = {
						modifier = ep3_tunnel_prison_modifier
						years = 15
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				desc = ep3_landless_admin.1050.c.failure
				send_interface_toast = {
					title = ep3_landless_admin.1050.c.failure
					left_icon = root
					remove_short_term_gold = minor_gold_value
				}
			}
		}
		stress_impact = {
			arrogant = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}

	# Wine Cellar - Treasure?
	option = {
		name = ep3_landless_admin.1050.d
		trigger = {
			var:domicile_building = flag:wine
		}
		duel = {
			value = medium_skill_rating
			skill = stewardship
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				modifier = {
					influence_level >= 3
					add = 10
				}
				desc = ep3_landless_admin.1050.d.success
				send_interface_toast = {
					title = ep3_landless_admin.1050.d.success
					left_icon = root
					add_short_term_gold = minor_gold_value
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				desc = ep3_landless_admin.1050.c.failure
				send_interface_toast = {
					title = ep3_landless_admin.1050.c.failure
					left_icon = root
					remove_short_term_gold = minor_gold_value
				}
			}
		}
		stress_impact = { 
			gregarious = medium_stress_impact_loss
			generous = medium_stress_impact_loss
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}
	
	# Servants Quarters - Use it for our agents
	option = {
		name = ep3_landless_admin.1050.e
		trigger = {
			var:domicile_building = flag:servants
		}
		duel = {
			value = medium_skill_rating
			skill = intrigue
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1.5
					min = -49
				}
				desc = ep3_landless_admin.1050.e.success
				send_interface_toast = {
					title = ep3_landless_admin.1050.e.success
					left_icon = root
					add_character_modifier = {
						modifier = ep3_tunnel_servants_modifier
						years = 15
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -49
				}
				desc = ep3_landless_admin.1050.c.failure
				send_interface_toast = {
					title = ep3_landless_admin.1050.c.failure
					left_icon = root
					remove_short_term_gold = minor_gold_value
				}
			}
		}
		stress_impact = { 
			gregarious = medium_stress_impact_loss
			generous = medium_stress_impact_loss
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
			modifier = {
				factor = 0
				short_term_gold <= medium_gold_value
			}
		}
	}
	
	# Opt out
	option = {
		name = ep3_landless_admin.1050.f
		
		stress_impact = { 
			lazy = medium_stress_impact_loss
			trusting = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {	
					has_trait = lazy
					has_trait = trusting
				}
			}
		}
	}

	after = { remove_variable = domicile_building }
}
