Exemplo n.º 1
0
    def execute(self, item=None):
        #global connections_list
        #print("I'm in the {0}.".format(self.player.room.name))
        #current_connections = []
        #for possible_connection in connections_list:
        #    if self.player.room in possible_connection:
        #        current_connections.append(possible_connection)
        #if len(current_connections) == 0:
        #    print("I can't go anywhere. I'm stuck in here...")
        #else:
        #    print("There is access to {0}".format(list_to_string(current_connections, article_definite=True)))

        if self.player.room.connections:
            rooms = "the {0}".format(self.player.room.connections[0].name.lower())
            length = len(self.player.room.connections)
            if length != 1:
                for counter in range(1, length - 1):
                    rooms += ", the {0}".format(self.player.room.connections[counter].name.lower())
                rooms += " and {0}".format(self.player.room.connections[length-1].name.lower())
            print("There is access to {0}.".format(list_to_string(self.player.room.connections, article=True, article_definite=True))) # testing
        if self.player.room.inventory:
            length_inv = len(self.player.room.inventory)
            if length_inv == 1:
                print("A {0} is in this room.".format(self.player.room.inventory[0].name))
            else:
                print("{0} are in this room.".format(list_to_string(self.player.room.inventory, True)))
        else:
            print("There's nothing here...")
            return 0
Exemplo n.º 2
0
 def use_item(self, second_item=None):
     print("The {0} has broken and dropped {1}.".format(
         self.name, list_to_string(self.access_to)))
     self.player.room.remove(self)
     for hidden_item in self.access_to:
         self.player.room.inventory.append(hidden_item)
     return
Exemplo n.º 3
0
 def execute(self, item=None):
     for heldItem in self.player.bag_contents:
         print(heldItem.name.capitalize())
     for inventoryItem in self.player.bag_contents:
         try:
             if inventoryItem.capacity != 0 and inventoryItem.access_to:
                 print("Inside the {0} I have {1}.".format(inventoryItem, list_to_string(inventoryItem.access_to)))
         except AttributeError:
             print("This has no storage.")
     if not self.player.bag_contents:
         print("I'm not holding anything.")
Exemplo n.º 4
0
 def use_item(self, second_item=None):
     if not self.locked:
         self.player.room.inventory.extend(self.access_to)
         if len(self.access_to) >= 1:
             if len(self.access_to) == 1:
                 print("A {0} was emptied into the room.".format(
                     self.access_to[0].name))
             else:
                 print("{0} were emptied into the room.".format(
                     list_to_string(self.access_to, True)))
         else:
             print("There wasn't anything in there...")
         self.access_to = []
     else:
         print("I can't get it open! Maybe it can be unlocked.")
Exemplo n.º 5
0
 def execute(self, item=None):
     success = False
     held_item = None
     for held_item in self.player.bag_contents:
         if item.lower() == held_item.name:
             self.player.bag_contents.remove(held_item)
             print("The {0} is broken to pieces! Mwhahaha.".format(held_item.name))
             success = True
             print(held_item.name)
             for i in held_item.access_to:
                 print(i.name)
             for hidden_item in held_item.access_to:
                 self.player.room.inventory.append(hidden_item)
             if len(held_item.access_to) == 1:
                 print("A {0} was in the {1}.".format(held_item.access_to[0], held_item.name))
             elif len(held_item.access_to) > 1:
                 print("{0} were in the {1}.".format(list_to_string(held_item.access_to, capital=True)), held_item.name)
     if not success:
         print("I don't have one of those to destroy. Maybe I can find one...")
Exemplo n.º 6
0
    def execute(self, item=None):
        #action_list = self.player.action_list

        #actions = "{0}".format(action_list[0].name.lower())

        #for i in range(1, len(action_list) - 1):
        #    actions += ", {0}".format(action_list[i].name.lower())

        #actions += " and {0}.".format(action_list[-1].name.lower())

        #include_articles = True
        #sentence_case = False

        #output = ''
        #list_size = len(action_list)
        # just for fun
        #for i in range(list_size):
        #    output += (', ' if 0 < i < list_size - 1 else 'and ') + \
        #              (('A ' if i == 0 and sentence_case else 'a ') if include_articles else '') + action_list[i]

        print("The possible actions are {0}.".format(list_to_string(self.player.action_list, False, False)))