from eventAPI import *
from APIUtils import *

def fireEvent(e):
    global k
    k = getTag(e, "kssAD")
    if (k > 1):
        return 1
    k += 2
    setTag(e, "kssAD", k)
    showMessage(e, ["You come to the center of the cromlech and behold the source of the chant that has been resonating since you entered the cavern: it's a small bearded man with a mad look in his eyes."])
    showMessage(e, ["The Arch-Druid (for that's who he is) interrupts the ceremony he was performing and utters a call before running off eastward.","","A group of druids surrounds you, soon joined by a few rangers."])
    fight(e)
    return 1

def fight(e):
    k = combat(e, [("Druid", 8, 0, 50), ("Ranger", 3, 0, 30)])
    if (k == 1):
        won(e)
    elif (k == 3):
        lost(e)
    else:
        showMessage(e, ["They are surrounding you, so there is no escape this time."])
        fight(e)

def won(e):
    showMessage(e, ["Bodies are surrounding you now; looking around, you see the Arch-Druid enter a large building at the far side of the cavern."])

def lost(e):
    showMessage(e, ["After killing you, they slice and season you, then they cook, broil, roast some parts and keep the rest for later.",
                    "","By then, the Arch-Druid has returned to partake of this venison."])
