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
			techno_feudal_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		potential = {
			OR = {
				controls_religion = no
				religion_group = muslim
				has_religion_feature = religion_temporal_head
				AND = {
					religion = norse_pagan_reformed
					has_religion_features = no # Old saves, and campaigns without HF, need the Fylkirate to continue working
				}
			}
			NOR = {
					religion_group = muslim
					is_government_potential = roman_imperial_government
					is_government_potential = chinese_imperial_government
					is_government_potential = dummy_government
					is_government_potential = order_government
					is_government_potential = sisterhood_government
					is_government_potential = nunorder_government
					is_government_potential = missionary_government
					is_government_potential = missionary_guard_government
					is_government_potential = warorder_government
					is_government_potential = imperial_pretender_government
					is_government_potential = techno_feudal_government
					is_government_potential = pirate_republic_government
					is_government_potential = techno_republic_government
			}
			NAND = { 
				culture_group = tibetan_group
				OR = {
					religion = bon
					religion = bon_reformed
					religion = buddhist
				}
				higher_tier_than = BARON
			}
			NAND = { 
				tier = EMPEROR
				primary_title = { has_title_flag = pretender_chinese_empire }
				OR = {
					culture_group = chinese_group
					culture = khitan
					culture = tangut
					culture = jurchen
					has_character_flag = chinese_imperial_government_preserve
				}
			}
			is_patrician = no
		}
		
		color = { 91 133 207 }
		
		dukes_called_kings = yes
		barons_need_dynasty = yes

		can_build_tribal = no
		
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}
		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 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
			techno_feudal_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
		}
		frame_suffix = "_iqta"
		potential = {
			OR = {
				controls_religion = no
				religion_group = muslim
				has_religion_feature = religion_temporal_head
				AND = {
					religion = norse_pagan_reformed
					has_religion_features = no # Old saves, and campaigns without HF, need the Fylkirate to continue working
				}
			}
			religion_group = muslim
			NOR = {
					is_government_potential = roman_imperial_government
					is_government_potential = chinese_imperial_government
					is_government_potential = dummy_government
					is_government_potential = order_government
					is_government_potential = sisterhood_government
					is_government_potential = nunorder_government
					is_government_potential = missionary_government
					is_government_potential = missionary_guard_government
					is_government_potential = warorder_government
					is_government_potential = imperial_pretender_government
					is_government_potential = techno_feudal_government
					is_government_potential = pirate_republic_government
					is_government_potential = techno_republic_government
			}
			NAND = { 
				tier = EMPEROR
				primary_title = { has_title_flag = pretender_chinese_empire }
				OR = {
					culture_group = chinese_group
					culture = khitan
					culture = tangut
					culture = jurchen
					has_character_flag = chinese_imperial_government_preserve
				}
			}
			is_patrician = no
		}
		
		color = { 10 138 57 }
		
		uses_decadence = yes
		uses_piety_for_law_change = yes
		
		dukes_called_kings = yes
		barons_need_dynasty = yes
		have_gender_laws = no
		allows_matrilineal_marriage = 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.

		can_build_tribal = no
		
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}
		capital_move_delay = 600

		## Modifiers
		court_size_modifier = 10
	}
	
	theocratic_feudal_government = {
		preferred_holdings = { CASTLE TEMPLE }
		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
			techno_feudal_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		frame_suffix = "_theocraticfeudal"
		potential = {
			OR = {
				controls_religion = no
				religion_group = muslim
				has_religion_feature = religion_temporal_head
				AND = {
					religion = norse_pagan_reformed
					has_religion_features = no # Old saves, and campaigns without HF, need the Fylkirate to continue working
				}
			}
			NOR = {
					religion_group = muslim
					is_government_potential = roman_imperial_government
					is_government_potential = chinese_imperial_government
					is_government_potential = dummy_government
					is_government_potential = order_government
					is_government_potential = sisterhood_government
					is_government_potential = nunorder_government
					is_government_potential = missionary_government
					is_government_potential = missionary_guard_government
					is_government_potential = warorder_government
					is_government_potential = imperial_pretender_government
					is_government_potential = techno_feudal_government
					is_government_potential = pirate_republic_government
					is_government_potential = techno_republic_government
			}
			culture_group = tibetan_group
			OR = {
				religion = bon
				religion = bon_reformed
				religion = buddhist
			}
			higher_tier_than = BARON
			NAND = {
				tier = EMPEROR
				primary_title = { has_title_flag = pretender_chinese_empire }
				OR = {
					culture_group = chinese_group
					culture = khitan
					culture = tangut
					culture = jurchen
					has_character_flag = chinese_imperial_government_preserve
				}
			}
			is_patrician = no
		}
		
		color = { 207 145 90 }
		
		uses_piety_for_law_change = yes
		dukes_called_kings = yes
		barons_need_dynasty = yes

		can_build_tribal = no
		
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}
		capital_move_delay = 600
		## Modifiers
		court_size_modifier = 10
	}
	
	chinese_imperial_government = {
		preferred_holdings = { CASTLE CITY }
		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
			techno_feudal_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
		}
		frame_suffix = "_chineseimperial"
		potential = {
			OR = {
				AND = {
					tier = EMPEROR
					OR = {
						primary_title = { has_title_flag = pretender_chinese_empire }
						primary_title = { title = e_china } # For Umbra Spherae Reborn
						has_game_rule = { name = sco_rule_gvchineseimperial value = culturalempire }
					}
				}
				AND = {
					is_merchant_republic = no
					has_game_rule = { name = sco_rule_imperialvassals value = on }
					any_liege = { government = chinese_imperial_government }
				}
				has_game_rule = { name = sco_rule_gvchineseimperial value = culture }
			}
			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
			}
			is_patrician = no
		}
		
		color = { 118 255 163 }

		barons_need_dynasty = yes

		can_build_tribal = no
		
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}
		capital_move_delay = 200
		
		can_usurp_kingdoms_and_empires = no
		can_create_empires = no
		can_demand_religious_conversion = no
		gets_religion_opinion_penalties = no
		gives_religion_opinion_penalties = no
		vassal_government_opinion_penalties = no
		can_grant_kingdoms_and_empires_to_other_government_group = yes
		free_retract_vassalage = yes
		marriage_ignore_religion = yes
		
		vassal_limit = 10
		
		character_modifier = {
			monthly_character_piety = 1
		}
		## Modifiers
		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
			techno_feudal_government
			sisterhood_government
			nunorder_government
			missionary_government
			warorder_government
		}
		free_revoke_on_governments = {
			order_government
			sisterhood_government
			nunorder_government
			missionary_government
			warorder_government
		}
		free_revoke_on_tiers = {
			BARON
		}

		forced_contract = {
			order_government
			sisterhood_government
			nunorder_government
			missionary_government
			warorder_government
		}

		frame_suffix = "_order"
		title_prefix = "order_"

		potential = {
			NOT = { is_government_potential = dummy_government }
			controls_religion = no
			NAND = {
				tier = BARON
				capital_holding = { holding_type = temple } #tried is_government_potential = theocracy_government, didn't work with tribal holdings for some reason, holder became tribal instead
			}
			OR = {
				holy_order = yes
				any_demesne_title = { has_flag = force_order_government }
				any_liege = {
					OR = {
						holy_order = yes
						government = order_government
						government = sisterhood_government
						government = nunorder_government
					}
					religion = ROOT
				}
			}
			OR = {
				any_demesne_title = { has_flag = force_order_government }
				AND = { #this is to avoid standard holy orders becoming other types upon vassalization
					is_feudal = yes
					mercenary = no
					#any_demesne_title = { is_landless_type_title = yes }
					OR = {
						NOR = {
							any_demesne_title = { has_flag = force_sis_government }
							any_demesne_title = { has_flag = force_missionary_government }
							any_demesne_title = { has_flag = force_warorder_government }
						}
						has_game_rule = { name = sco_rule_hoextra value = off }
					}
				}
				NOR = {
					is_government_potential = sisterhood_government
					is_government_potential = nunorder_government
					is_government_potential = missionary_government
					is_government_potential = warorder_government
				}
			}
			NAND = {
				OR = {
					is_government_potential = merchant_republic_government
					is_government_potential = pirate_republic_government
					is_government_potential = techno_republic_government
				}
				OR = {
					tier = DUKE
					is_patrician = yes
				}
				any_demesne_province = {
					any_province_holding = {
						OR = {
							AND = {
								tier = BARON
								holding_type = family_palace
							}
							AND = {
								NOT = {
									tier = BARON
								}
								holding_type = city
							}
						}
					}
				}
			}
		}

		color = { 169 169 169 }

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

	roman_imperial_government = {
		preferred_holdings = { CASTLE CITY }
		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
			techno_feudal_government
			republic_government
			merchant_republic_government
			pirate_republic_government
			techno_republic_government
		}
		free_revoke_on_governments_religion = { # Tribal vassals of other religions can have their titles revoked for free
			tribal_government
		}
		frame_suffix = "_romanimperial"
		potential = {
			OR = {
				AND = {
					is_save_game = no
					has_game_started = no
					primary_title = { 
						OR = { 
							title = e_byzantium
							title = e_roman_empire
						}
					}
				}
				primary_title = {
					OR = {
						title = e_byzantium
						title = e_roman_empire
						AND = {
							has_game_rule = { name = sco_rule_gvimperial value = feudalempire }
							tier = EMPEROR
						}
					}
					has_law = succ_byzantine_elective
				}
				AND = {
					is_merchant_republic = no
					has_game_rule = { name = sco_rule_imperialvassals value = on }
					any_liege = { OR = { government = roman_imperial_government government = imperial_pretender_government } }
				}
			}
			is_patrician = no
		}
		
		color = { 143 12 125 }

		barons_need_dynasty = yes

		can_build_tribal = no
		
		ignore_in_vassal_limit_calculation = {
			tribal_government
		}
		capital_move_delay = 2000
		
		can_usurp_kingdoms_and_empires = no
		can_imprison_without_reason = no
		can_create_empires = no
		vassal_government_opinion_penalties = no
		can_grant_kingdoms_and_empires_to_other_government_group = yes
		can_be_granted_kingdoms_and_empires_by_other_government = no
		free_retract_vassalage = yes
		
		## Modifiers
		court_size_modifier = 15
	}

}
