#bwsenratq3
from eventAPI import *
from APIUtils import *

bwsenratq3=0

def fireEvent(e):
   global bwsenratq3
   bwsenratq3 = getTag(e, "bwsenratq3")
   if (bwsenratq3 == 1):
      return 1
   else:
      showMessage(e, ["You are assaulted by a hoarde of senrats."], optionInput)
   fightThem(e)
   if (bwsenratq3 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Senrat", 50, 2, 20)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bwsenratq3
   showMessage(e, ["Victory Everywhere! you shout."])
   bwsenratq3 = 1
   setTag(e, "bwsenratq3", bwsenratq3)

def lostFight(e):
   showMessage(e, [" Victory is sweet but not for you! Muwahahahahaha!"])

def ranAwayFight(e):
   global bwsenratq3
   showMessage(e, ["Let's get out of here!"])
   bwsenratq3 = 0
   setTag(e, "bwsenratq3", bwsenratq3)
   setExit(e, "maps/bwquadrant3.cfg", 20, 23, 270)
