from eventAPI import *
from APIUtils import *

def fireEvent(e):
    k = getTag(e, "kssAD")
    if ((k != 6)and (k !=7)):
        return 1
    showMessage(e, ["At last, of that long pursuit comes on at hand the prey: the Arch-Druid, finally acknowledging your obstinacy, makes his stand.","",
                    "his followers arrayed before him, he raises a hand and prepares to unleash havoc."])
    fight(e)
    return 1

def fight(e):
    combatRet = combat(e, [("Arch-Druid", 1, 0, 70),("Druid", 2, 0, 50), ("Ranger", 1, 0, 30), ("Fire Ant", 2, 0, 30), ("Warrior Ant", 4, 0, 10)])
    if (combatRet == 1):
        won(e)
        return 1
    elif (combatRet == 3):
        lost(e)
    else:
        showMessage(e, ["After going to great lengths to track down the Arch-Druid, you're not going to let him escape."])
        fight(e)

def won(e):
    showMessage(e, ["The one who, by his own actions, had become your foe lies dead at your feet. With a grim smile, you kneel and search his body.",
                    "","A small key dangles from a chain around his neck: you pocket it, and pry his signet ring from a dead finger."])
    showMessage(e, ["You stand up and survey your surroundings. The fury of the battle has caused the passageway to cave in further on. You'll never know where your enemy was attempting to flee."])
    k = getTag(e, "kssAD")
    k += 2
    setTag(e, "kssAD", k)

def lost(e):
    showMessage(e, ["Well, it seems the Arch-Druid's fear was unfounded. They carry you back to the Enclave and prepare the feast, as was planned at first."])
