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

rtCastle2Flag2=0

def fireEvent(e):
   global rtCastle2Flag2
   rtCastle2Flag2 = getTag(e, "rtCastle2Flag2")
   if (rtCastle2Flag2 == 1):
      return 1
   elif (rtCastle2Flag2 == 2):
      showMessage(e, ["\"Again?\""])
   else:
      showMessage(e, ["You interrupt what appears to be a wizard convention.", "", "One of them points at you and says,", "\"You the caterers?  No?  Then you have to die!\""], optionInput)
   fightThem(e)
   setTag(e, "rtCastle2Flag2", rtCastle2Flag2)
   if (rtCastle2Flag2 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Alchemist", 8, 5, 30), ("Alchemist", 6, 5, 50), ("Alchemical Experiment", 15, 5, 10)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global rtCastle2Flag2
   showMessage(e, ["You emerge triumphant but singed."], optionInput)
   rtCastle2Flag2 = 1
   setTag(e, "rtCastle2Flag2", rtCastle2Flag2)

def lostFight(e):
   showMessage(e, ["As the world fades to black you hear the voices of your foes.", "", "\"Are you sure they weren't the caterers?"])

def ranAwayFight(e):
   global rtCastle2Flag2
   showMessage(e, ["The wizards make rude gestures to your back.", "", "\"..And one for yer mother, too!\""])
   rtCastle2Flag2 = 2
   setTag(e, "rtCastle2Flag2", rtCastle2Flag2)
