Example #1
0
    def __str__(self):
        "Summarise the room contents"

        dirs = [Room.__directions[d.lower()] for d in self.exits]

        text =  '{0}.\nExits are to {1}\n'.format(self.desc, comma_and(dirs))

        if self.__monster:
            text += 'A {0} {1}'.format(self.monster_health(), self.monster_name())

            if self.monster_health() == 'dead':
                text += ' lies in a pool of lurid green blood.\n'
            else:
                text += ' blocks your way\n'

        if self.booty:
            text += 'On the floor: ' + comma_and(self.booty)

        return text
Example #2
0
 def __str__(self):
     if len(self.items) > 0:
         return comma_and(self.items)
     else:
         return 'Nothing'