Ejemplo n.º 1
0
 def _frontalAssault(self, player):
     """
     The action sequence if the user decides to attack the Black Gate.
     
     @param player:   The player object.
     """
     #Battle wave 1
     print "Mouth of Sauron: \"I'm so glad you came! Slumber party!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave)
     if not result:
         return
         
     #Battle wave 2
     print "Mouth of Sauron: \"Hmm. You appear to not like our house.\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave2)
     if not result:
         return
         
     #Battle wave 3
     print "Mouth of Sauron: \"Time to DIE!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave3)
     if not result:
         return
         
     #Call the victory sequence
     self._victorySequence(player)
Ejemplo n.º 2
0
 def _frontalAssault(self, player):
     """
     Battle sequence for Minas Morgul.
     
     @param player:   The current player.
     """
     #Wave 1
     print ("Witch-King: \"Time for tea and crumpets. Please keep to the" 
         " left and don't \ntouch any of the artifacts.\" ")
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave)
     if not result:
         return
     
     print "Witch-King: \"Hmm. You appear to not like my tea. How Rude....\"" 
     raw_input("Press enter to continue. ")
     print ""
     
     #Wave 2
     print "Witch-King: \"Perhaps you will like this instead....\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave2)
     if not result:
         return
         
     #Call _victorySequence
     self._victorySequence(player)
Ejemplo n.º 3
0
 def _battle(self, player):
     """
     Battle sequence for Isenmouthe.
     
     @param player:   The current player.
     """
     #Wave 1
     print "Mouth of Sauron: \"You have overstayed your welcome.\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave)
     if not result:
         return
     
     #Wave 2
     print "Mouth of Sauron: \"Time... to... DIE!!!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave2)
     if not result:
         return
         
     #Call victory sequence
     self._victorySequence(player)
Ejemplo n.º 4
0
 def _battlePhase(self):
     """
     Evaluates if a random battle will occur. If so, battle_engine.battle()
     is called to execute the battle.
     """
     currentLocation = self._player.getLocation()
     battleProbability = currentLocation.getBattleProbability()
     
     #Determines if random battle will occur
     if random.random() < battleProbability:
         #Call on battle to resolve battle
         battle_engine.battle(self._player, 
         constants.BattleEngineContext.RANDOM)
Ejemplo n.º 5
0
 def _battle(self, player):
     """
     Barad Dur's battle sequence. Player fights five waves of enemies.
     
     @param player:   The player object.
     """
     print "Orc Commander I: \"We're having a blast upstairs! Slumber party!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave)
     if not result:
         return
         
     print ("Orc Commander II: \"Didn't you read the sign? No %ss" 
         " allowed.\"" % player.getName())
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave2)
     if not result:
         return
         
     print "Mouth of Sauron: \"You want ANOTHER slumber party?!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave3)
     if not result:
         return
         
     print "Nazgul: \"AAAAEEEEEEEEEEE!!!\""
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave4)
     if not result:
         return
         
     print ("Lance of the Elite Four: \"I've been waiting for you, %s! I" 
         " knew \nthat you, with your skills, would eventually reach me here.\"" 
         % player.getName())
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave5)
     if not result:
         return
         
     #Call _victorySequence
     self._victorySequence(player)
Ejemplo n.º 6
0
    def _battle(self, player):
        """
        Battle sequence for Isenguard.

        @param player:  The current player.
        """
        #Wave 1
        print ("Immediately as you approach the Ring of Isenguard, you are" 
            " greeted with an a wave of Uruk....")
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, self._wave)
        if not result:
            return False
        print ""
        
        #Wave 2
        print ("As you gaze over bodies of your slain enemies, Sauroman the" 
            " Great Wizard appears.")
        raw_input("Press enter to continue. ")
        print ""
        
        print ("Sauroman: \"You shouldn't have come, foolish one. Were you" 
            " haughty enough to think that you could take the Orthanc?\"")
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave2)
        if not result:
            return False
        print ""
        
        #Wave 3
        print "Sauroman: \"You stupid fool....\""
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave3)
        if not result:
            return False
        print ""

        #Victory sequence
        print "Isenguard has a new overseer this day."
        print ""
        
        self._createPort("south")
        
        #Give player loot
        if self._keysOfOrthanc in self._loot:
            print "You have gained the Keys of the Orthanc!"
            print ""
            if player.addToInventory(self._keysOfOrthanc):
                self._loot.remove(self._keysOfOrthanc)
Ejemplo n.º 7
0
    def _cave(self, player):
        """
        Action sequence for Gollum's cave.
        
        @param player:  The current player.
        """
        print "You try to sneak through Gollum's Cave."
        raw_input("Press enter to continue. ")
        print ""

        #If player ventures through undetected
        if random.random() < constants.GOBLIN_TOWN_EVASION_PROB:
            print "You make it through the mountains safely!"
            raw_input("Press enter to continue. ")
            print ""
            
        #If player gets  trapped in cave.
        else:
            #Story
            print ("Great Goblin: \"You fool... did you really think you could" 
                " make it through my territory \nwithout me knowing?\"")
            raw_input("Press enter to continue. ")
            print ""
            
            #Fight wave 4
            print "Great Goblin: \"Now I will feast on your flesh....\""
            raw_input("Press enter to continue. ")
            print ""
            result = battle(player, constants.BattleEngineContext.STORY, 
                self._wave4)
            if not result:
                return
            
            #Call victory sequence
            self._victorySequence(player)
 def _cirithUngol(self, player):
     """
     Action sequence for the Tower of Cirith Ungol.
     
     @param player:   The player object.
     """
     successfulEscape = random.random()
     #If player manages to escape undetected
     if successfulEscape < constants.CIRITH_UNGOL_EVASION_PROB:
         print ("You manage to sneak through the Tower of Cirith Ungol and"
             " are now in the heart \nof Mordor.")
         raw_input("Press enter to continue. ")
         print ""
     #If player gets detected
     else:
         print ("As you attempt to sneak through the rest of the passage,"
             " you are discovered \nby an orc patrol.")
         raw_input("Press enter to continue. ")
         print ""
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._wave2)
         if not result:
             return
             
         #Story
         print ("You make it into Mordor and Sauron has been alerted of"
             " your presence.")
         raw_input("Press enter to continue. ")
         print ""
     
     #Create port for quest completion
     self._createPort("east")
Ejemplo n.º 9
0
 def _frontalAssault(self, player):
     """
     Action sequence for frontal assault option.
     
     @param player:   The current player.
     """
     #Monster battles
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave)
     if not result:
         return
         
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave2)
     if not result:
         return
         
     #Call _victorySequence
     self._victorySequence(player)
Ejemplo n.º 10
0
    def _frontalAssault(self, player):
        """
        Action sequence for frontal assault choice.
        
        @param player:  The current player.
        """
        #Story
        print "Time to slay some goblins! On to Goblin Town!"
        raw_input("Press enter to continue. ")
        print ""
        
        print "You see some primitive huts, all uninhabited." 
        raw_input("Press enter to continue. ")
        print ""
        
        print "Suddenly, goblins circle you from all directions!"
        raw_input("Press enter to continue. ")
        print ""

        #Frontal assault wave 1
        print ("Great Goblin: \"What makes you think that you can just charge" 
            " into my city?\"")
        raw_input("Press enter to continue. ")
        print ""
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave2)
        if not result:
            return
            
        #Frontal assault wave 2
        print "Great Goblin: \"You stupid fool it is now time to DIE!\" "
        raw_input("Press enter to continue. ")
        print ""
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave3)
        if not result:
            return
            
        #Call victory sequence
        self._victorySequence(player)
Ejemplo n.º 11
0
    def _battle(self, player):
        """
        Battle sequence for Isenguard.

        @param player:  The current player.
        """
        #Wave 1
        print ("Immediately as you approach the Ring of Isenguard, you are" 
            " greeted with an a wave of Uruk....")
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, self._wave)
        if not result:
            return False
        print ""
        
        #Wave 2
        print ("As you gaze over bodies of your slain enemies, Sauroman the" 
            " Great Wizard appears.")
        raw_input("Press enter to continue. ")
        print ""
        
        print ("Sauroman: \"You shouldn't have come, foolish one. Were you" 
            " haughty enough to think that you could take the Orthanc?\"")
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave2)
        if not result:
            return False
        print ""
        
        #Wave 3
        print "Sauroman: \"You stupid fool....\""
        raw_input("Press enter to continue. ")
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave3)
        if not result:
            return False
        print ""
        
        return True
Ejemplo n.º 12
0
 def _chanceBattle(self, player):
     """
     Determines if a random battle is to occur.
     
     @param player:   The player object.
     """
     if random.random() < constants.THARBAD_BATTLE_PROB and self._monsters:
         print "You hear some rustling in the shadows...."
         raw_input("Press enter to continue. ")
         print ""
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._monsters)
         if not result:
             return
Ejemplo n.º 13
0
    def enter(self, player):
        """
        Action sequence for Moria.
        
        @param player:   The current player.
        """
        #Story
        print self._greetings
        print ""
        
        print ("You enter into a once-glorious hall, moving quickly among" 
            " the shadows.")
        raw_input("Press enter to continue. ")
        print ""
        
        #Generate length of time spent in Moria
        timeInMoria = random.randrange(15, 25)

        #Player journeys through Moria
        for time in range(timeInMoria):
            if self._danger < constants.MORIA_LOW_RISK_UPPER_LIMIT:
                result = self._lowRiskTravel(player)
            elif self._danger < constants.MORIA_MED_RISK_UPPER_LIMIT:
                result = self._mediumRiskTravel(player)
            else:
                result = self._highRiskTravel(player)
            
            #Unpack results
            statement = result[0]
            battleOccurence = result[1]
                        
            #Execute action sequence
            print statement
            raw_input("Press enter to continue. ")
            print ""
            
            if battleOccurence:
                result = battle(player, constants.BattleEngineContext.RANDOM)
                if not result:
                    self._danger = 0
                    return
        
        #Ending sequence
        print "You emerge from the Mines!"
        raw_input("Press enter to continue. ")
        print ""
        
        self._danger = 0
        self._createPort("east")
Ejemplo n.º 14
0
 def _run(self, player):
     """
     Action sequence for run option.
     
     @param player:   The current player.
     """
     print "You find yourself surrounded."
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave3)
     if not result:
         return
     
     print "You escape with your life!"
     print ""
Ejemplo n.º 15
0
 def _run(self, player):
     """
     The action sequence if player chooses to run. In this instance, player 
     still gets attacked by a smaller wave of enemies while leaving.
     
     @param player:   The current player.
     """
     #Battle enemies
     print ("As you rush out of the area, a large number of enemies catch" 
     " up to you.")
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave3)
     if not result:
         return
         
     print "You narrowly escape your enemies."
     print ""
Ejemplo n.º 16
0
 def _run(self, player):
     """
     The action sequence given that the player tries to run. In this 
     instance, a smaller chunk of enemies catch up to the player.
     
     @param player:   The player object.
     """
     #Battle wave 4
     print "The leading army catches up with you." 
     raw_input("Press enter to continue. ")
     print ""
     result = battle(player, constants.BattleEngineContext.STORY, 
         self._wave4)
     if not result:
         return
         
     #Story
     print "You escape the rest of your pursuers!"
     raw_input("Press enter to leave. ")
     print ""
Ejemplo n.º 17
0
    def _camp(self, player):
        """
        The camping action sequence. One of two things happen:
        -User gets attacked by a group of Nazgul.
        -Player spends the night undisturbed and gets fully healed.
        """
        # Nazgul encounter
        if random.random() < constants.WEATHERTOP_BATTLE_PROB:
            print ("As you prepare your camping gear, you hear some rustling" " in the \nshadows....")
            result = battle(player, constants.BattleEngineContext.STORY, self._monsters)
            if not result:
                return

            print ("Alas, peaceful rest was never to be. After all, you are a" " man \nhunted.")
            print ""

        # Peaceful rest
        else:
            print "You enjoy a relaxing stay among ancient ruins."
            amountHealing = player.getMaxHp() - player.getHp()
            player.heal(amountHealing)
            print "You wake up relaxed and ready to go!"
            print ""
Ejemplo n.º 18
0
    def enter(self, player):
        """
        Action sequence for GoblinTown.

        @param player:  The current player.
        """
        print self._greetings
        print ""
        
        #Fight wave 1
        print ("As you creep along High Pass hoping to avoid detection, you" 
            " hear some creeping \nin the shadows....")
        raw_input("Press enter to continue. ")
        print ""
        result = battle(player, constants.BattleEngineContext.STORY, 
            self._wave)
        if not result:
            return
            
        #Story
        print ("You have defeated some unsuspecting goblins! Escaping" 
            " detection now may \nstill be an option!")
        raw_input("Press enter to continue. ")
        print ""
    
        #Solicit user choice
        print ("As you think ahead, you have two options. You may attempt to" 
            " sneak through \nGollum's Cave taking the risk getting trapped " 
            " or go straight into Goblin Town.")
        print ""
        choice = self._choice()

        #Run choice-dependent scripts
        if choice == "cave":
            self._cave(player)
        else:
            self._frontalAssault(player)
 def _shelobClef(self, player):
     """
     Action sequence for venturing through Shelob's Clef.
     
     @param player:   The player object.
     """
     #Story
     print ("As you enter into Shelob's Clef, you are surrounded by a"
         " supernatural darkness and \nthe stench of rotting corpses.")
     raw_input("Press enter to continue. ")
     print ""
     
     print "...."
     raw_input("Press enter to continue. ")
     print ""
     
     #If Phial of Galadriel in inventory
     if phialOfGaladriel in player.getInventory():
         print "Galadriel's phial lights up the entire chamber."
         raw_input("Press enter to continue. ")
         print ""
         
         print ("The light gives you strength... and Shelob backs away,"
         " afraid of the light.")
         raw_input("Press enter to continue. ")
         print ""
         
         #Call next action sequence
         self._cirithUngol(player)
         return
     
     #A potential encounter with Shelob
     shelobAppearance = random.random()
     if shelobAppearance < constants.CIRITH_UNGOL_SHELOB_PROB:
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._wave)
         if not result:
             return
         
     print "You encounter a thick spider web."
     raw_input("Press enter to hack through the web. ")
     print ""
     
     #A potential encounter with Shelob
     shelobAppearance = random.random()
     if shelobAppearance < constants.CIRITH_UNGOL_SHELOB_PROB:
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._wave)
         if not result:
             return
             
     print "...."
     raw_input("Press enter to continue. ")
     print ""
     
     #A potential encounter with Shelob
     shelobAppearance = random.random()
     if shelobAppearance < constants.CIRITH_UNGOL_SHELOB_PROB:
         result = battle(player, constants.BattleEngineContext.STORY, self._wave)
         if not result:
             return
             
     print "You encounter a thick spider web."
     raw_input("Press enter to hack through the web. ")
     print ""
     
     #A potential encounter with Shelob
     shelobAppearance = random.random()
     if shelobAppearance < constants.CIRITH_UNGOL_SHELOB_PROB:
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._wave)
         if not result:
             return
             
     print "...."
     raw_input("Press enter to continue. ")
     print ""
     
     #A potential encounter with Shelob
     shelobAppearance = random.random()
     if shelobAppearance < constants.CIRITH_UNGOL_SHELOB_PROB:
         result = battle(player, constants.BattleEngineContext.STORY, 
             self._wave)
         if not result:
             return
             
     print "You have emerged through the darkness!"
     raw_input("Press enter to continue. ")
     print ""
     
     #Call next action sequence
     self._cirithUngol(player)