﻿#######################
# MODIFIED VANILLA TRADITIONS #
#######################

tradition_agrarian = {
	category = realm

	layers = {
		0 = steward
		1 = indian
		4 = farmland.dds
	}

	is_shown = {
		NOT = { #Cant be taken by Cultures who already are good at farming
			has_cultural_tradition = tradition_nile_agriculture
		}
	}
	
	can_pick = {
		NOR = { #Cant be taken by Cultures who already are good at farming
			has_cultural_tradition = tradition_nile_agriculture
		}
		custom_tooltip = {
			text = culture_in_plains_farmlands_or_floodplains_terrain_desc
			any_culture_county = {
				percent >= 0.33
				any_county_province = {
					OR = {
						terrain = plains
						terrain = farmlands
						terrain = floodplains
					}
				}
			}
		}
	}
	
	parameters = {
                diligent_trait_more_common = yes
		content_trait_more_common = yes
		martial_education_worse_outcomes = yes
		hard_working_traits_more_valued = yes
	}
	
	character_modifier = {
		men_at_arms_recruitment_cost = 0.25
		prowess = -2
                levy_toughness = -2
                floodplains_travel_danger = floodplains_medium_danger_reduction
	}
	
	county_modifier = {
		plains_development_growth_factor = 0.2
		plains_construction_gold_cost = -0.1	
		farmlands_development_growth_factor = 0.3
		farmlands_construction_gold_cost = -0.15
		floodplains_development_growth_factor = 0.3
		floodplains_construction_gold_cost = -0.15
		farmlands_levy_size = 0.1
		floodplains_levy_size = 0.1
		plains_levy_size = 0.05
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					culture_pillar:ethos_bellicose = { is_in_list = traits }
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = culture_not_bellicose
				}
			}
			if = {
				limit = {
					NOT = {
						any_culture_county = {
							count >= 5
							any_county_province = {
								OR = {
									terrain = plains
									terrain = farmlands
									terrain = floodplains
								}
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = culture_in_plains_farmlands_or_floodplains_terrain_count_desc
				}
			}
			if = {
				limit = {
					NOT = {
						any_culture_county = {
							count >= 10
							any_county_province = {
								OR = {
									has_building_or_higher = orchards_01
									has_building_or_higher = plantations_01
									has_building_or_higher = cereal_fields_01
								}
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = gardening_buildings_percentage_desc
				}
			}

			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					scope:character = {
						OR = {
							any_sub_realm_county = {
								count >= 2
								culture = scope:character.culture
								any_county_province = {
									OR = {
										terrain = farmlands
										terrain = floodplains
									}
								}
							}
							any_sub_realm_county = {
								count >= 5
								culture = scope:character.culture
								any_county_province = { terrain = plains }
							}
						}
					}
				}
			}
			multiply = 0
		}
		if = {
			limit = {
				scope:character = {
					OR = {
						government_has_flag = government_is_feudal
						government_allows = administrative
					}
				}
			}
			multiply = 0
		}
	}
}

tradition_amharic_highlanders = { #Ethiopian Unique Tradition, replaces hill dwellers, Unlocks MAA innovation & Castration
	category = realm

	layers = {
		0 = steward
		1 = mena
		4 = mountain.dds
	}

	is_shown = {
		NOT = { has_cultural_tradition = tradition_hill_dwellers }
		OR = {
			this = culture:ethiopian
			any_parent_culture_or_above = {
				this = culture:ethiopian
			}
			this = culture:agaw
			any_parent_culture_or_above = {
				this = culture:agaw
			}
			this = culture:tigray
			any_parent_culture_or_above = {
				this = culture:tigray
			}
		}
	}
	can_pick = {
		NOT = { has_cultural_tradition = tradition_hill_dwellers }
		OR = {
			this = culture:ethiopian
			any_parent_culture_or_above = {
				this = culture:ethiopian
			}
			this = culture:agaw
			any_parent_culture_or_above = {
				this = culture:agaw
			}
			this = culture:tigray
			any_parent_culture_or_above = {
				this = culture:tigray
			}
		}
		custom_description = {
			text = culture_in_hills_desc
			any_culture_county = {
				any_county_province = {
					terrain = hills
				}
			}
		}
	}
	
	parameters = {
		unlock_sarawit_innovation = yes
		can_castrate_prisoners = yes
		hill_farms_building_bonuses = yes
	}
	county_modifier = {
		hills_development_growth_factor = 0.2
	}
	province_modifier = {
		hills_construction_gold_cost = -0.1
		hills_holding_construction_gold_cost = -0.1
	}
	character_modifier = {
		hills_advantage = 5
		hills_travel_danger = hills_high_danger_reduction
		mountains_travel_danger = mountains_low_danger_reduction
		desert_mountains_travel_danger = desert_mountains_low_danger_reduction
	}

	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOT = {
						culture_pillar:ethos_spiritual = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_spiritual_desc
				}
			}
			if = {
				limit = {
					NOT = {
						any_culture_county = {
							percent >= 0.3
							any_county_province = {
								terrain = hills
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = hill_percentage_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					scope:character = {
						any_sub_realm_county = {
							percent >= 0.2
							culture = scope:character.culture
							any_county_province = {
								terrain = hills
							}
						}
					}
				}
			}
			multiply = 0
		}
	}
}

tradition_land_of_the_bow = {
	category = regional

	layers = {
		0 = martial
		1 = mena
		4 = bow.dds
	}
	
	is_shown = {
		OR ={
			this = culture:nubian
			any_parent_culture_or_above = {
				this = culture:nubian
			}
		}
	}
	can_pick = {
		always = no
		custom_tooltip = {
			text = cannot_have_tradition_byzantine_succession
			NOT = { culture_tradition:tradition_merciful_blindings = { is_in_list = traits } }
		}
	}
	
	parameters = {
		unlock_maa_archers_of_the_nile = yes
		hunting_archery_building_bonuses = yes
		nile_hill_forts = yes
		can_blind_prisoners = yes
		physical_disfigurement_blocks_inheritance = yes
	}
	county_modifier = {
		floodplains_levy_size = 0.1
	}
	province_modifier = {
		garrison_size = 0.25
	}
	character_modifier = {
		defender_advantage = 5
		diplomatic_range_mult = -0.30 #Nubian isolation
	}
	
	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_spiritual = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_bellicose_or_spiritual_desc
				}
			}
			if = {
				limit = {
					NOT = {
						scope:character = {
							number_maa_soldiers_of_base_type = {
								type = archers
								value >= 800
							}
						}
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = culture_head_archers_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}

	ai_will_do = {
		value = 100
		if = {
			limit = {
				NOT = {
					scope:character = {
						any_sub_realm_county = {
							culture = scope:character.culture
							any_county_province = {
								terrain = floodplains
							}
						}
					}
				}
			}
			multiply = 0
		}
	}
}

tradition_nubian_warrior_queens = {
	category = regional

	layers = {
		0 = intrigue
		1 = mediterranean
		4 = crown.dds
	}
	
	is_shown = {
		NOT = { has_game_rule = inversed_gender_equality }
		OR = {
			this = culture:norse
			any_parent_culture_or_above = {
				this = culture:norse
			}
			has_cultural_pillar = heritage_sahelian
			has_cultural_pillar = heritage_senegambian
			has_cultural_pillar = heritage_west_african
			has_cultural_pillar = heritage_yoruba
			has_cultural_pillar = heritage_akan
			has_cultural_pillar = heritage_east_african
			has_cultural_pillar = heritage_central_african
			has_cultural_pillar = heritage_berber
			has_cultural_pillar = heritage_somalian
			has_cultural_pillar = heritage_brythonic
		}	

	}
	can_pick = {
		scope:character = {
			faith = {
				has_doctrine = pagan_hostility_doctrine
			}
		}
	}

	parameters = {
		gender_equal_inheritance = yes
		female_only_inheritance = yes
		female_preference_inheritance = yes
		prowess_from_martial_education = yes
	}
	
	cost = {
		prestige = {
			add = {
				value = tradition_base_cost
				desc = BASE
				format = "BASE_VALUE_FORMAT"
			}
			if = {
				limit = {
					NOT = {
						culture_pillar:ethos_egalitarian = { is_in_list = traits }
					}
				}
				add = {
					value = tradition_incompatible_ethos_penalty
					desc = not_egalitarian_desc
				}
			}
			if = {
				limit = {
					trigger_if = {
						limit = {
							scope:character = {
								is_ai = no
							}
						}
						NAND = {
							any_ruler = {
								count >= 3
								culture = prev
								primary_title.tier > tier_barony
								is_male = yes
							}
							any_ruler = {
								count >= 3
								culture = prev
								primary_title.tier > tier_barony
								is_female = yes
							}
						}
					}
					trigger_else = {
						always = yes
					}
				}
				add = {
					value = tradition_unfulfilled_criteria_penalty
					desc = three_gender_rulers_desc
				}
			}
			
			multiply = tradition_replacement_cost_if_relevant
		}
	}
	
	ai_will_do = { value = 100 }
}
