#bwicegolems
from eventAPI import *
from APIUtils import *

bwicegolems=0

def fireEvent(e):
   global bwicegolems
   bwicegolems = getTag(e, "bwicegolems")
   if (bwicegolems == 1):
      return 1
   else:
      showMessage(e, ["Upon entering this room you are immediately attacked by some golems!"], optionInput)
   fightThem(e)
   if (bwicegolems == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Ice Golem", 6, 0, 10)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bwicegolems
   showMessage(e, ["You chop up the icegolems. Maybe you might come back and take some of the remains and make some margaritas."])
   bwicegolems = 1
   setTag(e, "bwicegolems", bwicegolems)

def lostFight(e):
   showMessage(e, ["The Ice Golems pound you to oblivion."])

def ranAwayFight(e):
   global bwicegolems
   showMessage(e, ["You scatter out of there."])
   bwicegolems = 0
   setTag(e, "bwicegolems", bwicegolems)
   setExit(e, "maps/bwquadrant4.cfg", 20, 15, 270)