from eventAPI import *
from APIUtils import *

def fireEvent(e):
    if (getTag(e, "lFlagU") != 0):
        return 1
    showMessage(e, ["As soon as you step into the tunnel, you're assaulted by a group of giant ants.",
                    "","You have your answer: it was NOT a good idea."])
    fight(e)
    return 1

def fight(e):
    combatRet = combat(e, [("Warrior Ant", 5, 0, 10), ("Fire Ant", 2, 0, 30)])
    if (combatRet == 1):
        won(e)
        return 1
    elif (combatRet == 3):
        lost(e)
    else:
        showMessage(e, ["With only an open well behind you, there is no escape."])
        fight(e)

def won(e):
    showMessage(e, ["You've defeated these ants, but you're sure (and your ears won't contradict you) that you'll see more of them.",
                    "","By the way, since when do fire ants actually breathe fire?"])
    setTag(e, "lFlagU", 1)

def lost(e):
    showMessage(e, ["It was definitely not a good idea..."])
