#bwbcwarlocks
from eventAPI import *
from APIUtils import *

bwbcwarlocks=0

def fireEvent(e):
   global bwbcwarlocks
   bwbcwarlocks = getTag(e, "bwbcwarlocks")
   if (bwbcwarlocks == 1):
      return 1
   else:
      showMessage(e, ["You face death itself in the form of 5 Black Claw Warlocks."], optionInput)
   fightThem(e)
   if (bwbcwarlocks == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Black Claw Warlock", 5, 1, 30)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bwbcwarlocks
   showMessage(e, ["Victory is ours!"])
   bwbcwarlocks = 1
   setTag(e, "bwbcwarlocks", bwbcwarlocks)

def lostFight(e):
   showMessage(e, ["Death and drek!, you gasp with your last breath."])

def ranAwayFight(e):
   global bwbcwarlocks
   showMessage(e, ["Let's get the friggin' hell out of here!"])
   bwbcwarlocks = 0
   setTag(e, "bwbcwarlocks", bwbcwarlocks)
   setExit(e, "maps/bwquadrant3.cfg", 28, 27, 90)
