#######################
# MONGOL VALUES
#######################
# Conquering things
# Drinking mare's milk
# Destroying civilisations
# Fighting


# Chance of Mongols appearing per year between 1180 and 1250
temujin_appearance_base_chance = 1

# Weight used in selecting targets for the automated Mongol invasions
mongol_invasion_target_character_weight = {
	value = 0.001
	every_sub_realm_county = {
		if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_start_region
				}
			}
			add = 10000
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_prio_1
				}
			}
			add = 5000
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_prio_2
				}
			}
			add = 3000
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_prio_3
				}
			}
			add = 2000
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_prio_4
				}
			}
			add = 1000
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_prio_5
				}
			}
			add = 500
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = special_mongol_empire_conquest_region_cleanup
				}
			}
			add = 250
		}
		else_if = {
			limit = {
				title_province = {
					geographical_region = world_tibet
				}
			}
			add = -100
		}
	}
}

# Mongol breakup succession score
mongol_breakup_succession_score = {
	# Prioritize the actual heir
	if = {
		limit = {
			exists = scope:old_mongol_emperor.primary_heir
			this = scope:old_mongol_emperor.primary_heir
		}
		add = 100
	}
	# A bonus for being of the same house
	if = {
		limit = {
			exists = house
			house = scope:old_mongol_emperor.house
		}
		add = 50
	}
	# Prioritize siblings
	if = {
		limit = {
			is_sibling_of = scope:old_mongol_emperor
		}
		add = 100
	}
	# Children of children of the old khan gain some priority
	else_if = {
		limit = {
			any_parent = {
				any_parent = {
					this = scope:old_mongol_emperor
				}
			}
		}
		add = 50
	}
	else_if = {
		limit = {
			is_close_family_of = scope:old_mongol_emperor
		}
		add = 30
	}
	else_if = {
		limit = {
			is_close_or_extended_family_of = scope:old_mongol_emperor
		}
		add = 15
	}
	# Skill bonuses
	add = sum_of_all_skills_value
	
	# Gender preference, can't check for realm law so using faith
	if = {
		limit = {
			is_female = yes
			scope:old_mongol_emperor.faith = {
				has_doctrine_parameter = male_dominated_law
			}
		}
		multiply = 0.1
	}
	else_if = {
		limit = {
			scope:old_mongol_emperor.faith = {
				has_doctrine_parameter = female_dominated_law
			}
		}
		multiply = 0.1
	}
	
	# A penalty for not being the same culture, mongol, or an accepted culture
	if = {
		limit = {
			NOR = {
				culture = scope:old_mongol_emperor.culture
				culture = culture:mongol
				culture = {
					cultural_acceptance = {
						target = scope:old_mongol_emperor.culture
						value >= 75
					}
				}
			}
		}
		multiply = 0.1
	}
	
	# Not adult
	if = {
		limit = {
			is_adult = no
		}
		multiply = 0.1
	}

	# Ill health
	if = {
		limit = {
			OR = {
				has_contagious_deadly_disease_trigger = yes
				has_epidemic_disease_trigger = yes
				health <= poor_health
				has_trait = infirm
				has_trait = incapable
			}
		}
		multiply = 0.01
	}
}

temujin_soldier_female_chance = {
	if = {
		limit = {
			NOT = { dummy_female = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:temujin } } }
			dummy_male = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:temujin } }
		}
		add =  0
	}
	else_if = {
		limit = {
			dummy_female = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:temujin } }
			NOT = { dummy_male = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:temujin } } }
		}
		add =  100
	}
	else = {
	 	add = 50
	}
}

mongol_successor_faith_chance = {
	value = 0
	save_temporary_scope_as = county_faith_check
	add = {
		scope:faith_changer = {
			every_vassal = {
				faith = scope:county_faith_check.faith
			}
			add = 5
		}
	}
}