def do_use( self, s ): #global GLOBAL_TIME #global TURBULENCE_START_TIME #global TURBULENCE_STOP_TIME if 'on' not in s: print self.parser.parseDescription("USE syntax: use <i><item1> on <i><item2>") return string1 = s.split('on')[0].strip() string2 = s.split('on')[1].strip() #if len(s.split()) < 3: # print self.parser.parseDescription("USE syntax: use <i><item1> on <i><item2>") # return cur_room = self.map.getRooms()[self.player.getPos()] room_items = cur_room.getItems() #string1 = s.split()[0] #string2 = s.split()[2] playeritem = self.player.getInventoryItemByName(string1) roomitem = cur_room.getItemByName(string2) ## For the case where the player doens't actually have the first item ## e.g. use latch on door if playeritem is None: playeritem = cur_room.getItemByName(string1) if playeritem is None: print "There's no " + yellow(string1) + " that could be found to use." elif roomitem is None: print "There's no " + yellow(string2) + " that could be found to use." elif string.lower(playeritem.getName()) in roomitem.getUnlockItems(): cur_room.modifyDirectionalBoundary(roomitem.getDirectionToChange()) print 'You used ' + yellow(string1) + ' on ' + yellow(string2) + '.' ### Check for lockbox opening and start the countdown to Turbulence # if string.lower(string2) == 'lockbox': # TURBULENCE_START_TIME = GLOBAL_TIME + 2 # TURBULENCE_STOP_TIME = GLOBAL_TIME + 7 if roomitem.getUnlockText() != '': print self.parser.parseDescription(roomitem.getUnlockText()) else: if cur_room.getDirectionByName(roomitem.getDirectionToChange()): print 'The ' + cyan(roomitem.getDirectionToChange()) + cyan('ern') + ' passage has opened!' else: print 'The ' + cyan(roomitem.getDirectionToChange()) + cyan('ern') + ' passage has closed!' ## Check for droppable items - if present, drop them if len(roomitem.getDroppableItems()) > 0: for item in roomitem.getDroppableItems(): cur_room.addToDroppedItems(item) #roomitem.getDroppableItems().remove(item) print yellow(roomitem.getName()) + ' dropped ' + yellow(item.getName()) + '!' ## Clear out droppable items so they can't drop again del roomitem.getDroppableItems()[:] ## Check both items that were used to see if any alternate descriptions should be used if playeritem.getAltDescDirection() is not None: cur_room.setAltDescBool(playeritem.getAltDescDirection(), True) if roomitem.getAltDescDirection() is not None: cur_room.setAltDescBool(roomitem.getAltDescDirection(), True) else: print "You can't use " + yellow(string1) + ' on ' + yellow(string2) + '!'
def do_launch(self, s): print magenta("Must Survive: Episode 0 - Elevated") print cyan("(1) New Game") print cyan("(2) Load Game") response = raw_input('What would you like to do? ') if response == '1': self.onecmd('new') elif response == '2': filename = raw_input('File to load: ') if not filename.endswith('.p'): filename = filename + '.p' self.onecmd('load ' + filename)
def print_enemy_status(self, enemy): print cyan(enemy.getName()) print ' HP: ' + str(enemy.getHP()) print ' MP: ' + str(enemy.getMP())
def print_player_status(self): print cyan('Player') print ' HP: ' + str(self.player.getHP()) print ' MP: ' + str(self.player.getMP())
def do_abilities(self, s): INDENT = ' ' for a in self.player.getAbilities(): print magenta(a.getName()) print INDENT + cyan(a.getDescription()) print INDENT + cyan('Damage: ' + str(a.getDamage()))