#	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_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_osterreich
			title = d_bavaria
			title = d_franconia
			title = d_luxembourg
			title = d_saxony
			title = d_swabia
			title = d_swiss
			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
		}
	}
}

# 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 }
		}
		AND = {
			title = b_roma
			FROM = {
				NOT = { has_landed_title = d_pentarch_rome }
			}
		}
		AND = {
			title = b_hagiasophia
			FROM = {
				NOR = {
					has_landed_title = d_pentarch_constantinople
					has_landed_title = d_latin_constantinople
				}
			}
		}
		AND = {
			title = b_alexandria
			FROM = {
				NOR = {
					has_landed_title = d_pentarch_alexandria
					has_landed_title = d_latin_alexandria
				}
			}
		}
		AND = {
			title = b_antiocheia
			FROM = {
				NOR = {
					has_landed_title = d_pentarch_antioch
					has_landed_title = d_latin_antioch
				}
			}
		}
		AND = {
			title = b_jerusalem
			FROM = {
				NOR = {
					has_landed_title = d_pentarch_jerusalem
					has_landed_title = d_latin_jerusalem
				}
			}
		}
	}
}

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
	}
}

can_inherit_trigger = {
	NOR = {
		trait = bastard
		trait = eunuch
		trait = horse
		trait = abdicated
		trait = disinherited
		trait = monk
		trait = nun
		trait = desert_mother
		trait = desert_father
		trait = druid
		trait = bad_druid
		trait = retired_vestalis
		trait = vestalis
		is_consort = yes # Concubines cannot inherit
		holy_order = yes
		any_liege = { holy_order = yes }
		AND = {
			NOR = {
				religion = waldensian
				religion = yazidi
				religion = aztec
				religion_group = jewish_group
				religion_group = pagan_group
				religion_group = muslim
			}
			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
		trait = incapable
		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 = {
		religion = cathar
		religion = bogomilist
		religion = messalian
		religion = egyptian_pagan
		religion = buddhist
		religion = mazdaki
		religion = tondrakian
		religion = druze
		religion = promethean_pagan
		religion = berber_pagan
		AND = {
			is_ruler = no
			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 = {
	OR = {
		AND = {
			has_game_rule = {
				name = empire_creation_kingdom_rule
				value = has_two
			}
			has_two_king_titles_trigger = yes
		}
		AND = {
			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
	OR = {
		independent = yes
		custom_tooltip = {
			text = NOT_IMPERIAL_GOVERNMENT
			hidden_tooltip = { has_imperial_government_trigger = no }
		}
		FROM = { is_titular = yes }
	}
}

may_create_empire_trigger = {
	is_title_active = FROM
	is_adult = yes
	has_regent = no
	war = no
	OR = {
		lower_real_tier_than = EMPEROR
		AND = {
			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
	OR = {
		independent = yes
		custom_tooltip = {
			text = NOT_IMPERIAL_GOVERNMENT
			hidden_tooltip = { has_imperial_government_trigger = no }
		}
	}
	OR = {
		custom_tooltip = {
			text = NOT_RESTRICTED_BY_LOCKOUT_LAW
			hidden_tooltip = {
				top_liege = { NOT = { has_law = kingdom_lockout_0 } }
			}
		}
		custom_tooltip = {
			text = TITLE_IS_EXEMPT
			hidden_tooltip = {
				OR = {
					FROM = { culture = roman }
					AND = {
						top_liege = { has_landed_title = e_hre }
						FROM = {
							OR = {
								title = k_bavaria
								title = k_bohemia
								title = k_saxony
								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_austria
								title = k_franconia
								title = k_luxembourg
								title = k_swabia
								title = k_tuscany
							}
						}
					}
				}
			}
		}
	}
	hidden_tooltip = {
		OR = {
			ai = no
			NOT = { has_landed_title = k_france }
			has_character_flag = is_charlemagne
			FROM = { NOT = { title = k_aquitaine } }
		}
		OR = {
			ai = no
			FROM = {
				OR = {
					is_titular = no
					title = k_bavaria
					title = k_bohemia
					title = k_saxony
					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
				}
			}
			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
				trait = incapable
			}
			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
					trait = incapable
				}
				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_chalcedonian
			ROOT = { NOT =  { religion = chalcedonian } }
		}
		AND = {
			title = k_papal_chalcedon
			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_hellenic_pagan
			ROOT = { NOT =  { religion = hellenic_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 = {
	OR = {
		culture = german
		culture = imperial_german
		culture = swabian
		culture = franconian
		culture = swiss
		culture = teutonic
		culture = colognian
		culture = thuringian
		culture = bavarian
		culture = austrian
		culture = old_saxon
	}
}

late_german_cultures_trigger = {
	OR = {
		culture = old_saxon
		culture = prussian
		culture = bavarian
	}
}

low_prussian_cultures_trigger = {
	OR = {
		culture = old_saxon
		culture = prussian
	}
}

german_cultures_no_old_german_trigger = {
	OR = {
		culture = imperial_german
		culture = swabian
		culture = franconian
		culture = swiss
		culture = teutonic
		culture = colognian
		culture = thuringian
		culture = bavarian
		culture = austrian
		culture = old_saxon
	}
}

german_cultures_no_imperial_german_trigger = {
	OR = {
		culture = german
		culture = swabian
		culture = franconian
		culture = swiss
		culture = teutonic
		culture = colognian
		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
		}
	}
}

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
		}
	}
}

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

german_culture_region_trigger = { # Checks if title is in one of the German culture regions
	OR = {
		region = custom_swabian
		region = custom_bavarian
		region = custom_colognian
		region = custom_franconian
		region = custom_swiss
		region = custom_old_saxon
		region = custom_thuringian
	}
}

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
	}
}

gavelkind_culture_trigger = {
	OR = {
		culture_group = central_germanic
		culture_group = west_african
		culture_group = mesoamerican
		culture = nubian
		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 = basque
		culture = castillan
		culture = catalan
		culture = old_frankish
		culture = greek
		culture = russian
		culture = italian
		culture = portuguese
		culture = armenian
		culture = georgian
		culture = lithuanian
		culture = welsh
		culture = cornish
		culture = breton
	}
}