#######################
# CULTURAL TRADITIONS #
#######################

######################
# MPO Traditions 	 #
######################

tradition_mpo_iron_cavalry = {
	category = regional

	layers = {
		0 = martial
		1 = steppe
		4 = iron_cavalry.dds
	}

	is_shown = {
		has_mpo_dlc_trigger = yes
		OR = {
			has_cultural_pillar = heritage_mongolic
			has_cultural_pillar = heritage_turkic
			has_cultural_pillar = heritage_magyar
			scope:character = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
		}
	}

	
	can_pick = {
		culture_not_pacifistic_trigger = yes
		custom_tooltip = {
			text = culture_head_archer_cavalry_desc
			scope:character = {
				max_number_maa_soldiers_of_base_type = {
					type = archer_cavalry
					value >= 600
				}
			}
		}
		trigger_if = {
			limit = {
				scope:character = { government_has_flag = government_is_nomadic }
			}
			scope:character.domicile ?= {
				has_domicile_building_or_higher = paiza_metal_trade_yurt_01
			}
		}
		trigger_else = {
			scope:character = {
				has_trait = nomadic_philosophy
			}
		}
	}
	
	parameters = {
		unlock_maa_cataphract_archers = yes
		martial_traits_give_out_hcav_bonus = yes
		metalworkers_internal_yurt_unlock = yes
	}
	character_modifier = {
		heavy_cavalry_toughness_mult = 0.2
		archer_cavalry_toughness_mult = 0.2
		light_cavalry_toughness_mult = 0.1
		herd_conversion = -0.01
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				multiply = 4
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}

			if = {
				limit = {
					culture_tradition_reduction_trigger = { TRADITION = tradition_mpo_iron_cavalry }
				}
				multiply = {
					value = 0.5
					desc = inspired_by_culture_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 200
		if = {
			limit = { # Reduce chance slightly if the culture has access to other "cavalry" types
				OR = {
					has_innovation = innovation_war_camels
					has_innovation = innovation_elephantry
				}
			}
			multiply = 0.4
		}
		else_if = {
			limit = {
				scope:character ?= {
					ai_has_warlike_personality = yes
				}
			}
			multiply = 4
		}
	}
}

tradition_mpo_wolves_of_the_deep_steppe = {
	category = regional

	layers = {
		0 = martial
		1 = steppe
		4 = wolves_of_the_deep_steppe.dds
	}

	is_shown = {
		has_mpo_dlc_trigger = yes
		OR = {
			has_cultural_pillar = heritage_mongolic
			has_cultural_pillar = heritage_turkic
			has_cultural_pillar = heritage_magyar
			scope:character = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
		}
	}

	can_pick = {
		culture_not_pacifistic_trigger = yes
		scope:character = {
			government_has_flag = government_is_nomadic
		}	
	}
	
	parameters = {
		unlock_maa_mangudai = yes
	}
	character_modifier = {
		prowess = 4
		herd_capacity_mult = 0.2
		herd_conversion = 0.01
		nomadic_horde_damage_mult = 0.1
		nomadic_horde_pursuit_mult = 0.1
		archer_cavalry_damage_mult = 0.15
		archer_cavalry_pursuit_mult = 0.2
		mountains_fertility_growth_mult = medium_culture_county_fertility_value_mult
		mountains_travel_danger = mountains_medium_danger_reduction
		hills_travel_danger = hills_medium_danger_reduction
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				multiply = 4
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					has_cultural_pillar = heritage_mongolic
				}
				multiply = {
					value = 0.5
					desc = heritage_mongolic_name
				}
			}
			
			if = {
				limit = {
					culture_tradition_reduction_trigger = { TRADITION = tradition_mpo_wolves_of_the_deep_steppe }
				}
				multiply = {
					value = 0.5
					desc = inspired_by_culture_desc
				}
			}

			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 200
		if = {
			limit = { # Reduce chance slightly if the culture has access to other "cavalry" types
				OR = {
					has_innovation = innovation_war_camels
					has_innovation = innovation_elephantry
				}
			}
			multiply = 0.4
		}
		else_if = {
			limit = {
				scope:character ?= {
					ai_has_warlike_personality = yes
				}
			}
			multiply = 4
		}
	}
}

tradition_devoted_horsemanship = {
	category = regional

	layers = {
		0 = martial
		1 = steppe
		4 = horses.dds
	}

	is_shown = {
		OR = {
			has_cultural_pillar = heritage_mongolic
			has_cultural_pillar = heritage_turkic
			has_cultural_pillar = heritage_magyar
			scope:character = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
		}
	}

	can_pick = {
		OR = {
			has_cultural_pillar = heritage_mongolic
			has_cultural_pillar = heritage_turkic
			has_cultural_pillar = heritage_magyar
			scope:character = {
				mpo_can_recruit_nomad_maa_trigger = yes
			}
			scope:character = {
				has_trait = nomadic_philosophy
			}
		}
	}

	parameters = {
		unlock_maa_horse_archers = yes
		can_recruit_open_specialist = yes
		unlock_horse_pastures_building = yes
		unlock_voluntary_laampdom = yes
		stewardship_traits_give_out_cav_bonus = yes
		unlock_maa_tarkhan = yes
	}

	character_modifier = {
		movement_speed = 0.1
		character_travel_speed_mult = 0.2
		movement_speed_land_raiding = 0.2
	}

	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				multiply = 2
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
						culture_pillar:ethos_communal = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_or_communal_desc
				}
			}

			if = {
				limit = {
					culture_tradition_reduction_trigger = { TRADITION = tradition_devoted_horsemanship }
				}
				multiply = {
					value = 0.5
					desc = inspired_by_culture_desc
				}
			}

			multiply = tradition_replacement_cost_if_relevant
		}
	}

	ai_will_do = {
		value = 400
	}
}

tradition_mpo_northern_tribes = {
	category = regional

	layers = {
		0 = steward
		1 = steppe
		4 = northern_tribes.dds
	}

	can_pick_for_hybridization = {
		custom_tooltip = {
			text = cannot_hybridize_northern_tribes
			always = no
		}	
	}

	is_shown = {
		has_mpo_dlc_trigger = yes
		any_culture_county = {
			OR = {
				has_county_modifier = mpo_siberian_permafrost_modifier	
				has_county_modifier = mpo_siberian_permafrost_modifier_bad
			}
		}
	}
	can_pick = {
		any_culture_county = {
			percent >= 0.2
			has_county_modifier = mpo_siberian_permafrost_modifier_bad
		}
	}
	
	parameters = {
		unlock_maa_maturkan_warriors = yes
		permafrost_modifier_mechanic = yes
		permafrost_modifier_removal_condition = yes
		permafrost_unlock_tribal_building = yes
		permafrost_cannot_become_feudal = yes	
	}
	character_modifier = {
		taiga_advantage = 4
		winter_advantage = 4
		taiga_travel_danger = taiga_medium_danger_reduction
		hills_travel_danger = hills_medium_danger_reduction
		taiga_construction_gold_cost = -0.2
		forest_construction_gold_cost = -0.2
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				multiply = 2
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}

			if = {
				limit = {
					culture_tradition_reduction_trigger = { TRADITION = tradition_mpo_northern_tribes }
				}
				multiply = {
					value = 0.5
					desc = inspired_by_culture_desc
				}
			}

			if = {
				limit = {
					NOT = {
						any_culture_county = {
							percent >= 0.5
							OR = {
								has_county_modifier = mpo_siberian_permafrost_modifier
								has_county_modifier = mpo_siberian_permafrost_modifier_bad
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = mpo_northern_tribes_percentage_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 0 #ai either has it on game start or should not pursue it
	}
}
