call_for_confederation_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	decision_group_type = major
	ai_check_interval = 8

	desc = call_for_confederation_decision_desc
	selection_tooltip = call_for_confederation_decision_tooltip

	is_shown = {
		highest_held_title_tier <= tier_duchy
		is_playable_character = yes
		is_independent_ruler = yes
		NOR = {
			has_character_flag = forming_confederation
			is_confederation_member = yes
		}
	}

	is_valid = {
		is_independent_ruler = yes
		highest_held_title_tier <= tier_duchy
		is_tributary = no
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			OR = {
				has_realm_law = nomadic_authority_1
				has_realm_law = nomadic_authority_2
			}
		}
		trigger_else = {
			OR = {
				has_realm_law = tribal_authority_0
				has_realm_law = tribal_authority_1
				has_realm_law = tribal_authority_2
				has_realm_law = crown_authority_0
				has_realm_law = crown_authority_1
			}
		}
		NOR = {
			has_trait = conqueror
			has_trait = greatest_of_khans
		}
		OR = {
			has_trait = diplomat
			has_trait = family_first
			confederation_foe_trigger = { CHARACTER = root }
		}
		#This is just meant to stop player exploits
		trigger_if = {
			limit = {
				is_ai = no
			}
			custom_tooltip = {
				text = recently_took_leave_confederation_decision_tt
				NOT = { has_variable = left_confederation }
			}
		}
	}
	cooldown = { years = 5 }

	is_valid_showing_failures_only = {
		age >= 6
		trigger_if = {
			limit = {
				is_ai = no
			}
			NOT = { exists = involved_activity }
			NOT = { has_trait = infirm }
			is_physically_able = yes
			is_travelling = no
		}
		trigger_else = {
			is_imprisoned = no
			is_incapable = no
			is_alive = yes
			is_migrating = no
			NOT = { has_trait = infirm }
		}
	}

	cost = {
		prestige = {
			value = {
				add = 100
				if = {
					limit = {
						highest_held_title_tier = tier_duchy
					}
					add = 200
				}
				if = {
					limit = {
						max_military_strength > 0
						any_neighboring_top_liege_realm_owner = {
							NOT = { is_allied_to = root }
							max_military_strength > 0
							confederation_worthy_foe_strength_ratio_value_root <= 0.5
						}
					}
					add = -50
				}
				if = {
					limit = {
						max_military_strength > 0
						any_neighboring_top_liege_realm_owner = {
							NOT = { is_allied_to = root }
							max_military_strength > 0
							confederation_worthy_foe_strength_ratio_value_root <= 0.25
						}
					}
					add = -50
				}
			}
		}
		piety = {
			value = {
				add = 250
			}
		}
	}

	effect = {
		custom_tooltip = enables_offer_confederation_tt
		custom_tooltip = offer_confederation_members_tt
		custom_tooltip = confederation_join_defensive_wars_tt
		custom_tooltip = confederation_raiding_attacking_tt
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = confederation_modifier_tt
		}
		custom_tooltip = offer_confederation_5_year_warning_tt
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = confederation_restrictions_warning_tt
		}
		else = {
			custom_tooltip = confederation_restrictions_tribe_warning_tt
		}
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = confederation_migrating_leaving_warning_tt
		}
		else = {
			custom_tooltip = confederation_leaving_warning_tt
		}
		trigger_event = mpo_decisions_events.0001
	}

	ai_potential = {
		OR = {
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
		}
		is_independent_ruler = yes
		highest_held_title_tier <= tier_duchy
		is_tributary = no
		is_playable_character = yes
		is_confederation_member = no
		is_alive = yes
		#Culture friends
		any_land_neighboring_realm_with_tributaries_owner = {
			count >= 2
			culture = root.culture
			OR = {
				faith = root.faith
				AND = {
					faith = {
						has_doctrine_parameter = unreformed
					}
					root.faith = {
						has_doctrine_parameter = unreformed
					}
				}
				faith = {
					faith_hostility_level = {
						target = root.faith
						value < faith_hostile_level
					}
				}
			}
			valid_confederation_member_trigger = { CHARACTER = root }
			NOT = {
				has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
			}
		}
	}

	ai_will_do = {
		base = 0
		modifier = {
			ai_compassion >= low_positive_ai_value
			add = 5
		}
		modifier = {
			ai_honor >= low_positive_ai_value
			add = 5
		}
		modifier = {
			ai_boldness <= low_negative_ai_value
			add = 5
		}
		modifier = {
			ai_sociability >= low_positive_ai_value
			add = 5
		}
		modifier = {
			ai_greed <= low_negative_ai_value
			add = 5
		}
		modifier = {
			ai_energy <= low_negative_ai_value
			add = 5
		}
		modifier = {
			ai_rationality >= low_positive_ai_value
			add = 5
		}
		modifier = {
			ai_compassion <= low_negative_ai_value
			add = -5
		}
		modifier = {
			ai_honor <= low_negative_ai_value
			add = -5
		}
		modifier = {
			ai_boldness >= low_positive_ai_value
			add = -5
		}
		modifier = {
			ai_sociability <= low_negative_ai_value
			add = -5
		}
		modifier = {
			ai_greed >= low_positive_ai_value
			add = -5
		}
		modifier = {
			ai_energy >= low_positive_ai_value
			add = -5
		}
		modifier = {
			ai_rationality <= low_negative_ai_value
			add = -5
		}
		modifier = {
			OR = {
				any_land_neighboring_realm_with_tributaries_owner = {
					is_confederation_member = no
					confederation_worthy_foe_strength_ratio_value_root <= 0.25
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_confederation_member = no
					is_tributary = yes
					top_suzerain = {
						confederation_worthy_foe_strength_ratio_value_root <= 0.25
					}
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_confederation_member = no
					is_tributary = yes
					suzerain ?= {
						confederation_worthy_foe_strength_ratio_value_root <= 0.25
					}
				}
			}
			add = 25
		}
		modifier = {
			confederation_neighboring_foe_trigger = { CHARACTER = root }
			add = 30
		}
		modifier = {
			OR = {
				any_land_neighboring_realm_with_tributaries_owner = {
					OR = {
						has_trait = greatest_of_khans
						has_trait = conqueror
						any_owned_story = {
							OR = {
								story_type = story_greatest_of_khans
								story_type = story_mongol_invasion
							}
						}
					}
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_tributary = yes
					top_suzerain = {
						OR = {
							has_trait = greatest_of_khans
							has_trait = conqueror
							any_owned_story = {
								OR = {
									story_type = story_greatest_of_khans
									story_type = story_mongol_invasion
								}
							}
						}
					}
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_tributary = yes
					suzerain ?= {
						OR = {
							has_trait = greatest_of_khans
							has_trait = conqueror
							any_owned_story = {
								OR = {
									story_type = story_greatest_of_khans
									story_type = story_mongol_invasion
								}
							}
						}
					}
				}
			}
			add = 50
		}
		modifier = {
			add = 10
			culture = {
				OR = {
					has_cultural_pillar = ethos_stoic
					has_cultural_pillar = ethos_communal
					has_cultural_pillar = ethos_egalitarian
				}
			}
		}
		modifier = {
			add = -20
			culture = {
				OR = {
					has_cultural_pillar = ethos_bellicose
					has_cultural_pillar = ethos_courtly
					has_cultural_pillar = ethos_bureaucratic
				}
			}
		}
		modifier = {
			add = -100
			prestige <= medium_prestige_value # You cannot afford this
		}
		#Another confederation of your culture already exists
		modifier = {
			any_in_global_list = {
				variable = confederations
				has_variable = confederation_culture
				var:confederation_culture = root.culture
			}
			factor = 0.05
		}
		#There's already another confederation nearby
		modifier = {
			any_in_global_list = {
				variable = confederations
				any_confederation_member = {
					in_diplomatic_range = root
				}
			}
			factor = 0.1
		}
	}
}

leave_confederation_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	ai_check_interval = 12

	desc = leave_confederation_decision_desc
	selection_tooltip = leave_confederation_decision_tooltip

	is_shown = {
		is_confederation_member = yes
	}

	is_valid = {
		is_confederation_member = yes
		is_at_war = no
		highest_held_title_tier >= tier_county
	}

	is_valid_showing_failures_only = {
		trigger_if = {
			limit = {
				is_ai = no
			}
			NOT = { exists = involved_activity }
			is_physically_able = yes
			is_travelling = no
		}
		trigger_else = {
			is_alive = yes
			is_imprisoned = no
			is_incapable = no
			NOT = { exists = involved_activity }
		}
	}

	cost = {
		prestige = {
			value = {
				add = medium_prestige_value
				if = { # Cost increases if Gurkhan is doing well
					limit = {
						government_has_flag = government_is_nomadic
						exists = situation:the_great_steppe
						situation:the_great_steppe.situation_top_herd = {
							OR = {
								has_realm_law = nomadic_authority_4
								has_realm_law = nomadic_authority_5
							}
						}
					}
					multiply = 1.5
				}
				if = { # Cost increases if just joined in last couple years
					limit = {
						has_character_flag = new_confederate
					}
					multiply = 2
				}
			}
		}
	}

	effect = {
		set_variable = {
			name = left_confederation
			value = root.confederation
			years = 5
		}
		root.confederation = {
			save_scope_as = confederation
			every_confederation_member = {
				limit = {
					NOT = {
						this = root
					}
				}
				add_to_list = confederation_members
			}
		}
		show_as_tooltip = {
			root.confederation = {
				#Your confederation will survive, it has more members
				if = {
					limit = {
						any_confederation_member = {
							count >= 2
							NOT = {
								this = root
							}
						}
					}
					remove_confederation_member = root
				}
				#Your confederation is toast
				else = {
					disband_confederation = yes
				}
			}
		}
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			show_as_tooltip = {
				remove_character_modifier = mpo_confederation_member_modifier
			}
		}
		custom_tooltip = confederates_lose_opinion_tt
		
		save_scope_as = leaver
		trigger_event = {
			id = mpo_decisions_events.0002
			days = 1
		}
	}

	ai_potential = {
		is_confederation_member = yes
		is_independent_ruler = no
		age >= 12
		is_at_war = no
		is_incapable = no
		NOR = {
			any_land_neighboring_realm_with_tributaries_owner = {
				OR = {
					has_trait = greatest_of_khans
					has_trait = conqueror
					is_gurkhan = yes
				}
			}
			any_land_neighboring_realm_with_tributaries_owner = {
				any_owned_story = {
					OR = {
						story_type = story_mongol_invasion
						story_type = story_greatest_of_khans
					}
				}
			}
			situation:the_great_steppe = {
				any_situation_participant = {
					this = root
				}
				any_situation_participant = {
					OR = {
						has_trait = greatest_of_khans
						has_trait = conqueror
					}
				}
			}
		}
		
		#Will not leave if any confederation member is a good pal
		exists = root.confederation
		NOT = {
			root.confederation = {
				any_confederation_member = {
					OR = {
						has_relation_blood_brother = root
						is_allied_to = root
					}
				}
			}
		}
	}

	ai_will_do = {
		base = 0
		# PERKS
		modifier = { # Only member of culture
			NOT = {
				confederation = {
					any_confederation_member = {
						has_same_culture_as = root
					}
				}
			}
			confederation = {
				any_confederation_member = {
					culture = {
						cultural_acceptance = {
							target = root.culture
							value <= 90
						}
					}
					save_temporary_scope_as = actor
				}
			}
			save_temporary_scope_as = recipient
			add = {
				value = offer_vassalage_acceptance_value
				multiply = -0.5
			}
		}

		# MAIN
		modifier = { #Only member of faith, no pluralism.
			NOR = {
				confederation = {
					any_confederation_member = {
						faith = root.faith
					}
				}
				faith = { has_doctrine = doctrine_pluralism_pluralistic }
			}
			confederation = {
				any_confederation_member = {
					save_temporary_scope_as = confederate
				}
			}
			
			add = {
				value = 30
				if = {
					limit = {
						faith = {
							faith_hostility_level = {
								target = scope:confederate.faith
								value >= faith_hostile_level
							}
						}
					}
					add = 30
				}
				if = {
					limit = {
						faith = {
							faith_hostility_level = {
								target = scope:confederate.faith
								value >= faith_evil_level
							}
						}
					}
					add = 30
				}
			}
		}

		modifier = { #Only member of faith, pluralism.
			NOT = {
				confederation = {
					any_confederation_member = {
						faith = root.faith
					}
				}
			}
			faith = { has_doctrine = doctrine_pluralism_pluralistic }
			confederation = {
				any_confederation_member = {
					save_temporary_scope_as = confederate
				}
			}
			add = {
				value = 15
				if = {
					limit = {
						faith = {
							faith_hostility_level = {
								target = scope:confederate.faith
								value >= faith_hostile_level
							}
						}
					}
					add = 10
				}
				if = {
					limit = {
						faith = {
							faith_hostility_level = {
								target = scope:confederate.faith
								value >= faith_evil_level
							}
						}
					}
					add = 10
				}
			}
		}
		modifier = { #Just fought against other member of confederation
			any_truce_holder = {
				is_member_of_confederation = root.confederation
				NOT = {
					has_purchased_truce_with_char = { TARGET = root }
				}
			}
			add = 50
		}
		modifier = { #I fought an independence war against confederation member
			root = {
				exists = var:independence_war_former_liege
				var:independence_war_former_liege = {
					is_member_of_confederation = root.confederation
				}
			}
			add = 100
		}
		modifier = { #Is wrong government type
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
			add = 50
		}
		modifier = { #Is wrong government type
			NOR = {
				government_has_flag = government_is_republic
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
			}
			add = -100
		}
		modifier = { # Isolationist tradition
			confederation = {
				any_confederation_member = {
					NOT = {
						culture = root.culture
					}
				}
			}
			root.culture = {
				has_cultural_tradition = tradition_isolationist
			}
			add = 20
		}
		modifier = { # Isolationist tradition and all members are other culture
			confederation = {
				NOT = {
					any_confederation_member = {
						culture = root.culture
						NOT = {
							this = root
						}
					}
				}
			}
			root.culture = {
				has_cultural_tradition = tradition_isolationist
			}
			add = 50
		}
		modifier = { # Isolationist tradition
			confederation = {
				any_confederation_member = {
					NOT = {
						culture = root.culture
					}
				}
			}
			root.culture = {
				has_cultural_tradition = tradition_isolationist
			}
			add = 40
		}
		modifier = { #Bankrupt
			confederation = {
				any_confederation_member = {
					gold <= -1
				}
			}
			add = 10
		}
		modifier = { #All Bankrupt
			NOT = {
				confederation = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						gold <= -1
					}
				}
			}
			add = 50
		}
		modifier = { #Wide difference in rank
			highest_held_title_tier <= tier_county
			sub_realm_size <= 2
			add = -10
		}
		modifier = { #Wide difference in rank
			sub_realm_size <= 1
			add = -10
		}
		modifier = { # Is the Rightful Liege of recipient
			trigger = {
				confederation = {
					any_confederation_member = {
						is_rightful_liege_of = root
					}
				}
			}
			add = -20
		}
		modifier = { #No adjacency
			desc = offer_vassalization_interaction_aibehavior_unconnectedrealm_tt
			trigger = {
				NOT = {
					any_land_neighboring_realm_with_tributaries_owner = {
						OR = {
							is_member_of_confederation = root.confederation
							suzerain ?= {
								is_member_of_confederation = root.confederation
							}
						}
					}
				}
			}
			add = 100
		}
		modifier = { #Distant Realm
			desc = offer_vassalization_interaction_aibehavior_distantrealm_tt
			trigger = {
				NOR = {
					any_land_neighboring_realm_with_tributaries_owner = {
						OR = {
							is_member_of_confederation = root.confederation
							suzerain ?= {
								is_member_of_confederation = root.confederation
							}
						}
					}
					any_confederation_member = {
						NOT = {
							this = root
						}
						capital_province = {
							squared_distance = { target = root.capital_province value < 100000 }
						}
					}
				}
			}
			add = 150
		}
		modifier = { #Remote Realm.
			desc = offer_vassalization_interaction_aibehavior_remoterealm_tt
			trigger = {
				NOR = {
					any_land_neighboring_realm_with_tributaries_owner = {
						OR = {
							is_member_of_confederation = root.confederation
							suzerain ?= {
								is_member_of_confederation = root.confederation
							}
						}
					}
					any_confederation_member = {
						NOT = {
							this = root
						}
						capital_province = {
							squared_distance = { target = root.capital_province value < 200000 }
						}
					}
				}
			}
			add = 200
		}
		#Military strength higher than any member
		modifier = {
			NOT = {
				confederation = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						max_military_strength > root.max_military_strength
					}
				}
			}
			add = 20
		}
		#Military strength much higher than any member
		modifier = {
			NOT = {
				confederation = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						max_military_strength >= {
							value = {
								value = root.max_military_strength
								multiply = 2
							}
						}
					}
				}
			}
			add = 50
		}
		#Military strength lower than another member
		modifier = {
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					max_military_strength > root.max_military_strength
				}
			}
			add = -20
		}
		#Military strength lower than every other member
		modifier = {
			confederation = {
				NOT = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						max_military_strength < root.max_military_strength
					}
				}
			}
			add = -50
		}

		# MINOR
		modifier = { #Friend modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_friend = root
					}
				}
			}
			add = -25
		}
		modifier = { #Best Friend modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_best_friend = root
					}
				}
			}
			add = -50
		}
		modifier = { #Lover modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_lover = root
					}
				}
			}
			add = -10
		}
		modifier = { #Soulmate modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_soulmate = root
					}
				}
			}
			add = -50
		}
		modifier = { #Rivalry modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_rival = root
					}
				}
			}
			add = 200
		}
		modifier = { #Nemesis modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						has_relation_nemesis = root
					}
				}
			}
			add = 1000
		}
		modifier = { #Same Dynasty modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						exists = root.dynasty
						dynasty ?= root.dynasty
					}
				}
			}
			add = -20
		}
		modifier = { #Same House modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						exists = root.house
						house ?= root.dynasty
					}
				}
			}
			add = -50
		}

		modifier = { #Ageism modifier vs kids.
			trigger = {
				age >= 16
				NOT = {
					confederation = {
						any_confederation_member = {
							NOT = {
								this = root
							}
							age >= 16
						}
					}
				}
			}
			add = 25
		}
		modifier = { #Illegitimacy modifier.
			trigger = {
				confederation = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						OR = {
							AND = {
								has_trait = bastard
								root = {
									faith = { NOT = { has_doctrine = doctrine_bastardry_none } }
								}
							}
							has_trait = denounced
							has_trait = disinherited
						}
					}
				}
			}
			add = 10
		}
		
		modifier = { # Conqueror/GoK leaves immediately
			trigger = {
				root = {
					OR = {
						has_trait = conqueror
						has_trait = greatest_of_khans
					}
				}
			}
			add = 1000
		}

		modifier = { # Ambitious
			trigger = {
				root = {
					has_trait = ambitious
				}
			}
			add = 50
		}

		modifier = { # Paranoid
			trigger = {
				root = {
					has_trait = paranoid
				}
			}
			add = 20
		}

		modifier = { # Arrogant
			trigger = {
				root = {
					has_trait = arrogant
				}
			}
			add = 25
		}

		modifier = { # Fickle
			trigger = {
				root = {
					has_trait = fickle
				}
			}
			add = 50
		}

		modifier = { # Greedy
			trigger = {
				root = {
					has_trait = greedy
				}
			}
			add = 20
		}

		modifier = { # just
			trigger = {
				root = {
					has_trait = just
				}
			}
			add = -10
		}

		modifier = { # Trusting
			trigger = {
				root = {
					has_trait = trusting
				}
			}
			add = -20
		}

		modifier = { # Content
			trigger = {
				root = {
					has_trait = content
				}
			}
			add = -50
		}

		modifier = { # Craven
			trigger = {
				root = {
					has_trait = craven
				}
			}
			add = -50
		}

		# OPINION INFLUENCE
		modifier = {
			add = -25
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					root = {
						has_dread_level_towards = {
							target = prev
							level = 1
						}
					}
				}
			}
		}
		modifier = {
			add = -50
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					root = {
						has_dread_level_towards = {
							target = prev
							level = 2
						}
					}
				}
			}
		}
		modifier = { #Compare Opinion modifier.
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					reverse_opinion = {
						target = root
						value <= -50
					}
				}
			}
			add = 20
		}
		modifier = { #Compare Opinion modifier.
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					reverse_opinion = {
						target = root
						value <= -80
					}
				}
			}
			add = 20
		}
		modifier = { #Compare Opinion modifier.
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					reverse_opinion = {
						target = root
						value >= 80
					}
				}
			}
			add = -20
		}
		modifier = { #Compare Opinion modifier.
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					reverse_opinion = {
						target = root
						value >= 100
					}
				}
			}
			add = -20
		}

		# LOW LEGITIMACY
		modifier = {
			add = 5
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = reduced_vassalization_acceptance
				}
			}
		}
		modifier = {
			add = 10
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = very_reduced_vassalization_acceptance
				}
			}
		}
		modifier = {
			add = 20
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = massively_reduced_vassalization_acceptance
				}
			}
		}

		# HIGH LEGITIMACY
		modifier = {
			add = -5
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = increased_vassalization_acceptance
				}
			}
		}
		modifier = {
			add = -10
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = very_increased_vassalization_acceptance
				}
			}
		}
		modifier = {
			add = -25
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					has_legitimacy_flag = extra_increased_vassalization_acceptance
				}
			}
		}

		# PRESTIGE
		modifier = {
			add = 25
			prestige_level >= 4
		}
		modifier = {
			add = 25
			prestige_level >= 5
		}

		#CULTURE
		modifier = {
			add = -10
			confederation = {
				NOT = {
					any_confederation_member = {
						NOT = {
							culture = root.culture
						}
					}
				}
			}
		}
		modifier = {
			add = 50
			confederation = {
				NOT = {
					any_confederation_member = {
						NOT = {
							this = root
						}
						NOR = {
							culture = root.culture
							culture = {
								any_parent_culture_or_above = {
									this = root.culture
								}
							}
							root.culture = {
								any_parent_culture_or_above = {
									this = root.liege.culture
								}
							}
							culture = {
								has_same_culture_heritage = root.culture
							}
						}
					}
				}
			}
		}

		#Conquerors have no interest in this
		modifier = {
			root = {
				has_trait = conqueror
			}
			add = 500
		}
		modifier = {
			root = {
				has_trait = greatest_of_khans
			}
			add = 500
		}

		# Are you using a hook?
		modifier = {
			confederation = {
				any_confederation_member = {
					has_usable_hook = root
				}
			}
			add = -50
		}

		#No threat to confederate against
		modifier = {
			add = 75
			root = {
				NOT = {
					confederation_foe_trigger = { CHARACTER = root }
				}
			}
		}

		#Has confederation threat
		modifier = {
			add = -25
			root = {
				confederation_foe_trigger = { CHARACTER = root }
			}
		}

		#Neighbor is scaring them
		modifier = {
			add = -50
			root = {
				any_land_neighboring_realm_with_tributaries_owner = {
					top_suzerain = {
						NOR = {
							this = liege
							this = top_liege
						}
						confederation_worthy_foe_strength_ratio_value_root <= 0.25
						NOT = { is_allied_to = root }
						OR = {
							highest_held_title_tier >= tier_kingdom
							faith = {
								faith_hostility_level = {
									target = root.faith
									value >= faith_evil_level
								}
							}
							has_trait = conqueror
							has_trait = greatest_of_khans
							any_owned_story = {
								OR = {
									story_type = story_greatest_of_khans
									story_type = story_mongol_invasion
								}
							}
						}
					}
				}
			}
		}

		#Neighbor is TERRIFYING them
		modifier = {
			add = -100
			root = {
				any_land_neighboring_realm_with_tributaries_owner = {
					top_suzerain = {
						NOR = {
							this = liege
							this = top_liege
						}
						confederation_worthy_foe_strength_ratio_value_root <= 0.1
						NOT = { is_allied_to = root }
						OR = {
							highest_held_title_tier >= tier_kingdom
							faith = {
								faith_hostility_level = {
									target = root.faith
									value >= faith_evil_level
								}
							}
							has_trait = conqueror
							has_trait = greatest_of_khans
							any_owned_story = {
								OR = {
									story_type = story_greatest_of_khans
									story_type = story_mongol_invasion
								}
							}
						}
					}
				}
			}
		}

		#You have too many vassals
		modifier = {
			save_temporary_scope_as = actor
			scope:actor.confederation = {
				any_confederation_member = {
					count >= 6
					highest_held_title_tier >= tier_county
				}
			}
			add = {
				value = duchy_confederation_vassals_value
				multiply = -1
			}
		}

		#NOT FROM OFFER CONFEDERATION INTERACTION
		modifier = {
			confederation = {
				has_variable = confederation_culture
				var:confederation_culture = {
					this = root.culture
				}
			}
			add = -20
		}
		modifier = {
			confederation = {
				has_variable = confederation_culture
				var:confederation_culture = {
					NOT = { this = root.culture }
				}
			}
			add = 20
		}

		modifier = {
			add = -50
			has_trait = loyal
		}
		modifier = {
			add = 50
			has_trait = disloyal
		}
		modifier = {
			has_trait = infirm
			add = -10
		}
		modifier = {
			confederation = {
				any_confederation_member = {
					NOT = {
						this = root
					}
					is_incapable = yes
				}
			}
			add = 15
		}
		#Confederation has only two
		modifier = {
			confederation = {
				any_confederation_member = {
					count <= 2
					highest_held_title_tier >= tier_county
				}
			}
			add = 20
		}
		#Doing great and doesn't need confederation
		modifier = {
			war_chest_gold >= war_chest_gold_maximum
			add = 25
		}
		modifier = {
			NOR = {
				any_land_neighboring_realm_with_tributaries_owner = {
					NOT = { is_allied_to = root }
				 	max_military_strength >= root.max_military_strength
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_tributary = yes
					suzerain ?= {
						NOT = { is_allied_to = root }
				 		max_military_strength >= root.max_military_strength
				 	}
				}
				any_land_neighboring_realm_with_tributaries_owner = {
					is_tributary = yes
					top_suzerain = {
						NOT = { is_allied_to = root }
				 		max_military_strength >= root.max_military_strength
				 	}
				}
			}
			add = 50
		}
		modifier = {
			domain_size >= 4
			add = 15
		}
		modifier = {
			domain_size >= 5
			add = 20
		}
		modifier = {
			domain_size >= 6
			add = 25
		}
		modifier = {
			add = -10
			culture = {
				OR = {
					has_cultural_pillar = ethos_stoic
					has_cultural_pillar = ethos_communal
					has_cultural_pillar = ethos_egalitarian
				}
			}
		}
		modifier = {
			add = 10
			culture = {
				OR = {
					has_cultural_pillar = ethos_bellicose
					has_cultural_pillar = ethos_courtly
					has_cultural_pillar = ethos_bureaucratic
				}
			}
		}
		modifier = {
			add = 100
			ai_energy > low_negative_ai_value
			ai_boldness > low_negative_ai_value
			NOR = {
				has_trait = content
				has_trait = craven
				has_trait = loyal
				has_trait = humble
			}
			NOT = {
				has_character_flag = new_confederate
			}
		}
		#Recent AI confederates should really not take this
		modifier = {
			add = -500
			has_character_flag = new_confederate
		}
		modifier = {
			add = -25
			confederation = {
				any_confederation_member = {
					is_primary_heir_of = root
				}
			}
		}
		modifier = {
			add = -50
			confederation = {
				any_confederation_member = {
					root = {
						is_primary_heir_of = prev
					}
				}
			}
		}
		modifier = {
			add = -25
			confederation = {
				any_confederation_member = {
					any_spouse = {
						this = root
					}
				}
			}
		}
		modifier = {
			add = -25
			confederation = {
				any_confederation_member = {
					is_close_family_of = root
				}
			}
		}
		modifier = {
			add = -20
			confederation = {
				any_confederation_member = {
					any_spouse = {
						is_close_family_of = root
					}
				}
			}
		}
		modifier = {
			add = -20
			confederation = {
				any_confederation_member = {
					any_close_family_member = {
						any_spouse = {
							OR = {
								is_close_family_of = root
								this = root
							}
						}
					}
				}
			}
		}
	}
}

study_commander_trait_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_concession.dds"
	} 
	decision_group_type = nomad_minor

	ai_check_interval = 72

	desc = study_commander_trait_decision_desc
	selection_tooltip = study_commander_trait_decision_tooltip

	is_shown = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_playable_character = yes
		is_available_adult = yes
		NOR = { 
			has_trait = conqueror
			has_trait = greatest_of_khans
			has_character_flag = study_commander_trait_cooldown
			has_character_flag = is_learning_commander_trait
	 	}
		number_of_commander_traits < commander_trait_limit
	}

	is_valid = {
		domicile ?= {
			has_domicile_building_or_higher = mass_warfare_yurt_01
		}
	}

	cooldown = { years = 10 } # 5 if they don't get one, 10 if they do

	is_valid_showing_failures_only = {
		is_at_war = no
	}

	effect = {
		custom_tooltip = study_commander_trait_decision_effect
		trigger_event = {
			id = mpo_decisions_events.0200
		}
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 50
		modifier = {
			add = 50
			OR = {
				has_trait = brave
				has_trait = diligent
				has_trait = ambitious
			}
		}
		modifier = {
			add = 50
			martial >= high_skill_rating
		}
		modifier = {
			add = 25
			highest_skill = martial
		}
		modifier = {
			add = 25
			has_focus = martial_strategy_focus
		}
		modifier = {
			add = -15
			has_trait = wounded
		}
		modifier = {
			add = -25
			OR = {
				has_trait = craven
				has_trait = lazy
			}
		}
		
	}
}

mpo_decision_fertility_dance = {
    picture = {
        reference = "gfx/interface/illustrations/event_scenes/mpo_temple_steppe.dds"
    }
    sort_order = 60
	decision_group_type = nomad_minor

    desc = mpo_decision_fertility_dance_desc

    selection_tooltip = mpo_decision_fertility_dance_tooltip

    cooldown = { years = 5 }

    is_shown = {
        has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
        is_landed = yes
        is_available_adult = yes
        any_sub_realm_county = {
            uses_county_fertility = yes
        }
    }

    is_valid_showing_failures_only = {
        is_at_war = no
		is_incapable = no
		employs_court_position = court_astrologer_court_position
    }

    cost = {
        piety = {
            add = medium_piety_value
        }
    }

    effect = {
        scope:barony.county = { save_scope_as = fertility_county }
        custom_tooltip = {
            text = mpo_decision_fertility_dance_effects_tt
            trigger_event = mpo_decisions_events.0300
        }
        custom_tooltip = mpo_decision_fertility_dance_bonus_tt
        if = {
			limit = {
				domicile ?= {
					has_domicile_parameter = nomad_yurt_improved_fertility_dance
				}
			}
			custom_tooltip = mpo_decisions_events.0300.a.tt.yurt
			show_as_tooltip = {
				scope:fertility_county = {
					every_neighboring_county = {
						limit = {
							OR = {
								holder = root
								holder = {
									government_has_flag = government_is_herder
								}
							}
						}
						add_county_modifier = {
							modifier = mpo_fertility_dance_county_modifier
							years = 2
						}
					}
				}
			}		
		}
    }

    widget = {
        controller = create_holy_order
        barony_valid = {
            trigger_if = {
                limit = { exists = this }
                is_capital_barony = yes
                county = {
                    uses_county_fertility = yes
                }
            }
        }
    }

    ai_check_interval = 12

    ai_potential = {
        is_landed = yes
        is_available_adult = yes
        is_at_war = no
		is_incapable = no
        any_sub_realm_county = {
            uses_county_fertility = yes
            county_fertility <= 25
        }
		piety >= medium_piety_value
    }

    ai_will_do = {
        base = 100
        ai_value_modifier = {
            ai_rationality = 1
        }
        modifier = {
            factor = 1.25
            has_trait = diligent
        }
        modifier = {
            factor = 1.5
            has_trait = zealous
        }
        modifier = {
            factor = 0.75
            has_trait = cynical
        }
        modifier = {
            factor = 2
            any_sub_realm_county = {
                uses_county_fertility = yes
                county_fertility <= 50
            }
        }
    }
}

mpo_decision_introduce_heir = {
	picture = {
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_tribal_neutral.dds"
	}
	decision_group_type = nomad_minor

	desc = introduce_heir_decision_desc
	selection_tooltip = introduce_heir_decision_tooltip

	cooldown = { years = 5 }
	
	is_shown = {
		OR = {
			government_has_flag = government_is_nomadic
			has_trait = nomadic_philosophy
		}
		exists = player_heir
		player_heir = {
			any_heir_title = {
				count >= 1
			}
			is_ai = yes
		}
	}

	is_valid = {
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			domicile ?= {
				has_domicile_building_or_higher = family_yurt_01
			}
		}
		trigger_else = {
			has_trait = nomadic_philosophy
		}
		
		player_heir = {
			custom_description = {
				text = player_heir_num_friends_tt
				num_of_relation_friend < 3
			}
			age >= 12
			OR = {
				is_courtier_of = root
				is_vassal_of = root
			}
			opinion = {
				target = root
				value >= 50
			}
		}
		custom_tooltip = {
			text = mpo_valid_heir_friend_tt
			OR = {
				any_ally = {
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
				}
				any_vassal = {
					is_obedient_to = root
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
				}
				any_relation = {
					type = friend
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
				}
				any_relation = {
					type = soulmate
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
				}
				any_relation = {
					type = blood_brother
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		trigger_if = {
			limit = {
				is_ai = no
			}
			NOT = { exists = involved_activity }
			is_available = yes
		}
		trigger_else = {
			is_alive = yes
			is_imprisoned = no
			is_incapable = no
			NOT = { exists = involved_activity }
		}
		player_heir = {
			is_imprisoned = no
			is_alive = yes
			NOR = {
				has_trait = wounded_2
				has_trait = wounded_3
				has_trait = infirm
				has_relation_rival = root
				has_relation_nemesis = root
				exists = involved_activity
				is_at_war_with = root
			}
			has_contagious_deadly_disease_trigger = no
			is_incapable = no
			is_a_faction_member = no
		}
	}

	cost = {
		prestige = {
			value = {
				add = mpo_introduce_heir_prestige_cost
				#AI suck
				if = {
					limit = {
						is_ai = yes
					}
					multiply = 0.5
				}
			}
		}
		piety = {
			value = {
				add = mpo_introduce_heir_piety_cost
			}
			if = {
				limit = {
					is_ai = yes
				}
				multiply = 0.5
			}
		}
	}

	effect = {
		custom_tooltip = choose_heir_friend_tt
		custom_tooltip = heir_friend_obedient_tt
		custom_tooltip = heir_friend_ally_tt
		custom_tooltip = heir_friend_side_effects_tt
		trigger_event = {
			id = mpo_decisions_events.0020
			days = 1
		}
		show_as_tooltip = {
			if = {
				limit = {
					has_trait = shy
				}
				add_stress = medium_stress_impact_gain
			}
			if = {
				limit = {
					has_trait = callous
				}
				add_stress = minor_stress_impact_gain
			}
			if = {
				limit = {
					has_trait = paranoid
				}
				add_stress = medium_stress_impact_gain
			}
		}
	}

	ai_check_interval = 18
	
	ai_potential = {
		exists = player_heir
		player_heir = {
			age >= 12
			opinion = {
				target = root
				value >= 50
			}
			OR = {
				is_courtier_of = root
				is_vassal_of = root
			}
			exists = house
			exists = root.house
			house = {
				this = root.house
			}
		}
		OR = {
			any_ally = {
				mpo_valid_heir_friend_trigger = { CHARACTER = root }
				reverse_opinion = {
					target = root
					value >= 0
				}
				OR = {
					has_relation_friend = root
					has_relation_best_friend = root
					has_relation_blood_brother = root
					AND = {
						exists = house
						exists = root.house
						house = {
							this = root.house
						}
					}
					culture = root.culture
					reverse_opinion = {
						target = root
						value >= 50
					}
					has_relation_soulmate = root
				}
			}
			any_vassal = {
				is_powerful_vassal = yes
				is_obedient_to = root
				mpo_valid_heir_friend_trigger = { CHARACTER = root }
				reverse_opinion = {
					target = root
					value >= 0
				}
				OR = {
					has_relation_friend = root
					has_relation_best_friend = root
					has_relation_blood_brother = root
					AND = {
						exists = house
						exists = root.house
						house = {
							this = root.house
						}
					}
					culture = root.culture
					reverse_opinion = {
						target = root
						value >= 50
					}
					has_relation_soulmate = root
					is_allied_to = root
				}
			}
			any_relation = {
				type = friend
				is_obedient_to = root
				mpo_valid_heir_friend_trigger = { CHARACTER = root }
				reverse_opinion = {
					target = root
					value >= 0
				}
				OR = {
					AND = {
						exists = house
						exists = root.house
						house = {
							this = root.house
						}
					}
					culture = root.culture
					reverse_opinion = {
						target = root
						value >= 50
					}
					has_relation_soulmate = root
					is_allied_to = root
					is_vassal_of = root
					AND = {
						exists = root.liege
						this = root.liege
					}
				}
			}
		}
	}

	ai_will_do = {
		base = 50
		ai_value_modifier = {
			ai_compassion = 1
			ai_energy = 1
			ai_sociability = 1
		}
		modifier = {
			opinion = {
				target = player_heir
				value < 0
			}
			add = -25
		}
		modifier = {
			opinion = {
				target = player_heir
				value >= 75
			}
			add = 25
		}
		modifier = {
			player_heir = {
				num_of_relation_friend < 1
			}
			add = 25
		}
		modifier = {
			player_heir = {
				num_of_relation_friend > 1
			}
			add = -25
		}
		#Weigh up if you are friends with a valid option
		modifier = {
			OR = {
				any_ally = {
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					OR = {
						has_relation_friend = root
						has_relation_best_friend = root
						has_relation_blood_brother = root
					}
				}
				any_vassal = {
					is_powerful_vassal = yes
					is_obedient_to = root
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					OR = {
						has_relation_friend = root
						has_relation_best_friend = root
						has_relation_blood_brother = root
					}
				}
				any_relation = {
					type = friend
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					AND = {
						exists = root.liege
						this = root.liege
					}
				}
			}
			add = 25
		}
		#Weigh down if none of the valid options are of culture
		modifier = {
			NOR = {
				any_ally = {
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					culture = root.culture
				}
				any_vassal = {
					is_powerful_vassal = yes
					is_obedient_to = root
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					culture = root.culture
				}
				any_relation = {
					type = friend
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					culture = root.culture
				}
			}
			add = -10
		}
		#Weigh up if you are house members with a valid option
		modifier = {
			exists = root.house
			OR = {
				any_ally = {
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					exists = house
					house = {
						this = root.house
					}
				}
				any_vassal = {
					is_powerful_vassal = yes
					is_obedient_to = root
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					exists = house
					house = {
						this = root.house
					}
				}
				any_relation = {
					type = friend
					mpo_valid_heir_friend_trigger = { CHARACTER = root }
					exists = house
					house = {
						this = root.house
					}
				}
			}
			add = 10
		}
	}
}


# Expand the Steppe
# List is as follows:
#
## Western Steppe expansion regions:
#	ghw_region_anatolia
#	custom_eastern_balkans
#	ghw_region_northern_russia
#	ghw_region_southern_russia
#	custom_hungary
#	ghw_region_poland
#	ghw_region_baltic
# 	dlc_mpo_steppe_caucasus_expansion
## Central Steppe expansion regions:
#	world_transoxiana
#	world_khorasan
#	dlc_mpo_steppe_persia_expansion
#	dlc_mpo_steppe_siberia_further_expansion
## Eastern Steppe expansion regions:
#	world_steppe_tarim

expand_the_steppe_decision = {
    picture = {
        reference = "gfx/interface/illustrations/event_scenes/mpo_raid_burning_asian.dds"
    }
    decision_group_type = nomad_major
    ai_check_interval = 8

	title = expand_the_steppe_decision_generic

    desc = expand_the_steppe_decision_desc
    selection_tooltip = expand_the_steppe_decision_tooltip

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "SELECT_ACTION"
		show_from_start = yes


		# steppe_west potential regions
		item = {
			value = custom_eastern_balkans
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:custom_eastern_balkans
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_eastern_balkans_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = custom_eastern_balkans
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = custom_eastern_balkans
	                }
				}
			}
			localization = custom_eastern_balkans
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = ghw_region_northern_russia
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:ghw_region_northern_russia
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_northern_russia_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = ghw_region_northern_russia
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = ghw_region_northern_russia
	                }
				}
			}
			localization = ghw_region_northern_russia
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = ghw_region_southern_russia
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:ghw_region_southern_russia
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_southern_russia_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = ghw_region_southern_russia
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = ghw_region_southern_russia
	                }
				}
			}
			localization = ghw_region_southern_russia
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = dlc_mpo_steppe_caucasus_expansion
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:dlc_mpo_steppe_caucasus_expansion
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_caucasus_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = dlc_mpo_steppe_caucasus_expansion
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = dlc_mpo_steppe_caucasus_expansion
	                }
				}
			}
			localization = dlc_mpo_steppe_caucasus_expansion
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = ghw_region_poland
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:ghw_region_poland
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_poland_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = ghw_region_poland
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = ghw_region_poland
	                }
				}
			}
			localization = ghw_region_poland
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 2137
			}
		}
		item = {
			value = custom_hungary
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:custom_hungary
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_hungary_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = custom_hungary
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = custom_hungary
	                }
				}
			}
			localization = custom_hungary
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = ghw_region_anatolia
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:ghw_region_anatolia
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_anatolia_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = ghw_region_anatolia
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = ghw_region_anatolia
	                }
				}
			}
			localization = ghw_region_anatolia
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = ghw_region_baltic
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:ghw_region_baltic
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_baltics_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = ghw_region_baltic
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = ghw_region_baltic
	                }
				}
			}
			localization = ghw_region_baltic
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}

		# steppe_central potential regions
		item = {
			value = world_transoxiana
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:world_transoxiana
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_transoxiana_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = world_transoxiana
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = world_transoxiana
	                }
				}
			}
			localization = world_transoxiana
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = dlc_mpo_steppe_siberia_further_expansion
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:dlc_mpo_steppe_siberia_further_expansion
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_siberia_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = dlc_mpo_steppe_siberia_further_expansion
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = dlc_mpo_steppe_siberia_further_expansion
	                }
				}
			}
			localization = dlc_mpo_steppe_siberia_further_expansion
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 0 #Tribes of the North
			}
		}
		item = {
			value = world_khorasan
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:world_khorasan
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_khorasan_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = world_khorasan
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = world_khorasan
	                }
				}
			}
			localization = world_khorasan
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
		item = {
			value = dlc_mpo_steppe_persia_expansion
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:dlc_mpo_steppe_persia_expansion
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_persia_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = dlc_mpo_steppe_persia_expansion
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = dlc_mpo_steppe_persia_expansion
	                }
				}
			}
			localization = dlc_mpo_steppe_persia_expansion
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}

		## Eastern Steppe

		item = {
			value = world_steppe_tarim
			is_shown = {
	            situation:the_great_steppe ?= {
	            	any_situation_sub_region = {
	                	region_is_adjacent = geographical_region:world_steppe_tarim
	                }
	            }
			}
			is_valid = {
				custom_tooltip = {
					text = custom_tarim_expand_steppe_tt
					situation:the_great_steppe ?= {
	                    NOT = {
	                        any_situation_sub_region = {
	                            situation_sub_region_has_geographical_region = world_steppe_tarim
	                        }
	                    }
	                }
	                any_realm_province = {
	                    geographical_region = world_steppe_tarim
	                }
				}
			}
			localization = world_steppe_tarim
			icon = "gfx/interface/icons/message_feed/banner.dds"
			ai_chance = {
				value = 100
			}
		}
	}

    is_shown = {
        has_mpo_dlc_trigger = yes

        government_has_flag = government_is_nomadic

    	any_character_situation = {
    		situation:the_great_steppe ?= this
    	}

        OR = {
			great_steppe_not_in_sub_region_trigger = { REGION = ghw_region_anatolia }
			great_steppe_not_in_sub_region_trigger = { REGION = custom_eastern_balkans }
			great_steppe_not_in_sub_region_trigger = { REGION = ghw_region_northern_russia }
			great_steppe_not_in_sub_region_trigger = { REGION = ghw_region_southern_russia }
			great_steppe_not_in_sub_region_trigger = { REGION = custom_hungary }
			great_steppe_not_in_sub_region_trigger = { REGION = ghw_region_poland }
			great_steppe_not_in_sub_region_trigger = { REGION = ghw_region_baltic }
			great_steppe_not_in_sub_region_trigger = { REGION = dlc_mpo_steppe_caucasus_expansion }
			great_steppe_not_in_sub_region_trigger = { REGION = world_transoxiana }
			great_steppe_not_in_sub_region_trigger = { REGION = world_khorasan }
			great_steppe_not_in_sub_region_trigger = { REGION = dlc_mpo_steppe_persia_expansion }
			great_steppe_not_in_sub_region_trigger = { REGION = dlc_mpo_steppe_siberia_further_expansion }
			great_steppe_not_in_sub_region_trigger = { REGION = world_steppe_tarim }
        }
    }

    is_valid = {
        is_independent_ruler = yes
        highest_held_title_tier >= tier_duchy

        trigger_if = {
        	limit = {
	    		scope:ghw_region_anatolia = yes
	    	}
		    completely_controls_region = ghw_region_anatolia
		}
        trigger_if = {
        	limit = {
	    		scope:custom_eastern_balkans = yes
	    	}
		    completely_controls_region = custom_eastern_balkans
		}
        trigger_if = {
        	limit = {
	    		scope:ghw_region_northern_russia = yes
	    	}
		    completely_controls_region = ghw_region_northern_russia
		}
        trigger_if = {
        	limit = {
	    		scope:ghw_region_southern_russia = yes
	    	}
		    completely_controls_region = ghw_region_southern_russia
		}
        trigger_if = {
        	limit = {
	    		scope:custom_hungary = yes
	    	}
		    completely_controls_region = custom_hungary
		}
        trigger_if = {
        	limit = {
	    		scope:ghw_region_poland = yes
	    	}
		    completely_controls_region = ghw_region_poland
		}
        trigger_if = {
        	limit = {
	    		scope:ghw_region_baltic = yes
	    	}
		    completely_controls_region = ghw_region_baltic
		}
        trigger_if = {
        	limit = {
	    		scope:dlc_mpo_steppe_caucasus_expansion = yes
	    	}
		    completely_controls_region = dlc_mpo_steppe_caucasus_expansion
		}

        trigger_if = {
        	limit = {
	    		scope:world_transoxiana = yes
	    	}
		    completely_controls_region = world_transoxiana
		}
        trigger_if = {
        	limit = {
	    		scope:world_khorasan = yes
	    	}
		    completely_controls_region = world_khorasan
		}
        trigger_if = {
        	limit = {
	    		scope:dlc_mpo_steppe_persia_expansion = yes
	    	}
		    completely_controls_region = dlc_mpo_steppe_persia_expansion
		}
        trigger_if = {
        	limit = {
	    		scope:dlc_mpo_steppe_siberia_further_expansion = yes
	    	}
		    completely_controls_region = dlc_mpo_steppe_siberia_further_expansion
		}
        trigger_if = {
        	limit = {
	    		scope:world_steppe_tarim = yes
	    	}
		    completely_controls_region = world_steppe_tarim
		}
    }

    cooldown = { years = 5 }

    is_valid_showing_failures_only = {
        trigger_if = {
            limit = {
                is_ai = no
            }
            NOT = { exists = involved_activity }
            NOT = { has_trait = infirm }
            is_available = yes
        }
        trigger_else = {
            is_imprisoned = no
            is_incapable = no
            is_alive = yes
            NOT = { has_trait = infirm }
        }
    }

    cost = {
        prestige = {
            value = {
                add = mpo_expand_steppe_prestige_cost
                #AI suck
                if = {
                    limit = {
                        is_ai = yes
                    }
                    multiply = 0.5
                }
            }
        }
    }

    effect = {
    	# Send a toast to yourself, as a confirmation that the Steppe Expansion happened
		send_interface_toast = {
			type = steppe_expansion_happened
			title = expand_the_steppe_decision_notification_toast
			left_icon = root
			expanding_steppe_effect = yes
			add_legitimacy = 150
		}
		hidden_effect = {
			# Send a notification to any other player in the Steppe
			every_player = {
				limit = {
					NOT = { this = root }

			    	any_character_situation = {
			    		situation:the_great_steppe ?= this
			    	}
				}
				send_interface_message = {
					type = steppe_expansion_happened
					title = expand_the_steppe_decision_notification_toast
					left_icon = root
					show_as_tooltip = {
						expanding_steppe_effect = yes
					}
				}
			}
		}
    }

    ai_will_do = {
        base = 1
    }
}

#Diligent overwork for nomads
develop_fertility_decision = {
	ai_check_interval = 0
	picture = {
        reference = "gfx/interface/illustrations/event_scenes/mpo_hunt_steppe.dds"
    }
    sort_order = 60
	decision_group_type = nomad_minor

	desc = develop_fertility_decision_desc

	selection_tooltip = develop_fertility_decision_tooltip

	cooldown = { years = 10 }

	is_shown = {
		OR = {
			has_trait = diligent
			has_trait = architect 
			has_trait = lifestyle_surveyor
		}
		is_landed = yes
		government_has_flag = government_is_nomadic
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_adult = yes
	}

	effect = {
		capital_county ?= {
			change_county_fertility = medium_county_fertility_gain
		}
		send_interface_toast = {
			type = event_toast_effect_neutral
			title = msg_develop_fertility
			left_icon = root

			add_character_modifier = {
 				modifier = develop_fertility_modifier
				years = 10
			}
		}

		add_stress = medium_stress_impact_gain
	}
	
	ai_potential = {
		OR = {
			has_trait = diligent
			has_trait = architect 
			has_trait = lifestyle_surveyor
		}
		NOT = {
			has_trait = temperate
		}
	}

	ai_will_do = {
		base = 100

		modifier = {
			factor = 0
			stress >= 50
		}
	}
}

# New Tier Title for Nomads
nomad_higher_tier_title_decision = {
	ai_check_interval = 6
	picture = {
        reference = "gfx/interface/illustrations/event_scenes/mpo_steppe_evening.dds"
    }
    sort_order = 100
	decision_group_type = nomad_major

	cooldown = { years = 10 }

	cost = {
		prestige = {
			value = 125
			switch = {
				trigger = root.highest_held_title_tier
				tier_kingdom = {
					value = 500
				}
				tier_duchy = {
					value = 250
				}
				tier_county = {
					value = 125
				}
			}
			if = {
				limit = {
					is_ai = yes
				}
				multiply = 0.1
			}
		}
	}

	is_shown = {
		government_has_flag = government_is_nomadic
		highest_held_title_tier < tier_empire
	}

	is_valid = {
		is_at_war = no
		is_landed = yes
		is_independent_ruler = yes
		is_confederation_member = no
		is_tributary = no
		switch = {
			trigger = root.highest_held_title_tier
			tier_kingdom = {
				custom_tooltip = {
					text = dominate_title_trigger_dominance_4
					OR = {
						has_realm_law = nomadic_authority_5
						has_realm_law = nomadic_authority_4
					}
				}
			}
			tier_duchy = {
				custom_tooltip = {
					text = dominate_title_trigger_dominance_3
					OR = {
						has_realm_law = nomadic_authority_5
						has_realm_law = nomadic_authority_4
						has_realm_law = nomadic_authority_3
					}
				}
			}
			tier_county = {
				custom_tooltip = {
					text = dominate_title_trigger_dominance_2
					OR = {
						has_realm_law = nomadic_authority_5
						has_realm_law = nomadic_authority_4
						has_realm_law = nomadic_authority_3
						has_realm_law = nomadic_authority_2
					}
				}
			}
		}
	}

	effect = {
		play_music_cue = mx_cue_the_khans_glory
		save_scope_as = root_scope
		root.primary_title.de_jure_liege ?= { save_scope_as = title_scope }
		if = {
			limit = {
				exists = scope:title_scope.holder
			}
			hidden_effect = {
				scope:title_scope.holder = { save_scope_as = main_defender }
				root = {
					if = {
						limit = {
							any_truce_target = { this = scope:main_defender }
						}
						cancel_truce_both_ways = scope:main_defender
					}
				}
				start_war = {
					cb = domination_cb
					target = scope:main_defender
					target_title = scope:title_scope
				}
			}
			custom_tooltip = domination_war_holder_custom_tooltip
		}
		else_if = {
			limit = {
				scope:title_scope ?= {
					NOT = { exists = holder }
					any_de_jure_county_holder = {
						is_landed = yes
						NOR = {
							top_liege ?= root
							top_suzerain ?= root
							is_allied_to = root
							government_has_flag = government_is_herder
						}
						is_independent_ruler = yes
					}
				}
			}
			hidden_effect = {
				scope:title_scope = {
					every_de_jure_county_holder = {
						limit = {
							is_landed = yes
							NOR = {
								top_liege ?= root
								top_suzerain ?= root
								is_allied_to = root
								government_has_flag = government_is_herder
							}
							is_independent_ruler = yes
						}
						add_to_list = war_targets
					}
					ordered_in_list = {
						list = war_targets
						order_by = current_military_strength
						save_scope_as = main_defender
					}
				}
				root = {
					if = {
						limit = {
							any_truce_target = { this = scope:main_defender }
						}
						cancel_truce_both_ways = scope:main_defender
					}
				}
				start_war = {
					cb = domination_cb
					target = scope:main_defender
					target_title = scope:title_scope
				}
				random_character_war = {
					limit = {
						primary_attacker = root
						primary_defender = scope:main_defender
					}
					every_in_list = {
						list = war_targets
						limit = {
							NOT = { is_participant_in_war = prev }
						}
						prev = {
							add_defender = prev
						}
					}
				}
			}
			custom_tooltip = domination_war_no_holder_custom_tooltip
		}
		else_if = {
			limit = {
				exists = scope:title_scope
			}
			scope:title_scope ?= {
				create_title_and_vassal_change = {
					type = created
					save_scope_as = change
				}
				change_title_holder = {
					holder = root
					change = scope:change
				}
				resolve_title_and_vassal_change = scope:change
			}
		}
		else = {
			custom_tooltip = nomad_higher_tier_title_decision_custom_tooltip
		}
	}
	
	ai_potential = {
		OR = {
			has_realm_law = nomadic_authority_5
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_3
		}
		current_military_strength >= 2000
		root.current_military_strength > dominate_title_current_enemy_strength
	}

	ai_will_do = {
		base = 50
	}
}

#Transition from Gurkhan to GREATEST KHAN EVER
mpo_become_greatest_of_khans_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_great_khan.dds"
	}
	
	desc = {
		desc = mpo_become_greatest_of_khans_decision_desc
		triggered_desc = {
			trigger = {
				NOR = {
					#Playing as Genghis
					this = character:125501
					#He came and went without becoming Genghis
					exists = global_var:genghis_died
					has_game_rule = never_mongol_invasion
				}
			}
			desc = mpo_become_greatest_of_khans_decision_genghis_warning
		}
	}

	cooldown = {
		years = 5
	}

	ai_check_interval = 12
	sort_order = 200

	decision_group_type = nomad_major

	is_shown = {
		government_has_flag = government_is_nomadic
		exists = situation:the_great_steppe
		any_character_situation = {
			this = situation:the_great_steppe
		}
		is_playable_character = yes
		NOR = {
			has_trait = greatest_of_khans
			any_owned_story = {
				story_type = story_greatest_of_khans
			}
		}
	}

	is_valid = {
		custom_tooltip = {
			text = gok_mongols_disable_warning_tt
			NOT = {
				has_global_variable = mongol_empire_has_spawned
			}
		}
		custom_tooltip = {
			text = greatest_of_khans_disable_warning_tt
			NOT = {
				is_target_in_global_variable_list = {
					name = unavailable_unique_decisions
					target = flag:mpo_become_greatest_of_khans_decision
				}
			}
		}
		custom_tooltip = {
			text = greatest_of_khans_war_ongoing_tt
			NOT = {
				exists = global_var:mpo_gok_war_ongoing
			}
		}
		custom_tooltip = {
			text = is_nomadic_tt
			government_has_flag = government_is_nomadic
		}
		custom_tooltip = {
			text = in_great_steppe_tt
			any_character_situation = {
				this = situation:the_great_steppe
			}
		}
		is_at_war = no
		has_realm_law = nomadic_authority_5
		prestige_level >= 4
		highest_held_title_tier = tier_empire
		trigger_if = { # If you are player Temüjin we waive this requirements
			limit = {
				NOT = { this = character:125501 }
			}
			OR = {
				sub_realm_size >= mpo_greatest_of_khans_target_counties
				save_temporary_scope_value_as = {
					name = temp_gok_tributaries
					value = sub_realm_with_tributaries_size
				}
				
				custom_tooltip = {
					text = greatest_of_khans_tributary_req
					sub_realm_with_tributaries_size >= mpo_greatest_of_khans_target_counties_tributaries
				}
			}
			custom_tooltip = {
				text = greatest_of_khans_vassal_culture_req_tt
				OR = {
					any_vassal = {
						government_has_flag = government_is_nomadic
						culture = {
							save_temporary_scope_as = culture_1
						}
					}
					any_tributary = {
						government_has_flag = government_is_nomadic
						culture = {
							save_temporary_scope_as = culture_1
						}
					}
				}
				OR = {
					any_vassal = {
						government_has_flag = government_is_nomadic
						NOT = {
							culture = scope:culture_1
						}
						culture = {
							save_temporary_scope_as = culture_2
						}
					}
					any_tributary = {
						government_has_flag = government_is_nomadic
						NOT = {
							culture = scope:culture_1
						}
						culture = {
							save_temporary_scope_as = culture_2
						}
					}
				}
				OR = {
					any_vassal = {
						government_has_flag = government_is_nomadic
							NOR = {
							culture = scope:culture_1
							culture = scope:culture_2
						}
						culture = {
							save_temporary_scope_as = culture_3
						}
					}
					any_tributary = {
						government_has_flag = government_is_nomadic
						NOR = {
							culture = scope:culture_1
							culture = scope:culture_2
						}
						culture = {
							save_temporary_scope_as = culture_3
						}
					}
				}
				trigger_if = {
					limit = {
						is_ai = no
					}
					OR = {
						any_vassal = {
							government_has_flag = government_is_nomadic
							NOR = {
								culture = scope:culture_1
								culture = scope:culture_2
								culture = scope:culture_3
							}
							culture = {
								save_temporary_scope_as = culture_4
							}
						}
						any_tributary = {
							government_has_flag = government_is_nomadic
							NOR = {
								culture = scope:culture_1
								culture = scope:culture_2
								culture = scope:culture_3
							}
							culture = {
								save_temporary_scope_as = culture_4
							}
						}
					}
					OR = {
						any_vassal = {
							government_has_flag = government_is_nomadic
							NOR = {
								culture = scope:culture_1
								culture = scope:culture_2
								culture = scope:culture_3
								culture = scope:culture_4
							}
							culture = {
								save_temporary_scope_as = culture_5
							}
						}
						any_tributary = {
							government_has_flag = government_is_nomadic
							NOR = {
								culture = scope:culture_1
								culture = scope:culture_2
								culture = scope:culture_3
								culture = scope:culture_4
							}
						}
					}
				}
			}
		}
		#AI cheat a little because they lack intent
		trigger_if = {
			limit = {
				is_ai = no
			}
			custom_tooltip = {
				text = greatest_of_khans_obedience_req_tt
				NOT = {
					any_powerful_vassal = {
						government_has_flag = government_is_nomadic
						obedience_target = root
						is_obedient = no
						is_ai = yes
					}
				}
			}
		}
		trigger_else = {
			NOT = {
				any_powerful_vassal = {
					is_ai = yes
					government_has_flag = government_is_nomadic
					has_dread_level_towards = {
						target = root
						level < 1
					}
					AND = {
						obedience_target = root
						is_obedient = no
						is_ai = yes
					}
					opinion = {
						target = root
						value <= 50
					}
				}
			}
		}
		trigger_if = {
			limit = {
				is_ai = no
				this = character:125501 # Temüjin
				has_variable = had_mpo_temujin_flavor_0020
			}
			custom_tooltip = {
				text = temujin_jamukha_gok_requirement
				character:mpo_mongol_1 = { # Jamukha
					is_alive = no
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_adult = yes
		trigger_if = {
			limit = {
				is_ai = no
			}
			is_available = yes
		}
		trigger_else = {
			is_imprisoned = no
			is_incapable = no
			is_alive = yes
			NOT = { has_trait = infirm }
		}
		is_independent_ruler = yes
	}

	cost = {
		gold = {
			value = massive_gold_value
		}
		prestige = {
			value = massive_prestige_value
		}
	}

	effect = {
		
		custom_description_no_bullet = { text = mpo_gok_war_of_submission_will_happen_tt }
		custom_tooltip = mpo_gok_cravens_wont_fight_tt
		custom_tooltip = mpo_gok_obedient_vassals_join_war_tt
		add_character_modifier = {
			modifier = aspiring_great_khan_modifier
			years = 5
		}

		custom_description_no_bullet = { text = mpo_gok_war_of_submission_victory_tt }
		custom_tooltip = greatest_of_khans_will_disable_warning_tt
		show_as_tooltip = {
			add_trait = greatest_of_khans
		}
		custom_tooltip = greatest_of_khans_prevents_mongol_invasion_tt
		custom_tooltip = mpo_gok_war_of_submission_vassals_tt
		custom_tooltip = mpo_gok_war_of_submission_truces_tt
		gain_heroic_legend_seed_tooltip_effect = yes

		show_as_tooltip = {
			custom_tooltip = greatest_of_khans_nickname_tt
			add_prestige = monumental_prestige_gain
			add_legitimacy = monumental_legitimacy_gain

			custom_tooltip = become_greatest_of_khans_decision_enable_gok_invasion_cb
			custom_tooltip = become_greatest_of_khans_decision_gok_armies_tt
			if = {
				limit = {
					culture = culture:mongol
				}
				custom_tooltip = become_greatest_of_khans_decision_gain_mongol_empire
			}
			else = {
				custom_tooltip = become_greatest_of_khans_decision_gain_gok_empire
			}
			
			if = {
				limit = {
					NOT = {
						has_realm_law = single_heir_succession_kurultai_law
					}
				}
				add_realm_law_skip_effects = single_heir_succession_kurultai_law
			}
			custom_tooltip = gain_gok_dynasty_modifier_tt
		}

		custom_description_no_bullet = { text = mpo_gok_war_of_submission_defeat_tt }
		custom_tooltip = mpo_gok_war_of_submission_defeat_imprisonment_tt
		custom_tooltip = mpo_gok_war_of_submission_defeat_lose_titles_tt
		custom_tooltip = mpo_gok_war_of_submission_defeat_lose_herd_tt
		show_as_tooltip = {
			add_legitimacy = monumental_legitimacy_loss
			if = {
				limit = {
					government_has_flag = government_is_nomadic
					has_realm_law = nomadic_authority_2
					NOT = {
						has_realm_law = nomadic_authority_1
					}
				}
				add_realm_law = nomadic_authority_1
			}
			else_if = {
				limit = {
					government_has_flag = government_is_nomadic
					NOT = {
						has_realm_law = nomadic_authority_1
					}
				}
				add_realm_law = nomadic_authority_2
			}
			add_prestige_level = -1
		}

		save_scope_as = genghis_khan

		hidden_effect = {
			#Make list of rulers who are willing to fight
			#All valid nomads in same steppes
			situation:the_great_steppe ?= {
				every_situation_sub_region = {
					limit = {
						any_situation_sub_region_participant = {
							this = root
						}
					}
					every_situation_sub_region_participant = {
						limit = {
							mpo_gok_coalition_member_trigger = yes
						}
						add_to_list = anti_gok_coalition_members
					}
				}
				#Add neighbors one region over if in just one region
				if = {
					limit = {
						any_situation_sub_region = {
							count <= 1
							any_situation_sub_region_participant = {
								this = root
							}
						}
					}
					root = {
						every_land_neighboring_realm_with_tributaries_owner = {
							limit = {
								government_has_flag = government_is_nomadic
								mpo_gok_coalition_member_trigger = yes
							}
							if = {
								limit = {
									government_has_flag = government_is_nomadic
								}
								add_to_list = anti_gok_coalition_members
							}
							if = {
								limit = {
									is_tributary = yes
									top_suzerain = {
										government_has_flag = government_is_nomadic
									}
								}
								top_suzerain = {
									add_to_list = anti_gok_coalition_members
								}
							}
							if = {
								limit = {
									is_tributary = yes
									suzerain = {
										government_has_flag = government_is_nomadic
									}
								}
								suzerain = {
									add_to_list = anti_gok_coalition_members
								}
							}
							
						}
					}
				}

			}
			#Find the most powerful ruler in your vicinity
			mpo_find_powerful_opponent_for_gurkhan_effect = yes
			
			#People who hate you too, why not
			every_relation = {
				type = rival
				limit = {
					NOT = {
						is_in_list = anti_gok_coalition_members
					}
					is_ruler = yes
					mpo_gok_coalition_member_trigger = yes
				}
				add_to_list = anti_gok_coalition_members
			}

			#Make list of neighbors that will submit
			every_land_neighboring_realm_with_tributaries_owner = {
				limit = {
					mpo_gok_submitting_coward_trigger = yes
				}
				add_to_list = gok_submitters
				if = {
					limit = {
						is_in_list = anti_gok_coalition_members
					}
					remove_from_list = anti_gok_coalition_members
				}
			}
		}

		#add obedient vassals as war allies
		hidden_effect = {
			
			#Make list of obedient vassals that will join you
			every_vassal = {
				limit = {
					is_obedient = yes
					government_has_flag = government_is_nomadic
					is_ai = yes
				}
				add_to_list = obedient_nomad_vassals
			}
		}

		#Choose strongest coalition member
		if = {
			limit = {
				any_in_list = {
					list = anti_gok_coalition_members
					current_military_strength > 0
					NOT = {
						this = root
					}
					is_landed = yes
					sub_realm_size >= 20
					government_has_flag = government_is_nomadic
					is_independent_ruler = yes
				}
			}
			ordered_in_list = {
				list = anti_gok_coalition_members
				order_by = current_military_strength
				limit = {
					NOT = {
						this = root
					}
					is_landed = yes
					sub_realm_size >= 20
					government_has_flag = government_is_nomadic
					is_independent_ruler = yes
				}
				save_scope_as = primary_coalition_defender
			}
		}
		else_if = {
			limit = {
				any_in_list = {
					list = anti_gok_coalition_members
					current_military_strength > 0
					is_landed = yes
					sub_realm_size >= 12
					NOT = {
						this = root
					}
					government_has_flag = government_is_nomadic
					is_independent_ruler = yes
				}
			}
			ordered_in_list = {
				list = anti_gok_coalition_members
				order_by = current_military_strength
				limit = {
					is_landed = yes
					NOT = {
						this = root
					}
					sub_realm_size >= 12
					government_has_flag = government_is_nomadic
					is_independent_ruler = yes
				}
				save_scope_as = primary_coalition_defender
			}
		}
		else = {
			ordered_in_list = {
				list = anti_gok_coalition_members
				order_by = sub_realm_size
				limit = {
					highest_held_title_tier >= tier_duchy
					NOT = {
						this = root
					}
					is_independent_ruler = yes
				}
				save_scope_as = primary_coalition_defender
			}
		}
		#It's possible no one is in list... need to find someone worthy
		#In the WHOLE steppe
		if = {
			limit = {
				NOT = {
					exists = scope:primary_coalition_defender
				}
			}
			situation:the_great_steppe ?= {
				ordered_situation_participant = {
					order_by = current_military_strength
					limit = {
						is_ai = yes
						NOR = {
							this = root
							top_liege = root
						}
						highest_held_title_tier >= tier_duchy
						is_independent_ruler = yes
					}
					save_scope_as = primary_coalition_defender
					add_to_list = anti_gok_coalition_members
				}
			}
		}
		#And... root's strongest vassal, I guess
		if = {
			limit = {
				NOT = {
					exists = scope:primary_coalition_defender
				}
			}
			ordered_vassal = {
				order_by = current_military_strength
				limit = {
					is_ai = yes
					NOT = { is_obedient_to = root }
					NOR = {
						government_has_flag = government_is_herder
						is_imprisoned_by = root
					}
					is_allied_to = root
					NOT = {
						this = root
					}
				}
				save_scope_as = primary_coalition_defender
			}
		}
		#This great khan has been very thorough already
		#Adding all members of all steppe regions
		if = {
			limit = {
				NOT = {
					any_in_list = {
						count >= 4
						list = anti_gok_coalition_members
						NOT = {
							this = scope:primary_coalition_defender
						}
					}
				}
			}
			situation:the_great_steppe ?= {
				every_situation_participant = {
					limit = {
						is_ai = yes
						NOT = {
							government_has_flag = government_is_herder
						}
						NOR = {
							is_allied_to = root
							this = root
							top_liege = root
							has_relation_friend = root
							has_relation_blood_brother = root
							is_imprisoned_by = root
						}
					}
					add_to_list = anti_gok_coalition_members
				}
			}
		}
		#Adding all non-loyal vassals
		if = {
			limit = {
				NOT = {
					any_in_list = {
						count >= 4
						list = anti_gok_coalition_members
						NOT = {
							this = scope:primary_coalition_defender
						}
					}
				}
			}
			every_vassal = {
				limit = {
					is_ai = yes
					NOT = { is_obedient_to = root }
					NOR = {
						government_has_flag = government_is_herder
						is_imprisoned_by = root
						is_allied_to = root
					}
					NOT = {
						this = root
					}
				}
				add_to_list = anti_gok_coalition_members
			}
		}

		#Ok... hopefully now there DEFINITELY is a leader for root's enemies and at least a couple enemies to fight

		#hidden setup event
		trigger_event = mpo_greatest_of_khans.0100
	}

	ai_potential = {
		has_realm_law = nomadic_authority_5
		is_independent_ruler = yes
		government_has_flag = government_is_nomadic
		#Stronger than all neighbors
		NOT = {
			any_land_neighboring_realm_with_tributaries_owner = {
				mpo_gok_coalition_member_trigger = yes
				current_military_strength >= root.current_military_strength
			}
		}
		OR = {
			realm_size >= 70
			sub_realm_with_tributaries_size >= 120
			#Has an ally that can seriously help
			any_ally = {
				count >= 1
				OR = {
					highest_held_title_tier >= tier_empire
					current_military_strength >= root.current_military_strength
				}
				is_at_war = no
			}
			#Has strong allies
			any_ally = {
				count >= 2
				highest_held_title_tier >= tier_kingdom
				is_at_war = no
			}
			any_ally = {
				count >= 3
				highest_held_title_tier >= tier_duchy
				is_at_war = no
			}
			#is conqueror already
			has_trait = conqueror
			#Is ballsy
			OR = {
				ai_boldness >= high_positive_ai_value
				ai_energy >= high_positive_ai_value
				ai_greed >= high_positive_ai_value
			}
		}
		health >= poor_health
		age <= 50
	}

	ai_will_do = {
		base = 0
		#NOT twice as strong as any neighbor or char in steppe region
		modifier = {
			add = -25
			OR = {
				any_land_neighboring_realm_with_tributaries_owner = {
					mpo_gok_coalition_member_trigger = yes
					#THIS SHOULD CHECK THEIR STRENGTH IS MORE THAN HALF ROOT'S
					confederation_worthy_foe_strength_ratio_value_root < 2
				}
				situation:the_great_steppe ?= {
					any_situation_sub_region = {
						any_situation_sub_region_participant = {
							this = root
						}
						any_situation_sub_region_participant = {
							NOT = { this = root }
							#THIS SHOULD CHECK ROOT'S STRENGTH IS DOUBLE THEIRS
							confederation_worthy_foe_strength_ratio_value_root < 2
						}
					}
				}
			}
		}
		#Three times as strong as any neighbor or char in steppe region
		modifier = {
			add = 75
			NOR = {
				any_land_neighboring_realm_with_tributaries_owner = {
					mpo_gok_coalition_member_trigger = yes
					#THIS SHOULD CHECK ROOT'S STRENGTH IS TRIPLE THEIRS
					confederation_worthy_foe_strength_ratio_value_root < 3
				}
				situation:the_great_steppe ?= {
					any_situation_sub_region = {
						any_situation_sub_region_participant = {
							this = root
						}
						any_situation_sub_region_participant = {
							NOT = { this = root }
							#THIS SHOULD CHECK ROOT'S STRENGTH IS TRIPLE THEIRS
							confederation_worthy_foe_strength_ratio_value_root < 3
						}
					}
				}
			}
		}
		modifier = {
			add = 25
			OR = {
				ai_boldness > 0
				ai_energy > 0
				ai_greed > 0
			}
		}
		modifier = {
			add = 25
			ai_boldness > 0
			ai_energy > 0
			ai_greed > 0
		}
		modifier = {
			add = -50
			OR = {
				ai_boldness <= medium_negative_ai_value
				ai_energy <= medium_negative_ai_value
				ai_greed <= medium_negative_ai_value
			}
		}
		modifier = {
			add = 25
			OR = {
				ai_boldness >= medium_positive_ai_value
				ai_energy >= medium_positive_ai_value
				ai_greed >= medium_positive_ai_value
			}
		}
		modifier = {
			add = 10
			culture = {
				has_cultural_pillar = ethos_bellicose
			}
		}
		modifier = {
			add = -10
			culture = {
				OR = {
					has_cultural_tradition = tradition_isolationist
					has_cultural_tradition = tradition_hereditary_hierarchy
					has_cultural_tradition = tradition_legalistic
				}
			}
		}
		# If young - go for it!!!!
		modifier = {
			add = 20
			age <= 35
		}
		#Want to make it less likely this happens early
		modifier = {
			add = -25
			current_date <= 1000
		}
		#Want to make it more likely this happens if game is getting late and Genghis didn't happen somehow
		modifier = {
			add = 100
			current_date >= 1250
		}
	}
}

#GREATEST OF KHANS HAS BECOME LORD OF ALL
mpo_gok_world_conquest_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_great_khan.dds"
	}
	decision_group_type = nomad_major
	desc = mpo_gok_world_conquest_decision_desc

	ai_check_interval = 36
	sort_order = 300

	is_shown = {
		exists = global_var:first_gok.dynasty
		exists = global_var:greatest_of_khans_title
		has_mpo_dlc_trigger = yes
		any_owned_story = {
			story_type = story_greatest_of_khans
		}
		is_playable_character = yes
	}

	is_valid = {
		NOT = {
			current_year >= global_var:gok_empire_crumble_date
		}
		dynasty = global_var:first_gok.dynasty
		global_var:greatest_of_khans_title = {
			holder = root
		}
		is_independent_ruler = yes
		custom_tooltip = {
			text = is_nomadic_tt
			government_has_flag = government_is_nomadic
		}
		has_realm_law = nomadic_authority_5
		#Legitimace is hamstrung a bit if you don't own legends
		trigger_if = {
			limit = {
				has_dlc_feature = legends
				is_ai = no
			}
			legitimacy_level >= 5
		}
		trigger_else_if = {
			limit = {
				NOT = { has_dlc_feature = legends }
				is_ai = yes
			}
			legitimacy_level >= 3
		}
		trigger_else = {
			legitimacy_level >= 4
		}
		
		trigger_if = {
			limit = {
				is_ai = no
			}
			prestige_level >= 5
		}
		trigger_else = {
			prestige_level >= 4
		}
		
		highest_held_title_tier = tier_empire

		OR = {
			sub_realm_size >= mpo_gok_world_conquest_target_counties
			save_temporary_scope_value_as = {
				name = temp_gok_tributaries
				value = sub_realm_with_tributaries_size
			}
			
			custom_tooltip = {
				text = gok_world_conquest_tributary_req
				sub_realm_with_tributaries_size >= mpo_gok_world_conquest_target_counties_tributaries
			}
		}
		
		#AI cheat a little because they lack intent
		trigger_if = {
			limit = {
				is_ai = no
			}
			custom_tooltip = {
				text = greatest_of_khans_obedience_req_tt
				NOT = {
					any_powerful_vassal = {
						government_has_flag = government_is_nomadic
						obedience_target = root
						is_obedient = no
						is_ai = yes
					}
				}
			}
		}
		trigger_else = {
			NOT = {
				any_powerful_vassal = {
					is_ai = yes
					government_has_flag = government_is_nomadic
					has_dread_level_towards = {
						target = root
						level < 1
					}
					AND = {
						obedience_target = root
						is_obedient = no
						is_ai = yes
					}
					opinion = {
						target = root
						value <= 50
					}
				}
			}
		}
	}
	
	is_valid_showing_failures_only = {
		is_at_war = no
		is_landed = yes
		is_adult = yes
		trigger_if = {
			limit = {
				is_ai = no
			}
			is_available = yes
		}
		trigger_else = {
			is_imprisoned = no
			is_incapable = no
			is_alive = yes
			NOT = { has_trait = infirm }
		}
	}

	cost = {
		prestige = {
			value = 5000
		}
		gold = {
			value = 5000
			if = {
				limit = { is_ai = no }
				#Realm size
				if = {
					limit = { root.realm_size >= 3000 }
					multiply = 3
				}
				else_if = {
					limit = { root.realm_size >= 2500 }
					multiply = 2.5
				}
				else_if = {
					limit = { root.realm_size >= 2000 }
					multiply = 2
				}
				else_if = {
					limit = { root.realm_size >= 1500 }
					multiply = 1.5
				}
			}
		}
	}

	effect = {
		save_scope_value_as = {
			name = gok_empire_crumble_date
			value = global_var:gok_empire_crumble_date
		}
		save_scope_as = actor
		save_scope_as = gok

		gok_final_decision_list_setup = yes

		#SHOW GENERAL EFFECTS THAT HAPPEN REGARDLESS OF OPTION CHOICE

		custom_tooltip = gok_reform_never_available_again_tt
		
		custom_tooltip = gok_reform_invalides_gok_stuff_tt
		custom_tooltip = gok_lose_succession_protection_tt
		custom_tooltip = gok_avoid_timing_out_tt
		
		show_as_tooltip = {
			gok_world_conquest_generic_rewards_effect = yes
		}
		custom_tooltip = gok_remain_nomadic_tt
		if = {
			limit = {
				has_dlc_feature = admin_gov
			}
			custom_tooltip = gok_choose_government_switch_tt
		}
		else = {
			custom_tooltip = gok_choose_government_switch_no_admin_tt
		}
		#SHOW SUPER NOMADIC EFFECTS
		custom_description_no_bullet = {
			text = gok_gov_if_super_nomadic_tt
		}
		custom_tooltip = gok_super_nomad_dread_and_gold_tt
		custom_tooltip = gok_counties_become_nomad_counties_tt
		custom_tooltip = gok_new_nomad_counties_lose_development_tt
		custom_tooltip = gok_other_counties_lose_development_tt
		custom_tooltip = gok_non_nomads_become_nomad_tt
		custom_tooltip = gok_city_state_creation

		#SHOW GOVERNMENT CHANGE EFFECTS
		custom_description_no_bullet = {
			text = gok_gov_switch_options_tt
		}
		show_as_tooltip = {
			nomad_domicile_refund_effect = yes
			nomad_convert_herds_to_gold_special_troops_effect = yes
			gok_upgrade_realm_and_government_effect = yes
		}
		#Gain innovations if ya need em
		if = {
			limit = {
				culture = {
					NOT = {
						has_cultural_era_or_later = culture_era_early_medieval
					}
				}
			}
			ordered_realm_county = {
				order_by = development_level
				limit = {
					culture = {
						has_cultural_era_or_later = culture_era_early_medieval
						save_temporary_scope_as = realm_culture
						NOT = {
							this = root.culture
						}
					}
					root.culture = {
						can_get_innovation_from = scope:realm_culture
						
					}
				}
				culture = {save_scope_as = realm_culture_1 }
			}
		}
		if = {
			limit = {
				culture = {
					NOT = {
						has_cultural_era_or_later = culture_era_high_medieval
					}
				}
			}
			ordered_realm_county = {
				order_by = development_level
				limit = {
					trigger_if = {
						limit = {
							exists = scope:realm_culture_1
						}
						NOT = {
							culture = scope:realm_culture_1
						}
					}
					
					culture = {
						NOT = {
							this = root.culture
						}
						has_cultural_era_or_later = culture_era_high_medieval
						save_temporary_scope_as = realm_culture
					}
					root.culture = {
						can_get_innovation_from = scope:realm_culture
						
					}
				}
				culture = { save_scope_as = realm_culture_2 }
			}
		}
		if = {
			limit = {
				culture = {
					NOT = {
						has_cultural_era_or_later = culture_era_late_medieval
					}
				}
			}
			ordered_realm_county = {
				order_by = development_level
				limit = {
					culture = {
						trigger_if = {
							limit = {
								exists = scope:realm_culture_1
							}
							NOT = {
								this = scope:realm_culture_1
							}
						}
						trigger_if = {
							limit = {
								exists = scope:realm_culture_2
							}
							NOT = {
								this = scope:realm_culture_2
							}
						}
						NOT = {
							this = root.culture
						}
						has_cultural_era_or_later = culture_era_late_medieval
						save_temporary_scope_as = realm_culture
					}
					root.culture = {
						can_get_innovation_from = scope:realm_culture
						
					}
				}
				culture = { save_scope_as = realm_culture_3 }
			}
		}
		if = {
			limit = {
				exists = scope:realm_culture_1
				exists = scope:realm_culture_2
				exists = scope:realm_culture_3
			}
			custom_tooltip = gok_3_innovation_gain
		}
		else_if = {
			limit = {
				exists = scope:realm_culture_1
				exists = scope:realm_culture_2
			}
			custom_tooltip = gok_2_innovation_gain
		}
		else_if = {
			limit = {
				exists = scope:realm_culture_1
			}
			custom_tooltip = gok_1_innovation_gain
		} 
		#Fires event that lets you choose new government type
		trigger_event = {
			id = mpo_greatest_of_khans.0030
			days = 1
		}
	}

	ai_potential = {
		any_owned_story = {
			story_type = story_greatest_of_khans
		}
		sub_realm_size >= mpo_gok_world_conquest_target_counties
		is_independent_ruler = yes
	}

	ai_will_do = {
		base = 100
	}
}

settle_people_decision = {
	picture = {
		reference = "gfx/interface/illustrations/holding_types/city_western.dds"
	} 
	decision_group_type = nomad_major

	ai_check_interval = 36

	desc = settle_people_decision_desc
	selection_tooltip = settle_people_decision_tooltip

	is_shown = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_playable_character = yes
	}

	is_valid = {
		OR = {
			has_realm_law = nomadic_authority_3
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
		custom_tooltip = {
			text = step_away_from_the_steppe_decision_holding_tt
			any_sub_realm_county = {
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_available = yes
	}

	cost = {
		prestige = {
			value = medium_prestige_value
		}
	}

	effect = {
		save_scope_as = nomad_settling_down
		domicile.domicile_culture = { save_scope_as = invading_culture }
		domicile.domicile_faith = { save_scope_as = invading_faith }
		save_scope_value_as = {
			name = invading_herd_value
			value = domicile.herd
		}
		nomad_domicile_refund_effect = yes
		nomad_convert_herds_to_gold_special_troops_effect = yes
		every_sub_realm_county = {
			limit = {
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			add_to_list = potential_new_capitals
		}
		every_held_title = {
			limit = {
				tier = tier_county
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			add_to_list = potential_new_capitals
		}
		ordered_in_list = {
			order_by = development_level
			list = potential_new_capitals
			save_scope_as = new_capital
		}
		if = {
			limit = {
				capital_county = {
					title_province = {
						NOR = { 
							has_holding_type = nomad_holding 
							has_holding_type = herder_holding 
						}
					}
				}
			}
			capital_county = {
				save_scope_as = new_capital
			}
		}
		if = {
			limit = {
				exists = scope:new_capital
				capital_county != scope:new_capital
			}
			if = {
				limit = {
					scope:new_capital.holder != root
				}
				create_title_and_vassal_change = {
					type = usurped
					save_scope_as = change
					add_claim_on_loss = yes
				}
				scope:new_capital = {
					change_title_holder = {
						holder = root
						change = scope:change
					}
				}
				resolve_title_and_vassal_change = scope:change
			}
			set_realm_capital = scope:new_capital
		}
		scope:new_capital.duchy = { save_scope_as = nomad_duchy_for_name }
		#Should gain target title, if possible
		if = {
			limit = {
				OR = {
					scope:new_capital.kingdom.holder ?= root
					is_independent_ruler = no
				}
			}
			# Already holds it, or is a vassal
		}
		else_if = {
			limit = {
				scope:new_capital.kingdom = {
					NOT = {
						exists = holder
					}
				}
			}
			create_title_and_vassal_change = {
				type = created
				save_scope_as = change
				add_claim_on_loss = yes
			}
			scope:new_capital.kingdom = {
				save_scope_as = new_primary
				change_title_holder = {
					holder = scope:attacker
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
		else = {
			#Gain capital duchy, if possible
			if = {
				limit = {
					scope:new_capital.duchy = {
						NOT = {
							exists = holder
						}
					}
				}
				hidden_effect = {
					create_title_and_vassal_change = {
						type = created
						save_scope_as = change_1
						add_claim_on_loss = yes
					}
					scope:new_capital.duchy = {
						change_title_holder = {
							holder = root
							change = scope:change_1
						}
					}
					resolve_title_and_vassal_change = scope:change_1
				}
			}
			#Gain titular kingdom
			if = {
				limit = {
					OR = {
						highest_held_title_tier < tier_kingdom
						NOT = {
							any_held_title = {
								tier = tier_kingdom
								any_in_de_jure_hierarchy = {
									tier = tier_county
									holder.top_liege = root
									title_province = {
										NOR = {
											has_holding_type = nomad_holding 
											has_holding_type = herder_holding 
										}
									}
								}
							}
						}
					}
				}
				custom_tooltip = overrunning_gain_titular_kingdom_tt
				hidden_effect = {
					create_dynamic_title = {
						tier = kingdom
						name = SETTLED_NOMAD_KINGDOM_NAME
						adj = SETTLED_NOMAD_KINGDOM_NAME_ADJ
					}
					scope:new_title = {
						save_scope_as = new_primary
						set_definitive_form = yes
					}
					create_title_and_vassal_change = {
						type = created
						save_scope_as = change_2
						add_claim_on_loss = no
					}
					scope:new_title = {
						set_can_be_named_after_dynasty = yes
						change_title_holder = {
							holder = root
							change = scope:change_2
						}
					}
					resolve_title_and_vassal_change = scope:change_2
					scope:new_title = { generate_coa = yes }
				}
			}
		}

		#Make this their primary title, if highest tier
		hidden_effect = {
			if = {
				limit = {
					exists = scope:new_primary
					NOT = {
						highest_held_title_tier > scope:new_primary.tier
					}
				}
				set_primary_title_to = scope:new_primary
			}
			# Destroy kingdoms you no longer have land in
			every_held_title = {
				limit = {
					tier = tier_kingdom
					is_titular = no
					NOT = {
						any_in_de_jure_hierarchy = {
							tier = tier_county
							holder.top_liege = root
							title_province = {
								NOR = {
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
					}
				}
				root = {
					destroy_title = prev
				}
			}
		}

		every_held_title = {
			limit = {
				tier >= tier_county
				title_province = {
					OR = {
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			save_temporary_scope_as = nomadic_county
			create_character = {
				location = scope:nomadic_county.title_province
				template = nomadic_chieftain_character
				save_scope_as = new_nomadic_chieftain
			}

			if = {
				limit = { 
					root = {
						is_independent_ruler = yes 
						is_tributary = no
					}
				}

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And give the chieftain their independence.
				scope:new_nomadic_chieftain = {
					becomes_independent = { change = scope:change }
				}
				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
			else_if = {
				limit = { 
					root = { 
						is_independent_ruler = yes 
						is_tributary = yes
					}
				}

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And make the chieftain a tributary of root's suzerain
				start_tributary_interaction_effect = {
					TRIBUTARY = scope:new_nomadic_chieftain
					SUZERAIN = root.suzerain
				}

				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
			else = {
				# root = { is_independent_ruler = no }, i.e. a vassal

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And make the chieftain vassal of root's liege
				scope:new_nomadic_chieftain = {
					change_liege = {
						liege = root.liege
						change = scope:change
					}
				}
				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
		}

		if = {
			limit = {
				scope:new_capital.title_province ?= {
					has_holding_type = tribal_holding
				}
			}
			change_government = tribal_government
			if = {
				limit = {
					NOT = { has_realm_law = tribal_authority_3 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = tribal_authority_3
				}
			}
		}
		else_if = {
			limit = {
				ep3_is_clan_inclined_trigger = yes
			}
			change_government = clan_government
			if = {
				limit = {
					NOT = { has_realm_law = crown_authority_3 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = crown_authority_3
				}
			}
		}
		else = {
			change_government = feudal_government

			if = {
				limit = {
					NOT = { has_realm_law = crown_authority_3 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = crown_authority_3
				}
			}
		}
		if = {
			limit = {
				NOT = { government_has_flag = government_allows_nomad_domicile_titles }
				any_held_title = {
					is_nomad_title = yes
				}
			}
			every_held_title = {
				limit = {
					is_nomad_title = yes
				}
				root = {
					destroy_title = prev
				}
			}
		}
		
		if = {
			limit = {
				any_vassal = {
					OR = {
						has_government = nomad_government
						has_government = herder_government
					}
					capital_county = {
						title_province = {
							NOR = { 
								has_holding_type = nomad_holding 
								has_holding_type = herder_holding 
							}
						}
					}
				}
			}
			custom_tooltip = {
				text = step_away_from_the_steppe_decision_vassal_convert
				
				every_vassal = {
					limit = {
						OR = {
							has_government = nomad_government
							has_government = herder_government
						}
						capital_county = {
							title_province = {
								NOR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
					}
					nomad_domicile_refund_effect = yes
					nomad_convert_herds_to_gold_special_troops_effect = yes
					if = {
						limit = {
							scope:new_capital.title_province = {
								has_holding_type = tribal_holding
							}
						}
						change_government = tribal_government
						if = {
							limit = {
								NOT = { has_realm_law = tribal_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = tribal_authority_1
							}
						}
					}
					else_if = {
						limit = {
							ep3_is_clan_inclined_trigger = yes
						}
						change_government = clan_government
						if = {
							limit = {
								NOT = { has_realm_law = crown_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = crown_authority_1
							}
						}
					}
					else = {
						change_government = feudal_government

						if = {
							limit = {
								NOT = { has_realm_law = crown_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = crown_authority_1
							}
						}
					}

					if = {
						limit = {
							NOT = { government_has_flag = government_allows_nomad_domicile_titles }
							any_held_title = {
								is_nomad_title = yes
							}
						}
						every_held_title = {
							limit = {
								is_nomad_title = yes
							}
							root = {
								destroy_title = prev
							}
						}
					}
					every_vassal = {
						limit = {
							OR = {
								has_government = nomad_government
								has_government = herder_government
							}
							capital_county = {
								title_province = {
									NOR = { 
										has_holding_type = nomad_holding 
										has_holding_type = herder_holding 
									}
								}
							}
						}
						nomad_domicile_refund_effect = yes
						nomad_convert_herds_to_gold_special_troops_effect = yes
						if = {
							limit = {
								scope:new_capital.title_province = {
									has_holding_type = tribal_holding
								}
							}
							change_government = tribal_government
							if = {
								limit = {
									NOT = { has_realm_law = tribal_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = tribal_authority_1
								}
							}
						}
						else_if = {
							limit = {
								ep3_is_clan_inclined_trigger = yes
							}
							change_government = clan_government
							if = {
								limit = {
									NOT = { has_realm_law = crown_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = crown_authority_1
								}
							}
						}
						else = {
							change_government = feudal_government

							if = {
								limit = {
									NOT = { has_realm_law = crown_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = crown_authority_1
								}
							}
						}
						
						if = {
							limit = {
								NOT = { government_has_flag = government_allows_nomad_domicile_titles }
								any_held_title = {
									is_nomad_title = yes
								}
							}
							every_held_title = {
								limit = {
									is_nomad_title = yes
								}
								root = {
									destroy_title = prev
								}
							}
						}
						
						every_vassal = {
							limit = {
								OR = {
									has_government = nomad_government
									has_government = herder_government
								}
								capital_county = {
									title_province = {
										NOR = { 
											has_holding_type = nomad_holding 
											has_holding_type = herder_holding 
										}
									}
								}
							}
							nomad_domicile_refund_effect = yes
							nomad_convert_herds_to_gold_special_troops_effect = yes
							if = {
								limit = {
									scope:new_capital.title_province = {
										has_holding_type = tribal_holding
									}
								}
								change_government = tribal_government
								if = {
									limit = {
										NOT = { has_realm_law = tribal_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = tribal_authority_1
									}
								}
							}
							else_if = {
								limit = {
									ep3_is_clan_inclined_trigger = yes
								}
								change_government = clan_government
								if = {
									limit = {
										NOT = { has_realm_law = crown_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = crown_authority_1
									}
								}
							}
							else = {
								change_government = feudal_government

								if = {
									limit = {
										NOT = { has_realm_law = crown_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = crown_authority_1
									}
								}
							}
							if = {
								limit = {
									NOT = { government_has_flag = government_allows_nomad_domicile_titles }
									any_held_title = {
										is_nomad_title = yes
									}
								}
								every_held_title = {
									limit = {
										is_nomad_title = yes
									}
									root = {
										destroy_title = prev
									}
								}
							}
						}
					}
				}
			}
		}
		custom_tooltip = {
			text = settle_people_decision_usurp_until_domain_limit
			hidden_effect = {
				while = {
					limit = {
						domain_size <= domain_limit
						any_sub_realm_county = {
							holder != root
							holder = { is_ai = yes }
							OR = {
								target_is_de_jure_liege_or_above = root.capital_county.kingdom
								any_neighboring_county = {
									holder = root
								}
							}
							title_province = {
								NOR = {
									has_holding_type = nomad_holding
									has_holding_type = herder_holding
								}
							}
						}
					}
					random_sub_realm_county = {
						limit = {
							holder != root
							holder = { is_ai = yes }
							OR = {
								target_is_de_jure_liege_or_above = root.capital_county.kingdom
								any_neighboring_county = {
									holder = root
								}
							}
							title_province = {
								NOR = {
									has_holding_type = nomad_holding
									has_holding_type = herder_holding
								}
							}
						}
						weight = {
							base = 1
							modifier = {
								add = {
									every_neighboring_county = {
										limit = {
											holder = root
										}
										add = 100
									}
								}
								any_neighboring_county = {
									holder = root
								}
							}
							modifier = {
								add = 10000
								any_neighboring_county = {
									this = root.capital_county
								}
							}
						}
						create_title_and_vassal_change = {
							type = revoked
							save_scope_as = change
							add_claim_on_loss = yes
						}
						change_title_holder = {
							holder = root
							change = scope:change
						}
						resolve_title_and_vassal_change = scope:change
					}
				}
			}
		}
		
		custom_tooltip = {
			text = settle_people_decision_culture_shift
			hidden_effect = {
				capital_county = {
					set_county_culture = scope:invading_culture
					set_county_faith = scope:invading_faith
				}
				every_vassal = {
					limit = {
						culture = root.culture
						highest_held_title_tier >= tier_duchy
					}
					#Convert capital to their culture
					capital_county = {
						set_county_culture = scope:invading_culture
						set_county_faith = scope:invading_faith
					}
				}
				while = {
					limit = {
						scope:invading_herd_value >= 2500
						any_sub_realm_county = {
							NOT = {
								culture = scope:invading_culture
							}
						}
					}
					random_sub_realm_county = {
						limit = {
							NOT = {
								culture = scope:invading_culture
							}
						}
						weight = {
							base = 1
							modifier = {
								add = {
									every_neighboring_county = {
										limit = {
											culture = scope:invading_culture
										}
										add = 100
									}
								}
								any_neighboring_county = {
									culture = scope:invading_culture
								}
							}
							modifier = {
								add = 10000
								any_neighboring_county = {
									this = root.capital_county
								}
							}
						}
						set_county_culture = scope:invading_culture
						set_county_faith = scope:invading_faith
					}
					save_scope_value_as = {
						name = invading_herd_value
						value = {
							add = scope:invading_herd_value
							subtract = 2500
						}
					}
				}
			}
		}

		custom_tooltip = {
			text = step_away_from_the_steppe_decision_vassal_loss

			every_vassal = {
				limit = {
					OR = {
						has_government = nomad_government
						has_government = herder_government
					}
					NOT = {
						capital_county = {
							title_province = {
								NOR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
					}
				}
				
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				becomes_independent = { change = scope:change }
				resolve_title_and_vassal_change = scope:change
			}

			every_tributary = {
				# all tributaries end
				end_tributary = yes
			}
		}
	}

	ai_potential = {
		NOR = {
			has_trait = greatest_of_khans
			has_trait = conqueror
		}
		OR = {
			has_trait = content
			domicile.herd <= 500
			is_independent_ruler = no
			AND = {
				culture = { has_cultural_pillar = heritage_magyar }
				OR = {
					has_title = title:k_hungary
					has_title = title:e_carpathia
				}
			}
			NOT = {
				any_sub_realm_county = {
					title_province = {
						has_holding_type = nomad_holding
					}
				}
			}
		}
	}

	ai_will_do = {
		base = 0

		# different holdings are valued more or less

		modifier = {
			add = 100
			any_sub_realm_county = {
				count >= 3
				title_province = {
					has_holding_type = castle_holding
				}
			}
		}

		modifier = {
			add = 10
			any_sub_realm_county = {
				count >= 3
				title_province = {
					has_holding_type = tribal_holding
				}
			}
		}

		modifier = {
			add = 20
			any_sub_realm_county = {
				count >= 3
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
			}
		}

		# development checks

		modifier = {
			add = 25
			any_sub_realm_county = {
				count >= 3
				root.capital_county != this
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
				development_level >= root.capital_county.development_level
			}
		}

		modifier = {
			add = 25
			any_held_title = {
				count >= 5
				tier = tier_county
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
			}
		}

		# traits

		modifier = {
			add = 10
			OR = {
				highest_skill = learning
				highest_skill = stewardship
			}
		}
		modifier = {
			add = 10
			OR = {
				has_trait = craven
				has_trait = lazy
				has_trait = greedy
				has_trait = reclusive
			}
		}
		modifier = {
			add = -25
			OR = {
				highest_skill = martial
				has_trait = athletic
			}
		}
		modifier = {
			add = -50
			has_trait = ambitious
		}

		# Hungarians want to settle
		modifier = {
			add = 1000
			culture = { has_cultural_pillar = heritage_magyar }
			OR = {
				has_title = title:k_hungary
				has_title = title:e_carpathia
			}
		}

		# Nomadic Vassals of non-Nomads want to settle down
		modifier = {
			add = 100
			top_liege != root
			NOT = {
				top_liege = {
					government_has_flag = government_is_nomadic
				}
			}
		}

		# Nomadic Vassals of Nomads do NOT want to settle down
		modifier = {
			factor = 0
			top_liege != root
			top_liege = {
				government_has_flag = government_is_nomadic
			}
		}

		modifier = {
			factor = 0
			top_liege = {
				government_has_flag = government_is_nomadic
			}
			highest_held_title_tier >= tier_kingdom
			NOR = {
				has_title = title:k_hungary
				has_title = title:e_carpathia
				any_sub_realm_county = {
					count >= 10
					title_province = {
						OR = {
							has_holding_type = castle_holding
							has_holding_type = tribal_holding
						}
					}
				}
			}
		}
	}
}

step_away_from_the_steppe_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_scenes/mpo_rural_village_asian.dds"
	} 
	decision_group_type = nomad_minor

	ai_check_interval = 36

	desc = step_away_from_the_steppe_decision_desc
	selection_tooltip = step_away_from_the_steppe_decision_tooltip

	is_shown = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_playable_character = yes
	}

	is_valid = {
		custom_tooltip = {
			text = step_away_from_the_steppe_decision_holding_tt
			any_sub_realm_county = {
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_available = yes
	}

	cost = {
		prestige = {
			value = medium_prestige_value
		}
	}

	effect = {
		nomad_domicile_refund_effect = yes
		nomad_convert_herds_to_gold_special_troops_effect = yes
		every_sub_realm_county = {
			limit = {
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			add_to_list = potential_new_capitals
		}
		every_held_title = {
			limit = {
				tier = tier_county
				title_province = {
					NOR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			add_to_list = potential_new_capitals
		}
		ordered_in_list = {
			order_by = development_level
			list = potential_new_capitals
			save_scope_as = new_capital
		}
		if = {
			limit = {
				capital_county = {
					title_province = {
						NOR = { 
							has_holding_type = nomad_holding 
							has_holding_type = herder_holding 
						}
					}
				}
			}
			capital_county = {
				save_scope_as = new_capital
			}
		}
		if = {
			limit = {
				exists = scope:new_capital
				capital_county != scope:new_capital
			}
			if = {
				limit = {
					scope:new_capital.holder != root
				}
				create_title_and_vassal_change = {
					type = usurped
					save_scope_as = change
					add_claim_on_loss = yes
				}
				scope:new_capital = {
					change_title_holder = {
						holder = root
						change = scope:change
					}
				}
				resolve_title_and_vassal_change = scope:change
			}
			set_realm_capital = scope:new_capital
		}

		every_held_title = {
			limit = {
				tier >= tier_county
				title_province = {
					OR = {
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
			save_temporary_scope_as = nomadic_county
			create_character = {
				location = scope:nomadic_county.title_province
				template = nomadic_chieftain_character
				save_scope_as = new_nomadic_chieftain
			}

			if = {
				limit = { 
					root = {
						is_independent_ruler = yes 
						is_tributary = no
					}
				}

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And give the chieftain their independence.
				scope:new_nomadic_chieftain = {
					becomes_independent = { change = scope:change }
				}
				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
			else_if = {
				limit = { 
					root = { 
						is_independent_ruler = yes 
						is_tributary = yes
					}
				}

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And make the chieftain a tributary of root's suzerain
				start_tributary_interaction_effect = {
					TRIBUTARY = scope:new_nomadic_chieftain
					SUZERAIN = root.suzerain
				}

				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
			else = {
				# root = { is_independent_ruler = no }, i.e. a vassal

				#Assign the seceding titles to the new nomadic chieftain
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				change_title_holder = {
					holder = scope:new_nomadic_chieftain
					change = scope:change
					take_baronies = yes
				}

				#And make the chieftain vassal of root's liege
				scope:new_nomadic_chieftain = {
					change_liege = {
						liege = root.liege
						change = scope:change
					}
				}
				resolve_title_and_vassal_change = scope:change

				scope:new_nomadic_chieftain = {
					hidden_effect = {
						change_government = nomad_government
					}
				}
			}
		}

		if = {
			limit = {
				scope:new_capital.title_province ?= {
					has_holding_type = tribal_holding
				}
			}
			change_government = tribal_government
			if = {
				limit = {
					NOT = { has_realm_law = tribal_authority_1 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = tribal_authority_1
				}
			}
		}
		else_if = {
			limit = {
				ep3_is_clan_inclined_trigger = yes
			}
			change_government = clan_government
			if = {
				limit = {
					NOT = { has_realm_law = crown_authority_1 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = crown_authority_1
				}
			}
		}
		else = {
			change_government = feudal_government

			if = {
				limit = {
					NOT = { has_realm_law = crown_authority_1 }
				}
				hidden_effect = {
					add_realm_law_skip_effects = crown_authority_1
				}
			}
		}
		if = {
			limit = {
				NOT = { government_has_flag = government_allows_nomad_domicile_titles }
				any_held_title = {
					is_nomad_title = yes
				}
			}
			every_held_title = {
				limit = {
					is_nomad_title = yes
				}
				root = {
					destroy_title = prev
				}
			}
		}
		
		if = {
			limit = {
				any_vassal = {
					OR = {
						has_government = nomad_government
						has_government = herder_government
					}
					capital_county = {
						title_province = {
							NOR = { 
								has_holding_type = nomad_holding 
								has_holding_type = herder_holding 
							}
						}
					}
				}
			}
			custom_tooltip = {
				text = step_away_from_the_steppe_decision_vassal_convert
				
				every_vassal = {
					limit = {
						OR = {
							has_government = nomad_government
							has_government = herder_government
						}
						capital_county = {
							title_province = {
								NOR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
					}
					nomad_domicile_refund_effect = yes
					nomad_convert_herds_to_gold_special_troops_effect = yes
					if = {
						limit = {
							scope:new_capital.title_province = {
								has_holding_type = tribal_holding
							}
						}
						change_government = tribal_government
						if = {
							limit = {
								NOT = { has_realm_law = tribal_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = tribal_authority_1
							}
						}
					}
					else_if = {
						limit = {
							ep3_is_clan_inclined_trigger = yes
						}
						change_government = clan_government
						if = {
							limit = {
								NOT = { has_realm_law = crown_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = crown_authority_1
							}
						}
					}
					else = {
						change_government = feudal_government

						if = {
							limit = {
								NOT = { has_realm_law = crown_authority_1 }
							}
							hidden_effect = {
								add_realm_law_skip_effects = crown_authority_1
							}
						}
					}

					if = {
						limit = {
							NOT = { government_has_flag = government_allows_nomad_domicile_titles }
							any_held_title = {
								is_nomad_title = yes
							}
						}
						every_held_title = {
							limit = {
								is_nomad_title = yes
							}
							root = {
								destroy_title = prev
							}
						}
					}
					every_vassal = {
						limit = {
							OR = {
								has_government = nomad_government
								has_government = herder_government
							}
							capital_county = {
								title_province = {
									NOR = { 
										has_holding_type = nomad_holding 
										has_holding_type = herder_holding 
									}
								}
							}
						}
						nomad_domicile_refund_effect = yes
						nomad_convert_herds_to_gold_special_troops_effect = yes
						if = {
							limit = {
								scope:new_capital.title_province = {
									has_holding_type = tribal_holding
								}
							}
							change_government = tribal_government
							if = {
								limit = {
									NOT = { has_realm_law = tribal_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = tribal_authority_1
								}
							}
						}
						else_if = {
							limit = {
								ep3_is_clan_inclined_trigger = yes
							}
							change_government = clan_government
							if = {
								limit = {
									NOT = { has_realm_law = crown_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = crown_authority_1
								}
							}
						}
						else = {
							change_government = feudal_government

							if = {
								limit = {
									NOT = { has_realm_law = crown_authority_1 }
								}
								hidden_effect = {
									add_realm_law_skip_effects = crown_authority_1
								}
							}
						}
						
						if = {
							limit = {
								NOT = { government_has_flag = government_allows_nomad_domicile_titles }
								any_held_title = {
									is_nomad_title = yes
								}
							}
							every_held_title = {
								limit = {
									is_nomad_title = yes
								}
								root = {
									destroy_title = prev
								}
							}
						}
						
						every_vassal = {
							limit = {
								OR = {
									has_government = nomad_government
									has_government = herder_government
								}
								capital_county = {
									title_province = {
										NOR = { 
											has_holding_type = nomad_holding 
											has_holding_type = herder_holding 
										}
									}
								}
							}
							nomad_domicile_refund_effect = yes
							nomad_convert_herds_to_gold_special_troops_effect = yes
							if = {
								limit = {
									scope:new_capital.title_province = {
										has_holding_type = tribal_holding
									}
								}
								change_government = tribal_government
								if = {
									limit = {
										NOT = { has_realm_law = tribal_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = tribal_authority_1
									}
								}
							}
							else_if = {
								limit = {
									ep3_is_clan_inclined_trigger = yes
								}
								change_government = clan_government
								if = {
									limit = {
										NOT = { has_realm_law = crown_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = crown_authority_1
									}
								}
							}
							else = {
								change_government = feudal_government

								if = {
									limit = {
										NOT = { has_realm_law = crown_authority_1 }
									}
									hidden_effect = {
										add_realm_law_skip_effects = crown_authority_1
									}
								}
							}
							if = {
								limit = {
									NOT = { government_has_flag = government_allows_nomad_domicile_titles }
									any_held_title = {
										is_nomad_title = yes
									}
								}
								every_held_title = {
									limit = {
										is_nomad_title = yes
									}
									root = {
										destroy_title = prev
									}
								}
							}
						}
					}
				}
			}
		}

		custom_tooltip = {
			text = step_away_from_the_steppe_decision_vassal_loss

			every_vassal = {
				limit = {
					OR = {
						has_government = nomad_government
						has_government = herder_government
					}
					NOT = {
						capital_county = {
							title_province = {
								NOR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
					}
				}

				# they hate you
				add_opinion = {
					target = root
					modifier = forsook_nomadic_life_opinion
				}

				# also, they're leaving
				create_title_and_vassal_change = {
					type = independency
					save_scope_as = change
					add_claim_on_loss = no
				}
				becomes_independent = { change = scope:change }
				resolve_title_and_vassal_change = scope:change
			}

			every_tributary = {
				# nomadic and herder tributaries will hate you
				if = {
					limit = {
						OR = {
							has_government = nomad_government
							has_government = herder_government
						}
					}
					add_opinion = {
						target = root
						modifier = forsook_nomadic_life_opinion
					}
				}

				# all tributaries end
				end_tributary = yes
			}
		}
	}

	ai_potential = {
		NOR = {
			has_trait = greatest_of_khans
			has_trait = conqueror
			has_realm_law = nomadic_authority_3
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
		OR = {
			has_trait = content
			domicile.herd <= 500
			is_independent_ruler = no
			AND = {
				culture = { has_cultural_pillar = heritage_magyar }
				OR = {
					has_title = title:k_hungary
					has_title = title:e_carpathia
				}
			}
			NOT = {
				any_sub_realm_county = {
					title_province = {
						has_holding_type = nomad_holding
					}
				}
			}
		}
	}

	ai_will_do = {
		base = 0

		# different holdings are valued more or less

		modifier = {
			add = 100
			any_sub_realm_county = {
				count >= 3
				title_province = {
					has_holding_type = castle_holding
				}
			}
		}

		modifier = {
			add = 10
			any_sub_realm_county = {
				count >= 3
				title_province = {
					has_holding_type = tribal_holding
				}
			}
		}

		modifier = {
			add = 20
			any_sub_realm_county = {
				count >= 3
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
			}
		}

		# development checks

		modifier = {
			add = 25
			any_sub_realm_county = {
				count >= 3
				root.capital_county != this
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
				development_level >= root.capital_county.development_level
			}
		}

		modifier = {
			add = 25
			any_held_title = {
				count >= 5
				tier = tier_county
				title_province = {
					NOT = { has_holding_type = nomad_holding }
				}
			}
		}

		# traits

		modifier = {
			add = 10
			OR = {
				highest_skill = learning
				highest_skill = stewardship
			}
		}
		modifier = {
			add = 10
			OR = {
				has_trait = craven
				has_trait = lazy
				has_trait = greedy
				has_trait = reclusive
			}
		}
		modifier = {
			add = -25
			OR = {
				highest_skill = martial
				has_trait = athletic
			}
		}
		modifier = {
			add = -50
			has_trait = ambitious
		}

		# Hungarians want to settle
		modifier = {
			add = 1000
			culture = { has_cultural_pillar = heritage_magyar }
			OR = {
				has_title = title:k_hungary
				has_title = title:e_carpathia
			}
		}

		# Nomadic Vassals of non-Nomads want to settle down
		modifier = {
			add = 100
			top_liege != root
			NOT = {
				top_liege = {
					government_has_flag = government_is_nomadic
				}
			}
		}

		# Nomadic Vassals of Nomads do NOT want to settle down
		modifier = {
			factor = 0
			top_liege != root
			top_liege = {
				government_has_flag = government_is_nomadic
			}
		}

		modifier = {
			factor = 0
			top_liege = {
				government_has_flag = government_is_nomadic
			}
			highest_held_title_tier >= tier_kingdom
			NOR = {
				has_title = title:k_hungary
				has_title = title:e_carpathia
				any_sub_realm_county = {
					count >= 10
					title_province = {
						OR = {
							has_holding_type = castle_holding
							has_holding_type = tribal_holding
						}
					}
				}
			}
		}
	}
}

confederation_kingdom_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	decision_group_type = major
	ai_check_interval = 12
	desc = confederation_kingdom_decision_desc

	is_shown = {
		is_confederation_member = yes
		is_landed = yes
		is_playable_character = yes
	}

	is_valid = {
		prestige_level >= 3
		is_independent_ruler = yes
		custom_description = {
			text = confederation_kingdom_decision_vassal_req
			confederation = {
				any_confederation_member = {
					highest_held_title_tier >= tier_county
					count >= 5
				}
			}
		}
		custom_tooltip = {
			text = confederation_kingdom_decision_vassal_opinion_req
			NOT = {
				confederation = {
					any_confederation_member = {
						this != root
						opinion = {
							target = root
							value < 25
						}
					}
				}
			}
		}
		custom_tooltip = {
			text = confederation_kingdom_decision_vassal_prestige_level_req
			NOT = {
				confederation = {
					any_confederation_member = {
						this != root
						prestige_level >= root.prestige_level
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		is_at_war = no
		is_tributary = no
		custom_tooltip = {
			text = confederation_kingdom_decision_vassal_wars_req
			NOT = {
				confederation = {
					any_confederation_member = {
						is_at_war = yes
					}
				}
			}
		}
	}

	cost = {
		prestige = {
			value = {
				add = 0
				if = {
					limit = {
						government_has_flag = government_is_tribal
					}
					add = medium_prestige_value
				}
			}
		}
		herd = {
			value = {
				add = 0
				if = {
					limit = {
						government_has_flag = government_is_nomadic
					}
					add = medium_herd_value_static
				}
			}
		}
	}

	effect = {
		custom_tooltip = confederation_kingdom_creation_tt
		custom_tooltip = confederation_succession_tt
		custom_tooltip = confederation_king_modifier_tt
		custom_tooltip = confederation_vassal_modifier_tt
		custom_tooltip = confederation_county_modifier_tt
		save_scope_as = new_king_ruler
		hidden_effect = {
			confederation = {
				every_confederation_member = {
					add_to_list = confederation_vassals
					every_tributary = {
						limit = {
							highest_held_title_tier <= tier_duchy
						}
						add_to_list = confederation_vassals
					}
				}
			}
			primary_title = {
				save_scope_as = old_title
			}
			save_scope_as = confederation_offerer
			create_dynamic_title = {
				tier = kingdom
				name = CONFEDERATION_CULTURE_NAME
				adj = CONFEDERATION_CULTURE_NAME_ADJ
				pre = article_CONFEDERATION_CULTURE_NAME
			}
			scope:new_title = {
				set_variable = {
					name = confederation_culture
					value = scope:confederation_offerer.culture
				}
			}
			scope:new_title = {
				set_color_from_title = root.capital_county
				set_definitive_form = yes
			}
			
			create_title_and_vassal_change = {
				type = created
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:new_title = {
				set_destroy_on_gain_same_tier = yes
				set_no_automatic_claims = yes
				set_can_be_named_after_dynasty = no
				set_can_use_nomadic_naming = no
				change_title_holder = {
					holder = root
					change = scope:change
				}
			}
			every_in_list = {
				list = confederation_vassals
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
			
			create_title_and_vassal_change = {
				type = swear_fealty
				save_scope_as = change
				add_claim_on_loss = no
			}
			every_in_list = {
				list = confederation_vassals
				limit = {
					NOT = {
						this = root
					}
				}
				if = {
					limit = {
						has_government = herder_government
					}
					every_held_title = {
						limit = {
							tier = tier_county
							title_province = {
								has_holding_type = herder_holding
							}
						}
						title_province = {
							set_holding_type = nomad_holding
						}
					}
					change_government = nomad_government
				}
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
			

			scope:new_title = {
				generate_coa = yes
				add_title_law = confederation_elective_succession_law
				set_capital_county = root.capital_county
			}
			set_primary_title_to = scope:new_title
			confederation = {
				disband_confederation = yes
			}
			every_in_list = {
				list = confederation_vassals
				limit = {
					this != root
				}
				trigger_event = mpo_decisions_events.0004
			}
			trigger_event = mpo_decisions_events.0005
		}
	}

	ai_potential = {
		is_confederation_member = yes
	}

	ai_will_do = {
		base = 100
	}
}

settle_the_steppe_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_story/mpo_steppe_region.dds"
	} 
	decision_group_type = nomad_major

	ai_check_interval = 360

	desc = settle_the_steppe_decision_desc
	selection_tooltip = settle_the_steppe_decision_tooltip

	is_shown = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_playable_character = yes
	}

	is_valid = {
		is_independent_ruler = yes
		OR = {
			has_realm_law = nomadic_authority_3
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
		capital_county = {
			title_province = {
				OR = { 
					has_holding_type = nomad_holding 
					has_holding_type = herder_holding 
				}
			}
		}
		custom_tooltip = {
			text = step_away_from_the_steppe_decision_holding_tt
			any_sub_realm_county = {
				title_province = {
					OR = { 
						has_holding_type = nomad_holding 
						has_holding_type = herder_holding 
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_available = yes
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "CHOOSE_GOVERNMENT_NEXT_STEP_BUTTON"
		show_from_start = yes

		item = {
			value = become_tribal_decision
			current_description = become_tribal_decision
			localization = become_tribal_decision
			icon = "gfx/interface/icons/government_types/tribal_government.dds"
			ai_chance = {
				value = 0
			}
		}

		item = {
			value = become_feudal_decision
			current_description = become_feudal_decision
			localization = become_feudal_decision
			icon = "gfx/interface/icons/government_types/feudal_government.dds"
			is_valid = {
				trigger_if = {
					limit = {
						NOR = {
							has_realm_law = nomadic_authority_4
							has_realm_law = nomadic_authority_5
						}
					}
					has_realm_law = nomadic_authority_4
					has_realm_law = nomadic_authority_5
				}
			}
			ai_chance = {
				value = 100
			}
		}

		item = {
			value = become_clan_decision
			current_description = become_clan_decision
			localization = become_clan_decision
			icon = "gfx/interface/icons/government_types/clan_government.dds"
			is_valid = {
				trigger_if = {
					limit = {
						NOR = {
							has_realm_law = nomadic_authority_4
							has_realm_law = nomadic_authority_5
						}
					}
					has_realm_law = nomadic_authority_4
					has_realm_law = nomadic_authority_5
				}
				trigger_if = {
					limit = {
						NOR = {
							faith.religion = religion:islam_religion
							culture = { has_cultural_pillar = heritage_arabic }
							culture = { has_cultural_pillar = heritage_iranian }
							culture = { has_cultural_pillar = heritage_turkic }
						}
					}
					faith.religion = religion:islam_religion
					culture = { has_cultural_pillar = heritage_arabic }
					culture = { has_cultural_pillar = heritage_iranian }
					culture = { has_cultural_pillar = heritage_turkic }
				}
			}
			ai_chance = {
				value = 100
			}
		}
	}

	cost = {
		gold = {
			value = {
				if = {
					limit = {
						scope:become_tribal_decision = yes
					}
					every_sub_realm_county = {
						limit = {
							title_province = {
								OR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
						add = 5
					}
				}
				else_if = {
					limit = {
						OR = {
							scope:become_feudal_decision = yes
							scope:become_clan_decision = yes
						}
					}
					every_sub_realm_county = {
						limit = {
							title_province = {
								OR = { 
									has_holding_type = nomad_holding 
									has_holding_type = herder_holding 
								}
							}
						}
						add = 25
					}
				}
			}
		}
		prestige = {
			value = major_prestige_value
		}
	}

	effect = {
		# MPO ACHIEVEMENT Settling In
		if = {
			limit = { is_ai = no }
			add_achievement_global_variable_effect = {
				VARIABLE = mpo_settling_in_achievement_unlocked
				VALUE = yes
			}
		}
		save_scope_as = nomad_settling_down
		domicile.domicile_culture = { save_scope_as = invading_culture }
		domicile.domicile_faith = { save_scope_as = invading_faith }
		save_scope_value_as = {
			name = invading_herd_value
			value = domicile.herd
		}
		save_scope_value_as = {
			name = development_herd_value
			value = domicile.herd
		}
		nomad_domicile_refund_effect = yes
		nomad_convert_herds_to_gold_special_troops_effect = yes
		
		show_as_tooltip = {
			if = {
				limit= {
					scope:become_tribal_decision = yes
				}
				change_government = tribal_government
			}
			else_if = {
				limit= {
					scope:become_feudal_decision = yes
				}
				change_government = feudal_government
			}
			else_if = {
				limit= {
					scope:become_clan_decision = yes
				}
				change_government = clan_government
			}
		}
		
		custom_tooltip = nomad_holdings_convert_tt
		custom_tooltip = nomad_vassals_convert_tt
		custom_tooltip = buildings_based_on_herd_tt
		custom_tooltip = development_based_on_herd_tt
		
		hidden_effect = {
			#Nuke tribal authorities.
			if = {
				limit = { has_realm_law = nomadic_authority_1 }
				remove_realm_law = nomadic_authority_1
			}
			if = {
				limit = { has_realm_law = nomadic_authority_2 }
				remove_realm_law = nomadic_authority_2
			}
			if = {
				limit = { has_realm_law = nomadic_authority_3 }
				remove_realm_law = nomadic_authority_3
			}
			if = {
				limit = { has_realm_law = nomadic_authority_4 }
				remove_realm_law = nomadic_authority_4
			}
			if = {
				limit = { has_realm_law = nomadic_authority_5 }
				remove_realm_law = nomadic_authority_5
			}
			if = {
				limit = {
					scope:become_tribal_decision = yes
				}
				every_sub_realm_county = {
					limit = {
						title_province = {
							OR = { 
								has_holding_type = nomad_holding 
								has_holding_type = herder_holding 
							}
						}
					}
					title_province = {
						set_holding_type = tribal_holding
					}
					add_to_list = holding_conversion
				}
				change_government = tribal_government
				every_vassal_or_below = {
					limit = {
						has_government = nomad_government
					}
					#Nuke tribal authorities.
					if = {
						limit = { has_realm_law = nomadic_authority_1 }
						remove_realm_law = nomadic_authority_1
					}
					if = {
						limit = { has_realm_law = nomadic_authority_2 }
						remove_realm_law = nomadic_authority_2
					}
					if = {
						limit = { has_realm_law = nomadic_authority_3 }
						remove_realm_law = nomadic_authority_3
					}
					if = {
						limit = { has_realm_law = nomadic_authority_4 }
						remove_realm_law = nomadic_authority_4
					}
					if = {
						limit = { has_realm_law = nomadic_authority_5 }
						remove_realm_law = nomadic_authority_5
					}
					change_government = tribal_government
					if = {
						limit = {
							NOT = { has_realm_law = tribal_authority_1 }
						}
						add_realm_law_skip_effects = tribal_authority_1
					}
				}
				#Start off tribal authorities.
				if = {
					limit = {
						NOT = { has_realm_law = tribal_authority_2 }
					}
					add_realm_law_skip_effects = tribal_authority_2
				}
			}
			if = {
				limit = {
					OR = {
						scope:become_feudal_decision = yes
						scope:become_clan_decision = yes
					}
				}
				every_sub_realm_county = {
					limit = {
						title_province = {
							OR = { 
								has_holding_type = nomad_holding 
								has_holding_type = herder_holding 
							}
						}
					}
					title_province = {
						set_holding_type = castle_holding
					}
					add_to_list = holding_conversion
					random_county_province = {
						limit = {
							has_holding = no
							barony_cannot_construct_holding = no
						}
						random = {
							chance = 50
							modifier = {
								add = 50
								this.county = root.capital_county
							}
							modifier = {
								add = 25
								scope:become_feudal_decision = yes
							}
							modifier = {
								add = {
									value = scope:invading_herd_value
									divide = 1000
								}
							}
							set_holding_type = city_holding
						}
					}
					random_county_province = {
						limit = {
							has_holding = no
							barony_cannot_construct_holding = no
						}
						random = {
							chance = 50
							modifier = {
								add = 50
								this.county = root.capital_county
							}
							modifier = {
								add = 50
								barony = {
									is_holy_site_of = root.faith
								}
							}
							modifier = {
								add = 25
								scope:become_clan_decision = yes
							}
							modifier = {
								add = {
									value = scope:invading_herd_value
									divide = 1000
								}
							}
							set_holding_type = church_holding
						}
					}
				}
				if = {
					limit = {
						scope:become_feudal_decision = yes
					}
					change_government = feudal_government
				}
				else_if = {
					limit = {
						scope:become_clan_decision = yes
					}
					change_government = clan_government
				}
				every_vassal_or_below = {
					limit = {
						has_government = nomad_government
					}
					#Nuke tribal authorities.
					if = {
						limit = { has_realm_law = nomadic_authority_1 }
						remove_realm_law = nomadic_authority_1
					}
					if = {
						limit = { has_realm_law = nomadic_authority_2 }
						remove_realm_law = nomadic_authority_2
					}
					if = {
						limit = { has_realm_law = nomadic_authority_3 }
						remove_realm_law = nomadic_authority_3
					}
					if = {
						limit = { has_realm_law = nomadic_authority_4 }
						remove_realm_law = nomadic_authority_4
					}
					if = {
						limit = { has_realm_law = nomadic_authority_5 }
						remove_realm_law = nomadic_authority_5
					}
					if = {
						limit = {
							scope:become_feudal_decision = yes
						}
						change_government = feudal_government
					}
					else_if = {
						limit = {
							scope:become_clan_decision = yes
						}
						change_government = clan_government
					}
					#Start off crown authorities.
					if = {
						limit = {
							NOT = { has_realm_law = crown_authority_1 }
						}
						add_realm_law_skip_effects = crown_authority_1
					}
				}
				#Start off crown authorities.
				if = {
					limit = {
						NOT = { has_realm_law = crown_authority_2 }
					}
					add_realm_law_skip_effects = crown_authority_2
				}
			}
			while = {
				limit = {
					scope:invading_herd_value >= 2000
				}
				every_in_list = {
					list = holding_conversion
					every_county_province = {
						generate_building = yes
					}
				}
				save_scope_value_as = {
					name = invading_herd_value
					value = {
						add = scope:invading_herd_value
						subtract = 2000
					}
				}
			}
			if = {
				limit = {
					scope:become_tribal_decision = yes
				}
				while = {
					limit = {
						scope:development_herd_value >= 2000
					}
					random_sub_realm_county = {
						weight = {
							base = 1
							modifier = {
								add = 9
								this = root.capital_county
							}
							modifier = {
								add = 6
								any_neighboring_county = {
									this = root.capital_county
								}
							}
							modifier = {
								factor = 1
								is_coastal_county = yes
							}
						}
						change_development_level = 1
					}
					save_scope_value_as = {
						name = development_herd_value
						value = {
							add = scope:development_herd_value
							subtract = 2000
						}
					}
				}
			}
			else = {
				while = {
					limit = {
						scope:development_herd_value >= 1000
					}
					random_sub_realm_county = {
						weight = {
							base = 1
							modifier = {
								add = 9
								this = root.capital_county
							}
							modifier = {
								add = 6
								any_neighboring_county = {
									this = root.capital_county
								}
							}
							modifier = {
								factor = 1
								is_coastal_county = yes
							}
						}
						change_development_level = 1
					}
					save_scope_value_as = {
						name = development_herd_value
						value = {
							add = scope:development_herd_value
							subtract = 1000
						}
					}
				}
			}
		}
		
	}

	ai_potential = {
		NOR = {
			has_trait = greatest_of_khans
			has_trait = conqueror
		}
		OR = {
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
		culture = {
			has_cultural_tradition = tradition_ruling_caste
		}
		NOT = {
			any_vassal_or_below = {
				is_ai = no
			}
		}
	}

	ai_will_do = {
		base = 10
	}
}

become_nomadic_decision = {
	picture = {
		reference = "gfx/interface/illustrations/event_story/mpo_steppe_region.dds"
	}

	desc = become_nomadic_decision_desc
	selection_tooltip = become_nomadic_decision_tooltip
	
	ai_check_interval = 0

	is_shown = {
		has_mpo_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		is_playable_character = yes
		capital_county = {
			any_county_situation = {
				OR = {
					situation:game_rule_extra_nomads_arabs ?= this
					situation:game_rule_extra_nomads_sami ?= this
					situation:game_rule_extra_nomads_tibet ?= this
					situation:game_rule_extra_nomads_sahel ?= this
					situation:game_rule_extra_nomads_horn ?= this
				}
			}
		}
	}

	is_valid = {
		is_independent_ruler = yes
		is_landed = yes
		has_government = tribal_government
		realm_size < 10
	}

	is_valid_showing_failures_only = {
		is_at_war = no
		is_available = yes
	}

	cost = {
		prestige = {
			value = major_prestige_value
		}
	}

	effect = {
		every_sub_realm_county = {
			limit = {
				title_province = {
					has_holding_type = tribal_holding
				}
			}
			title_province = {
				set_holding_type = nomad_holding
			}
		}
		change_government = nomad_government
		every_vassal_or_below = {
			limit = {
				has_government = tribal_government
				highest_held_title_tier >= tier_county
			}
			change_government = nomad_government
		}
	}

	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}
}
