# The main game loop. Contains both the pre- and post- planning parts

label gameLoopStart:
    
    # Administrative stuff regarding the game state
    $ myPlanner.incrementDay()
    if myPlanner.getDay() > 7 :
            jump alpha_end
    $ activitiesDone = 0
    
    # Choice of how the player wakes up
    $ from random import *
    $ randomChoice = choice([0,1,2])
    
    # Start of the day banter
    scene bg wakeupBG with fade
    
    $ _day = myPlanner.getDay()
    
    show you tired at left
    you "*YAAAAAAWN*"

    show planner happy at offright
    show planner happy at right with ease
    planner "Good morning!"
    planner "Are you ready for day %(_day)s of your campaign?"
    
    if randomChoice == 0:    
        show you normal at left
        "Well, you woke up a little later than you intended to after a restless night..."
        you "I shall certainly try my best."
    elif randomChoice == 1:
        show you sweat at left
        "You had a really interesting dream last night..."
        you "Uhh, yeah..."
    elif randomChoice == 2:
        show you confident at left
        "You had wonderful dreams of a successful campaign!"
        you "Of course!"
        you "There is no way anything could go wrong today!"

    planner "Wonderful!"
    planner "I'm sure you'll do well."
    planner "Now, let's plan out your day!"
    
    # Jump to Planner.rpy to actually plan the day.
    call plannerMenu                                                                                                                         
   
# Now that the day has been planned, actually perform said activities.
# This label is returned to after each activity is done, so it's important that we keep track of the time period.
label gameLoopActivities:
    # In the future, determine which NPC the activity is meant to be done with, and fetch it.
    # Then tell it to do the activity.
    $ _planMap = myPlanner.getPlanMap()
    if activitiesDone == 0 : 
        $ npc = getNPC(_planMap['partnerMorning'])
        $ npc.doActivity(_planMap['planMorning'])
        
    elif activitiesDone == 1 :      
        scene bg wakeupBG with fade
        show planner normal at center
        planner "Ready for your afternoon?"
        
        $ npc = getNPC(_planMap['partnerAfternoon'])
        $ npc.doActivity(_planMap['planAfternoon'])
    
    # all activites complete, end the day and proceed to the next
    else :
        scene bg nightBG with fade
        show you happy at center   
        you "Well, that was productive!"
        show you tired at center
        you "Time for bed!"
        
        jump gameLoopStart
    
