Esempio n. 1
0
 def get_info(self, player):
     self.get_info_help()
     out = center_align('Open the door? y/n')
     print('\n' + out)
     player_input = getch()
     clear()
     # action: open door
     if player_input == 'y':
         # only open if they have the key
         if self.key in player.inventory or self.key is None:
             if self.key in player.inventory:
                 des = 'You unlock the door using the {}'.format(get_color_str(self.key, "yellow"))
             else:
                 des = 'The door opens'
             out = des
             _return = self.unlock_cord
         else:
             out = 'The door is locked'
     # action: leave the door
     else:
         out = 'Fearing what is beyond, '
         out += 'you leave the door for another day'
     out = center_align(out)
     print('\n\n\n{}\n\n'.format(out))
     getch()
     if _return:
         return _return
Esempio n. 2
0
    def show_info(self):
        clear()
        print()
        des = center_align("HEALTH: {}".format(self.health))
        print(des)
        des = center_align("INVENTORY")
        print(des)

        # print inventory
        if len(self.inventory) == 0:
            print(center_align("empty"))
        inv = "--"
        for item in self.inventory:
            inv += item + "--"
        des = center_align(inv)
        print(des)
        getch()
Esempio n. 3
0
 def get_info(self, player):
     self.get_info_help()
     out = center_align('Open this? y/n')
     print('\n' + out)
     player_input = getch()
     # action: open chest
     clear()
     if not self.empty:
         if player_input == 'y':
             out = 'You found a {}'.format(get_color_str(self.treasure, "yellow"))
             player.add_inventory(self.treasure)
             self.empty = True
         else:
             out = 'Fearing the unknown, '
             out += 'you leave it closed for another day'
     else:
         out = 'You find nothing... perhaps someone has already take the contents'
     out = center_align(out)
     print('\n\n\n{}\n\n'.format(out))
     getch()
Esempio n. 4
0
 def get_info_help(self):
     """Prints name and description."""
     spaces = 50 - len(self.name) - 8
     desline = center_align(self.description)
     clear()
     print('\n\n')
     print(' ' * (int(spaces/2)), end='')
     print(self.char + '---', end='')
     print(get_color_str(self.name.upper(), "red"), end='')
     print('---' + self.char, end='')
     print('\n\n' + desline)
Esempio n. 5
0
 def show_info(self):
     clear()
     print()
     des = center_align(self.info)
     print(des)
     getch()