﻿# court_language_ai_score = {
# 	add = scope:their_language_counties

# 	# Bit of relative score for percentage too
# 	add = {
# 		value = scope:their_language_counties
# 		multiply = 10
# 		divide = scope:total_counties
# 	}
# 	if = {
# 		limit = { scope:checking_native_language = no }
# 		subtract = scope:my_language_counties
# 	}

# 	#Adjust for Court Grandeur.
# 	#World religions primarily cares about other courts that share their faith.
# 	add = {
# 		value = 0
# 		if = {	#Islamic rulers cares about islamic courts
# 			limit = {
# 				faith.religion = religion:islam_religion
# 				scope:target.faith.religion = religion:islam_religion
# 			}
# 			add = {
# 				value = scope:target.court_grandeur_current
# 				if = { #Reduce further if not same faith
# 					limit = {
# 						NOT = { faith = scope:target.faith }
# 					}
# 					divide = 2
# 				}
# 			}
# 		}
# 		else_if = {	#Christian cares about other Christians - especially of the same faith
# 			limit = {
# 				faith.religion = religion:christianity_religion
# 				scope:target.faith.religion = religion:christianity_religion
# 			}
# 			add = {
# 				value = scope:target.court_grandeur_current
# 				if = { #Reduce further if not same faith
# 					limit = {
# 						NOT = { faith = scope:target.faith }
# 					}
# 					divide = 3
# 				}
# 			}
# 		}
# 		else_if = {	#Eastern Faiths
# 			limit = {
# 				OR = {
# 					faith.religion = religion:hinduism_religion
# 					faith.religion = religion:buddhism_religion
# 					faith.religion = religion:jainism_religion
# 				}
# 				OR = {
# 					scope:target.faith.religion = religion:hinduism_religion
# 					scope:target.faith.religion = religion:buddhism_religion
# 					scope:target.faith.religion = religion:jainism_religion
# 				}
# 			}
# 			add = {
# 				value = scope:target.court_grandeur_current
# 				if = { #Reduce further if not same Religion
# 					limit = {
# 						NOT = { faith.religion = scope:target.faith.religion }
# 					}
# 					divide = 2
# 				}
# 			}
# 		}
# 		else_if = { #Abrahamic religion matching vs non co-religionist - CGV Ignored
# 			limit = {
# 				OR = {
# 					faith.religion = religion:islam_religion
# 					faith.religion = religion:christianity_religion
# 				}
# 				NOT = { faith.religion = scope:target.faith.religion }
# 			}
# 			##add nothing
# 		}
# 		else_if = { #Eastern religion matching vs non Eastern religion - CGV Ignored
# 			limit = {
# 				OR = {
# 					faith.religion = religion:hinduism_religion
# 					faith.religion = religion:buddhism_religion
# 					faith.religion = religion:jainism_religion
# 				}
# 				NOR = {
# 					scope:target.faith.religion = religion:hinduism_religion
# 					scope:target.faith.religion = religion:buddhism_religion
# 					scope:target.faith.religion = religion:jainism_religion
# 				}
# 			}
# 			##add nothing
# 		}
# 		else = { #Everyone else just cares about the Grandeur directly
# 			add = scope:target.court_grandeur_current
# 		}
# 	}


# 	#Increase from number of other courts using the Language (1.5 per court).
# 	add = {
# 		value = scope:courts_with_language
# 		multiply = 1.5
# 	}

# 	#Arbitrary Geographical Bias - if our courts are not in the same region the score is divided by 2.
# 	divide = {
# 		value = 1
# 		if = {
# 			limit = {
# 				OR = {
# 					#Europe:
# 					AND = {
# 						capital_province = { geographical_region = world_europe_west_britannia }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_west_britannia } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_west_germania }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_west_germania } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_west_francia }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_west_francia } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_west_iberia }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_west_iberia } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_north }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_north } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_south_east }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_south_east } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_europe_south_italy }
# 						NOT = { scope:target.capital_province = { geographical_region = world_europe_south_italy } }
# 					}
# 					#South Asia:
# 					AND = {
# 						capital_province = { geographical_region = world_india_rajastan }
# 						scope:target.capital_province = { geographical_region = world_india_rajastan }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_india_bengal }
# 						NOT = { scope:target.capital_province = { geographical_region = world_india_bengal } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_india_deccan }
# 						NOT = { scope:target.capital_province = { geographical_region = world_india_deccan } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_burma }
# 						NOT = { scope:target.capital_province = { geographical_region = world_burma } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_himalaya }
# 						NOT = { scope:target.capital_province = { geographical_region = world_himalaya } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_middle_east }
# 						NOT = { scope:target.capital_province = { geographical_region = world_middle_east } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_middle_east_persia }
# 						NOT = { scope:target.capital_province = { geographical_region = world_middle_east_persia } }
# 					}
# 					#Africa
# 					AND = {
# 						capital_province = { geographical_region = world_africa_north }
# 						NOT = { scope:target.capital_province = { geographical_region = world_africa_north } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_africa_west }
# 						NOT = { scope:target.capital_province = { geographical_region = world_africa_west } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_africa_east }
# 						NOT = { scope:target.capital_province = { geographical_region = world_africa_east } }
# 					}
# 					#Central Asia
# 					AND = {
# 						capital_province = { geographical_region = world_steppe_west }
# 						NOT = { scope:target.capital_province = { geographical_region = world_steppe_west } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_steppe_east }
# 						NOT = { scope:target.capital_province = { geographical_region = world_steppe_east } }
# 					}
# 					AND = {
# 						capital_province = { geographical_region = world_tibet }
# 						NOT = { scope:target.capital_province = { geographical_region = world_tibet } }
# 					}
# 				}
# 			}
# 			add = 1
# 		}
# 	}

# 	# Prefer the status quo slightly. Needs to be last
# 	if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			has_court_language_of_culture = culture
# 		}
# 		multiply = 1.5
# 	}
# 	else_if = {
# 		limit = {
# 			scope:checking_native_language = no
# 			has_same_court_language = scope:target
# 		}
# 		multiply = 1.5
# 	}
	
# 	# CCU: Prefer not to switch from native language to very different languages
# 	if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			NOT = { culture = { has_same_language_family_as_trigger = { TARGET = scope:target.culture } } }
# 		}
# 		multiply = 0.2
# 	}
# 	else_if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			NOT = { culture = { has_same_language_branch_as_trigger = { TARGET = scope:target.culture } } }
# 		}
# 		multiply = 0.4
# 	}
# 	else_if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			NOT = { culture = { has_same_language_group_as_trigger = { TARGET = scope:target.culture } } }
# 		}
# 		multiply = 0.8
# 	}
# 	else_if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			NOT = { culture = { has_same_dialect_continuum_as_trigger = { TARGET = scope:target.culture } } }
# 		}
# 		multiply = 1.0
# 	}
# 	if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			culture = { is_in_language_union_with_trigger = { TARGET = scope:target.culture } }
# 		}
# 		multiply = 2.0 #Reverts not in same family effect
# 	}
# 	if = {
# 		limit = {
# 			scope:checking_native_language = yes
# 			culture = { has_a_creole_language_trigger = { TARGET = scope:target.culture } }
# 		}
# 		multiply = 4.0 #Reverts not in same family/group effect
# 	}
# }
