﻿namespace = divine_conception_event

#########################################
# Divine Conception – Mother Gets Pregnant
#########################################

divine_conception_event.1000 = {
    type = character_event
    title = divine_conception_event_title
    desc = divine_conception_event_desc
    override_background = { reference = bedchamber_log }

    left_portrait = {
    character = scope:recipient
    animation = worry  # Confused/anxious animation for the woman
    }

    # BASTARD CHILD OPTION
    option = {
        name = divine_conception_option_bastard
        custom_tooltip = divine_conception_option_bastard_desc
        scope:recipient = {
            add_character_flag = divine_conception_log_pregnancy
            
            set_variable = {
                name = divine_conception_father
                value = scope:actor
            }

            if = {
                limit = {
                    any_spouse = { always = yes }
                }
                random_spouse = {
                    save_scope_as = chosen_father
                }
            }
            else_if = {
                limit = { exists = liege }
                liege = {
                    save_scope_as = chosen_father
                }
            }
            if = {
                limit = { exists = scope:chosen_father }
                make_pregnant_no_checks = {
                    father = scope:chosen_father
                    known_bastard = no
                }
            }
        }
    }
    
    # LEGITIMATE CHILD OPTION
    option = {
        name = divine_conception_option_legitimate
        custom_tooltip = divine_conception_option_legitimate_desc
        scope:recipient = {
            make_pregnant_no_checks = {
                father = scope:actor
                known_bastard = no
            }
        }
    }
}

divine_conception_event.2000 = {
    type = character_event
    hidden = yes

    trigger = { }

    immediate = {

        # ======================
        # GOD INHERITANCE LOGIC
        # ======================

        if = {
            limit = {
                mother = { has_trait = angel_full_god }
                scope:divine_father = { has_trait = angel_full_god }
            }
            add_trait = young_god_light
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
        }
        else_if = {
            limit = {
                mother = { has_trait = fallen_god }
                scope:divine_father = { has_trait = fallen_god }
            }
            add_trait = young_god_dark
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
        }
        
        # angel_full_god + young_god_light → young_god_light
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = angel_full_god }
                        scope:divine_father = { has_trait = young_god_light }
                    }
                    AND = {
                        mother = { has_trait = young_god_light }
                        scope:divine_father = { has_trait = angel_full_god }
                    }
                }
            }
            add_trait = young_god_light
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
        }

        # fallen_god + young_god_dark → young_god_dark
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = fallen_god }
                        scope:divine_father = { has_trait = young_god_dark }
                    }
                    AND = {
                        mother = { has_trait = young_god_dark }
                        scope:divine_father = { has_trait = fallen_god }
                    }
                }
            }
            add_trait = young_god_dark
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
        }
        
        else_if = {
            limit = {
                mother = { has_trait = demi_god }
                scope:divine_father = { has_trait = demi_god }
            }
            add_trait = demi_god
            add_trait = intellect_good_2
            add_trait = physique_good_2
            add_trait = beauty_good_2
        }
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = angel_full_god }
                        NOT = { scope:divine_father = { has_trait = angel_full_god } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = angel_full_god }
                        NOT = { mother = { has_trait = angel_full_god } }
                    }
                    AND = {
                        mother = { has_trait = fallen_god }
                        NOT = { scope:divine_father = { has_trait = fallen_god } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = fallen_god }
                        NOT = { mother = { has_trait = fallen_god } }
                    }
                }
            }
            add_trait = demi_god
            add_trait = intellect_good_2
            add_trait = physique_good_2
            add_trait = beauty_good_2
        }
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = demi_god }
                        NOT = { scope:divine_father = { has_trait = demi_god } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = demi_god }
                        NOT = { mother = { has_trait = demi_god } }
                    }
                }
            }
            add_trait = god_blood
            add_trait = intellect_good_1
            add_trait = physique_good_1
            add_trait = beauty_good_1
        }

        # =========================
        # ANGEL INHERITANCE LOGIC
        # =========================

        else_if = {
            limit = {
                mother = { has_trait = archangel }
                scope:divine_father = { has_trait = archangel }
            }
            add_trait = archangel
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
            add_trait = content
            add_trait = loyal
            add_trait = zealous
        }
        else_if = {
            limit = {
                mother = { has_trait = dark_archangel }
                scope:divine_father = { has_trait = dark_archangel }
            }
            add_trait = dark_archangel
            add_trait = intellect_good_3
            add_trait = physique_good_3
            add_trait = beauty_good_3
            add_trait = content
            add_trait = loyal
            add_trait = zealous
        }
        else_if = {
            limit = {
                mother = { has_trait = angel }
                scope:divine_father = { has_trait = angel }
            }
            add_trait = angel
            add_trait = intellect_good_2
            add_trait = physique_good_2
            add_trait = beauty_good_2
            add_trait = content
            add_trait = loyal
            add_trait = zealous
        }
        else_if = {
            limit = {
                mother = { has_trait = dark_angel }
                scope:divine_father = { has_trait = dark_angel }
            }
            add_trait = dark_angel
            add_trait = intellect_good_2
            add_trait = physique_good_2
            add_trait = beauty_good_2
            add_trait = content
            add_trait = loyal
            add_trait = zealous
        }
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = archangel }
                        NOT = { scope:divine_father = { has_trait = archangel } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = archangel }
                        NOT = { mother = { has_trait = archangel } }
                    }
                    AND = {
                        mother = { has_trait = dark_archangel }
                        NOT = { scope:divine_father = { has_trait = dark_archangel } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = dark_archangel }
                        NOT = { mother = { has_trait = dark_archangel } }
                    }
                }
            }
            add_trait = angel
            add_trait = intellect_good_2
            add_trait = physique_good_2
            add_trait = beauty_good_2
            add_trait = content
            add_trait = loyal
            add_trait = zealous
        }
        else_if = {
            limit = {
                OR = {
                    AND = {
                        mother = { has_trait = angel }
                        NOT = { scope:divine_father = { has_trait = angel } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = angel }
                        NOT = { mother = { has_trait = angel } }
                    }
                    AND = {
                        mother = { has_trait = dark_angel }
                        NOT = { scope:divine_father = { has_trait = dark_angel } }
                    }
                    AND = {
                        scope:divine_father = { has_trait = dark_angel }
                        NOT = { mother = { has_trait = dark_angel } }
                    }
                }
            }
            add_trait = angel_blood
            add_trait = intellect_good_1
            add_trait = physique_good_1
            add_trait = beauty_good_1
        }
    }
}
