#plane of earth Mountain encounter
from eventAPI import *
from APIUtils import *

rtPOEMountain1 = 0

def fireEvent(e):
   global rtPOEMountain1
   rtPOEMountain1 = getTag(e, "rtPOEMountain1")
   if (rtPOEMountain1 == 2):
      questDone(e)
      return 0
   elif (rtPOEMountain1 == 1):
      returnVisit(e)
      return 0
   else:
      firstVisit(e)
      return 0

def firstVisit(e):
   global rtPOEMountain1
   showMessage(e, ["You enter a large cavern."])
   showMessage(e, ["A rumbling noise, deep and powerful, fills the chamber.", "", "You find that the source of the noise is a rather large rock."])
   showMessage(e, ["The rock begins to turn and you suddenly realize that it is in fact a rather large golem-like creature.", "", "You ready your weapons."])
   showPicture(e, "Stone_Golem")
   showMessage(e, ["\"Hmmm.\" the great rock rumbles, \"Calm down little ones.  There is no fighting to be done in here.\""])
   showMessage(e, ["\"I am Mountain and this is my home.  Yes, here I can sit and listen to the rocks and the soil for they have seen all that has happened.\"", "", "\"Now they tell me that you are on a journey.  What is it that brings you here?\""])
   showMessage(e, ["You tell the story of your encounter with the strange man who appeared to you in the empty space.", "", "Mountain sits montionless and quiet for some time after you have finished."])
   showMessage(e, ["\"It is Flame that has taken what you seek.  He is greedy and hot tempered.  He will not give anything willingly.  You should speak with Ocean as she is the only one who has ever held any power over Flame.\""])
   showMessage(e, ["Mountain turns his attention to other things.", "", "You leave."])
   rtPOEMountain1 = 1
   setTag(e, "rtPOEMountain1", rtPOEMountain1)


def returnVisit(e):
   global rtPOWOcean1
   global rtPOEMountain1
   rtPOWOcean1 = getTag(e, "rtPOWOcean1")
   if (rtPOWOcean1 == 1):
      showMessage(e, ["Mountain is sitting quietly listening to the rocks.", "", "As you approach, he turns his gaze upon you."])
      showPicture(e, "Stone_Golem")
      showMessage(e, ["\"Welcome again, little ones.\"", "", "Although impatient with this ponderous beast, you detail your encounter with Ocean.", "", "Again, Mountain sits silently for some time."])
      showMessage(e, ["\"She has become cold and emotionless without Wind.  I did not realize that it had been so long since Flame captured Wind for his own purposes.\""])
      showMessage(e, ["\"Ocean and Wind have always been close and it is only Wind that has ever made her laugh and play.  Though Wind can turn Ocean towards recklessness, I do think that they are both better off together.\""])
      showMessage(e, ["\"So very long ago it seems when Wind was captured.\"", "", "\"I have not heard him in a great long time.\""])
      showMessage(e, ["Mountain appears lost in thought.  Again, you wait patiently until he addresses you."])
      showMessage(e, ["\"You must go to free Wind and help to console Ocean.  When this is done, then Ocean will no doubt help you.\"", "", "\"It will be good to have them together again, though they do tend to wear on me.\""])
      showMessage(e, ["Mountain reaches out his arm and drops a large rock at your feet."])
      giveItems(e, ["Mountain Stone"])
      showMessage(e, ["Mountain tilts his head, as if listening to something.", "", "Giving you a concerned look, he speaks again."])
      showMessage(e, ["\"Flame is laughing, perhaps he knows.\"", "", "\"Be careful, little ones.\""])
      showMessage(e, ["Mountain turns his attention to other things.", "", "You leave."])
      rtPOEMountain1 = 2
      setTag(e, "rtPOEMountain1", rtPOEMountain1)
   else:
      showPicture(e, "Stone_Golem")
      showMessage(e, ["Mountain sits quietly before you and does not acknowledge your presence.", "", "You leave."])

def questDone(e):
   showPicture(e, "Stone_Golem")
   showMessage(e, ["Mountain sits quietly before you and does not acknowledge your presence.", "", "There is no reason to disturb him, so you turn and leave."])
   return 0
