#keep level 1 observation tower #2

from eventAPI import *
from APIUtils import *

rtKeep1Tower2=0

def fireEvent(e):
   global rtKeep1Tower2
   rtKeep1Tower2 = getTag(e, "rtKeep1Tower2")
   if (rtKeep1Tower2 == 1):
      return 1
   elif (rtKeep1Tower2 == 2):
      showMessage(e, ["Your enemies return!"])
   else:
      showMessage(e, ["You come upon a group of monsters."], optionInput)
   fightThem(e)
   if (rtKeep1Tower2 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   combatRet = combat(e, [("Zombified Orc Fury", 11, 3, 10)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global rtKeep1Tower2
   global rtKeep1TowerFlag
   rtKeep1TowerFlag = getTag(e, "rtKeep1TowerFlag")
   showMessage(e, ["You are free to continue your battle through the tower."])
   rtKeep1Tower2 = 1
   rtKeep1TowerFlag = 2
   setTag(e, "rtKeep1Tower2", rtKeep1Tower2)
   setTag(e, "rtKeep1TowerFlag", rtKeep1TowerFlag)


def lostFight(e):
   showMessage(e, ["It seems that you aren't as powerful as you thought you were."])

def ranAwayFight(e):
   global rtKeep1Tower2
   showMessage(e, ["You hear laughter as you flee your enemies."])
   rtKeep1Tower2 = 2
   setTag(e, "rtKeep1Tower2", rtKeep1Tower2)
