#keep level 2 observation tower #1
from eventAPI import *
from APIUtils import *

rtKeep2Tower1=0

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

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

def wonFight(e):
   global rtKeep2Tower1
   global rtKeep1TowerFlag
   rtKeep1TowerFlag = getTag(e, "rtKeep1TowerFlag")
   showMessage(e, ["You are free to continue your battle through the tower."])
   rtKeep2Tower1 = 1
   rtKeep1TowerFlag = 3
   setTag(e, "rtKeep2Tower1", rtKeep2Tower1)
   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 rtKeep2Tower1
   showMessage(e, ["You hear laughter as you flee your enemies."])
   rtKeep2Tower1 = 2
   setTag(e, "rtKeep2Tower1", rtKeep2Tower1)
