namespace = HF

# Written by Joachim
# HF.40100 - HF.40199

# Check if a character is eligible for Worshipping 
character_event = {
	id = HF.40100
	hide_window = yes
	is_triggered_only = yes
	has_dlc = "Holy Fury"
	only_playable = yes
	min_age = 16

	trigger = {
		death_in_china_trigger = no
		death_no_trace_trigger = no
		prestige = 1000 
		is_adult = yes
		has_religion_feature = religion_beatification
        OR = {
            has_religion_feature = religion_temporal_head
            has_religion_feature = religion_theocratic_head
            has_religion_feature = religion_autocephaly
        }
	}

	immediate = {
		save_event_target_as = saint_person

		check_if_ancestor_worship_worthy_effect = yes
	}
}

# Religious Head is notified about potential Ancestor material
character_event = {
    id = HF.40101
    desc = EVTDESC_HF_40020_B
    picture = GFX_evt_council
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    trigger = {
    
    }

    immediate = {
        sound_effect = saint_proclaimed
    	save_event_target_as = canonizer_person
    }

    option = {      
        name = EVTOPTA_HF_40020
        custom_tooltip = {
        	text = pagan_pope_cannonize_choice_TT

        	# Titles and Bloodlines
        	event_target:saint_person = {
        		set_special_character_title = BLESSED_TITLE

        		random_list = {
        			10 = {
        				modifier = {
        					factor = 0.4
        					any_owned_bloodline = {
        						has_bloodline_flag = bloodline_heroes
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_01
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_01
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_average_nickname_trigger = yes
        					}
        					give_nickname = nick_the_great
        				}
        			}
					
					
					20 = {
                    trigger = {
                        event_target:saint_person = {
                            OR = {
                                trait = zealous
                                trait = holy_warrior
                            }
                        }
                    }
                    event_target:saint_person = {
                        if = {
                            limit = {
                                OR = {
                                    religion = orthodox
                                    religion = iconoclast
                                    religion = paulician
                                    religion = monothelite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_orthodox_01
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        
                        
                        else_if = {
                            limit = {
                                religion = norse_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_01
                                    religion = norse_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_01
                                    religion = norse_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = baltic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_01
                                    religion = baltic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_01
                                    religion = baltic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = slavic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_01
                                    religion = slavic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_01
                                    religion = slavic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = tengri_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_01
                                    religion = tengri_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_01
                                    religion = tengri_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = finnish_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_01
                                    religion = finnish_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_01
                                    religion = finnish_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = aztec_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_01
                                    religion = aztec_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_01
                                    religion = aztec_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = west_african_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_african_01
                                    religion = west_african_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_african_01
                                    religion = west_african_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = zun_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_zun_01
                                    religion = zun_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_zun_01
                                    religion = zun_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = hellenic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_01
                                    religion = hellenic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_01
                                    religion = hellenic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = bon_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_bon_01
                                    religion = bon_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_bon_01
                                    religion = bon_reformed
                                }
                            }
                        }
                        else = {
                            create_bloodline = {
                                type = saintly_bloodline_catholic_01
                                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 = {
                        if = {
                            limit = {
                                OR = {
                                    religion = orthodox
                                    religion = iconoclast
                                    religion = paulician
                                    religion = monothelite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_orthodox_03
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = nestorian
                            }
                            create_bloodline = {
                                type = saintly_bloodline_nestorian_03
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                OR = {
                                    religion = miaphysite
                                    religion = monophysite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_coptic_03
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = norse_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_03
                                    religion = norse_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_03
                                    religion = norse_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = baltic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_03
                                    religion = baltic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_03
                                    religion = baltic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = slavic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_03
                                    religion = slavic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_03
                                    religion = slavic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = tengri_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_03
                                    religion = tengri_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_03
                                    religion = tengri_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = finnish_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_03
                                    religion = finnish_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_03
                                    religion = finnish_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = aztec_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_03
                                    religion = aztec_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_03
                                    religion = aztec_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = west_african_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_african_03
                                    religion = west_african_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_african_03
                                    religion = west_african_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = zun_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_zun_03
                                    religion = zun_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_zun_03
                                    religion = zun_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = hellenic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_03
                                    religion = hellenic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_03
                                    religion = hellenic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = bon_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_bon_03
                                    religion = bon_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_bon_03
                                    religion = bon_reformed
                                }
                            }
                        }
                        else = {
                            create_bloodline = {
                                type = saintly_bloodline_catholic_03
                                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 = {
                    modifier = {
                        factor = 4
                        OR = {
                            event_target:saint_person = {
                                trait = zealous
                            }
                            event_target:saint_person = {
                                trait = holy_warrior
                            }
                        }
                    }
                    event_target:saint_person = {
                        if = {
                            limit = {
                                OR = {
                                    religion = orthodox
                                    religion = iconoclast
                                    religion = paulician
                                    religion = monothelite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_orthodox_04
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = nestorian
                            }
                            create_bloodline = {
                                type = saintly_bloodline_nestorian_04
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                OR = {
                                    religion = miaphysite
                                    religion = monophysite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_coptic_04
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = norse_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_04
                                    religion = norse_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_04
                                    religion = norse_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = baltic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_04
                                    religion = baltic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_04
                                    religion = baltic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = slavic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_04
                                    religion = slavic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_04
                                    religion = slavic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = tengri_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_04
                                    religion = tengri_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_04
                                    religion = tengri_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = finnish_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_04
                                    religion = finnish_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_04
                                    religion = finnish_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = aztec_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_04
                                    religion = aztec_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_04
                                    religion = aztec_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = west_african_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_african_04
                                    religion = west_african_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_african_04
                                    religion = west_african_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = zun_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_zun_04
                                    religion = zun_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_zun_04
                                    religion = zun_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = hellenic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_04
                                    religion = hellenic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_04
                                    religion = hellenic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = bon_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_bon_04
                                    religion = bon_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_bon_04
                                    religion = bon_reformed
                                }
                            }
                        }
                        else = {
                            create_bloodline = {
                                type = saintly_bloodline_catholic_04
                                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
                            }
                        }
                    }
                }
                30 = {
                    trigger = {
                        event_target:saint_person = {
                            trait = sympathy_judaism
                        }
                    }
                    event_target:saint_person = {
                        if = {
                            limit = {
                                OR = {
                                    religion = orthodox
                                    religion = iconoclast
                                    religion = paulician
                                    religion = monothelite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_orthodox_05
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = nestorian
                            }
                            create_bloodline = {
                                type = saintly_bloodline_nestorian_05
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                OR = {
                                    religion = miaphysite
                                    religion = monophysite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_coptic_05
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = norse_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_05
                                    religion = norse_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_05
                                    religion = norse_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = baltic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_05
                                    religion = baltic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_05
                                    religion = baltic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = slavic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_05
                                    religion = slavic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_05
                                    religion = slavic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = tengri_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_05
                                    religion = tengri_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_05
                                    religion = tengri_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = finnish_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_05
                                    religion = finnish_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_05
                                    religion = finnish_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = aztec_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_05
                                    religion = aztec_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_05
                                    religion = aztec_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = west_african_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_african_05
                                    religion = west_african_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_african_05
                                    religion = west_african_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = zun_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_zun_05
                                    religion = zun_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_zun_05
                                    religion = zun_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = hellenic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_05
                                    religion = hellenic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_05
                                    religion = hellenic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = bon_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_bon_05
                                    religion = bon_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_bon_05
                                    religion = bon_reformed
                                }
                            }
                        }
                        else = {
                            create_bloodline = {
                                type = saintly_bloodline_catholic_05
                                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 = {
                        if = {
                            limit = {
                                OR = {
                                    religion = orthodox
                                    religion = iconoclast
                                    religion = paulician
                                    religion = monothelite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_orthodox_06
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = nestorian
                            }
                            create_bloodline = {
                                type = saintly_bloodline_nestorian_06
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                OR = {
                                    religion = miaphysite
                                    religion = monophysite
                                }
                            }
                            create_bloodline = {
                                type = saintly_bloodline_coptic_06
                                religion = event_target:saint_person
                                inheritance = patrilineal
                            }
                        }
                        else_if = {
                            limit = {
                                religion = norse_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_06
                                    religion = norse_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_germanic_06
                                    religion = norse_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = baltic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_06
                                    religion = baltic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_romuva_06
                                    religion = baltic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = slavic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_06
                                    religion = slavic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_slavic_06
                                    religion = slavic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = tengri_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_06
                                    religion = tengri_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_tengri_06
                                    religion = tengri_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = finnish_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_06
                                    religion = finnish_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_suomenusko_06
                                    religion = finnish_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = aztec_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_06
                                    religion = aztec_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_aztec_06
                                    religion = aztec_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = west_african_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_african_06
                                    religion = west_african_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_african_06
                                    religion = west_african_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = zun_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_zun_06
                                    religion = zun_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_zun_06
                                    religion = zun_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = hellenic_pagan_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_06
                                    religion = hellenic_pagan_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_hellenic_06
                                    religion = hellenic_pagan_reformed
                                }
                            }
                        }
                        else_if = {
                            limit = {
                                religion = bon_reformed
                            }
                            if = {
                                limit = {
                                    is_female = yes
                                }
                                create_bloodline = {
                                    type = saintly_bloodline_bon_06
                                    religion = bon_reformed
                                    inheritance = matrilineal
                                }
                            }
                            else = {
                                create_bloodline = {
                                    type = saintly_bloodline_bon_06
                                    religion = bon_reformed
                                }
                            }
                        }
                        else = {
                            create_bloodline = {
                                type = saintly_bloodline_catholic_06
                                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
                            }
                        }
                    }
                }
            
       	
				
					
					
					
					
					
					
        			30 = {
        				trigger = {
        					OR = {
        						trait = bastard
        						trait = legit_bastard
        					}
        				}
        				modifier = {
        					factor = 0.1
        					any_owned_bloodline = {
        						has_bloodline_flag = bloodline_legitimize
        					}
        				}
        				if = {
    						limit = {
    							is_female = yes
    						}
    						create_bloodline = {
    							type = ancestor_worship_bloodline_02
                                religion = event_target:saint_person
    							inheritance = matrilineal
    						}
    					}
    					else = {
    						create_bloodline = {
    							type = ancestor_worship_bloodline_02
                                religion = event_target:saint_person
    						}
    					}
    					if = {
    						limit = {
    							can_apply_lame_nickname_trigger = yes
    						}
    						give_nickname = nick_the_bastard
    					}
        			}
        			20 = {
        				trigger = {
        					OR = {
        						AND = {
        							government = nomadic_government
        							OR = {
        								religion = tengri_pagan
        								religion = tengri_pagan_reformed
        							}
        						}
        						religion = bon
        						religion = bon_reformed
        					}
        				}
        				modifier = {
        					factor = 0.2
        					any_owned_bloodline = {
        						has_bloodline_flag = bloodline_sky_burial
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_03
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_03
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_average_nickname_trigger = yes
        					}
        					give_nickname = nick_the_guide
        				}
        			}
        			20 = {
        				trigger = {
        					government = nomadic_government
        				}
        				modifier = {
        					factor = 0.1
        					any_owned_bloodline = {
        						has_bloodline_flag = bloodline_mercenary_traditions
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_04
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_04
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_cool_nickname_trigger = yes
        					}
        					give_nickname = nick_the_scourge
        				}
        			}
        			30 = {
        				trigger = {
        					has_law = succ_tanistry
        				}
        				modifier = {
        					factor = 0.1
        					any_owned_bloodline = {
        						has_bloodline_flag = bloodline_tanistry
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_05
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_05
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_cool_nickname_trigger = yes
        					}
        					give_nickname = nick_the_lawgiver
        				}
        			}
        			30 = {
        				trigger = {
        					OR = {
        						trait = pirate
        						trait = viking
        						trait = ravager
        						trait = sea_queen
        						trait = seaking
        					}
        				}
        				modifier = {
        					factor = 0.1
        					any_owned_bloodline = {
                                has_bloodline_flag = more_raiders_bloodline
                                bloodline_is_active_for = PREV
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_06
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_06
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_cool_nickname_trigger = yes
        						is_female = yes
        					}
        					give_nickname = nick_the_valkyrie
        				}
        				if = {
        					limit = {
        						can_apply_cool_nickname_trigger = yes
        						is_female = no
        					}
        					give_nickname = the_unrestrained
        				}
        			}
        			20 = {
        				trigger = {
        					trait = duelist 
        				}
        				modifier = {
        					factor = 0.1
        					any_owned_bloodline = {
        						has_bloodline_flag = duelist_bloodline
        					}
        				}
        				if = {
        					limit = {
        						is_female = yes
        					}
        					create_bloodline = {
        						type = ancestor_worship_bloodline_07
                                religion = event_target:saint_person
        						inheritance = matrilineal
        					}
        				}
        				else = {
        					create_bloodline = {
        						type = ancestor_worship_bloodline_07
                                religion = event_target:saint_person
        					}
        				}
        				if = {
        					limit = {
        						can_apply_average_nickname_trigger = yes
        					}
        					give_nickname = nick_bloodaxe
        				}
        			}
        		}
        		new_bloodline = {
                    set_name = blessed_bloodline_name
                    set_description = blessed_bloodline_description
                }
        	}
        	hidden_tooltip = {
                # 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 }
                }
            }
        }
    }
    option = {      
        name = EVTOPTB_HF_40020
    }
}

# Test Script
character_event = {
    id = HF.40105
    hide_window = yes
    is_triggered_only = yes
    trigger = {
    
    }

    immediate = {
    	save_event_target_as = saint_person

    	character_event = { id = HF.40101 }
    }
}

