
label summon_astoria:

    $ active_girl = "astoria"
    $ last_character = "astoria"

    $ astoria_busy = True

    #call update_ast_tier
    call update_astoria

    $ renpy.checkpoint(hard=True)

    # Clothes Events
    call astoria_summon_setup

    label astoria_requests:

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

    menu:

        # Talk
        "-Talk-" (icon="interface/icons/small/talk.webp"):
            if ast_mood > 0:
                ast "I have nothing to say." ("annoyed", "narrow", "base", "R")
                jump astoria_requests

            call astoria_chitchat
            jump astoria_talk

        # Spells
        "-Spells-" (icon="interface/icons/small/spell.webp"):
            if ast_mood != 0:
                ast "I don't want to today..." ("annoyed", "narrow", "base", "R")
                jump astoria_requests
            else:
                jump astoria_spells

        "-Sexual favours-" (icon="interface/icons/small/condom.webp", style="disabled") if cho_favors_unlocked:
            $ TBA_message()
            jump astoria_requests

        # Wardrobe
        "-Wardrobe-" (icon="interface/icons/small/wardrobe.webp") if astoria_wardrobe_unlocked:
            hide astoria_main with d1
            call wardrobe
            jump astoria_requests

        "-Hidden-" (style="disabled") if not astoria_wardrobe_unlocked:
            call nar(">You haven't unlocked this feature yet.")
            jump astoria_requests

        "-Give Item-" (icon="interface/icons/small/gift.webp"):
            hide astoria_main with d1
            call gift_menu
            jump astoria_requests

        # Dismiss
        "-Dismiss her-":
            stop music fadeout 3.0

            if game.daytime:
                ast "I will go back to classes then, [ast_genie_name]." ( face="neutral")
            else:
                ast "Oh, alright. Good night, [ast_genie_name]." ( face="neutral")

            call play_sound("door")

            jump end_astoria_event



label astoria_spells:
    call update_astoria_spells

    python:
        spell_menu = []

        for i in ag_spell_list:
            if not i.is_complete(): # Not trained yet.
                if game.daytime and not tonks_busy:
                    spell_menu.append(i.get_menu_item())
                else:
                    spell_menu.append(i.get_menu_item(disabled=True))

            else: # Spell trained and unlocked.
                spell_menu.append(i.get_menu_item())

        spell_menu.append(("-Never mind-", "nvm"))

        result = renpy.display_menu(spell_menu)

    if result == "nvm":
        jump astoria_requests
    elif result == "block":
        call block_spell_training
        jump astoria_spells
    elif result == "vague":
        call spell_not_known
        jump astoria_spells
    elif result == "busy":
        call person_is_busy
        jump astoria_spells
    else:
        $ renpy.jump(result)


label block_spell_training:
    if not game.daytime:
        gen "It's too late for that..." ("base", xpos="far_left", ypos="head")
    elif tonks_busy:
        gen "I don't think Tonks has time for that right now..." ("base", xpos="far_left", ypos="head")
    return

label person_is_busy:
    if game.daytime:
        gen "Looks like she's taking classes right now." ("base", xpos="far_left", ypos="head")
    else:
        gen "Seems like she's already asleep." ("base", xpos="far_left", ypos="head")
    return

label spell_not_known:
    call nar(">You haven't unlocked this spell yet.")
    return

label astoria_talk:
    menu:
        "-Ask about Slytherin Quidditch Team-" (icon="interface/icons/small/quidditch.webp") if cho_tier == 2 and cho_quid.lock_practice and cho_quid.E6_complete and not cho_quid.E8_complete:
            # TODO: Posing
            gen "Could you help me with something?" ("base", xpos="far_left", ypos="head")
            ast "Depends what it is." ("annoyed", "narrow", "base", "mid")
            ast "And what's in it for me..." ("smile", "closed", "angry", "mid")
            gen "Well, the Slytherin Quidditch team refuses to practise against the Ravenclaws." ("base", xpos="far_left", ypos="head")
            ast "And?" ("base", "base", "base", "mid")
            gen "I was wondering if there's something you could do about it." ("base", xpos="far_left", ypos="head")
            ast "Like what?" ("open", "base", "worried", "mid")
            gen "I don't know... ask them nicely?" ("base", xpos="far_left", ypos="head")
            ast "Yeah right, those guys would never listen to me..." ("base", "narrow", "base", "R")
            ast "And can't you do something about it? You're the headmaster!" ("annoyed", "base", "worried", "mid")
            gen "Well, I can't technically force them to do anything. If I could then that would make things way easier..." ("base", xpos="far_left", ypos="head")
            ast "Ask Snape then, he's the head of Slytherin... If they'd listen to anyone it'd be him." ("base", "base", "base", "mid")
            if cho_quid.E9_complete:
                gen "I already did..." ("base", xpos="far_left", ypos="head")
            else:
                gen "I could..." ("base", xpos="far_left", ypos="head")
            gen "Well, I'll try and think of something..." ("base", xpos="far_left", ypos="head")
            ast "You do that." ("open", "base", "base", "mid")

            jump astoria_talk

        "-Address me only as-":
            menu:
                "-Sir-":
                    label .sir:
                    $ ast_genie_name = "Sir"
                    ast "Very well, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Dumbledore-":
                    label .dumbledore:
                    $ ast_genie_name = "Dumbledore"
                    ast "Of course, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Professor-":
                    label .professor:
                    $ ast_genie_name = "Professor"
                    ast "Of course, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Old man-":
                    label .old_man:
                    $ ast_genie_name = "Old man"
                    ast "Alrighty, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Genie-":
                    label .genie:
                    $ ast_genie_name = "Genie"
                    ast "What?! You are a genie? For real?" ( face="happy")
                    ast "That's so cool!" ( face="happy")
                    gen "(Oh right. Nobody is supposed to know that.)" ("base", xpos="far_left", ypos="head")
                    gen "It's just my name, [astoria_name]..." ("base", xpos="far_left", ypos="head")
                    ast "Oh... okay, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Lord Voldemort-":
                    label .lord_voldemort:
                    $ ast_genie_name = "Lord Voldemort"
                    ast "Voldemort? Like that mean, evil wizard?" ( face="disgusted")
                    ast "You aren't him, are you?" ( face="disgusted")
                    gen "No, just role-playing..." ("base", xpos="far_left", ypos="head")
                    ast "Oh, alrighty then!" ( face="happy")
                    ast "[ast_genie_name]." ( face="happy")
                    jump astoria_talk
                "-Daddy-":
                    label .daddy:
                    $ ast_genie_name = "Daddy"
                    ast "Daddy? Don't you think that's a little weird?" ( face="disgusted")
                    gen "Not at all!" ("base", xpos="far_left", ypos="head")
                    ast "*Hmph*..." ( face="angry")
                    ast "Alright, why not. Nobody knows about it anyways." ( face="neutral")
                    jump astoria_talk
                "-Master-" (style="disabled") if ast_whoring < 18:
                    label .master_fail:
                    $ ast_genie_name = "Dumby" # Tricked
                    ast "*Ha-ha-ha-ha*-- you want me to call you master?" ( face="happy")
                    ast "That's so dumb!" ( face="happy")
                    ast "Oh I know!" ( face="happy")
                    ast "How about I'll call you \"Dumby\" instead? It fits you really well." ( face="happy")
                    gen "(...)" ("base", xpos="far_left", ypos="head")
                    ast "*Ha-ha-ha-ha*--" ( face="happy")
                    gen "Are you done now?" ("base", xpos="far_left", ypos="head")
                    ast "Yes... I'm sorry... {w=1.0}Dumby..." ( face="happy")
                    gen "(Damn brat! We'll see who will be laughing later.)" ("angry", xpos="far_left", ypos="head")
                    jump astoria_talk
                "-Master-" if ast_whoring >= 18:
                    label .master:
                    $ ast_genie_name = "Master"
                    ast "*Ha-ha-ha-ha*-- you want me to call you master?" ( face="happy")
                    ast "That's so silly!" ( face="happy")
                    gen "(...)" ("base", xpos="far_left", ypos="head")
                    ast "Well alright... M-master--" ( face="happy")
                    ast "*Ha-ha-ha-ha*--{w=1.0}{nw}" ( face="happy")
                    with hpunch
                    gen "Shut it... or there will be consequences!" ("angry", xpos="far_left", ypos="head")
                    ast "I'm sorry... It won't happen again, master..." ( face="neutral")
                    jump astoria_talk
                "-Custom Input-" (style="disabled") if ast_whoring < 18:
                    gen "(I don't think she's yet ready for that)" ("base", xpos="far_left", ypos="head")
                    jump astoria_talk

                "-Custom Input-" if ast_whoring >= 18:
                    $ temp_name = renpy.input("(Please enter the name.)", ast_genie_name, ALLOWED_CHARACTERS, length=14)
                    $ temp_name = temp_name.strip()

                    if temp_name.lower() in ("sir", "dumbledore", "professor", "old man", "genie", "lord voldemort", "daddy", "master"):
                        if temp_name.lower() == "master" and ast_whoring < 18:
                            jump astoria_talk.master_fail
                        $ renpy.jump("astoria_talk."+temp_name.lower().replace(" ", "_")) # Jump to local label
                    elif temp_name == "":
                        jump astoria_talk
                    else:
                        $ ast_genie_name = temp_name
                        ast "*Uhm*... ok. I will call you [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Never mind-":
                    jump astoria_talk


        "-From now on I will refer to you as-":
            menu:
                "-Miss Greengrass-":
                    label .miss_greengrass:
                    $ astoria_name = "Miss Greengrass"
                    ast "Sure, [ast_genie_name]." ( face="happy")
                    jump astoria_talk
                "-Astoria-":
                    label .Astoria:
                    $ astoria_name = "Astoria"
                    ast "Finally getting rid of this formal bullshit? I approve!" ( face="happy")
                    jump astoria_talk
                "-Girl-":
                    label .girl:
                    $ astoria_name = "Girl"
                    ast "Okay, [ast_genie_name]." ( face="neutral")
                    jump astoria_talk
                "-Princess-":
                    label .princess:
                    $ astoria_name = "Princess"
                    ast "I really do feel like a princess!" ( face="happy")
                    ast "After all, I can do whatever I want!" ( face="angry")
                    jump astoria_talk
                "-Cutie-":
                    label .cutie:
                    $ astoria_name = "Cutie"
                    ast "Fine... If you really have to, [ast_genie_name]." ( face="disgusted")
                    jump astoria_talk
                "-Slave-" (style="disabled") if ast_whoring < 18:
                    label .slave_fail:
                    ast "I'm not your slave, [ast_genie_name]!" ( face="angry")
                    gen "Of course you aren't! We are just playing a game, that's all..." ("base", xpos="far_left", ypos="head")
                    ast "Well, I don't like your games!" ( face="angry")
                    ast "Forget it!" ( face="angry")
                    jump astoria_talk
                "-Slave-" if ast_whoring >= 18:
                    label .slave:
                    $ astoria_name = "Slave"
                    ast "I'm not your slave, [ast_genie_name]!" ( face="angry")
                    gen "Of course you aren't! We are just playing a game, that's all..." ("base", xpos="far_left", ypos="head")
                    ast "Oh I like games!" ( face="happy")
                    ast "Alrighty then!" ( face="happy")
                    jump astoria_talk

                "-Custom Input-" (style="disabled") if ast_whoring < 18:
                    gen "(I don't think she's yet ready for that)" ("base", xpos="far_left", ypos="head")
                    jump astoria_talk

                "-Custom Input-" if ast_whoring >= 18:
                    $ temp_name = renpy.input("(Please enter the name.)", astoria_name, ALLOWED_CHARACTERS, length=14)
                    $ temp_name = temp_name.strip()

                    if temp_name.lower() in ("miss greengrass", "girl", "princess", "cutie", "slave"):
                        if temp_name.lower() == "slave" and ast_whoring < 18:
                            jump astoria_talk.slave_fail
                        $ renpy.jump("astoria_talk."+temp_name.lower().replace(" ", "_")) # Jump to local label
                    elif temp_name == "":
                        jump astoria_talk
                    else:
                        $ astoria_name = temp_name
                        ast "That's a bit much, don't you think, [ast_genie_name]?" ( face="disgusted")
                        gen "Not at all!" ("base", xpos="far_left", ypos="head")
                        gen "I will only call you that when we are alone, promised!" ("base", xpos="far_left", ypos="head")
                        ast "Well... Okay then..." ( face="neutral")
                    jump astoria_talk
                "-Never mind-":
                    jump astoria_talk

        "-Never mind-":
            jump astoria_requests
