tribe_mechanic = {
	tribal = yes
	monarchy = yes
	basic_reform = yes # = invisible/does not take up a slot
	valid_for_nation_designer = no
	heir = yes
	queen = yes
	custom_attributes = {
		enables_aristocratic_idea_group = yes
	}
}

steppe_horde = {
	icon = "horde_riding"
	allow_normal_conversion = no
	potential = {
		OR = {
			has_reform = steppe_horde
			culture_group = altaic
			culture_group = tartar
			primary_culture = altaic_new 
		}
		has_reform = steppe_horde
		NOT = { has_reform = great_mongol_state_reform }
	}
	legacy_equivalent = steppe_horde_legacy
	nomad = yes
	raze_province = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 0
	nation_designer_trigger = {
		technology_group = nomad_group
	}

	lock_level_when_selected = yes

	start_territory_to_estates = 0.5

	modifiers = {
		loot_amount = 0.50
		global_institution_spread = -0.15
		cav_to_inf_ratio = 0.25
		movement_speed = 0.2
		global_manpower_modifier = 0.2
		land_forcelimit_modifier = 0.2
		years_of_nationalism = -5
		reinforce_cost_modifier = -0.5
	}
	custom_attributes = {
		enables_horde_idea_group = yes
		enables_aristocratic_idea_group = no
	}
	ai = {
		factor = 1000
	}
}

great_mongol_state_reform = {
	icon = "horde_riding"
	allow_normal_conversion = yes
	lock_level_when_selected = yes
	potential = {
		OR = {
			has_reform = great_mongol_state_reform
			have_had_reform = great_mongol_state_reform
			tag = MGE
		}
	}
	legacy_equivalent = great_mongol_state_legacy
	fixed_rank = 3
	valid_for_nation_designer = no
	nomad = yes
	raze_province = yes
	modifiers = {
		horde_unity = 1
		global_manpower_modifier = 0.2
		land_forcelimit_modifier = 0.2
		loot_amount = 0.50
		reinforce_cost_modifier = -0.5
		cav_to_inf_ratio = 0.5
		movement_speed = 0.2
		years_of_nationalism = -5
		may_establish_frontier = yes
	}
	conditional = {
		allow = { has_dlc = "Mandate of Heaven" }
		allow_banners = yes
		custom_attributes = {
			can_recruit_banners_from_primary_culture_provinces = yes
		}
	}
	custom_attributes = {
		enables_horde_idea_group = yes
		enables_aristocratic_idea_group = no
	}
	effect = {
		hidden_effect = {
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				capital_scope = {
					add_province_modifier = {
						name = allow_banners_capital_modifier
						duration = -1
						hidden = yes
					}
				}
				every_owned_province = {
					limit = { culture = root }
					add_province_modifier = {
						name = mongol_banners_location
						duration = -1
						hidden = yes
					}
				}
			}
		}
	}
	removed_effect = {
		hidden_effect = {
			capital_scope = { remove_province_modifier = allow_banners_capital_modifier }
			every_owned_province = {
				limit = { has_province_modifier = mongol_banners_location }
				remove_province_modifier = mongol_banners_location
			}
		}
	}
	ai = {
		factor = 1000
	}
}

tribal_federation = {
	icon = "chieftain"
	allow_normal_conversion = yes
	potential = {
		has_reform = tribal_federation
	}

	valid_for_nation_designer = yes
	nation_designer_cost = 20
	legacy_equivalent = tribal_federation_legacy

	lock_level_when_selected = yes

	modifiers = {
		years_of_nationalism = -5
	}

	conditional = {
		allow = { has_dlc = "Cradle of Civilization" }
		government_abilities = {
			tribal_federation_mechanic
		}
	}
	ai = {
		factor = 0
	}
}

tribal_despotism = {
	icon = "tribal_council"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 0
	modifiers = {
		core_creation = -0.1
	}
	legacy_equivalent = tribal_despotism_legacy
	ai = {
		factor = 1
	}
}

tribal_kingdom = {
	icon = "indian_crown"
	valid_for_nation_designer = yes
	nation_designer_cost = 0
	legacy_equivalent = tribal_kingdom_legacy
	modifiers = {
		vassal_income = 0.2
	}
	ai = {
		factor = 1
	}
}

polynesian_tribe = {
	icon = "tribal_council"
	allow_normal_conversion = no
	potential = {
		culture_group = pacific
		has_reform = polynesian_tribe
	}
	valid_for_nation_designer = yes
	nation_designer_cost = -10
	native_mechanic = no
	allow_migration = yes
	fixed_rank = 1
	lock_level_when_selected = yes
	modifiers = {
		global_manpower_modifier = 0.2
	}
	ai = {
		factor = 1
	}
}

polynesian_kingdom = {
	icon = "tribal_council"
	allow_normal_conversion = no
	potential = {
		culture_group = pacific
		has_reform = polynesian_kingdom
	}
	valid_for_nation_designer = yes
	nation_designer_cost = 0
	modifiers = {
		naval_forcelimit_modifier = 0.2
		range = 0.2
		vassal_income = 0.2
		reduced_liberty_desire = 20
		governing_capacity_modifier = -0.5
	}
	ai = {
		factor = 1
	}
}

siberian_tribe = {
	icon = "shaman"
	allow_normal_conversion = no
	potential = {
		has_reform = siberian_tribe
	}
	valid_for_nation_designer = yes
	nation_designer_cost = -10
	legacy_equivalent = siberian_native_council
	native_mechanic = no
	allow_migration = yes
	fixed_rank = 1
	lock_level_when_selected = yes
	modifiers = {
		stability_cost_modifier = -0.33
		global_institution_spread = -0.2
	}
	ai = {
		factor = 1
	}
}
stateless_society = {
	icon = "fist_in_air"
	allow_normal_conversion = no
	valid_for_nation_designer = yes
	lock_level_when_selected = yes
	nation_designer_cost = 0
	modifiers = {
		governing_capacity_modifier = -0.99
		defensiveness = 0.75
		land_morale = 0.15
	}
	ai = {
		factor = 0.25		#New added in MMETR, AI much less likely to choose
		modifier = {
			factor = -1
			num_of_cities = 2
		}
	}
}

gond_kingdom = {
	icon = "chieftain"
	allow_normal_conversion = yes
	potential = {
		has_dlc = "Dharma"
		technology_group = indian
		primary_culture = gondi
	}
	valid_for_nation_designer = yes
	nation_designer_cost = 0
	nation_designer_trigger = {
		technology_group = indian
		primary_culture = gondi
	}
	legacy_equivalent = tribal_kingdom_legacy
	modifiers = {
		defensiveness = 0.2
	}
}

sacred_kingdom = {
	icon = "divine_guidance_reform"
	allow_normal_conversion = yes
	lock_level_when_selected = yes
	potential = {
		has_dlc = "Origins"
		religion_group = pagan
	}
	trigger = {
		OR = {
			NOT = { has_institution = enlightenment }	#Why should any enlightened person ever want to support this system?
			AND = {
				is_playing_custom_nation = yes
				have_had_reform = sacred_kingdom
			}
		}
	}
	valid_for_nation_designer = yes
	nation_designer_cost = 10
	nation_designer_trigger = {
		religion_group = pagan
	}
	legacy_equivalent = sacred_kingdom_legacy
	maintain_dynasty = yes
	
	removed_effect = {
		if = {
			limit = {
				NOT = { has_institution = enlightenment }
			}
			add_stability = -2
		}
	}

	modifiers = {
		tolerance_own = 2
		max_absolutism = 25
		legitimacy = 0.5
	}
}

matrilineal_system = {
	icon = "british_queen"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 30
	legacy_equivalent = matrilineal_system_legacy
	potential = {
		OR = {
			primary_culture = nubian
			have_had_reform = matrilineal_system
		}
	}
	trigger = {
		OR = {
			primary_culture = nubian
			have_had_reform = matrilineal_system
		}
	}
	modifiers = {
		heir_chance = -0.5
		female_advisor_chance = 0.5
		legitimacy = 1
	}
}

tribal_confederacy = {
	icon = "native_settle_down_reform"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	lock_level_when_selected = yes
	nation_designer_cost = 30
	legacy_equivalent = tribal_confederacy_legacy

	potential = {
		have_had_reform = tribal_confederacy
		NOT = { has_country_flag = centralized_tribes_level_3 }	#Already centralized the tribes
	}

	modifiers = {
		nobles_influence_modifier = 0.15
		nobles_loyalty_modifier = 0.1
		global_unrest = -1
		max_absolutism = -20
	}

	conditional = {
		allow = {
			has_dlc = "Origins"
		}
		custom_attributes = {
			has_internal_tribes = yes
			locked_government_type = yes
		}
	}

	effect = {
		hidden_effect = {
			if = {
				limit = {
					has_dlc = "Origins"
				}
				set_estate_privilege = estate_nobles_decentralized_tribe
			}
		}
	}

	ai = {
		factor = 0
	}
}

great_man = {
	icon = "chieftain"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 30
	legacy_equivalent = great_man_legacy
	potential = {
		OR = {
			AND = {
				religion = shamanism
				capital_scope = {
					has_terrain = jungle
				}
			}
			have_had_reform = great_man
		}
	}
	trigger = {
		OR = {
			AND = {
				religion = shamanism
				capital_scope = {
					has_terrain = jungle
				}
			}
			have_had_reform = great_man
		}
	}
	modifiers = {
		leader_cost = -0.1
		production_efficiency = 0.1
	}

	ai = {
		factor = 1
	}
}

shaka_regime = {
	icon = "chieftain"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 30
	legacy_equivalent = shaka_regime_legacy
	potential = {
		OR = {
			tag = ZUL
			have_had_reform = shaka_regime
		}
	}
	trigger = {
		OR = {
			tag = ZUL
			have_had_reform = shaka_regime
		}
	}
	modifiers = {
		monarch_military_power = 2
		global_unrest = -2
		war_exhaustion = -0.02
		governing_capacity_modifier = -0.5
	}

	conditional = {
		allow = {
			has_dlc = "Rights of Man"
		}
		government_abilities = {
			militarization_mechanic
		}
	}

	ai = {
		factor = 1
	}
}

feudal_tribe = {
	icon = "tribal_civil_society"
	allow_normal_conversion = yes
	valid_for_nation_designer = yes
	nation_designer_cost = 30
	legacy_equivalent = feudal_tribe_legacy
	lock_level_when_selected = yes
	potential = {
	}
	trigger = {
	}
	modifiers = {
		vassal_income = 0.1
		global_tax_modifier = 0.1
	}

	conditional = {
		allow = { 
			has_dlc = "Mandate of Heaven"
		}
		custom_attributes = {
			has_tributaries = yes
		}
	}

	ai = {
		factor = 0
	}
}

#tribal_cultural_values

martial_society_reform = {
	allow_normal_conversion = yes
	icon = "tribal_martial_society"
	modifiers = {
		global_manpower_modifier = 0.2
	}
	ai = {
		factor = 1
		modifier = {
			factor = 2
			any_enemy_country = {
				army_size = root
			}
		}
	}
}

civil_society_reform = {
	allow_normal_conversion = yes
	icon = "tribal_civil_society"
	modifiers = {
		global_tax_modifier = 0.05
		yearly_corruption = -0.05
	}
	ai = {
		factor = 1
		modifier = {
			factor = 2
			OR = {
				is_in_deficit = yes
				num_of_loans = 5
				corruption = 5
			}
		}
	}
}

#Religion vs Secularization

religious_societies_reform = {
	icon = "tribal_religious_society"
	allow_normal_conversion = yes
	modifiers = {
		stability_cost_modifier = -0.1
		religious_unity = 0.15
	}
	ai = {
		factor = 1
		modifier = {
			factor = 0.1
			religious_unity = 1
		}
		modifier = {
			factor = 0.5
			religious_unity = 0.9
		}
	}
}

lip_service_reform = {
	icon = "tribal_lip_service"
	allow_normal_conversion = yes
	modifiers = {
		land_maintenance_modifier = -0.1
	}
}

#Modernizantion

retain_tribal_hierarchy_reform = {
	icon = "retain_tribal_hierarchy"
	allow_normal_conversion = yes
	modifiers = {
		governing_capacity = 150
		max_absolutism = 10
	}
	ai = {
		factor = 1
		modifier = {
			factor = 0.5
			NOT = {
				any_owned_province = {
					is_territorial_core = root
				}
			}
		}
	}
}

centralize_tribal_power_reform = {
	icon = "tribal_centralize_power"
	allow_normal_conversion = yes
	modifiers = {
		core_creation = -0.05
		stability_cost_modifier = -0.05
	}
}

#Tribal Reformation

horde_barbaric_despoilers_reform = {
	icon = "rioting_burning_2"
	allow_normal_conversion = yes
	potential = {
		OR = {
			has_reform = steppe_horde
			has_reform = great_mongol_state_reform
		}
		has_dlc = "The Cossacks"
	}
	modifiers = {
		raze_power_gain = 0.33
		
	}
	ai = {
		factor = 2
	}
}

horde_tribal_unity_reform = {
	icon = "fist_in_air"
	allow_normal_conversion = yes
	potential = {
		OR = {
			has_reform = steppe_horde
			has_reform = great_mongol_state_reform
		}
		has_dlc = "The Cossacks"
	}
	modifiers = {
		horde_unity = 2
	}
	ai = {
		factor = 2
	}
}

tribe_becomes_monarchy_reform = {
	icon = "king_highlighted"
	allow_normal_conversion = yes
	potential = {
		NOT = { 
			has_reform = stateless_society
		}
	}
	trigger = {
		NOT = { has_government_attribute_short_desc = locked_government_type }
	}
	effect = {
		if = {
			limit = { has_reform = steppe_horde }
			hidden_effect = { set_country_flag = was_horde_flag }
		}
		set_country_flag = populists_in_government
		lose_reforms = 4
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion_group = muslim
					secondary_religion = sunni
					secondary_religion = shiite
					secondary_religion = ibadi
				}
			}
			change_technology_group = muslim
			change_unit_type = muslim
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion_group = christian
			}
			change_technology_group = eastern
			change_unit_type = eastern
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = totemism
			}
			change_technology_group = north_american
			change_unit_type = north_american
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = inti
			}
			change_technology_group = andean
			change_unit_type = andean
		}
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion = mesoamerican_religion
					religion = nahuatl
				}
			}
			change_technology_group = mesoamerican
			change_unit_type = mesoamerican
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = dreamtime
			}
			change_technology_group = aboriginal_tech
			change_unit_type = aboriginal_tech
		}
		if = {
			limit = {
				technology_group = nomad_group
				NOT = { religion_group = muslim }
				NOT = { religion_group = christian }
				NOT = { secondary_religion = sunni }
				NOT = { secondary_religion = shiite }
				NOT = { secondary_religion = ibadi }
				NOT = { religion = totemism }
				NOT = { religion = inti }
				NOT = { religion = nahuatl }
				NOT = { religion = mesoamerican_religion }
				NOT = { religion = dreamtime }
			}
			change_technology_group = chinese
			change_unit_type = chinese
		}
		change_government = monarchy
		if = {
			limit = {
				tag = AVE
			}
			hidden_effect = {
				country_event = {
					id = flavor_gbr.20
				}
			}
		}
	}
	ai = {
		factor = 1
	}
}

tribe_becomes_republic_reform = {
	icon = "parliament_highlighted"
	allow_normal_conversion = yes
	trigger = {
		NOT = { is_lesser_in_union = yes }
		NOT = { has_government_attribute_short_desc = locked_government_type }
	}
	effect = {
		if = {
			limit = { has_reform = steppe_horde }
			hidden_effect = { set_country_flag = was_horde_flag }
		}
		set_country_flag = populists_in_government
		lose_reforms = 4
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion_group = muslim
					secondary_religion = sunni
					secondary_religion = shiite
					secondary_religion = ibadi
				}
			}
			change_technology_group = muslim
			change_unit_type = muslim
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion_group = christian
			}
			change_technology_group = eastern
			change_unit_type = eastern
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = totemism
			}
			change_technology_group = north_american
			change_unit_type = north_american
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = inti
			}
			change_technology_group = andean
			change_unit_type = andean
		}
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion = mesoamerican_religion
					religion = nahuatl
				}
			}
			change_technology_group = mesoamerican
			change_unit_type = mesoamerican
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = dreamtime
			}
			change_technology_group = aboriginal_tech
			change_unit_type = aboriginal_tech
		}
		if = {
			limit = {
				technology_group = nomad_group
				NOT = { religion_group = muslim }
				NOT = { religion_group = christian }
				NOT = { secondary_religion = sunni }
				NOT = { secondary_religion = shiite }
				NOT = { secondary_religion = ibadi }
				NOT = { religion = totemism }
				NOT = { religion = inti }
				NOT = { religion = nahuatl }
				NOT = { religion = mesoamerican_religion }
				NOT = { religion = dreamtime }
			}
			change_technology_group = chinese
			change_unit_type = chinese
		}
		change_government = republic
		if = {
			limit = {
				tag = AVE
			}
			hidden_effect = {
				country_event = {
					id = flavor_gbr.20
				}
			}
		}
		if = {
			limit = {
				have_had_reform = stateless_society
			}
			add_government_reform = peasants_republic
		}
	}
	ai = {
		factor = 1
		modifier = {
			factor = 0
			OR = {
				has_reform = steppe_horde
				has_reform = great_mongol_state_reform
				NOT = { trade_income_percentage = 0.3 }
			}
		}
		modifier = {
			factor = 1.5
			OR = {
				num_of_centers_of_trade = 5
				trade_income_percentage = 0.4
			}
		}
	}
}

tribe_becomes_theocracy_reform = {
	icon = "pope_highlighted"
	allow_normal_conversion = yes
	potential = {
		NOT = { 
			has_reform = stateless_society
		}
	}
	trigger = {
		NOT = { is_lesser_in_union = yes }
		NOT = { has_government_attribute_short_desc = locked_government_type }
	}
	effect = {
		if = {
			limit = { has_reform = steppe_horde }
			hidden_effect = { set_country_flag = was_horde_flag }
		}
		set_country_flag = populists_in_government
		lose_reforms = 4
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion_group = muslim
					secondary_religion = sunni
					secondary_religion = shiite
					secondary_religion = ibadi
				}
			}
			change_technology_group = muslim
			change_unit_type = muslim
		}
		else_if = {
			limit = {
				technology_group = nomad_group
				religion_group = christian
			}
			change_technology_group = eastern
			change_unit_type = eastern
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = totemism
			}
			change_technology_group = north_american
			change_unit_type = north_american
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = inti
			}
			change_technology_group = andean
			change_unit_type = andean
		}
		if = {
			limit = {
				technology_group = nomad_group
				OR = {
					religion = mesoamerican_religion
					religion = nahuatl
				}
			}
			change_technology_group = mesoamerican
			change_unit_type = mesoamerican
		}
		if = {
			limit = {
				technology_group = nomad_group
				religion = dreamtime
			}
			change_technology_group = aboriginal_tech
			change_unit_type = aboriginal_tech
		}
		if = {
			limit = {
				technology_group = nomad_group
				NOT = { religion_group = muslim }
				NOT = { religion_group = christian }
				NOT = { secondary_religion = sunni }
				NOT = { secondary_religion = shiite }
				NOT = { secondary_religion = ibadi }
				NOT = { religion = totemism }
				NOT = { religion = inti }
				NOT = { religion = nahuatl }
				NOT = { religion = mesoamerican_religion }
				NOT = { religion = dreamtime }
			}
			change_technology_group = chinese
			change_unit_type = chinese
		}
		change_government = theocracy
		if = {
			limit = {
				tag = AVE
			}
			hidden_effect = {
				country_event = {
					id = flavor_gbr.20
				}
			}
		}
	}
	ai = {
		factor = 1
		modifier = {
			factor = 0
			OR = {
				has_reform = steppe_horde
				has_reform = great_mongol_state_reform
				NOT = { religion_group = muslim }
			}
		}
	}
}

tribe_becomes_horde_reform = {
	icon = "horde_riding_highlighted"
	allow_normal_conversion = yes
	potential = {
		NOT = { 
			has_reform = stateless_society
		}
	}
	effect = {
		set_country_flag = populists_in_government
		add_government_reform = steppe_horde
		change_unit_type = nomad_group
		change_technology_group = nomad_group
		custom_tooltip = STEPPE_HORDE_BENEFITS
	}
	trigger = {
		OR = {
			NOT = {	has_reform = steppe_horde }
			has_reform = tribe_becomes_horde_reform
		}
		NOT = { has_reform = great_mongol_state_reform }
		NOT = { has_government_attribute_short_desc = locked_government_type }
	}
	ai = {
		factor = 0
	}
}

tribe_remain_tribal_reform = {
	icon = "rioting_burning_2"
	allow_normal_conversion = yes
	potential = {
		OR = {
			AND = {
				NOT = { has_reform = steppe_horde }
				NOT = { has_reform = great_mongol_state_reform }
			}
			NOT = { has_dlc = "The Cossacks" }
		}
	}
	modifiers = {
		legitimacy = 0.5
		war_exhaustion = -0.02
	}
}

tribe_tribal_unity = {
	icon = "fist_in_air"
	allow_normal_conversion = yes
	potential = {
		OR = {
			has_reform = tribal_federation
			has_reform = turkoman_ottoman_institutions
		}
		has_dlc = "Cradle of Civilization"
	}
	modifiers = {
		yearly_government_power = 1
		church_loyalty_modifier = 0.05
		nobles_loyalty_modifier = 0.05
		dhimmi_loyalty_modifier = 0.05
		burghers_loyalty_modifier = 0.05
	}
	ai = {
		factor = 2
	}
}