Exemplo n.º 1
0
         currentRoom.quest.desc = currentRoom.quest.desc + " [COMPLETED]"
         #matching the reward from the quest with item object
         m = 0 
         while m < len(items):
             if (currentRoom.quest.reward == items[m].name):
                 adv.take(items[m])
                 break      
             m+=1
                
     
 elif i == "CHECK":
     x = input("Check what? ")
     m = x.upper()
     print("")
     if m =="ME":
         adv.check_self()      
     if m != "ME":
         #allows the adventurer input to be case insensitive and checks if item in adventurers inventory
         m = 0                
         while m < len(items):
             if ((x.upper() == items[m].name.upper()) or (x.upper() == items[m].short.upper())):  
                 print(items[m].name)
                 print("Grants a bonus of " + items[m].skill_bonus + " to SKILL.")
                 print("Grants a bonus of " + items[m].will_bonus + " to WILL.")
                 print()
                 print()
                 break
             m+=1
         #if object not in inventory 
         else:
             print("You don't have that!\n")
Exemplo n.º 2
0
    elif user_input == "inv":
        """Display the characters inventory and print out all items that they are carrying"""
        print("You are carrying:")
        characters_inventory = character.get_inv()
        if len(characters_inventory) == 0:
            print("Nothing.")
        else:
            for item in range(len(characters_inventory)):
                print("- A {}".format(character.inventory[item].get_name()))

    elif user_input == "check":
        """Allows the user to examine items or themselves. This command will ask the user for a second input, which can be an item's name or its short name. If the user enters 'me', they are shown a description of their character"""
        user_input_two = input("Check what? ").lower()
        print()
        if user_input_two == "me":
            character.check_self()
        else:
            whether_carrying = False
            for item in range(len(character.get_inv())):
                if character.inventory[item].get_name().lower(
                ) == user_input_two or character.inventory[item].get_short(
                ).lower() == user_input_two:
                    character.inventory[item].get_info()
                    whether_carrying = True
                    break
            if whether_carrying == False:
                print("You don't have that!")

    elif (user_input
          == "n") or (user_input == "north") or (user_input == "south") or (
              user_input == "east") or (user_input == "west") or (