﻿suitable_faith_for_undirected_ghw_trigger = {
	OR = {
		has_doctrine_parameter = great_holy_wars_active
		AND = {
			has_doctrine_parameter = great_holy_wars_active_if_reformed
			NOT = { has_doctrine_parameter = unreformed }
		}
		has_doctrine = divine_destiny_doctrine #SPECIAL: Has become the Chakravarti
	}
	has_doctrine = doctrine_spiritual_head
	NOR = {
		has_doctrine_parameter = unreformed
		AND = {
			has_doctrine = tenet_dharmic_pacifism
			NOT = { has_doctrine = divine_destiny_doctrine }
		}
		has_doctrine = tenet_pacifism
	}
	OR = {
		AND = {
			fervor >= 50 #MODDED from vanilla 75
			OR = {
				holy_sites_controlled < 5
				num_county_followers < 1100
			}
		}
		AND = {
			fervor >= 70
			holy_sites_controlled >= 5
			num_county_followers >= 1100
		}
	}
	save_temporary_scope_value_as = {
		name = faith_strength
		value = faith_military_strength
	}
	save_temporary_scope_as = faith
	any_kingdom = {
		valid_ghw_target_trigger = { FAITH = scope:faith }
	}
}

suitable_faith_for_directed_ghw_trigger = {
	OR = {
		has_doctrine = tenet_armed_pilgrimages #Catholics
		has_doctrine = tenet_struggle_submission #Islam (though, the default Faiths have Temporal Heads, so still do not qualify)
		has_doctrine = tenet_warmonger #Germanic (though, starting as Unreformed, it still doesn't qualify by default)
		has_doctrine = divine_destiny_doctrine #SPECIAL: Has become the Chakravarti
	}	
	has_doctrine = doctrine_temporal_head
	NOR = {
		has_doctrine_parameter = unreformed
		AND = {
			has_doctrine = tenet_dharmic_pacifism
			NOT = { has_doctrine = divine_destiny_doctrine }
		}
		has_doctrine = tenet_pacifism
	}
	OR = {
		AND = {
			fervor >= 50 #MODDED from vanilla 75
			OR = {
				holy_sites_controlled < 5
				num_county_followers < 1100
			}
		}
		AND = {
			fervor >= 70
			holy_sites_controlled >= 5
			num_county_followers >= 1100
		}
	}
}

suitable_faith_for_any_ghw_trigger = {
	OR = {
		has_doctrine = tenet_armed_pilgrimages #Catholics
		has_doctrine = tenet_struggle_submission #Islam (though, the default Faiths have Temporal Heads, so still do not qualify)
		has_doctrine = tenet_warmonger #Germanic (though, starting as Unreformed, it still doesn't qualify by default)
		has_doctrine = divine_destiny_doctrine #SPECIAL: Has become the Chakravarti
	}
	OR = {
		has_doctrine = doctrine_temporal_head
		has_doctrine = doctrine_spiritual_head
	}
	NOR = {
		has_doctrine_parameter = unreformed
		AND = {
			has_doctrine = tenet_dharmic_pacifism
			NOT = { has_doctrine = divine_destiny_doctrine }
		}
		has_doctrine = tenet_pacifism
	}
	fervor >= 40 #MODDED from vanilla 65 so that GHWs will activate
}

valid_ghw_target_trigger = {
	exists = capital_vassal.capital_vassal
	any_in_de_jure_hierarchy = {
		continue = { tier > tier_county }
		tier = tier_county
																   
		count >= 5
   
		$FAITH$ = {
			is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.top_liege.faith }
		}
	}
	NOT = {
		any_in_de_jure_hierarchy = {
			continue = { tier > tier_county }
			tier = tier_county
			$FAITH$ = {
				is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.top_liege.faith }
				#Consider hashing out to force more great holy wars
				prev.holder.top_liege.current_military_strength > { value = scope:faith_strength }
			}
		}
	}
}