# -*- ck2.scripted_triggers -*-


#### EMF CORE PROPERTIES TRIGGERS ####

emf_unreformed_pagan = {
	custom_tooltip = {
		text = RELIGION_IS_UNREFORMED_PAGAN
		religion_group = pagan_group
		is_reformed_religion = no
	}
}
emf_not_unreformed_pagan = {
	custom_tooltip = {
		text = RELIGION_IS_UNREFORMED_PAGAN_NOT
		emf_unreformed_pagan = no
	}
}

emf_true_unreformed_pagan = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_UNREFORMED_PAGAN
		true_religion_group = pagan_group
		trigger_if = {
			limit = {
				OR = {
					character = no
					has_secret_religion = no
				}
			}
			is_reformed_religion = no
		}
		trigger_else = {
			true_religion_scope = {
				persistent_event_target:emf_religion_dummy_character = {
					is_reformed_religion = no
				}
			}
		}
	}
}
emf_not_true_unreformed_pagan = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_UNREFORMED_PAGAN_NOT
		emf_true_unreformed_pagan = no
	}
}

emf_polytheist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_POLYTHEISTIC
		OR = {
			AND = {
				religion_group = pagan_group
				NOR = {
					has_religion_feature = religion_dogmatic
					religion = zun_pagan_reformed
					religion = zun_pagan
				}
			}
			AND = {
				religion_group = indian_group
				NOT = { religion = buddhist }
			}
			religion = zurvanist
		}
	}
}
emf_not_polytheist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_POLYTHEISTIC_NOT
		emf_polytheist_religion = no
	}
}

emf_western_christian_religion = {
	custom_tooltip = {
		text = RELIGION_IS_WESTERN_CHRISTIAN
		OR = {
			religion = catholic
			religion = cathar
			religion = fraticelli
			religion = waldensian
			religion = lollard
			religion = adoptionist
			religion = arian
		}
	}
}
emf_not_western_christian_religion = {
	custom_tooltip = {
		text = RELIGION_IS_WESTERN_CHRISTIAN_NOT
		emf_western_christian_religion = no
	}
}

emf_feminist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_FEMINIST
		OR = {
			religion_scope = { has_religion_feature = religion_matriarchal } # more than feminist, but does set feminist = yes param
			emf_gender_equal_religion = yes
		}
	}
}
emf_not_feminist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_FEMINIST_NOT
		emf_feminist_religion = no
	}
}

emf_gender_equal_religion = {
	custom_tooltip = {
		text = RELIGION_IS_GENDER_EQUAL
		religion_scope = {
			has_flag = emf_feminist
			NOR = {
				has_religion_feature = religion_matriarchal
				has_religion_feature = religion_patriarchal
			}
		}
	}
}
emf_not_gender_equal_religion = {
	custom_tooltip = {
		text = RELIGION_IS_GENDER_EQUAL_NOT
		emf_gender_equal_religion = no
	}
}

emf_antifeminist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_PATRIARCHAL
		OR = {
			religion_scope = { has_religion_feature = religion_patriarchal }
			religion_group = muslim
		}
		emf_feminist_religion = no
	}
}
emf_not_antifeminist_religion = {
	custom_tooltip = {
		text = RELIGION_IS_PATRIARCHAL_NOT
		emf_antifeminist_religion = no
	}
}

# No tooltip because this is meant for private, behind-the-scenes interactions
emf_feminist_true_religion = {
	true_religion_scope = {
		OR = {
			has_religion_feature = religion_matriarchal # more than feminist, but does set feminist = yes param
			AND = {
				has_flag = emf_feminist
				NOR = {
					has_religion_feature = religion_matriarchal
					has_religion_feature = religion_patriarchal
				}
			}
		}
	}
}

emf_pacifist_true_religion = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_PACIFIST
		true_religion_scope = {
			persistent_event_target:emf_religion_dummy_character = {
				pacifist = yes
			}
		}
	}
}
emf_not_pacifist_true_religion = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_PACIFIST_NOT
		emf_pacifist_true_religion = no
	}
}

emf_warlike_true_religion = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_WARLIKE
		true_religion_scope = {
			OR = {
				has_religion_feature = religion_warlike
				religion = norse_pagan
				religion = tengri_pagan
				religion = aztec
				AND = {
					has_religion_features = no
					OR = {
						religion = norse_pagan_reformed
						religion = tengri_pagan_reformed
						religion = aztec_reformed
						religion = zun_pagan_reformed
					}
				}
			}
		}
	}
}
emf_not_warlike_true_religion = {
	custom_tooltip = {
		text = TRUE_RELIGION_IS_WARLIKE_NOT
		emf_warlike_true_religion = no
	}
}

# Does the character acknowledge that shieldmaidens are exceptions to the traditional rule that women cannot be warriors
emf_accepts_shieldmaidens = {
	custom_tooltip = {
		text = ACCEPTS_SHIELDMAIDENS_AS_WARRIORS
		NOT = { religion_scope = { has_religion_feature = religion_patriarchal } }
		OR = {
			AND = {
				this_is_warrior_culture_trigger = yes
				emf_antifeminist_religion = no
			}
			is_member_of_any_warrior_lodge_trigger = yes
			trait = sympathy_pagans
			gender_equality_trigger = yes
		}
	}
}
emf_does_not_accept_shieldmaidens = {
	custom_tooltip = {
		text = ACCEPTS_SHIELDMAIDENS_AS_WARRIORS_NOT
		emf_accepts_shieldmaidens = no
	}
}

emf_religion_can_excommunicate = {
	custom_tooltip = {
		text = RELIGION_CAN_EXCOMMUNICATE
		religion_scope = { has_flag = emf_can_excommunicate }
	}
}
emf_religion_cannot_excommunicate = {
	custom_tooltip = {
		text = RELIGION_CAN_EXCOMMUNICATE_NOT
		emf_religion_can_excommunicate = no
	}
}

emf_religion_head_can_divorce = {
	custom_tooltip = {
		text = RELIGION_HEAD_CAN_GRANT_DIVORCE
		religion_scope = { has_flag = emf_can_grant_divorce }
	}
}
emf_religion_head_cannot_divorce = {
	custom_tooltip = {
		text = RELIGION_HEAD_CAN_GRANT_DIVORCE_NOT
		emf_religion_head_can_divorce = no
	}
}

# emf_religion_has_castes moved to emf_religion_codegen_triggers because it is used by traits at startup
# whose conditions and the like are checked before flags can be set for religions indicating that they have castes
#
emf_religion_does_not_have_castes = {
	custom_tooltip = {
		text = RELIGION_HAS_CASTES_NOT
		emf_religion_has_castes = no
	}
}

emf_religion_has_caste_opinions = {
	custom_tooltip = {
		text = RELIGION_HAS_CASTE_OPINIONS
		religion_scope = { has_flag = emf_caste_opinions }
	}
}
emf_religion_does_not_have_caste_opinions = {
	custom_tooltip = {
		text = RELIGION_HAS_CASTE_OPINIONS_NOT
		emf_religion_has_caste_opinions = no
	}
}

emf_divine_blood_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_DIVINE_BLOOD_DOCTRINE
		religion_scope = { has_flag = emf_divine_blood }
	}
}
emf_not_divine_blood_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_DIVINE_BLOOD_DOCTRINE_NOT
		emf_divine_blood_religion = no
	}
}
# No tooltip because this is meant for private, behind-the-scenes interactions
emf_divine_blood_true_religion = {
	true_religion_scope = { has_flag = emf_divine_blood }
}

emf_jizya_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_JIZYA_DOCTRINE
		religion_scope = { has_flag = emf_uses_jizya_tax }
	}
}
emf_not_jizya_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_JIZYA_DOCTRINE_NOT
		emf_jizya_religion = no
	}
}

emf_astrology_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_ASTROLOGY_DOCTRINE
		religion_scope = {
			OR = {
				AND = {
					has_random_religions = no
					religion = hellenic_pagan
				}
				trigger_if = {
					limit = { has_religion_features = yes }
					OR = {
						has_religion_feature = religion_feature_hellenic
						has_religion_feature = religion_astrology
					}
				}
				trigger_else = {
					religion = hellenic_pagan_reformed
				}
			}
		}
	}
}
emf_not_astrology_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_ASTROLOGY_DOCTRINE_NOT
		emf_astrology_religion = no
	}
}

emf_haruspicy_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_HARUSPICY_DOCTRINE
		religion_scope = {
			OR = {
				AND = {
					has_random_religions = no
					religion = hellenic_pagan
				}
				trigger_if = {
					limit = { has_religion_features = yes }
					OR = {
						has_religion_feature = religion_feature_hellenic
						has_religion_feature = religion_astrology
					}
				}
				trigger_else = {
					religion = hellenic_pagan_reformed
				}
			}
		}
	}
}
emf_not_haruspicy_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_HARUSPICY_DOCTRINE_NOT
		emf_haruspicy_religion = no
	}
}

emf_ritual_sacrifice_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_RITUAL_SACRIFICE_DOCTRINE
		religion_scope = {
			OR = {
				AND = {
					has_random_religions = no
					religion = aztec
				}
				trigger_if = {
					limit = { has_religion_features = yes }
					OR = {
						has_religion_feature = religion_feature_aztec
						has_religion_feature = religion_ritual_sacrifice
					}
				}
				trigger_else = {
					religion = aztec_reformed
				}
			}
		}
	}
}
emf_not_ritual_sacrifice_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_RITUAL_SACRIFICE_DOCTRINE_NOT
		emf_ritual_sacrifice_religion = no
	}
}

emf_animistic_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_ANIMISTIC_DOCTRINE
		religion_scope = {
			OR = {
				AND = {
					has_random_religions = no
					religion = west_african_pagan
				}
				trigger_if = {
					limit = { has_religion_features = yes }
					OR = {
						has_religion_feature = religion_animistic
						has_religion_feature = religion_feature_west_african
						has_religion_feature = religion_feature_finnish
						has_religion_feature = religion_feature_baltic
					}
				}
				trigger_else = {
					OR = {
						religion = west_african_pagan_reformed
						religion = finnish_pagan_reformed
						religion = baltic_pagan_reformed
					}
				}
			}
		}
	}
}
emf_not_animistic_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_ANIMISTIC_DOCTRINE_NOT
		emf_animistic_religion = no
	}
}

emf_seafaring_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_SEAFARING_DOCTRINE
		religion_scope = { has_flag = emf_seafarer }
	}
}
emf_not_seafaring_religion = {
	custom_tooltip = {
		text = RELIGION_FOLLOWS_SEAFARING_DOCTRINE_NOT
		emf_seafaring_religion = no
	}
}

emf_male_homosexual_indifferent_religion = {
	custom_tooltip = {
		text = RELIGION_MALE_HOMOSEXUAL_INDIFFERENT
		# Note that there's a lot of missing or mixed information about how a lot of non-Abrahamic religions dealt with this topic, so only if we know that a religion at the time was 100% fine with male-male acts (having them be part of their mythology is not enough on its own) can it be listed here
		# E.g. with Norse, it was 100% OK to be a top, but definitely insulting to be a bottom or called as someone who ever was one, so they don't make the list
		OR = {
			# (Roman) Hellenic: Male-male completely fine and not just as pederasty or just for tops (by the Empire era at least). Lot murkier with Greeks, but we assume that hellenic_pagan follows Roman behavior.
			religion = hellenic_pagan
			religion = hellenic_pagan_reformed
			# Buddhism is the only possible exception here, but even that's only for some schools, so including the entire group is fine.
			religion_group = indian_group
			# Pagans are generally more flexible, so if they syncretize with the Eastern group (who are indifferent) and not with any Abrahamic or Mazdan groups (who are NOT indifferent), they are fine.
			religion_scope = {
				has_religion_feature = religion_syncretic_indian
				NOR = {
					has_religion_feature = religion_syncretic_christian
					has_religion_feature = religion_syncretic_muslim
					has_religion_feature = religion_syncretic_zoroastrian
				}
			}
		}
	}
}
emf_not_male_homosexual_indifferent_religion = {
	custom_tooltip = {
		text = RELIGION_MALE_HOMOSEXUAL_INDIFFERENT_NOT
		emf_male_homosexual_indifferent_religion = no
	}
}

emf_female_homosexual_indifferent_religion = {
	custom_tooltip = {
		text = RELIGION_FEMALE_HOMOSEXUAL_INDIFFERENT
		# Note that there's a lot of missing or mixed information about how a lot of non-Abrahamic religions dealt with this topic, so only if we know that a religion at the time was 100% fine with female-female acts (having them be part of their mythology is not enough on its own) can it be listed here
		OR = {
			# Hellenic: Female-female only fine if gender-equal or feminist, since male-male is fine normally but lesbianness was looked at oddly by Ancient Greeks and definitely looked down on by Romans
			AND = {
				OR = {
					religion = hellenic_pagan
					religion = hellenic_pagan_reformed
				}
				emf_feminist_religion = yes
			}
			# Buddhism is the only possible exception here, but even that's only for some schools, so including the entire group is fine.
			religion_group = indian_group
			# Pagans are generally more flexible, so if they syncretize with the Eastern group (who are indifferent) and not with any Abrahamic or Mazdan groups (who are NOT indifferent), they are fine.
			religion_scope = {
				has_religion_feature = religion_syncretic_indian
				NOR = {
					has_religion_feature = religion_syncretic_christian
					has_religion_feature = religion_syncretic_muslim
					has_religion_feature = religion_syncretic_zoroastrian
				}
			}
		}
	}
}
emf_not_female_homosexual_indifferent_religion = {
	custom_tooltip = {
		text = RELIGION_FEMALE_HOMOSEXUAL_INDIFFERENT_NOT
		emf_female_homosexual_indifferent_religion = no
	}
}

# No tooltip because this is meant to only be used behind-the-scenes
emf_male_homosexual_indifferent_true_religion = {
	OR = {
		true_religion = hellenic_pagan
		true_religion = hellenic_pagan_reformed
		true_religion_group = indian_group
		true_religion_scope = {
			has_religion_feature = religion_syncretic_indian
			NOR = {
				has_religion_feature = religion_syncretic_christian
				has_religion_feature = religion_syncretic_muslim
				has_religion_feature = religion_syncretic_zoroastrian
			}
		}
	}
}

emf_female_homosexual_indifferent_true_religion = {
	OR = {
		AND = {
			OR = {
				true_religion = hellenic_pagan
				true_religion = hellenic_pagan_reformed
			}
			emf_feminist_true_religion = yes
		}
		true_religion_group = indian_group
		true_religion_scope = {
			has_religion_feature = religion_syncretic_indian
			NOR = {
				has_religion_feature = religion_syncretic_christian
				has_religion_feature = religion_syncretic_muslim
				has_religion_feature = religion_syncretic_zoroastrian
			}
		}
	}
}

emf_same_basic_religion_as_ROOT = {
	custom_tooltip = {
		text = HAS_SAME_BASIC_RELIGION_AS_ROOT
		OR = {
			religion = ROOT
			is_heresy_of = ROOT
			is_parent_religion = ROOT
			is_reformed_religion = ROOT
			ROOT = { is_reformed_religion = PREV }
		}
	}
}
emf_not_same_basic_religion_as_ROOT = {
	custom_tooltip = {
		text = HAS_SAME_BASIC_RELIGION_AS_ROOT_NOT
		emf_same_basic_religion_as_ROOT = no
	}
}

emf_same_basic_religion_as_PREV = {
	custom_tooltip = {
		text = HAS_SAME_BASIC_RELIGION_AS_PREV
		OR = {
			religion = PREV
			is_heresy_of = PREV
			is_parent_religion = PREV
			is_reformed_religion = PREV
			PREV = { is_reformed_religion = PREV }
		}
	}
}
emf_not_same_basic_religion_as_PREV = {
	custom_tooltip = {
		text = HAS_SAME_BASIC_RELIGION_AS_PREV_NOT
		emf_same_basic_religion_as_PREV = no
	}
}

emf_syncretized_religion_with_ROOT = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_ROOT
		trigger_if = {
			limit = { ROOT = { religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_ROOT = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_ROOT_NOT
		emf_syncretized_religion_with_ROOT = no
	}
}

emf_syncretized_religion_with_PREV = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREV
		trigger_if = {
			limit = { PREV = { religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_PREV = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREV_NOT
		emf_syncretized_religion_with_PREV = no
	}
}

emf_syncretized_religion_with_PREVPREV = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREVPREV
		trigger_if = {
			limit = { PREVPREV = { religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { PREVPREV = { religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { PREVPREV = { religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { PREVPREV = { religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_PREVPREV = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREVPREV_NOT
		emf_syncretized_religion_with_PREVPREV = no
	}
}

emf_syncretized_religion_with_FROM = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_FROM
		trigger_if = {
			limit = { FROM = { religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_FROM = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_FROM_NOT
		emf_syncretized_religion_with_FROM = no
	}
}

emf_syncretized_true_religion_with_ROOT = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_ROOT
		trigger_if = {
			limit = { ROOT = { religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { ROOT = { religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_ROOT = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_ROOT_NOT
		emf_syncretized_true_religion_with_ROOT = no
	}
}

emf_syncretized_true_religion_with_PREV = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_PREV
		trigger_if = {
			limit = { PREV = { religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { PREV = { religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_PREV = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_PREV_NOT
		emf_syncretized_true_religion_with_PREV = no
	}
}

emf_syncretized_true_religion_with_FROM = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_FROM
		trigger_if = {
			limit = { FROM = { religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { FROM = { religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_FROM = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_FROM_NOT
		emf_syncretized_true_religion_with_FROM = no
	}
}

emf_syncretized_religion_with_ROOTs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_ROOT_TRUE_RELIGION
		trigger_if = {
			limit = { ROOT = { true_religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_ROOTs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_ROOT_TRUE_RELIGION_NOT
		emf_syncretized_religion_with_ROOTs_true_religion = no
	}
}

emf_syncretized_religion_with_PREVs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREV_TRUE_RELIGION
		trigger_if = {
			limit = { PREV = { true_religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_PREVs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_PREV_TRUE_RELIGION_NOT
		emf_syncretized_religion_with_PREVs_true_religion = no
	}
}

emf_syncretized_religion_with_FROMs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_FROM_TRUE_RELIGION
		trigger_if = {
			limit = { FROM = { true_religion_group = christian } }
			religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = muslim } }
			religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = zoroastrian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = indian_group } }
			religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_religion_with_FROMs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_RELIGION_WITH_FROM_TRUE_RELIGION_NOT
		emf_syncretized_religion_with_FROMs_true_religion = no
	}
}

emf_syncretized_true_religion_with_ROOTs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_ROOT_TRUE_RELIGION
		trigger_if = {
			limit = { ROOT = { true_religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { ROOT = { true_religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_ROOTs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_ROOT_TRUE_RELIGION_NOT
		emf_syncretized_true_religion_with_ROOTs_true_religion = no
	}
}

emf_syncretized_true_religion_with_PREVs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_PREV_TRUE_RELIGION
		trigger_if = {
			limit = { PREV = { true_religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { PREV = { true_religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_PREVs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_PREV_TRUE_RELIGION_NOT
		emf_syncretized_true_religion_with_PREVs_true_religion = no
	}
}

emf_syncretized_true_religion_with_FROMs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_FROM_TRUE_RELIGION
		trigger_if = {
			limit = { FROM = { true_religion_group = christian } }
			true_religion_scope = { has_religion_feature = religion_syncretic_christian }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = muslim } }
			true_religion_scope = { has_religion_feature = religion_syncretic_muslim }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = zoroastrian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_zoroastrian }
		}
		trigger_else_if = {
			limit = { FROM = { true_religion_group = indian_group } }
			true_religion_scope = { has_religion_feature = religion_syncretic_indian }
		}
		trigger_else = {
			always = no
		}
	}
}
emf_not_syncretized_true_religion_with_FROMs_true_religion = {
	custom_tooltip = {
		text = SYNCRETIZED_TRUE_RELIGION_WITH_FROM_TRUE_RELIGION_NOT
		emf_syncretized_true_religion_with_FROMs_true_religion = no
	}
}

# does THIS have / is a religion that will lead to Game Over if a non-nomadic player?
emf_religion_unsafe_for_player_if_not_nomad = {
	custom_tooltip = {
		text = RELIGION_WOULD_CAUSE_GAME_OVER_IF_NOT_A_NOMAD
		trigger_if = {
			limit = { secret_religion_group = muslim }
			NOT = { has_dlc = "The Sword of Islam" }
		}
		trigger_else_if = {
			limit = { secret_religion_group = jewish_group }
			NOT = { has_dlc = "Sons of Abraham" }
		}
		trigger_else_if = {
			limit = { secret_religion_group = zoroastrian_group }
			NOT = { has_dlc = "The Old Gods" }
		}
		trigger_else_if = {
			limit = { secret_religion_group = pagan_group }
			NOR = {
				has_dlc = "The Old Gods"
				has_dlc = "Holy Fury"
			}
			NAND = {
				has_dlc = "Jade Dragon"
				OR = {
					secret_religion = bon
					secret_religion = bon_reformed
				}
			}
		}
		trigger_else_if = {
			limit = { secret_religion_group = indian_group }
			NOT = { has_dlc = "Rajas of India" }
			NAND = {
				has_dlc = "Jade Dragon"
				secret_religion = taoist
			}
		}
		trigger_else = {
			always = no
		}
	}
}
emf_religion_safe_for_player_if_not_nomad = {
	custom_tooltip = {
		text = RELIGION_WOULD_CAUSE_GAME_OVER_IF_NOT_A_NOMAD_NOT
		emf_religion_unsafe_for_player_if_not_nomad = no
	}
}

# Needed because is_government_potential for theocracies apparently includes an extra, hidden check for marriage, so this lets us access the check for theocracy_government's potential block without having that marriage check performed
emf_theocracy_softcoded_potential = {
	NOR = {
		religion_group = muslim
		religion = hip_religion # Keep e_hip playable
	}
	holy_order = no
	is_patrician = no
	trigger_if = {
		limit = { is_female = yes }
		religion_allows_female_temple_holders = yes
	}
	trigger_else = {
		religion_allows_male_temple_holders = yes
	}
}

# Makes no assumptions about current government type -- only considers potential government type
emf_feudal_can_hold_temples_potential = {
	OR = {
		is_government_potential = muslim_government
		is_government_potential = muslim_imperial_government
		is_government_potential = bogomilist_government
		is_government_potential = bogomilist_imperial_government
		is_government_potential = theocratic_feudal_government
		is_government_potential = theocratic_imperial_government
		is_government_potential = order_government
	}
}

emf_can_hold_temples_potential = {
	OR = {
		is_government_potential = theocracy_government
		is_government_potential = muslim_merchant_republic_government
		is_government_potential = bogomilist_merchant_republic_government
		emf_feudal_can_hold_temples_potential = yes
	}
}

emf_feudal_can_hold_temples = {
	OR = {
		government = muslim_government
		government = muslim_imperial_government
		government = bogomilist_government
		government = bogomilist_imperial_government
		government = theocratic_feudal_government
		government = theocratic_imperial_government
		government = order_government
	}
}

emf_can_hold_temples = {
	OR = {
		government = theocracy_government
		government = muslim_merchant_republic_government
		government = bogomilist_merchant_republic_government
		emf_feudal_can_hold_temples = yes
	}
}

emf_alternate_start = {
	custom_tooltip = {
		text = GAME_IS_ALTERNATE_START
		OR = {
			is_alternate_start = yes
			has_global_flag = emf_nwo
		}
	}
}
emf_not_alternate_start = {
	custom_tooltip = {
		text = GAME_IS_ALTERNATE_START_NOT
		emf_alternate_start = no
	}
}

emf_shattered_world = {
	custom_tooltip = {
		text = GAME_IS_SHATTERED_WORLD
		OR = {
			is_shattered_world = yes
			has_global_flag = emf_nwo
		}
	}
}
emf_not_shattered_world = {
	custom_tooltip = {
		text = GAME_IS_SHATTERED_WORLD_NOT
		OR = {
			is_shattered_world = yes
			has_global_flag = emf_nwo
		}
	}
}

# is THIS character considered by EMF standards to be a formidable person?
# I.e. they are formidable enough to play with the big boys/girls despite the medieval patriarchy (or matriarchy if that's what the religion is like).
emf_is_formidable_person = {
	trait = ambitious
	calc_true_if = {
		amount = 2
		diplomacy = 20
		martial = 20
		intrigue = 20
		diplomacy = 15
		martial = 15
		intrigue = 15
		trait = genius
		trait = quick
	}
	NOR = {
		trait = humble
		trait = shy
		trait = slothful
		trait = content
		trait = inbred
		trait = slow
		is_incapable = yes
	}
}

emf_is_trophy_spouse = {
	OR = {
		trait = proud
		trait = envious
		trait = ambitious
		AND = {
			has_fair_trait_trigger = yes
			has_unattractive_trait_trigger = no
		}
	}
	NOR = {
		trait = humble
		is_unattractive_trigger = yes
		is_councillor = yes
	}
	trigger_if = {
		limit = { is_female = yes }
		emf_feminist_true_religion = no
		gender_equality_trigger = no
	}
	trigger_else = {
		true_religion_scope = { has_religion_feature = religion_matriarchal }
	}
	lower_real_tier_than = DUKE
	mother_even_if_dead = { lower_real_tier_than = DUKE }
	father_even_if_dead = { lower_real_tier_than = DUKE }
	spouse = { higher_real_tier_than = COUNT }
	OR = {
		spouse = { higher_real_tier_than = DUKE }
		AND = {
			lower_real_tier_than = COUNT
			mother_even_if_dead = { lower_real_tier_than = COUNT }
			father_even_if_dead = { lower_real_tier_than = COUNT }
		}
	}
	NOT = { any_spouse = { is_main_spouse = no } }
	NOR = {
		has_minor_title = title_regent
		has_minor_title = title_commander
		trait = shieldmaiden
	}
}

emf_has_interesting_trait_for_founding_realm = {
	OR = {
		trait = bastard
		trait = legit_bastard
		trait = varangian
		trait = berserker
		trait = saoshyant_descendant
		trait = adventurer
		trait = peasant_leader
		trait = heresiarch
		trait = sayyid
		trait = mirza
		trait = eunuch
		trait = blinded
		trait = reincarnation
		trait = seaking
		trait = shieldmaiden
		trait = sea_queen
		trait = peasant_ruler
	}
}

emf_is_preferred_gender_for_laws_of_PREV = {
	custom_tooltip = {
		text = IS_PREFERRED_GENDER_FOR_LAWS_OF_PREV
		trigger_if = {
			limit = { is_female = yes }
			PREV = {
				primary_title = {
					succ_law_title = {
						NOR = {
							has_law = agnatic_succession
							has_law = cognatic_succession
						}
					}
				}
			}
		}
		trigger_else = {
			PREV = {
				primary_title = {
					succ_law_title = {
						NOR = {
							has_law = enatic_succession
							has_law = enatic_cognatic_succession
						}
					}
				}
			}
		}
	}
}
emf_is_not_preferred_gender_for_laws_of_PREV = {
	custom_tooltip = {
		text = IS_PREFERRED_GENDER_FOR_LAWS_OF_PREV_NOT
		emf_is_preferred_gender_for_laws_of_PREV = no
	}
}

# can FROM character generally be a candidate for elective title FROMFROM (currently held by ROOT)?
emf_succession_voting_standard_candidate_triggers = {
	FROMFROM = { has_holder = yes }
	NOT = { character = FROM } #Not the current ruler.
	FROM = {
		emf_can_inherit = yes
		NOR = {
			has_character_flag = emf_disinherit_@ROOT_FROMFROM
			AND = {
				OR = {
					trait = crusader_king
					trait = crusader_queen
				}
				ROOT = {
					NOR = {
						trait = crusader_king
						trait = crusader_queen
					}
				}
			}
			is_ascetic_trigger = yes
		}
		OR = { #Either the candidate is in the realm, or is landless, or the title is independent, or the realm of the title does NOT have protected inheritance.
			is_ruler = no
			ROOT = { independent = yes }
			is_liege_or_above = ROOT
			ROOT_FROMFROM = {
				OR = {
					NOT = { crownlaw_title = { has_law = inheritance_1 } }
					crownlaw_title = { owner = { is_liege_or_above_of = ROOT_FROM } }
				}
			}
		}
		trigger_if = {
			limit = { is_ruler = yes }
			ROOT = {
				OR = {
					is_patrician = no
					NOT = { family_palace = { ROOT_FROMFROM = { succ_law_title = { title = PREVPREV } } } }
				}
			}
			OR = {
				is_landed = yes
				AND = {
					is_patrician = yes
					vassal_of = ROOT
					ROOT_FROMFROM = { is_merchant_republic = yes }
				}
			}
			OR = {
				is_theocracy = no
				ROOT_FROMFROM = { is_theocracy = yes }
			}
			OR = {
				is_republic = no
				ROOT_FROMFROM = { is_republic = yes }
			}
			OR = {
				is_merchant_republic = no
				ROOT_FROMFROM = { is_merchant_republic = yes }
			}
		}
		trigger_else = { #Candidate should not be a landless Courtier that is about to inherit a Theocracy or Republic
			NOT = {
				any_heir_title = {
					OR = {
						AND = {
							is_republic = yes
							ROOT_FROMFROM = { is_republic = no }
						}
						AND = {
							is_merchant_republic = yes
							ROOT_FROMFROM = { is_merchant_republic = no }
						}
						AND = {
							NOT = { ROOT_FROM = { religion_group = muslim } }
							is_theocracy = yes
							ROOT_FROMFROM = { is_theocracy = no }
						}
					}
				}
			}
		}
		OR = { #If the title controls the religion, candidates must be of the same religion.
			NOT = { ROOT_FROMFROM = { controls_religion = yes } }
			religion = ROOT
		}
		OR = { #Make sure MR titles can only be inherited by patricians
			ROOT_FROMFROM = { is_merchant_republic = no }
			AND = {
				vassal_of = ROOT
				OR = {
					is_patrician = yes
					any_heir_title = { ROOT = { family_palace = { title = PREVPREV } } }
				}
			}
		}
		OR = { #Make sure patrician titles stay within the dynasty
			ROOT = {
				OR = {
					is_patrician = no
					NOT = { family_palace = { ROOT_FROMFROM = { succ_law_title = { title = PREVPREV } } } }
				}
			}
			dynasty = ROOT
		}
	}
}

# can THIS character theoretically inherit normal titles?
emf_can_inherit = {
	custom_tooltip = {
		text = CAN_INHERIT_TITLES
		emf_can_inherit_if_not_bastard = yes
		NOT = { trait = bastard }
	}
}
emf_cannot_inherit = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = CAN_INHERIT_TITLES_NOT
		emf_can_inherit = no
	}
}

emf_can_inherit_if_not_bastard = {
	custom_tooltip = {
		text = COULD_INHERIT_TITLES_IF_NOT_BASTARD
		emf_can_inherit_if_not_bastard_or_bishop_nominee = yes
		emf_is_bishop_nominee = no
	}
}
emf_cannot_inherit_if_not_bastard = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = COULD_INHERIT_TITLES_IF_NOT_BASTARD_NOT
		emf_can_inherit_if_not_bastard = no
	}
}

emf_can_inherit_if_not_bishop_nominee = {
	custom_tooltip = {
		text = COULD_INHERIT_TITLES_IF_NOT_BISHOP_NOMINEE
		emf_can_inherit_if_not_bastard_or_bishop_nominee = yes
		NOT = { trait = bastard }
	}
}
emf_cannot_inherit_if_not_bishop_nominee = {
	custom_tooltip = {
		text = COULD_INHERIT_TITLES_IF_NOT_BISHOP_NOMINEE_NOT
		emf_can_inherit_if_not_bishop_nominee = no
	}
}

emf_can_inherit_if_not_bastard_or_bishop_nominee = {
	NOR = {
		has_inheritance_blocker = yes # all cannot_inherit = yes traits
		is_consort = yes # Concubines cannot inherit
		AND = {
			OR = {
				is_theocracy = yes
				has_character_flag = needs_fake_feudal_government # Makes sure theocracy religion switch won't cause people to get fired
			}
			religion_scope = { NOT = { has_flag = emf_priests_can_inherit } }
		}
		is_offmap_ruler = yes
		holy_order = yes
		any_liege = { NOT = { holy_order = no } } # Structered funnily in order to avoid an assert for some reason
		emf_is_disinherited_from_blinding = yes
	}
}

emf_is_bishop_nominee = {
	custom_tooltip = {
		text = IS_NOMINATED_SUCCESSOR_TO_BISHOPRIC
		is_ruler = no
		any_heir_title = {
			OR = {
				is_theocracy = yes
				has_flag = needs_fake_feudal_government # Makes sure theocracy religion switch won't cause people to get fired
			}
			succ_law_title = { has_law = succ_catholic_bishopric }
		}
	}
}
emf_is_not_bishop_nominee = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = IS_NOMINATED_SUCCESSOR_TO_BISHOPRIC_NOT
		emf_is_bishop_nominee = no
	}
}

emf_is_disinherited_from_blinding = {
	custom_tooltip = {
		text = IS_DISINHERITED_FROM_BLINDING
		trait = blinded
		OR = { # TODO: this culture(_group)? list should be code-generated
			culture_group = byzantine
			culture = kasogi # TODO: Audax Validator IGNORE_XXXX directive, SWMH-only
			culture = roman
		}
	}
}
emf_is_not_disinherited_from_blinding = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = IS_DISINHERITED_FROM_BLINDING_NOT
		emf_is_disinherited_from_blinding = no
	}
}

emf_isolated_character = {
	custom_tooltip = {
		text = IS_ISOLATED_CHARACTER
		OR = {
			character = event_target:isis
			trait = emf_isis_courtier
		}
	}
}
emf_not_isolated_character = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = IS_ISOLATED_CHARACTER_NOT
		emf_isolated_character = no
	}
}

# for modifier/trait `is_visible` blocks:
emf_hidden = {
	OR = {
		character = event_target:isis # playable isis conveniently sees all
		has_global_flag = emf_debug # so does debug mode
	}
}

emf_hidden_from_others = {
	OR = {
		character = FROM # character themselves
		character = event_target:isis # playable isis conveniently sees all
		has_global_flag = emf_debug # so does debug mode
	}
}

# return all people on the proverbial council regardless of DLC:
emf_is_voter = {
	custom_tooltip = {
		text = EMF_IS_VOTER
		OR = {
			is_voter = yes
			is_councillor = yes
		}
	}
}
emf_is_not_voter = { # Use this for tooltips instead of <trigger> = no
	custom_tooltip = {
		text = EMF_IS_VOTER_NOT
		emf_is_voter = no
	}
}

# check whether a character can convert to another religion (though this can fail to return true when it's still OK for the
# character to willfully choose to convert to another religion for whatever reason):
emf_can_convert_religion = {
	can_change_religion = yes
	OR = {
		ai = no
		NOT = { has_flag = ai_flag_refuse_conversion }
	}
}

emf_can_convert_culture = {
	OR = {
		ai = no
		NOT = { has_flag = emf_ai_never_convert_culture }
	}
}

emf_minor_title_basic_allowed_to_hold = {
	OR = {
		is_ruler = no
		NOT = { primary_title = { temporary = yes } }
	}
	hidden_trigger = { emf_isolated_character = no }
}

emf_hiprio_decision_basic_potential = {
	OR = {
		AND = {
			multiplayer = yes
			NOT = { is_multiplayer_host_character = yes }
		}
		had_global_flag = { flag = EMF days = 1 }
	}
}

emf_can_disturb = {
	NOT = { has_flag = do_not_disturb }
}

emf_ROOT_completely_controls_counties = {
	custom_tooltip = {
		text = emf_ctt_ROOT_completely_controls_counties
		hidden_tooltip = {
			NOT = {
				any_de_jure_vassal_title = {
					tier = COUNT
					owner_under_ROOT = no
				}
			}
		}
	}
}

emf_nomadic_province = {
	NOT = {
		any_province_holding = {
			NOR = {
				holding_type = nomad
				AND = {
					holding_type = tribal
					has_flag = emf_built_by_latb
				}
			}
		}
	}
}

emf_is_freckles_graphical_culture = {
	OR = {
		graphical_culture = norsegfx
		graphical_culture = saxongfx
		graphical_culture = celticgfx
		AND = {
			culture = uyghur
			graphical_culture = cumangfx
		}
	}
}

emf_is_chinese_imperial_culture = {
	OR = {
		culture_group = chinese_group
		culture = khitan
		culture = tangut
		culture = jurchen
	}
}

emf_is_sterile_trigger = {
	OR = {
		trait = sterile_secret
		trait = sterile_known
		has_flag = emf_is_sterile
	}
}

# Character doesn't have a caste trait at startup (because it's missing from character history), but probably needs one
emf_needs_caste_trait_at_startup = {
	emf_religion_has_castes = yes
	NOR = {
		trait = brahmin
		trait = kshatriya
		trait = vaishya
		trait = peasant_leader
		trait = peasant_ruler
		has_flag = emf_caste_exception
	}
}

emf_willing_to_consider_incest_despite_religion = {
	OR = {
		ai = no # Humans have agency
		AND = {
			NOR = {
				trait = zealous
				ai_zeal = 40
			}
			OR = {
				trait = lustful
				trait = hedonist
				trait = possessed
				trait = lunatic
			}
		}
		AND = {
			NOR = {
				trait = zealous
				ai_zeal = 0
			}
			trait = arbitrary
		}
		has_character_modifier = voice_of_satan
	}
}

emf_requires_workaround_for_religion_switch = {
	is_landed = yes
	government = theocracy_government
}

# emf_has_swmh located in emf_is_swmh_trigger.txt so that it can easily be overwritten at install time

emf_not_has_swmh = { # Defined separately to give a custom negation tooltip
	custom_tooltip = {
		text = emf_ctt_swmh_trigger_not
		emf_has_swmh = no
	}
}

# opinion mods for things like "can imprison" or "can execute"
# [which is it? a smattering of the gist, or specifically execution? -Z 2017/12/20 ]
# TODO: this really needs an update/clarify: see the dissonance w/ vanilla's remove_opinions_with_prison_reason_effect in
# 00_scripted_effects.txt
emf_can_execute_ROOT = {
	OR = {
		has_opinion_modifier = { who = ROOT modifier = declared_war }
		has_opinion_modifier = { who = ROOT modifier = opinion_traitor }
		has_opinion_modifier = { who = ROOT modifier = opinion_rebel_traitor }
		has_opinion_modifier = { who = ROOT modifier = opinion_regicide_traitor }
		has_opinion_modifier = { who = ROOT modifier = opinion_targeted_by_adventurer }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_spouse }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_spouse_vassal }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_child }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_parent }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_sibling }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder_of_vassal }
		has_opinion_modifier = { who = ROOT modifier = attempted_murder }
		has_opinion_modifier = { who = ROOT modifier = opinion_spouse_slayer }
		has_opinion_modifier = { who = ROOT modifier = opinion_murder_attempt }
		has_opinion_modifier = { who = ROOT modifier = opinion_killed_close_kin }
		has_opinion_modifier = { who = ROOT modifier = opinion_killed_father }
		has_opinion_modifier = { who = ROOT modifier = opinion_hajj_attempt_murder }
		has_opinion_modifier = { who = ROOT modifier = opinion_castrated_me }
		has_opinion_modifier = { who = ROOT modifier = opinion_blinded_me }
		has_opinion_modifier = { who = ROOT modifier = opinion_witch }
		has_opinion_modifier = { who = ROOT modifier = opinion_unfaithful_wife }
		has_opinion_modifier = { who = ROOT modifier = opinion_unfaithful_husband_crime }
		has_opinion_modifier = { who = ROOT modifier = opinion_cuckolded }
		has_opinion_modifier = { who = ROOT modifier = slut_seductress }
		has_opinion_modifier = { who = ROOT modifier = opinion_tortured_me }
		has_opinion_modifier = { who = ROOT modifier = opinion_mutilated_me }
		has_opinion_modifier = { who = ROOT modifier = opinion_mutilated_family }
		has_opinion_modifier = { who = ROOT modifier = opinion_mutilated_close_kin }
		has_opinion_modifier = { who = ROOT modifier = attempted_kidnapping }
		has_opinion_modifier = { who = ROOT modifier = attempted_kidnapping_of_kin }
		has_opinion_modifier = { who = ROOT modifier = attempted_kidnapping_of_vassal }
		has_opinion_modifier = { who = ROOT modifier = devious_plotter }
		has_opinion_modifier = { who = ROOT modifier = opinion_kidnapped_kin }
		has_opinion_modifier = { who = ROOT modifier = opinion_kidnapped_vassal }
		has_opinion_modifier = { who = ROOT modifier = opinion_civil_war_loser }
	}
}

# all non-hordes (retinues) have this in their purchase/hire requirements
emf_retinue_hire_basic_potential = {
	is_nomadic = no
	OR = {
		ai = no
		is_patrician = yes
		is_merchant_republic = yes
		AND = {
			higher_real_tier_than = COUNT
			yearly_income = 120 # 10g/month
			OR = {
				realm_size = 21
				num_of_count_titles_in_realm = 7
			}
		}
	}
}

emf_is_building_construction_allowed = {
	show_only_failed_conditions = yes
	trigger_if = {
		limit = {
			had_global_flag = { flag = EMF days = 1 }
			FROM = { ai = yes }
		}
		FROM = { war = no }
	}
}

# considered "Good Enough Peace" for the realm for the purposes of tracking whether and how long since a realm/ruler has had
# relatively uninterrupted peace. currently only used for the 'See The Realm Prosper' ambition.
emf_has_primary_peace = {
	custom_tooltip = {
		text = TT_HAS_PRIMARY_PEACE
		hidden_tooltip = {
			NOT = {
				any_war = {
					OR = {
						attacker = { character = PREV }
						AND = {
							defender = { character = PREV }
							NOR = {
								using_cb = peasant_revolt
								using_cb = heretic_revolt
								using_cb = cb_minor_clan_revolt
								using_cb = liberation_revolt
								using_cb = emf_revolt_religious
								using_cb = emf_decadence_revolt
							}
						}
					}
				}
			}
		}
	}
}

# Succession laws that no feudal ruler's titles should have and that cannot be readily changed:
emf_has_succ_law_unfit_for_feudal = {
	OR = {
		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
		has_law = succ_offmap_succession
	}
}

# Used by emf_abdicate effect
emf_revolting_against_abdicator_internal = {
	any_war = {
		defender = {
			character = event_target:emf_abdicator_tmp
		}
		attacker = {
			character = PREV
			independent = no
			OR = {
				in_revolt = yes
				liege_before_war = {
					character = event_target:emf_abdicator_tmp
				}
			}
			liege = {
				OR = {
					character = PREV
					event_target:emf_abdicator_tmp = {
						is_liege_or_above = PREV
					}
				}
			}
		}
	}
}

# largely for debugging:
emf_has_any_succ_law = {
	OR = {
		has_law = succ_gavelkind
		has_law = succ_elective_gavelkind
		has_law = succ_eldership
		has_law = succ_seniority
		has_law = succ_primogeniture
		has_law = succ_feudal_elective
		has_law = succ_hre_elective
		has_law = succ_aztec_elective
		has_law = succ_byzantine_elective
		has_law = succ_tanistry
		has_law = succ_pictish_elective
		has_law = succ_dynastic_elective
		has_law = succ_ultimogeniture
#		has_law = succ_mirath
		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
		has_law = succ_offmap_succession
	}
}

emf_has_any_gender_succ_law = {
	OR = {
		has_law = agnatic_succession
		has_law = cognatic_succession
		has_law = true_cognatic_succession
		has_law = enatic_succession
		has_law = enatic_cognatic_succession
	}
}
