#bwnomads
from eventAPI import *
from APIUtils import *

bwnomads=0

def fireEvent(e):
   global bwnomads
   bwnomads = getTag(e, "bwnomads")
   if (bwnomads == 1):
      return 1
   else:
      showMessage(e, ["The denizens of this mystic place assault you without warning."], optionInput)
   fightThem(e)
   if (bwnomads == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Nomad", 75, 7, 20)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bwnomads
   showMessage(e, ["Victory at last!"])
   bwnomads = 1
   setTag(e, "bwnomads", bwnomads)

def lostFight(e):
   showMessage(e, ["In your last moments, the words of the Nomad that vanquished you echoes in your head.......Eat steel you filthy swine!"])

def ranAwayFight(e):
   global bwnomads
   showMessage(e, ["Lets get the hell out of here!"])
   bwnomads = 0
   setTag(e, "bwnomads", bwnomads)
   setExit(e, "maps/bwquadrant4.cfg", 19, 28, 0)
