from eventAPI import *
from APIUtils import *

def fireEvent(e):
   if (getTag(e, "lFlagU") == 2):
      return 1
   elif (getTag(e, "lFlagU") == 0):
      showMessage(e, ["A heap of debris has been gathered in this cave, probably by cleaning ants.","",
                      "A few rats have found refuge in the refuse; ready to fight for their residence, they bare their fangs and rush forward."])
      setTag(e, "lFlagU", 1)
   else:
      showMessage(e, ["The rats still refuse to let you in."])
   cr = combat(e, [("Giant Rat", 5, 2, 10)])
   if (cr == 1):
      showMessage(e, ["You are now the proud owner of a slightly used refuse heap, adorned with mutilated, lifeless rats.",
                      "","How bourgeois!"])
      setTag(e, "lFlagU", 2)
      return 1
   elif (cr == 3):
      showMessage(e, ["The rats add your bodies to their heap, and contemplate the results with great satisfaction."])
   else:  
      showMessage(e, ["You have no wish to fight for a pile of crap, and retreat with as much dignity as possible."])
      return 0

