#stone golem fight
from eventAPI import *
from APIUtils import *

bwstonegolem=0

def fireEvent(e):
   global bwstonegolem
   bwstonegolem = getTag(e, "bwstonegolem")
   if (bwstonegolem == 1):
      return 1
   else:
      showMessage(e, ["Upon entering the room a statue springs to life and attacks."], optionInput)
   fightThem(e)
   if (bwstonegolem == 1):
      return 1
   else:
      return 0

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

def wonFight(e):
   global bwstonegolem
   showMessage(e, ["You smash the stone golem into pieces. Debri litters the floor."])
   bwstonegolem = 1
   setTag(e, "bwstonegolem", bwstonegolem)

def lostFight(e):
   showMessage(e, ["As you lay dying the stone golem transforms back into a motionless statue."])

def ranAwayFight(e):
   global bwstonegolem
   showMessage(e, ["You back out of the room and close the door and hope the golem doesn't come crashing through it to get you."])
   bwstonegolem = 0
   setTag(e, "bwstonegolem", bwstonegolem)
   setExit(e, "maps/bwquadrant1.cfg", 24, 12, 270)
