﻿# culture changes
terteroba_culture_migration_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
	}
	decision_group_type = major

	ai_check_interval = 36

	desc = terteroba_culture_migration_decision_desc
	selection_tooltip = terteroba_culture_migration_decision_tooltip

	is_shown = {
		is_ruler = yes
		is_landed = yes
		exists = dynasty
		current_date < 1000.1.1
		exists = title:e_terteroba
		has_title = title:e_terteroba
		# check that there are available county cultures that can be replaced
		any_county_in_region = {
			count > 0
			region = special_terteroba_culture_region
			culture = {
				has_cultural_pillar = heritage_turkic
				NOR = {
					this = culture:cuman
					any_parent_culture_or_above = { this = culture:cuman }
					this = culture:kipchak
					any_parent_culture_or_above = { this = culture:kipchak }
				}
			}
		}
	}

	cooldown = { years = 3 }

	# I am using lots of custom tooltips here, because there is no vanilla localization for most of this stuff
	is_valid = {
		has_primary_title = title:e_terteroba
		# make sure that the khazars are subjugated and are no longer a threat
		any_county_in_region = {
			custom_tooltip = { text = terteroba_culture_migration_decision_percent_text }
			percent >= 0.8
			custom_tooltip = { text = terteroba_culture_migration_decision_region_text }
			region = special_terteroba_culture_region
			OR = {
				holder = root
				holder = { target_is_liege_or_above = root }
			}
		}
		# your culture is cuman / kipchak or decendend from them
		OR = {
			culture = culture:cuman
			custom_tooltip = {
				text = terteroba_culture_migration_decision_descended_cuman_text
				culture = { any_parent_culture_or_above = { this = culture:cuman } }
			}
			culture = culture:kipchak
			custom_tooltip = {
				text = terteroba_culture_migration_decision_descended_kipchak_text
				culture = { any_parent_culture_or_above = { this = culture:kipchak } }
			}
		}
		# check that there are available county cultures that can be replaced
		any_sub_realm_county = {
			custom_tooltip = { text = terteroba_culture_migration_decision_count_text }
			count > 0
			# only check a specific region
			custom_tooltip = {
				text = terteroba_culture_migration_decision_region_text
				# region = region_name works, but has no localization
				title_province = { geographical_region = special_terteroba_culture_region }
			}
			culture = {
				# only replace cultures with a specific heritage
				custom_tooltip = {
					text = terteroba_culture_migration_decision_heritage_turkic_text
					has_cultural_pillar = heritage_turkic
				}
				# but don't replace cuman / kipchak or their diverged / hybridized child cultures
				NOR = {
					custom_tooltip = {
						text = terteroba_culture_migration_decision_not_cuman_text
						this = culture:cuman
					}
					custom_tooltip = {
						text = terteroba_culture_migration_decision_not_descended_cuman_text
						any_parent_culture_or_above = { this = culture:cuman }
					}
					custom_tooltip = {
						text = terteroba_culture_migration_decision_not_kipchak_text
						this = culture:kipchak
					}
					custom_tooltip = {
						text = terteroba_culture_migration_decision_not_descended_kipchak_text
						any_parent_culture_or_above = { this = culture:kipchak }
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_imprisoned = no
	}

	cost = { # only players pay a cost
		gold = {
			value = 0
			if = {
				limit = { is_ai = no }
				add = 250
			}
		}
		prestige = {
			value = 0
			if = {
				limit = { is_ai = no }
				add = 500
			}
		}
		piety = {
			value = 0
			if = {
				limit = { is_ai = no }
				add = 50
			}
		}
	}

	effect = {
		custom_tooltip = { text = terteroba_culture_migration_decision_effect_text }
		hidden_effect = {
			terteroba_culture_migration_decision_effect = yes
			terteroba_culture_migration_decision_effect = yes
			terteroba_culture_migration_decision_effect = yes
			terteroba_culture_migration_decision_effect = yes
			terteroba_culture_migration_decision_effect = yes
		}
		hidden_effect = {
			if = {
				limit = {
					title:e_caspian-pontic_steppe = {
						is_title_created = yes
						is_titular = yes
					}
				}
				title:e_caspian-pontic_steppe.holder = { destroy_title = title:e_caspian-pontic_steppe }
			}
		}
	}

	ai_potential = {
		primary_title.tier = tier_empire
		has_primary_title = title:e_terteroba
	}

	ai_will_do = { base = 100 }
}