namespace = HF

#Written by Joachim 
#HF.40000 - HF.40099

#A character is eligible for Beatification
character_event = {
	id = HF.40000
	hide_window = yes
	is_triggered_only = yes
	min_age = 16
	only_playable = yes
	has_dlc = "Holy Fury"

	trigger = {
		OR = {
			religion_group = christian
			religion_group = latter_day_saints
		}
		death_in_china_trigger = no
		death_no_trace_trigger = no
		NOR = {
			trait = excommunicated
			trait = drunkard
			trait = hedonist
			trait = cannibal_trait
			#controls_religion = yes
			religion = evangelical
			religion = charismatic
			religion = antinomian
			religion = postadventist
			religion = anabaptist
			religion = batenburger
			is_any_kinslayer_trigger = yes
			has_character_modifier = voice_of_satan
			has_character_modifier = known_satanist
			has_character_modifier = suspected_demon_spawn
			has_character_modifier = suspected_witch
			has_character_modifier = known_witch
			has_character_modifier = crazy_cannibal
			has_character_modifier = demon_child_non_pagan
			has_character_modifier = corrupting_magic_minor
			has_character_modifier = corrupting_magic_major

			any_claim = { title = k_papal_state } # Antipopes
			any_claim = { title = k_ursuline } # Antipopes
			any_claim = { title = k_high_church } # Antipopes
			any_claim = { title = d_quorum_of_the_twelve } # Antipopes
		}
		OR = {
			AND = {
				tier = Emperor
				piety >= 1250
			}

			AND = {
				tier = King
				piety >= 1000
			}
			AND = {
				tier = Duke
				piety >= 750
			}
			AND = {
				tier = Count
				piety >= 500
			}
			has_character_modifier = true_christian_knight
			has_any_opinion_modifier = opinion_baptism_sponsor_target
		}
		has_vice_trigger = no
		is_benevolent_trigger = yes
		is_pious_trigger = yes
		has_virtue_trigger = yes
		is_adult = yes
	}

	immediate = {
		#Beatification
		save_event_target_as = saint_person
		event_target:saint_person = {
			capital_scope = {
				save_event_target_as = saint_capital
			}
		}
		random_demesne_province = {
			limit = {
				NOR = {
					has_province_modifier = tomb_of_a_saint
					has_province_modifier = pillaged_tomb_of_a_saint
				}
			}
			save_event_target_as = random_saint_demesne_province
		}
		random_realm_province = {
			limit = {
				NOR = {
					has_province_modifier = tomb_of_a_saint
					has_province_modifier = pillaged_tomb_of_a_saint
				}
			}
			save_event_target_as = random_saint_realm_province
		}
		if = {
			limit = {
				OR = {
					religion_group = christian
					religion_group = latter_day_saints
				}
			}
			random_realm_character = {
				limit = {
					is_theocracy = yes
					religion = event_target:saint_person
					NOR = {
						trait = bad_priest_christian
						trait = bad_priest_mormon
					}
					is_landed = yes
				}
				random = {
					chance = 100
					modifier = {
						factor = 0.25
						event_target:saint_person = {
							any_owned_bloodline = {
								has_bloodline_flag = saintly_bloodline
							}
						}
					}
					modifier = {
						factor = 0.8
						event_target:saint_person = {
							trait = cynical
						}
					}
					random_realm_province = {
						province_event = { id = HF.40001 }
					}
					event_target:saint_person = {
						set_character_flag = beatified
					}
				}
			}
		}

		if = {
			limit = {
				event_target:saint_person = {
					ai = no
				}
			}
			event_target:saint_person = {
				add_trait = i_used_to_be_a_player
			}
		}
		#Potential for sainthood
		deciding_upon_saint_effect = yes
	}
}

#Decision if to be Beatified
province_event = {
	id = HF.40001
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	immediate = {
		if = {
			limit = {
				has_global_flag = qa_testing
			}
			province_event = { id = HF.40002 days = 3 }
		}
		else = {
			province_event = { id = HF.40002 days = 180 random = 360 }
		}
	}
}

#Decision has been made to be Beatified
province_event = {
	id = HF.40002
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	immediate = {
		holder_scope = {
			if = {
				limit = {
					OR = {
						has_global_flag = only_papal_saints
						has_global_flag = only_abbess_saints
						has_global_flag = only_archbishop_saints
						has_global_flag = only_presidential_saints
					}
					event_target:saint_person = {
						OR = {
							religion = catholic
							religion = ursuline
							religion = high_church
							religion = mormon
						}
					}
				}
				rightful_religious_head_scope = {
					character_event = { id = HF.40005 }
				}
			}
			else = {
				random_realm_character = {
					limit = {
						is_theocracy = yes
						religion = event_target:saint_person
						NOR = {
							trait = bad_priest_christian
							trait = bad_priest_mormon
						}
						is_landed = yes
					}
					character_event = { id = HF.40003 }
				}
			}
		}
	}
}

#Local priest sends out letters declaring beatification
character_event = {
	id = HF.40003
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	immediate = {
		save_event_target_as = bishopric_holder
		event_target:saint_person = {
			add_trait = beatified
			if = {
				limit = {
					is_female = yes
				}
				set_special_character_title = BLESSED_TITLE_FEMALE
			}
			else = {
				set_special_character_title = BLESSED_TITLE
			}
		}
		top_liege = {
			any_realm_character = {
				limit = {
					NOT = {
						family = event_target:saint_person
					}
					religion_group = ROOT
				}
				narrative_event = { id = HF.40004 }
				set_character_flag = had_beatification_notification #Flags to make sure you only get the event once
			}
		}
		event_target:saint_person = {
			any_dynasty_member = {
				limit = {
					religion_group = ROOT
					NOT = { has_character_flag = had_beatification_notification }
				}
				narrative_event = { id = HF.40004 }
				set_character_flag = had_beatification_notification
			}
		}
		top_liege = {
			if = {
				limit = {
					NOR = {
						family = event_target:saint_person
						has_character_flag = had_beatification_notification
					}
					religion_group = ROOT
				}
				narrative_event = { id = HF.40004 }
			}
		}
	}
	after = { #To remove the flags
		any_realm_character = {
			limit = {
				has_character_flag = had_beatification_notification
			}
			clr_character_flag = had_beatification_notification
		}
		event_target:saint_person = {
			any_dynasty_member = {
				limit = {
					has_character_flag = had_beatification_notification
				}
				clr_character_flag = had_beatification_notification
			}
		}
		top_liege = {
			if = {
				limit = {
					has_character_flag = had_beatification_notification
				}
				clr_character_flag = had_beatification_notification
			}
		}
	}
}

#Beatification is made official
narrative_event = {
	id = HF.40004
	title = TITLEHF.40004
	desc = EVTDESC_HF_40004
	portrait = event_target:saint_person
	is_triggered_only = yes
	picture = GFX_evt_beatification
	border = GFX_event_narrative_frame_religion
	has_dlc = "Holy Fury"

	option = {
		name = EVTOPTAHF.40004
		if = {
			limit = {
				event_target:saint_person = {
					family = ROOT
				}
			}
			piety = 50
		}
		show_portrait = event_target:bishopric_holder
	}
}

#Pope sends out letters declaring beatification
character_event = {
	id = HF.40005
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	immediate = {
		event_target:saint_person = {
			add_trait = beatified
			if = {
				limit = {
					is_female = yes
				}
				set_special_character_title = BLESSED_TITLE_FEMALE
			}
			else = {
				set_special_character_title = BLESSED_TITLE
			}
		}
		event_target:saint_person = {
			primary_title = {
				holder_scope = {
					any_realm_character = {
						limit = {
							NOT = {
								family = event_target:saint_person
							}
						religion_group = ROOT
						}
						narrative_event = { id = HF.40006 }
					}
				}
			}
		}
		event_target:saint_person = {
			any_dynasty_member = {
				limit = {
					religion_group = ROOT
				}
				narrative_event = { id = HF.40006 }
			}
		}
		event_target:saint_person = {
			primary_title = {
				holder_scope = {
					top_liege = {
						if = {
							limit = {
								NOT = {
									family = event_target:saint_person
								}
								religion_group = ROOT
							}
							narrative_event = { id = HF.40006 }
						}
					}
				}
			}
		}
	}
}

#Papal beatification Event
narrative_event = {
	id = HF.40006
	desc = EVTDESC_HF_40006
	title = TITLEHF.40006
	picture = GFX_evt_beatification
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	portrait = event_target:saint_person
	has_dlc = "Holy Fury"

	option = {	
		name = EVTOPTA_HF_40006
		if = {
			limit = {
				event_target:saint_person = {
					family = ROOT
				}
			}
			piety = 250
			religion_head = {
				opinion = {
					modifier = opinion_family_saint
					who = ROOT
					years = 10
				}
			}
			random_vassal = {
				limit = {
					is_priest = yes
					religion_head = { NOT = { character = PREV } }
				}
				opinion = {
					modifier = opinion_family_saint
					who = ROOT
					years = 10
				}
			}
		}
		show_portrait = FROM
	}
}

#Checking time left to Canonization
character_event = {
	id = HF.40010
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	immediate = {
		if = {
			limit = {
				OR = {
					has_global_flag = qa_testing
					event_target:saint_person = {
						has_religion_feature = religion_beatification
					}
					event_target:saint_person = {
						has_religion_feature = religion_feature_revelationist
					}
					event_target:saint_person = {
						has_religion_feature = religion_feature_trailwalker
					}
				}
			}
			province_event = { id = HF.40015 days = 5 }
		}
		else_if = {
			limit = {
				event_target:saint_person = {
					trait = i_used_to_be_a_player
				}
			}
			province_event = { id = HF.40015 days = 1000 random = 1000 }
		}
		else = {
			province_event = { id = HF.40015 days = 1000 random = 10000 }
		}
	}
}

#Preparing Canonization
province_event = {
	id = HF.40015
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	trigger = {
		event_target:saint_person = {
			OR = {
				trait = beatified
				has_religion_feature = religion_beatification
				has_religion_feature = religion_feature_trailwalker
				has_religion_feature = religion_feature_revelationist
			}
			NOT = {
				has_character_flag = blessed_ancestor_prestige
			}
		}
	}

	immediate = { 
		if = {
			limit = {
				event_target:saint_capital = {
					owner = {
						religion = event_target:saint_person
					}
				}
			}
			event_target:saint_capital = {
				owner = {
					rightful_religious_head_scope = {
						character_event = { id = HF.40020 }
					}
				}
			}
		}
		else = {
			event_target:saint_person = {
				rightful_religious_head_scope = {
					character_event = { id = HF.40020 }
				}
			}		
		}
	}
}

#Canonization
character_event = {
	id = HF.40020
	desc = {
		trigger = {
			event_target:saint_person = {
				OR = {
					religion_group = christian
					religion_group = cult_of_saints
					religion_group = latter_day_saints
				}
			}
		}
		text = EVTDESC_HF_40020_A
	} 
	desc = {
		trigger = {
			event_target:saint_person = {
				OR = {
					religion_group = pagan_group
					religion_group = afro_syncretic
					religion_group = american_native
				}
			}
		}
		text = EVTDESC_HF_40020_B
	}
	picture = GFX_evt_council
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	immediate = {
		save_event_target_as = canonizer_person
	}

	option = {
		name = EVTOPTA_HF_40020
		trigger_switch = {
			on_trigger = religion_group
			christian = {
				custom_tooltip = {
					text = pope_cannonize_choice_TT
				}
			}
			cult_of_saints = {
				custom_tooltip = {
					text = pope_cannonize_choice_TT
				}
			}
			latter_day_saints = {
				custom_tooltip = {
					text = pope_cannonize_choice_TT
				}
			}
			pagan_group = {
				custom_tooltip = {
					text = pagan_pope_cannonize_choice_TT
				}
			}
			afro_syncretic = {
				custom_tooltip = {
					text = pagan_pope_cannonize_choice_TT
				}
			}
			american_native = {
				custom_tooltip = {
					text = pagan_pope_cannonize_choice_TT
				}
			}
		}

		hidden_tooltip = {
			# Find Miracle - Christian only
			if = {
				limit = {
					event_target:saint_person = {
						OR = {
							religion_group = christian
							religion_group = cult_of_saints
							religion_group = latter_day_saints
						}
					}
				}
				random_list = {
					#Stigmata
					100 = {
						set_variable = { which = global_miracle value = 1 }
						event_target:saint_person = {
							give_nickname = nick_the_god_bearing
						}
					}
					#Incorruptible body
					100 = {
						set_variable = { which = global_miracle value = 2 }
						event_target:saint_person = {
							give_nickname = nick_the_myrrh_streaming
						}
					}
					#Miraculous healing
					800 = {
						trigger = {
							event_target:saint_person = {
								trait = physician
							}
						}
						set_variable = { which = global_miracle value = 3 }
						if = {
							limit = {
								event_target:saint_person = {
									trait = charitable
								}
							}
							event_target:saint_person = {
								give_nickname = nick_the_unmercenary_healer
							}
						}
						else = {
							event_target:saint_person = {
								give_nickname = nick_the_healer
							}
						}
					}
					#Prophetic Foresight
					200 = {
						trigger = {
							event_target:saint_person = {
								OR = {
									trait = mystic
									trait = possessed
								}
							}
						}
						set_variable = { which = global_miracle value = 4 }
						event_target:saint_person = {
							give_nickname = nick_the_prophet
						}
					}
					#Mindreading
					100 = {
						set_variable = { which = global_miracle value = 5 }
						event_target:saint_person = {
							give_nickname = nick_the_understanding
						}
					}
					#Exorciser
					100 = {
						trigger = {
							event_target:saint_person = {
								trait = zealous
							}
						}
						set_variable = { which = global_miracle value = 6 }
						event_target:saint_person = {
							give_nickname = nick_the_righteous
						}
					}
					#Angel talker
					100 = {
						set_variable = { which = global_miracle value = 7 }
						event_target:saint_person = {
							give_nickname = nick_the_apostle
						}
					}
					#Waterwalker
					50 = {
						set_variable = { which = global_miracle value = 8 }
						event_target:saint_person = {
							give_nickname = nick_the_confessor
						}
					}
					#Heard after death
					50 = {
						set_variable = { which = global_miracle value = 9 }
						event_target:saint_person = {
							give_nickname = nick_the_venerable
						}
					}
					#Creating fire
					25 = {
						set_variable = { which = global_miracle value = 10 }
						event_target:saint_person = {
							give_nickname = nick_the_spark_of_god
						}
					}
					#Praying heavy object away
					50 = {
						set_variable = { which = global_miracle value = 11 }
						event_target:saint_person = {
							give_nickname = nick_the_right_believing
						}
					}
					#Being seen after death
					25 = {
						trigger = {
							event_target:saint_person = {
								martyrs_death_trigger = yes
							}
						}
						set_variable = { which = global_miracle value = 12 }
						event_target:saint_person = {
							give_nickname = nick_the_martyr
						} 
					}
					#Blessing local water with the power of love
					25 = {
						set_variable = { which = global_miracle value = 13 }
						event_target:saint_person = {
							give_nickname = nick_the_miracle_worker 
						}
					}
					#Rats
					25 = {
						trigger = {
							event_target:saint_person = {
								trait = lunatic
							}
						}
						set_variable = { which = global_miracle value = 14 }
						event_target:saint_person = {
							give_nickname = nick_the_fool_for_christ
						}
					}
					#Wise dog
					25 = {
						set_variable = { which = global_miracle value = 15 }
						event_target:saint_person = {
							give_nickname = nick_the_merciful 
						}
					}
					#Flying
					25 = {
						set_variable = { which = global_miracle value = 16 }
						event_target:saint_person = {
							give_nickname = nick_the_pious
						}
					}
				}
			}
			# Give nickname - Pagan only
			if = {
				limit = {
					event_target:saint_person = {
						OR = {
							religion_group = pagan_group
							religion_group = afro_syncretic
							religion_group = american_native
						}
						OR = {
							has_nickname = no
							has_nickname = nick_the_blessed
						}
					}
				}
				event_target:saint_person = {
					random_list = {
						1 = {
							give_nickname = nick_the_noble
						}
						1 = {
							give_nickname = nick_the_gentle
						}
						3 = {
							trigger = {
								trait = chaste
							}
							give_nickname = nick_the_chaste
						}
						3 = {
							trigger = {
								trait = just
							}
							give_nickname = nick_the_just
						}
						3 = {
							trigger = {
								trait = fair
							}
							give_nickname = nick_the_fair
						}
						3 = {
							trigger = {
								trait = is_malnourished
							}
							give_nickname = nick_the_hollow
						}
						3 = {
							trigger = {
								OR = {
									trait = genius
									trait = shrewd
									trait = quick
									learning = 15
								}
							}
							give_nickname = nick_the_wise
						}
						3 = {
							trigger = {
								trait = one_eyed
							}
							give_nickname = nick_one_eye
						}
						3 = {
							trigger = {
								OR = {
									trait = strong
									trait = robust
								}
							}
							give_nickname = nick_the_bear
						}
						3 = {
							trigger = {
								trait = brave
							}
							give_nickname = nick_the_bold
						}
						15 = {
							trigger = {
								trait = hunter
								trait = brilliant_strategist
								culture_group = plains
							}
							give_nickname = nick_the_wolf
						}
					}
				}
			}
			# Messages
			any_playable_ruler = {
				limit = {
					NOT = {
						family = event_target:saint_person
					}
					religion = ROOT
				}
				narrative_event = { id = HF.40025 }
			}
			event_target:saint_person = {
				any_dynasty_member = {
					limit = {
						religion_group = ROOT
					}
					narrative_event = { id = HF.40025 }
				}
			}
			ROOT = {
				narrative_event = { id = HF.40025 }
			}
			# Trait change
			event_target:saint_person = {
				trigger_switch = {
					on_trigger = religion_group
					christian = {
						remove_trait = beatified
						add_trait = saint 
						if = {
							limit = {
								is_female = yes
							}
							set_special_character_title = SAINT_TITLE_FEMALE
						}
						else = {
							set_special_character_title = SAINT_TITLE
						}
					}
					cult_of_saints = {
						remove_trait = beatified
						add_trait = saint 
						if = {
							limit = {
								is_female = yes
							}
							set_special_character_title = SAINT_TITLE_FEMALE
						}
						else = {
							set_special_character_title = SAINT_TITLE
						}
					}
					latter_day_saints = {
						remove_trait = beatified
						add_trait = saint 
						if = {
							limit = {
								is_female = yes
							}
							set_special_character_title = SAINT_TITLE_FEMALE
						}
						else = {
							set_special_character_title = SAINT_TITLE
						}
					}
					pagan_group = {
						add_trait = blessed_ancestor
						set_special_character_title = BLESSED_TITLE
					}
					afro_syncretic = {
						add_trait = blessed_ancestor
						set_special_character_title = BLESSED_TITLE
					}
					american_native = {
						add_trait = blessed_ancestor
						set_special_character_title = BLESSED_TITLE
					}
				}
			}
			# Burial Site setting - Christian only
			if = {
				limit = {
					event_target:saint_person = {
						religion_group = christian
					}
				}
				#Confirm that a burial site exists, for pilgrimage
				set_global_flag = saintly_burial_sites_exist
				event_target:saint_capital = {
					owner = {
						save_event_target_as = saint_capital_owner
					}
				}
				if = {
					limit = {
						NOR = {
							event_target:saint_capital = {
								has_province_modifier = tomb_of_a_saint
							}
							event_target:saint_capital = {
								has_province_modifier = pillaged_tomb_of_a_saint
							}
						}
					}
					event_target:saint_capital = {
						setting_up_saintly_burial_site_effect = yes
					}
				}
				else_if = {
					limit = {
						event_target:saint_capital = {
							any_neighbor_province = {
								owner = {
									character = event_target:saint_capital_owner
								}
								NOR = {
									has_province_modifier = tomb_of_a_saint
									has_province_modifier = pillaged_tomb_of_a_saint
								}
							}
						}
					}
					event_target:saint_capital = {
						random_neighbor_province = {
							limit = {
								owner = {
									character = event_target:saint_capital_owner
								}
								NOR = {
									has_province_modifier = tomb_of_a_saint
									has_province_modifier = pillaged_tomb_of_a_saint
								}
							}
							setting_up_saintly_burial_site_effect = yes
						}
					}
				}
				else_if = {
					limit = {
						NOR = {
							event_target:random_saint_demesne_province = {
								has_province_modifier = tomb_of_a_saint
							}
							event_target:random_saint_demesne_province = {
								has_province_modifier = pillaged_tomb_of_a_saint
							}
						}
					}
					event_target:random_saint_demesne_province = {
						setting_up_saintly_burial_site_effect = yes
					}
				}
				else_if = {
					limit = {
						NOR = {
							event_target:random_saint_realm_province = {
								has_province_modifier = tomb_of_a_saint
							}
							event_target:random_saint_realm_province = {
								has_province_modifier = pillaged_tomb_of_a_saint
							}
						}
					}
					event_target:random_saint_realm_province = {
						setting_up_saintly_burial_site_effect = yes
					}
				}
			}
			# Bloodline creation
			random_list = {
				20 = {
					trigger = {
						event_target:saint_person = {
							OR = {
								trait = zealous
								trait = holy_warrior
							}
						}
					}
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_01
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_01
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_01
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_01
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = { #no religious head = no saints...
								create_bloodline = {
									type = saintly_bloodline_falling_star_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							norse_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_germanic_01
										religion = norse_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_germanic_01
										religion = norse_pagan_reformed
									}
								}
							}
							revelationist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_revelationist_01
										religion = revelationist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_revelationist_01
										religion = revelationist_reformed
									}
								}
							}
							occultist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_occultist_01
										religion = occultist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_occultist_01
										religion = occultist_reformed
									}
								}
							}
							glorian = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_glorian_01
										religion = glorian
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_glorian_01
										religion = glorian
									}
								}
							}
							celtic_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_celtic_01
										religion = celtic_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_celtic_01
										religion = celtic_pagan_reformed
									}
								}
							}
							aria_de_machete_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_01
										religion = aria_de_machete_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_01
										religion = aria_de_machete_reformed
									}
								}
							}
							sacred_heart = {
								if = {
								limit = {
									is_female = yes
								}
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_01
										religion = sacred_heart
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_01
										religion = sacred_heart
									}
								}
							}
							patria_grande = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_patria_grande_01
										religion = patria_grande
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_patria_grande_01
										religion = patria_grande
									}
								}
							}
							mormon = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
									}
								}
							}
							woolleyite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
									}
								}
							}
							strangite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
									}
								}
							}
							neogodbeite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_01
										religion = ROOT
									}
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_01
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = christian
										religion_group = cult_of_saints
										religion_group = latter_day_saints
									}
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = pagan_group
										religion_group = afro_syncretic
										religion_group = american_native
									}
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
				20 = {
					trigger = {
						has_dlc = "Mystics"
						OR = {
							event_target:saint_person = {
								trait = celibate
							}
							event_target:saint_person = {
								trait = monk
							}
							event_target:saint_person = {
								trait = nun
							}
						}
						OR = {
							event_target:saint_person = {
								religion_group = christian
							}
							event_target:saint_person = {
								religion_group = cult_of_saints
							}
							event_target:saint_person = {
								religion_group = latter_day_saints
							}
						}
					}
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_02
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_02
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_02
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_02
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_02
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
									religion_group = christian
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									religion_group = pagan_group
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
				5 = {
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_03
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_03
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_03
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_03
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_anabaptist_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							norse_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_germanic_03
										religion = norse_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_germanic_03
										religion = norse_pagan_reformed
									}
								}
							}
							revelationist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_revelationist_03
										religion = revelationist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_revelationist_03
										religion = revelationist_reformed
									}
								}
							}
							occultist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_occultist_03
										religion = occultist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_occultist_03
										religion = occultist_reformed
									}
								}
							}
							glorian = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_glorian_03
										religion = glorian
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_glorian_03
										religion = glorian
									}
								}
							}
							celtic_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_celtic_03
										religion = celtic_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_celtic_03
										religion = celtic_pagan_reformed
									}
								}
							}
							aria_de_machete_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_03
										religion = aria_de_machete_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_03
										religion = aria_de_machete_reformed
									}
								}
							}
							sacred_heart = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_03
										religion = sacred_heart
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_03
										religion = sacred_heart
									}
								}
							}
							patria_grande = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_patria_grande_03
										religion = patria_grande
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_patria_grande_03
										religion = patria_grande
									}
								}
							}
							mormon = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
									}
								}
							}
							woolleyite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
									}
								}
							}
							strangite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
									}
								}
							}
							neogodbeite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_03
										religion = ROOT
									}
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_03
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
								OR = {
										religion_group = christian
										religion_group = cult_of_saints
										religion_group = latter_day_saints
									}
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = pagan_group
										religion_group = afro_syncretic
										religion_group = american_native
									}
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
				5 = {
					modifier = {
						factor = 4
						OR = {
							event_target:saint_person = {
								trait = zealous
							}
							event_target:saint_person = {
								trait = holy_warrior
							}
						}
					}
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_04
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_04
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_04
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_04
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_high_church_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							norse_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_germanic_04
										religion = norse_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_germanic_04
										religion = norse_pagan_reformed
									}
								}
							}
							revelationist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_revelationist_04
										religion = revelationist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_revelationist_04
										religion = revelationist_reformed
									}
								}
							}
							occultist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_occultist_04
										religion = occultist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_occultist_04
										religion = occultist_reformed
									}
								}
							}
							glorian = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_glorian_04
										religion = glorian
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_glorian_04
										religion = glorian
									}
								}
							}
							celtic_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_celtic_04
										religion = celtic_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_celtic_04
										religion = celtic_pagan_reformed
									}
								}
							}
							aria_de_machete_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_04
										religion = aria_de_machete_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_04
										religion = aria_de_machete_reformed
									}
								}
							}
							sacred_heart = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_04
										religion = sacred_heart
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_04
										religion = sacred_heart
									}
								}
							}
							patria_grande = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_patria_grande_04
										religion = patria_grande
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_patria_grande_04
										religion = patria_grande
									}
								}
							}
							mormon = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
									religion = ROOT
									}
								}
							}
							woolleyite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
									religion = ROOT
									}
								}
							}
							strangite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
									religion = ROOT
									}
								}
							}
							neogodbeite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_04
									religion = ROOT
									}
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = christian
										religion_group = cult_of_saints
										religion_group = latter_day_saints
									}
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = pagan_group
										religion_group = afro_syncretic
										religion_group = american_native
									}
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
				30 = {
					trigger = {
						event_target:saint_person = {
							trait = sympathy_judaism
						}
					}
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_05
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_05
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_05
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_05
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_high_church_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_05
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							norse_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_germanic_05
										religion = norse_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_germanic_05
										religion = norse_pagan_reformed
									}
								}
							}
							revelationist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_revelationist_05
										religion = revelationist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_revelationist_05
										religion = revelationist_reformed
									}
								}
							}
							occultist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_occultist_05
										religion = occultist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_occultist_05
										religion = occultist_reformed
									}
								}
							}
							glorian = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_glorian_05
										religion = glorian
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_glorian_05
										religion = glorian
									}
								}
							}
							celtic_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_celtic_05
										religion = celtic_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_celtic_05
										religion = celtic_pagan_reformed
									}
								}
							}
							aria_de_machete_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_05
										religion = aria_de_machete_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_05
										religion = aria_de_machete_reformed
									}
								}
							}
							sacred_heart = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_05
										religion = sacred_heart
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_05
										religion = sacred_heart
									}
								}
							}
							patria_grande = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_patria_grande_05
										religion = patria_grande
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_patria_grande_05
										religion = patria_grande
									}
								}
							}
							mormon = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
									religion = ROOT
									}
								}
							}
							woolleyite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
									religion = ROOT
									}
								}
							}
							strangite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
									religion = ROOT
									}
								}
							}
							neogodbeite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_05
									religion = ROOT
									}
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_04
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = christian
										religion_group = cult_of_saints
										religion_group = latter_day_saints
									}
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = pagan_group
										religion_group = afro_syncretic
										religion_group = american_native
									}
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
				5 = {
					event_target:saint_person = {
						trigger_switch = {
							on_trigger = religion
							evangelical = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							antinomian = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							charismatic = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							postadventist = {
								create_bloodline = {
									type = saintly_bloodline_evangelical_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							ursuline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_06
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_06
										religion = event_target:saint_person
									}
								}
							}
							angeline = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_ursuline_06
										religion = event_target:saint_person
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_ursuline_06
										religion = event_target:saint_person
									}
								}
							}
							high_church = {
								create_bloodline = {
									type = saintly_bloodline_high_church_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							nonconformist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							anabaptist = {
								create_bloodline = {
									type = saintly_bloodline_high_church_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							batenburger = {
								create_bloodline = {
									type = saintly_bloodline_high_church_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							falling_star = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							moravian = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							wormwoodist = {
								create_bloodline = {
									type = saintly_bloodline_falling_star_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
							norse_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_germanic_06
										religion = norse_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_germanic_06
										religion = norse_pagan_reformed
									}
								}
							}
							revelationist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_revelationist_06
										religion = revelationist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_revelationist_06
										religion = revelationist_reformed
									}
								}
							}
							occultist_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_occultist_06
										religion = occultist_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_occultist_06
										religion = occultist_reformed
									}
								}
							}
							glorian = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_glorian_06
										religion = glorian
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_glorian_06
										religion = glorian
									}
								}
							}
							celtic_pagan_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_celtic_06
										religion = celtic_pagan_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_celtic_06
										religion = celtic_pagan_reformed
									}
								}
							}
							aria_de_machete_reformed = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_06
										religion = aria_de_machete_reformed
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_aria_de_machete_06
										religion = aria_de_machete_reformed
									}
								}
							}
							sacred_heart = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_06
										religion = sacred_heart
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_sacred_heart_06
										religion = sacred_heart
									}
								}
							}
							patria_grande = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_patria_grande_06
										religion = patria_grande
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_patria_grande_06
										religion = patria_grande
									}
								}
							}
							mormon = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
									religion = ROOT
									}
								}
							}
							woolleyite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
									religion = ROOT
									}
								}
							}
							strangite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
									religion = ROOT
									}
								}
							}
							neogodbeite = {
								if = {
									limit = {
										is_female = yes
									}
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
										religion = ROOT
										inheritance = all_descendants
									}
								}
								else = {
									create_bloodline = {
										type = saintly_bloodline_latter_day_saints_06
									religion = ROOT
									}
								}
							}
							fallback = {
								create_bloodline = {
									type = saintly_bloodline_catholic_06
									religion = event_target:saint_person
									inheritance = patrilineal
								}
							}
						}
						if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = christian
										religion_group = cult_of_saints
										religion_group = latter_day_saints
									}
								}
							}
							new_bloodline = {
								set_name = saintly_bloodline_name
								set_description = saintly_bloodline_description
							}
						}
						else_if = {
							limit = {
								event_target:saint_person = {
									OR = {
										religion_group = pagan_group
										religion_group = afro_syncretic
										religion_group = american_native
									}
								}
							}
							new_bloodline = {
								set_name = blessed_bloodline_name
								set_description = blessed_bloodline_description
							}
						}
					}
				}
			}
		}

		ai_chance = {
			factor = 1
		}
	}

	option = {
		name = EVTOPTB_HF_40020

		ai_chance = {
			factor = 0
		}
	}
}

#Notification about Burial Site
province_event = {
	id = HF.40021
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

 	immediate = {
 		owner = {
			character_event = { id = HF.40022 }
 		}
 	}
}

#Notification sent out to all players
character_event = {
	id = HF.40022
	desc = EVTDESC_HF_40022
	picture = GFX_evt_large_army
	is_triggered_only = yes
	notification = yes
	has_dlc = "Holy Fury"

	option = {	
		name = OK
	}
}

#Canonization Official
narrative_event = {
	id = HF.40025
	desc = {
		trigger = {
			event_target:saint_person = {
				OR = {
					religion_group = christian
					religion_group = cult_of_saints
					religion_group = latter_day_saints
				}
			}
		}
		text = EVTDESC_HF_40025
		picture = GFX_evt_beatification
	}
	desc = {
		trigger = {
			event_target:saint_person = {
				OR = {
					religion_group = pagan_group
					religion_group = afro_syncretic
					religion_group = american_native
				}
			}
		}
		text = EVTDESC_HF_40025_B
		picture = GFX_evt_pagan_reformation
	}
	title = EVTTITLE_HF_40025
	portrait = event_target:saint_person
	picture = GFX_evt_beatification
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	
	immediate = {
		if = {
			limit = {
				event_target:saint_person = {
					OR = {
						religion_group = christian
						religion_group = cult_of_saints
						religion_group = latter_day_saints
					}
				}
			}
			sound_effect = saint_proclaimed
		}
		opinion = {
			name = opinion_very_grateful_donation
			who = FROM
			years = 30
		}
	}

	option = {	
		name = EVTOPTA_HF_40025
		show_portrait = FROM
		if = {
			limit = {
				event_target:saint_person = {
					family = ROOT
				}
			}
			piety = 100
			if = {
				limit = {
					OR = {
						religion_group = christian
						religion_group = cult_of_saints
						religion_group = latter_day_saints
					}
				}
				custom_tooltip = { text = TT_CANONIZATION_FAMILY }
			}
			else_if = {
				limit = {
					OR = {
						religion_group = pagan_group
						religion_group = afro_syncretic
						religion_group = american_native
					}
				}
				custom_tooltip = { text = TT_PAGAN_CANONIZATION_FAMILY}
			}
		}
	}
}

#Bad Beatification
character_event = {
	id = HF.40050
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"
	min_age = 16

	trigger = {
		OR = {
 			trait = drunkard
 			trait = hedonist
		}
		#year = 900
		OR = {
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_papal_state
				}
				NOT = { has_global_flag = only_papal_saints }
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_ursuline
				}
				NOT = { has_global_flag = only_abbess_saints }
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_high_church
				}
				NOT = { has_global_flag = only_archbishop_saints }
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = d_quorum_of_the_twelve
				}
				NOT = { has_global_flag = only_presidential_saints }
			}
		}
	}

	weight_multiplier = {
		days = 1
		#After the year 2710
		modifier = {
			factor = 5
			year = 2710
			NOT = {
				year = 2750
			}
		}
		#After the year 2750
		modifier = {
			factor = 6
			year = 2750
			NOT = {
				year = 2800
			}
		}
		#After the year 2800
		modifier = {
			factor = 7
			year = 2800
			NOT = {
				year = 2850
			}
		}
		#After the year 2850
		modifier = {
			factor = 8
			year = 2850
		}
	}

	immediate = {
		save_event_target_as = saint_person
		random_realm_character = {
			limit = {
				is_theocracy = yes
				religion = ROOT
			}
			save_event_target_as = bishopric_holder 
			primary_title = {
				save_event_target_as = bishopric_title
			}
			random_realm_province = {
				province_event = { id = HF.40051 }
			}
		}
	}
}

#Bishop considers making a sinful Beatified
province_event = {
	id = HF.40051
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	immediate = {
		if = {
			limit = {
				has_global_flag = qa_testing
			}
			province_event = { id = HF.40052 days = 3 }
		}
		else = {
			province_event = { id = HF.40052 days = 180 random = 500 }
		}
	}
}

#Bishop decided to make a Sinful Beatified
province_event = {
	id = HF.40052
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	immediate = {
		holder_scope = {
			random_realm_character = {
				limit = {
					is_theocracy = yes
					religion = event_target:saint_person
					NOR = {
						OR = {
							trait = bad_priest_christian
							trait = bad_priest_mormon
						}
					}
					NOR = {
						event_target:saint_person = {
							trait = beatified
						}
						event_target:saint_person = {
							trait = saint
						}
					}
				}
				character_event = { id = HF.40053 }
			}
		}
	}
}

#Bishop sends out the letters with the news of the sinful Beatification
character_event = {
	id = HF.40053
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	trigger = {
		OR = {
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_papal_state
				}
				NOT = {
					has_global_flag = only_papal_saints
				}
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_ursuline
				}
				NOT = {
					has_global_flag = only_abbess_saints
				}
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = k_high_church
				}
				NOT = {
					has_global_flag = only_archbishop_saints
				}
			}
			AND = {
				rightful_religious_head_scope = {
					has_landed_title = d_quorum_of_the_twelve
				}
				NOT = {
					has_global_flag = only_presidential_saints
				}
			}
		}
		NOT = {
			has_global_flag = bad_beatification_completed
		}
	}

	immediate = {
		religion_authority = {
			modifier = impious_beatification
		}
		save_event_target_as = bishopric_holder
		event_target:saint_person = {
			add_trait = beatified
			if = {
				limit = {
					is_female = yes
				}
				set_special_character_title = BLESSED_TITLE_FEMALE
			}
			else = {
				set_special_character_title = BLESSED_TITLE
			}
			trigger_switch = {
				on_trigger = religion
				catholic = {
					set_global_flag = bad_catholic_saint
				}
				ursuline = {
					set_global_flag = bad_ursuline_saint
				}
				high_church = {
					set_global_flag = bad_high_church_saint
				}
				mormon = {
					set_global_flag = bad_mormon_saint
				}
			}
		}
		any_realm_character = {
			limit = {
				NOT = {
					family = event_target:saint_person
				}
			religion_group = ROOT
			}
			narrative_event = { id = HF.40055}
		}
		event_target:saint_person = {
			any_dynasty_member = {
				limit = {
					religion_group = ROOT
				}
				narrative_event = { id = HF.40055}
			}
		}
		top_liege = {
			if = {
				limit = {
					NOT = {
						family = event_target:saint_person
					}
					religion_group = ROOT
				}
				narrative_event = { id = HF.40055}
			}
		}
		random_realm_province = {
			province_event = { id = HF.40056 }
		}
		set_global_flag = bad_beatification_completed
	}
}

#Sinful Beatification event
narrative_event = {
	id = HF.40055

	#Disapprove of sinful Blessed
	desc = {
		trigger = {
			OR = {
				#Stranger, and dislike sinful beatified
				AND = {
					NOR = {
						trait = drunkard
						trait = hedonist
						event_target:saint_person = {
						family = ROOT
						}
					}
				}
				#Family member, and disapprove of sinful beatified
				AND = {
					NOR = {
							trait = drunkard
							trait = hedonist
					}
					event_target:saint_person = {
						family = ROOT
					}
				}
			}
		}
		text = EVTDESCA_HF_40055
	}

	#Approve of sinful beatified
	desc = {
		trigger = {
			OR = {
				#Not family member, but similar
				AND = {
					OR = {
						trait = drunkard
						trait = hedonist
					}
					NOT = {
						event_target:saint_person = {
							family = ROOT
						}
					}
				}
				#Family Member and similar
				AND = {
					OR = {
						trait = drunkard
						trait = hedonist
					}
					event_target:saint_person = {
						family = ROOT
					}
				}
			}
		}
		text = EVTDESCB_HF_40055
	} 

	title = TITLEHF.40055
	portrait = event_target:saint_person
	picture = GFX_evt_beatification	
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	#Stranger and disapprove
	option = {
		name = EVTOPTA_HF_40055
		trigger = {
			NOT = {
				OR = {
					trait = drunkard
					trait = hedonist
				}	
				event_target:saint_person = {
					family = ROOT
				}
			}
		}
		show_portrait = bishopric_holder
	}

	#Stranger and approve
	option = {
		name = EVTOPTB_HF_40055
		trigger = {
			OR = {
				trait = drunkard
				trait = hedonist
			}
			NOT = {
				event_target:saint_person = {
					family = ROOT
				}
			}
		}
		show_portrait = bishopric_holder
	}

	#Family and disapprove
	option = {
		name = EVTOPTC_HF_40055
		trigger = {
			event_target:saint_person = {
				family = ROOT
			}
			NOT = {
				OR = {
					trait = drunkard
					trait = hedonist
				}
	
			}
		}
		show_portrait = bishopric_holder
	}

	#Family and approve
	option = {
		name = EVTOPTD_HF_40055
		trigger = {
			OR = {
				trait = drunkard
				trait = hedonist
			}
			event_target:saint_person = {
				family = ROOT
			}
		}
		show_portrait = bishopric_holder
	}
}

#Pope preparing a response
province_event = {
	id = HF.40056
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	immediate = {
		if = {
			limit = {
				has_global_flag = qa_testing
			}
			province_event = { id = HF.40057 days = 5 }
		}
		else = {
		province_event = { id = HF.40057 days = 180 random = 500 }
		}
	}
}

#Pope finished response
province_event = {
	id = HF.40057
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	immediate = {
		trigger_switch = {
			on_trigger = has_global_flag
			bad_catholic_saint = {
				k_papal_state = { 
					holder_scope = {
						character_event = { id = HF.40058 }
					}
				}
			}
			bad_ursuline_saint = {
				k_ursuline = { 
					holder_scope = {
						character_event = { id = HF.40058 }
					}
				}
			}
			bad_high_church_saint = {
				k_high_church = { 
					holder_scope = {
						character_event = { id = HF.40058 }
					}
				}
			}
			bad_mormon_saint = {
				d_quorum_of_the_twelve = { 
					holder_scope = {
						character_event = { id = HF.40058 }
					}
				}
			}
		}
	}
}

#Pope sending out letters
character_event = {
	id = HF.40058
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	trigger = {
		NOR = {
			has_global_flag = only_papal_saints
			has_global_flag = only_abbess_saints
			has_global_flag = only_archbishop_saints
			has_global_flag = only_presidential_saints
		}
	}

	immediate = {
		trigger_switch = {
			on_trigger = has_global_flag
			bad_catholic_saint = {
				set_global_flag = only_papal_saints
				clr_global_flag = bad_catholic_saint
				log = "Only Papal Beatifications, declared by [Root.GetTitledName]"
				any_playable_ruler = {
					limit = {
						religion = catholic
					}
					narrative_event = { id = HF.40060 }
				}
			}
			bad_ursuline_saint = {
				set_global_flag = only_abbess_saints
				clr_global_flag = bad_ursuline_saint
				log = "Only Abbessal Beatifications, declared by [Root.GetTitledName]"
				any_playable_ruler = {
					limit = {
						religion = ursuline
					}
					narrative_event = { id = HF.40060 }
				}
			}
			bad_high_church_saint = {
				set_global_flag = only_archbishop_saints
				clr_global_flag = bak_high_church_saint
				log = "Only Archbishoprical Beatifications, declared by [Root.GetTitledName]"
				any_playable_ruler = {
					limit = {
						religion = high_church
					}
					narrative_event = { id = HF.40060 }
				}
			}
			bad_mormon_saint = {
				set_global_flag = only_presidential_saints
				clr_global_flag = bad_mormon_saint
				log = "Only Archbishoprical Beatifications, declared by [Root.GetTitledName]"
				any_playable_ruler = {
					limit = {
						religion = mormon
					}
					narrative_event = { id = HF.40060 }
				}
			}
		}
	}
}

#Vatican Outrage over Sinful Beatification
narrative_event = {
	id = HF.40060

	#Approve of Papal decision
	desc = {
		trigger = {
			OR = {
				#Stranger, and dislike sinful beatified
				NOR = {
					trait = drunkard
					trait = hedonist
					event_target:saint_person = {
						family = ROOT
					}
				}
				#Family member, and dislike sinful beatified
				AND = {
					NOR = {
						trait = drunkard
						trait = hedonist
					}
					event_target:saint_person = {
						family = ROOT
					}
				}
			}
		}
		text = EVTDESCA_HF_40060
	}

	#Disapprove of Papal decision
	desc = {
		trigger = {
			OR = {
				#Not family member of Saint, but similar
				AND = {
					OR = {
						trait = drunkard
						trait = hedonist
					}
					NOT = {
						event_target:saint_person = {
							family = ROOT
						}
					}
				}
				#Family Member of Saint and similar
				AND = {
					OR = {
						trait = drunkard
						trait = hedonist
					}
					event_target:saint_person = {
						family = ROOT
					}
				}
			}
		}
		text = EVTDESCB_HF_40060
	} 

	title = TITLEHF.40060
	picture = GFX_evt_church_council
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	#Stranger and approve of Papal decision
	option = {
		name = EVTOPTA_HF_40060
		trigger = {
			NOR = {
				trait = drunkard
				trait = hedonist
				event_target:saint_person = {
					family = ROOT
				}
			}
		}
		custom_tooltip = { text = impious_beatification_tooltip }
		show_portrait = event_target:saint_person
	}

	#Stranger and disapprove of Papal decision
	option = {
		name = EVTOPTB_HF_40060
		trigger = {
			OR = {
				trait = drunkard
				trait = hedonist
			}
			NOT = {
				event_target:saint_person = {
					family = ROOT
				}
			}
		}
		opinion = {
			modifier = insulted
			who = FROM
		}
		FROM = {
			show_scope_change = no
			opinion = {
				modifier = insulted
				who = ROOT
			}
		}
		custom_tooltip = { text = impious_beatification_tooltip }
		show_portrait = event_target:saint_person
	}

	#Family and approve of Papal decision
	option = {
		name = EVTOPTC_HF_40060
		trigger = {
			event_target:saint_person = {
				family = ROOT
			}
			NOR = {
				trait = drunkard
				trait = hedonist
			}
		}
		custom_tooltip = { text = impious_beatification_tooltip }
		show_portrait = event_target:saint_person
	}

	#Family and disapprove of Papal decision 
	option = {
		name = EVTOPTD_HF_40060
		trigger = {
			OR = {
				trait = drunkard
				trait = hedonist
			}
			event_target:saint_person = {
				family = ROOT
			}
		}
		opinion = {
			modifier = insulted
			who = FROM
		}		
		FROM = {
			show_scope_change = no
			opinion = {
				modifier = insulted
				who = ROOT
			}
		}
		custom_tooltip = { text = impious_beatification_tooltip }
		show_portrait = event_target:saint_person
	}
}

#Bad Papal saint
character_event = {
	id = HF.40090
	hide_window = yes
	is_triggered_only = yes
	min_age = 16
	has_dlc = "Holy Fury"

	trigger = {
		death_in_china_trigger = no
		death_no_trace_trigger = no
		#the world's worst spaghetti code is below
		OR = {
			AND = {
				religion = catholic
				k_papal_state = {
					holder_scope = {
						trait = bad_priest_christian
						independent = yes
						opinion = {
							who = ROOT
							value = 50
						}
					}
				}
				OR = {
					AND = {
						trait = impaler
						k_papal_state = {
							holder_scope = {
								trait = impaler
							}
						}	
					}
					AND = {
						trait = hedonist
						k_papal_state = {
							holder_scope = {
								trait = hedonist
							}
						}
					}
					AND = {
						trait = cannibal_trait
						k_papal_state = {
							holder_scope = {
								trait = cannibal_trait
							}
						}
					}
					AND = {
						trait = lunatic
						k_papal_state = {
							holder_scope = {
								trait = lunatic
							}
						}
					}
					AND = {
						trait = drunkard
						k_papal_state = {
							holder_scope = {
							trait = drunkard
							}
						}
					}
					AND = {
						trait = homosexual
						k_papal_state = {
							holder_scope = {
								trait = homosexual
								is_lover = ROOT
								trait = lustful
							}
						}
					}
					AND = {
						trait = lustful
						k_papal_state = {
							is_lover = ROOT
							trait = lustful
							NOT = {
								trait = homosexual
							}
						}
					}
					AND = {
						OR = {
							trait = seducer
							trait = seductress
						}
						k_papal_state = {
							holder_scope = {
								trait = seducer
							}
						}
					}
				}
			}
			AND = {
				religion = ursuline
				k_ursuline = {
					holder_scope = {
						trait = bad_priest_christian
						independent = yes
						opinion = {
							who = ROOT
							value = 50
						}
					}
				}
				OR = {
					AND = {
						trait = impaler
						k_ursuline = {
							holder_scope = {
								trait = impaler
							}
						}	
					}
					AND = {
						trait = hedonist
						k_ursuline = {
							holder_scope = {
								trait = hedonist
							}
						}
					}
					AND = {
						trait = cannibal_trait
						k_ursuline = {
							holder_scope = {
								trait = cannibal_trait
							}
						}
					}
					AND = {
						trait = lunatic
						k_ursuline = {
							holder_scope = {
								trait = lunatic
							}
						}
					}
					AND = {
						trait = drunkard
						k_ursuline = {
							holder_scope = {
							trait = drunkard
							}
						}
					}
					AND = {
						trait = homosexual
						k_ursuline = {
							holder_scope = {
								trait = homosexual
								is_lover = ROOT
								trait = lustful
							}
						}
					}
					AND = {
						trait = lustful
						k_ursuline = {
							is_lover = ROOT
							trait = lustful
							NOT = {
								trait = homosexual
							}
						}
					}
					AND = {
						OR = {
							trait = seducer
							trait = seductress
						}
						k_ursuline = {
							holder_scope = {
								trait = seductress
							}
						}
					}

				}
			}
			AND = {
				religion = high_church
				k_high_church = {
					holder_scope = {
						trait = bad_priest_christian
						independent = yes
						opinion = {
							who = ROOT
							value = 50
						}
					}
				}
				OR = {
					AND = {
						trait = impaler
						k_high_church = {
							holder_scope = {
								trait = impaler
							}
						}	
					}
					AND = {
						trait = hedonist
						k_high_church = {
							holder_scope = {
								trait = hedonist
							}
						}
					}
					AND = {
						trait = cannibal_trait
						k_high_church = {
							holder_scope = {
								trait = cannibal_trait
							}
						}
					}
					AND = {
						trait = lunatic
						k_high_church = {
							holder_scope = {
								trait = lunatic
							}
						}
					}
					AND = {
						trait = drunkard
						k_high_church = {
							holder_scope = {
							trait = drunkard
							}
						}
					}
					AND = {
						trait = homosexual
						k_high_church = {
							holder_scope = {
								trait = homosexual
								is_lover = ROOT
								trait = lustful
							}
						}
					}
					AND = {
						trait = lustful
						k_high_church = {
							is_lover = ROOT
							trait = lustful
							NOT = {
								trait = homosexual
							}
						}
					}
					AND = {
						OR = {
							trait = seducer
							trait = seductress
						}
						k_high_church = {
							holder_scope = {
								trait = seducer
							}
						}
					}
				}
			}
			AND = {
				religion = mormon
					d_quorum_of_the_twelve = {
					holder_scope = {
						trait = bad_priest_mormon
						independent = yes
						opinion = {
							who = ROOT
							value = 50
						}
					}
				}
				OR = {
					AND = {
						trait = impaler
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = impaler
							}
						}	
					}
					AND = {
						trait = hedonist
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = hedonist
							}
						}
					}
					AND = {
						trait = cannibal_trait
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = cannibal_trait
							}
						}
					}
					AND = {
						trait = lunatic
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = lunatic
							}
						}
					}
					AND = {
						trait = drunkard
						d_quorum_of_the_twelve = {
							holder_scope = {
							trait = drunkard
							}
						}
					}
					AND = {
						trait = homosexual
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = homosexual
								is_lover = ROOT
								trait = lustful
							}
						}
					}
					AND = {
						trait = lustful
						d_quorum_of_the_twelve = {
							is_lover = ROOT
							trait = lustful
							NOT = {
								trait = homosexual
							}
						}
					}
					AND = {
						OR = {
							trait = seducer
							trait = seductress
						}
						d_quorum_of_the_twelve = {
							holder_scope = {
								trait = seducer
							}
						}
					}
				}
			}
		}
		NOT = {
			trait = excommunicated
		}
	}

	immediate = {
		save_event_target_as = saint_person
		if = {
			limit = {
				event_target:saint_person = {
					religion = catholic
				}
			}
			random = {
				chance = 20
				k_papal_state = {
					holder_scope = {
						character_event = { id = HF.40091 }
					}
				}
			}
		}
		else_if = {
			limit = {
				event_target:saint_person = {
					religion = ursuline
				}
			}
			random = {
				chance = 20
				k_ursuline = {
					holder_scope = {
						character_event = { id = HF.40091 }
					}
				}
			}
		}
		else_if = {
			limit = {
				event_target:saint_person = {
					religion = high_church
				}
			}
			random = {
				chance = 20
				k_high_church = {
					holder_scope = {
						character_event = { id = HF.40091 }
					}
				}
			}
		}
		else_if = {
			limit = {
				event_target:saint_person = {
					religion = mormon
				}
			}
			random = {
				chance = 20
				d_quorum_of_the_twelve = {
					holder_scope = {
						character_event = { id = HF.40091 }
					}
				}
			}
		}
	}
}

#Bad Papal Saint decision
character_event = {
	id = HF.40091
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"

	immediate = {
		if = {
			limit = {
				has_global_flag = qa_testing
			}
			character_event = { id = HF.40092 days = 5 }
		}
		else = {
		character_event = { id = HF.40092 days = 180 random = 300 }
		}
	}
}

#Pope sends out letters deciding bad Saint
character_event = {
	id = HF.40092
	is_triggered_only = yes
	hide_window = yes
	has_dlc = "Holy Fury"
	trigger = {
		OR = {
			AND = {
				event_target:saint_person = {
					trait = impaler
				}
				trait = impaler
			}
			AND = {
				event_target:saint_person = {
					trait = hedonist
				}
				trait = hedonist
			}
			AND = {
				event_target:saint_person = {
					trait = cannibal_trait
				}
				trait = cannibal_trait
			}
			AND = {
				event_target:saint_person = {
					trait = lunatic
				}
				trait = lunatic
			}
			AND = {
				event_target:saint_person = {
					trait = drunkard
				}
				trait = drunkard
			}
			AND = {
				event_target:saint_person = {
					trait = homosexual
				}
				trait = homosexual
			}
			AND = {
				event_target:saint_person = {
					trait = lustful
				}
				trait = lustful
				NOT = {
					trait = homosexual
				}
			}
			AND = {
				event_target:saint_person = {
					OR = {
						trait = seducer
						trait = seductress
					}
				}
				trait = seducer
			}
		}
		NOT = {
			has_character_flag = impious_canonization_done
		}
	}

	immediate = {
		religion_authority = {
			modifier = impious_canonization
		}
		any_playable_ruler = {
			limit = {
				religion = ROOT
			}
			narrative_event = { id = HF.40098 }
		}
		log = "Bad Saint canonized by [Root.GetTitledName]"
		set_character_flag = impious_canonization_done
		set_global_flag = pre_catholic_civil_war
		event_target:saint_person = {
			remove_trait = beatified
			add_trait = saint
			create_bloodline = {
				type = saintly_bloodline_07
				religion = event_target:saint_person
				inheritance = patrilineal
			}
			event_target:saint_person = {
				trigger_switch = {
					on_trigger = trait
					impaler = { give_nickname = nick_gods_torturer new_bloodline = { set_description = saintly_impaler_description } }
					hedonist = { give_nickname = nick_gods_hedonist new_bloodline = { set_description = saintly_hedonist_description } }
					cannibal_trait = { give_nickname = nick_gods_cannibal new_bloodline = { set_description = saintly_cannibal_description } }
					lunatic = { give_nickname = nick_the_fool_for_christ new_bloodline = { set_description = saintly_lunatic_description } }
					drunkard = { give_nickname = nick_gods_drunkard new_bloodline = { set_description = saintly_drunkard_description } }
					homosexual = { give_nickname = nick_papal_lover new_bloodline = { set_description = saintly_homosexual_description } }
					lustful = { give_nickname = nick_papal_lover new_bloodline = { set_description = saintly_lustful_description } } 
					seducer = { give_nickname = nick_gods_seducer new_bloodline = { set_description = saintly_seducer_description } }
					seductress = { give_nickname = nick_gods_seducer new_bloodline = { set_description = saintly_seducer_description } }
				}
			}
			if = {
				limit = {
					is_female = yes
				}
				set_special_character_title = SAINT_TITLE_FEMALE
			}
			else = {
				set_special_character_title = SAINT_TITLE
			}
		}

		if = {
			limit = {
				independent = yes
				any_playable_ruler = {
					independent = yes
					OR = {
						tier = KING
						tier = EMPEROR
					}
					NOT = { trait = cynical }
					war = no
					ai = yes
					religion = ROOT
					is_within_diplo_range = ROOT
				}
			}
			random_playable_ruler = {
				limit = {
					independent = yes
					OR = {
						tier = KING
						tier = EMPEROR
					}
					NOT = { trait = cynical }
					war = no
					ai = yes
					religion = ROOT
					is_within_diplo_range = ROOT
				}
				preferred_limit = {
					tier = EMPEROR
				}
				save_event_target_as = papal_attacker
				add_trait = zealous
				unsafe_war = {
					target = ROOT
					casus_belli = depose_impious_pope
				}
			}
			any_playable_ruler = {
				limit = { 
					religion = ROOT
					event_target:papal_attacker = {
						NOT = {
							character = PREV
						}
					}
				}
				narrative_event = { id = HF.40093 days = 15 }
			}
		}
	}
}

#Bad Papal Saint main event
narrative_event = {
	id = HF.40098
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = impaler
			}
		} 
		text = EVTDESCA_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = hedonist
			}
		}
		text = EVTDESCB_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = cannibal_trait
			}
		}
		text = EVTDESCC_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = lunatic
			}
		}
		text = EVTDESCD_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = drunkard
			}
		}
		text = EVTDESCE_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = homosexual
			}
		}
		text = EVTDESCF_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = lustful
				NOT = {
					trait = homosexual
				}
			}
		}
		text = EVTDESCG_HF_40098
	}
	desc = {
		trigger = {
			rightful_religious_head_scope = {
				trait = seducer
			}
		}
		text = EVTDESCH_HF_40098
	}
	title = TITLEHF.40098
	picture = GFX_evt_beatification
	border = GFX_event_narrative_frame_religion
	portrait = event_target:saint_person
	sound = saint_proclaimed
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	#Disgruntled at the Pope's unebelievable actions
	option = {
		name = EVTOPTA_HF_40098
		custom_tooltip = { text = impious_canonization_tooltip }

		ai_chance = {
			factor = 80

			modifier = {
				factor = 0
				AND = {
					independent = yes
					ai = yes
					trait = zealous
				}
			}

			modifier = {
				factor = 0.25
				OR = {
					trait = cannibal_trait
					trait = impaler
					trait = hedonist
					trait = drunkard
					trait = seducer
					trait = lustful
					trait = lunatic	
				}
			}
		}
	}

	#Side with the Pope
	option = {
		name = EVTOPTC_HF_40098
		show_portrait = FROM
		trigger = {
			NOT = { trait = zealous }
			or = {
				independent = yes
				ai = no
			}
		}
		random = {
			chance = 50
			FROM = {
				trigger_switch = {
					on_trigger = trait
					cannibal_trait = { ROOT = { add_trait = cruel } }
					impaler = { ROOT = { add_trait = cruel } }
					hedonist = { ROOT = { add_trait = gluttonous } }
					drunkard = { ROOT = { add_trait = gluttonous } }
					seducer = { ROOT = { add_trait = lustful } }
					lustful = { ROOT = { add_trait = lustful } }
					lunatic = { ROOT = { add_trait = lunatic } }
				}
			}
		}
		custom_tooltip = { text = impious_canonization_tooltip }

		ai_chance = {
			factor = 20 
			modifier = {
				factor = 4
				OR = {
					trait = cannibal_trait
					trait = impaler
					trait = hedonist
					trait = drunkard
					trait = seducer
					trait = lustful
					trait = lunatic
				}
			}
		}

		set_character_flag = supported_impious_pope
	}
}

#War against the Pope
narrative_event = {
	id = HF.40093
	desc = EVTDESC_HF_40093
	title = EVTTITLE_HF_40093
	picture = GFX_evt_large_army
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	trigger = {
		FROM = {
			OR = {
				has_landed_title = k_papal_state
				has_landed_title = k_ursuline
				has_landed_title = k_high_church
				has_landed_title = d_quorum_of_the_twelve
			}
			any_war = {
				using_cb = depose_impious_pope
				is_primary_war_defender = yes
			}
		}
		event_target:papal_attacker = {
			is_alive = yes
		}
	}

	immediate = {
		clr_global_flag = pre_catholic_civil_war
	}

	#Support the war to depose the Pope
	option = {	
		name = EVTOPTA_HF_40093
		trigger = {
			independent = yes
			NOR = { 
				trait = cynical
				has_character_flag = supported_impious_pope 
				any_war = {
					using_cb = depose_impious_pope
				}
			}
		}
		custom_tooltip = {
			text = join_war_to_despose_pope_TT

			event_target:papal_attacker = {
				show_scope_change = no
				any_war = {
					limit = {
						using_cb = depose_impious_pope
						is_primary_war_attacker = yes
					}
					ROOT = {
						show_scope_change = no
						join_attacker_wars = PREV
					}
				}
			}
		}

		ai_chance = {
			factor = 10
			modifier = {
				factor = 5
				OR = {
					trait = zealous
					trait = holy_warrior
				}
			}
		}
	}
	#Support the Pope
	option = {	
		name = EVTOPTB_HF_40093
		trigger = {
			independent = yes
			NOR = {
				trait = zealous
				trait = holy_warrior
				any_war = {
					using_cb = depose_impious_pope
				}
			}
		}
		custom_tooltip = {
			text = join_war_to_defend_pope_TT

			FROMFROM = {
				any_war = {
					limit = {
						using_cb = depose_impious_pope
					}
					ROOT = {
						show_scope_change = no
						join_defender_wars = PREV
					}
				}
			}
		}

		ai_chance = {
			factor = 10
			modifier = {
				factor = 5
				has_character_flag = supported_impious_pope
			}
		}
	}
	#Take neither side
	option = {
		name = EVTOPTC_HF_40093
		trigger = {
			independent = yes
			NOR = {
				any_war = {
					using_cb = depose_impious_pope
				}
			}
		}
		custom_tooltip = { text = EVTOPTC_HF_40093_TT }

		ai_chance = {
			factor = 10
			modifier = {
				factor = 3
				NOR = {
					has_character_flag = supported_impious_pope
					trait = zealous
					trait = holy_warrior
				}
			}
		}
	}
	#Already in the war
	option = {
		name = EVTOPTD_HF_40093
		trigger = {
			any_war = {
				using_cb = depose_impious_pope
			}
		}
	}
	#Not independent
	option = {
		name = EVTOPTE_HF_40093
		trigger = {
			independent = no
		}
	}
}

#The Pope loses and have to abdicate
narrative_event = {
	id = HF.40094
	desc = EVTDESC_HF_40094
	title = EVTTITLE_HF_40094
	picture = GFX_evt_church_council
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	immediate = {
		rightful_religious_head_scope = {
			save_event_target_as = current_pope
		}
	}

	option = {	
		name = EVTOPTA_HF_40094
		trigger = {
			NOT = {
				has_character_flag = impious_papal_defender
			}
		}
		show_portrait = event_target:current_pope
	}

	option = {
		name = EVTOPTB_HF_40094
		trigger = {
			has_character_flag = impious_papal_defender
		}
		clr_character_flag = impious_papal_defender
		show_portrait = event_target:current_pope
	}
}

#The Pope wins
narrative_event = {
	id = HF.40095
	desc = EVTDESC_HF_40095
	title = EVTTITLE_HF_40095
	picture = GFX_evt_church_council
	border = GFX_event_narrative_frame_religion
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	option = {	
		name = EVTOPTA_HF_40095
		trigger = {
			NOT = {
				has_character_flag = impious_papal_defender
			}
		}
	}

	option = {
		name = EVTOPTB_HF_40095
		trigger = {
			has_character_flag = impious_papal_defender
		}
		clr_character_flag = impious_papal_defender
	}
}

# TEST SCRIPT
character_event = {
	id = HF.40097
	hide_window = yes
	is_triggered_only = yes
	trigger = {
	
	}

	immediate = {
		rightful_religious_head_scope = {
			piety = 5000
		}
	}
}

#Setting up Saintly Burial Site in a province
province_event = {
	id = HF.40099
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"

	immediate = {
		add_province_modifier = {
			name = tomb_of_a_saint
			duration = -1
		}
	}
}