#castle level 3 fight #2
from eventAPI import *
from APIUtils import *

rtCastle3Flag2=0

def fireEvent(e):
   global rtCastle3Flag2
   rtCastle3Flag2 = getTag(e, "rtCastle3Flag2")
   if (rtCastle3Flag2 == 1):
      return 1
   elif (rtCastle3Flag2 == 2):
      showMessage(e, ["Yep, they're still in there."])
   else:
      showMessage(e, ["Suprise!"], optionInput)
   fightThem(e)
   setTag(e, "rtCastle3Flag2", rtCastle3Flag2)
   if (rtCastle3Flag2 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Skeleton", 99, 0, 10), ("Skeleton", 99, 0, 20), ("Skeleton", 99, 0, 30), ("Skeleton", 99, 0, 40)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global rtCastle3Flag2
   showMessage(e, ["Talk about having skeletons in your closet..."])
   rtCastle3Flag2 = 1
   setTag(e, "rtCastle3Flag2", rtCastle3Flag2)

def lostFight(e):
   showMessage(e, ["What just happened?  Did you just stand there for an hour letting them hit you?"])

def ranAwayFight(e):
   global rtCastle3Flag2
   showMessage(e, ["How do they all fit in there?"])
   rtCastle3Flag2 = 2
   setTag(e, "rtCastle3Flag2", rtCastle3Flag2)