from eventAPI import *
from APIUtils import *

def fireEvent(e):
    if (getTag(e, "lFlagU") != 0):
        return 1
    showMessage(e, ["As soon as you enter this pen, a pack of ants (the bull-sized ones, of course) stop whatever they were doing to greet you."])
    combatRet = combat(e, [("Warrior Ant", 6, 2, 10)])
    if (combatRet == 1):
        won(e)
        return 1
    elif (combatRet == 3):
        lost(e)
    else:  
        ran(e)
        return 0

def won(e):
    showMessage(e, ["Bits of maimed, hacked, burnt, crushed (you name it) ants can be seen everywhere around you.",
                    "","Giant ants ? What next, giant armadillos ?"])
    setTag(e, "lFlagU", 1)

def lost(e):
    showMessage(e, ["The ants savage your bodies. At least, you can get satisfaction in the knowledge that the rangers and druids won't get their meal."])

def ran(e):
    showMessage(e, ["You barely manage to run away, and bolt the gate behind you. The ants resume their activities."])
