tribal_federation_mechanic = {
	alert_icon_gfx = GFX_alerticons_government_mechanics
	alert_icon_index = 5
	available = {
		has_dlc = "Cradle of Civilization"
	}

	powers = {
		tribal_allegiance = {
			max = 100
			reset_on_new_ruler = no
			base_monthly_growth = 0
			development_scaled_monthly_growth = -0.25
			
			scaled_modifier = {
				modifier = {
					manpower_recovery_speed = 0.10
					global_manpower_modifier = 0.15
					global_unrest = -2.5
				}
			}
		}
	}
	
	interactions = {
		enlist_general = {
			icon = GFX_enlist_general_button
			cost_type = tribal_allegiance
			cost = 30
			trigger = {
			}
			effect = {
				create_general = {
					tradition = 50
				}
			}
			cooldown_years = 10
			ai_chance = {
				factor = 10
				modifier = {
					factor = 100
					is_in_important_war = yes
					has_government_power = {
						mechanic_type = tribal_federation_mechanic
						power_type = tribal_allegiance
						value = 95
					}
				}
				modifier = {
					factor = 20
					NOT = { 
						has_leaders = {
							value = 1
							type = general
							include_monarch = no
							include_heir = no
						}
					}
				}
				modifier = {
					factor = 20
					NOT = { 
						has_leaders = {
							value = 2
							type = general
							include_monarch = no
							include_heir = no
						}
					}
				}
				modifier = {
					factor = 20
					NOT = { 
						has_leader_with = {
							general = yes
							total_pips = 7
						}
					}
				}
				modifier = {
					factor = 0.1
					has_leader_with = {
						general = yes
						total_pips = 12
					}
				}
				modifier = {
					factor = 0
					is_at_war = no
				}
			}
		}
		
		train_horsemanship = {
			icon = GFX_train_horsemanship_button
			cost_type = tribal_allegiance
			cost = 30
			trigger = {
			}
			effect = {
				add_country_modifier = {
					name = train_horsemanship_modifier
					duration = 3650
				}
			}
			cooldown_years = 10
			ai_chance = {
				factor = 100
				modifier = {
					factor = 100
					is_in_important_war = yes
					has_government_power = {
						mechanic_type = tribal_federation_mechanic
						power_type = tribal_allegiance
						value = 95
					}
				}
				modifier = {
					factor = 0
					NOT = { cavalry_fraction = 0.1 }
				}
				modifier = {
					factor = 0.1
					NOT = { cavalry_fraction = 0.2 }
				}
				modifier = {
					factor = 0
					is_at_war = no
				}
				modifier = {
					factor = 0
					NOT = { manpower_percentage = 0.8 }
				}
			}
		}
		
		conscript_from_tribes = {
			icon = GFX_conscript_from_tribes_button
			cost_type = tribal_allegiance
			cost = 30
			trigger = {
				capital_scope = {
					controller = { 
						tag = ROOT
					}
					has_siege = no
				}
			}
			effect = {
				capital_scope = {
					add_unit_construction = {
						type = cavalry
						amount = 10
						speed = 0.25
						cost = 0
					}
				}
			}
			cooldown_years = 10
			ai_chance = {
				factor = 0	#Just no
			}
		}
	}
}