Exemplo n.º 1
0
 def get_name(self, article=0):
     if article == 0:
         return 'the ' + self.name
     elif article == 1:
         return self.name
         
     _name = get_correct_article(self.name) + ' ' + self.name
     return _name.strip()       
Exemplo n.º 2
0
 def pick_up_message(self, agent, item):
     _msg = self.resolve_name(agent) + ' ' + self.parse(agent, 'pick')
     _item = item.get_full_name()
     _art = get_correct_article(_item)
     _msg += ' up '
     if _art != '':
         _msg += _art + ' '
     _msg += _item + '.'
         
     self.dm.alert_player(agent.row, agent.col, _msg)
Exemplo n.º 3
0
    def get_menu(self,category):
        menu = []

        for j in range(0,26):
            letter = chr(self.lc+j)
        
            if self.__inv[letter] != '' and self.__inv[letter][1] == category:
                name = self.__inv[letter][0].get_full_name() 
                name = get_correct_article(name) + ' ' + name

                if self.__inv[letter] == self.__primary_weapon:
                    name += ' (primary weapon)'
                elif self.__inv[letter] == self.__secondary_weapon:
                    name += ' (secondary weapon)'
                elif self.__inv[letter][0].get_category() == 'Armour':
                    if self.__inv[letter] == self.__readied_armour[self.__inv[letter][0].get_area()]:
                        name += ' (being worn)'

                menu.append( (letter,name,letter,letter) )

        return menu
Exemplo n.º 4
0
 def get_full_menu(self):
     _menu = {}
     
     for j in range(0,26):
         letter = chr(self.lc+j)
         
         if self.__inv[letter] != '':
             _category = self.__inv[letter][1]
             _name = self.__inv[letter][0].get_full_name()
             _art = get_correct_article(_name)
             if _art != '':
                 _name = _art + ' ' + _name
             if self.__inv[letter] == self.__primary_weapon:
                 _name += ' (primary weapon)'
             elif self.__inv[letter] == self.__secondary_weapon:
                 _name += ' (secondary weapon)'
             elif self.__inv[letter][0].get_category() == 'Armour':
                 if self.__inv[letter] == self.__readied_armour[self.__inv[letter][0].get_area()]:
                     _name += ' (being worn)'
                     
             if not _category in _menu.keys():
                 _menu[_category] = []
             _menu[_category].append( (letter,_name,letter,letter))
     return _menu
Exemplo n.º 5
0
    def wear_armour(self):
        try:
            _ch = self.dui.pick_inventory_item('Put on what?')
            _player = self.dm.player
            _item = _player.inventory.get_item(_ch)
    
            if _item == '':
                self.dui.display_message('You do not have that item.')
            elif _item != '' and _item.get_category() != 'Armour':
                self.dui.display_message('You cannot wear that!')
            else:
                try:
                    _player.inventory.ready_armour(_ch)
                    _player.calc_ac()
                    _player.apply_effects_from_equipment()
                    self.dui.display_message('You put on the ' + _item.get_full_name())
                
                    # Yes! I will definitely use three lines of code just for a bad joke!!
                    if isinstance(_item, Items.TargetingWizard):
                        self.dui.display_message("It looks like you're wasting some foes!  Would you like help?")
                    
                    self.dui.update_status_bar()
                    _player.energy -= STD_ENERGY_COST
                except AlreadyWearingSomething:
                    _msg = 'You are already wearing '
                    _area = _item.get_area()

                    if _area not in ['gloves','boots']:
                        _msg += get_correct_article(_area) + ' '

                    _msg += _area
                    self.dui.display_message(_msg)
        except NonePicked:
            self.dui.clear_msg_line()
        except EmptyInventory:
            pass