#bwdragons
from eventAPI import *
from APIUtils import *

bwdragons=0

def fireEvent(e):
   global bwdragons
   bwdragons = getTag(e, "bwdragons")
   if (bwdragons == 1):
      return 1
   else:
      showMessage(e, ["As you walk into this room you have the feeling that something is breathing down on your neck. You look up and see the face of a dragon. Not just one either."], optionInput)
   fightThem(e)
   if (bwdragons == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Green Dragon", 25, 0, 20)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global bwdragons
   showMessage(e, ["You s#*%! you survived! Praise Rennibister!"])
   bwdragons = 1
   setTag(e, "bwdragons", bwdragons)

def lostFight(e):
   showMessage(e, ["The green dragons gobble you up. Mmmmm. Adventurers!"])

def ranAwayFight(e):
   global bwdragons
   showMessage(e, ["You scatter out of there."])
   bwdragons = 0
   setTag(e, "bwdragons", bwdragons)
   setExit(e, "maps/bwquadrant4.cfg", 27, 18, 270)