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

	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
	}

	royal_court = landed

	can_get_government = {
		exists = faith
		trigger_if = {
			limit = { exists = faith }
			theocratic_lay_clergy_trigger = yes
		}
		#The LAAMP Construct Holding decision
		trigger_if = {
			limit = {
				has_variable = {
					name = city_construction_is_temple_citadel
					name = city_construction_is_castle
				}
			}
			always = no
		}
	}

	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_church_authority
		government_uses_domain_limit
		gov_uses_non_crown_coa
		government_is_basic_theocracy
	}

	mechanic_type = theocracy
	min_appointment_tier = county
	is_mechanic_type_default = yes

	# Any positive weight is enough
	grant_vassal_ai_will_do = {
		value = 0
		if = {
			limit = {
				scope:title = { tier = tier_county }
				NOT = { has_variable = grant_vassal_government_cooldown }
				ai_zeal >= medium_positive_ai_value
				rite ?= {
					NOT = { rite_has_doctrine = doctrine_theocracy_lay_clergy }
					rite_has_doctrine = doctrine_theocracy_temporal
				}
				realm_theocratic_county_share_ai_below_cap_trigger = yes
			}
			add = 10
		}
	}

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

### Brief: ecclesiastical_government
# This is a theocratic government type that is Christian centered
#
ecclesiastical_government = {
	government_rules = {
		inherit_from_dynastic_government = no
		treasury = yes
		replace_gold_cost_by_treasury = yes
		add_religious_subordinates_for_treasury = yes
		use_as_base_on_landed = yes
		disable_regnal_numbers = yes
		sticky_government = yes
		allow_accolades = yes
		landless_playable = yes
	}

	royal_court = landed

	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 = {
		exists = faith
		trigger_if = {
			limit = { exists = faith }
			theocratic_lay_clergy_trigger = yes
		}
		#The LAAMP Construct Holding decision
		trigger_if = {
			limit = {
				has_variable = {
					name = city_construction_is_temple_citadel
					name = city_construction_is_castle
				}
			}
			always = no
		}
	}

	vassal_contract_group = theocracy_vassal

	character_modifier = {
		monthly_treasury_from_vassals = 0.85
		monthly_treasury_from_non_vassals = 0.85
		monthly_piety = 0.25
		accolades = -1
		knight_limit = -3
		men_at_arms_cap = -3
		men_at_arms_limit = -3
		mercenary_hire_cost_mult = 2
	}

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

	mechanic_type = theocracy
	min_appointment_tier = county
	domicile_type = ecclesiastical_domicile

	# is_grant_government_shown already limits this to ecclesiastical theocracy faiths
	grant_vassal_ai_will_do = {
		value = 0
		if = {
			limit = {
				scope:title = { tier = tier_county }
				NOT = { has_variable = grant_vassal_government_cooldown }
				ai_zeal >= medium_positive_ai_value
				rite ?= { rite_has_doctrine = doctrine_theocracy_temporal }
				realm_theocratic_county_share_ai_below_cap_trigger = yes
			}
			add = 10
		}
	}

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