### Brief: feudal_government
#
# This is referenced in code
#
feudal_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		legitimacy = yes
	}

	royal_court = any

	fallback = 1

	primary_holding = castle_holding
	valid_holdings = { temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = feudal_vassal

	ai = {
		use_legends = yes
	}
	character_modifier = {
		ai_war_cooldown = 1.5
		ai_war_chance = -0.15
	}
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_feudal
		government_is_settled
		may_elevate_co_monarch
		government_uses_crown_authority
		government_uses_domain_limit
	}

	mechanic_type = feudal
	is_mechanic_type_default = yes

	color = hsv{ 0.67 1.00 0.78 }
	realm_mask_offset = { 0.0 0.01 }
	realm_mask_scale = { 1 1 }
}

republic_government = {
	primary_holding = city_holding
	valid_holdings = { castle_holding }
	required_county_holdings = { city_holding castle_holding church_holding }
	government_rules = {
		inherit_from_dynastic_government = no
	}

	can_get_government = {
		
		NOR = {
			culture = {
				has_cultural_tradition = tradition_farmer_republics
			}
			faith = {
				has_doctrine = tenet_communal_possessions
			}
			liege = {
				has_government = peasantrepublic_government
			}
		}
	}
	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	vassal_contract_group = republic_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_republic
		government_is_settled
		government_uses_domain_limit
	}

	color = hsv{ 0.00 1.00 0.98 }
	realm_mask_offset = { 0.0 -0.01 }
	realm_mask_scale = { 1 1 }
}

### Brief: theocracy_government
# Head of faith will always get this if possible
#
# This is referenced in code
#
theocracy_government = {
	government_rules = {
		religious = yes
		inherit_from_dynastic_government = no
	}

	primary_holding = church_holding
	valid_holdings = { castle_holding tribal_holding nomad_holding herder_holding temple_citadel_holding }
	required_county_holdings = { church_holding castle_holding city_holding }

	ai = {
		use_legends = no
	}

	can_get_government = {
		NOT = {
			faith = {
				has_doctrine = doctrine_theocracy_lay_clergy
			}
		}
	}

	vassal_contract_group = theocracy_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_theocracy
		government_is_settled
		government_uses_domain_limit
	}

	mechanic_type = theocracy
	is_mechanic_type_default = yes

	color = hsv{ 0.00 0.00 0.78 }
	realm_mask_offset = { 0.0 0.02 }
	realm_mask_scale = { 0.95 0.95 }
}

### Brief: clan_government
clan_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		legitimacy = yes
		dynasty_named_realms = no
		always_use_patronym = yes
	}

	royal_court = any

	primary_holding = castle_holding
	primary_heritages = { heritage_arabic heritage_iranian heritage_turkic }

	fallback = 2

	preferred_religions = { islam_religion }

	valid_holdings = { temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	house_unity = clan_house_unity
	tax_slot_type = clan_tax_slot

	vassal_contract_group = clan_vassal

	ai = {
		use_legends = yes
	}

	opinion_of_liege = {
		scope:vassal = {
			if = {
				limit = {
					is_powerful_vassal = yes
					NOT = {
						is_allied_to = scope:liege
					}
				}
				value = clan_powerful_vassal_no_alliance_opinion_penalty_value
			}
		}
	}
	opinion_of_liege_desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:vassal = {
						NOT = {
							is_allied_to = scope:liege
						}
						is_powerful_vassal = yes
					}
				}
				desc = "GOVERNMENT_CLAN_NOT_ALLIED_POWERFUL"
			}
		}
	}

	character_modifier = {
		ai_war_cooldown = 1.5
		ai_war_chance = -0.15
	}
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_clan
		may_appoint_viziers
		government_is_settled
		government_uses_crown_authority
		government_uses_domain_limit
	}

	mechanic_type = clan
	is_mechanic_type_default = yes

	color = hsv{ 0.39 0.93 0.54 }
	realm_mask_offset = { 0.0 0.03 }
	realm_mask_scale = { 1 1 }
}

tribal_government = {
	government_rules = {
		rulers_should_have_dynasty = yes
		regiments_prestige_as_gold = yes
		legitimacy = yes
		always_use_patronym = yes
		affected_by_development = no
	}

	royal_court = any

	supply_limit_mult_for_others = -0.5
	primary_holding = tribal_holding
	required_county_holdings = { tribal_holding }

	valid_holdings = { castle_holding temple_citadel_holding }

	prestige_opinion_override = { -10 0 3 5 10 20 }

	vassal_contract_group = tribal_vassal

	ai = {
		use_legends = yes
	}

	character_modifier = {
		title_creation_cost_mult = -0.5
		army_maintenance_mult = -0.5

		feudal_government_vassal_opinion = -20
		clan_government_vassal_opinion = -20
		republic_government_vassal_opinion = -20

		character_travel_safety = 10

		monthly_prestige = 0.2
		ai_war_cooldown = 1.5
		ai_war_chance = -0.05
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_tribal
		government_is_tribal_excluding_wanua
		use_prestige_to_buy_maa
		government_is_settled
		government_can_raid_rule
		may_elevate_co_monarch
		government_uses_domain_limit
	}

	color = hsv{ 0.02 0.75 0.36 }
	realm_mask_offset = { 0.0 0.0 }
	realm_mask_scale = { 0.96 0.96 }
}

# This govtype will be switched back to tribal_government if the TGP DLC is not active. This is done by effect in the game_start.txt on_action file.
#
wanua_government = { # "Wanua"
	government_rules = {
		rulers_should_have_dynasty = yes
		legitimacy = yes
		always_use_patronym = yes
		affected_by_development = no
		gain_legitimacy_becoming_tributary = yes
		regiments_use_barter_goods_as_gold = yes
		barter = yes
	}

	royal_court = any

	supply_limit_mult_for_others = -0.5
	primary_holding = tribal_holding
	required_county_holdings = { tribal_holding }
	primary_heritages = { heritage_austronesian }

	valid_holdings = { city_holding castle_holding temple_citadel_holding }

	prestige_opinion_override = { -10 0 3 5 10 20 }

	vassal_contract_group = wanua_vassal

	ai = {
		use_legends = yes
	}

	character_modifier = {
		title_creation_cost_mult = -0.5

		embarkation_cost_mult = -1

		sea_travel_danger = medium_sea_danger_reduction
		coastal_sea_travel_danger = medium_sea_danger_reduction

		ai_war_chance = -0.5

		domain_limit_max = 2
		vassal_limit_max = 2
		ai_war_cooldown = 1.5
		ai_war_chance = -0.55
	}

	can_get_government = {
		has_tgp_dlc_trigger = yes
	}

	flags = {
		government_is_tribal
		government_is_wanua
		government_can_raid_rule
		government_enables_naval_raiding
		government_enables_river_travel
		may_elevate_co_monarch
	}

	color = rgb{ 85 207 198 }
	realm_mask_offset = { 0.0 0.09 }
	realm_mask_scale = { 0.9 0.9 }
}

### Brief: mercenary_government
# Mercenary will always get this
#
# This is referenced in code
#
mercenary_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		inherit_from_dynastic_government = no
	}

	court_generate_commanders = 5

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_uses_crown_authority
		cannot_be_vassal_or_liege
		government_is_mercenary
	}

	mechanic_type = mercenary
	is_mechanic_type_default = yes

	color = hsv{ 0.00 0.00 0.66 }
	realm_mask_offset = { 0.0 -0.01 }
	realm_mask_scale = { 1 1 }
}

### Brief: holy_order_government
# Holy order will always get this
#
# This is referenced in code
#
holy_order_government = {
	government_rules = {
		council = no
		court_generate_spouses = no
		inherit_from_dynastic_government = no
	}

	court_generate_commanders = 5

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	valid_holdings = { castle_holding city_holding temple_citadel_holding }

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_uses_crown_authority
		cannot_be_vassal_or_liege
		government_is_holy_order
	}

	mechanic_type = holy_order
	is_mechanic_type_default = yes

	color = hsv{ 0.00 0.00 0.66 }
	realm_mask_offset = { 0.0 -0.01 }
	realm_mask_scale = { 1 1 }
}

### Brief: administrative_government
# Default administrative government, used for Byzantium
#
# This is referenced in code
#
administrative_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		landless_playable = yes
		legitimacy = yes
		administrative = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
		house_aspirations = yes
		noble_families = yes
		admin_allows_holding_multiple_primary_tier_titles = yes
		treasury = yes
		replace_gold_cost_by_treasury = yes
	}

	royal_court = top_liege

	domicile_type = estate
	main_administrative_tier = duchy
	min_appointment_tier = duchy
	minimum_provincial_maa_tier = duchy

	fallback = 3

	primary_holding = castle_holding
	valid_holdings = { city_holding temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = admin_vassal

	character_modifier = {
		levy_size = -0.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -2
		men_at_arms_limit = -2
		knight_limit = -5
		vassal_limit = 100
		active_accolades = -1
		title_creation_cost_mult = -0.5
		mercenary_hire_cost_mult = 2
		men_at_arms_maintenance = 0.5

		# Vassals get Treasury income that is this percentage less than their taxes to their liege
		monthly_treasury_from_liege_mult = -0.15
		ai_war_cooldown = 1.5
		ai_war_chance = -0.15
	}

	top_liege_character_modifier = {
		# 85% of vassal income goes to the treasury
		monthly_treasury_from_vassals = 0.85
		men_at_arms_maintenance = 1.5
		men_at_arms_recruitment_cost = 1
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_administrative
		#government_has_county_tier_noble_families

		# These flags only exist for loc and in-game descriptions
		government_has_influence
		government_has_treasury
		government_is_special_administrative
		government_has_title_men_at_arms
		government_has_powerful_families
		government_is_settled
		government_uses_domicile_but_not_adventurer
		government_uses_domain_limit
		government_uses_admin_province_obligations
	}

	mechanic_type = administrative
	is_mechanic_type_default = yes

	color = { 72 6 92 }
	realm_mask_offset = { 0.0 0.01 }
	realm_mask_scale = { 1 1 }
}

### Brief: landless_adventurer_government
# Default landless adventurer government
#
# This is referenced in code
#
landless_adventurer_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		landless_playable = yes
		conditional_maa_refill = yes
		use_title_tier_modifiers = no
		mercenary = yes
		allow_out_of_realm_inheritance = yes
		use_as_base_on_landed = yes
		use_maa_maintenance = no
	}

	domicile_type = camp
	court_generate_commanders = no

	can_get_government = {
		any_held_title = {
			title_tier = duchy
			is_landless_type_title = yes
		}
	}

	valid_holdings = { tribal_holding church_holding castle_holding city_holding temple_citadel_holding }

	character_modifier = {
		active_accolades = -100
		knight_limit = 2
		men_at_arms_cap = -3
		men_at_arms_limit = -2
		character_travel_speed = 20
		siege_weapon_siege_value_mult = -0.5
		mercenary_hire_cost_mult = 1
		short_reign_duration_mult = -5
		long_reign_bonus_mult = -1
		domicile_travel_speed = -0.75
		monthly_wanderer_lifestyle_xp_gain_mult = 0.15
	}

	ai = {
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		cannot_be_vassal_or_liege
		government_is_landless_adventurer
		has_unique_government_perks
	}

	mechanic_type = landless_adventurer
	is_mechanic_type_default = yes

	color = hsv{ 0.00 0.00 0.66 }
	realm_mask_offset = { 0.0 0.0 }
	realm_mask_scale = { 1 1 }
}

landless_minority_government = {
	government_rules = {
		create_cadet_branches = yes
		court_generate_spouses = yes
		council = yes
		always_use_patronym = yes
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		landless_playable = yes
		use_title_tier_modifiers = no
		mercenary = yes
		allow_out_of_realm_inheritance = yes
		use_as_base_on_landed = yes
		regiments_use_barter_goods_as_gold = yes
		barter = yes
	}

	domicile_type = minority_community
	court_generate_commanders = yes

	can_get_government = {
		any_held_title = {
			title_tier = duchy
			is_landless_type_title = yes
		}
		culture = {
			has_cultural_tradition = tradition_diasporic
		}
	}
	valid_holdings = { tribal_holding church_holding castle_holding city_holding temple_citadel_holding }

	character_modifier = {
		active_accolades = -100
		knight_limit = 2
		character_travel_speed = 20
		siege_weapon_siege_value_mult = -0.5
		mercenary_hire_cost_mult = 1
		short_reign_duration_mult = -5
		long_reign_bonus_mult = -1
		domicile_travel_speed = -0.75
		monthly_wanderer_lifestyle_xp_gain_mult = 0.15
	}

	ai = {
		use_goals = yes
		use_scripted_guis = no
		perform_religious_reformation = yes
		use_legends = yes
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_barterer
		landless_can_be_vassalised
		government_is_landless_minority
		government_devassalises
	}

	mechanic_type = landless_adventurer

	color = hsv{ 0.00 0.00 0.90 }
	realm_mask_offset = { 0.0 0.0 }
	realm_mask_scale = { 1 1 }
}

peasantrepublic_government = {
	primary_holding = city_holding
	valid_holdings = { temple_citadel_holding }
	required_county_holdings = { city_holding church_holding }
	government_rules = {
		create_cadet_branches = yes
		court_generate_spouses = yes
		council = yes
		always_use_patronym = yes
		rulers_should_have_dynasty = yes
		landless_playable = yes
		legitimacy = yes
		barter = yes
		mercenary = yes
		use_as_base_on_landed = yes
		allow_out_of_realm_inheritance = no
		use_as_base_on_rank_up = yes
		uses_county_fertility = yes
		sticky_government = yes
		replenishes_county_fertility = yes
		regiments_use_barter_goods_as_gold = yes
	}

	can_get_government = {
		OR = {
			culture = {
				has_cultural_tradition = tradition_farmer_republics
			}
			faith = {
				has_doctrine = tenet_communal_possessions
			}
			liege = {
				has_government = peasantrepublic_government
			}
		}
	}
	domicile_type = farmstead
	character_modifier = {
		levy_size = 1.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		ignore_negative_opinion_of_culture = yes
		men_at_arms_cap = -1
		men_at_arms_limit = -1
		knight_limit = -4
		active_accolades = -1
		title_creation_cost_mult = 1.5
		mercenary_hire_cost_mult = 2
		men_at_arms_maintenance = 1.5
		vassal_limit = 5
		ai_war_cooldown = 1.5
		ai_war_chance = -0.15
	}
	vassal_contract_group = peasantrepublic_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_settled
		may_elevate_co_monarch
		government_uses_legitimacy
		government_uses_domain_limit
		government_is_herder
		government_has_herd
		government_is_barterer
		government_is_prepublic
		government_locked_to_elective
		government_allows_nomad_domicile_titles
	}

	mechanic_type = feudal
	color = hsv{ 0.30 0.60 0.68 }
	realm_mask_offset = { 0.0 -0.01 }
	realm_mask_scale = { 1 1 }
}
### Brief: nomad_government
# Default nomad government, used for the Steppe Region
#
# This is referenced in code
#
nomad_government = {
	government_rules = {
		obedience = yes
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		landless_playable = yes
		legitimacy = yes
		use_as_base_on_rank_up = yes
		use_as_base_on_landed = yes
		conditional_maa_refill = yes
		uses_county_fertility = yes
		uses_culture_and_house_head_named_realms = yes
		sticky_government = yes
		subject_men_at_arms = yes
		no_capital_movement_cooldown = yes
		affected_by_development = no
		buildings = no
	}

	royal_court = any

	domicile_type = yurt

	primary_holding = nomad_holding
	valid_holdings = { castle_holding tribal_holding temple_citadel_holding }
	required_county_holdings = { nomad_holding }

	generated_character_template = nomadic_chieftain_character

	max_dread = 150

	vassal_contract_group = nomad_vassal

	character_modifier = {
		steppe_travel_danger = steppe_high_danger_reduction
		plains_travel_danger = steppe_high_danger_reduction
		drylands_travel_danger = drylands_medium_danger_reduction
		mountains_travel_danger = mountains_medium_danger_reduction
		steppe_cancel_negative_supply = yes
		ignore_negative_opinion_of_culture = yes
		county_fertility_decline_add = -15
		movement_speed = 0.1
		movement_speed_land_raiding = 0.1
		the_great_steppe_supply_limit_add = 10000
		game_rule_extra_nomads_arabs_supply_limit_add = 10000
		game_rule_extra_nomads_horn_supply_limit_add = 10000
		game_rule_extra_nomads_sahel_supply_limit_add = 10000
		game_rule_extra_nomads_sami_supply_limit_add = 10000
		game_rule_extra_nomads_tibet_supply_limit_add = 10000
		domain_limit = -1
		ai_war_cooldown = -0.5
		ai_war_chance = 2
		men_at_arms_maintenance = -0.5
		supply_duration = 1
		county_opinion_add = 25
		title_creation_cost_mult = -0.5
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_nomadic
		government_has_herd
		government_can_raid_rule
		government_can_use_tributary_men_at_arms
		can_start_war_with_raised_troops
		ignores_faith_marriage_penalties
		no_hostile_attrition_in_steppe # Done in code, here for loc
		movement_speed_from_government
		land_raiding_movement_speed_from_government
		can_raze_holdings
		government_uses_domicile_but_not_adventurer
	}

	mechanic_type = nomad
	is_mechanic_type_default = yes

	# These flags only exist for loc and in-game descriptions
	color = { 255 127 80 }
	realm_mask_offset = { 0.0 0.12 }
	realm_mask_scale = { 0.8 0.8 }
}

### Brief: herder_government
# Default herder government, used for the Steppe Region
#
# This is referenced in code
#
herder_government = {
	generated_character_template = herder_character

	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		uses_county_fertility = yes
		replenishes_county_fertility = yes
		deny_powerful_vassal = yes
		redirects_wars_to_overlord = yes
		buildings = no
	}

	character_modifier = {
		knight_limit = -100
		active_accolades = -100
		county_opinion_add = 100
		monthly_income_mult = -10
	}

	primary_holding = herder_holding
	valid_holdings = { herder_holding castle_holding tribal_holding }
	required_county_holdings = { herder_holding }

	ai = {
		use_lifestyle = no
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		use_scripted_guis = no
		use_legends = no
		perform_religious_reformation = no
	}

	vassal_contract_group = herder_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_herder
		government_is_true_herder
		government_has_herd
		ignores_faith_marriage_penalties
	}

	mechanic_type = herder
	is_mechanic_type_default = yes

	color = { 235 213 52 }
	realm_mask_offset = { 0.0 0.12 }
	realm_mask_scale = { 0.8 0.8 }
}

celestial_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		administrative = yes
		landless_playable = yes
		legitimacy = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
		house_aspirations = yes
		noble_families = yes
		deny_powerful_vassal = yes

		treasury = yes
		merit = yes
		replace_gold_cost_by_treasury = yes
		block_alliance_child_marriage = yes
		admin_allows_holding_multiple_primary_tier_titles = no
	}

	royal_court = top_liege

	domicile_type = east_asian_estate
	main_administrative_tier = duchy
	min_appointment_tier = county
	minimum_provincial_maa_tier = county
	administrative_title_maa_setup = vassals_and_top_liege

	fallback = 3

	primary_holding = castle_holding
	valid_holdings = { city_holding temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = celestial_vassal

	character_modifier = {
		levy_size = -0.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -3
		men_at_arms_limit = -2
		knight_limit = -5
		vassal_limit = 20
		active_accolades = -1
		character_max_merit_level_add = 1
		mercenary_hire_cost_mult = 2

		# Vassals get Treasury income that is this percentage less than their taxes to their liege
		monthly_treasury_from_liege_mult = -0.25
		ai_war_cooldown = 1.5
		ai_war_chance = -0.15
	}

	top_liege_character_modifier = {
		# 99% of vassal income goes to the treasury
		monthly_treasury_from_vassals = 0.99
		men_at_arms_title_cap = -1
	}

	ai_ruler_desired_kingdom_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier >= tier_empire
			}
			add = 1 # Is 0 == Don't keep any Kingdoms - they should all be circuits
		}
	}
	ai_ruler_desired_empire_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier = tier_hegemony
			}
			add = 1 # Is 0 == Don't keep any Empires - they should all be 'great circuits'
		}
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_celestial

		government_has_merit
		government_has_influence
		government_has_treasury
		government_has_title_men_at_arms
		government_has_powerful_families
		government_has_county_tier_noble_families
		government_is_settled
		government_uses_domicile_but_not_adventurer
		government_uses_domain_limit
		government_uses_admin_province_obligations
		government_uses_merit_family_aspirations
		has_special_house_aspirations
	}

	# The hegemon cannot reassign ministers
	ai_can_reassign_council_positions = {
		primary_title != title:h_china
	}

	currency_levels_cap = {
		merit = 9
	}

	color = { 250 230 10 }
	realm_mask_offset = { 0.0 0.1 }
	realm_mask_scale = { 0.94 0.94 }
}

mandala_government = {
	government_rules = {
		create_cadet_branches = yes

		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes

		legitimacy = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		house_aspirations = yes
		considers_piety_for_title_creation = yes
		ask_for_tribute = yes

		deny_powerful_vassal = yes #LET HAVOC ENSUE!

		count_tributaries_for_title_requirements = yes
		radiance = yes
	}

	royal_court = any

	primary_holding = temple_citadel_holding
	valid_holdings = { church_holding castle_holding }
	required_county_holdings = { temple_citadel_holding city_holding }

	can_get_government = {
		has_tgp_dlc_trigger = yes
		always = no
		OR = {
			liege = { has_government = mandala_government }
			highest_held_title_tier > tier_barony
		}
	}

	vassal_contract_group = mandala_vassal

	opinion_of_liege = {
		scope:liege = {
			if = {
				limit = { piety_level = max_piety_level_plus_3 }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_8_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level_plus_2 }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_7_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level_plus_1 }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_6_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_5_value }
			}
			else_if = {
				limit = { piety_level = very_high_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_4_value }
			}
			else_if = {
				limit = { piety_level = high_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_3_value }
			}
			else_if = {
				limit = { piety_level = medium_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_2_value }
			}
			else_if = {
				limit = { piety_level = low_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_1_value }
			}
			else_if = {
				limit = { piety_level = low_negative_piety_level }
				scope:vassal = { value = mandala_vassal_opinion_bonus_piety_0_value }
			}
		}
	}
	opinion_of_liege_desc = { desc = liege_piety_level_desc }

	opinion_of_suzerain = {
		scope:suzerain = {
			if = {
				limit = { piety_level = max_piety_level_plus_3 }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_8_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level_plus_2 }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_7_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level_plus_1 }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_6_value }
			}
			else_if = {
				limit = { piety_level = max_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_5_value }
			}
			else_if = {
				limit = { piety_level = very_high_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_4_value }
			}
			else_if = {
				limit = { piety_level = high_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_3_value }
			}
			else_if = {
				limit = { piety_level = medium_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_2_value }
			}
			else_if = {
				limit = { piety_level = low_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_1_value }
			}
			else_if = {
				limit = { piety_level = low_negative_piety_level }
				scope:tributary = { value = mandala_tributary_opinion_bonus_piety_0_value }
			}
		}
	}
	opinion_of_suzerain_desc = { desc = suzerain_piety_level_desc }

	character_modifier = {
		clergy_opinion = 5
		zealot_opinion = 5
		domain_limit_max = 2

		#Vassal Limit Max:
		#Base:
		vassal_limit_max = 2
		#Increased with Mandala Temple Complex up to 30
		#Further 35 possible from Piety Levels 6-8 for a total of 65
		zealot_tax_contribution_mult = 0.05
		zealot_levy_contribution_mult = 0.05
		monthly_piety_gain_mult = 0.15
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		uses_mandala_aspects
		uses_mandala_decrees
		government_is_mandala
		has_coerce_tributary_scheme
		additional_piety_from_religious_buildings
		can_perform_ritual_contracts
		subjects_gain_piety_based_on_overlord_piety_level
		has_special_house_aspirations
		government_is_settled
		has_unique_government_perks
		no_powerful_vassals
	}

	# These flags only exist for loc and in-game descriptions

	currency_levels_cap = {
		piety = 8
	}

	mechanic_type = mandala
	is_mechanic_type_default = yes

	color = { 42 56 100 }
	realm_mask_offset = { 0.0 0.05 }
	realm_mask_scale = { 0.92 0.92 }
}

steppe_admin_government = {
	government_rules = {
		obedience = yes
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		administrative = yes
		landless_playable = yes
		legitimacy = yes
		use_as_base_on_rank_up = yes
		use_as_base_on_landed = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
		house_aspirations = yes
		subject_men_at_arms = yes
		noble_families = yes
		
		merit = yes # Meritocracy!
		treasury = yes
		replace_gold_cost_by_treasury = yes
		government_ignores_rightful_liege_penalties = yes
		deny_powerful_vassal = yes
	}

	royal_court = any

	domicile_type = east_asian_estate

	main_administrative_tier = duchy
	min_appointment_tier = county
	minimum_provincial_maa_tier = duchy

	primary_holding = castle_holding
	valid_holdings = { city_holding temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = meritocratic_vassal

	max_dread = 150

	character_modifier = {
		levy_size = -0.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -2
		men_at_arms_limit = -2
		knight_limit = -5
		vassal_limit = 100
		active_accolades = -1
		ignore_negative_opinion_of_culture = yes
		movement_speed = 0.1
		movement_speed_land_raiding = 0.1
		ai_war_cooldown = -0.5
		ai_war_chance = 2
		title_creation_cost_mult = -0.5
		character_max_merit_level_add = 2
		mercenary_hire_cost_mult = 2

		# Vassals get Treasury income that is this percentage less than their taxes to their liege
		monthly_treasury_from_liege_mult = -0.4
	}

	top_liege_character_modifier = {
		# 95% of vassal income goes to the treasury
		monthly_treasury_from_vassals = 0.95
	}

	ai_ruler_desired_kingdom_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier >= tier_empire
			}
			add = 2 # Is 1 == keep one kingdom only!
		}
	}
	ai_ruler_desired_empire_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier = tier_hegemony
			}
			add = 1 # Is 0 == Don't keep any Empires - they should all be 'great circuits'
		}
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_steppe_admin
		government_can_raid_rule
		government_can_use_tributary_men_at_arms
		government_has_merit
		government_has_influence
		government_has_treasury
		government_has_title_men_at_arms
		government_has_powerful_families
		government_has_county_tier_noble_families
		ignores_faith_marriage_penalties
		land_raiding_movement_speed_from_government
		can_raze_holdings
		government_is_settled
		government_uses_domicile_but_not_adventurer
		government_uses_admin_province_obligations
		government_uses_merit_family_aspirations
		has_special_house_aspirations
	}

	currency_levels_cap = {
		merit = 5
	}

	can_get_government = {
		has_tgp_dlc_trigger = yes
	}

	color = { 255 110 40 }
	realm_mask_offset = { 0.0 0.2 }
	realm_mask_scale = { 0.78 0.78 }
}

meritocratic_government = { # e.g. Korea, Dai Viet
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		administrative = yes
		landless_playable = yes
		legitimacy = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
		house_aspirations = yes
		noble_families = yes
		
		merit = yes # Meritocracy!
		treasury = yes
		replace_gold_cost_by_treasury = yes
		deny_powerful_vassal = yes
	}

	royal_court = any

	domicile_type = east_asian_estate
	main_administrative_tier = duchy
	min_appointment_tier = county
	minimum_provincial_maa_tier = duchy

	primary_holding = castle_holding
	valid_holdings = { city_holding temple_citadel_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = meritocratic_vassal

	character_modifier = {
		levy_size = -0.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -2
		men_at_arms_limit = -2
		knight_limit = -5
		vassal_limit = 100
		active_accolades = -1
		title_creation_cost_mult = -0.5
		character_max_merit_level_add = 2
		mercenary_hire_cost_mult = 2

		# Vassals get Treasury income that is this percentage less than their taxes to their liege
		monthly_treasury_from_liege_mult = -0.4
	}

	top_liege_character_modifier = {
		# 95% of vassal income goes to the treasury
		monthly_treasury_from_vassals = 0.95
	}

	ai_ruler_desired_kingdom_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier >= tier_empire
			}
			add = 2 # Is 1 == keep one kingdom only!
		}
	}
	ai_ruler_desired_empire_titles = {
		value = -1 # Keep all
		if = {
			limit = {
				highest_held_title_tier = tier_hegemony
			}
			add = 1 # Is 0 == Don't keep any Empires - they should all be 'great circuits'
		}
	}

	can_get_government = {
		has_tgp_dlc_trigger = yes
		always = no
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_meritocratic
		# These flags only exist for loc and in-game descriptions
		government_has_merit
		government_has_influence
		government_has_treasury
		government_has_title_men_at_arms
		government_has_powerful_families
		government_has_county_tier_noble_families
		government_is_settled
		government_uses_domicile_but_not_adventurer
		government_uses_domain_limit
		government_uses_admin_province_obligations
		government_uses_merit_family_aspirations
		has_special_house_aspirations
	}

	currency_levels_cap = {
		merit = 5
	}

	color = { 250 100 0 }
	realm_mask_offset = { 0.0 0.12 }
	realm_mask_scale = { 0.92 0.92 }
}
