

label summon_hermione:
    #call play_music("hermione")
    #call play_sound("door")

    $ active_girl = "hermione"
    $ last_character = "hermione"

    $ hermione_busy = True

    call update_hermione
    call update_her_tier

    $ renpy.checkpoint(hard=True)

    # Clothes Events
    call hermione_summon_setup

    label hermione_requests:

    # Reset
    call reset_menu_position
    her "" (xpos="base",ypos="base")

    menu:

        "-Talk-" (icon="interface/icons/small/talk.webp"):
            if her_mood > 0:
                her "I have nothing to say to you sir..."
                jump hermione_requests

            call hermione_chitchat
            jump hermione_talk

        "-Tutoring-" (icon="interface/icons/small/book.webp") if not game.daytime and her_tutoring < 15: #14 is last level.
            if her_mood >=1 and her_mood < 3:
                her "I'm sorry, maybe tomorrow..."
                jump hermione_requests
            elif her_mood >=3 and her_mood < 10:
                her "I am not in the mood today..."
                jump hermione_requests
            elif her_mood >= 10 and her_mood < 20:
                her "Absolutely not, [genie_name]."
                her "I {i}might{/i} consider it once you've said sorry..."
                jump hermione_requests
            elif her_mood >=20:
                her "After what you did, [genie_name]?"
                her "I don't think so..."
                jump hermione_requests
            else:
                jump hg_tutor_start

        "-Tutoring-" (icon="interface/icons/small/book.webp", style="disabled") if game.daytime and her_tutoring < 15:
            call nar("> Tutoring is available during the night only.")
            jump hermione_requests

        "-Sexual favours-" (icon="interface/icons/small/condom.webp") if hermione_favors:
            if her_mood >=1 and her_mood < 3:
                her "I'm sorry, [genie_name], Maybe some other time..." ("annoyed", "base", "base", "R")
                jump hermione_requests
            elif her_mood >=  3 and her_mood < 10:
                her "I don't feel like it today..." ("open", "closed", "base", "mid")
                her "Maybe some other time..." ("normal", "closed", "base", "mid")
                her "" ("normal", "base", "base", "mid")
                jump hermione_requests
            elif her_mood >= 10 and her_mood < 20:
                her "No thank you..." ("angry", "narrow", "base", "mid")
                jump hermione_requests
            elif her_mood >= 20 and her_mood < 30:
                her "After what you did, [genie_name]?" ("angry", "narrow", "annoyed", "mid")
                her "I don't think so..." ("disgust", "narrow", "annoyed", "mid")
                jump hermione_requests
            elif her_mood >= 30 and her_mood < 40:
                her "You can't be serious!" ("angry", "narrow", "angry", "mid")
                jump hermione_requests
            elif her_mood >= 40:
                her "Is this some twisted joke to you, sir?!" ("angry", "squint", "angry", "mid")
                her "After what you did I don't feel like doing this ever again!" ("disgust", "base", "angry", "mid")
                jump hermione_requests
            else:
                jump hermione_favor_menu

        "-Wardrobe-" (icon="interface/icons/small/wardrobe.webp") if hermione_wardrobe_unlocked: # Unlocks after first summoning her.
            hide hermione_main with d1
            call wardrobe
            jump hermione_requests

        "-Let's Duel-" (icon="interface/icons/small/cards.webp") if snape_second_win:
            jump hermione_cardgame_menu

        "-Give Item-" (icon="interface/icons/small/gift.webp") if hermione_favors:
            hide hermione_main with d1
            call gift_menu
            jump hermione_requests

        "-Dismiss her-":
            stop music fadeout 3.0

            if game.daytime:
                if her_mood >=3 and her_mood < 7:
                    her "..............................."
                elif her_mood >=7:
                    her "*Humph*!..."
                else:
                    her "Oh, alright. I will go to classes then."
            else:
                if her_mood >=3 and her_mood < 7:
                    her "..............................."
                elif her_mood >=7:
                    her "*Tch*..."
                else:
                    her "Oh, alright. I will go to bed then."

            call play_sound("door")

            jump end_hermione_event



label update_her_tier:
    if her_tier == 1 and her_whoring >= 3:
        # Trigger: None
        $ her_level_up = 1
    elif her_tier == 2 and her_whoring >= 9 and hg_jerkoff.trigger == True:
        # Trigger: When you get caught jerking off.
        $ her_level_up = 2
    elif her_tier == 3 and her_whoring >= 12 and hg_strip.trigger == True:
        # Trigger: After she strips for you.
        $ her_level_up = 3
    elif her_tier == 4 and her_whoring >= 18 and hg_kiss.trigger == True:
        # Trigger: None
        $ her_level_up = 4
    elif her_tier == 5 and her_whoring >= 21 and hg_blowjob.trigger == True:
        # Trigger: First BJ
        $ her_level_up = 5

    return


label hermione_level_up(tier=None):

    call bld
    if tier == 1:
        show screen blktone
        with d3
        ">Hermione's second {i}favour tier{/i} is now available."
        ">You can move up {i}favour tiers{/i} by increasing her {i}whoring level{/i}, and by triggering {i}favour milestones{/i}."
        ">Each tier unlocks a new set of favours, but favours of the previous tier will no longer be available."
        hide screen blktone
        with d3
        pause.5
        menu:
            "Would you like to increase Hermione's {i}favour tier{/i} now?"
            "-Yes, increase her tier-":
                pass
            "-No, stay on her current tier-":
                return

    elif tier == 2:
        gen "(I wonder if she's ready for some more advanced favours now...)" ("base", xpos="far_left", ypos="head")
    elif tier == 3:
        gen "(...)" ("base", xpos="far_left", ypos="head")
        gen "(Would she know what a handjob is...?)" ("base", xpos="far_left", ypos="head")
    elif tier == 4:
        gen "(I wonder if I can get her to suck me off today...)" ("base", xpos="far_left", ypos="head")
        gen "(I'm dying to feel that mouth around my cock!)" ("angry", xpos="far_left", ypos="head")
    elif tier == 5:
        gen "(Yes, I think it's time...)" ("base", xpos="far_left", ypos="head")
        gen "(I'm gonna put my \"P\" in her \"V\"!)" ("angry", xpos="far_left", ypos="head")

    $ her_tier = tier+1
    $ her_level_up = None
    $ her_mood = 0

    pause.5
    call nar(">Hermione has reached {i}favour tier{/i} "+str(her_tier)+"!")

    call update_her_tier

    return

label hermione_favor_menu:
    call update_her_favors
    call update_her_requests

    if not is_in_lead(gryffindor):

        label silver_requests_root:
        menu:
            "-Level Up-" (icon="interface/icons/small/levelup.webp") if her_level_up != None:
                call hermione_level_up(tier=her_level_up)
                jump hermione_favor_menu

            "-Personal favours-" (icon="interface/icons/small/heart_red.webp"):
                call tutorial("hearts")

                label .personal:
                python:
                    menu_choices = []
                    for i in hg_favor_list:
                        if i in []: # Not in the game yet.
                            menu_choices.append(gui.menu_item("-Not available-", "na", style="disabled"))
                        elif i.start_tier > her_tier:
                            menu_choices.append(gui.menu_item("-Not Ready-", "vague", style="disabled"))
                        else:
                            menu_choices.append(i.get_menu_item())

                    menu_choices.append(("-Never mind-", "nvm"))
                    result = renpy.display_menu(menu_choices)

                if result == "nvm":
                    jump silver_requests_root
                elif result == "vague":
                    call favor_not_ready
                    jump .personal
                elif result == "na":
                    call not_available
                    jump .personal
                else:
                    $ renpy.jump(result)

            "-Public requests-" (icon="interface/icons/small/star_yellow.webp", style="disabled") if not game.daytime:
                call nar(">Public requests are available during the day only.")
                jump silver_requests_root

            "-Public requests-" (icon="interface/icons/small/star_yellow.webp") if game.daytime:
                if her_reputation >= 16 and not public_whore_ending:
                    # Public whore ending choice
                    $ renpy.choice_for_skipping()
                    $ renpy.music.set_volume(0.5, 1.0)
                    nar "Attention!{w=1.0} If you continue tarnishing Hermione's reputation you will lock yourself towards certain game ending. (Public route)"
                    menu:
                        nar "Do you wish to continue?\n{size=-4}(You won't be asked again){/size}"
                        "Yes, I do.":
                            $ renpy.music.set_volume(1.0, 1.0)
                            $ public_whore_ending = True
                        "No, go back.":
                            $ renpy.music.set_volume(1.0, 1.0)
                            jump silver_requests_root

                label .public:
                python:
                    menu_choices = []
                    for i in hg_requests_list:
                        if i in []: # Not in the game yet.
                            menu_choices.append(gui.menu_item("-Not available-", "na", style="disabled"))
                        elif i.start_tier > her_tier:
                            menu_choices.append(gui.menu_item("-Not Ready-", "vague", style="disabled"))
                        else:
                            menu_choices.append(i.get_menu_item())

                    menu_choices.append(("-Never mind-", "nvm"))
                    result = renpy.display_menu(menu_choices)

                if result == "nvm":
                    jump silver_requests_root
                elif result == "vague":
                    call favor_not_ready
                    jump .public
                elif result == "na":
                    call not_available
                    jump .public
                else:
                    $ renpy.jump(result)

            "-Public Shaming-" (icon="interface/icons/small/star_pink.webp", style="disabled") if not game.daytime:
                call nar(">Public Shaming events are available during the day only.")
                jump silver_requests_root

            "-Public Shaming-" (icon="interface/icons/small/star_pink.webp")if game.daytime:
                label not_now_ps:
                python:
                    menu_choices = []
                    for i in hg_ps_list:
                        if i.tier > her_tier:
                            menu_choices.append(gui.menu_item("-Vague idea-", "vague", style="disabled"))
                        else:
                            menu_choices.append(i.get_menu_item())
                    menu_choices.append(("-Never mind-", "nvm"))
                    result = renpy.display_menu(menu_choices)

                if result == "nvm":
                    jump silver_requests_root
                elif result == "vague":
                    call favor_not_ready
                    jump not_now_ps
                else:
                    $ renpy.jump(result)

            "-Never mind-":
                jump hermione_requests
    else:
        if hermione_favors_convinced:
            her "We're in the lead already..." ("base", "base", "base", "mid_soft", trans=d3)
            if her_whoring >=20 and hermione_favors_convinced == 2:
                her "But I'll do anything for you, [genie_name]..." ("smile", "happy", "base", "mid")
                jump silver_requests_root
            elif her_whoring >=18 and hermione_favors_convinced == 2:
                her "I guess you do have a way with words,[genie_name]... I'll do it." ("soft", "wink", "base", "mid")
                jump silver_requests_root
            elif her_whoring >=16:
                her "I have told you before, [genie_name], it was just a one time thing..." ("open", "happy", "base", "mid")
                gen "What about tomorrow though?" ("base", xpos="far_left", ypos="head")
                her "What about tomorrow?" ("base","squint", "base", "mid")
                gen "I made a graph detailing the current daily average points Slytherin gain... doesn't look that great." ("grin", xpos="far_left", ypos="head")
                gen "Just think about it." ("base", xpos="far_left", ypos="head")
                jump hermione_favors_convinced_check
        else:
            her "The Gryffindor house is in the lead. I don't need to do this." ("base", "base", "base", "mid_soft", trans=d3)
            if her_whoring >= 15:
                menu:
                    "-Change her mind-":
                        gen "Are you sure it's not within your house best interests?" ("base", xpos="far_left", ypos="head")
                        her "What do you mean?" ("soft", "happy", "base", "mid")
                        gen "Think about the future..." ("grin", xpos="far_left", ypos="head")
                        label hermione_favors_convinced_check:
                        if her_whoring >=20:
                            gen "If you do it now it could secu--" ("base", xpos="far_left", ypos="head")
                            her "I'll do it!" ("angry", "happy", "base", "mid")
                            gen "Just like that?!" ("base", xpos="far_left", ypos="head")
                            her "Yes... just like that." ("base", "closed", "base", "mid")
                            gen "That's my girl!" ("grin", xpos="far_left", ypos="head")
                            $ hermione_favors_convinced = 2
                            jump silver_requests_root

                        gen "If you do it, you could secure the win for you household you know..." ("base", xpos="far_left", ypos="head")

                        if her_whoring >=18:
                            her "You really know how to talk me through, [genie_name]." ("soft", "narrow", "worried", "down")
                            her "Okay I agree." ("open", "narrow", "base", "down")
                            $ hermione_favors_convinced = 2
                            jump silver_requests_root
                        elif her_whoring >=16 and not hermione_favors_convinced == 1:
                            her "I guess you're right..." ("open", "happy", "base", "mid_soft")
                            her "I'll do it... but just this once okay?" ("grin", "happyCl", "base", "mid")
                            $ hermione_favors_convinced = 1
                            jump silver_requests_root
                        else:
                            her "I could..." ("soft", "narrow", "base", "mid_soft")
                            her "But I don't want to." ("normal", "closed", "base", "mid")
                            jump hermione_requests
                    "-Forget it-":
                        pass
            else:
                if sna_friendship <= 10:
                    gen "What do you mean in the lead?" ("base", xpos="far_left", ypos="head")
                    gen "Explain yourself, [hermione_name]!" ("angry", xpos="far_left", ypos="head")
                    her "With the current points distribution, I am certain getting the house cup for Gryffindor will be just a formality." ("smile", "closed", "base", "mid")
                    her "Thank you, [genie_name], but I don't need any more points." ("smile", "base", "base", "mid")

                    call tutorial("points")

                    gen "(That little...)" ("angry", xpos="far_left", ypos="head")
                    gen "(Perhaps I should hangout with that Snape dude tonight, he might know what to do.)" ("base", xpos="far_left", ypos="head")
                    her "Do you need anything else, [genie_name]?" ("smile", "base", "base", "mid")
                else:
                    gen "Right..." ("base", xpos="far_left", ypos="head")

                    call tutorial("points")

                    gen "(I guess another hangout with Snape is in order.)" ("base", xpos="far_left", ypos="head")
        jump hermione_requests


label update_her_favors:
    python:
        for i in hg_favor_list:
            i.tier = her_tier

    return


label update_her_requests:
    python:
        for i in hg_requests_list:
            i.tier = her_tier

    return
