#bworcs
from eventAPI import *
from APIUtils import *

bworcs=0

def fireEvent(e):
   global bworcs
   bworcs = getTag(e, "bworcs")
   if (bworcs == 1):
      return 1
   else:
      showMessage(e, ["As you enter this room, you suddenly have the feeling that you wish you hadn't."], optionInput)
   fightThem(e)
   if (bworcs == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Orc", 50, 0, 30)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bworcs
   showMessage(e, ["As you look around all you can see is blood and guts strewn around the room. It now reeks of dead orc. Lets get the hell out of this friggin' place!"])
   bworcs = 1
   setTag(e, "bworcs", bworcs)

def lostFight(e):
   showMessage(e, ["One orc takes a knife and cuts your heart out, eating it as you lose conciousness and perish to the earth."])

def ranAwayFight(e):
   global bworcs
   showMessage(e, ["You flee the scene."])
   bworcs = 0
   setTag(e, "bworcs", bworcs)
   setExit(e, "maps/bwquadrant2.cfg", 22, 17, 90)