#################
#Estate triggers
#################

#Generals estate

#Used to define a Theme Capital province.
estate_generals_is_theme_capital_trigger = {
	#custom_trigger_tooltip = {
		#tooltip = estate_generals_is_theme_capital_tooltip
		has_fort_building_trigger = yes
		has_forcelimit_building_trigger = yes
		NOT = { is_capital = yes } #Let's exclude Constantinople from this.
	#}
}

#Call using estate_generals_country_has_num_of_theme_capitals_trigger = { value = X }
estate_generals_country_has_num_of_theme_capitals_trigger = { 
	calc_true_if = {
		desc = estate_generals_is_theme_capital_tooltip
		all_owned_province = {
			estate_generals_is_theme_capital_trigger = yes
		}
		amount = $value$
	}
}

#Different version of vanilla trigger
root_can_build_alternate_manufactory_here_trigger = {
	num_free_building_slots = 1
	OR = {
		has_no_manufactory_trigger = yes #No manufactory - go ahead!
		AND = { #Has at least one extra manufactory slot.
			OR = {
				root = {
					has_global_modifier_value = {
						which = global_allowed_num_of_manufactories 
						value = 1
					}
				}
				has_local_modifier_value = {
					which = allowed_num_of_manufactories
					value = 1
				}
			}
			calc_true_if = { #Has one manufactory building	
				has_building = wharf
				has_building = weapons
				has_building = textile
				has_building = tradecompany
				has_building = farm_estate
				has_building = mills
				has_building = plantations
				has_building = furnace
				has_building = ramparts
				has_building = soldier_households
				has_building = impressment_offices
				has_building = state_house
				amount = 1
			}
			NOT = { #NOT has two manufactory buildings.
				calc_true_if = {		
					has_building = wharf
					has_building = weapons
					has_building = textile
					has_building = tradecompany
					has_building = farm_estate
					has_building = mills
					has_building = plantations
					has_building = furnace
					has_building = ramparts
					has_building = soldier_households
					has_building = impressment_offices
					has_building = state_house
					amount = 2
				}
			}
		}
	}
}




#Used to check for Exarchate tags
is_exarch_tag_and_exarch_of_root_trigger = {
	custom_trigger_tooltip = { 
		tooltip = any_exarch_tag_under_root_exists_trigger
		OR = { #I wonder if this is even necessary to check for.
			tag = KCD
			tag = HSP
			tag = GLT
			tag = ATL
			tag = PSI
			tag = RVN
			tag = ABO
			tag = AEG
		}
		is_subject_of_type = byz_exarch
		is_subject_of = ROOT
	}
}

#If BYZ or ROM formed from BYZ 
is_byz_or_hellenic_rome_trigger = { #Deprecated
	#tag = BYZ
}

#LTE-related
#LTE knightly order province triggers found in separate file.

#Used to check for Knightly Order tags
is_knightly_order_tag_and_knightly_order_of_root_trigger = { #Deprecated
	# custom_trigger_tooltip = {
		# tooltip = any_knightly_order_tag_under_root_exists_trigger
		# OR = { #I wonder if this is even necessary to check for.
			# #Vanilla & BT:
			# tag = ATH
			# tag = LES
			# tag = CYP
			# tag = NAX
			# tag = CEP
			# tag = ACH
			# #SE:
			# tag = EDE
			# tag = ATC
			# tag = TPL
			# tag = NEG
			# tag = NEO
			# #New tags:
			# tag = DYR
			# tag = TSL
			# tag = PHP
			# tag = VNA
			# tag = NCP
			# tag = AMK
			# tag = NCA
			# tag = PFG
			# tag = ATO
			# tag = TCS
			# tag = CSM
			# tag = CSN
			# tag = CLO
			# tag = CBT
			# tag = MSP
			# tag = TBZ
			# tag = CRS
			# tag = CDA
			# tag = EPR
			# tag = TSY
			# tag = OHR
		# }
		# is_subject_of_type = byz_crusader_vassal
		# is_subject_of = ROOT
	# }
}

#Used to check if province has no religious center modifier.
province_has_no_religious_center_modifier_trigger = {
	custom_trigger_tooltip = {
		tooltip = province_has_no_religious_center_modifier
		NOT = {
			has_province_modifier = religious_center
			has_province_modifier = orthodox_religious_center
		}
	}
}



has_non_capital_state_province_of_dev = {
	any_owned_province = {
		is_state = yes
		NOT = { is_capital = yes }
		development = $dev$
	}
}

#Gov mechanics triggers for ease of checking with a single line instead of the multiscope trigger.
#Usage: has_<gov_mechanic> = { value = X }
has_logothete_general_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_general_power 
		value = $value$ 
	}
}
has_logothete_postal_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_postal_power 
		value = $value$ 
	}
}
has_logothete_military_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_military_power 
		value = $value$ 
	}
}
has_logothete_praetorium_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_praetorium_power 
		value = $value$ 
	}
}
has_logothete_special_affairs_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_special_affairs_power 
		value = $value$ 
	}
}
has_logothete_waters_power = {
	has_government_power = { 
		mechanic_type = byzantine_bureaucracy_mechanic 
		power_type = logothete_waters_power 
		value = $value$ 
	}
}
has_byzantine_pronoia_power = {
	has_government_power = { 
		mechanic_type = byzantine_pronoia_mechanic 
		power_type = byzantine_pronoia_power 
		value = $value$ 
	}
}
has_byzantine_militarization = {
	has_government_power = { 
		mechanic_type = byzantine_militarization_mechanic 
		power_type = byzantine_militarization 
		value = $value$ 
	}
}
has_latin_imperial_authority = {
	has_government_power = { 
		mechanic_type = latin_imperial_authority_mechanic 
		power_type = latin_imperial_authority 
		value = $value$ 
	}
}

