feudal_governments = {

	feudal_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			muslim_government
			theocratic_feudal_government
			chinese_imperial_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		color = { 91 133 207 }

		potential = {
			is_patrician = no

			NOR = {
				is_government_potential = insular_feudal_government
				is_government_potential = muslim_government
				is_government_potential = timar_government
				is_government_potential = theocratic_feudal_government
				is_government_potential = tibetan_feudal_government
				is_government_potential = spiritual_feudal_government
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
				is_government_allowed = theocracy_government
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}
	
	insular_feudal_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			muslim_government
			theocratic_feudal_government
			chinese_imperial_government
		}

		frame_suffix = "_insularfeudal"
		color = { 92 82 115 }

		potential = {
			has_concubinage = no
			is_senior_consort_party = yes
			culture_group = celtic
			
			NOR = {
				is_government_potential = muslim_government
				is_government_potential = theocratic_feudal_government
			}
		}
		
		allow = {
			is_patrician = no

			NOR = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
				is_government_allowed = theocracy_government
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes
		max_consorts = 3

		capital_move_delay = 600

		## Modifiers
		vassal_limit = -10
	}

	muslim_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			feudal_government
			theocratic_feudal_government
			chinese_imperial_government
		}
		free_revoke_on_tiers = {
			DUKE
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_iqta"
		color = { 10 138 57 }

		potential = {
			religion_group = muslim
			NOT = {
				is_government_potential = timar_government
			}
		}

		allow = {
			is_patrician = no

			NOR = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
			}
		}

		allows_matrilineal_marriage = no
		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes
		free_retract_vassalage = yes
		free_levies_in_offensive_war = yes # Took away the hardcoded stuff for muslims where they could raise levies without pissing off vassals if in an offensive war.
		have_gender_laws = no
		uses_decadence = yes
		uses_piety_for_law_change = yes

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}
	
	timar_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			feudal_government
			theocratic_feudal_government
			chinese_imperial_government
		}
		free_revoke_on_tiers = {
			DUKE
			BARON
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		forced_contract = {
			muslim_government
			feudal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_iqta"
		color = { 10 138 57 }

		potential = {
			culture = turkish
			religion_group = muslim
			OR = {
				has_landed_title = k_tekke
				has_landed_title = k_ottoman
				has_landed_title = k_mentese
				has_landed_title = k_karaman
				has_landed_title = k_germiyan
				has_landed_title = k_eretnid
				has_landed_title = k_aydin
				has_landed_title = k_candar
				AND = {
					has_landed_title = k_rum
					k_rum = {
						has_title_flag = anatolian_rum
					}
				}
			}
		}

		allow = {
			is_patrician = no
			
			NOT = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
			}
		}

		allows_matrilineal_marriage = no
		barons_need_dynasty = yes
		can_build_tribal = no
		free_retract_vassalage = yes
		free_levies_in_offensive_war = yes # Took away the hardcoded stuff for muslims where they could raise levies without pissing off vassals if in an offensive war.
		have_gender_laws = no
		uses_decadence = yes
		uses_piety_for_law_change = yes
		vassal_government_opinion_penalties = no

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 15
	}
	
	
	theocratic_feudal_government = { # Patrimonial Theocracy
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			muslim_government
			theocracy_government
			feudal_government
			chinese_imperial_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		free_revoke_on_governments = {
			theocracy_government
		}
		forced_contract = {
			theocracy_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_theocraticfeudal"
		color = { 192 192 192 }

		potential = {
			controls_religion = yes
			OR = {
				AND = {
					has_religion_feature = religion_temporal_head
					has_religion_feature = religion_dogmatic
				}
				
				trigger_if = {
					limit = { religion = norse_pagan_reformed }
					has_religion_features = no # Old saves, and campaigns without HF, need the Fylkirate to continue working
				}
			}
			NOT = { is_government_potential = tibetan_feudal_government }
		}
		
		allow = {
			is_patrician = no
			
			NOR = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
				is_government_allowed = theocracy_government
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes
		uses_piety_for_law_change = yes

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}

	tibetan_feudal_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			muslim_government
			theocracy_government
			feudal_government
			chinese_imperial_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_tibetanfeudal"
		color = { 207 145 90 }

		potential = {
			higher_tier_than = BARON
			culture_group = tibetan_group

			OR = {
				religion = bon
				religion = bon_reformed
				religion = buddhist
			}
		}

		allow = {
			is_patrician = no
			
			NOR = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
				is_government_allowed = theocracy_government
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes
		uses_piety_for_law_change = yes

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}

	chinese_imperial_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			CITY
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			feudal_government
			muslim_government
			theocratic_feudal_government
		}
		free_revoke_on_tiers = {
			KING
			DUKE
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_chineseimperial"
		color = { 183 135 39 }

		potential = {
			OR = {
				culture_group = chinese_group
				culture = khitan
				culture = tangut
				culture = jurchen
				has_character_flag = chinese_imperial_government_preserve #keeps government when player is given culture change option
			}
		}

		allow = {
			primary_title = {
				tier = EMPEROR
				has_title_flag = pretender_chinese_empire
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		can_create_empires = no
		can_demand_religious_conversion = no
		can_grant_kingdoms_and_empires_to_other_government_group = yes
		can_usurp_kingdoms_and_empires = no
		free_retract_vassalage = yes
		gets_religion_opinion_penalties = no
		gives_religion_opinion_penalties = no
		marriage_ignore_religion = yes
		vassal_government_opinion_penalties = no

		capital_move_delay = 2000 # Reluctant to move

		## Modifiers
		character_modifier = {
		}

		court_size_modifier = 15
	}

	order_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			TRIBAL
			FORT
			HOSPITAL
		}
		accepts_liege_governments = {
			feudal_government
			muslim_government
			theocracy_government
			theocratic_feudal_government
			chinese_imperial_government
		}
		free_revoke_on_governments = {
			order_government
		}
		free_revoke_on_tiers = {
			BARON
		}
		forced_contract = {
			order_government
		}

		frame_suffix = "_order"
		title_prefix = "order_"
		color = { 169 169 169 }

		potential = {
			trigger_if = {
				limit = { holy_order = no }

				ai = yes

				any_liege = {
					holy_order = yes
					religion = ROOT
				}

				NOT = { is_government_potential = merchant_republic_government }
			}
		}

		barons_need_dynasty = yes
		can_be_granted_kingdoms_and_empires_by_other_government = no
		can_create_kingdoms = no
		can_create_empires = no
		can_grant_kingdoms_and_empires_to_other_government = no
		can_inherit = no
		can_imprison_without_reason = no
		can_revoke_without_reason = no
		can_usurp_kingdoms_and_empires = no
		dukes_called_kings = yes
		free_retract_vassalage = yes
		have_gender_laws = no
	}

	roman_imperial_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			CITY
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			feudal_government
			republic_government
			merchant_republic_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_romanimperial"
		color = { 143 12 125 }

		potential = {
			OR = {
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
			}
			trigger_if = {
				limit = {
					NOT = { has_law = succ_byzantine_elective }
				}
				is_save_game = no
				has_game_started = no
			}
		}

		allow = {}

		barons_need_dynasty = yes
		can_be_granted_kingdoms_and_empires_by_other_government = no
		can_build_tribal = no
		can_create_empires = no
		can_grant_kingdoms_and_empires_to_other_government_group = yes
		can_imprison_without_reason = no
		can_usurp_kingdoms_and_empires = no
		free_retract_vassalage = yes
		vassal_government_opinion_penalties = no

		capital_move_delay = 2000

		## Modifiers
		court_size_modifier = 15
	}
	
	sacred_confederacy_government = {
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			feudal_government
			republic_government
			merchant_republic_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		#frame_suffix = "_sacredimperial"
		color = { 91 133 207 }

		potential = {
			trigger_if = {
				limit = { offmap_power = { always = yes } } # Using flags to maximize compatibilities, as for now
				offmap_power = {
					has_offmap_flag = hre_diet_metz_enacted
					NOR = {
						has_offmap_flag = revoke_the_privilegia
						has_offmap_flag = hre_dismantled
					}
				}
			}
			trigger_else = {
				always = no
			}
		}

		allow = {}

		barons_need_dynasty = yes
		can_be_granted_kingdoms_and_empires_by_other_government = no
		can_build_tribal = no
		can_create_empires = no
		can_grant_kingdoms_and_empires_to_other_government_group = yes
		can_usurp_kingdoms_and_empires = no

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}
	
	spiritual_feudal_government = { # Cathar, Waldensian, Lollard, Messalian, Bogomilist and 769 start Orthodox.
		preferred_holdings = {
			CASTLE
		}
		allowed_holdings = {
			CASTLE
			TEMPLE
			FORT
			HOSPITAL
		}
		allowed_holdings_culture = { # Will not get the wrong government type penalty for tribes of the same culture
			TRIBAL
		}
		accepts_liege_governments = { # Gets the wrong religion modifier instead
			muslim_government
			theocratic_feudal_government
			chinese_imperial_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}

		frame_suffix = "_spiritualfeudal"
		color = { 192 192 192 }

		potential = {
			higher_tier_than = BARON
			religion_group = christian
			NOT = {
				religion_head = {
					controls_religion = yes
				}
			}
			#religion_allows_female_temple_holders = yes
			NOR = {
				is_government_potential = insular_feudal_government
				is_government_potential = theocratic_feudal_government
			}
		}
		
		allow = {
			is_patrician = no
			
			NOR = {
				is_government_potential = roman_imperial_government
				is_government_potential = order_government
				is_government_potential = sacred_confederacy_government
				is_government_allowed = chinese_imperial_government
				is_government_allowed = theocracy_government
			}
		}

		barons_need_dynasty = yes
		can_build_tribal = no
		dukes_called_kings = yes
		uses_piety_for_law_change = yes

		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}
}