
### CONVENIENCE TRIGGERS ###
emf_laws_no_crown_law_title_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_no_crown_law_title
		hidden_tooltip = { has_crown_law_title = no }
	}
}
emf_laws_has_readable_succession_law_trigger = {
	OR = {
		has_law = succ_gavelkind
		has_law = succ_elective_gavelkind
		has_law = succ_seniority
		has_law = succ_primogeniture
		has_law = succ_feudal_elective
		has_law = succ_tanistry
		has_law = succ_ultimogeniture
		has_law = succ_turkish_succession
		has_law = succ_papal_succession
		has_law = succ_appointment
		has_law = succ_open_elective
		has_law = succ_catholic_bishopric
		has_law = succ_patrician_elective
		has_law = succ_nomad_succession
	}
}
emf_laws_crownlaw_title_limited_ca_plus_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_crownlaw_title_limited_ca_plus
		hidden_tooltip = {
			crownlaw_title = {
				OR = {
					has_law = crown_authority_1
					has_law = crown_authority_2
					has_law = crown_authority_3
					has_law = crown_authority_4
				}
			}
		}
	}
}
emf_laws_crownlaw_title_medium_ca_plus_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_crownlaw_title_medium_ca_plus
		hidden_tooltip = {
			crownlaw_title = {
				OR = {
					has_law = crown_authority_2
					has_law = crown_authority_3
					has_law = crown_authority_4
				}
			}
		}
	}
}
emf_laws_crownlaw_title_high_ca_plus_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_crownlaw_title_high_ca_plus
		hidden_tooltip = {
			crownlaw_title = {
				OR = {
					has_law = crown_authority_3
					has_law = crown_authority_4
				}
			}
		}
	}
}
emf_laws_holder_has_late_adminstration_plus_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_holder_has_late_adminstration_plus_raw
		hidden_tooltip = {
			holder_scope = {
				primary_title = {
					OR = {
						has_law = late_feudal_administration
						has_law = imperial_administration
					}
				}
			}
		}
	}
}

emf_laws_holder_liege_has_late_adminstration_plus_trigger = {
	custom_tooltip = {
		text = emf_laws_ctt_holder_liege_has_late_adminstration_plus_raw
		hidden_tooltip = {
			holder_scope = {
				liege = {
					primary_title = {
						OR = {
							has_law = late_feudal_administration
							has_law = imperial_administration
						}
					}
				}
			}
		}
	}
}

# A lot nicer-looking to the user than the direct-coded version
emf_laws_change_succ_prestige_cost_trigger = {
	OR = {
		custom_tooltip = {
			text = emf_laws_ctt_baron_tier_and_requires_125_prestige_cost
			hidden_tooltip = {
				tier = BARON
				holder_scope = { prestige = 125 }
			}
		}
		custom_tooltip = {
			text = emf_laws_ctt_count_tier_and_requires_250_prestige_cost
			hidden_tooltip = {
				tier = COUNT
				holder_scope = { prestige = 250 }
			}
		}
		custom_tooltip = {
			text = emf_laws_ctt_duke_tier_and_requires_500_prestige_cost
			hidden_tooltip = {
				tier = DUKE
				holder_scope = { prestige = 500 }
			}
		}
		custom_tooltip = {
			text = emf_laws_ctt_king_tier_and_requires_750_prestige_cost
			hidden_tooltip = {
				tier = KING
				holder_scope = { prestige = 750 }
			}
		}
		custom_tooltip = {
			text = emf_laws_ctt_emperor_tier_and_requires_1000_prestige_cost
			hidden_tooltip = {
				tier = EMPEROR
				holder_scope = { prestige = 1000 }
			}
		}
	}
}

# Vassals are almost (always) upset by a succession law change; these are the ones that are affected:
emf_laws_change_succ_affected_vassal_trigger = {
	OR = {
		event_target:emf_succ_title = {
			OR = {
				is_primary_holder_title = yes
				is_titular = yes
			}
		}
		capital_holding = { de_jure_liege_or_above = event_target:emf_succ_title }
	}
}

# The succession law change reactions of the new heir, former heir, new pretenders, and former pretenders are all handled
# by event and thus the succ_adopt_* effects should skip these characters in its blanket opinion effects. Note that we
# don't use this for elective-style succession laws, because the new heir and pretenders will not really be valid for a bit,
# and even so, it's subject to rapid change.
emf_laws_change_succ_vip_trigger = {
	OR = {
		character = event_target:emf_heir
		character = event_target:emf_former_heir
		reverse_has_opinion_modifier = { who = event_target:emf_succ_changer modifier = opinion_succ_former_pretender }
		any_pretender_title = { title = event_target:emf_succ_title }
	}
}

# Additionally, as the succ_adopt_* effects hand-out blanket opinions, they do so in order of priority, and they mark each
# "already reacted to this succession law change" character as they go with flags.
#
# Note that we distinguish the types of succession change reaction so that we may know which opinion modifier we've added
# from the character to the succession law changer _for this law change only_ so that actual opinions may properly stack from
# past reactions to law changes (alternative would be to check for the modifiers themselves, but that would not allow
# coherent stacking across multiple law changes by the same ruler).
emf_laws_change_succ_reaction_trigger = {
	OR = {
		has_character_flag = emf_mild_reaction
		has_character_flag = emf_bad_reaction
		has_character_flag = emf_good_reaction
		has_character_flag = emf_bad2_reaction
	}
}


# Used for most regular succession laws as PART of the potential. It's NOT common to every major succession type (e.g.,
# primogeniture and turkish succession don't use it); it's just a convenience to clarify the succession laws code.
emf_laws_succ_basic_potential_trigger = {
	holder_scope = {
		NOT = { religion_group = muslim }
		OR = {
			independent = yes
			NOR = {
				any_liege = { holy_order = yes }
				any_demesne_title = { is_vice_royalty = yes }
			}
		}
	}
	is_primary_type_title = no
	is_vice_royalty = no
}

