﻿wandering_lifestyle_exp_post_travel_effect = {
	if = {
		limit = {
			is_ai = no
			has_bp3_dlc_trigger = yes
			exists = current_travel_plan
		}
		add_wanderer_lifestyle_xp = 5
	}
}

inspection_success_chance_change_effect = {
	scope:activity = {
		if = {
			limit = {
				NOT = { exists = var:inspection_success_chance_event }
			}
			set_variable = { name = inspection_success_chance_event value = 0 }
		}
		change_variable = {
			name = inspection_success_chance_event
			add = inspection_activity_success_$CHANGE$_value
		}
		set_variable = {
			name = inspection_success_chance
			value = inspection_success_chance_value
		}
	}
	custom_tooltip = inspection_activity_success_$CHANGE$_tt
}

inspection_success_chance_change_focus_effect = {
	if = {
		limit = {
			has_variable = inspection_activity_$FOCUS$_focus
		}
		inspection_success_chance_change_effect = {
			CHANGE = $CHANGE$
		}
	}
}

inspection_success_chance_change_not_focus_effect = {
	if = {
		limit = {
			NOT = { has_variable = inspection_activity_$FOCUS$_focus }
		}
		inspection_success_chance_change_effect = {
			CHANGE = $CHANGE$
		}
	}
}

inspection_claim_effects = {
	if = {
		limit = {
			$ACTOR$ = {
				NOT = { has_claim_on = $TARGET$ }
			}
		}
		$ACTOR$ = { add_$TYPE$_claim = $TARGET$ }
	}
}

inspection_fighting_guilds_effect = {
	scope:city_province = {
		random_list = {
			10 = { # Millers Guild (Watermills)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 1 }
					}
					building_watermills_requirement_terrain = yes
					culture = {
						has_innovation = innovation_windmills
					}
					NOT = { has_building_or_higher =  watermills_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 1
				}
			}
			10 = { # Bakers Guild (Windmills)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 2 }
					}
					building_windmills_requirement_terrain = yes
					culture = {
						has_innovation = innovation_windmills
					}
					NOT = { has_building_or_higher =  windmills_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 2
				}
			}
			10 = { # Fishmongers Guild (Port)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 3 }
					}
					building_common_tradeport_requirement_terrain = yes
					NOT = { has_building_or_higher =  common_tradeport_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 3
				}
			}
			10 = { # Shoemakers/Tanners/Tailors/Weavers Guild (Cattle Pastures)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOR = { 
							var:fighting_guilds_option_1 = 4
							var:fighting_guilds_option_1 = 5
							var:fighting_guilds_option_1 = 6
							var:fighting_guilds_option_1 = 7
						}
					}
					building_pastures_requirement_terrain = yes
					NOT = { has_building_or_higher = pastures_01 }
				}
				random_list = {
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 4
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 5
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 6
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 7
						}
					}
				}
			}
			10 = { # Butchers/Furriers/Skinners Guild (Hunting Grounds)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOR = { 
							var:fighting_guilds_option_1 = 8
							var:fighting_guilds_option_1 = 9
							var:fighting_guilds_option_1 = 10
						}
					}
					building_hunting_grounds_requirement_terrain = yes
					NOT = { has_building_or_higher = hunting_grounds_01 }
				}
				random_list = {
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 8
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 9
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 10
						}
					}
				}
			}
			10 = { # Vintners Guild (Orchards)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 11 }
					}
					building_orchards_requirement_terrain = yes
					NOT = { has_building_or_higher = orchards_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 11
				}
			}
			10 = { # Carpenters Guild (Logging Camps)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 12 }
					}
					building_logging_camps_requirement_terrain = yes
					NOT = { has_building_or_higher = logging_camps_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 12
				}
			}
			10 = { # Masons/Miners Guild (Quarries)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOR = { 
							var:fighting_guilds_option_1 = 13 
							var:fighting_guilds_option_1 = 14 
						}
					}
					building_quarries_requirement_terrain = yes
					NOT = { has_building_or_higher = quarries_01 }
				}
				random_list = {
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 13
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 14
						}
					}
				}
			}
			10 = { # Blacksmiths Guild (Blacksmith)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 15 }
					}
					building_smiths_requirement_terrain = yes
					NOT = { has_building_or_higher = smiths_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 15
				}
			}
			10 = { # Saddlers Guild (Stables)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 16 }
					}
					building_stables_requirement_terrain = yes
					NOT = { has_building_or_higher = stables_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 16
				}
			}
			10 = { # Merchants Guild (Guild Halls)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 17 }
					}
					has_building_or_higher = city_01
					NOT = { has_building_or_higher = guild_halls_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 17
				}
			}
			10 = { # Physicians/Pharmacists Guild (Hospices)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOR = {
							var:fighting_guilds_option_1 = 18
							var:fighting_guilds_option_1 = 19
						}
					}
					NOT = { has_building_or_higher = hospices_01 }
				}
				random_list = {
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 18
						}
					}
					10 = {
						set_variable = {
							name = fighting_guilds_option_$VALUE$
							value = 19
						}
					}
				}
			}
			10 = { # Toolmakers Guild (Workshops)
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 20 }
					}
					building_workshops_requirement_terrain = yes
					culture = {
						has_innovation = innovation_advanced_bowmaking
					}
					NOT = { has_building_or_higher = workshops_01 }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 20
				}
			}
			1 = { # Fallback - Innkeepers Guild
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 21 }
					}
					NOT = { has_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 21
				}
			}
			1 = { # Fallback - Artists Guild
				trigger = {
					trigger_if = {
						limit = {
							has_variable = fighting_guilds_option_1
						}
						NOT = { var:fighting_guilds_option_1 = 22 }
					}
					NOT = { has_province_modifier = inspection_fighting_guilds_artists_guild_modifier }
				}
				set_variable = {
					name = fighting_guilds_option_$VALUE$
					value = 22
				}
			}
		}
	}
}

inspection_fighting_guilds_setup_reward_effect = {
	switch = {
		trigger = var:fighting_guilds_option_$VALUE$
		1 = { add_building = watermills_01 }
		2 = { add_building = windmills_01 }
		3 = { add_building = common_tradeport_01 }
		4 = { add_building = pastures_01 }
		5 = { add_building = pastures_01 }
		6 = { add_building = pastures_01 }
		7 = { add_building = pastures_01 }
		8 = { add_building = hunting_grounds_01 }
		9 = { add_building = hunting_grounds_01 }
		10 = { add_building = hunting_grounds_01 }
		11 = { add_building = orchards_01 }
		12 = { add_building = logging_camps_01 }
		13 = { add_building = quarries_01 }
		14 = { add_building = quarries_01 }
		15 = { add_building = smiths_01 }
		16 = { add_building = stables_01 }
		17 = { add_building = guild_halls_01 }
		18 = { add_building = hospices_01 }
		19 = { add_building = hospices_01 }
		20 = { add_building = workshops_01 }
		21 = {
			scope:city_province = {
				add_province_modifier = inspection_fighting_guilds_innkeepers_guild_modifier
			}
		}
		22 = {
			scope:city_province = {
				add_province_modifier = inspection_fighting_guilds_artists_guild_modifier
			}
		}
	}
}

inspection_survey_intent_development = {
	if = {
		limit = {
			has_activity_intent = survey_learning_intent
		}
		capital_county = {
			change_development_progress_with_overflow = $VALUE$
		}
	}
}

inspection_survey_intent_control = {
	if = {
		limit = {
			has_activity_intent = survey_learning_intent
			capital_county = { county_control < 100 }
		}
		capital_county = {
			change_county_control = $VALUE$
		}
	}
	else = {
		inspection_survey_intent_development = { VALUE = $VALUE$ }
	}
}

inspection_survey_intent_county_modifier = {
	if = {
		limit = {
			has_activity_intent = survey_learning_intent
			capital_county = {
				NOT = { has_county_modifier = $MODIFIER$ }
			}
		}
		capital_county = {
			add_county_modifier = {
				modifier = $MODIFIER$
				years = 5
			}
		}
	}
	else = {
		inspection_survey_intent_development = { VALUE = 5 }
	}
}

inspection_survey_intent_province_modifier = {
	if = {
		limit = {
			has_activity_intent = survey_learning_intent
			capital_barony.title_province = {
				NOT = { has_province_modifier = $MODIFIER$ }
			}
		}
		capital_barony.title_province = {
			add_province_modifier = {
				modifier = $MODIFIER$
				years = 5
			}
		}
	}
	else = {
		inspection_survey_intent_development = { VALUE = 5 }
	}
}

inspection_survey_local_message_county_modifier = {
	hidden_effect = {
		if = {
			limit = {
				scope:province.county.holder != scope:host
			}
			scope:province.county.holder = {
				send_interface_message = {
					type = send_interface_$TYPE$
					title = bp3_survey_liege_intervention

					show_as_tooltip = {
						scope:province.county = {
							add_county_modifier = {
								modifier = $MODIFIER$
								years = $YEARS$
							}
						}
					}
				}
			}
		}
	}
}

inspection_survey_local_message_province_modifier = {
	hidden_effect = {
		if = {
			limit = {
				scope:province.county.holder != scope:host
			}
			scope:province.county.holder = {
				send_interface_message = {
					type = send_interface_$TYPE$
					title = bp3_survey_liege_intervention

					show_as_tooltip = {
						scope:province = {
							add_province_modifier = {
								modifier = $MODIFIER$
								years = $YEARS$
							}
						}
					}
				}
			}
		}
	}
}

inspection_survey_local_message_permanent_province_modifier = {
	hidden_effect = {
		if = {
			limit = {
				scope:province.county.holder != scope:host
			}
			scope:province.county.holder = {
				send_interface_message = {
					type = send_interface_$TYPE$
					title = bp3_survey_liege_intervention

					show_as_tooltip = {
						scope:province = {
							add_province_modifier = $MODIFIER$
						}
					}
				}
			}
		}
	}
}

inspection_survey_local_message_specific_location_province_modifier = {
	hidden_effect = {
		if = {
			limit = {
				county.holder != scope:host
			}
			save_scope_as = saved_province
			county.holder = {
				send_interface_message = {
					type = send_interface_$TYPE$
					title = bp3_survey_liege_intervention

					show_as_tooltip = {
						scope:saved_province = {
							add_province_modifier = {
								modifier = $MODIFIER$
								years = $YEARS$
							}
						}
					}
				}
			}
		}
	}
}

court_brewmaster_assign_modifier_positive_effect = {
	send_interface_message = {
		type = send_interface_message_good
		title = experimental_brew_title
		right_icon = root

		add_character_modifier = {
			modifier = experimental_brew_$MODIFIER$_modifier
			months = 6
		}
	}
}

brewery_counter_effect = {
	county = {
		if = {
			limit = {
				has_variable = brewery_counter_var 
				NOT = {
					any_county_province = {
						has_building_or_higher = breweries_01
					}
				}
			}
			remove_variable = brewery_counter_var
		}
		else_if = {
			limit = {
				NOT = { has_variable = brewery_counter_var }
				any_county_province = { has_building_or_higher = breweries_01 }
			}
			set_variable = {
				name = brewery_counter_var
				value = current_year
			}
		}
	}
}

brewery_counter_start_effect = {
	if = {
		limit = {
			has_building_or_higher = breweries_01
		}
		county = {
			set_variable = {
				name = brewery_counter_var
				value = {
					value = current_year
					subtract = { integer_range = { min = 1 max = 80 } }
				}
			}
		}
	}
}

souvenirs_aplenty_gallowsbait_effect = {
	send_interface_message = {
		type = event_generic_good
		title = souvenirs_aplenty_perk_name
		left_icon = root
		
		add_gold = 25
		add_trait_xp = {
			trait = gallowsbait
			track = $TRACK$
			value = 5
		}
	}
}

landless_inspector_assign_terrain_effect = {
	if = {
		limit = {
			has_perk = no_stone_unturned_perk
			government_has_flag = government_is_landless_adventurer
		}
		add_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier
	}
	else_if = {
		limit = {
			has_perk = no_stone_unturned_perk
			government_has_flag = government_is_nomadic
		}
		add_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier
	}
	else_if = {
		limit = {
			has_perk = local_inspection_perk
			government_has_flag = government_is_landless_adventurer
		}
		add_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier
	}
	else_if = {
		limit = {
			has_perk = local_inspection_perk
			government_has_flag = government_is_nomadic
		}
		add_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier
	}
	else_if = {
		limit = {
			has_perk = mustering_the_troops_perk
		}
		add_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
	}
	else = {
		landless_inspector_remove_terrain_effect = yes
	}
}

landless_inspector_upgrade_terrain_tier_effect = {
	landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = woodlands}
	landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = highlands}
	landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = lowlands }
	landless_inspector_upgrade_terrain_tier_extrapolated_effect = { TERRAIN = drylands }
}

landless_inspector_upgrade_terrain_tier_extrapolated_effect = {
	if = {
		limit = {
			has_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier
			has_perk = no_stone_unturned_perk
			government_has_flag = government_is_landless_adventurer
		}
		remove_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier
		add_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier
	}
	else_if = {
		limit = {
			has_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
			has_perk = local_inspection_perk
			government_has_flag = government_is_landless_adventurer
		}
		remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
		add_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier
	}
	if = {
		limit = {
			has_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier
			has_perk = no_stone_unturned_perk
			government_has_flag = government_is_nomadic
		}
		remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier
		add_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier
	}
	else_if = {
		limit = {
			has_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
			has_perk = local_inspection_perk
			government_has_flag = government_is_nomadic
		}
		remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
		add_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier
	}
}

landless_inspector_remove_terrain_effect = {
	hidden_effect = {
		landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = woodlands }
		landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = highlands }
		landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = lowlands }
		landless_inspector_remove_terrain_extrapolated_effect = { TERRAIN = drylands }
	}
}

landless_inspector_remove_master_terrain_effect = {
	hidden_effect = {
		remove_character_modifier = master_terrain_forest_modifier
		remove_character_modifier = master_terrain_jungle_modifier
		remove_character_modifier = master_terrain_taiga_modifier
		remove_character_modifier = master_terrain_wetlands_modifier

		remove_character_modifier = master_terrain_mountains_modifier
		remove_character_modifier = master_terrain_hills_modifier
		remove_character_modifier = master_terrain_desert_mountains_modifier		

		remove_character_modifier = master_terrain_plains_modifier
		remove_character_modifier = master_terrain_steppe_modifier
		remove_character_modifier = master_terrain_farmlands_modifier
		remove_character_modifier = master_terrain_floodplains_modifier

		remove_character_modifier = master_terrain_drylands_modifier
		remove_character_modifier = master_terrain_desert_modifier
		remove_character_modifier = master_terrain_oasis_modifier
	}
}

landless_inspector_remove_terrain_extrapolated_effect = {
	remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_3_modifier
	remove_character_modifier = nomadic_inspector_$TERRAIN$_tier_2_modifier
	remove_character_modifier = landless_inspector_$TERRAIN$_tier_3_modifier
	remove_character_modifier = landless_inspector_$TERRAIN$_tier_2_modifier
	remove_character_modifier = landless_inspector_$TERRAIN$_tier_1_modifier
}

local_arbitration_boon_logic_purpose_effect = {
	hidden_effect = {
		if = {
			limit = {
				has_perk = local_arbitration_perk
			}
			if = {
				limit = {
					has_realm_law = camp_purpose_wanderers
				}
				add_character_modifier = landless_local_arbitration_wanderers_modifier
			}
			else_if = {
				limit = {
					has_realm_law = camp_purpose_mercenaries
				}
				add_character_modifier = landless_local_arbitration_mercenaries_modifier
			}
			else_if = {
				limit = {
					has_realm_law = camp_purpose_scholars
				}
				add_character_modifier = landless_local_arbitration_scholars_modifier
			}
			else_if = {
				limit = {
					has_realm_law = camp_purpose_explorers
				}
				add_character_modifier = landless_local_arbitration_explorers_modifier
			}
			else_if = {
				limit = {
					has_realm_law = camp_purpose_brigands
				}
				add_character_modifier = landless_local_arbitration_brigands_modifier
			}
			else_if = {
				limit = {
					has_realm_law = camp_purpose_legitimists
				}
				add_character_modifier = landless_local_arbitration_legitimists_modifier
			}
			else_if = {
				limit = {
					has_government = landless_adventurer_government
				}
				add_character_modifier = landless_local_arbitration_wanderers_modifier
			}
		}
	}
}

local_arbitration_boon_change_purpose_effect = {
	hidden_effect = {
		local_arbitration_boon_remove_purpose_effect = yes

		local_arbitration_boon_logic_purpose_effect = yes
	}
}

local_arbitration_boon_set_purpose_effect = {
	hidden_effect = {
		local_arbitration_boon_remove_purpose_effect = yes

		if = {
			limit = {
				has_perk = local_arbitration_perk
			}
			add_character_modifier = $MODIFIER$
		}
	}
}

local_arbitration_boon_remove_purpose_effect = {
	remove_character_modifier = landless_local_arbitration_wanderers_modifier
	remove_character_modifier = landless_local_arbitration_mercenaries_modifier
	remove_character_modifier = landless_local_arbitration_scholars_modifier
	remove_character_modifier = landless_local_arbitration_explorers_modifier
	remove_character_modifier = landless_local_arbitration_brigands_modifier
	remove_character_modifier = landless_local_arbitration_legitimists_modifier
}

remove_all_landless_inspector_modifiers = {
	hidden_effect = {
		local_arbitration_boon_remove_purpose_effect = yes
		landless_inspector_remove_terrain_effect = yes
		landless_inspector_remove_master_terrain_effect = yes
	}
}

landless_inspector_cleanup_modifier = {
	if = {
		limit = {
			has_perk = mustering_the_troops_perk
		}
		if = {
			limit = {
				NOR = {
					government_has_flag = government_is_nomadic
					is_landless_adventurer = yes
				}
			}
			remove_all_landless_inspector_modifiers = yes
		}
	}
}

landless_inspector_master_terrain_effect = {
	hidden_effect = {
		add_character_modifier = master_terrain_$TERRAIN$_modifier
	}
	custom_tooltip = master_terrain_custom_tooltip_$TERRAIN$
	custom_description = {
		text = personal_touch_3_effect
	}
}

merge_aquitaine_effect = {
	title:$PRIMARY$ = {
		save_scope_as = rightful_title
		every_in_de_jure_hierarchy = {
			custom = merge_aquitaine_decision_vassal_$TEXT$
			limit = {
				tier < tier_kingdom
			}
			holder ?= {
				if = {
					limit = {
						NOR = { 
							is_in_list = merge_aquitaine_list 
							this = root
						}
					}
					add_opinion = {
						modifier = rightful_king_opinion
						target = root
						opinion = 20
					}
					add_to_temporary_list = merge_aquitaine_list
				}
			}
			custom_tooltip = merge_aquitaine_opinion
		}
	}
	title:$SECONDARY$ = {
		save_scope_as = destroyed_title
		every_in_de_jure_hierarchy = {
			custom = merge_aquitane_culture_tooltip_$TEXT$
			limit = {
				tier = tier_county
			}
			hidden_effect = {
				culture ?= {
					if = {
						limit = {
							NOR = { 
								is_in_list = merge_aquitaine_list 
								this = root.culture
								any_parent_culture_or_above = { this = root.culture }
							}
						}
						change_cultural_acceptance = {
							target = root.culture
							value = -25
							desc = cultural_acceptance_merge_aquitaine
						}
						add_to_list = merge_aquitaine_list
					}
				}
			}
			custom_tooltip = merge_aquitaine_culture_tooltip
		}
		every_in_de_jure_hierarchy = {
			custom = merge_aquitaine_decision_tooltip_$TEXT$
			limit = {
				tier = tier_duchy
			}
			hidden_effect = { set_de_jure_liege_title = title:$PRIMARY$ }
			custom_tooltip = merge_aquitaine_decision_tooltip_2_$TEXT$
		}
	}
	destroy_title = title:$SECONDARY$
}

hire_for_court_position_journey_effect = {
	hidden_effect = {
		$CHARACTER$ = {
			add_to_court_and_entourage_effect = yes
		}
		if = {
			limit = {
				any_court_position_holder = {
					type = $COURT_POSITION$_court_position
				}
			}
			random_court_position_holder = {
				type = $COURT_POSITION$_court_position
				save_scope_as = current_holder
			}
		}
	}

	show_as_tooltip = {
		if = {
			limit = {
				is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
				trigger_if = {
					limit = {
						exists = scope:current_holder
					}
					$CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position
				}
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $COURT_POSITION$_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else = {
			$CHARACTER$ = {
				add_to_court_and_entourage_effect = yes
			}
		}
	}
	
	if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			OR = {
				NOT = { exists = scope:current_holder }
				trigger_if = {
					limit = {
						has_character_flag = bodyguard_flag
					}
					any_court_position_holder = {
						type = bodyguard_court_position
						count <= 1
					}
				}
			}
		}
		employ_character_as_position_in_current_scope_court_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $COURT_POSITION$
		}
	}
	else_if = {
		limit = {
			exists = scope:current_holder
			$CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $COURT_POSITION$_court_position
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	
	if = {
		limit = {
			has_activity_intent = journey_curiosity_intent
		}
		add_hook = {
			type = strong_obligation_hook
			target = $CHARACTER$
		}
		custom_tooltip = obligation_hook_tt
	}
}

hire_for_court_position_journey_laamp_replacement_effect = {
	show_as_tooltip = {
		if = {
			limit = {
				is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $COURT_POSITION$_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else_if = {
			limit = {
				is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $LAAMP_POSITION$_camp_officer
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else = {
			$CHARACTER$ = {
				add_to_court_and_entourage_effect = yes
			}
		}
	}
	
	hidden_effect = {
		$CHARACTER$ = {
			add_to_court_and_entourage_effect = yes
		}
	}
	
	if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			NOT = { exists = scope:current_holder }
		}
		employ_character_as_position_in_current_scope_court_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $COURT_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			NOT = { exists = scope:current_holder }
		}
		employ_character_as_position_in_current_scope_camp_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $LAAMP_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			exists = scope:current_holder
			$CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $COURT_POSITION$_court_position
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			exists = scope:current_holder
			$CHARACTER$.aptitude:$LAAMP_POSITION$_camp_officer > scope:current_holder.aptitude:$LAAMP_POSITION$_camp_officer
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $LAAMP_POSITION$_camp_officer
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	
	add_hook = {
		type = strong_obligation_hook
		target = $CHARACTER$
	}
	custom_tooltip = obligation_hook_tt
}

hire_for_two_court_position_journey_laamp_replacement_effect = {
	show_as_tooltip = {
		if = {
			limit = {
				is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $COURT_POSITION$_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else_if = {
			limit = {
				is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $COURT_POSITION_2$_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else_if = {
			limit = {
				is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $LAAMP_POSITION$_camp_officer
			}
			custom_tooltip = will_have_excellent_aptitude
		}
	}
	
	hidden_effect = {
		$CHARACTER$ = {
			add_to_court_and_entourage_effect = yes
		}
	}
	
	if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			NOT = { exists = scope:current_holder }
		}
		employ_character_as_position_in_current_scope_court_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $COURT_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position
			NOT = { exists = scope:current_holder }
		}
		employ_character_as_position_in_current_scope_court_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $COURT_POSITION_2$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			NOT = { exists = scope:current_holder }
		}
		employ_character_as_position_in_current_scope_camp_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $LAAMP_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			exists = scope:current_holder
			$CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder.aptitude:$COURT_POSITION$_court_position
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $COURT_POSITION$_court_position
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION_2$_court_position
			exists = scope:current_holder
			$CHARACTER$.aptitude:$COURT_POSITION_2$_court_position > scope:current_holder.aptitude:$COURT_POSITION_2$_court_position
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $COURT_POSITION_2$_court_position
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			exists = scope:current_holder
			$CHARACTER$.aptitude:$LAAMP_POSITION$_camp_officer > scope:current_holder.aptitude:$LAAMP_POSITION$_camp_officer
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder
			court_position = $LAAMP_POSITION$_camp_officer
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	
	add_hook = {
		type = strong_obligation_hook
		target = $CHARACTER$
	}
	custom_tooltip = obligation_hook_tt
}

hire_for_court_position_journey_laamp_replacement_effect_2 = {
	show_as_tooltip = {
		if = {
			limit = {
				is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $COURT_POSITION$_court_position
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else_if = {
			limit = {
				is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			}
			appoint_court_position = {
				recipient = $CHARACTER$
				court_position = $LAAMP_POSITION$_camp_officer
			}
			custom_tooltip = will_have_excellent_aptitude
		}
		else = {
			$CHARACTER$ = {
				add_to_court_and_entourage_effect = yes
			}
		}
	}
	
	hidden_effect = {
		$CHARACTER$ = {
			add_to_court_and_entourage_effect = yes
		}
	}
	
	if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			NOT = { exists = scope:current_holder_2 }
		}
		employ_character_as_position_in_current_scope_court_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $COURT_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			NOT = { exists = scope:current_holder_2 }
		}
		employ_character_as_position_in_current_scope_camp_effect = {
			CHARACTER = $CHARACTER$
			POSITION = $LAAMP_POSITION$
		}
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $COURT_POSITION$_court_position
			exists = scope:current_holder_2
			$CHARACTER$.aptitude:$COURT_POSITION$_court_position > scope:current_holder_2.aptitude:$COURT_POSITION$_court_position
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder_2
			court_position = $COURT_POSITION$_court_position
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	else_if = {
		limit = {
			is_valid_to_hire_court_position_type = $LAAMP_POSITION$_camp_officer
			exists = scope:current_holder_2
			$CHARACTER$.aptitude:$LAAMP_POSITION$_camp_officer > scope:current_holder_2.aptitude:$LAAMP_POSITION$_camp_officer
		}
		add_character_flag = temporary_court_position_cost_removal
		replace_court_position = {
			recipient = $CHARACTER$
			holder = scope:current_holder_2
			court_position = $LAAMP_POSITION$_camp_officer
		}
		remove_character_flag = temporary_court_position_cost_removal
	}
	
	add_hook = {
		type = strong_obligation_hook
		target = $CHARACTER$
	}
	custom_tooltip = obligation_hook_tt
}
