#keep level 2 fight #10
from eventAPI import *
from APIUtils import *

rtKeep2Flag1=0

def fireEvent(e):
   global rtKeep2Flag1
   rtKeep2Flag1 = getTag(e, "rtKeep2Flag1")
   if (rtKeep2Flag1 == 1):
      return 1
   elif (rtKeep2Flag1 == 2):
      showMessage(e, ["The spirits reappear and assault you!"])
   else:
      showMessage(e, ["Your footsteps stir the dust from the floor.", "", "Your presence here has disturbed something."], optionInput)
   fightThem(e)
   setTag(e, "rtKeep2Flag1", rtKeep2Flag1)
   if (rtKeep2Flag1 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Angry Spirit", 10, 4, 30), ("Cursed Spirit", 10, 4, 10), ("Cursed Spirit", 10, 2, 20)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global rtKeep2Flag1
   showMessage(e, ["The last echos of battle fade as the dust begins to settle once again."])
   rtKeep2Flag1 = 1
   setTag(e, "rtKeep2Flag1", rtKeep2Flag1)

def lostFight(e):
   showMessage(e, ["You have lost and will now join with the ranks of undead inhabiting this place."])

def ranAwayFight(e):
   global rtKeep2Flag1
   showMessage(e, ["As you flee, the spirits fade away."])
   rtKeep2Flag1 = 2
   setTag(e, "rtKeep2Flag1", rtKeep2Flag1)
