#######################################
# Order of the Sacred Magdalene
# Tentacle Companion Events
#######################################

namespace = ggsmt


#######################################
# ACQUISITION
#######################################

long_character_event = {
    id = ggsmt.1
    desc = ggsmt.1.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 2
        religion = catholic
        is_female = yes
        is_adult = yes
        NOT = { trait = ggsm_tentacle_companion }
    }

    option = {
        name = ggsmt.1.a
        add_trait = ggsm_tentacle_companion
    }

    option = {
        name = ggsmt.1.b
    }
}


#######################################
# MEMBERSHIP CLEANUP
#######################################

long_character_event = {
    id = ggsmt.10
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        trait = ggsm_tentacle_companion
        NOT = { society_member_of = ggsm_order_sacred_magdalene }
    }

    immediate = {
        remove_trait = ggsm_tentacle_companion
    }
}


#######################################
# RECURRING PET TOMBOLA
#######################################

long_character_event = {
    id = ggsmt.20
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        trait = ggsm_tentacle_companion
        society_member_of = ggsm_order_sacred_magdalene
        religion = catholic
        is_female = yes
        is_adult = yes
        prisoner = no
        NOT = { trait = incapable }
    }

    immediate = {

        # Backup cleanup in case society membership was removed byE
        # something that did not pass through the normal leave on-action.
        if = {
            limit = {
                NOT = { society_member_of = ggsm_order_sacred_magdalene }
            }
            remove_trait = ggsm_tentacle_companion
            break = yes
        }

        # The yearly pulse does not guarantee a pet scene.
        random = {
            chance = 60

            random_list = {

                # 21-22: Comfort. Self-only.
                18 = {
                    modifier = {
                        factor = 0
                        NOR = {
                            trait = stressed
                            trait = depressed
                        }
                    }
                    long_character_event = { id = ggsmt.21 }
                }

                # 23: Family. Pick an actual living close relative.
                # Children are permitted here because this scene is nonsexual.
                12 = {
                    modifier = {
                        factor = 0
                        NOT = {
                            any_close_relative = {
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }
                    random_close_relative = {
                        limit = {
                            prisoner = no
                            NOT = { trait = incapable }
                        }
                        save_event_target_as = ggsm_tentacle_target
                        ROOT = {
                            long_character_event = { id = ggsmt.23 }
                        }
                    }
                }

                # 24-25: Lover or spouse. Adult target only.
                12 = {
                    modifier = {
                        factor = 0
                        NOR = {
                            any_lover = {
                                is_adult = yes
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                            any_spouse = {
                                is_adult = yes
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }

                    random_list = {
                        50 = {
                            modifier = {
                                factor = 0
                                NOT = {
                                    any_lover = {
                                        is_adult = yes
                                        prisoner = no
                                        NOT = { trait = incapable }
                                    }
                                }
                            }
                            random_lover = {
                                limit = {
                                    is_adult = yes
                                    prisoner = no
                                    NOT = { trait = incapable }
                                }
                                save_event_target_as = ggsm_tentacle_target
                                ROOT = {
                                    long_character_event = { id = ggsmt.24 }
                                }
                            }
                        }

                        50 = {
                            modifier = {
                                factor = 0
                                NOT = {
                                    any_spouse = {
                                        is_adult = yes
                                        prisoner = no
                                        NOT = { trait = incapable }
                                    }
                                }
                            }
                            random_spouse = {
                                limit = {
                                    is_adult = yes
                                    prisoner = no
                                    NOT = { trait = incapable }
                                }
                                save_event_target_as = ggsm_tentacle_target
                                ROOT = {
                                    long_character_event = { id = ggsmt.24 }
                                }
                            }
                        }
                    }
                }

                # 26-27: Another adult sister of the Order.
                12 = {
                    modifier = {
                        factor = 0
                        NOT = {
                            any_society_member = {
                                same_society_as = ROOT
                                NOT = { character = ROOT }
                                is_adult = yes
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }
                    random_society_member = {
                        limit = {
                            same_society_as = ROOT
                            NOT = { character = ROOT }
                            is_adult = yes
                            prisoner = no
                            NOT = { trait = incapable }
                        }
                        save_event_target_as = ggsm_tentacle_target
                        ROOT = {
                            long_character_event = { id = ggsmt.26 }
                        }
                    }
                }

                # 28-29: Chapel companion. Self-only.
                10 = {
                    long_character_event = { id = ggsmt.28 }
                }

                # 30: Stolen mantle. Pick a courtier or direct vassal.
                # This gives the joke an actual owner of the stolen garment.
                10 = {
                    modifier = {
                        factor = 0
                        NOT = {
                            any_courtier_or_vassal = {
                                NOT = { character = ROOT }
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }
                    random_courtier_or_vassal = {
                        limit = {
                            NOT = { character = ROOT }
                            prisoner = no
                            NOT = { trait = incapable }
                        }
                        save_event_target_as = ggsm_tentacle_target
                        ROOT = {
                            long_character_event = { id = ggsmt.30 }
                        }
                    }
                }

                # 31: Courtly appearance. Pick somebody actually present
                # in the ruler's court, including visiting nobles.
                8 = {
                    modifier = {
                        factor = 0
                        NOT = {
                            any_host_courtier = {
                                NOT = { character = ROOT }
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }
                    random_host_courtier = {
                        limit = {
                            NOT = { character = ROOT }
                            prisoner = no
                            NOT = { trait = incapable }
                        }
                        save_event_target_as = ggsm_tentacle_target
                        ROOT = {
                            long_character_event = { id = ggsmt.31 }
                        }
                    }
                }

                # 32-33: Study. Self-only.
                8 = {
                    long_character_event = { id = ggsmt.32 }
                }

                # 34-36: Private affection. Self-only sexual chain.
                6 = {
                    long_character_event = { id = ggsmt.34 }
                }

                # 37-39: Shared affection with an adult beloved.
                4 = {
                    modifier = {
                        factor = 0
                        NOR = {
                            any_lover = {
                                is_adult = yes
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                            any_spouse = {
                                is_adult = yes
                                prisoner = no
                                NOT = { trait = incapable }
                            }
                        }
                    }

                    random_list = {
                        50 = {
                            modifier = {
                                factor = 0
                                NOT = {
                                    any_lover = {
                                        is_adult = yes
                                        prisoner = no
                                        NOT = { trait = incapable }
                                    }
                                }
                            }
                            random_lover = {
                                limit = {
                                    is_adult = yes
                                    prisoner = no
                                    NOT = { trait = incapable }
                                }
                                save_event_target_as = ggsm_tentacle_target
                                ROOT = {
                                    long_character_event = { id = ggsmt.37 }
                                }
                            }
                        }

                        50 = {
                            modifier = {
                                factor = 0
                                NOT = {
                                    any_spouse = {
                                        is_adult = yes
                                        prisoner = no
                                        NOT = { trait = incapable }
                                    }
                                }
                            }
                            random_spouse = {
                                limit = {
                                    is_adult = yes
                                    prisoner = no
                                    NOT = { trait = incapable }
                                }
                                save_event_target_as = ggsm_tentacle_target
                                ROOT = {
                                    long_character_event = { id = ggsmt.37 }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}


#######################################
# 21-22 - COMFORT
#######################################

long_character_event = {
    id = ggsmt.21
    desc = ggsmt.21.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        trait = ggsm_tentacle_companion
        OR = {
            trait = stressed
            trait = depressed
        }
    }

    option = {
        name = ggsmt.21.a
        long_character_event = { id = ggsmt.22 }
    }
}

long_character_event = {
    id = ggsmt.22
    desc = ggsmt.22.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.22.a

        if = {
            limit = { trait = stressed }
            random = {
                chance = 60
                remove_trait = stressed
            }
        }

        if = {
            limit = { trait = depressed }
            random = {
                chance = 30
                remove_trait = depressed
            }
        }
    }
}


#######################################
# 23 - FAMILY
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.23
    desc = ggsmt.23.desc
	portrait = event_target:ggsm_tentacle_target
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.23.a
    }
}


#######################################
# 24-25 - LOVER OR SPOUSE
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.24
    desc = ggsmt.24.desc
	portrait = event_target:ggsm_tentacle_target
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.24.a
        long_character_event = { id = ggsmt.25 }
    }
}

long_character_event = {
    id = ggsmt.25
    desc = ggsmt.25.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.25.a
    }
}


#######################################
# 26-27 - ANOTHER SISTER OF THE ORDER
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.26
    desc = ggsmt.26.desc
	portrait = event_target:ggsm_tentacle_target
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.26.a
        long_character_event = { id = ggsmt.27 }
    }
}

long_character_event = {
    id = ggsmt.27
    desc = ggsmt.27.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.27.a
    }
}


#######################################
# 28-29 - CHAPEL COMPANION
#######################################

long_character_event = {
    id = ggsmt.28
    desc = ggsmt.28.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.28.a
        long_character_event = { id = ggsmt.29 }
    }
}

long_character_event = {
    id = ggsmt.29
    desc = ggsmt.29.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.29.a
    }
}


#######################################
# 30 - STOLEN MANTLE
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.30
	portrait = event_target:ggsm_tentacle_target
    desc = ggsmt.30.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.30.a
    }
}


#######################################
# 31 - COURTLY APPEARANCE
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.31
    desc = ggsmt.31.desc
	portrait = event_target:ggsm_tentacle_target
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_diplomacy
    is_triggered_only = yes

    option = {
        name = ggsmt.31.a
    }
}


#######################################
# 32-33 - STUDY
#######################################

long_character_event = {
    id = ggsmt.32
    desc = ggsmt.32.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.32.a
        long_character_event = { id = ggsmt.33 }
    }
}

long_character_event = {
    id = ggsmt.33
    desc = ggsmt.33.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.33.a
    }
}


#######################################
# 34-36 - PRIVATE AFFECTION
#######################################

long_character_event = {
    id = ggsmt.34
    desc = ggsmt.34.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.34.a
        long_character_event = { id = ggsmt.35 }
    }
}

long_character_event = {
    id = ggsmt.35
    desc = ggsmt.35.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.35.a
        long_character_event = { id = ggsmt.36 }
    }
}

long_character_event = {
    id = ggsmt.36
    desc = ggsmt.36.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.36.a
    }
}


#######################################
# 37-39 - SHARED AFFECTION WITH A BELOVED
# Target: event_target:ggsm_tentacle_target
#######################################

long_character_event = {
    id = ggsmt.37
    desc = ggsmt.37.desc
	portrait = event_target:ggsm_tentacle_target
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.37.a
        long_character_event = { id = ggsmt.38 }
    }
}

long_character_event = {
    id = ggsmt.38
    desc = ggsmt.38.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.38.a
        long_character_event = { id = ggsmt.39 }
    }
}

long_character_event = {
    id = ggsmt.39
    desc = ggsmt.39.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    option = {
        name = ggsmt.39.a
    }
}
