#This is the start of the sidequest created by "Origen"
from eventAPI import *
from APIUtils import *

DK1 = 0

def fireEvent(e):
    global DK1
    DK1 = getTag(e, "DK1")
    if (DK1 == 1):
        return 1
    else:
        next(e)
        
def next(e):
    showMessage(e, ["The unexpected fall knocks you unconscious..."])
    showMessage(e, ["As you begin to awaken, you faintly see the image of a man standing over you."])
    showMessage(e, ["The man begins to speak to you in a raspy voice.", "", "\"Thank you for falling into my trap. I hope you don't mind, but I took the liberty of lightening your load, as you will need all of your strength for your journey. If you would like to get it back, you can try to find me at the Green Bard.\""])
    showMessage(e, ["\"Of course, you will first have to find your way out of this maze. So far, none have been successful, so I am not that worried.\""])
    showMessage(e, ["His laughter begins to fade, and you are left alone."])
    showMessage(e, ["As your party gets to their feet, you notice that you are missing some gold.", "", "\"Find me at the Green Bard\" were his last words. You may have to take him up on that offer."])
    showMessage(e, ["You see the exit to this maze immediately to the West. However, it looks like there is some invisible wall blocking your way. I guess you will have to enter the maze."])
    setTag(e, "DK1", 1)
    nogold(e)
    return 1
    
def nogold(e):    
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -500)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -400)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -300)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -200)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -100)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -50)
        x += 1
    x, c = 0, getPartyCount(e)
    while (x < c):
        modifyGold(e, x, -25)
        x += 1
    return 1
