﻿namespace = god_young_event

god_young_event.0099 = {
    type = character_event
    hidden = yes

    trigger = {
        is_alive = yes
        is_playable_character = yes
        OR = {
            has_trait = young_god_light
            has_trait = young_god_dark
        }
    }

    immediate = {

        # LIGHT PATH
        if = {
            limit = {
                has_trait = young_god_light
                NOT = { has_character_flag = light_event_1_complete }
            }
            trigger_event = god_young_event.1001
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_1_complete
                NOT = { has_character_flag = light_event_2_complete }
            }
            trigger_event = god_young_event.1002
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_2_complete
                NOT = { has_character_flag = light_event_3_complete }
            }
            trigger_event = god_young_event.1003
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_3_complete
                NOT = { has_character_flag = light_event_4_complete }
            }
            trigger_event = god_young_event.1004
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_4_complete
                NOT = { has_character_flag = light_event_5_complete }
            }
            trigger_event = god_young_event.1005
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_5_complete
                NOT = { has_character_flag = light_event_6_complete }
            }
            trigger_event = god_young_event.1006
        }
        else_if = {
            limit = {
                has_trait = young_god_light
                has_character_flag = light_event_6_complete
                NOT = { has_character_flag = light_event_7_1_complete }
            }
            trigger_event = god_young_event.1007
        }

        # DARK PATH
        else_if = {
            limit = {
                has_trait = young_god_dark
                NOT = { has_character_flag = dark_event_1_complete }
            }
            trigger_event = god_young_event.2001
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_1_complete
                NOT = { has_character_flag = dark_event_2_complete }
            }
            trigger_event = god_young_event.2002
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_2_complete
                NOT = { has_character_flag = dark_event_3_complete }
            }
            trigger_event = god_young_event.2003
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_3_complete
                NOT = { has_character_flag = dark_event_4_complete }
            }
            trigger_event = god_young_event.2004
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_4_complete
                NOT = { has_character_flag = dark_event_5_complete }
            }
            trigger_event = god_young_event.2005
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_5_complete
                NOT = { has_character_flag = dark_event_6_complete }
            }
            trigger_event = god_young_event.2006
        }
        else_if = {
            limit = {
                has_trait = young_god_dark
                has_character_flag = dark_event_6_complete
                NOT = { has_character_flag = dark_event_7_1_complete }
            }
            trigger_event = god_young_event.2007
        }
    }

    option = { name = OK }
}

god_young_event.0001 = {
    type = character_event
    hidden = yes

    immediate = {
        random_list = {
            25 = { trigger_event = god_young_event.0002 }
            75 = { }  # Nothing happens
        }
    }
}

god_young_event.0002 = {
    type = character_event
    title = god_young_event.0002.t
    desc = god_young_event.0002.d
    override_background = { reference = activity_hunt_log }

    immediate = {
        add_character_flag = flag_god_event_0002_seen

        create_character = {
            save_scope_as = damsel_character
            template = damsel_courtier_template
            location = root.capital_province
        }

        random_list = {
            50 = { scope:damsel_character = { add_trait = beauty_good_2 } }
            50 = { scope:damsel_character = { add_trait = beauty_good_3 } }
        }
        

        create_character = {
            save_scope_as = bandit
            location = root.capital_province
            age = { 27 35 }
	        dynasty = none
	        gender = male

	        culture = root.culture
	        faith = root.faith

	        # Stat blocks
	        martial = { 10 15 }
	        prowess = { 10 15 }

	        # Traits
	        trait = sadistic
            trait = education_martial_2

	        # No random traits
	        random_traits = yes
        }
        
    }

    left_portrait = {
        character = scope:bandit
        animation = aggressive_hammer
    }

    right_portrait = {
        character = scope:damsel_character
        animation = fear
    }

    option = {
        name = god_young_event.0002.a
        trigger = { prowess >= 33 }

        random_list = {
            85 = {
                change_variable = { name = ascension_score add = 4 }
                add_courtier = scope:damsel_character
                scope:bandit = {
                    death = {
                        death_reason = death_execution
                        killer = root
                    }
                }
            }
            15 = {
                remove_courtier_or_guest = scope:damsel_character
                random = {
                    chance = 10
                    add_trait = wounded_1
                }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            brave = major_stress_impact_loss
            wrathful = medium_stress_impact_loss
            craven = medium_stress_impact_gain
            shy = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.0002.b
        trigger = { prowess >= 28 }

        random_list = {
            75 = {
                change_variable = { name = ascension_score add = 3 }
                add_courtier = scope:damsel_character
            }
            25 = {
                remove_courtier_or_guest = scope:damsel_character
                random = {
                    chance = 20
                    add_trait = wounded_1
                }
            }
        }
        stress_impact = {
            base = minor_stress_impact_gain
            brave = major_stress_impact_loss
            calm = major_stress_impact_loss
            gregarious = minor_stress_impact_loss
            wrathful = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.0002.c
        trigger = { prowess >= 25 }

        random_list = {
            50 = {
                change_variable = { name = ascension_score add = 2 }
                add_courtier = scope:damsel_character
            }
            50 = {
                remove_courtier_or_guest = scope:damsel_character
                random = {
                    chance = 35
                    add_trait = wounded_1
                }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            paranoid = minor_stress_impact_loss
            patient = major_stress_impact_loss
            honest = major_stress_impact_loss
        }
    }
    
    option = {
        name = god_young_event.0002.d_option
        remove_courtier_or_guest = scope:damsel_character
        add_courtier = scope:bandit
        stress_impact = {
            base = minor_stress_impact_gain
            callous = medium_stress_impact_loss
            content = major_stress_impact_loss
            compassionate = major_stress_impact_gain
            trusting = medium_stress_impact_gain
        }
    }
}

god_young_event.1001 = {
    type = character_event
    title = god_young_event.1001.t
    desc = god_young_event.1001.d
    override_background = { reference = travel_hills_log }

    immediate = {
        add_character_flag = light_event_1_complete

        random_courtier = {
            limit = { has_trait = magic_seer }
            save_scope_as = seer_character
        }
    }

    left_portrait = {
        character = scope:seer_character
        animation = chaplain
    }

    right_portrait = {
        character = root
        animation = personality_honorable
    }

    option = {
        name = god_young_event.1001.option_1

        random = {
            chance = 20
            add_piety = 500
            add_prestige = 100
        }
        random = {
            chance = 80
        }
        stress_impact = {
            base = medium_stress_impact_gain
            zealous = minor_stress_impact_loss
            brave = minor_stress_impact_loss
            ambitious = minor_stress_impact_loss
            craven = medium_stress_impact_gain
            shy = minor_stress_impact_gain
            humble = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1001.option_2

        random = {
            chance = 50
            add_piety = 250
            add_prestige = 50
        }
        random = {
            chance = 50
        }
        stress_impact = {
            base = minor_stress_impact_gain
            humble = miniscule_stress_impact_loss
            chaste = minor_stress_impact_loss
            zealous = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1001.option_3

        random = {
            chance = 85
            add_piety = 100
        }
        stress_impact = {
            base = minor_stress_impact_gain
            temperate = miniscule_stress_impact_loss
            patient = minor_stress_impact_loss
            paranoid = minor_stress_impact_gain
            ambitious = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1001.option_4
        # 100% success, no effect, progresses story
        stress_impact = {
            base = medium_stress_impact_gain
            craven = minor_stress_impact_loss
            shy = minor_stress_impact_loss
            brave = minor_stress_impact_gain
            zealous = minor_stress_impact_gain
            diligent = minor_stress_impact_gain
        }
    }
}

god_young_event.2001 = {
    type = character_event
    title = god_young_event.2001.t
    desc = god_young_event.2001.desc
    override_background = { reference = red_night_log }

    immediate = {
        add_character_flag = dark_event_1_complete

        # Set up Seer for left portrait
        global_var:log_seer = {
            save_scope_as = seer_character
        }
    }

    left_portrait = {
        character = scope:seer_character
        animation = go_to_your_room
    }

    right_portrait = {
        character = root
        animation = survey
    }

    option = {
        name = god_young_event.2001.option_1  # "Raise your arms and beckon it closer"

        random = {
            chance = 20
            add_piety = 500
            add_dread = 100
        }
        random = {
            chance = 80
            add_stress = 20
        }
    }

    option = {
        name = god_young_event.2001.option_2  # "Bow your head and accept the omen"

        random = {
            chance = 50
            add_piety = 250
            add_dread = 50
        }
        random = {
            chance = 50
            add_stress = 10
        }
    }

    option = {
        name = god_young_event.2001.option_3  # "Whisper to the void that you are listening"

        random = {
            chance = 85
            add_piety = 100
        }
    }

    option = {
        name = god_young_event.2001.option_4  # "Turn away from the night sky"
        # No effect, event chain continues
    }
}

god_young_event.1002 = {
    type = character_event
    title = god_young_event.1002.t
    desc = god_young_event.1002.desc
    override_background = { reference = courtyard_night_log }

    immediate = {
        add_character_flag = light_event_2_complete
    }

    right_portrait = {
        character = root
        animation = personality_cynical
    }

    option = {
        name = god_young_event.1002.option_1  # "Let the memories consume you"

        random = {
            chance = 60
            add_piety = 200
            if = {
                limit = { NOT = { has_trait = compassionate } }
                add_trait = compassionate
            }
            else_if = {
                limit = { NOT = { has_trait = forgiving } }
                add_trait = forgiving
            }
        }
        random = {
            chance = 40
            if = {
                limit = { has_trait = zealous }
                remove_trait = zealous
            }
            stress_impact = {
                base = massive_stress_impact_gain
                compassionate = minor_stress_impact_loss
                forgiving = minor_stress_impact_loss
                zealous = minor_stress_impact_loss
                callous = medium_stress_impact_gain
                arrogant = minor_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.1002.option_2  # "Meditate on who I’ve become"

        random = {
            chance = 75
            add_piety = 150
        }
        random = {
            chance = 25
        }
        stress_impact = {
            base = medium_stress_impact_gain
            calm = minor_stress_impact_loss
            humble = minor_stress_impact_loss
            patient = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1002.option_3  # "Tear the memories away"

        random = {
            chance = 90
            add_piety = 75
            stress_impact = {
                base = medium_stress_impact_gain
                brave = minor_stress_impact_loss
                wrathful = minor_stress_impact_loss
                vengeful = minor_stress_impact_loss
                forgiving = minor_stress_impact_gain
                trusting = minor_stress_impact_gain
            }
        }
        random = {
            chance = 10
        }
    }

    option = {
        name = god_young_event.1002.option_4  # "Record them in my journal and move on"
        add_prestige = 10
        stress_impact = {
            base = minor_stress_impact_gain
            temperate = miniscule_stress_impact_loss
            diligent = minor_stress_impact_loss
            content = minor_stress_impact_loss
            lazy = minor_stress_impact_gain
        }
    }
}

god_young_event.2002 = {
    type = character_event
    title = god_young_event.2002.t
    desc = god_young_event.2002.desc
    override_background = { reference = condemned_village_log }

    immediate = {
        add_character_flag = dark_event_2_complete
    }

    right_portrait = {
        character = root
        animation = personality_vengeful
    }

    option = {
        name = god_young_event.2002.option_1  # "Let vengeance guide me"

        random = {
            chance = 25
            add_piety = 200
            add_dread = 50
            if = {
                limit = { NOT = { has_trait = wrathful } }
                add_trait = wrathful
            }
            else_if = {
                limit = { NOT = { has_trait = vengeful } }
                add_trait = vengeful
            }
        }
        random = {
            chance = 75
            add_stress = major_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2002.option_2  # "Channel it into purpose"

        random = {
            chance = 60
            add_piety = 150
            add_dread = 20
        }
        random = {
            chance = 40
            add_stress = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2002.option_3  # "Silence the memories"

        random = {
            chance = 90
            add_piety = 75
            add_dread = -5
        }
    }

    option = {
        name = god_young_event.2002.option_4  # "Write the names in secret, then burn them"

        add_prestige = 10
    }
}

god_young_event.1003 = {
    type = character_event
    title = god_young_event.1003.t
    desc = god_young_event.1003.desc
    override_background = { reference = bp1_plains_log }

    immediate = {
        add_character_flag = light_event_3_complete

        create_character = {
            save_scope_as = sick_mother
            dynasty = none
            age = { 20 40 }
            gender = female
            culture = root.culture
            faith = root.faith
            location = root.capital_province
        }

        scope:sick_mother = {
            create_character = {
                save_scope_as = sick_child
                dynasty = none
                age = { 2 6 }
                gender = male
                mother = scope:sick_mother
                culture = root.culture
                faith = root.faith
                location = root.capital_province
            }
        }

        scope:sick_child = {
            add_trait = ill
            add_trait = sickly
        }
    }

    left_portrait = {
        character = scope:sick_mother
        animation = worry
    }

    right_portrait = {
        character = root
        animation = chaplain
    }

    option = {
        name = god_young_event.1003.option_1

        random_list = {
            25 = {
                add_piety = 500
                scope:sick_child = { 
                    add_character_flag = devoted_servant
                    remove_trait = ill
                    remove_trait = sickly
                    add_opinion = { target = root modifier = blessings_of_divine_opinion }
                }
                scope:sick_mother = {
                    add_character_flag = devout_follower
                    add_courtier = scope:sick_mother
                    add_opinion = { target = root modifier = blessings_of_divine_opinion }
                }
                add_courtier = scope:sick_child
                add_courtier = scope:sick_mother
            }
            75 = {
                add_stress = major_stress_impact_gain
                scope:sick_child = {
                    add_trait = wounded_2
                    add_opinion = { target = root modifier = false_god_opinion }
                }
                scope:sick_mother = {
                    add_opinion = { target = root modifier = false_god_opinion }
                }
            }
        }
    }

    option = {
        name = god_young_event.1003.option_2

        random_list = {
            60 = {
                add_piety = 200
                scope:sick_child = {
                    remove_trait = ill
                    add_opinion = { target = root modifier = grateful_servant_opinion }
                }
                scope:sick_mother = {
                    add_opinion = { target = root modifier = grateful_servant_opinion }
                }
                add_courtier = scope:sick_mother
                add_courtier = scope:sick_child
            }
            40 = {
                add_stress = minor_stress_impact_gain
                scope:sick_child = {
                    add_opinion = { target = root modifier = false_god_opinion }
                }
                scope:sick_mother = {
                    add_opinion = { target = root modifier = dissapointed_follower_opinion }
                }
            }
        }
    }

    option = {
        name = god_young_event.1003.option_3

        random = {
            chance = 90
            add_piety = 100
            scope:sick_mother = {
                add_opinion = { target = root modifier = grateful_servant_opinion }
            }
            add_courtier = scope:sick_mother
            add_courtier = scope:sick_child
        }
    }

    option = {
        name = god_young_event.1003.option_4

        scope:sick_mother = {
            add_trait = wounded_2
            add_opinion = { target = root modifier = false_god_opinion }
        }

        add_prestige = 5
    }
}

god_young_event.2003 = {
    type = character_event
    title = god_young_event.2003.t
    desc = god_young_event.2003.desc
	override_background = { reference = armory_log }
    theme = prison

    immediate = {
        add_character_flag = dark_event_3_complete
        save_scope_as = dark_god_root

        create_character = {
            save_scope_as = dungeon_prisoner
            dynasty = none
            age = { 25 50 }
            gender = male
            culture = root.culture
            faith = root.faith
            location = root.capital_province
        }
        
        scope:dungeon_prisoner = {
            add_character_flag = dungeon_prisoner
        }

        create_character = {
            save_scope_as = guard
            dynasty = none
            age = { 25 35 }
            martial = { 12 17 }
            gender = male
            culture = root.culture
            faith = root.faith
            location = root.capital_province
        }

        scope:dungeon_prisoner = {
            add_trait = wounded_2
            add_trait = craven
        }

        scope:guard = {
            add_trait = education_martial_3
            add_trait = sadistic
        }

        scope:dark_god_root = {
            imprison = {
                target = scope:dungeon_prisoner
                type = house_arrest
            }
        }
    }

    left_portrait = {
        character = scope:dungeon_prisoner
        animation = prisonhouse
        outfit_tags = { prison }
    }

    right_portrait = {
        character = scope:guard
        animation = marshal
        outfit_tags = { military }
    }

    option = {
        name = god_young_event.2003.option_1

        random_list = {
            25 = {
                add_piety = 500
                add_dread = 50
                scope:dungeon_prisoner = {
					death = {
						killer = scope:dark_god_root
						death_reason = death_burned
					}
				}
                scope:guard = {
					add_opinion = { target = root modifier = true_god_of_darkness_opinion }
				}
                add_courtier = scope:guard

            }
        
            75 = {
                add_stress = major_stress_impact_gain
                scope:dungeon_prisoner = {
                    add_trait = wounded_3
                    add_opinion = { target = root modifier = false_god_opinion }
                }
                add_courtier = scope:guard
                scope:guard = {
					add_opinion = { target = root modifier = delighted_by_cruelty_opinion }
				}
            }
        }
    }

    option = {
        name = god_young_event.2003.option_2

        random_list = {
            60 = {
                add_piety = 200
                add_dread = 25
                scope:dungeon_prisoner = {
                    add_trait = disfigured
                    add_opinion = { target = root modifier = fearful_servant_opinion }
                }
                scope:guard = {
					add_opinion = { target = root modifier = delighted_by_cruelty_opinion }
				}
                add_courtier = scope:guard
                add_courtier = scope:dungeon_prisoner
            }
            40 = {
                add_stress = minor_stress_impact_gain
                scope:guard = {
					add_opinion = { target = root modifier = fearful_servant_opinion }
				}
                add_courtier = scope:guard
            }
        }
    }

    option = {
        name = god_young_event.2003.option_3

        random = {
            chance = 90
            add_piety = 100
            add_dread = 10
        }
        scope:dungeon_prisoner = {
                    add_trait = physique_bad_2
                    add_opinion = { target = root modifier = fearful_servant_opinion }
                }
        scope:guard = {
					add_opinion = { target = root modifier = delighted_by_cruelty_opinion }
				}
        add_courtier = scope:guard
    }

    option = {
        name = god_young_event.2003.option_4

        add_prestige = 5
    }
}

###############################################

god_young_event.1004 = {
    type = character_event
    hidden = yes

    immediate = {
        save_scope_as = player_character
        add_character_flag = light_event_4_complete

        random_list = {
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:akan
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:hausa
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:nupe
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:somali
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:egyptian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:bedouin
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:persian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:levantine
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:french
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:castilian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:italian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:portuguese
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:english
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:danish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:swedish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:anglo_saxon
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:han
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:mongol
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:turkish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:uyghur
                        }
                    }
                }
            }
        }

        every_independent_ruler = {
            limit = { 
                is_ai = yes
                culture = scope:culture_holder.culture
                NOT = { exists = global_var:log_rival_god }
            }

            save_scope_as = potential_ruler
        
            scope:potential_ruler = {
                random_courtier = {
                    limit = {
                        is_adult = yes
                        is_alive = yes
                        is_married = no
                        
                        age = { 18 37 }
                        OR = {
                            AND = {
                                is_female = yes
                                scope:player_character = { is_female = yes }
                            }
                            AND = {
                                is_female = no
                                scope:player_character = { is_female = no }
                            }
                        }

                        NOT = {
                            OR = {
                                has_trait = young_god_light
                                has_trait = angel_full_god
                            }
                        }
                    }
                    save_scope_as = dark_god
                    set_global_variable = {
                        name = log_rival_god
                        value = scope:dark_god
                    }
                }
            }
        }

        set_global_variable = {
            name = log_ruler
            value = scope:potential_ruler
        }

        scope:dark_god = {

            add_learning_skill = 10
            add_intrigue_skill = 10
            add_martial_skill = 10
            add_intrigue_skill = 10
            add_prowess_skill = 10
            add_stewardship_skill = 10
            add_trait = young_god_dark
            remove_trait = calm
            remove_trait = chaste
            remove_trait = content
            remove_trait = diligent
            remove_trait = fickle
            remove_trait = forgiving
            remove_trait = generous
            remove_trait = gregarious
            remove_trait = honest
            remove_trait = humble
            remove_trait = just
            remove_trait = patient
            remove_trait = temperate
            remove_trait = trusting
            remove_trait = zealous
            remove_trait = compassionate
            add_trait = brave

            random_list = {
                34 = {
                    add_trait = wrathful
                    add_trait = sadistic
                    add_trait = vengeful
                }
                33 = {
                    add_trait = callous
                    add_trait = stubborn
                    add_trait = ambitious
                }
                33 = {
                    add_trait = deceitful
                    add_trait = arrogant
                    add_trait = impatient
                }
            }
            add_character_flag = dark_god_rival
        }
        trigger_event = god_young_event.1014
    }
}

god_young_event.2004 = {
    type = character_event
    hidden = yes

    immediate = {
        save_scope_as = player_character
        add_character_flag = dark_event_4_complete

        random_list = {
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:akan
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:hausa
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:nupe
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:somali
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:egyptian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:bedouin
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:persian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:levantine
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:french
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:castilian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:italian
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:portuguese
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:english
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:danish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:swedish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:anglo_saxon
                        }
                    }
                }
            }
            20 = {
                random_list = {
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:han
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:mongol
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:turkish
                        }
                    }
                    25 = {
                        create_character = {
                            save_scope_as = culture_holder
                            age = 25
                            dynasty = none
                            gender = male
                            location = root.capital_province
                            culture = culture:uyghur
                        }
                    }
                }
            }
        }

        every_independent_ruler = {
            limit = { 
                is_ai = yes
                culture = scope:culture_holder.culture
                NOT = { exists = global_var:log_rival_god }
            }

            save_scope_as = potential_ruler

            scope:potential_ruler = {
                random_courtier = {
                    limit = {
                        is_adult = yes
                        is_alive = yes
                        is_married = no
                        
                        age = { 18 37 }
                        OR = {
                            AND = {
                                is_female = yes
                                scope:player_character = { is_female = yes }
                            }
                            AND = {
                                is_female = no
                                scope:player_character = { is_female = no }
                            }
                        }

                        NOT = {
                            OR = {
                                has_trait = young_god_dark
                                has_trait = fallen_god
                            }
                        }
                    }
                    save_scope_as = light_god
                    set_global_variable = {
                        name = log_rival_god
                        value = scope:light_god
                    }
                }
            }
        }

        set_global_variable = {
            name = log_ruler
            value = scope:potential_ruler
        }

        scope:light_god = {
            add_trait = young_god_light
            add_learning_skill = 10
            add_intrigue_skill = 10
            add_martial_skill = 10
            add_intrigue_skill = 10
            add_prowess_skill = 10
            add_stewardship_skill = 10
            remove_trait = lustful
            remove_trait = gluttonous
            remove_trait = greedy
            remove_trait = lazy
            remove_trait = wrathful
            remove_trait = impatient
            remove_trait = arrogant
            remove_trait = deceitful
            remove_trait = craven
            remove_trait = shy
            remove_trait = ambitious
            remove_trait = arbitrary
            remove_trait = cynical
            remove_trait = paranoid
            remove_trait = callous
            remove_trait = sadistic
            remove_trait = stubborn
            remove_trait = vengeful
            add_trait = brave

            random_list = {
                34 = {
                    add_trait = zealous
                    add_trait = diligent
                    add_trait = gregarious
                }
                33 = {
                    add_trait = just
                    add_trait = temperate
                    add_trait = honest
                }
                33 = {
                    add_trait = forgiving
                    add_trait = patient
                    add_trait = compassionate
                }
            }
            add_character_flag = light_god_rival
        }
        trigger_event = god_young_event.2014
    }
}

#################################################


god_young_event.1014 = {
    type = character_event
    title = god_young_event.1014.t
    desc = god_young_event.1014.desc
    override_background = { reference = bp1_plains_log }

    immediate = {
        save_scope_as = player_character

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }

        global_var:log_ruler = {
            save_scope_as = potential_ruler
        }
    }
    
    right_portrait = {
        character = root
        animation = interested
    }

    option = {
        name = god_young_event.1014.option_1

        random_list = {
            25 = {
                add_piety = 500
                if = {
                    limit = { NOT = { has_trait = brave } }
                    add_trait = brave
                }
                else_if = {
                    limit = { NOT = { has_trait = diligent } }
                    add_trait = diligent
                }
            }
            75 = {
                add_stress = major_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.1014.option_2

        random_list = {
            60 = {
                add_piety = 200
                if = {
                    limit = { NOT = { has_trait = trusting } }
                    add_trait = trusting
                }
            }
            40 = {
                add_stress = minor_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.1014.option_3

        random = {
            chance = 90
            add_piety = 100
        }
        add_trait = patient
        add_stress = miniscule_stress_impact_gain
    }

    option = {
        name = god_young_event.1014.option_4
        add_stress = major_stress_impact_loss
        # No effect
    }
}

god_young_event.2014 = {
    type = character_event
    title = god_young_event.2014.t
    desc = god_young_event.2014.desc
    override_background = { reference = courtyard_night_log }

    immediate = {
        save_scope_as = player_character

        global_var:log_rival_god = {
            save_scope_as = light_god
        }

        global_var:log_ruler = {
            save_scope_as = potential_ruler
        }
    }
    
    right_portrait = {
        character = root
        animation = interested
    }

    option = {
        name = god_young_event.2014.option_1

        random_list = {
            25 = {
                add_piety = 500
                if = {
                    limit = { NOT = { has_trait = ambitious } }
                    add_trait = ambitious
                }
                else_if = {
                    limit = { NOT = { has_trait = wrathful } }
                    add_trait = wrathful
                }
            }
            75 = {
                add_stress = major_stress_impact_gain
                # Flavor-only stress consequence
            }
        }
    }

    option = {
        name = god_young_event.2014.option_2

        random_list = {
            60 = {
                add_piety = 200
                add_dread = 15
                if = {
                    limit = { NOT = { has_trait = callous } }
                    add_trait = callous
                }
            }
            40 = {
                add_stress = minor_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.2014.option_3

        random = {
            chance = 90
            add_piety = 100
        }
        if = {
            limit = { NOT = { has_trait = patient } }
            add_trait = patient
        }
        add_stress = miniscule_stress_impact_gain
    }

    option = {
        name = god_young_event.2014.option_4
        add_stress = major_stress_impact_loss
    }
}

god_young_event.1005 = {
    type = character_event
    title = god_young_event.1005.t
    desc = god_young_event.1005.desc
    override_background = { reference = bp1_plains_log }

    immediate = {
        add_character_flag = light_event_5_complete
    }

    right_portrait = {
        character = root
        animation = chaplain
    }

    option = {
        name = god_young_event.1005.option_1

        random_list = {
            25 = {
                add_piety = 300
                if = { limit = { NOT = { has_trait = chaste } } add_trait = chaste }
                else_if = { limit = { NOT = { has_trait = temperate } } add_trait = temperate }
                add_stress = minor_stress_impact_gain
                if = {
                    limit = {
                        has_any_nickname = yes
                    }
                    remove_nickname = yes
                }                
                give_nickname = nick_the_divine_heart
            }
            75 = {
                add_stress = major_stress_impact_gain
                add_prestige = 50
            }
        }
    }

    option = {
        name = god_young_event.1005.option_2

        random_list = {
            60 = {
                add_piety = 200
                add_prestige = 25
                add_trait = patient
                if = {
                    limit = {
                        has_any_nickname = yes
                    }
                    remove_nickname = yes
                }  
                give_nickname = nick_the_lightbearer
            }
            40 = {
                add_stress = minor_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.1005.option_3

        random = {
            chance = 90
            add_piety = 100
            add_prestige = 10
        }
        add_stress = miniscule_stress_impact_gain
        if = {
            limit = {
                has_any_nickname = yes
            }
            remove_nickname = yes
        }  
        give_nickname = nick_the_shining_one
    }

    option = {
        name = god_young_event.1005.option_4

        add_prestige = 10
        add_stress = medium_stress_impact_loss
        if = {
            limit = {
                has_any_nickname = yes
            }
            remove_nickname = yes
        } 
        give_nickname = nick_the_dawnfire
    }
}

god_young_event.2005 = {
    type = character_event
    title = god_young_event.2005.t
    desc = god_young_event.2005.desc
    override_background = { reference = blood_pool_log }

    immediate = {
        add_character_flag = dark_event_5_complete
    }

    right_portrait = {
        character = root
        animation = chaplain
    }

    option = {
        name = god_young_event.2005.option_1

        random_list = {
            25 = {
                add_piety = 300
                add_dread = 25
                if = { limit = { NOT = { has_trait = arrogant } } add_trait = arrogant }
                else_if = { limit = { NOT = { has_trait = callous } } add_trait = callous }
                add_stress = minor_stress_impact_gain
                if = { limit = { has_any_nickname = yes } remove_nickname = yes }
                give_nickname = nick_the_dreadmirror
            }
            75 = {
                add_stress = major_stress_impact_gain
                add_prestige = 25
            }
        }
    }

    option = {
        name = god_young_event.2005.option_2

        random_list = {
            60 = {
                add_piety = 200
                add_dread = 10
                add_trait = paranoid
                if = { limit = { has_any_nickname = yes } remove_nickname = yes }
                give_nickname = nick_the_soulchain
            }
            40 = {
                add_stress = minor_stress_impact_gain
            }
        }
    }

    option = {
        name = god_young_event.2005.option_3

        random = {
            chance = 90
            add_piety = 100
            add_dread = 5
        }
        add_trait = cynical
        add_stress = miniscule_stress_impact_gain
        if = { limit = { has_any_nickname = yes } remove_nickname = yes }
        give_nickname = nick_the_voidbrand
    }

    option = {
        name = god_young_event.2005.option_4

        add_prestige = 10
        add_stress = medium_stress_impact_loss
        if = { limit = { has_any_nickname = yes } remove_nickname = yes }
        give_nickname = nick_the_nightreaper
    }
}

god_young_event.1006 = {
    type = character_event
    title = god_young_event.1006.t
    desc = god_young_event.1006.desc
    override_background = { reference = bp1_plains_log }

    immediate = {
        add_character_flag = light_event_6_complete

        random_courtier = {
            limit = {
                has_trait = magic_seer
            }
            save_scope_as = seer_character
        }

        random_courtier = {
            limit = { is_adult = yes }
            save_scope_as = loyal_courtier
        }
    }

    left_portrait = {
        character = scope:seer_character
        animation = chaplain
    }

    right_portrait = {
        character = root
        animation = chaplain
    }

    option = {
        name = god_young_event.1006.option_1  # Step onto the altar

        random_list = {
            25 = {
                add_piety = 500
                add_prestige = 50
                scope:loyal_courtier = {
                    add_character_flag = loyal_follower_of_light
                }
                # Optional: add_trait = glowing_eyes_trait
            }
            75 = {
                add_stress = major_stress_impact_gain
                add_prestige = -25
                # Optional: trigger visual event or flavor follow-up
            }
        }
    }

    option = {
        name = god_young_event.1006.option_2  # Let the Seer lead

        random_list = {
            60 = {
                add_piety = 250
                scope:seer_character = {
                    add_opinion = { target = root modifier = blessings_of_divine_opinion }
                }
                add_prestige = 15
            }
            40 = {
                add_stress = minor_stress_impact_gain
                add_prestige = -10
            }
        }
    }

    option = {
        name = god_young_event.1006.option_3  # Quiet vow

        random = {
            chance = 90
            add_piety = 100
            add_prestige = 20
        }
    }

    option = {
        name = god_young_event.1006.option_4  # Refuse ritual
        add_stress = medium_stress_impact_loss
        add_prestige = 5
        # No other effect
    }
}

god_young_event.2006 = {
    type = character_event
    title = god_young_event.2006.t
    desc = god_young_event.2006.desc
    override_background = { reference = bp1_plains_log }

    immediate = {
        add_character_flag = dark_event_6_complete

        create_character = {
            save_scope_as = cultist
            dynasty = none
            age = { 25 45 }
            learning = { 12 17 }
            intrigue = { 12 17 }
            culture = root.culture
            faith = root.faith
            gender = male
            location = root.capital_province
        }

        scope:cultist = {
            add_trait = zealous
            add_trait = sadistic
            add_character_flag = cultist_log
            random_list = {
                50 = {
                    add_trait = education_learning_3
                }
                50 = {
                    add_trait = education_intrigue_3
                }
            }
        }
    }

    left_portrait = {
        character = scope:cultist
        animation = spymaster
    }

    right_portrait = {
        character = root
        animation = aggressive_dagger
    }

    option = {
        name = god_young_event.2006.option_1  # Cut your palm

        random_list = {
            25 = {
                add_piety = 500
                add_dread = 50
                add_courtier = scope:cultist
            }
            75 = {
                add_stress = major_stress_impact_gain
                add_prestige = 10  # Simulates fear or notoriety
            }
        }
    }

    option = {
        name = god_young_event.2006.option_2  # Appoint cultist

        random_list = {
            60 = {
                add_piety = 250
                add_dread = 20
                add_courtier = scope:cultist
            }
            40 = {
                add_stress = minor_stress_impact_gain
                scope:cultist = {
                    death = {
                        killer = root
                        death_reason = death_burned
                    }
                }
            }
        }
    }

    option = {
        name = god_young_event.2006.option_3  # Meditate silently

        random = {
            chance = 90
            add_piety = 100
            add_dread = 5
        }
    }

    option = {
        name = god_young_event.2006.option_4  # Walk away

        add_prestige = 5
        add_stress = medium_stress_impact_loss
        # Optional: add_cult_morale_flag = cult_shaken
    }
}

## Light 7.1 ##
god_young_event.1007 = {
    type = character_event
    title = god_young_event.1007.t
    desc = god_young_event.1007.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = light_event_7_1_complete

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }

    }

    left_portrait = {
        character = scope:dark_god
        animation = threatening
    }

    right_portrait = {
        character = root
        animation = chaplain
    }

    option = {
        name = god_young_event.1007.option_1
        trigger = { prowess >= 38 }

        duel = {
            skill = prowess
            value = 35  # Target difficulty baseline

            65 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -20
                }
                desc = god_duel_wound_1.1.1
                add_piety = 250
                add_prestige = 25
                scope:dark_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_3
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = light_duel_round_1_win
                trigger_event = {
                    id = god_young_event.1017
                }
            }

            35 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.0
                    min = -5
                }
                desc = god_duel_wound_1.1.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = light_duel_round_1_loss
                trigger_event = {
                    id = god_young_event.1017
                }
            }
        }
        stress_impact = {
            brave = miniscule_stress_impact_loss
            craven = minor_stress_impact_gain
        }
    }


    option = {
        name = god_young_event.1007.option_2
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 37  # Slightly easier than Option 1

            55 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.75
                    min = -25
                }
                desc = god_duel_wound_1.2.1
                add_piety = 150
                scope:dark_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_1
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = light_duel_round_1_win
                trigger_event = { id = god_young_event.1017 }
            }

            45 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.75
                    min = 0
                }
                desc = god_duel_wound_1.2.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = light_duel_round_1_loss
                trigger_event = { id = god_young_event.1017 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            brave = miniscule_stress_impact_loss
            calm = minor_stress_impact_loss
            arbitrary = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1007.option_3
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 40  # Easier baseline for deceptive feint

            45 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.5
                    min = -30
                }
                desc = god_duel_wound_1.3.1
                add_piety = 100
                scope:dark_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_1
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = light_duel_round_1_win
                trigger_event = { id = god_young_event.1017 }
            }

            55 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.5
                    min = -10
                }
                desc = god_duel_wound_1.3.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = light_duel_round_1_loss
                trigger_event = { id = god_young_event.1017 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            calm = miniscule_stress_impact_loss
            paranoid = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1007.option_4
        
        duel = {
            skill = prowess
            value = 1000  # Impossible check to ensure failure

            100 = {
                custom_tooltip = god_duel_wound_1.4.1
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    remove_trait = wounded_1
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    remove_trait = wounded_2
                    add_trait = wounded_3
                }

                add_character_flag = light_duel_round_1_loss
                add_character_flag = light_duel_bonus_insight
                trigger_event = { id = god_young_event.1017 }
            }
        }
        stress_impact = {
            base = massive_stress_impact_gain
            patient = minor_stress_impact_loss
            stubborn = minor_stress_impact_loss
            brave = minor_stress_impact_loss
            craven = major_stress_impact_gain
        }
    }
}

## Light 7.2 ##
god_young_event.1017 = {
    type = character_event
    title = god_young_event.1017.t
    desc = god_young_event.1017.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = light_event_7_2_complete

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }
    }

    left_portrait = {
        character = scope:dark_god
        animation = aggressive_axe
    }

    right_portrait = {
        character = root
        animation = aggressive_sword
    }

    option = {
        name = god_young_event.1017.option_1
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 35

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -20
                }
                add_piety = 300
                add_prestige = 25
                scope:dark_god = { add_trait = wounded_3 }
                add_character_flag = light_duel_round_2_win
                trigger_event = { id = god_young_event.1027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = 0
                }
                add_trait = wounded_3
                add_character_flag = light_duel_round_2_loss
                trigger_event = { id = god_young_event.1027 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            brave = miniscule_stress_impact_loss
            wrathful = miniscule_stress_impact_loss
            zealous = minor_stress_impact_loss
            craven = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1017.option_2
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 28

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -50
                }
                add_piety = 200
                scope:dark_god = { add_trait = wounded_2 }
                add_character_flag = light_duel_round_2_win
                trigger_event = { id = god_young_event.1027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -10
                }
                add_trait = wounded_1
                add_character_flag = light_duel_round_2_loss
                trigger_event = { id = god_young_event.1027 }
            }
        }
        stress_impact = {
            base = minor_stress_impact_gain
            calm = minor_stress_impact_loss
            patient = miniscule_stress_impact_loss
            stubborn = miniscule_stress_impact_loss
            arbitrary = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1017.option_3
        trigger = { prowess >= 25 }

        duel = {
            skill = prowess
            value = 12

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.0
                    min = -50
                }
                add_piety = 100
                scope:dark_god = { add_trait = wounded_1 }
                add_character_flag = light_duel_round_2_win
                trigger_event = { id = god_young_event.1027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.0
                    min = -40
                }
                add_character_flag = light_duel_round_2_loss
                trigger_event = { id = god_young_event.1027 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            paranoid = minor_stress_impact_loss
            deceitful = miniscule_stress_impact_loss
            brave = minor_stress_impact_gain
            honest = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.1017.option_4
        trigger = {
            has_character_flag = light_duel_bonus_insight
        }
        trait = young_god_light
        
        custom_tooltip = god_duel_insight_strike
        add_piety = 350
        add_prestige = 50
        scope:dark_god = { add_trait = wounded_3 }
        add_character_flag = light_duel_round_2_win
        trigger_event = { id = god_young_event.1027 }
        stress_impact = {
            base = miniscule_stress_impact_gain
            patient = miniscule_stress_impact_loss
            brave = miniscule_stress_impact_loss
        }
    }
}

## Light 7.3: Flag Checker and Router ##
god_young_event.1027 = {
    type = character_event
    title = god_young_event.1027.t
    desc = god_young_event.1027.d
    hidden = yes

    immediate = {
        add_character_flag = light_event_7_3_router_complete

        # Victory: Win both rounds
        if = {
            limit = {
                has_character_flag = light_duel_round_1_win
                has_character_flag = light_duel_round_2_win
            }
            trigger_event = { id = god_young_event.1028 }
        }

        # Tiebreak: Win one, lose one
        else_if = {
            limit = {
                OR = {
                    AND = {
                        has_character_flag = light_duel_round_1_win
                        has_character_flag = light_duel_round_2_loss
                    }
                    AND = {
                        has_character_flag = light_duel_round_1_loss
                        has_character_flag = light_duel_round_2_win
                    }
                }
            }
            trigger_event = { id = god_young_event.1029 }
        }

        # Death: Lost both
        else = {
            trigger_event = { id = god_young_event.1030 }
        }
    }

    option = { name = OK }
}

## Light 7.3: Final Clash – Victory ##
god_young_event.1028 = {
    type = character_event
    title = god_young_event.1028.t
    desc = god_young_event.1028.desc_victory
    override_background = { reference = battle_02_log }

    immediate = {
        add_character_flag = light_event_7_3_complete

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }
    }

    left_portrait = {
        character = scope:dark_god
        animation = throne_room_kneel_1
    }

    right_portrait = {
        character = root
        animation = war_over_win
    }

    # Option 1: Strike the killing blow
    option = {
        name = god_young_event.1028.option_1
        custom_tooltip = god_young_event.1028.option_1.tt
        add_piety = 1000
        add_prestige = 100
        remove_trait = young_god_light
        add_trait = angel_full_god
        scope:dark_god = {
            death = {
                death_reason = death_execution
                killer = root
            }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
        }
    }

    # Option 2: Seal their power
    option = {
        name = god_young_event.1028.option_2
        custom_tooltip = god_young_event.1028.option_2.tt
        add_piety = 500
        remove_trait = young_god_light
        add_trait = angel_full_god
        scope:dark_god = {
            remove_trait = young_god_dark
            remove_trait = beauty_good_3
            remove_trait = intellect_good_3
            remove_trait = physique_good_3
            remove_trait = beauty_good_2
            remove_trait = intellect_good_2
            remove_trait = physique_good_2
            remove_trait = beauty_good_1
            remove_trait = intellect_good_1
            remove_trait = physique_good_1
            remove_trait = beauty_bad_3
            remove_trait = intellect_bad_3
            remove_trait = physique_bad_3
            remove_trait = beauty_bad_2
            remove_trait = intellect_bad_2
            remove_trait = physique_bad_2
            remove_trait = beauty_bad_1
            remove_trait = intellect_bad_1
            remove_trait = physique_bad_1
            add_trait = physique_bad_3
            add_trait = beauty_bad_3
            add_trait = intellect_bad_3
        }
        imprison = {
			target = scope:dark_god
			type = house_arrest
		}
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 3: Offer unity/path forward
    option = {
        name = god_young_event.1028.option_3
        custom_tooltip = god_young_event.1028.option_3.tt
        scope:dark_god = {
            remove_trait = young_god_dark
            remove_trait = beauty_good_3
            remove_trait = intellect_good_3
            remove_trait = physique_good_3
            remove_trait = beauty_good_2
            remove_trait = intellect_good_2
            remove_trait = physique_good_2
            remove_trait = beauty_good_1
            remove_trait = intellect_good_1
            remove_trait = physique_good_1
            remove_trait = beauty_bad_3
            remove_trait = intellect_bad_3
            remove_trait = physique_bad_3
            remove_trait = beauty_bad_2
            remove_trait = intellect_bad_2
            remove_trait = physique_bad_2
            remove_trait = beauty_bad_1
            remove_trait = intellect_bad_1
            remove_trait = physique_bad_1
            remove_trait = wounded_1
            remove_trait = wounded_2
            remove_trait = wounded_3
            add_trait = angel
            set_character_faith = root.faith
            trigger_event = { id = angel_trait_mod.101 }
            trigger_event = { id = angel_trait_mod.100 }
        }
        remove_trait = young_god_light
        add_trait = angel_full_god
        add_courtier = scope:dark_god
        add_character_flag = dual_god_path_unlocked
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 4: Walk away in triumph
    option = {
        name = god_young_event.1028.option_4
        custom_tooltip = god_young_event.1028.option_4.tt
        add_prestige = 2500
        add_piety = 250
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }
}

## Light 7.3 – Final Duel: Tiebreaker ##
god_young_event.1029 = {
    type = character_event
    title = god_young_event.1029.t
    desc = god_young_event.1029.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = light_event_7_3_complete

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }
    }

    left_portrait = {
        character = scope:dark_god
        animation = sword_yield_start
    }

    right_portrait = {
        character = root
        animation = sword_coup_degrace
    }

    option = {
        name = god_young_event.1029.option_1
        trigger = { prowess >= 38 }

        duel = {
            skill = prowess
            value = 35
            85 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -5
                }
                desc = god_duel_wound_1.5.1
                add_piety = 500
                add_prestige = 100
                scope:dark_god = { add_trait = wounded_3 }
                add_character_flag = light_duel_tiebreak_win
                trigger_event = { id = god_young_event.1028 }
            }
            15 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = 0
                }
                desc = god_duel_wound_1.5.2
                add_trait = wounded_2
                add_character_flag = light_duel_tiebreak_loss
                trigger_event = { id = god_young_event.1030 }
            }
        }

        stress_impact = {
            brave = miniscule_stress_impact_loss
            craven = minor_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_boldness = 1
                ai_energy = 1
            }
        }
    }

    option = {
        name = god_young_event.1029.option_2
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 37
            75 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.25
                    min = -10
                }
                desc = god_duel_wound_1.5.3
                add_piety = 300
                scope:dark_god = { add_trait = wounded_2 }
                add_character_flag = light_duel_tiebreak_win
                trigger_event = { id = god_young_event.1028 }
            }
            25 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.25
                    min = 0
                }
                desc = god_duel_wound_1.5.4
                add_trait = wounded_1
                add_character_flag = light_duel_tiebreak_loss
                trigger_event = { id = god_young_event.1030 }
            }
        }

        stress_impact = {
            base = medium_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_boldness = 0.5
            }
        }
    }

    option = {
        name = god_young_event.1029.option_3
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 40
            65 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -20
                }
                desc = god_duel_wound_1.5.5
                add_piety = 200
                scope:dark_god = { add_trait = wounded_1 }
                add_character_flag = light_duel_tiebreak_win
                trigger_event = { id = god_young_event.1028 }
            }
            35 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.0
                    min = -10
                }
                desc = god_duel_wound_1.5.6
                add_stress = 100
                add_character_flag = light_duel_tiebreak_loss
                trigger_event = { id = god_young_event.1030 }
            }
        }

        stress_impact = {
            base = medium_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_energy = -0.5
            }
        }
    }

    option = {
        name = god_young_event.1029.option_4
        custom_tooltip = god_duel_tiebreak_walkaway

        add_stress = 200
        add_trait = wounded_1
        add_character_flag = light_duel_tiebreak_loss
        trigger_event = { id = god_young_event.1030 }

        stress_impact = {
            base = massive_stress_impact_gain
            calm = minor_stress_impact_loss
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_boldness = -1
                ai_energy = -1
            }
        }
    }

    option = {
        name = god_young_event.1029.option_5
        trigger = { has_trait = brave }
        trait = brave

        add_stress = massive_stress_gain
        custom_tooltip = god_duel_tiebreak_walkaway

        add_character_flag = light_duel_tiebreak_loss
        trigger_event = { id = god_young_event.1030 }

        stress_impact = {
            base = massive_stress_impact_gain
            stubborn = minor_stress_impact_loss
        }
        ai_chance = {
            base = 1000
        }
    }

}

# Death: Lost both
god_young_event.1030 = {
    type = character_event
    title = god_young_event.1030.t
    desc = god_young_event.1030.desc
    override_background = { reference = battle_03_log }

    immediate = {
        add_character_flag = light_event_7_3_complete

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }
        global_var:log_ruler = {
            save_scope_as = potential_ruler
        }
    }

    left_portrait = {
        character = root
        animation = throne_room_kneel_1
    }

    right_portrait = {
        character = scope:dark_god
        animation = assassin
    }

    # Option 1: Face execution
    option = {
        name = god_young_event.1030.option_1
        custom_tooltip = god_young_event.1030.option_1.tt
        death = {
            death_reason = death_execution
            killer = scope:dark_god
        }
        scope:dark_god = {
            remove_trait = young_god_dark
            add_trait = fallen_god
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 2: Stripped of power, imprisoned
    option = {
        name = god_young_event.1030.option_2
        custom_tooltip = god_young_event.1030.option_2.tt
        remove_trait = young_god_light
        remove_trait = angel_full_god
        remove_trait = beauty_good_3
        remove_trait = intellect_good_3
        remove_trait = physique_good_3
        remove_trait = beauty_good_2
        remove_trait = intellect_good_2
        remove_trait = physique_good_2
        remove_trait = beauty_good_1
        remove_trait = intellect_good_1
        remove_trait = physique_good_1
        add_trait = beauty_bad_2
        add_trait = intellect_bad_2
        add_trait = physique_bad_2

        every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:dark_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        scope:dark_god = {
            remove_trait = young_god_dark
            add_trait = fallen_god
            imprison = {
                target = root
                type = dungeon
            }
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 3: Corrupted into dark path
    option = {
        name = god_young_event.1030.option_3
        custom_tooltip = god_young_event.1030.option_3.tt
        remove_trait = young_god_light
        remove_trait = angel_full_god
        remove_trait = beauty_good_3
        remove_trait = intellect_good_3
        remove_trait = physique_good_3
        remove_trait = beauty_good_2
        remove_trait = intellect_good_2
        remove_trait = physique_good_2
        remove_trait = beauty_good_1
        remove_trait = intellect_good_1
        remove_trait = physique_good_1
        remove_trait = wounded_1
        remove_trait = wounded_2
        remove_trait = wounded_3
        add_trait = dark_angel
        trigger_event = { id = angel_trait_mod.101 }
        trigger_event = { id = angel_trait_mod.100 }  # Optional: corruption storyline

        every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:dark_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        # Create a fealty transfer
        create_title_and_vassal_change = {
            type = swear_fealty
            save_scope_as = fealty_change
            add_claim_on_loss = no
        }

        change_liege = {
            liege = scope:dark_god
            change = scope:fealty_change
        }

        resolve_title_and_vassal_change = scope:fealty_change

        scope:dark_god = {
            remove_trait = young_god_dark
            add_trait = fallen_god
            add_gold = root.gold
            add_prestige = 2500
            add_piety = 50
            imprison = {
                target = root
                type = dungeon
            }
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 4: Flee, broken but alive
    option = {
        name = god_young_event.1030.option_4
        custom_tooltip = god_young_event.1030.option_4.tt
        add_stress = 100
        remove_trait = young_god_light
        remove_trait = angel_full_god
        add_trait = wounded_2

                every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:dark_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        scope:dark_god = {
            remove_trait = young_god_dark
            add_trait = fallen_god
            add_gold = root.gold
            add_prestige = 2500
            add_piety = 50
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }
    
}

god_young_event.9999 = {
    type = character_event
    title = god_young_event.9999.t
    desc = god_young_event.9999.desc
    hidden = yes

    immediate = {

        global_var:log_rival_god = {
            save_scope_as = dark_god
        }

        # Duel outcome flags
        remove_character_flag = light_duel_round_1_win
        remove_character_flag = light_duel_round_1_loss
        remove_character_flag = light_duel_round_2_win
        remove_character_flag = light_duel_round_2_loss
        remove_character_flag = dark_duel_round_1_win
        remove_character_flag = dark_duel_round_1_loss
        remove_character_flag = dark_duel_round_2_win
        remove_character_flag = dark_duel_round_2_loss

        # Bonus/branching flags
        remove_character_flag = light_duel_bonus_insight
        remove_character_flag = light_duel_bonus_reserve
        remove_character_flag = dual_god_path_unlocked
        remove_character_flag = chained_dark_god_remnant
        remove_character_flag = flag_god_event_0002_seen
        remove_character_flag = dark_duel_bonus_insight
        remove_character_flag = dark_duel_bonus_reserve
        remove_character_flag = chained_light_god_remnant
        remove_trait = wounded_1
        remove_trait = wounded_2
        remove_trait = wounded_3
        remove_trait = lustful
        remove_trait = gluttonous
        remove_trait = greedy
        remove_trait = lazy
        remove_trait = wrathful
        remove_trait = impatient
        remove_trait = arrogant
        remove_trait = deceitful
        remove_trait = craven
        remove_trait = shy
        remove_trait = ambitious
        remove_trait = arbitrary
        remove_trait = cynical
        remove_trait = paranoid
        remove_trait = callous
        remove_trait = sadistic
        remove_trait = stubborn
        remove_trait = vengeful
        remove_trait = angel_full_god
        remove_trait = angel
        remove_trait = dark_angel
        add_trait = young_god_dark
        add_trait = brave
        
        trigger_event = { id = angel_trait_mod.101 }
        trigger_event = { id = angel_trait_mod.100 }
        
        scope:dark_god = {
            death = {
				killer = scope:root
				death_reason = death_burned
			}
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    option = {
        name = OK
    }
}

## Dark 7.1 ##
god_young_event.2007 = {
    type = character_event
    title = god_young_event.2007.t
    desc = god_young_event.2007.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = dark_event_7_1_complete

        global_var:log_rival_god = {
            save_scope_as = light_god
        }

    }

    left_portrait = {
        character = scope:light_god
        animation = inspect_weapon
    }

    right_portrait = {
        character = root
        animation = marshal_axe
    }

    option = {
        name = god_young_event.2007.option_1
        trigger = { prowess >= 38 }

        duel = {
            skill = prowess
            value = 35  # Target difficulty baseline

            65 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -20
                }
                desc = god_duel_wound_d_1.1.1
                add_piety = 250
                add_prestige = 25
                scope:light_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_3
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = dark_duel_round_1_win
                trigger_event = {
                    id = god_young_event.2017
                }
            }

            35 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.0
                    min = -5
                }
                desc = god_duel_wound_d_1.1.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = dark_duel_round_1_loss
                trigger_event = {
                    id = god_young_event.2017
                }
            }
        }
        stress_impact = {
            brave = miniscule_stress_impact_loss
            craven = minor_stress_impact_gain
        }
    }


    option = {
        name = god_young_event.2007.option_2
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 37  # Slightly easier than Option 1

            55 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.75
                    min = -25
                }
                desc = god_duel_wound_d_1.2.1
                add_piety = 150
                scope:light_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_1
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = dark_duel_round_1_win
                trigger_event = { id = god_young_event.2017 }
            }

            45 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.75
                    min = 0
                }
                desc = god_duel_wound_d_1.2.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = dark_duel_round_1_loss
                trigger_event = { id = god_young_event.2017 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            brave = miniscule_stress_impact_loss
            calm = minor_stress_impact_loss
            arbitrary = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2007.option_3
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 40  # Easier baseline for deceptive feint

            45 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.5
                    min = -30
                }
                desc = god_duel_wound_d_1.3.1
                add_piety = 100
                scope:light_god = {
                    if = {
                        limit = {
                            NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                        }
                        add_trait = wounded_1
                    }
                    else_if = {
                        limit = { has_trait = wounded_1 NOT = { has_trait = wounded_2 } }
                        hidden_effect = { remove_trait = wounded_1 }
                        add_trait = wounded_2
                    }
                    else_if = {
                        limit = { has_trait = wounded_2 NOT = { has_trait = wounded_3 } }
                        hidden_effect = { remove_trait = wounded_2 }
                        add_trait = wounded_3
                    }
                }
                add_character_flag = dark_duel_round_1_win
                trigger_event = { id = god_young_event.2017 }
            }

            55 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.5
                    min = -10
                }
                desc = god_duel_wound_d_1.3.2
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    hidden_effect = { remove_trait = wounded_1 }
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    hidden_effect = { remove_trait = wounded_2 }
                    add_trait = wounded_3
                }
                add_character_flag = dark_duel_round_1_loss
                trigger_event = { id = god_young_event.2017 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            calm = miniscule_stress_impact_loss
            paranoid = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2007.option_4
        
        duel = {
            skill = prowess
            value = 1000  # Impossible check to ensure failure

            100 = {
                custom_tooltip = god_duel_wound_d_1.4.1
                if = {
                    limit = {
                        NOT = { OR = { has_trait = wounded_1 has_trait = wounded_2 has_trait = wounded_3 } }
                    }
                    add_trait = wounded_1
                }
                else_if = {
                    limit = { has_trait = wounded_1 }
                    remove_trait = wounded_1
                    add_trait = wounded_2
                }
                else_if = {
                    limit = { has_trait = wounded_2 }
                    remove_trait = wounded_2
                    add_trait = wounded_3
                }

                add_character_flag = dark_duel_round_1_loss
                add_character_flag = dark_duel_bonus_insight
                trigger_event = { id = god_young_event.2017 }
            }
        }
        stress_impact = {
            base = massive_stress_impact_gain
            patient = minor_stress_impact_loss
            stubborn = minor_stress_impact_loss
            brave = minor_stress_impact_loss
            craven = major_stress_impact_gain
        }
    }
}

## Dark 7.2 ##
god_young_event.2017 = {
    type = character_event
    title = god_young_event.2017.t
    desc = god_young_event.2017.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = dark_event_7_2_complete

        global_var:log_rival_god = {
            save_scope_as = light_god
        }
    }

    left_portrait = {
        character = scope:light_god
        animation = aggressive_sword
    }

    right_portrait = {
        character = root
        animation = aggressive_axe
    }

    option = {
        name = god_young_event.2017.option_1
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 35

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -20
                }
                add_piety = 300
                add_prestige = 25
                scope:light_god = { add_trait = wounded_3 }
                add_character_flag = dark_duel_round_2_win
                trigger_event = { id = god_young_event.2027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = 0
                }
                add_trait = wounded_3
                add_character_flag = dark_duel_round_2_loss
                trigger_event = { id = god_young_event.2027 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            brave = miniscule_stress_impact_loss
            wrathful = miniscule_stress_impact_loss
            zealous = minor_stress_impact_loss
            craven = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2017.option_2
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 28

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -50
                }
                add_piety = 200
                scope:light_god = { add_trait = wounded_2 }
                add_character_flag = dark_duel_round_2_win
                trigger_event = { id = god_young_event.2027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -10
                }
                add_trait = wounded_1
                add_character_flag = dark_duel_round_2_loss
                trigger_event = { id = god_young_event.2027 }
            }
        }
        stress_impact = {
            base = minor_stress_impact_gain
            calm = minor_stress_impact_loss
            patient = miniscule_stress_impact_loss
            stubborn = miniscule_stress_impact_loss
            arbitrary = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2017.option_3
        trigger = { prowess >= 25 }

        duel = {
            skill = prowess
            value = 12

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 2.0
                    min = -50
                }
                add_piety = 100
                scope:light_god = { add_trait = wounded_1 }
                add_character_flag = dark_duel_round_2_win
                trigger_event = { id = god_young_event.2027 }
            }

            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -2.0
                    min = -40
                }
                add_character_flag = dark_duel_round_2_loss
                trigger_event = { id = god_young_event.2027 }
            }
        }
        stress_impact = {
            base = medium_stress_impact_gain
            paranoid = minor_stress_impact_loss
            deceitful = miniscule_stress_impact_loss
            brave = minor_stress_impact_gain
            honest = minor_stress_impact_gain
        }
    }

    option = {
        name = god_young_event.2017.option_4
        trigger = {
            has_character_flag = dark_duel_bonus_insight
        }
        trait = young_god_dark
        
        custom_tooltip = god_duel_insight_strike_dark
        add_piety = 350
        add_prestige = 50
        scope:light_god = { add_trait = wounded_3 }
        add_character_flag = dark_duel_round_2_win
        trigger_event = { id = god_young_event.2027 }
        stress_impact = {
            base = miniscule_stress_impact_gain
            patient = miniscule_stress_impact_loss
            brave = miniscule_stress_impact_loss
        }
    }
}

## Dark 7.3: Flag Checker and Router ##
god_young_event.2027 = {
    type = character_event
    title = god_young_event.2027.t
    desc = god_young_event.2027.d
    hidden = yes

    immediate = {
        add_character_flag = dark_event_7_3_router_complete

        # Victory: Win both rounds
        if = {
            limit = {
                has_character_flag = dark_duel_round_1_win
                has_character_flag = dark_duel_round_2_win
            }
            trigger_event = { id = god_young_event.2028 }
        }

        # Tiebreak: Win one, lose one
        else_if = {
            limit = {
                OR = {
                    AND = {
                        has_character_flag = dark_duel_round_1_win
                        has_character_flag = dark_duel_round_2_loss
                    }
                    AND = {
                        has_character_flag = dark_duel_round_1_loss
                        has_character_flag = dark_duel_round_2_win
                    }
                }
            }
            trigger_event = { id = god_young_event.2029 }
        }

        # Death: Lost both
        else = {
            trigger_event = { id = god_young_event.2030 }
        }
    }

    option = { name = OK }
}

## Dark 7.3 – Final Duel: Tiebreaker ##
god_young_event.2029 = {
    type = character_event
    title = god_young_event.2029.t
    desc = god_young_event.2029.desc
    override_background = { reference = battle_01_log }

    immediate = {
        add_character_flag = battle_01_log

        global_var:log_rival_god = {
            save_scope_as = light_god
        }
    }

    left_portrait = {
        character = scope:light_god
        animation = sword_yield_start
    }

    right_portrait = {
        character = root
        animation = sword_coup_degrace
    }

    option = {
        name = god_young_event.2029.option_1
        trigger = { prowess >= 38 }

        duel = {
            skill = prowess
            value = 35
            85 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -5
                }
                desc = god_duel_wound_d_3.1.1
                add_piety = 500
                add_prestige = 100
                scope:light_god = { add_trait = wounded_3 }
                add_character_flag = dark_duel_tiebreak_win
                trigger_event = { id = god_young_event.2028 }
            }
            15 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = 0
                }
                desc = god_duel_wound_d_3.1.2
                add_trait = wounded_2
                add_character_flag = dark_duel_tiebreak_loss
                trigger_event = { id = god_young_event.2030 }
            }
        }

        stress_impact = {
            brave = miniscule_stress_impact_loss
            craven = minor_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_boldness = 1
                ai_energy = 1
            }
        }
    }

    option = {
        name = god_young_event.2029.option_2
        trigger = { prowess >= 33 }

        duel = {
            skill = prowess
            value = 37
            75 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.25
                    min = -10
                }
                desc = god_duel_wound_d_3.2.1
                add_piety = 300
                scope:light_god = { add_trait = wounded_2 }
                add_character_flag = dark_duel_tiebreak_win
                trigger_event = { id = god_young_event.2028 }
            }
            25 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.25
                    min = 0
                }
                desc = god_duel_wound_d_3.2.2
                add_trait = wounded_1
                add_character_flag = dark_duel_tiebreak_loss
                trigger_event = { id = god_young_event.2030 }
            }
        }

        stress_impact = {
            base = medium_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_boldness = 0.5
            }
        }
    }

    option = {
        name = god_young_event.2029.option_3
        trigger = { prowess >= 28 }

        duel = {
            skill = prowess
            value = 40
            65 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.0
                    min = -20
                }
                desc = god_duel_wound_d_3.3.1
                add_piety = 200
                scope:light_god = { add_trait = wounded_1 }
                add_character_flag = dark_duel_tiebreak_win
                trigger_event = { id = god_young_event.2028 }
            }
            35 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.0
                    min = -10
                }
                desc = god_duel_wound_d_3.3.2
                add_stress = 100
                add_character_flag = dark_duel_tiebreak_loss
                trigger_event = { id = god_young_event.2030 }
            }
        }

        stress_impact = {
            base = medium_stress_impact_gain
        }
        ai_chance = {
            base = 1
            ai_value_modifier = {
                ai_energy = -0.5
            }
        }
    }

    option = {
        name = god_young_event.2029.option_4
        custom_tooltip = god_duel_tiebreak_walkaway_dark

        add_stress = 200
        add_trait = wounded_1
        add_character_flag = dark_duel_tiebreak_loss
        trigger_event = { id = god_young_event.2030 }

        stress_impact = {
            base = massive_stress_impact_gain
            calm = minor_stress_impact_loss
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_boldness = -1
                ai_energy = -1
            }
        }
    }

    option = {
        name = god_young_event.2029.option_5
        trigger = { has_trait = brave }
        trait = brave

        add_stress = massive_stress_gain
        custom_tooltip = god_duel_tiebreak_walkaway

        add_character_flag = dark_duel_tiebreak_loss
        trigger_event = { id = god_young_event.2030 }

        stress_impact = {
            base = massive_stress_impact_gain
            stubborn = minor_stress_impact_loss
        }
        ai_chance = {
            base = 1000
        }
    }

}

## Dark 7.3: Dark Final Clash – Victory ##
god_young_event.2028 = {
    type = character_event
    title = god_young_event.2028.t
    desc = god_young_event.2028.desc_victory
    override_background = { reference = battle_03_log }

    immediate = {
        add_character_flag = dark_event_7_3_complete

        global_var:log_rival_god = {
            save_scope_as = light_god
        }
    }

    left_portrait = {
        character = scope:light_god
        animation = throne_room_kneel_1
    }

    right_portrait = {
        character = root
        animation = assassin
    }

    # Option 1: Strike the killing blow
    option = {
        name = god_young_event.2028.option_1
        custom_tooltip = god_young_event.2028.option_1.tt
        add_piety = 100
        add_prestige = 1000
        remove_trait = young_god_dark
        add_trait = fallen_god
        scope:light_god = {
            death = {
                death_reason = death_execution
                killer = root
            }
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 2: Seal their power
    option = {
        name = god_young_event.2028.option_2
        custom_tooltip = god_young_event.2028.option_2.tt
        add_prestige = 500
        remove_trait = young_god_dark
        add_trait = fallen_god
        scope:light_god = {
            remove_trait = young_god_light
            remove_trait = beauty_good_3
            remove_trait = intellect_good_3
            remove_trait = physique_good_3
            remove_trait = beauty_good_2
            remove_trait = intellect_good_2
            remove_trait = physique_good_2
            remove_trait = beauty_good_1
            remove_trait = intellect_good_1
            remove_trait = physique_good_1
            remove_trait = beauty_bad_3
            remove_trait = intellect_bad_3
            remove_trait = physique_bad_3
            remove_trait = beauty_bad_2
            remove_trait = intellect_bad_2
            remove_trait = physique_bad_2
            remove_trait = beauty_bad_1
            remove_trait = intellect_bad_1
            remove_trait = physique_bad_1
            add_trait = physique_bad_3
            add_trait = beauty_bad_3
            add_trait = intellect_bad_3
        }
        imprison = {
			target = scope:light_god
			type = house_arrest
		}
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 3: Offer unity/path forward
    option = {
        name = god_young_event.2028.option_3
        custom_tooltip = god_young_event.2028.option_3.tt
        scope:light_god = {
            remove_trait = young_god_light
            remove_trait = beauty_good_3
            remove_trait = intellect_good_3
            remove_trait = physique_good_3
            remove_trait = beauty_good_2
            remove_trait = intellect_good_2
            remove_trait = physique_good_2
            remove_trait = beauty_good_1
            remove_trait = intellect_good_1
            remove_trait = physique_good_1
            remove_trait = beauty_bad_3
            remove_trait = intellect_bad_3
            remove_trait = physique_bad_3
            remove_trait = beauty_bad_2
            remove_trait = intellect_bad_2
            remove_trait = physique_bad_2
            remove_trait = beauty_bad_1
            remove_trait = intellect_bad_1
            remove_trait = physique_bad_1
            remove_trait = wounded_1
            remove_trait = wounded_2
            remove_trait = wounded_3
            add_trait = dark_angel
            set_character_faith = root.faith
            trigger_event = { id = angel_trait_mod.101 }
            trigger_event = { id = angel_trait_mod.100 }
        }
        remove_trait = young_god_dark
        add_trait = fallen_god
        add_courtier = scope:light_god
        add_character_flag = dual_god_path_unlocked
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 4: Walk away in triumph
    option = {
        name = god_young_event.2028.option_4
        custom_tooltip = god_young_event.2028.option_4.tt
        add_prestige = 2500
        add_piety = 250
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }
}

# Dark Death: Lost both
god_young_event.2030 = {
    type = character_event
    title = god_young_event.2030.t
    desc = god_young_event.2030.desc
    override_background = { reference = battle_02_log }

    immediate = {
        add_character_flag = dark_event_7_3_complete

        global_var:log_rival_god = {
            save_scope_as = light_god
        }
        global_var:log_ruler = {
            save_scope_as = potential_ruler
        }
    }

    left_portrait = {
        character = root
        animation = throne_room_kneel_1
    }

    right_portrait = {
        character = scope:light_god
        animation = war_over_win
    }

    # Option 1: Face execution
    option = {
        name = god_young_event.2030.option_1
        custom_tooltip = god_young_event.2030.option_1.tt
        death = {
            death_reason = death_execution
            killer = scope:light_god
        }
        scope:light_god = {
            remove_trait = young_god_light
            add_trait = angel_full_god
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 2: Stripped of power, imprisoned
    option = {
        name = god_young_event.2030.option_2
        custom_tooltip = god_young_event.2030.option_2.tt
        remove_trait = young_god_dark
        remove_trait = fallen_god
        remove_trait = beauty_good_3
        remove_trait = intellect_good_3
        remove_trait = physique_good_3
        remove_trait = beauty_good_2
        remove_trait = intellect_good_2
        remove_trait = physique_good_2
        remove_trait = beauty_good_1
        remove_trait = intellect_good_1
        remove_trait = physique_good_1
        add_trait = beauty_bad_2
        add_trait = intellect_bad_2
        add_trait = physique_bad_2

        every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:light_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        

        scope:light_god = {
            remove_trait = young_god_light
            add_trait = angel_full_god
            imprison = {
                target = root
                type = dungeon
            }
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 3: Corrupted into dark path
    option = {
        name = god_young_event.2030.option_3
        custom_tooltip = god_young_event.2030.option_3.tt
        remove_trait = young_god_dark
        remove_trait = fallen_god
        remove_trait = beauty_good_3
        remove_trait = intellect_good_3
        remove_trait = physique_good_3
        remove_trait = beauty_good_2
        remove_trait = intellect_good_2
        remove_trait = physique_good_2
        remove_trait = beauty_good_1
        remove_trait = intellect_good_1
        remove_trait = physique_good_1
        remove_trait = wounded_1
        remove_trait = wounded_2
        remove_trait = wounded_3
        add_trait = angel
        trigger_event = { id = angel_trait_mod.101 }
        trigger_event = { id = angel_trait_mod.100 }  # Optional: corruption storyline

        every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:light_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        # Create a fealty transfer
        create_title_and_vassal_change = {
            type = swear_fealty
            save_scope_as = fealty_change
            add_claim_on_loss = no
        }

        change_liege = {
            liege = scope:light_god
            change = scope:fealty_change
        }

        resolve_title_and_vassal_change = scope:fealty_change

        scope:light_god = {
            remove_trait = young_god_light
            add_trait = angel_full_god
            add_gold = root.gold
            add_prestige = 2500
            add_piety = 50
            imprison = {
                target = root
                type = dungeon
            }
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }

    # Option 4: Flee, broken but alive
    option = {
        name = god_young_event.2030.option_4
        custom_tooltip = god_young_event.2030.option_4.tt
        add_stress = 100
        remove_trait = young_god_dark
        remove_trait = fallen_god
        add_trait = wounded_2

                every_held_title = {
			add_to_temporary_list = titles_to_destroy
		}

		every_in_list = {
			list = titles_to_destroy
			holder = {
				destroy_title = prev
			}
		}

        # Start transfer scope
        create_title_and_vassal_change = {
            type = granted
            save_scope_as = title_change
            add_claim_on_loss = no
        }

        # Gather and transfer titles to dark god
        every_held_title = {
            limit = { tier < tier_kingdom }
            change_title_holder = {
                holder = scope:light_god
                change = scope:title_change
                take_baronies = yes
            }
        }

        # Finalize transfer
        resolve_title_and_vassal_change = scope:title_change

        scope:light_god = {
            remove_trait = young_god_light
            add_trait = angel_full_god
            add_gold = root.gold
            add_prestige = 2500
            add_piety = 50
        }
        remove_global_variable = log_rival_god
        remove_global_variable = log_ruler
    }
}

god_young_event.9100 = {
    type = character_event
    hidden = no
    title = god_young_event.9100.t
    desc = god_young_event.9100.desc

    trigger = {
        is_alive = yes
        is_playable_character = yes
        has_trait = young_god_light
    }

    immediate = {
        if = {
            limit = { NOT = { has_variable = god_light_ascension_years } }
            set_variable = { name = god_light_ascension_years value = 0 }
        }
    }

    option = {
        name = god_young_event.9100.option_1
        trigger = { var:god_light_ascension_years >= 3 }

        ai_chance = {
            base = 100
        }

        remove_character_flag = become_full_god_light
        remove_trait = young_god_light
        add_trait = angel_full_god
        add_prestige = 250
        add_piety = 250
        remove_variable = god_light_ascension_years
        trigger_event = angel_trait_mod.100
        trigger_event = angel_trait_mod.102
    }

    option = {
        name = god_young_event.9100.option_2
        trigger = { piety >= 2500 }

        ai_chance = {
            base = 100
        }

        add_piety = -2500
        remove_character_flag = become_full_god_light
        remove_trait = young_god_light
        add_trait = angel_full_god
        add_prestige = 1000
        remove_variable = god_light_ascension_years
        trigger_event = angel_trait_mod.100
        trigger_event = angel_trait_mod.102
    }

    option = {
        name = god_young_event.9100.option_3

        ai_chance = {
            base = 100
            modifier = {
                add = -100
                OR = {
                    var:god_light_ascension_years >= 2
                    piety >= 2500
                }
            }
        }

        hidden_effect = {
            change_variable = { name = god_light_ascension_years add = 1 }
        }
    }

    option = {
        name = god_young_event.9100.option_4
        trigger = { var:god_light_ascension_years >= 2 }

        ai_chance = {
            base = 0
        }

        hidden_effect = {
            set_variable = { name = god_light_ascension_years value = 0 }
        }
    }
}

god_young_event.9101 = {
    type = character_event
    hidden = no
    title = god_young_event.9101.t
    desc = god_young_event.9101.desc

    trigger = {
        is_alive = yes
        is_playable_character = yes
        has_trait = young_god_dark
    }

    immediate = {
        if = {
            limit = { NOT = { has_variable = god_dark_ascension_years } }
            set_variable = { name = god_dark_ascension_years value = 0 }
        }
    }

    # Option 1 — Ascend via time
    option = {
        name = god_young_event.9101.option_1
        trigger = { var:god_dark_ascension_years >= 3 }

        ai_chance = {
            base = 100
        }

        remove_character_flag = become_full_god_dark
        remove_trait = young_god_dark
        add_trait = fallen_god
        add_prestige = 250
        add_dread = 30
        remove_variable = god_dark_ascension_years
        trigger_event = angel_trait_mod.100
        trigger_event = angel_trait_mod.102
    }

    # Option 2 — Ascend via prestige
    option = {
        name = god_young_event.9101.option_2
        trigger = { prestige >= 2500 }

        ai_chance = {
            base = 100
        }

        add_prestige = -2500
        add_piety = 1000
        remove_character_flag = become_full_god_dark
        remove_trait = young_god_dark
        add_trait = fallen_god
        add_dread = 30
        remove_variable = god_dark_ascension_years
        trigger_event = angel_trait_mod.100
        trigger_event = angel_trait_mod.102
    }

    # Option 3 — Wait and increment counter
    option = {
        name = god_young_event.9101.option_3

        ai_chance = {
            base = 100
            modifier = {
                add = -100
                OR = {
                    var:god_dark_ascension_years >= 2
                    prestige >= 2500
                }
            }
        }

        hidden_effect = {
            change_variable = { name = god_dark_ascension_years add = 1 }
        }
    }

    # Option 4 — Reset counter (player only)
    option = {
        name = god_young_event.9101.option_4
        trigger = { var:god_dark_ascension_years >= 2 }

        ai_chance = {
            base = 0
        }

        hidden_effect = {
            set_variable = { name = god_dark_ascension_years value = 0 }
        }
    }
}
