﻿### Afri heritage

tradition_african_agriculture = {
	category = regional

	layers = {
		0 = steward
		1 = mena
		4 = farmland.dds
	}
	
	is_shown = {
		any_culture_county = {
			title_province = {
				geographical_region = custom_roman_africa
			}
		}
	}
	
	can_pick = {
		any_culture_county = {
			percent >= 0.5
			any_county_province = {
				geographical_region = custom_roman_africa
			}
		}
	}
	
	parameters = {
		innovative_traits_more_valued = yes
		unlocks_qanat_building = yes
		plantations_building_bonuses = yes
		pastures_building_bonuses = yes
	}
	
	county_modifier = {
		drylands_development_growth_factor = 0.35
		drylands_construction_gold_cost = -0.25
		drylands_supply_limit_mult = 0.2
		drylands_levy_size = 0.15
	}

	character_modifier = {
		men_at_arms_recruitment_cost = 0.15
		prowess = -1
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
						culture_pillar:ethos_courtly = { is_in_list = traits }
						culture_pillar:ethos_egalitarian = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bureaucratic_courtly_or_egalitarian_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					scope:character = {
						any_sub_realm_county = {
							count >= 2
							culture = scope:character.culture
							any_county_province = {
								terrain = drylands
							}
						}
					}
				}
			}
			multiply = 0
		}
		if = {
			limit = {
				scope:character = { government_has_flag = government_is_feudal }
			}
			multiply = 0
		}
	}
}

### Arabic heritage

tradition_islamic_furusiyya = {
	category = regional

	layers = {
		0 = martial
		1 = mena
		4 = horses.dds
	}
	
	is_shown = {
		AND = {
			has_cultural_pillar = heritage_arabic
			any_culture_county = {
				title_province = {
					geographical_region = world_middle_east_arabia
				}
			}
		}
	}

	can_pick = {
		culture_not_pacifistic_trigger = yes
	}

	parameters = {
		commanders_likelier_to_gain_commander_traits = yes
		may_challenge_to_board_games = yes
		can_use_sparring_duel = yes
		martial_education_more_valued = yes
		prowess_traits_more_valued = yes
		blademaster_trait_bonuses = yes
		craven_and_content_traits_looked_down_upon = yes
		knights_slightly_more_prone_to_injury = yes
	}
	
	character_modifier = {
		heavy_cavalry_damage_mult = 0.1
		heavy_cavalry_toughness_mult = 0.1
		archer_cavalry_damage_mult = 0.1
		archer_cavalry_toughness_mult = 0.1

		ai_honor = 15
		ai_boldness = 10
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
						culture_pillar:ethos_egalitarian = { is_in_list = traits }
						culture_pillar:ethos_courtly = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_egalitarian_or_courtly_desc
				}
			}
			if = {
				limit = {
					NOT = {
						scope:character = {
							any_knight = {
								count >= 6
								prowess >= 12
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = knights_with_prowess_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					culture_pillar:ethos_bellicose = { is_in_list = traits }
				}
			}
			multiply = 0.25
		}
	}
}



### Amazigh heritage

tradition_barbary_corsairs = {
    category = regional

	layers = {
		0 = intrigue
		1 = mediterranean
		4 = battle.dds
	}
    
    is_shown = {
        has_cultural_pillar = heritage_berber
    }
	
    can_pick = {
        has_cultural_pillar = heritage_berber
		custom_description = {
			text = percentage_of_culture_on_coast_desc
			any_culture_county = {
				percent >= 0.5
				any_county_province = {
					is_coastal = yes
				}
			}
		}
    }
    
    parameters = {
		culture_can_raid_at_sea_even_if_feudal = yes
		unlock_maa_barbary_corsairs = yes
    }

	character_modifier = {
		max_loot_mult = 0.5
		embarkation_cost_mult = -0.25
		naval_movement_speed_mult = 0.25
		coastal_advantage = 5
		raid_speed = 0.5

		ai_greed = 15
		ai_boldness = 5
	} 

    cost = {
        prestige = {
            add = {
                value = tradition_base_cost
                desc = BASE
                format = "BASE_VALUE_FORMAT"
            }
			# Ethos requirement.
			if = {
				limit = {
					NOT = {
						culture_pillar:ethos_bellicose = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_desc
				}
			}
			# Coastal requirement.
			if = {
				limit = {
					NOT = {
						any_culture_county = {
							percent >= 0.7
							any_county_province = {
								is_coastal = yes
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = high_coastal_percentage_desc
				}
			}
			if = {
				limit = {
					trigger_if = {
						limit = {
							scope:character = {
								is_ai = no
							}
						}
						NOT = {
							any_ruler = {
								count >= 3
								culture = prev
								primary_title.tier >= tier_county
								OR = {
									has_trait = reaver
								}
							}
						}
					}
					trigger_else = {
						NOR = {
							culture_pillar:heritage_turkic = { is_in_list = traits }
							culture_pillar:heritage_mongolic = { is_in_list = traits }
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = rulers_with_reaver_desc
				}
			}
			
            multiply = tradition_replacement_cost_if_relevant
        }
    }

    ai_will_do = { value = 100 }
}

tradition_barb_horses = {
    category = regional

	layers = {
		0 = martial
		1 = mena
		4 = horses.dds
	}
    
    is_shown = {
        has_cultural_pillar = heritage_berber
    }
	
    can_pick = {
        has_cultural_pillar = heritage_berber
    }
    
    parameters = {
		pastures_building_bonuses = yes
    }

	character_modifier = {
		light_cavalry_maintenance_mult = -0.2
		light_cavalry_recruitment_cost_mult = -0.25
		light_cavalry_pursuit_mult = 0.15
		light_cavalry_screen_mult = 0.15
		heavy_cavalry_maintenance_mult = -0.2
		heavy_cavalry_recruitment_cost_mult = -0.25
		heavy_cavalry_pursuit_mult = 0.15
	} 

    cost = {
        prestige = {
            add = {
                value = tradition_base_cost
                desc = BASE
                format = "BASE_VALUE_FORMAT"
            }
           
            multiply = tradition_replacement_cost_if_relevant
        }
    }

    ai_will_do = { value = 100 }
}

#### Nile heritage

tradition_nile_agriculture = {
	category = regional

	layers = {
		0 = steward
		1 = mena
		4 = farmland.dds
	}
	
	is_shown = {
		any_culture_county = {
			title_province = {
				geographical_region = ce_nile_river
			}
		}
	}
	
	can_pick = {
		trigger_if = {
			limit = {
				OR = {
					NOT = { exists = scope:replacing }
					NOT = { scope:replacing = culture_tradition:tradition_agrarian }
				}
			}
			NOT = { has_cultural_tradition = tradition_agrarian } #To prevent stacking after hybridization
		}
		any_culture_county = {
			percent >= 0.5
			any_county_province = {
				geographical_region = ce_nile_river
			}
		}
	}
	
	parameters = {
		content_trait_more_common = yes
		diligent_trait_more_common = yes
		coastal_agriculture_building_bonuses = yes
		hard_working_traits_more_valued = yes
	}
	
	character_modifier = {
		men_at_arms_recruitment_cost = 0.15
		prowess = -1
	}
	
	county_modifier = {
		oasis_development_growth_factor = 0.35
		oasis_construction_gold_cost = -0.25
		oasis_supply_limit_mult = 0.2
		oasis_levy_size = 0.15
		floodplains_development_growth_factor = 0.35
		floodplains_construction_gold_cost = -0.25
		floodplains_supply_limit_mult = 0.2
		floodplains_levy_size = 0.15
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOR = {
						culture_pillar:ethos_communal = { is_in_list = traits }
						culture_pillar:ethos_egalitarian = { is_in_list = traits }
						culture_pillar:ethos_bureaucratic = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_communal_egalitarian_or_bureaucratic_desc
				}
			}
			if = {
				limit = {
					NOT = {
						any_culture_county = {
							count >= 5
							any_county_province = {
								OR = {
									terrain = farmlands
									terrain = floodplains
								}
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = culture_in_farmlands_or_floodplains_terrain_count_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					scope:character = {
						any_sub_realm_county = {
							count >= 2
							culture = scope:character.culture
							any_county_province = {
								OR = {
									terrain = farmlands
									terrain = floodplains
								}
							}
						}
					}
				}
			}
			multiply = 0
		}
		if = {
			limit = {
				scope:character = { government_has_flag = government_is_tribal }
			}
			multiply = 0
		}
	}
}
