﻿
# Remove another House from your Bloc
kick_from_house_bloc_interaction = {
	category = interaction_category_diplomacy
	use_diplomatic_range = no
	common_interaction = yes

	desc = kick_from_house_bloc_interaction_desc

	icon = icon_remove_from_bloc

	cooldown = { months = 0 }

	cost = {
		influence = {
			value = 0
			if = {
				limit = { scope:actor = { government_allows = administrative } }
				add = 50
			}
		}
		prestige = {
			value = 0
			if = {
				limit = { NOT = { scope:actor = { government_allows = administrative } } }
				add = 100
			}
		}
	}

	redirect = {
		if = {
			limit = {
				exists = scope:recipient.house.house_head
				scope:recipient = { is_house_head = no }
			}
			scope:recipient.house.house_head = { save_scope_as = recipient }
		}
	}

	is_available = {
		house.house_head ?= this
		house.house_confederation.leading_house = house
		tgp_house_bloc_interaction_valid_trigger = yes
	}

	is_shown = {
		exists = scope:actor.house
		exists = scope:recipient.house
		scope:actor.house != scope:recipient.house
		scope:recipient.house.house_confederation ?= scope:actor.house.house_confederation # Also works on self
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
			custom_tooltip = {
				text = must_be_leader_of_bloc_trigger
				confederation.leading_house ?= house
			}
			custom_tooltip = {
				text = must_not_be_involved_in_war_together_trigger
				NOT = {
					any_character_war = {
						any_war_participant = { this = scope:recipient }
					}
				}
			}
		}
		scope:recipient = {
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
			NOT = { has_usable_hook = scope:actor }
		}
	}

	auto_accept = yes

	on_accept = {
		scope:recipient.house = {
			tgp_leave_house_bloc_effect = {
				OPINION = flag:no
				TRUCE = flag:yes
			}
			house_head ?={
				if = {
					limit = {
						is_ai = yes
						exists = scope:leader.house_head
					}
					add_opinion = {
						modifier = kicked_from_house_bloc_opinion
						target = scope:leader.house_head
						opinion = -25
					}
				}
			}
			change_house_relation_effect = {
				HOUSE = scope:leaver
				VALUE = house_relation_damage_major_value
				REASON = kicked_from_bloc
				CHAR = scope:actor
				TARGET_CHAR = scope:recipient
				TITLE = scope:dummy_gender
			}
		}
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 12
		duchy = 12
		kingdom = 6
		empire = 6
		hegemony = 0
	}

	ai_targets = {
		ai_recipients = confederation_house_heads
		max = 25
	}

	ai_will_do = {
		base = -75
		#Opinions
 		opinion_modifier = {
 			opinion_target = scope:recipient.house.house_head
 			multiplier = -0.5
 			step = 5
 			max = 25
 		}
 		# House Relations
 		house_relation_ai_accept_modifiers = { # House Relations
 			HOUSE_1_MEMBER = scope:actor
 			HOUSE_2_MEMBER = scope:recipient
 			MULTIPLIER = -1
 		}
 		modifier = {
 			add = {
 				value = 0
 				scope:recipient.house = {
 					every_house_relation = {
 						limit = {
 							any_relation_house = {
 								NOT = { this = scope:recipient.house }
 								house_confederation = scope:actor.house.house_confederation
 							}
 						}
 						if = {
 							limit = { has_house_relation_level = quarrel }
 							add = 10
 						}
 						else_if = {
 							limit = { has_house_relation_level = rivalry }
 							add = 20
 						}
 						else_if = {
 							limit = { has_house_relation_level = feud }
 							add = 30
 						}
 					}
 				}
 			}
 		}
		modifier = { # Kick out landless houses
			exists = scope:recipient.house
			scope:recipient = {
				is_landed = no
				NOT = {
					any_close_family_member = {
						house = scope:recipient.house
						is_landed = yes
					}
				}
			}
			add = 50
		}
		modifier = {
			exists = scope:recipient.house
			NOT = {
				scope:actor.house ?= { has_same_house_power_as = scope:recipient.house }
			}
			add = 50
		}
		modifier = {
			exists = scope:recipient.house.house_head
			NOT = {
				scope:actor.house.house_head ?= { has_same_government = scope:recipient.house.house_head }
			}
			add = 75
		}
	}
}

# Improve House Relation Perk Interaction
improve_house_relation_in_bloc_interaction = {
	category = interaction_category_diplomacy
	use_diplomatic_range = no
	common_interaction = yes

	greeting = positive
	desc = improve_house_relation_in_bloc_interaction_desc

	icon = icon_grant_bloc_leadership

	cooldown = { months = 0 }

	redirect = {
		scope:recipient.house.house_head ?= { save_scope_as = recipient }
	}

	cost = {
		gold = scope:actor.medium_gold_value
		influence = {
			value = 0
			if = {
				limit = { scope:actor = { government_has_flag = government_has_influence } }
				add = 50
			}
		}
		prestige = {
			value = 0
			if = {
				limit = { NOT = { scope:actor = { government_has_flag = government_has_influence } } }
				add = 100
			}
		}
	}

	is_shown = {
		scope:actor = {
			dynasty ?= { has_dynasty_perk = tgp_japan_legacy_3 }
			tgp_house_bloc_interaction_valid_trigger = yes
			is_house_head = yes
			exists = confederation
			confederation.leading_house = house
		}
		scope:recipient = {
			house.house_confederation ?= scope:actor.house.house_confederation
			NOT = { house ?= scope:actor.house }
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			NOT = { is_at_war_with = scope:recipient }
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
			custom_tooltip = {
				text = has_to_have_negative_house_relations_tt
				house = {
					any_house_relation = {
						OR = {
							has_house_relation_level = quarrel
							has_house_relation_level = rivalry
							has_house_relation_level = feud
						}
						any_relation_house = { this = scope:recipient.house }
					}
				}
			}
		}
		scope:recipient = {
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
		}
	}

	auto_accept = yes

	on_accept = {
		scope:actor.house = {
			change_house_relation_effect = {
				HOUSE = scope:recipient.house
				VALUE = house_relation_improve_major_value
				REASON = perk_interaction
				CHAR = scope:actor
				TARGET_CHAR = scope:recipient
				TITLE = scope:dummy_gender
			}
		}
		if = {
			limit = {
				scope:actor.house = {
					any_house_relation = {
						any_relation_house = { this = scope:recipient.house }
						has_house_relation_level = quarrel
					}
				}
			}
			custom_tooltip = house_relation_perk_interaction_quarrel_effect
		}
		else_if = {
			limit = {
				any_house_relation = {
					any_relation_house = { this = scope:recipient.house }
					has_house_relation_level = rivalry
				}
			}
			custom_tooltip = house_relation_perk_interaction_rivalry_effect
		}
		else = {
			custom_tooltip = house_relation_perk_interaction_feud_effect
		}
	}

	ai_potential = {
		is_house_head = yes
		tgp_uses_house_blocs_trigger = yes
		government_is_japanese_trigger = yes
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 24
		duchy = 24
		kingdom = 12
		empire = 12
		hegemony = 0
	}

	ai_targets = {
		ai_recipients = confederation_house_heads
		max = 25
	}

	ai_will_do = {
		base = -50
		#Opinions
 		house_relation_ai_accept_modifiers = { # House Relations
 			HOUSE_1_MEMBER = scope:actor
 			HOUSE_2_MEMBER = scope:actor.house.house_confederation.leading_house.house_head
 			MULTIPLIER = -1
 		}
	}
}

# Demand Aspiration change in bloc
demand_aspiration_change_interaction = {
	category = interaction_category_diplomacy
	use_diplomatic_range = no
	common_interaction = yes
	send_options_exclusive = no

	greeting = positive
	notification_text = DEMAND_ASPIRATION_CHANGE_NOTIFICATION
	desc = demand_aspiration_change_interaction_desc

	icon = icon_invite_to_bloc

	cooldown_against_recipient = { years = 0 }

	cost = {
		influence = {
			value = 0
			if = {
				limit = { scope:actor = { government_allows = administrative } }
				add = 50
				if = {
					limit = {
						scope:actor.dynasty = scope:recipient.dynasty
					}
					multiply = 0.5
				}
			}
		}
		prestige = {
			value = 0
			if = {
				limit = {
					NOT = { scope:actor = { government_allows = administrative } }
				}
				add = 100
				if = {
					limit = {
						scope:actor.dynasty = scope:recipient.dynasty
					}
					multiply = 0.5
				}
			}
		}
	}

	redirect = {
		scope:recipient = {
			if = {
				limit = {
					is_house_head = no
					exists = house.house_head
				}
				house.house_head = { save_scope_as = recipient }
			}
		}
	}

	is_shown = {
		scope:actor = {
			this != scope:recipient
			is_house_head = yes
			top_liege = scope:recipient.top_liege
			tgp_house_bloc_interaction_valid_trigger = yes
			house.house_confederation.leading_house = house
			trigger_if = { # Same confederation
				limit = { exists = house.house_confederation }
				scope:recipient.house.house_confederation ?= house.house_confederation
			}
		}
		scope:recipient = { tgp_house_bloc_interaction_valid_trigger = yes }
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_at_war = no
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
			custom_tooltip = {
				text = demand_aspiration_change_interaction_power_tt
				NOT = {
					house = { has_same_house_power_as = scope:recipient.house }
				}
			}
		}
		scope:recipient = {
			is_at_war = no
			tgp_house_bloc_interaction_valid_showing_failures_trigger = yes
		}
	}

	# Use gold
	send_option = {
		is_valid = { scope:actor.gold >= scope:recipient.medium_gold_value }
		flag = gold
		localization = TRADE_GOLD_FOR_BETTER_AI_ACCEPTANCE
	}
	# Use prestige
	send_option = {
		is_valid = { scope:actor.prestige >= scope:recipient.medium_prestige_value }
		flag = prestige
		localization = TRADE_PRESTIGE_FOR_BETTER_AI_ACCEPTANCE
	}
	# Use influence
	send_option = {
		is_valid = {
			scope:actor = { government_has_flag = government_has_influence }
			scope:actor.influence >= scope:recipient.medium_influence_value
		}
		flag = influence
		localization = TRADE_INFLUENCE_FOR_BETTER_AI_ACCEPTANCE
	}
	## Offer a hook
	send_option = {
		flag = offer_hook
		is_valid = {
			custom_tooltip = {
				text = offer_hook.tt.cannot_offer_both_hooks
				scope:offer_hook_strong = no
			}
			NOT = {
				scope:recipient = { has_hook = scope:actor }
			}
		}
		localization = SCHEME_AGENT_HOOK
	}
	# Offer a strong hook
	send_option = {
		flag = offer_hook_strong
		is_shown = {
			scope:actor = { has_trait_with_flag = can_offer_strong_hook_to_agents }
		}
		is_valid = {
			custom_tooltip = {
				text = offer_hook.tt.cannot_offer_both_hooks
				scope:offer_hook = no
			}
			NOT = {
				scope:recipient = { has_strong_hook = scope:actor }
			}
		}
		localization = SCHEME_AGENT_HOOK_STRONG
	}
	# Use hook
	send_option = {
		is_valid = { scope:actor = { has_usable_hook = scope:recipient } }
		flag = hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	on_accept = {
		scope:recipient.house = { save_scope_as = house }
		scope:actor = {
			# HOOK
			if = {
				limit = { scope:hook = yes }
				use_hook = scope:recipient
			}
			# BRIBES
			else = {
				if = {
					limit = { scope:gold = yes }
					pay_short_term_gold = {
						target = scope:recipient
						gold = scope:recipient.medium_gold_value
					}
				}
				if = {
					limit = { scope:prestige = yes }
					add_prestige = scope:recipient.medium_prestige_loss
					scope:recipient = { add_prestige = medium_prestige_value }
				}
				if = {
					limit = { scope:influence = yes }
					change_influence = scope:recipient.medium_influence_loss
					scope:recipient = { change_influence = medium_influence_gain }
				}
				if = { # Offer Hook
					limit = { scope:offer_hook = yes }
					scope:recipient = {
						add_hook = {
							type = favor_hook
							target = scope:actor
						}
					}
				}
				if = { # Offer Strong Hook
					limit = { scope:offer_hook_strong = yes }
					scope:recipient = {
						add_hook = {
							type = strong_favor_hook
							target = scope:actor
						}
					}
				}
			}
			house = {
				switch = {
					trigger = has_house_power_parameter
					ceremony_cheaper_feasts = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = ceremony_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = ceremony } }
						}
					}
					unlocks_japanese_manor_watch_house = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = determination_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = determination } }
						}
					}
					unlocks_japanese_manor_shrine = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = humility_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = humility } }
						}
					}
					unlocks_japanese_manor_brewery = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = prosperity_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = prosperity } }
						}
					}
					unlocks_japanese_manor_archive = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = service_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = service } }
						}
					}
					unlocks_japanese_manor_armory = {
						if = {
							limit = {
								has_government = feudal_government
							}
							scope:house = { set_house_aspiration = { type = strength_feudal } }
						}
						else = {
							scope:house = { set_house_aspiration = { type = strength } }
						}
					}
				}
				set_variable = {
					name = recently_changed_aspiration
					years = 5
				}
			}
		}
	}

	on_decline = {
		scope:recipient = {
			add_character_flag = {
				flag = demanded_aspiration_change_recently
				years = 4
			}
		}
	}

	ai_accept = {
 		base = -20
 		opinion_modifier = {
 			who = scope:recipient
 			opinion_target = scope:actor
 			multiplier = 1
 		}
 		# They are a Cadet House of my Dynasty
 		modifier = {
 			scope:recipient.dynasty = scope:actor.dynasty
 			add = 50
			desc = AI_SAME_DYNASTY_REASON
 		}
 		# Bribes
 		modifier = {
 			scope:gold = yes
 			add = 25
			desc = TRADE_GOLD_FOR_BETTER_AI_ACCEPTANCE_TT
 		}
 		modifier = {
 			scope:prestige = yes
 			add = 25
			desc = PRESTIGE_INTERACTION_ACCEPTANCE_SEND_OPTION
 		}
 		modifier = {
 			scope:influence = yes
 			add = 25
			desc = INFLUENCE_INTERACTION_ACCEPTANCE_SEND_OPTION
 		}
		modifier = {
			add = 20
			scope:offer_hook = yes
			exists = scope:recipient
			desc = SCHEME_WITH_OFFER_HOOK
		}
		modifier = {
			add = 50
			scope:offer_hook_strong = yes
			exists = scope:recipient
			desc = SCHEME_WITH_OFFER_HOOK_STRONG
		}
	}

	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
		}
	}

	ai_potential = {
		is_house_head = yes
		tgp_uses_house_blocs_trigger = yes
		house.house_confederation.leading_house ?= house
		government_is_japanese_trigger = yes
	}

	ai_frequency_by_tier = {
		barony = 0
		county = 6
		duchy = 6
		kingdom = 6
		empire = 6
		hegemony = 0
	}

	ai_targets = {
		ai_recipients = liege
		ai_recipients = top_liege
		ai_recipients = scripted_relations
	}

	ai_targets = {
		ai_recipients = peer_vassals
		ai_recipients = vassals
		max = 25
	}

	ai_will_do = {
		base = -50
		# Rating
		modifier = {
			scope:recipient.house = {
				NOT = { has_same_house_power_as = scope:actor.house }
			}
			add = 100
		}
		modifier = {
			scope:actor.house.house_confederation.cohesion < 25
			add = 100
		}
		modifier = {
			scope:actor.house.house_confederation.cohesion < 50
			add = 100
		}
		modifier = { # Frequency
			factor = 0
			scope:recipient = { has_character_flag = demanded_aspiration_change_recently }
		}
	}
}

# Raid Estate
start_raid_estate_interaction = {
	icon = icon_raid_estate
	interface_priority = 90
	category = interaction_category_hostile
	send_name = START_SCHEME 
	scheme = raid_estate
	ignores_pending_interaction_block = yes
	ai_frequency_by_tier = {
		barony = 0
		county = 60
		duchy = 60
		kingdom = 24
		empire = 24
		hegemony = 24
	}

	ai_targets = { ai_recipients = liege }
	ai_targets = {
		ai_recipients = peer_vassals
		max = 20
	}
	ai_targets = {
		ai_recipients = vassals
		max = 20
	}

	filter_tags = { admin_house_head }

	cooldown = { years = 5 }

	highlighted_reason = start_raid_estate_interaction_HIGHLIGHTED

	is_highlighted = { scope:actor.var:raid_estate_permission ?= scope:recipient.house }

	redirect = {
		scope:recipient = {
			if = {
				limit = {
					is_house_head = no
					exists = house.house_head
				}
				house.house_head = { save_scope_as = recipient }
			}
		}
	}

	is_shown = {
		scope:actor = {
			domicile ?= {
				OR = {
					is_domicile_type = estate
					is_domicile_type = east_asian_estate
					is_domicile_type = japanese_manor
					is_domicile_type = feudal_domicile
				}
			}
		}
		scope:recipient.house.house_head ?= {
			domicile ?= {
				OR = {
					is_domicile_type = estate
					is_domicile_type = east_asian_estate
					is_domicile_type = japanese_manor
					is_domicile_type = feudal_domicile
				}
			}
			is_independent_ruler = no
			top_liege = scope:actor.top_liege
			house != scope:actor.house
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_available_adult = yes
			shared_raid_estate_participant_valid_trigger = yes
			trigger_if = {
				limit = {
					government_has_flag = government_is_celestial
					exists = var:movement_power
				}
				custom_tooltip = {
					text = actor_not_extremely_high_movement_power
					var:movement_power >= extremely_high_movement_power_value
				}
			}
		}
		scope:recipient.house.house_head ?= {
			shared_raid_estate_participant_valid_trigger = yes
			domicile ?= {
				trigger_if = {
					limit = { is_domicile_type = japanese_manor }
					custom_tooltip = {
						text = raid_estate_japanese_manor_tt
						is_domicile_type = japanese_manor
					}
				}
				trigger_else_if = {
					custom_tooltip = {
						text = raid_estate_estate_tt
						is_domicile_type = east_asian_estate
					}
				}
				trigger_else_if = {
					custom_tooltip = {
						text = raid_estate_estate_tt
						is_domicile_type = feudal_domicile
					}
				}
				trigger_else = {
					custom_tooltip = {
						text = raid_estate_estate_tt
						is_domicile_type = estate
					}
				}
			}
		}
		trigger_if = {
			limit = { scope:actor = { has_variable = no_scheming_allowed_var } }
			custom_tooltip = {
				text = no_scheming_allowed_var_tt
				scope:actor.var:no_scheming_allowed_var != scope:recipient
			}
		}
	}

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:recipient.domicile ?= { is_domicile_type = japanese_manor }
				}
				desc = start_raid_estate_interaction_desc_japan
			}
			desc = start_raid_estate_interaction_desc
		}
	}

	# Scheme Starter Packages
	options_heading = schemes.t.agent_packages
	send_options_exclusive = yes
	## Balanced agents.
	send_option = {
		flag = agent_focus_balance
		current_description = start_raid_estate_interaction.tt.agent_focus_balance
	}
	## Focused on Success Chance.
	send_option = {
		flag = agent_focus_success
		current_description = start_raid_estate_interaction.tt.agent_focus_success
	}
	## Focused on Speed.
	send_option = {
		flag = agent_focus_speed
		current_description = start_raid_estate_interaction.tt.agent_focus_speed
	}
	## Focused on Secrecy.
	send_option = {
		flag = agent_focus_secrecy
		current_description = start_raid_estate_interaction.tt.agent_focus_secrecy
	}

	on_accept = {
		scope:recipient = { 
			custom_tooltip = raid_estate_kill_maim_imprison_house_members_tt
			custom_tooltip = raid_estate_destroy_buildings_tt
			if = {
				limit = {
					domicile ?= { is_domicile_type = japanese_manor }
				}
				custom_tooltip = raid_estate_house_modifier_tt_japan
			}
			else = { custom_tooltip = raid_estate_house_modifier_tt }
			random_held_title = {
				limit = { is_noble_family_title = yes }
				save_scope_as = target_title
			}
		}
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = start_raid_estate_notification
				left_icon = scope:recipient					
				right_icon = scope:target_title
				# Success.
				if = {
					limit = { scope:agent_focus_success ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = raid_estate
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_scout
						AGENT_2 = agent_scout
						AGENT_3 = agent_muscle
						# Speed.
						AGENT_4 = agent_infiltrator
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Speed.
				else_if = {
					limit = { scope:agent_focus_speed ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = raid_estate
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Speed.
						AGENT_1 = agent_infiltrator
						AGENT_2 = agent_infiltrator
						AGENT_3 = agent_footpad
						# Success.
						AGENT_4 = agent_scout
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Secrecy.
				else_if = {
					limit = { scope:agent_focus_secrecy ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = raid_estate
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Secrecy.
						AGENT_1 = agent_lookout
						AGENT_2 = agent_lookout
						AGENT_3 = agent_alibi
						# Success.
						AGENT_4 = agent_scout
						# Speed.
						AGENT_5 = agent_infiltrator
					}
				}
				# Balanced.
				else = {
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = raid_estate
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_scout
						AGENT_2 = agent_muscle
						# Speed.
						AGENT_3 = agent_infiltrator
						AGENT_4 = agent_footpad
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
			}
			# Scheme progress bonus from education
			education_5_scheme_progress_effect = { SKILL = intrigue }
			# Scheme bonuses from being the emperor/dominant family/powerful family
			ep3_actor_scheme_modifier_effect = yes

			custom_tooltip = raid_estate_gain_coin_tt
			# Relations
			if = {
				limit = { has_relation_rival = scope:recipient }
				custom_tooltip = raid_estate_nemesis_relation_tt
			}
			else = { custom_tooltip = raid_estate_rival_relation_tt }
			# Catalysts
			if = {
				limit = {
					NOT = { var:raid_estate_permission ?= scope:recipient.house }
				}
				show_as_tooltip = {
					tgp_activate_catalyst_against_hegemon_effect = {
						HEGEMON = scope:recipient.top_liege
						CATALYST = catalyst_governor_raided_estate
					}
				}
			}
			# Stress
			stress_impact = {
				content = medium_stress_impact_gain
			}
			if = {
				limit = { has_relation_nemesis = scope:recipient }
				stress_impact = { base = major_stress_impact_loss }
			}
			else_if = {
				limit = { has_relation_rival = scope:recipient }
				stress_impact = { base = medium_stress_impact_loss }
			}
		}
	}

	ai_potential = {
		NOT = {
			any_scheme = { is_hostile = yes }
		}
		any_held_title = { is_noble_family_title = yes }
	}
	
	auto_accept = yes

	ai_will_do = {
		base = -20
		#Personality
		modifier = {
			has_trait = vengeful
			add = 15
		}
		modifier = {
			has_trait = forgiving
			add = -15
		}
		modifier = {
			has_trait = brave
			add = 15
		}
		modifier = {
			has_trait = craven
			add = -15
		}
		# Relationships
		modifier = {
			add = -25
			has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = scope:recipient }
		}
		modifier = {
			add = -50
			has_any_best_good_relationship_with_character_trigger = { CHARACTER = scope:recipient }
		}
		modifier = {
			add = 15
			has_any_mild_bad_relationship_with_character_trigger = { CHARACTER = scope:recipient }
		}
		modifier = {
			add = 25
			has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = scope:recipient }
		}
		modifier = {
			add = 50
			has_any_worst_bad_relationship_with_character_trigger = { CHARACTER = scope:recipient }
		}
		modifier = {
			scope:recipient.house = scope:actor.top_liege.house
			add = -25
		}
		opinion_modifier = {
			who = scope:actor
			opinion_target = scope:recipient
			multiplier = -0.25
		}
		
		# Avoid fellow movement members if possible (assuming they aren't rivals)
		modifier = {
			factor = {
				value = 0.25
				if = {
					limit = {
						is_in_pro_hegemon_or_hegemon_movement = yes
					}
					multiply = 0.5
				}
			}
			is_in_same_movement_as = { TARGET = scope:recipient }
			NOT = { has_relation_rival = scope:recipient }
		}
	}
}