#	Example:
#
#	example_trigger = {
#		year = 1066
#		num_of_spouses = 2
#	}
#
#
#	In a script file:
#
#	trigger = {
#		exampel_trigger = yes
#	}
#
# Naming convention:  xxxx_trigger
#

ai_not_busy_trigger = {
	OR = {
		ai = no
		NOR = {
			has_character_modifier = holding_epic_tournament
			has_character_modifier = holding_nomad_wargames
			trait = on_pilgrimage
			trait = on_hajj
		}
	}
}

allowed_custom_titles_trigger = {
	primary_title = {
		NOR = {
			title = k_israel
			title = k_armenia
			title = k_bohemia
			title = k_cornwall
			title = k_denmark
			title = k_egypt
			title = k_england
			title = k_finland
			title = k_ghana
			title = k_hungary
			title = k_ireland
			title = k_norway
			title = k_nubia
			title = k_scotland
			title = k_serbia
			title = k_sicily
			title = k_wales
			title = k_wend
			title = k_takrur
			title = k_abyssinia
			title = k_andalusia
			title = k_arabia
			title = k_austria
			title = k_bengal
			title = k_bulgaria
			title = k_carpathia
			title = k_croatia
			title = k_cuman
			title = k_georgia
			title = k_iceland
			title = k_lithuania
			title = k_mali
			title = k_poland
			title = k_prussia
			title = k_sweden
			title = k_syria
			title = k_france
			title = k_italy
			title = k_germany
			title = k_byzantium
			title = k_north_sea
			title = k_ottoman
			title = d_antioch
			title = d_epirus
			title = d_gascogne
			title = d_krete
			title = d_mallorca
			title = d_normandy
			title = d_slavonia
			title = d_swiss
			title = d_osterreich
			title = d_bavaria
			title = d_franconia
			title = d_luxembourg
			title = d_saxony
			title = d_swabia
			title = d_cornwall
			title = d_finland
			title = d_lombardia
			title = d_oman
			title = d_moravia
			title = d_gondar
			title = d_prussia
			title = d_cyprus
			title = d_edessa
			title = d_thessalonika
			title = d_iceland
			title = d_provence
			title = d_algarve
			title = d_bosnia
			title = d_skane
			title = d_armenia
			title = d_croatia
			title = d_valencia
		}
	}
}

# THIS = attacker, FROM = attacked ruler
attacking_religious_head_trigger = {
	ai = yes
	rightful_religious_head = FROM
	OR = {
		religion_group = christian
		religion_group = jewish_group
	}
	NOR = {
		trait = cynical
		trait = lunatic
		trait = excommunicated
		has_character_modifier = voice_of_satan
	}
}

can_attack_patriarch_trigger = {
	OR = {
		ROOT = { ai = no }
		holder_scope = { NOT = { religion = ROOT } }
		NOR = {
			title = b_roma
			title = b_hagiasophia
			title = b_alexandria
			title = b_antiocheia
			title = b_jerusalem
		}
		ROOT = {
			higher_real_tier_than = DUKE
			NOT = { same_realm = FROM }
		}
	}
}

can_change_succession_law = {
	FROM = {
		war = no
		has_regent = no
		ruled_years = 10
		NOR = {
			has_character_flag = changed_succession_@ROOT
			any_vassal = { war = yes }
			any_vassal = {
				higher_real_tier_than = BARON
				OR = {
					among_most_powerful_vassals = 5
					relative_power_to_liege = 0.10
					is_voter = yes
				}
				NOT = { opinion = { who = PREV value = 0 } }
			}
			AND = {
				OR = {
					has_character_flag = faction_court_unhappy
					has_character_flag = faction_court_angry
				}
				any_vassal = {
					leads_faction = faction_court
					faction_power = { faction = faction_court power = 0.50 }
				}
			}
			AND = {
				OR = {
					has_character_flag = faction_prosperity_unhappy
					has_character_flag = faction_prosperity_angry
				}
				any_vassal = {
					leads_faction = faction_prosperity
					faction_power = { faction = faction_prosperity power = 0.50 }
				}
			}
			AND = {
				OR = {
					has_character_flag = faction_glory_unhappy
					has_character_flag = faction_glory_angry
				}
				any_vassal = {
					leads_faction = faction_glory
					faction_power = { faction = faction_glory power = 0.50 }
				}
			}
			AND = {
				OR = {
					has_character_flag = faction_tradition_unhappy
					has_character_flag = faction_tradition_angry
				}
				any_vassal = {
					leads_faction = faction_tradition
					faction_power = { faction = faction_tradition power = 0.50 }
				}
			}
		}
	}
}

can_destroy_title_trigger = {
	is_primary_holder_title = yes
	is_landless_type_title = no
	temporary = no
	higher_tier_than = DUKE
	has_law = crown_authority_0
	NOT = { has_title_flag = do_not_destroy }
}

can_excommunicate_trigger = {
	OR = {
		religion = chalcedonian
		religion = catholic
		religion = fraticelli
		religion = orthodox
		religion = bogomilist
		religion = monothelite
		religion = iconoclast
		religion = miaphysite
		religion = monophysite
		religion = apostolic
		religion = nestorian
	}
}

has_disinheritance_trait_trigger = {
	custom_tooltip = {
		text = HAS_DISINHERITANCE_TRAIT_TT
		hidden_tooltip = {
			OR = {
				trait = bastard
				trait = eunuch
				trait = horse
				trait = abdicated
				trait = disinherited
				trait = monk
				trait = nun
				trait = desert_mother
				trait = desert_father
				trait = retired_vestalis
				trait = vestalis
			}
		}
	}
}

religion_allows_temple_inheritance = {
	custom_tooltip = {
		text = RELIGION_ALLOWS_TEMPLE_INHERITANCE_TT
		hidden_tooltip = {
			OR = {
				religion = waldensian
				religion = yazidi
				religion = aztec
				religion_group = jewish_group
				is_pagan_religion = yes
				religion_group = muslim
			}
		}
	}
}

can_inherit_trigger = {
	NOR = {
		has_disinheritance_trait_trigger = yes
		is_consort = yes # Concubines cannot inherit
		holy_order = yes
		any_liege = { holy_order = yes }
		AND = {
			religion_allows_temple_inheritance = no
			OR = {
				is_theocracy = yes
				AND = { # Nominees
					is_ruler = no
					any_heir_title = { is_theocracy = yes }
				}
			}
		}
	}
}

can_marry_trigger = {
	can_marry = ROOT
	religion = ROOT
	is_within_diplo_range = ROOT
	is_adult = yes
	is_married = no
	is_betrothed = no
	is_consort = no
	fertility = 0.01
	prisoner = no
	is_pregnant = no
	is_ill = no
	NOR = {
		same_sex = ROOT
		is_incapable = yes
		is_inaccessible_trigger = yes
	}
	OR = {
		NOT = { age = 30 }
		is_female = no
	}
	OR = {
		AND = {
			NOT = { age = 25 }
			fertility = 0.30
		}
		NOR = {
			age = 40
			AND = {
				is_older_than = ROOT
				age_diff = { who = ROOT years = 3 }
			}
			ROOT = {
				is_older_than = PREV
				age_diff = { who = PREV years = 10 }
			}
		}
	}
	OR = {
		is_ruler = yes
		NOT = {
			liege = {
				ai = no
				OR = {
					is_close_relative = PREV
					dynasty = PREV
				}
			}
		}
	}
}

can_marry_matrilineally_trigger = {
	OR = {
		AND = {
			is_ruler = yes
			OR = {
				NOT = { has_law = agnatic_succession }
				is_feminist_trigger = yes
			}
		}
		AND = {
			is_ruler = no
			liege = {
				OR = {
					NOT = { has_law = agnatic_succession }
					is_feminist_trigger = yes
				}
			}
		}
	}
}

close_viceroy_trigger = {
	is_liege_or_above = ROOT
	religion = ROOT
	higher_real_tier_than = BARON
	has_imperial_government_trigger = yes
	is_landed = yes
	has_regent = no
	NOR = {
		num_of_duke_titles = 2
		character = event_target:council_first_pick
		character = event_target:council_second_pick
		character = event_target:council_third_pick
	}
	OR = {
		character = event_target:current_viceroy
		character = event_target:former_viceroy
		NOT = { vassal_of = ROOT }
		is_voter = no
		lower_real_tier_than = DUKE
		NOR = {
			event_target:council_first_pick = { is_voter = yes }
			event_target:council_second_pick = { is_voter = yes }
			event_target:council_third_pick = { is_voter = yes }
		}
	}
	OR = {
		character = event_target:current_viceroy
		character = event_target:former_viceroy
		any_realm_province = {
			has_province_flag = contingent_territory
			OR = {
				de_jure_liege_or_above = event_target:viceroy_title
				any_neighbor_province = {
					OR = {
						duchy = { title = event_target:viceroy_title }
						kingdom = { title = event_target:viceroy_title }
					}
				}
			}
		}
	}
}

crime_against_FROM_trigger = {
	OR = {
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_regicide_traitor }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
		reverse_has_opinion_modifier = { who = FROM modifier = slut_seductress }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_parent }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_sibling }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_fatwa_target }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_refused_order }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_unfaithful_wife }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_unfaithful_husband }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_cuckolded }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_heresiarch }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_infidel }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_deviant }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_illegitimate }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_traitor }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_charge_slanderer }
		reverse_has_opinion_modifier = { who = FROM modifier = abuse_of_office }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping_of_kin }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping_of_vassal }
		reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
		reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
		reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
		reverse_has_opinion_modifier = { who = FROM modifier = mad_heretic }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_independent }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_kidnapped_kin }
		reverse_has_opinion_modifier = { who = FROM modifier = opinion_eloped_target }
	}
}

crime_against_ROOT_FROM_trigger = {
	OR = {
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_dishonorable }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_rebel_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_regicide_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_targeted_by_adventurer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = slut_seductress }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_spouse }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_child }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_parent }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_sibling }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_spouse_slayer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_murder_attempt }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_killed_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_fatwa_target }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_refused_order }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_witch }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_takfir }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_wife }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_husband }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_cuckolded }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_heresiarch }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_infidel }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_deviant }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_illegitimate }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_charge_slanderer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = abuse_of_office }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping_of_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping_of_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = devious_plotter }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = killed_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = mad_heretic }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_civil_war_loser }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_independent }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_kidnapped_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_eloped_target }
	}
}

crime_execute_against_ROOT_FROM_trigger = {
	OR = {
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = declared_war }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_rebel_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_regicide_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_targeted_by_adventurer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_spouse }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_child }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_parent }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_sibling }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_spouse_slayer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_murder_attempt }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_killed_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_witch }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_wife }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_husband }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping_of_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping_of_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = devious_plotter }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = killed_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_civil_war_loser }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_independent }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_kidnapped_kin }
	}
}

crime_exile_against_ROOT_FROM_trigger = {
	OR = {
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = declared_war }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_dishonorable }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_rebel_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_regicide_traitor }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = slut_seductress }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_spouse }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_child }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_parent }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_sibling }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_vassal }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_spouse_slayer }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_murder_attempt }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_killed_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_witch }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_takfir }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_wife }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_unfaithful_husband }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_cuckolded }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_kidnapping_of_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = attempted_murder_of_close_kin }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = devious_plotter }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_civil_war_loser }
		reverse_has_opinion_modifier = { who = ROOT_FROM modifier = opinion_independent }
	}
}

enforce_ephesus_religion_trigger = {
	is_heretic = no
	OR = {
		religion = miaphysite
		religion = monophysite
		religion = apostolic
		religion = paulician
	}
}

faction_council_trigger = {
	OR = {
		NOT = { has_dlc = "Zeus" }
		is_voter = no
		is_nomadic = yes
		is_tribal = yes
		liege = {
			OR = {
				is_council_content = no
				NOT = { primary_title = { has_law = war_voting_power_1 } }
			}
		}
	}
}

has_holder_trigger = {
	custom_tooltip = {
		text = TITLE_IS_HELD
		hidden_tooltip = {
			FROM = { has_holder = yes }
		}
	}
}

has_imperial_government_trigger = {
	OR = {
		government = imperial_government
		government = muslim_imperial_government
	}
}

holy_order_not_expelled_trigger = {
	any_demesne_title = {
		OR = {
			AND = {
				title = d_ansar
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_ansar } } }
			}
			title = d_anubis
			AND = {
				title = d_army_light
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_army_light } } }
			}
			AND = {
				title = d_army_lucifer
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_army_lucifer } } }
			}
			title = d_ashokas_chosen
			AND = {
				title = d_braedralag
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_braedralag } } }
			}
			title = d_bulls_rishabha
			AND = {
				title = d_chosen_perkunas
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_chosen_perkunas } } }
			}
			title = d_devotees_of_the_true_prophet
			title = d_disciples_of_the_old_gods
			AND = {
				title = d_fianna
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_fianna } } }
			}
			title = d_followers_arjuna
			title = d_ghazi_shiite
			title = d_ghazi_sunni
			title = d_great_host
			title = d_guardians_of_the_sacred_flame
			AND = {
				title = d_gwydion
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_gwydion } } }
			}
			AND = {
				title = d_harii
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_harii } } }
			}
			AND = {
				title = d_haruriyyah
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_haruriyyah } } }
			}
			AND = {
				title = d_hashshashin
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_hashshashin } } }
			}
			title = d_herculean
			AND = {
				title = d_huitzilopochtli
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_huitzilopochtli } } }
			}
			AND = {
				title = d_holy_sepulchre
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_holy_sepulchre } } }
			}
			title = d_horus
			AND = {
				title = d_immortals
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_immortals } } }
			}
			AND = {
				title = d_jomsvikings
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_jomsvikings } } }
			}
			AND = {
				title = d_knights_calatrava
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_knights_calatrava } } }
			}
			AND = {
				title = d_knights_hospitaler
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_knights_hospitaler } } }
			}
			AND = {
				title = d_knights_saint_mark
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_knights_saint_mark } } }
			}
			AND = {
				title = d_knights_santiago
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_knights_santiago } } }
			}
			AND = {
				title = d_knights_templar
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_knights_templar } } }
			}
			AND = {
				title = d_red_dragons
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_red_dragons } } }
			}
			title = d_sacred_band
			AND = {
				title = d_saint_addai
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_saint_addai } } }
			}
			AND = {
				title = d_saint_anthony
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_saint_anthony } } }
			}
			AND = {
				title = d_saint_blaise
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_saint_blaise } } }
			}
			AND = {
				title = d_sky_lords
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_sky_lords } } }
			}
			AND = {
				title = d_sons_kaleva
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_sons_kaleva } } }
			}
			title = d_sons_of_judea
			AND = {
				title = d_spirit_guardians
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_spirit_guardians } } }
			}
			AND = {
				title = d_teutonic_order
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_teutonic_order } } }
			}
			AND = {
				title = d_warriors_perun
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_warriors_perun } } }
			}
			AND = {
				title = d_zealots
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_zealots } } }
			}
			AND = {
				title = d_zun_warriors
				ROOT = { NOT = { any_liege = { has_character_modifier = expelled_d_zun_warriors } } }
			}
		}
	}
}

in_command_trigger = {
	custom_tooltip = {
		text = IN_COMMAND_TOOLTIP
		hidden_tooltip = {
			in_command = yes
			OR = {
				war = yes
				any_liege = { war = yes }
			}
		}
	}
}

is_abroad_trigger = {
	custom_tooltip = {
		text = IS_ABROAD_TOOLTIP
		hidden_tooltip = {
			OR = {
				in_command_trigger = yes
				has_character_modifier = away_from_court
				trait = on_hajj
				trait = on_pilgrimage
				trait = learning_druidic_arts
				AND = {
					is_adult = no
					educator = {
						NOR = {
							is_liege_of = PREV
							same_liege = PREV
						}
					}
				}
				AND = {
					prisoner = yes
					OR = {
						is_ruler = yes
						host = { NOT = { is_liege_of = PREV } }
					}
				}
			}
		}
	}
}

is_feminist_trigger = {
	OR = {
		culture = basque
		culture = zhangzhung
		culture = sumpa
		religion = cathar
		religion = bogomilist
		religion = messalian
		religion = egyptian_pagan
		religion = buddhist
		religion = mazdaki
		religion = tondrakian
		religion = druze
		religion = promethean_pagan
		religion = berber_pagan
		has_religion_feature = religion_equal
		#TODO: figure out whether we need to make an is_misandrist_trigger or something and put this there? We use this trigger in a lot of places and Matriarchal religions may not be best suited for all of them
		has_religion_feature = religion_matriarchal
		AND = {
			is_ruler = yes
			primary_title = { has_law = female_council_law_4 }
		}
		AND = {
			is_ruler = no
			liege = { primary_title = { has_law = female_council_law_4 } }
		}
	}
}

is_not_titular_trigger = {
	custom_tooltip = {
		text = TITLE_IS_NOT_TITULAR
		hidden_tooltip = {
			FROM = { is_titular = no }
		}
	}
}

#used inside a claim scope to streamline "check for strong claim or usable weak?"
#ROOT is presumed to be the claimholder - possible to use PREVPREV instead?
is_usable_claim_trigger = {
	OR = {
		ROOT = { has_strong_claim = PREV }
		is_contested = yes # is already being contested in some form of Claim or Succession War
		is_pretender = yes # Checks vs ROOT character
		holder_scope = { has_regent = yes }
		AND = {
			higher_tier_than = duke
			holder_scope = { trait = uncrowned }
		}
		AND = {
			succ_law_title = {
				NOR = {
					has_law = enatic_succession
					has_law = enatic_cognatic_succession
					has_law = true_cognatic_succession
				}
			}
			holder_scope = { is_female = yes }
		}
		AND = {
			succ_law_title = {
				OR = {
					has_law = enatic_succession
					has_law = enatic_cognatic_succession
				}
			}
			holder_scope = { is_female = no }
		}
		AND = {
			ROOT = {
				is_female = yes
				culture = basque
			}
			OR = {
				de_jure_liege_or_above = k_navarra
				title = k_navarra
			}
		}
	}
}

has_empire_size_trigger = {
	custom_tooltip = {
		text = HAS_SIZE_EMPIRE
		hidden_tooltip = {
			OR = {
				realm_size = 150
				num_of_count_titles_in_realm = 50
			}
		}
	}
}

has_two_king_titles_trigger = {
	custom_tooltip = {
		text = HAS_TWO_KING_TITLES
		hidden_tooltip = {
			any_demesne_title = {
				tier = KING
				is_titular = no
				count = 2
			}
		}
	}
}

has_three_king_titles_trigger = {
	custom_tooltip = {
		text = HAS_THREE_KING_TITLES
		hidden_tooltip = {
			any_demesne_title = {
				tier = KING
				is_titular = no
				count = 3
			}
		}
	}
}

empire_creation_kingdom_rules_trigger = {
	conditional_tooltip = {
		trigger = {
			has_game_rule = {
				name = empire_creation_kingdom_rule
				value = has_two
			}
		}
		has_two_king_titles_trigger = yes
	}
	conditional_tooltip = {
		trigger = {
			has_game_rule = {
				name = empire_creation_kingdom_rule
				value = has_three
			}
		}
		has_three_king_titles_trigger = yes
	}
}

may_create_duchy_trigger = {
	is_adult = yes
	has_regent = no
	war = no
	conditional_tooltip = {
		trigger = { independent = no }
		custom_tooltip = {
			text = NOT_IMPERIAL_GOVERNMENT
			hidden_tooltip = { has_imperial_government_trigger = no }
		}
	}
	conditional_tooltip = {
		trigger = { FROM = { is_titular = yes } }
		lower_real_tier_than = DUKE
	}
}

may_create_empire_trigger = {
	is_title_active = FROM
	is_adult = yes
	has_regent = no
	war = no
	conditional_tooltip = {
		trigger = { real_tier = EMPEROR }
		is_nomadic = no
		primary_title = { is_titular = no }
		FROM = { is_titular = yes }
	}
	empire_creation_kingdom_rules_trigger = yes
	ruled_years = 5
}

may_create_kingdom_trigger = {
	is_title_active = FROM
	is_adult = yes
	has_regent = no
	war = no
	ruled_years = 5
	conditional_tooltip = {
		trigger = { independent = no }
		custom_tooltip = {
			text = NOT_IMPERIAL_GOVERNMENT
			hidden_tooltip = { has_imperial_government_trigger = no }
		}
	}
	conditional_tooltip = {
		trigger = {
			top_liege = { has_law = kingdom_lockout_0 }
			NOT = { FROM = { culture = roman } }
			NOT = {
				AND = {
					top_liege = { has_landed_title = e_hre }
					FROM = {
						OR = {
							title = k_bohemia
							title = k_arch_austria
							title = k_brandenburg
							title = k_grand_bavaria
							title = k_grand_franconia
							title = k_grand_luxembourg
							title = k_grand_saxony
							title = k_grand_swabia
							title = k_grand_tuscany
							title = k_grand_milan
							title = k_grand_naples
							title = k_grand_sicily
						}
					}
				}
			}
		}
		custom_tooltip = {
			text = NOT_RESTRICTED_BY_LOCKOUT_LAW
			hidden_tooltip = {
				top_liege = { NOT = { has_law = kingdom_lockout_0 } }
			}
		}
	}
	conditional_tooltip = {
		trigger = { FROM = { is_titular = yes } }
		lower_real_tier_than = KING
	}
	conditional_tooltip = {
		trigger = { ai = yes }
		OR = {
			NOT = { has_landed_title = k_france }
			has_character_flag = is_charlemagne
			FROM = { NOT = { title = k_aquitaine } }
		}
		OR = {
			FROM = {
				OR = {
					is_titular = no
					title = k_bohemia
					title = k_arch_austria
					title = k_brandenburg
					title = k_grand_bavaria
					title = k_grand_franconia
					title = k_grand_luxembourg
					title = k_grand_saxony
					title = k_grand_swabia
					title = k_grand_tuscany
					title = k_grand_milan
					title = k_grand_naples
					title = k_grand_sicily
				}
			}
			AND = {
				prestige = 1000
				any_demesne_title = {
					count = 3
					tier = DUKE
				}
			}
		}
	}
}

mend_schism_religion_trigger = {
	is_heretic = no
	OR = {
		AND = {
			OR = {
				religion = catholic
				religion = fraticelli
				religion = cathar
			}
			event_target:mender_religion = {
				OR = {
					religion = orthodox
					religion = monothelite
					religion = iconoclast
					religion = bogomilist
				}
			}
		}
		AND = {
			OR = {
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = bogomilist
			}
			event_target:mender_religion = {
				OR = {
					religion = catholic
					religion = fraticelli
					religion = cathar
				}
			}
		}
	}
}

powerful_vassal_wants_council_trigger = {
	OR = {
		AND = {
			liege = { lower_real_tier_than = KING }
			among_most_powerful_vassals = 3
		}
		AND = {
			liege = { real_tier = KING }
			among_most_powerful_vassals = 4
		}
		AND = {
			liege = { real_tier = EMPEROR }
			among_most_powerful_vassals = 5
		}
	}
}

religion_head_divorce_trigger = {
	OR = {
		religion = chalcedonian
		religion = catholic
		religion = fraticelli
		religion = orthodox
		religion = paulician
		religion = nestorian
		religion = monothelite
		religion = iconoclast
		religion = miaphysite
		religion = monophysite
		religion = zoroastrian
		religion = mazdaki
		religion = zurvanist
		religion = manichean
		religion = mandaean
		religion = jewish
		religion = samaritan
		religion = karaite
		religion = hindu
		religion = buddhist
		religion = jain
	}
}

repudiate_chalcedon_religion_trigger = {
	is_heretic = no
	OR = {
		religion = orthodox
		religion = iconoclast
		religion = monothelite
		religion = bogomilist
		AND = {
			OR = {
				religion = apostolic
				religion = paulician
			}
			event_target:mender_religion = {
				OR = {
					religion = miaphysite
					religion = monophysite
				}
			}
		}
		AND = {
			OR = {
				religion = miaphysite
				religion = monophysite
			}
			event_target:mender_religion = {
				OR = {
					religion = apostolic
					religion = paulician
				}
			}
		}

	}
}

repudiate_ephesus_religion_trigger = {
	is_heretic = no
	OR = {
		religion = orthodox
		religion = iconoclast
		religion = monothelite
		religion = bogomilist
	}
}

same_sea_zone_province_trigger = {
	OR = {
		AND = {
			ROOT = { location = { region = custom_baltic_sea_zone } }
			region = custom_baltic_sea_zone
		}
		AND = {
			ROOT = { location = { region = custom_north_sea_zone } }
			region = custom_north_sea_zone
		}
		AND = {
			ROOT = { location = { region = custom_atlantic_zone } }
			region = custom_atlantic_zone
		}
		AND = {
			ROOT = { location = { region = custom_west_med_zone } }
			region = custom_west_med_zone
		}
		AND = {
			ROOT = { location = { region = custom_east_med_zone } }
			region = custom_east_med_zone
		}
		AND = {
			ROOT = { location = { region = custom_black_sea_zone } }
			region = custom_black_sea_zone
		}
		AND = {
			ROOT = { location = { region = custom_arctic_sea_zone } }
			region = custom_arctic_sea_zone
		}
		AND = {
			ROOT = { location = { region = custom_indian_sea_zone } }
			region = custom_indian_sea_zone
		}
	}
}

tribute_war_blocker_trigger = {
	NOR = {
		pays_tribute_to = FROM
		any_liege = {
			OR = {
				pays_tribute_to = FROM
				FROM = {
					pays_tribute_to = PREV
				}
			}
		}
	}
}

unite_christianity_religion_trigger = {
	is_heretic = no
	OR = {
		religion = catholic
		religion = fraticelli
		religion = cathar
	}
}

uses_imperial_decadence_trigger = {
	tier = EMPEROR
	is_tribal = no
	is_nomadic = no
	is_ironman = no
	NOT = { uses_decadence = yes }
}

valid_viceroy_trigger = {
	is_liege_or_above = ROOT
	religion = ROOT
	higher_real_tier_than = BARON
	has_imperial_government_trigger = yes
	is_landed = yes
	has_regent = no
	NOR = {
		num_of_duke_titles = 2
		character = event_target:council_first_pick
		character = event_target:council_second_pick
		character = event_target:council_third_pick
	}
	OR = {
		character = event_target:current_viceroy
		character = event_target:former_viceroy
		NOT = { vassal_of = ROOT }
		is_voter = no
		lower_real_tier_than = DUKE
		NOR = {
			event_target:council_first_pick = { is_voter = yes }
			event_target:council_second_pick = { is_voter = yes }
			event_target:council_third_pick = { is_voter = yes }
		}
	}
	OR = {
		character = event_target:current_viceroy
		character = event_target:former_viceroy
		any_realm_province = {
			has_province_flag = contingent_territory
			OR = {
				de_jure_liege_or_above = event_target:viceroy_title
				any_neighbor_province = {
					OR = {
						duchy = { title = event_target:viceroy_title }
						kingdom = { title = event_target:viceroy_title }
					}
				}
				event_target:viceroy_title = {
					any_de_jure_vassal_title = {
						tier = COUNT
						location = {
							NOT = { distance = { where = PREVPREVPREV value = 75 } }
						}
					}
				}
			}
		}
	}
}

wants_matrilineal_marriage_trigger = {
	is_female = yes
	OR = {
		AND = {
			is_dumb_trigger = no
			NOR = {
				trait = humble
				trait = content
				is_incapable = yes
			}
			OR = {
				trait = ambitious
				trait = proud
				trait = brave
				stewardship = 10
				is_smart_trigger = yes
				is_ruler = yes
				higher_tier_than = DUKE
			}
		}
		any_heir_title = {
			is_primary_holder_title = yes
			holder_scope = {
				is_close_relative = PREVPREV
				is_dumb_trigger = no
				NOR = {
					trait = humble
					trait = content
					is_incapable = yes
				}
				OR = {
					trait = ambitious
					trait = proud
					higher_tier_than = COUNT
				}
			}
		}
	}
	OR = {
		is_ruler = yes
		any_heir_title = { always = yes }
		any_pretender_title = { always = yes }
	}
}

wrong_religion_head_trigger = {
	OR = {
		AND = {
			title = k_pentarch_rome
			ROOT = { NOT =  { religion = chalcedonian } }
		}
		AND = {
			title = k_papal_state
			ROOT = { NOT =  { religion = catholic } }
		}
		AND = {
			title = d_cathar
			ROOT = { NOT =  { religion = cathar } }
		}
		AND = {
			title = d_fraticelli
			ROOT = { NOT =  { religion = fraticelli } }
		}
		AND = {
			title = k_orthodox
			ROOT = { NOT =  { religion = orthodox } }
		}
		AND = {
			title = d_bogomilist
			ROOT = { NOT =  { religion = bogomilist } }
		}
		AND = {
			title = d_monothelite
			ROOT = { NOT =  { religion = monothelite } }
		}
		AND = {
			title = d_iconoclast
			ROOT = { NOT =  { religion = iconoclast } }
		}
		AND = {
			title = d_miaphysite
			ROOT = { NOT =  { religion = miaphysite } }
		}
		AND = {
			title = d_monophysite
			ROOT = { NOT =  { religion = monophysite } }
		}
		AND = {
			title = d_apostolic
			ROOT = { NOT =  { religion = apostolic } }
		}
		AND = {
			title = d_paulician
			ROOT = { NOT =  { religion = paulician } }
		}
		AND = {
			title = d_nestorian
			ROOT = { NOT =  { religion = nestorian } }
		}
		AND = {
			title = d_messalian
			ROOT = { NOT =  { religion = messalian } }
		}
		AND = {
			title = d_sunni
			ROOT = { NOT =  { religion = sunni } }
		}
		AND = {
			title = d_zikri
			ROOT = { NOT =  { religion = zikri } }
		}
		AND = {
			title = d_quranist
			ROOT = { NOT =  { religion = quranist } }
		}
		AND = {
			title = d_ibadi
			ROOT = { NOT =  { religion = ibadi } }
		}
		AND = {
			title = d_kharijite
			ROOT = { NOT =  { religion = kharijite } }
		}
		AND = {
			title = d_shiite
			ROOT = { NOT =  { religion = shiite } }
		}
		AND = {
			title = d_bektashi_head
			ROOT = { NOT =  { religion = bektashi } }
		}
		AND = {
			title = d_druze
			ROOT = { NOT =  { religion = druze } }
		}
		AND = {
			title = d_hurufi
			ROOT = { NOT =  { religion = hurufi } }
		}
		AND = {
			title = d_qarmatian
			ROOT = { NOT =  { religion = qarmatian } }
		}
		AND = {
			title = d_baltic_pagan_reformed
			ROOT = { NOT =  { religion = baltic_pagan_reformed } }
		}
		AND = {
			title = d_celtic_pagan_reformed
			ROOT = { NOT =  { religion = celtic_pagan_reformed } }
		}
		AND = {
			title = d_finnish_pagan_reformed
			ROOT = { NOT =  { religion = finnish_pagan_reformed } }
		}
		AND = {
			title = d_german_pagan_reformed
			ROOT = { NOT =  { religion = german_pagan_reformed } }
		}
		AND = {
			title = d_norse_pagan_reformed
			ROOT = { NOT =  { religion = norse_pagan_reformed } }
		}
		AND = {
			title = d_slavic_pagan_reformed
			ROOT = { NOT =  { religion = slavic_pagan_reformed } }
		}
		AND = {
			title = d_tengri_pagan_reformed
			ROOT = { NOT =  { religion = tengri_pagan_reformed } }
		}
		AND = {
			title = d_west_african_pagan_reformed
			ROOT = { NOT =  { religion = west_african_pagan_reformed } }
		}
		AND = {
			title = d_zun_pagan_reformed
			ROOT = { NOT =  { religion = zun_pagan_reformed } }
		}
		AND = {
			title = d_egyptian_pagan
			ROOT = { NOT =  { religion = egyptian_pagan } }
		}
		AND = {
			title = d_pontifex_maximus
			ROOT = { NOT =  { religion = roman_pagan } }
		}
		AND = {
			title = d_promethean_pagan
			ROOT = { NOT =  { religion = promethean_pagan } }
		}
		AND = {
			title = d_zoroastrian
			ROOT = { NOT =  { religion = zoroastrian } }
		}
		AND = {
			title = d_mazdaki
			ROOT = { NOT =  { religion = mazdaki } }
		}
		AND = {
			title = d_manichean
			ROOT = { NOT =  { religion = manichean } }
		}
		AND = {
			title = d_yazidi
			ROOT = { NOT =  { religion = yazidi } }
		}
		AND = {
			title = d_jewish
			ROOT = { NOT =  { religion = jewish } }
		}
		AND = {
			title = d_samaritan
			ROOT = { NOT =  { religion = samaritan } }
		}
		AND = {
			title = d_aztec
			ROOT = { NOT =  { religion = aztec } }
		}
	}
}

vanilla_empires_trigger = {
	tier = KING
	is_titular = no
	is_primary_type_title = no
}

german_cultures_trigger = {
	custom_tooltip = {
		text = GERMAN_CULTURES_TRIGGER
		hidden_tooltip = {
			OR = {
				culture = german
				culture = imperial_german
				culture = swabian
				culture = franconian
				culture = swiss
				culture = teutonic
				culture = thuringian
				culture = bavarian
				culture = austrian
				culture = old_saxon
			}
		}
	}
}

potential_late_german_cultures_trigger = {
	custom_tooltip = {
		text = POTENTIAL_LATE_GERMAN_CULTURES_TRIGGER
		hidden_tooltip = {
			OR = {
				culture = old_saxon
				culture = bavarian
			}
		}
	}
}

late_german_cultures_trigger = {
	custom_tooltip = {
		text = LATE_GERMAN_CULTURES_TRIGGER
		hidden_tooltip = {
			OR = {
				culture = teutonic
				culture = austrian
			}
		}
	}
}

german_cultures_no_old_german_trigger = {
	OR = {
		culture = imperial_german
		culture = swabian
		culture = franconian
		culture = swiss
		culture = teutonic
		culture = austrian
	}
}

german_cultures_no_imperial_german_trigger = {
	OR = {
		culture = german
		culture = swabian
		culture = franconian
		culture = swiss
		culture = teutonic
		culture = thuringian
		culture = bavarian
		culture = austrian
		culture = old_saxon
	}
}

compare_cultures_ROOT_trigger = { # Compares the culture of the current scope with ROOT and returns true if they are the same, or part of an exception
	OR = {
		culture = ROOT
		AND = { # German cultures are more accepting of each other
			ROOT = { german_cultures_trigger = yes }
			german_cultures_trigger = yes
		}
		AND = { # Italian cultures are more accepting of each other
			ROOT = { is_italian_trigger = yes }
			is_italian_trigger = yes
		}
	}
}

compare_cultures_FROM_trigger = { # Compares the culture of the current scope with FROM and returns true if they are the same, or part of an exception
	OR = {
		culture = FROM
		AND = { # German cultures are more accepting of each other
			FROM = { german_cultures_trigger = yes }
			german_cultures_trigger = yes
		}
		AND = { # Italian cultures are more accepting of each other
			FROM = { is_italian_trigger = yes }
			is_italian_trigger = yes
		}
	}
}

ai_attack_tributary_trigger = {
	ROOT = {
		ai = yes
	}
	FROM = {
		OR = {
			pays_tribute_to = ROOT
			any_liege = {
				pays_tribute_to = ROOT
			}
		}
	}
}

german_culture_region_trigger = { # Checks if is within "German" area
	OR = {
		region = custom_germany
		region = custom_lotharingia
		region = custom_swiss
	}
}

late_german_culture_region_trigger = {
	OR = {
		region = custom_austrian
		region = custom_prussian
	}
}

elective_gavelkind_culture_trigger = {
	OR = {
		culture_group = north_germanic
		culture_group = celtic
		culture_group = finno_ugric
		culture = english_norse
		culture = saxon
	}
}

seniority_culture_trigger = {
	OR = {
		is_patrician = yes
		culture_group = east_slavic
		culture_group = west_slavic
		culture_group = south_slavic
		culture = hungarian
		culture = ethiopian
	}
}

primogeniture_culture_trigger = {
	OR = {
		culture_group = crusader_group
		culture = english
		culture = scots
		culture = dutch
		culture = flemish
		culture = frankish
		culture = norman
		culture = roman
		AND = {
			culture = occitan
			year = 1050
		}
		culture_group = byzantine
		culture_group = mesoamerican
	}
}

gavelkind_culture_trigger = {
	OR = {
		culture_group = central_germanic
		culture_group = west_african
		culture_group = central_african
		culture_group = mesoamerican
		culture = nubian
		culture = daju
		culture = somali
		culture = old_frankish
	}
}

regnal_name_culture_trigger = {
	OR = {
		culture = norse
		culture = swedish
		culture = norwegian
		culture = danish
		culture = icelandic
		culture = english_norse
		german_cultures_trigger = yes
		culture = polish
		culture = scottish
		culture = scots
		culture = english
		culture = saxon
		culture = bohemian
		culture = hungarian
		culture = croatian
		culture = serbian
		culture = bulgarian
		culture = romanian
		culture = frankish
		culture = norman
		culture = basque
		culture = castillan
		culture = catalan
		culture = old_frankish
		culture = greek
		culture = pontic_greek
		culture = russian
		is_italian_trigger = yes
		culture = portuguese
		culture = armenian
		culture = georgian
		culture = lithuanian
		culture = welsh
		culture = cornish
		culture = breton
		culture = persian
	}
}

regnal_female_name_culture_trigger = {
	OR = {
		culture = basque
		culture = portuguese
		culture = georgian
		culture = danish
		culture = greek
		culture = pontic_greek
		culture = norman
		culture = castillan
		culture = norwegian
	}
}

is_greek_trigger = {
	OR = {
		culture = greek
		culture = pontic_greek
		culture = sicilian_greek
	}
}

regnal_dynastic_name_trigger = {
	any_dynasty_member_even_if_dead = {
		NOT = { character = ROOT }
		same_sex = ROOT
		is_alive = no
		OR = {
			culture = ROOT
			AND = {
				is_italian_trigger = yes
				ROOT = { is_italian_trigger = yes }
			}
			AND = {
				german_cultures_trigger = yes
				ROOT = { german_cultures_trigger = yes }
			}
			AND = {
				is_greek_trigger = yes
				ROOT = { is_greek_trigger = yes }
			}
		}
		OR = {
			tier = ROOT
			higher_tier_than = ROOT
		}
	}
}

regnal_name_trigger = {
	OR = {
		AND = {
			is_female = no
			regnal_name_culture_trigger = yes
		}
		AND = {
			is_female = yes
			regnal_female_name_culture_trigger = yes
		}
		regnal_dynastic_name_trigger = yes
	}
}

is_secret_congenital_trait_trigger = {
	OR = {
		trait = genius
		trait = quick
		trait = slow
		trait = imbecile
		trait = fair
		trait = ugly
		trait = tall
		trait = dwarf
		trait = strong
		trait = weak
	}
}

is_italian_trigger = {
	custom_tooltip = {
		text = IS_ITALIAN_TRIGGER
		hidden_tooltip = {
			OR = {
				culture = corsican
				culture = dalmatian
				culture = emilian
				culture = italian
				culture = ligurian
				culture = lombard
				culture = neapolitan
				culture = sardinian
				culture = tuscan
				culture = umbrian
				culture = veneto
			}
		}
	}
}

is_italian_cultural_unitor_trigger = {
	OR = {
        culture = emilian
        culture = ligurian
        culture = lombard
        culture = neapolitan
        culture = tuscan
        culture = umbrian
        culture = veneto
    }
}

is_italian_unification_enforcement_trigger = {
	OR = {
		culture = corsican
		culture = dalmatian
        culture = emilian
        culture = ligurian
        culture = lombard
        culture = neapolitan
        culture = sardinian
		culture = sicilian
        culture = tuscan
        culture = umbrian
        culture = veneto
    }
}

is_dalmatian_meltingpot_culture_italian = {
	OR = {
        culture = emilian
        culture = italian
        culture = ligurian
        culture = lombard
        culture = tuscan
        culture = neapolitan
        culture = umbrian
        culture = veneto
    }
}

is_dalmatian_meltingpot_culture_yugoslav = {
	OR = {
        culture = yugoslavian
        culture = croatian
		culture = slovene
        culture = serbian
    }
}

is_greekpersian_meltingpot_greek = {
	OR = {
		culture = greek
		culture = pontic_greek
	}
}

is_greekpersian_meltingpot_persian = {
	OR = {
		culture = persian
		culture = sogdian
		culture = baloch
		culture = afghan
	}
}

is_israelite_meltingpot_israeli = {
	OR = {
		AND = {
			culture_group = israelite
			NOT = { culture = israeli }
		}
		AND = {
			religion_group = jewish_group
			NOT = { culture_group = israelite }
		}
	}
}

is_pc_marriage_religion_trigger = { # Parent-Child Marriage Religions
	OR = {							# Can be used to check if PC relations are allowed
		true_religion_messalian_trigger = yes
		true_religion_egyptian_pagan_trigger = yes
		true_religion_zoroastrian_trigger = yes
	}
}

is_bs_marriage_religion_trigger = { # Brother-Sister Marriage Religions
	OR = {							# Can be used to check if BS relations are allowed
		true_religion_messalian_trigger = yes
		true_religion_egyptian_pagan_trigger = yes
		true_religion_group_hellenic_pagan_trigger = yes
		true_religion_promethean_pagan_trigger = yes
		true_religion_zoroastrian_trigger = yes
	}
}

has_former_religion_flag_trigger = {
	OR = {
		has_character_flag = character_was_catholic
		has_character_flag = character_was_cathar
		has_character_flag = character_was_fraticelli
		has_character_flag = character_was_waldensian
		has_character_flag = character_was_lollard
		has_character_flag = character_was_adoptionist
		has_character_flag = character_was_chalcedonian
		has_character_flag = character_was_orthodox
		has_character_flag = character_was_bogomilist
		has_character_flag = character_was_monothelite
		has_character_flag = character_was_iconoclast
		has_character_flag = character_was_nestorian
		has_character_flag = character_was_messalian
		has_character_flag = character_was_miaphysite
		has_character_flag = character_was_monophysite
		has_character_flag = character_was_apostolic
		has_character_flag = character_was_paulician
		has_character_flag = character_was_tondrakian
		has_character_flag = character_was_sunni
		has_character_flag = character_was_zikri
		has_character_flag = character_was_quranist
		has_character_flag = character_was_ibadi
		has_character_flag = character_was_kharijite
		has_character_flag = character_was_shiite
		has_character_flag = character_was_bektashi
		has_character_flag = character_was_druze
		has_character_flag = character_was_hurufi
		has_character_flag = character_was_qarmatian
		has_character_flag = character_was_jewish
		has_character_flag = character_was_samaritan
		has_character_flag = character_was_karaite
		has_character_flag = character_was_zoroastrian
		has_character_flag = character_was_mazdaki
		has_character_flag = character_was_zurvanist
		has_character_flag = character_was_manichean
		has_character_flag = character_was_khurmazta
		has_character_flag = character_was_bon
		has_character_flag = character_was_taoist
		has_character_flag = character_was_tibetan_pagan
		has_character_flag = character_was_mandaean
		has_character_flag = character_was_yazidi
		has_character_flag = character_was_hindu
		has_character_flag = character_was_buddhist
		has_character_flag = character_was_jain
		has_character_flag = character_was_norse_pagan_reformed
		has_character_flag = character_was_german_pagan_reformed
		has_character_flag = character_was_celtic_pagan_reformed
		has_character_flag = character_was_slavic_pagan_reformed
		has_character_flag = character_was_tengri_pagan_reformed
		has_character_flag = character_was_baltic_pagan_reformed
		has_character_flag = character_was_finnish_pagan_reformed
		has_character_flag = character_was_west_african_pagan_reformed
		has_character_flag = character_was_zun_pagan_reformed
		has_character_flag = character_was_hellenic_pagan
		has_character_flag = character_was_roman_pagan
		has_character_flag = character_was_egyptian_pagan
		has_character_flag = character_was_norse_pagan
		has_character_flag = character_was_german_pagan
		has_character_flag = character_was_celtic_pagan
		has_character_flag = character_was_slavic_pagan
		has_character_flag = character_was_tengri_pagan
		has_character_flag = character_was_baltic_pagan
		has_character_flag = character_was_finnish_pagan
		has_character_flag = character_was_west_african_pagan
		has_character_flag = character_was_zun_pagan
		has_character_flag = character_was_arab_pagan
		has_character_flag = character_was_berber_pagan
		has_character_flag = character_was_jewish_pagan
		has_character_flag = character_was_aten_pagan
		has_character_flag = character_was_promethean_pagan
		has_character_flag = character_was_aztec
	}
}

is_historic_title_trigger = {
	OR = {
		title = e_hre
		title = e_byzantium
		title = e_karling
		title = e_arabia
		title = k_scotland
		title = k_asturias
		title = k_andalusia
		title = k_france
		title = k_lotharingia
		title = k_africa
		title = k_egypt
		title = k_bulgaria
		title = k_carpathia
		title = k_saxony
		title = k_abyssinia
		title = k_lombardy
		title = k_armenia
		title = k_sindh
		title = k_malwa
		title = k_maharastra
		title = k_lanka
		title = k_kosala
		title = k_bengal
		title = k_kamarupa
		title = k_ghana
		title = k_takrur
		title = k_morocco
		title = k_nubia
		title = k_ireland
		title = k_navarra
		title = k_aquitaine
		title = k_burgundy
		title = k_germany
		title = k_georgia
		title = k_baluchistan
		title = k_denmark
		title = k_norway
		title = k_england
		title = k_sweden
		title = k_rus
		title = k_croatia
		title = k_hungary
		title = k_mesopotamia
		title = k_afghanistan
		title = k_persia
		title = k_tamilakam
		title = k_gondwana
		title = k_aragon
		title = k_leon
		title = k_castille
		title = k_poland
		title = k_gujarat
		title = k_gondar
		title = k_rum
		title = k_jerusalem
		title = k_portugal
		title = k_novgorod
		title = k_sicily
		title = k_serbia
		title = k_trebizond
		title = k_delhi
		title = k_bohemia
		title = k_lithuania
		title = k_epirus
		title = k_muscovy
		title = k_ottoman
		title = k_candar
		title = k_eretnid
		title = k_naples
		title = k_trinacria
	}
}

major_vassal_is_foreign_trigger = {
	OR = {
		any_vassal = {
			relative_power_to_liege = 0.25
			NOR = {
				liege = { culture = PREV }
				de_jure_liege_or_above = PREV
			}
		}
		any_vassal = {
			relative_power_to_liege = 0.1
			NOR = {
				liege = { culture = PREV }
				de_jure_liege_or_above = PREV
			}
			count = 2
		}
	}
}

has_tier_3_education_trigger = {
	OR = {
		trait = charismatic_negotiator
		trait = skilled_tactician
		trait = fortune_builder
		trait = intricate_webweaver
		trait = scholarly_theologian
	}
}
has_tier_2_education_trigger = {
	OR = {
		trait = underhanded_rogue
		trait = tough_soldier
		trait = thrifty_clerk
		trait = flamboyant_schemer
		trait = martial_cleric
	}
}
has_tier_1_education_trigger = {
	OR = {
		trait = naive_appeaser
		trait = misguided_warrior
		trait = indulgent_wastrel
		trait = amateurish_plotter
		trait = detached_priest
	}
}

is_evil_tyrant_trigger = {
	OR = {
		trait = tyrant5
		trait = tyrant4
	}
}

is_lesser_tyrant_trigger = {
	OR = {
		trait = tyrant1
		trait = tyrant2
		trait = tyrant3
	}
}

is_tyrant_trigger = {
	OR = {
		is_lesser_tyrant_trigger = yes
		is_evil_tyrant_trigger = yes
	}
}

is_not_busy_trigger = {
	custom_tooltip = {
		text = is_not_busy_trigger_tooltip
		hidden_tooltip = {
			NOR = {
				has_character_modifier = do_not_disturb
				has_character_flag = do_not_disturb
			}
		}
	}
}

cb_can_use_preamble = { # Should be at the start of most CBs
	ROOT = { ai_not_busy_trigger = yes }
	ROOT = { NOT = { has_character_modifier = holy_truce_timer } }
	FROM = { NOT = { has_character_modifier = holy_truce_timer } }
}

is_reformed_pagan_religion = {
	custom_tooltip = {
		text = TT_NOT_UNREFORMED_PAGAN
		hidden_tooltip = {
			OR = {
				AND = {
					religion_group = pagan_group
					is_reformed_religion = yes
				}
				religion_group = hellenic_pagan_group
				religion_group = egyptian_pagan_group
			}
		}
	}
}

is_pagan_religion = {
	custom_tooltip = { text = IS_PAGAN_TT }
	hidden_tooltip = {
		OR = {
			religion_group = pagan_group
			religion_group = hellenic_pagan_group
			religion_group = egyptian_pagan_group
		}
	}
}

true_religion_is_pagan = {
	OR = {
		true_religion_group = pagan_group
		true_religion_group = hellenic_pagan_group
		true_religion_group = egyptian_pagan_group
	}
}

has_any_secret_community = {
	OR = {
		has_province_modifier = secret_catholic_community
		has_province_modifier = secret_cathar_community
		has_province_modifier = secret_fraticelli_community
		has_province_modifier = secret_waldensian_community
		has_province_modifier = secret_lollard_community
		has_province_modifier = secret_orthodox_community
		has_province_modifier = secret_monophysite_community
		has_province_modifier = secret_bogomilist_community
		has_province_modifier = secret_monothelite_community
		has_province_modifier = secret_iconoclast_community
		has_province_modifier = secret_paulician_community
		has_province_modifier = secret_nestorian_community
		has_province_modifier = secret_messalian_community
		has_province_modifier = secret_sunni_community
		has_province_modifier = secret_zikri_community
		has_province_modifier = secret_yazidi_community
		has_province_modifier = secret_ibadi_community
		has_province_modifier = secret_kharijite_community
		has_province_modifier = secret_shiite_community
		has_province_modifier = secret_druze_community
		has_province_modifier = secret_hurufi_community
		has_province_modifier = secret_norse_pagan_community
		has_province_modifier = secret_tengri_pagan_community
		has_province_modifier = secret_baltic_pagan_community
		has_province_modifier = secret_finnish_pagan_community
		has_province_modifier = secret_aztec_community
		has_province_modifier = secret_slavic_pagan_community
		has_province_modifier = secret_west_african_pagan_community
		has_province_modifier = secret_zun_pagan_community
		has_province_modifier = secret_jewish_community
		has_province_modifier = secret_samaritan_community
		has_province_modifier = secret_karaite_community
		has_province_modifier = secret_zoroastrian_community
		has_province_modifier = secret_zurvanist_community
		has_province_modifier = secret_mazdaki_community
		has_province_modifier = secret_hindu_community
		has_province_modifier = secret_buddhist_community
		has_province_modifier = secret_jain_community
		has_province_modifier = secret_khurmazta_community
		has_province_modifier = secret_taoist_community
		has_province_modifier = secret_bon_community
		has_province_modifier = secret_tibetan_pagan_community
		has_province_modifier = secret_norse_pagan_reformed_community
		has_province_modifier = secret_baltic_pagan_reformed_community
		has_province_modifier = secret_finnish_pagan_reformed_community
		has_province_modifier = secret_slavic_pagan_reformed_community
		has_province_modifier = secret_tengri_pagan_reformed_community
		has_province_modifier = secret_west_african_pagan_reformed_community
		has_province_modifier = secret_zun_pagan_reformed_community
		has_province_modifier = secret_german_pagan_reformed_community
		has_province_modifier = secret_celtic_pagan_reformed_community
		has_province_modifier = secret_chalcedonian_community
		has_province_modifier = secret_miaphysite_community
		has_province_modifier = secret_apostolic_community
		has_province_modifier = secret_manichean_community
		has_province_modifier = secret_tondrakian_community
		has_province_modifier = secret_adoptionist_community
		has_province_modifier = secret_quranist_community
		has_province_modifier = secret_bektashi_community
		has_province_modifier = secret_qarmatian_community
		has_province_modifier = secret_mandaean_community
		has_province_modifier = secret_roman_pagan_community
		has_province_modifier = secret_hellenic_pagan_community
		has_province_modifier = secret_egyptian_pagan_community
		has_province_modifier = secret_arab_pagan_community
		has_province_modifier = secret_berber_pagan_community
		has_province_modifier = secret_jewish_pagan_community
		has_province_modifier = secret_aten_pagan_community
		has_province_modifier = secret_promethean_pagan_community
		has_province_modifier = secret_german_pagan_community
		has_province_modifier = secret_celtic_pagan_community
	}
}

has_owners_secret_community = {
	OR = {
		AND = { has_province_modifier = secret_catholic_community owner = { true_religion = catholic } }
		AND = { has_province_modifier = secret_cathar_community owner = { true_religion = cathar } }
		AND = { has_province_modifier = secret_fraticelli_community owner = { true_religion = fraticelli } }
		AND = { has_province_modifier = secret_waldensian_community owner = { true_religion = waldensian } }
		AND = { has_province_modifier = secret_lollard_community owner = { true_religion = lollard } }
		AND = { has_province_modifier = secret_orthodox_community owner = { true_religion = orthodox } }
		AND = { has_province_modifier = secret_monophysite_community owner = { true_religion = monophysite } }
		AND = { has_province_modifier = secret_bogomilist_community owner = { true_religion = bogomilist } }
		AND = { has_province_modifier = secret_monothelite_community owner = { true_religion = monothelite } }
		AND = { has_province_modifier = secret_iconoclast_community owner = { true_religion = iconoclast } }
		AND = { has_province_modifier = secret_paulician_community owner = { true_religion = paulician } }
		AND = { has_province_modifier = secret_nestorian_community owner = { true_religion = nestorian } }
		AND = { has_province_modifier = secret_messalian_community owner = { true_religion = messalian } }
		AND = { has_province_modifier = secret_sunni_community owner = { true_religion = sunni } }
		AND = { has_province_modifier = secret_zikri_community owner = { true_religion = zikri } }
		AND = { has_province_modifier = secret_yazidi_community owner = { true_religion = yazidi } }
		AND = { has_province_modifier = secret_ibadi_community owner = { true_religion = ibadi } }
		AND = { has_province_modifier = secret_kharijite_community owner = { true_religion = kharijite} }
		AND = { has_province_modifier = secret_shiite_community owner = { true_religion = shiite } }
		AND = { has_province_modifier = secret_druze_community owner = { true_religion = druze } }
		AND = { has_province_modifier = secret_hurufi_community owner = { true_religion = hurufi } }
		AND = { has_province_modifier = secret_norse_pagan_community owner = { true_religion = norse_pagan } }
		AND = { has_province_modifier = secret_tengri_pagan_community owner = { true_religion = tengri_pagan } }
		AND = { has_province_modifier = secret_baltic_pagan_community owner = { true_religion = baltic_pagan } }
		AND = { has_province_modifier = secret_finnish_pagan_community owner = { true_religion = finnish_pagan } }
		AND = { has_province_modifier = secret_aztec_community owner = { true_religion = aztec } }
		AND = { has_province_modifier = secret_slavic_pagan_community owner = { true_religion = slavic_pagan } }
		AND = { has_province_modifier = secret_west_african_pagan_community owner = { true_religion = west_african_pagan } }
		AND = { has_province_modifier = secret_zun_pagan_community owner = { true_religion = zun_pagan } }
		AND = { has_province_modifier = secret_jewish_community owner = { true_religion = jewish } }
		AND = { has_province_modifier = secret_samaritan_community owner = { true_religion = samaritan } }
		AND = { has_province_modifier = secret_karaite_community owner = { true_religion = karaite } }
		AND = { has_province_modifier = secret_zoroastrian_community owner = { true_religion = zoroastrian} }
		AND = { has_province_modifier = secret_zurvanist_community owner = { true_religion = zurvanist } }
		AND = { has_province_modifier = secret_mazdaki_community owner = { true_religion = mazdaki } }
		AND = { has_province_modifier = secret_hindu_community owner = { true_religion = hindu } }
		AND = { has_province_modifier = secret_buddhist_community owner = { true_religion = buddhist } }
		AND = { has_province_modifier = secret_jain_community owner = { true_religion = jain } }
		AND = { has_province_modifier = secret_khurmazta_community owner = { true_religion = khurmazta } }
		AND = { has_province_modifier = secret_taoist_community owner = { true_religion = taoist } }
		AND = { has_province_modifier = secret_bon_community owner = { true_religion = bon } }
		AND = { has_province_modifier = secret_tibetan_pagan_community owner = { true_religion = tibetan_pagan } }
		AND = { has_province_modifier = secret_norse_pagan_reformed_community owner = { true_religion = norse_pagan_reformed } }
		AND = { has_province_modifier = secret_baltic_pagan_reformed_community owner = { true_religion = baltic_pagan_reformed } }
		AND = { has_province_modifier = secret_finnish_pagan_reformed_community owner = { true_religion = finnish_pagan_reformed } }
		AND = { has_province_modifier = secret_slavic_pagan_reformed_community owner = { true_religion = slavic_pagan_reformed } }
		AND = { has_province_modifier = secret_tengri_pagan_reformed_community owner = { true_religion = tengri_pagan_reformed } }
		AND = { has_province_modifier = secret_west_african_pagan_reformed_community owner = { true_religion = west_african_pagan_reformed } }
		AND = { has_province_modifier = secret_zun_pagan_reformed_community owner = { true_religion = zun_pagan_reformed } }
		AND = { has_province_modifier = secret_german_pagan_reformed_community owner = { true_religion = german_pagan_reformed } }
		AND = { has_province_modifier = secret_celtic_pagan_reformed_community owner = { true_religion = celtic_pagan_reformed } }
		AND = { has_province_modifier = secret_chalcedonian_community owner = { true_religion = chalcedonian } }
		AND = { has_province_modifier = secret_miaphysite_community owner = { true_religion = miaphysite } }
		AND = { has_province_modifier = secret_apostolic_community owner = { true_religion = apostolic } }
		AND = { has_province_modifier = secret_manichean_community owner = { true_religion = manichean } }
		AND = { has_province_modifier = secret_tondrakian_community owner = { true_religion = tondrakian } }
		AND = { has_province_modifier = secret_adoptionist_community owner = { true_religion = adoptionist } }
		AND = { has_province_modifier = secret_quranist_community owner = { true_religion = quranist } }
		AND = { has_province_modifier = secret_bektashi_community owner = { true_religion = bektashi } }
		AND = { has_province_modifier = secret_qarmatian_community owner = { true_religion = qarmatian } }
		AND = { has_province_modifier = secret_mandaean_community owner = { true_religion = mandaean } }
		AND = { has_province_modifier = secret_roman_pagan_community owner = { true_religion = roman_pagan } }
		AND = { has_province_modifier = secret_hellenic_pagan_community owner = { true_religion = hellenic_pagan } }
		AND = { has_province_modifier = secret_egyptian_pagan_community owner = { true_religion = egyptian_pagan } }
		AND = { has_province_modifier = secret_arab_pagan_community owner = { true_religion = arab_pagan } }
		AND = { has_province_modifier = secret_berber_pagan_community owner = { true_religion = berber_pagan } }
		AND = { has_province_modifier = secret_jewish_pagan_community owner = { true_religion = jewish_pagan } }
		AND = { has_province_modifier = secret_aten_pagan_community owner = { true_religion = aten_pagan } }
		AND = { has_province_modifier = secret_promethean_pagan_community owner = { true_religion = promethean_pagan } }
		AND = { has_province_modifier = secret_german_pagan_community owner = { true_religion = german_pagan } }
		AND = { has_province_modifier = secret_celtic_pagan_community owner = { true_religion = celtic_pagan } }
	}
}

has_roots_secret_community = {
	OR = {
		AND = { has_province_modifier = secret_catholic_community ROOT = { true_religion = catholic } }
		AND = { has_province_modifier = secret_cathar_community ROOT = { true_religion = cathar } }
		AND = { has_province_modifier = secret_fraticelli_community ROOT = { true_religion = fraticelli } }
		AND = { has_province_modifier = secret_waldensian_community ROOT = { true_religion = waldensian } }
		AND = { has_province_modifier = secret_lollard_community ROOT = { true_religion = lollard } }
		AND = { has_province_modifier = secret_orthodox_community ROOT = { true_religion = orthodox } }
		AND = { has_province_modifier = secret_monophysite_community ROOT = { true_religion = monophysite } }
		AND = { has_province_modifier = secret_bogomilist_community ROOT = { true_religion = bogomilist } }
		AND = { has_province_modifier = secret_monothelite_community ROOT = { true_religion = monothelite } }
		AND = { has_province_modifier = secret_iconoclast_community ROOT = { true_religion = iconoclast } }
		AND = { has_province_modifier = secret_paulician_community ROOT = { true_religion = paulician } }
		AND = { has_province_modifier = secret_nestorian_community ROOT = { true_religion = nestorian } }
		AND = { has_province_modifier = secret_messalian_community ROOT = { true_religion = messalian } }
		AND = { has_province_modifier = secret_sunni_community ROOT = { true_religion = sunni } }
		AND = { has_province_modifier = secret_zikri_community ROOT = { true_religion = zikri } }
		AND = { has_province_modifier = secret_yazidi_community ROOT = { true_religion = yazidi } }
		AND = { has_province_modifier = secret_ibadi_community ROOT = { true_religion = ibadi } }
		AND = { has_province_modifier = secret_kharijite_community ROOT = { true_religion = kharijite} }
		AND = { has_province_modifier = secret_shiite_community ROOT = { true_religion = shiite } }
		AND = { has_province_modifier = secret_druze_community ROOT = { true_religion = druze } }
		AND = { has_province_modifier = secret_hurufi_community ROOT = { true_religion = hurufi } }
		AND = { has_province_modifier = secret_norse_pagan_community ROOT = { true_religion = norse_pagan } }
		AND = { has_province_modifier = secret_tengri_pagan_community ROOT = { true_religion = tengri_pagan } }
		AND = { has_province_modifier = secret_baltic_pagan_community ROOT = { true_religion = baltic_pagan } }
		AND = { has_province_modifier = secret_finnish_pagan_community ROOT = { true_religion = finnish_pagan } }
		AND = { has_province_modifier = secret_aztec_community ROOT = { true_religion = aztec } }
		AND = { has_province_modifier = secret_slavic_pagan_community ROOT = { true_religion = slavic_pagan } }
		AND = { has_province_modifier = secret_west_african_pagan_community ROOT = { true_religion = west_african_pagan } }
		AND = { has_province_modifier = secret_zun_pagan_community ROOT = { true_religion = zun_pagan } }
		AND = { has_province_modifier = secret_jewish_community ROOT = { true_religion = jewish } }
		AND = { has_province_modifier = secret_samaritan_community ROOT = { true_religion = samaritan } }
		AND = { has_province_modifier = secret_karaite_community ROOT = { true_religion = karaite } }
		AND = { has_province_modifier = secret_zoroastrian_community ROOT = { true_religion = zoroastrian} }
		AND = { has_province_modifier = secret_zurvanist_community ROOT = { true_religion = zurvanist } }
		AND = { has_province_modifier = secret_mazdaki_community ROOT = { true_religion = mazdaki } }
		AND = { has_province_modifier = secret_hindu_community ROOT = { true_religion = hindu } }
		AND = { has_province_modifier = secret_buddhist_community ROOT = { true_religion = buddhist } }
		AND = { has_province_modifier = secret_jain_community ROOT = { true_religion = jain } }
		AND = { has_province_modifier = secret_khurmazta_community ROOT = { true_religion = khurmazta } }
		AND = { has_province_modifier = secret_taoist_community ROOT = { true_religion = taoist } }
		AND = { has_province_modifier = secret_bon_community ROOT = { true_religion = bon } }
		AND = { has_province_modifier = secret_tibetan_pagan_community ROOT = { true_religion = tibetan_pagan } }
		AND = { has_province_modifier = secret_norse_pagan_reformed_community ROOT = { true_religion = norse_pagan_reformed } }
		AND = { has_province_modifier = secret_baltic_pagan_reformed_community ROOT = { true_religion = baltic_pagan_reformed } }
		AND = { has_province_modifier = secret_finnish_pagan_reformed_community ROOT = { true_religion = finnish_pagan_reformed } }
		AND = { has_province_modifier = secret_slavic_pagan_reformed_community ROOT = { true_religion = slavic_pagan_reformed } }
		AND = { has_province_modifier = secret_tengri_pagan_reformed_community ROOT = { true_religion = tengri_pagan_reformed } }
		AND = { has_province_modifier = secret_west_african_pagan_reformed_community ROOT = { true_religion = west_african_pagan_reformed } }
		AND = { has_province_modifier = secret_zun_pagan_reformed_community ROOT = { true_religion = zun_pagan_reformed } }
		AND = { has_province_modifier = secret_german_pagan_reformed_community ROOT = { true_religion = german_pagan_reformed } }
		AND = { has_province_modifier = secret_celtic_pagan_reformed_community ROOT = { true_religion = celtic_pagan_reformed } }
		AND = { has_province_modifier = secret_chalcedonian_community ROOT = { true_religion = chalcedonian } }
		AND = { has_province_modifier = secret_miaphysite_community ROOT = { true_religion = miaphysite } }
		AND = { has_province_modifier = secret_apostolic_community ROOT = { true_religion = apostolic } }
		AND = { has_province_modifier = secret_manichean_community ROOT = { true_religion = manichean } }
		AND = { has_province_modifier = secret_tondrakian_community ROOT = { true_religion = tondrakian } }
		AND = { has_province_modifier = secret_adoptionist_community ROOT = { true_religion = adoptionist } }
		AND = { has_province_modifier = secret_quranist_community ROOT = { true_religion = quranist } }
		AND = { has_province_modifier = secret_bektashi_community ROOT = { true_religion = bektashi } }
		AND = { has_province_modifier = secret_qarmatian_community ROOT = { true_religion = qarmatian } }
		AND = { has_province_modifier = secret_mandaean_community ROOT = { true_religion = mandaean } }
		AND = { has_province_modifier = secret_roman_pagan_community ROOT = { true_religion = roman_pagan } }
		AND = { has_province_modifier = secret_hellenic_pagan_community ROOT = { true_religion = hellenic_pagan } }
		AND = { has_province_modifier = secret_egyptian_pagan_community ROOT = { true_religion = egyptian_pagan } }
		AND = { has_province_modifier = secret_arab_pagan_community ROOT = { true_religion = arab_pagan } }
		AND = { has_province_modifier = secret_berber_pagan_community ROOT = { true_religion = berber_pagan } }
		AND = { has_province_modifier = secret_jewish_pagan_community ROOT = { true_religion = jewish_pagan } }
		AND = { has_province_modifier = secret_aten_pagan_community ROOT = { true_religion = aten_pagan } }
		AND = { has_province_modifier = secret_promethean_pagan_community ROOT = { true_religion = promethean_pagan } }
		AND = { has_province_modifier = secret_german_pagan_community ROOT = { true_religion = german_pagan } }
		AND = { has_province_modifier = secret_celtic_pagan_community ROOT = { true_religion = celtic_pagan } }
	}
}

secret_is_pagan_religion = {
	OR = {
		secret_religion_group = pagan_group
		secret_religion_group = hellenic_pagan_group
		secret_religion_group = egyptian_pagan_group
	}
}

true_is_pagan_religion = {
	OR = {
		true_religion_group = pagan_group
		true_religion_group = hellenic_pagan_group
		true_religion_group = egyptian_pagan_group
	}
}

can_use_holy_war_cb = {
	AND = {
		top_liege = {
			OR = {
				religion_group = PREV
				PREV = {
					AND = { # Tibetan cultures can holy war each other within a realm if they are buddhist and bon
						culture_group = tibetan_group
						OR = {
							religion = buddhist
							religion = bon
						}
						NOT = { religion = FROM }
					}
				}
			}
		}
		OR = {
			NOT = { religion_group = pagan_group }
			is_reformed_religion = yes
			any_realm_title = {
				count = 3
				is_holy_site = ROOT
			}
		}
		OR = {
			is_patrician = no
			independent = yes
		}
		OR = {
			NOR = {
				religion = hindu
				religion = buddhist
			}
			FROM = {
				OR = {
					NOT = { religion_group = indian_group }
					religion = taoist
					religion = bon
				}
			}
		}
		OR = {
			NOT = { religion = cathar }
			has_global_flag = cathar_war
		}
		OR = {
			NOT = { religion_group = FROM }
			is_heresy_of = FROM
			is_parent_religion = FROM
			AND = { # Religions that can holy_war within their own group
				OR = {
					religion_group = muslim
					religion_group = pagan_group
					religion = paulician
					AND = {
						culture_group = tibetan_group
						OR = {
							religion = buddhist
							religion = bon
						}
					}
				}
				NOT = { religion = FROM }
			}
		}
		OR = {
			pacifist = no
			NOR = {
				same_realm = FROM
				AND = { # Tibetan cultures can holy war each other within a realm if they are buddhist and bon
					culture_group = tibetan_group
					OR = {
						religion = buddhist
						religion = bon
					}
					NOT = { religion = FROM }
				}
			}
		}
	}
}

is_court_educator_trigger = {
	OR = {
		AND = {
			has_dlc = "Zeus"
			has_minor_title = title_teacher
		}
		AND = {
			NOT = { has_dlc = "Zeus" }
			has_minor_title = title_court_educator
		}
	}
}

cb_no_nap_with_suzerain_trigger = {
	FROM = {
		OR = {
			is_tributary = no
			pays_tribute_to = ROOT
			suzerain = {
				NOT = { has_non_aggression_pact_with = ROOT }
				NOT = { is_allied_with = ROOT }
			}
		}
	}
}

cb_other_no_nap_with_suzerain_trigger = {
	FROM = {
		OR = {
			is_tributary = no
			pays_tribute_to = FROMFROM
			suzerain = {
				NOT = { has_non_aggression_pact_with = FROMFROM }
				NOT = { is_allied_with = FROMFROM }
			}
		}
	}
}

is_kinslayer_trigger = {
	OR = {
		trait = kinslayer
		trait = familial_kinslayer
		trait = dynastic_kinslayer
	}
}
is_offmap_trigger = {
	is_offmap_governor = yes
	is_offmap_ruler = yes
}
is_sea_trade_route_trigger = { # These are allowed to build Custom Houses
	OR = {
		trade_route = mediterranean_trade
		trade_route = atlantic_trade
		trade_route = baltic_sea
	}
}
is_land_trade_route_trigger = { # These are allowed to build Toll Booths and Roads
	OR = {
		trade_route = amber_road
		trade_route = salt_road
		trade_route = french_trade
		trade_route = iberian_trade
		trade_route = british_trade
		trade_route = grand_trunk_road
		trade_route = timbuktu_trade
		trade_route = rus_road
	}
}

is_caspian_port = {
	OR = { # Caspian sea provinces, counter-clockwise starting from Gilan in the South
		province_id = 666 # Gilan
		province_id = 662 # Alamut/Mazandaran
		province_id = 661 # Tabaristan
		province_id = 633 # Gurgan
		province_id = 631 # Dihistan
		province_id = 627 # Kyzyl Su
		province_id = 625 # Usturt
		province_id = 624 # Mangyshlak
		province_id = 621 # Emba
		province_id = 618 # Atyrau/Guryev
		province_id = 620 # Itil
		province_id = 604 # Kuma
		province_id = 675 # Semender
		province_id = 674 # Derbent
		province_id = 669 # Shemakha
		province_id = 668 # Shirvan
	}
}

has_enough_personality_traits_trigger = {
	OR = {
		AND = {
			ai = yes
			personality_traits = 6
		}
		AND = {
			ai = no
			personality_traits = 8
		}
	}
}

# requires event target capital_province set
is_capital_province = {
	province = event_target:capital_province
}

is_pentarch_trigger = {
	OR = {
		has_landed_title = b_roma
		has_landed_title = b_hagiasophia
		has_landed_title = b_alexandria
		has_landed_title = b_jerusalem
		has_landed_title = b_antiocheia
	}
}

is_crowned_trigger = {
	custom_tooltip = {
		text = HAS_CROWNED_TRAIT
		hidden_tooltip = {
			OR = {
				trait = crowned
				trait = crowned_by_pope
				trait = crowned_by_vip
				trait = crowned_by_relhead
				trait = weak_basileus
				trait = strong_basileus
			}
		}
	}
}

is_high_crowned_trigger = {
	custom_tooltip = {
		text = HAS_HIGH_CROWNED_TRAIT
		hidden_tooltip = {
			OR = {
				trait = crowned_by_pope
				trait = crowned_by_vip
				trait = crowned_by_relhead
				trait = strong_basileus
			}
		}
	}
}

patrician_is_in_caspian = { # Check if a patrician's realm holds any of the Caspian ports
	AND = {
		FROM = {
			is_patrician = yes
			top_liege = {
				any_realm_province = {
					is_caspian_port = yes # Port check skipped as all is_caspian_port provinces are ports anyways
				}
			}
		}
	}
}

patrician_is_outside_caspian = { # Check if a patrician's realm holds any non-Caspian ports
	AND = {
		FROM = {
			is_patrician = yes
			top_liege = {
				any_realm_province = {
					NOT = { is_caspian_port = yes } # Port check necessary as this isn't as exclusive as the opposite
					port = yes
				}
			}
		}
	}
}

has_gender_equal_game_rule_trigger = {
	OR = {
		has_game_rule = {
			name = gender
			value = plus
		}
		has_game_rule = {
			name = gender
			value = all
		}
	}
}

# Two additional buildings can be built per increase in Construction technology
# checks if max allowed number has been built yet
can_build_more_buildings = {
	custom_tooltip = {
		text = requires_building_slots
		OR = {
			AND = {
				TECH_CONSTRUCTION == 1
				FROMFROM = {
					num_of_buildings < 2
				}
			}
			AND = {
				TECH_CONSTRUCTION == 2
				FROMFROM = {
					num_of_buildings < 4
				}
			}
			AND = {
				TECH_CONSTRUCTION == 3
				FROMFROM = {
					num_of_buildings < 6
				}
			}
			AND = {
				TECH_CONSTRUCTION == 4
				FROMFROM = {
					num_of_buildings < 8
				}
			}
			AND = {
				TECH_CONSTRUCTION == 5
				FROMFROM = {
					num_of_buildings < 10
				}
			}
			AND = {
				TECH_CONSTRUCTION == 6
				FROMFROM = {
					num_of_buildings < 12
				}
			}
			AND = {
				TECH_CONSTRUCTION == 7
				FROMFROM = {
					num_of_buildings < 14
				}
			}
			AND = {
				TECH_CONSTRUCTION == 8
				FROMFROM = {
					num_of_buildings < 16
				}
			}
		}
	}
}

# Two additional buildings can be built per increase in Construction technology,
# checks if max allowed number has been built yet
hospital_can_build_more_buildings = {
	custom_tooltip = {
		text = requires_building_slots
		OR = {
			AND = {
				TECH_CONSTRUCTION == 1
				calc_true_if = {
					amount < 2
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 2
				calc_true_if = {
					amount < 4
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 3
				calc_true_if = {
					amount < 6
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 4
				calc_true_if = {
					amount < 8
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 5
				calc_true_if = {
					amount < 10
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 6
				calc_true_if = {
					amount < 12
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 7
				calc_true_if = {
					amount < 14
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
			AND = {
				TECH_CONSTRUCTION == 8
				calc_true_if = {
					amount < 16
					hospital_has_building = ho_abomination_stand
					hospital_has_building = ho_alchemist_hut
					hospital_has_building = ho_archive_room
					hospital_has_building = ho_autopsy_room
					hospital_has_building = ho_chapel
					hospital_has_building = ho_games_room
					hospital_has_building = ho_garden
					hospital_has_building = ho_healer_quarters
					hospital_has_building = ho_isolation_cells
					hospital_has_building = ho_leper_colony
					hospital_has_building = ho_medical_academy
					hospital_has_building = ho_observatory
					hospital_has_building = ho_pilgrim_inn
					hospital_has_building = ho_refugee_docks
					hospital_has_building = ho_sick_house
					hospital_has_building = ho_soup_kitchen
					hospital_has_building = ho_surgery_room
					hospital_has_building = ho_tailor_room
					hospital_has_building = ho_translation_house
					hospital_has_building = ho_well
				}
			}
		}
	}
}

# Two additional buildings can be built per increase in Construction technology,
# checks if max allowed number has been built yet
trade_post_can_build_more_buildings = {
	custom_tooltip = {
		text = requires_building_slots
		OR = {
			AND = {
				TECH_CONSTRUCTION == 1
				calc_true_if = {
					amount < 2
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 2
				calc_true_if = {
					amount < 4
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 3
				calc_true_if = {
					amount < 6
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 4
				calc_true_if = {
					amount < 8
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 5
				calc_true_if = {
					amount < 10
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 6
				calc_true_if = {
					amount < 12
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 7
				calc_true_if = {
					amount < 14
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
			AND = {
				TECH_CONSTRUCTION == 8
				calc_true_if = {
					amount < 16
					trade_post_has_building = tr_bank
					trade_post_has_building = tr_camp
					trade_post_has_building = tr_custom_house
					trade_post_has_building = tr_depot
					trade_post_has_building = tr_farm
					trade_post_has_building = tr_fishery
					trade_post_has_building = tr_guild_enclave
					trade_post_has_building = tr_guild_fishery
					trade_post_has_building = tr_lumber_mill
					trade_post_has_building = tr_mercenary_garrison
					trade_post_has_building = tr_mine
					trade_post_has_building = tr_pasture
					trade_post_has_building = tr_paved_roads
					trade_post_has_building = tr_plantation
					trade_post_has_building = tr_quarry
					trade_post_has_building = tr_realm_garrison
					trade_post_has_building = tr_smuggler_cove
					trade_post_has_building = tr_toll_booth
					trade_post_has_building = tr_trade_office
					trade_post_has_building = tr_trade_port
				}
			}
		}
	}
}

# Two additional buildings can be built per increase in Construction technology,
# checks if max allowed number has been built yet
fort_can_build_more_buildings = {
	custom_tooltip = {
		text = requires_building_slots
		OR = {
			AND = {
				TECH_CONSTRUCTION == 1
				calc_true_if = {
					amount < 2
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 2
				calc_true_if = {
					amount < 4
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 3
				calc_true_if = {
					amount < 6
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 4
				calc_true_if = {
					amount < 8
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 5
				calc_true_if = {
					amount < 10
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 6
				calc_true_if = {
					amount < 12
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 7
				calc_true_if = {
					amount < 14
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
			AND = {
				TECH_CONSTRUCTION == 8
				calc_true_if = {
					amount < 16
					fort_has_building = fo_arrow_maker
					fort_has_building = fo_brimstones
					fort_has_building = fo_caltrops
					fort_has_building = fo_command_tent
					fort_has_building = fo_common_tents
					fort_has_building = fo_forager_huts
					fort_has_building = fo_hitching_post
					fort_has_building = fo_oil_pits
					fort_has_building = fo_outer_palisade
					fort_has_building = fo_quartermaster
					fort_has_building = fo_ramparts
					fort_has_building = fo_reinforced_walls
					fort_has_building = fo_senior_tents
					fort_has_building = fo_spear_bracing_spots
					fort_has_building = fo_spike_traps
					fort_has_building = fo_stakes
					fort_has_building = fo_supply_tent
					fort_has_building = fo_training_dummies
					fort_has_building = fo_watchtower
					fort_has_building = fo_wooden_barbican
				}
			}
		}
	}
}

# Two additional buildings can be built per increase in Construction technology,
# checks if max allowed number has been built yet
family_palace_can_build_more_buildings = {
	custom_tooltip = {
		text = requires_building_slots
		OR = {
			AND = {
				TECH_CONSTRUCTION == 1
				calc_true_if = {
					amount < 2
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 2
				calc_true_if = {
					amount < 4
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 3
				calc_true_if = {
					amount < 6
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 4
				calc_true_if = {
					amount < 8
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 5
				calc_true_if = {
					amount < 10
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 6
				calc_true_if = {
					amount < 12
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 7
				calc_true_if = {
					amount < 14
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
			AND = {
				TECH_CONSTRUCTION == 8
				calc_true_if = {
					amount < 16
					family_palace = { has_building = fp_administrative_office }
					family_palace = { has_building = fp_art_collection }
					family_palace = { has_building = fp_chancellor }
					family_palace = { has_building = fp_chaplain }
					family_palace = { has_building = fp_crossbow_workshop }
					family_palace = { has_building = fp_maze }
					family_palace = { has_building = fp_mansion }
					family_palace = { has_building = fp_map_room }
					family_palace = { has_building = fp_marshal }
					family_palace = { has_building = fp_meditation_room }
					family_palace = { has_building = fp_mercenary_contractors }
					family_palace = { has_building = fp_minter }
					family_palace = { has_building = fp_poleaxe_workshop }
					family_palace = { has_building = fp_riding_grounds }
					family_palace = { has_building = fp_royal_escorts }
					family_palace = { has_building = fp_royal_guards }
					family_palace = { has_building = fp_spymaster }
					family_palace = { has_building = fp_steward }
					family_palace = { has_building = fp_vault }
					family_palace = { has_building = fp_cellar }
				}
			}
		}
	}
}
