﻿confederation_kingdom_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	decision_group_type = major
	
	ai_check_interval_by_tier = {
		barony = 0
		county = 12
		duchy = 12
		kingdom = 0
		empire = 0
		hegemony = 0
	}
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {confederation = {has_flag = TMA_nato}}
				desc = elevate_nato
			}
			triggered_desc = {
				trigger = {confederation = {has_flag = TMA_csto}}
				desc = elevate_csto
			}
		}
	}
	
	desc = confederation_kingdom_decision_desc

	is_shown = {
		is_confederation_member = yes
		exists = confederation
		is_landed = yes
		is_playable_character = yes
		NOT = { exists = confederation.leading_house }
	}

	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 = domicile.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
				article = 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
	}
}
leave_confederation_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	
	ai_check_interval_by_tier = {
		barony = 0
		county = 12
		duchy = 12
		kingdom = 0
		empire = 0
		hegemony = 0
	}	
	desc = leave_confederation_decision_desc
	selection_tooltip = leave_confederation_decision_tooltip

	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					confederation = {has_flag = TMA_nato}
				}
				desc = leave_nato
			}
		}
	}
	is_shown = {
		confederation ?= { is_house_based = no }
	}

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

	is_valid_showing_failures_only = {
		is_available = yes
	}

	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 = { # 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.house
					}
				}
			}
			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
							}
						}
					}
				}
			}
		}
		modifier = {
			desc = "BARANGAY_TRADITION_REASON"
			trigger = {
				culture = {
					has_cultural_parameter = invite_to_confederation_extra_reasons
				}
			}
			add = -20
		}
	}
}