def do_action(self,s): print 'Enemy name: ' + self.enemy.getName() print 'HP remaining: ' + str(self.enemy.getHP()) ability = self.player.getAbilityByName(s) if ability is None: print "You don't have an ability called " + s else: print "You used the " + ability.getName() + " ability!" print "You dealt " + magenta(str(ability.getDamage())) + " to " + red(self.enemy.getName()) self.enemy.setHP(self.enemy.getHP() - ability.getDamage()) if self.enemy.getHP() > 0: enemy_ability = self.enemy.getAbilities()[0] self.print_enemy_status(self.enemy) print red("--------- Enemy's Turn --------------") time.sleep(1.0) print self.enemy.getName() + " used " + self.enemy.getAbilities()[0].getName() + "!" time.sleep(1.0) self.player.setHP(self.player.getHP() - enemy_ability.getDamage()) print self.enemy.getName() + " dealt " + magenta(str(enemy_ability.getDamage())) + " to you!" time.sleep(1.0) self.print_player_status() print red("--------- End Enemy's Turn --------------") else: time.sleep(1.0) print red("You defeated " + red(self.enemy.getName())) print "You gained " + magenta(str(self.enemy.getXP())) + " XP" + "!" self.player.setXP(self.player.getXP() + self.enemy.getXP()) self.enemy.setHP(0) self.player return True
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 do_unequip( self, s ): item = self.player.getEquippedItemByName(s) if item == None: print "You don't have anything by that name equipped" else: self.player.unequipItem(item) print yellow(s) + " unequipped and put into your " + magenta('Inventory') + '.'
def do_inventory( self, s ): inv = self.player.getInventory() print magenta('=== INVENTORY ===') for item in inv: print yellow(item.getName()) print yellow(' - ' + item.getExamineText().replace('<i>','')) print magenta('=================') print magenta('=== EQUIPPED ===') for item in self.player.getEquipped(): print yellow(item.getName()) print yellow(' - ' + item.getExamineText().replace('<i>','')) print magenta('=================')
def do_take( self, s ): cur_room = self.map.getRooms()[self.player.getPos()] for item in cur_room.getItems() + cur_room.getDroppedItems(): if string.lower(item.getName()) == string.lower(s): if 'take' in item.getKeywords(): print yellow(item.getName()) + ' added to your' + magenta(' inventory') self.player.addToInventory(item) # Either remove the item from the list of room items, or list of dropped room items try: cur_room.getItems().remove(item) except ValueError: cur_room.getDroppedItems().remove(item) ## Check both items that were used to see if any alternate descriptions should be used if item.getAltDescDirection() is not None: cur_room.setAltDescBool(item.getAltDescDirection(), True) return else: print red("You can't take that.") return print "You don't see anything that looks like a " + yellow(s) + '.'
def help_stats(self): print 'Show the core stats of your character.' print magenta('IN DEVELOPMENT')
def help_enemies(self): print 'List all the combattable enemies in the room' print magenta('IN DEVELOPMENT')
def help_attack(self): print 'Attack an enemy and enter combat mode' print magenta('IN DEVELOPMENT')
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()))