#keep level 1 Observation Tower #1

from eventAPI import *
from APIUtils import *

rtKeep1Tower1=0
rtKeep1TowerFlag=0

def fireEvent(e):
   global rtKeep1Tower1
   rtKeep1Tower1 = getTag(e, "rtKeep1Tower1")
   if (rtKeep1Tower1 == 1):
      return 1
   elif (rtKeep1Tower1 == 2):
      showMessage(e, ["Your enemies return!"])
   else:
      showMessage(e, ["You begin to make your way up the observation tower.  It is not long before you stumble across a group of enemies."], optionInput)
   fightThem(e)
   if (rtKeep1Tower1 == 1):
      return 1
   else:
      return 0

def fightThem(e):
   showMessage(e, ["Egad!  Zombies!"])
   combatRet = combat(e, [("Zombified Orc Fury", 7, 2, 10), ("Demon Dog", 5, 3, 10)])
   if (combatRet == 1):
      wonFight(e)
   elif (combatRet == 3):
      lostFight(e)
   else:
      ranAwayFight(e)

def wonFight(e):
   global rtKeep1Tower1
   global rtKeep1TowerFlag
   rtKeep1TowerFlag = getTag(e, "rtKeep1TowerFlag")
   showMessage(e, ["It appears as if it will take some effort to reach the top of the towers."])
   rtKeep1Tower1 = 1
   rtKeep1TowerFlag = 1
   setTag(e, "rtKeep1Tower1", rtKeep1Tower1)
   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 rtKeep1Tower1
   showMessage(e, ["You hear laughter as you flee your enemies."])
   rtKeep1Tower1 = 2
   setTag(e, "rtKeep1Tower1", rtKeep1Tower1)
