Пример #1
0
 def test_addXinvalid(self):
     assert get_quantity(1, 1) == 2
     assert get_quantity(1, 2) == 0
     add_item(1, 10, 5000)
     assert get_quantity(1, 1) == 2
     assert get_quantity(1, 2) == 0
     add_item(2, 1, 300)
     assert get_quantity(1, 1) == 2
     assert get_quantity(1, 2) == 0
Пример #2
0
def take_item():
    item_name = input("Which item do you want to take?\n> ")
    item = game.find_item_by_name(item_name, items)
    if not item:
        print("Sorry, item " + item_name + " not in chest.")
        return show()
    else:
        inventory.add_item(item)
        items.remove(item)
        return show()
Пример #3
0
    def test_exec_recipeXclosefail(self):
        add_item(1, 0, 49) #Add 49 Money (Not enough)
        assert get_quantity(1, 1) == 2
        assert get_quantity(1, 2) == 0
        assert get_quantity(1, 0) == 49

        assert exec_recipe(1, 1, SHOP) == False

        assert get_quantity(1, 1) == 2
        assert get_quantity(1, 2) == 0
        assert get_quantity(1, 0) == 49
Пример #4
0
    def test_exec_recipeXpass(self):
        add_item(1, 0, 50) #Add 50 Money
        assert get_quantity(1, 1) == 2
        assert get_quantity(1, 0) == 50 #Money
        assert get_quantity(1, 2) == 0 #Purchased Item

        assert exec_recipe(1, 1, SHOP) == True

        assert get_quantity(1, 1) == 2
        assert get_quantity(1, 0) == 0 #Money
        assert get_quantity(1, 2) == 1 #Purchased Item
Пример #5
0
 def test_contains_itemsXmultipass(self):
     add_item(1, 2, 1) #Add item 2
     rows = []
     row1 = []
     rows.append(row1)
     row1.append(1) #itemid = 1
     row1.append(2) #quantity = 2
     row2 = []
     rows.append(row2)
     row2.append(2) #itemid = 1
     row2.append(1) #quantity = 1
     assert contains_items(1, rows) == True
Пример #6
0
    def buy(self, item_name):
        item = game.find_item_by_name(item_name.lower(), self.inventory)
        if not item:
            print(text.get_message_item_not_selling(item_name))
            return

        if game.player.gold < item.price:
            print(text.MESSAGE_NOT_ENOUGH_GOLD)
        else:
            game.player.gold -= item.price
            inventory.add_item(item)
            if self.name == "grave digger":
                self.inventory.remove(item)
            print(text.get_message_item_bought(item))
Пример #7
0
def enter():
    global umbrella
    os.system("cls")
    room_three_story = [
    """
    \n
    You enter room three, there is a bed in the room, a table and chairs. You search\n    under the bed but there is nothing there. There looks to be something\n    behind the door. 
    """
    ]
    read_text.read_letters(room_three_story)
    options =[
        "\n",
        "    What would you like to do?",
        "    (L)ook behind door, Look under (B)ed or go back to (C)orridor"
    ]
    read_text.read_line(options)
    cont = False
    while cont == False:
        key_pressed = msvcrt.getch().decode().lower() # gets the key pressed
        if key_pressed == "i" or key_pressed == "q":
            os.system("cls")
            option_functions.other_options(key_pressed)
            read_text.read_line(options)
        elif key_pressed == "s":
            os.system("cls")
            cont = True
            enter()
        elif key_pressed == "l":
            if umbrella == False:
                print("""
                You find an umbrella and pick it up.
                """
                )
                umbrella = True
                inventory.add_item("Umbrella")
            else:
                print("""
                You already have the umbrella.
                """
                )
            read_text.read_line(options)
        elif key_pressed == "b":
            print("""
                There is nothing under the bed.
                """
                )
            read_text.read_line(options)
        elif key_pressed == "c":
            motel_navigation.enter_corridor()
            cont = True
Пример #8
0
 def test_add_itemsXremovemulti(self):
     add_item(1, 2, 1) #Add item 2
     assert get_quantity(1, 1) == 2
     assert get_quantity(1, 2) == 1
     rows = []
     row1 = []
     rows.append(row1)
     row1.append(1) #itemid = 1
     row1.append(1) #quantity = 1
     row2 = []
     rows.append(row2)
     row2.append(2) #itemid = 2
     row2.append(1) #quantity = 1
     add_items(1, rows)
     assert get_quantity(1, 1) == 3
     assert get_quantity(1, 2) == 2        
Пример #9
0
 def attack(self, monsters, monster, messages, game_map):
     weapon = self.get_equipped_item_stats(Weapon)
     if test_for_hit(self.agility + weapon[2], monster.agility):
         dealt_damage = deal_damage(self.damage + weapon[1],
                                    monster.defense)
         messages.append(
             'You attacked {} with {}. You dealt {} damage. The blood is everywhere'
             .format(monster.monster_type, weapon[0], dealt_damage))
         monster.health -= dealt_damage
         if monster.health <= 0:
             messages.append('The {} died in agony.'.format(
                 monster.monster_type))
             game_map[monster.x][monster.y].tile = Cell.EMPTY
             loot = create_item(monster.drop_rarity)
             inventory.add_item(loot, self.inventory, messages)
             self.kill_count += 1
             monsters.remove(monster)
     else:
         messages.append('You missed {}.'.format(monster.monster_type))
Пример #10
0
    def __init__(self):
        ##THIS SHOULD REALLY START AS INIT
        self.gameState = g.GameState.MAP

        self.viewSurf = pygame.Surface((g.VIEW_WIDTH, g.VIEW_HEIGHT))
        self.viewRect = self.viewSurf.get_rect()
        self.screen = pygame.display.set_mode((g.WIN_WIDTH, g.WIN_HEIGHT))
        self.clock = pygame.time.Clock()
        self.loopState = None
        #self.spriteCache = utility.TileCache(g.TILE_SIZE)
        self.spriteCache = utility.TileCache(g.SPRITE_WIDTH, g.SPRITE_HEIGHT)

        self.eventKeys = pygame.key.get_pressed()

        self.TM = utility.TextManager(self.viewSurf)

        self.BC = None
        self.MC = None

        self.playTimeEvent = pygame.USEREVENT + 1
        pygame.time.set_timer(self.playTimeEvent, 1000)
        
        g.partyList.append(db.Hero.dic["Luxe"])
        g.partyList.append(db.Hero.dic["Elle"]);
        g.partyList.append(db.Hero.dic["Asa"])
        
        inventory.init()
        inventory.add_item("Potion", 2)
        inventory.add_item("Revive")
        inventory.add_item("Stone Ring")
        inventory.add_item("Crystal Shard")
        inventory.add_item("Pepper Charm")
        animarium.add_animagus("Signis")
        animarium.add_animagus("Zeir")
        animarium.add_animagus("Luna")
        animarium.add_animagus("Felix")

        self.curLevel = world.Level(self.viewRect.copy(), self)
        self.curLevel.load_file("lvl/level02.map")
        self.curLevel.add_entity(world.Player("player", self.curLevel, (1, 1), self.spriteCache['spr/actors/luxe.png'], True))

        self.skipRender = False
Пример #11
0
def add_to_inventory():
	data = request.get_json()
	print(data)
	name = data.get('name')
	category = data.get('category')
	desc = data.get('description')
	price = data.get('price')
	stock = data.get('stock')
	weight = data.get('weight')
	w_id = data.get('warehouse_id')
	if not add_item(name, category, desc, price, stock, weight, w_id):
		responseObject = {
			"success" : False,
			"msg" : "could not add item"
		}
	else:
		responseObject = {
			"success" : True,
			"msg" : "added item"
		}
	return make_response(jsonify(responseObject))
Пример #12
0
def enter():
    global starting_pistol
    global bow_and_arrow

    os.system("cls")
    room_three_story = [
        """
    \n
    You enter room five and you see two items in the room, one is a starting\n    pistol under the table, a bow and arrows hanging off a picture\n    on the wall and a door leading to who knows where. 
    """
    ]
    read_text.read_letters(room_three_story)
    options = [
        "\n", "    What would you like to do?",
        "    (P)ick up the starting pistol, (T)ake the bow and arrows from the picture, (O)pen\n    the door or go back to (C)orridor "
    ]
    read_text.read_line(options)
    cont = False
    while cont == False:
        key_pressed = msvcrt.getch().decode().lower()  # gets the key pressed
        if key_pressed == "i" or key_pressed == "q":
            os.system("cls")
            option_functions.other_options(key_pressed)
            read_text.read_line(options)
        elif key_pressed == "s":
            os.system("cls")
            cont = True
            enter()
        elif key_pressed == "p":
            if starting_pistol == False:
                print("""
                You pick up the starting pistol!
                """)
                starting_pistol = True
                inventory.add_item("Starting Pistol")
            else:
                print("""
                You already have the starting pistol.
                """)
            read_text.read_line(options)
        elif key_pressed == "t":
            if bow_and_arrow == False:
                print("""
                You take the bow and arrow from the picture!
                """)
                bow_and_arrow = True
                inventory.add_item("Bow and arrow")
            else:
                print("""
                You already have bow and arrow.
                """)
            read_text.read_line(options)
        elif key_pressed == "o":
            read_text.read_letters(
                """\n    Behind the door is a corridor, you follow it and go through a hatch at the end\n    and you end up ????"""
            )
            print("\n\n\n       (Press spacebar to continue")
            c = False
            while c == False:
                space = msvcrt.getch().decode().lower()
                if space == " ":
                    motel_navigation.enter_corridor()
                    c = True
        elif key_pressed == "c":
            motel_navigation.enter_corridor()
            cont = True
Пример #13
0
import inventory

#demonstration below this point
print(inventory.weight_carrying())
inventory.add_item("Matchbox")
inventory.add_item("Candle")
print(inventory.weight_carrying())
inventory.list_carrying()
inventory.delete_item(inventory.on_hand, "Candle")
print(inventory.weight_carrying())
Пример #14
0
 def test_addXbatch(self):
     assert get_quantity(1, 1) == 2
     add_item(1, 1, 2)
     assert get_quantity(1, 1) == 4
Пример #15
0
 def test_addXcreate(self):
     assert get_quantity(1, 2) == 0
     add_item(1, 2, 2)
     assert get_quantity(1, 2) == 2
     add_item(1, 2, 1)
     assert get_quantity(1, 2) == 3
Пример #16
0
""" Bar """
from inventory import get_inventory, add_item, remove_item_by_name
# import inventory

if __name__ == "__main__":
    print('------------- INVENTORY -----------------')
    print(get_inventory())
    print('-----------------------------------------')

    # This first item we are adding already exists in the inventory
    add_item({'name': 'Titos', 'type': 'VODKA', 'price': 13.07})

    # This second item we are adding does not exist in the inventory yet
    add_item({'name': 'Absolute', 'type': 'VODKA', 'price': 11.27})

    print('------------- INVENTORY -----------------')
    print(get_inventory())
    print('-----------------------------------------')

    # Remove an item thatis in the list
    remove_item_by_name('Titos')

    print('------------- INVENTORY -----------------')
    print(get_inventory())
    print('-----------------------------------------')

    # Example of creating a dictionary from inputs and adding it to inventory
    ITEM_NAME = input('Name: ')
    ITEM_TYPE = input('Type: ')
    ITEM_PRICE = input('Price: ')
Пример #17
0
def enter():
    global safe
    global crowbar
    global gun
    os.system("cls")
    room_one_story = [
        """
    \n
    On entering room two there is a picture on the wall, a quick glance shows it is on a hinge, in\n    the corner there are a bunch of crowbars stood against the wall and in the middle\n    of the room is a table with a drawer partly open.
    \n
    """
    ]
    read_text.read_letters(room_one_story)
    options = [
        "\n", "    What would you like to do?",
        "    (L)ook at picture, (P)ick up crowbar, (E)xamine table or go back to (C)orridor?"
    ]
    read_text.read_line(options)
    cont = False
    while cont == False:
        key_pressed = msvcrt.getch().decode().lower()  # gets the key pressed
        if key_pressed == "i" or key_pressed == "q":
            os.system("cls")
            option_functions.other_options(key_pressed)
            read_text.read_line(options)
        elif key_pressed == "s":
            os.system("cls")
            cont = True
            enter()
        elif key_pressed == "l":
            if safe == False:
                read_text.read_letters(
                    "\n    Looking a little closer at the picture you discover that it pulls sideways to reveal a safe.\n    Looks like you need a code to open the safe!"
                )
                if "Numbers off ceiling = 8374" in inventory.inventory:
                    read_text.read_letters(
                        "\n    Ah... you remember the numbers from the cieling in room one, trying the numbers with\n    the safe you find the safe opens to reveal some money! £2000, what a lucky day!"
                    )
                    inventory.add_item("£2000")
                    safe = True
                else:
                    read_text.read_letters(
                        "\n    You try different numbers but you cant open the safe!"
                    )
            else:
                read_text.read_letters(
                    "\n    Now you are being greedy! You already have the money from the safe!"
                )
            read_text.read_line(options)
        elif key_pressed == "p":
            if crowbar == False:
                read_text.read_letters(
                    "\n    You go over to the crowbars and pick one up")
                crowbar = True
                inventory.add_item("Crowbar")
            else:
                read_text.read_letters("\n    You have already got a crowbar")
            read_text.read_line(options)
        elif key_pressed == "e":
            if gun == False:
                read_text.read_letters(
                    "\n    You go over to the table, on opening the drawer fully you discover a gun inside, you add it\n    to your weapons to fight Norman!"
                )
                inventory.add_item("Gun")
                gun = True
            else:
                read_text.read_letters(
                    "\n    You check the drawer again but it is empty!")
            read_text.read_line(options)
        elif key_pressed == "c":
            motel_navigation.enter_corridor()
            cont = True
Пример #18
0
def in_room7():
    global TV_count
    global ward_count
    print("""\033[1;31;40m\n o(=(=(=(=)=)=)=)o
  !!!!!!}!{!!!!!!                                    __________
  !!!!!} | {!!!!!                                   |  __  __  |   ___________
  !!!!}  |  {!!!!     _!_                           | |  ||  | |  |     |     |
  !!!'   |   '!!!    |~@~|     ________________     | |  ||  | |  |     |     |
  ~@~----+----~@~    |___|    |                |    | |__||__| |  |    o|o    |
  !!!    |    !!!      |      |                |    |  __  __()|  |     |     |
  !!!    |    !!!     ( )     |_______  _______|    | |  ||  | |  |_____|_____|
  !!!____|____!!!  __(___)__  {__~@~__}{__~@~__}    | |  ||  | |  |_____-_____|
  !!!=========!!!   |__-__|   |%%%%%%%%%%%%%%%%|    | |__||__| |  |_____-_____|
 _!!!_________!!!___|_____|___|%%%%%%%%%%%%%%%%|____|__________|__|_____-_____|_
                    |     |   |%%%%%%%%%%%%%%%%|                  |/         \|
    
    You enter room 7 and are immediately greeted by an overwhelming acidic smell
    It's making your nose burn.""")
    d = False
    while d == False:
        read_letters(
            """\033[1;37;40m\n    When you inspect the room, you notice:
      A (T)V
      A (W)ardrobe
      A (B)athroom
     (C) to return to corridor
      
    What would you like to inspect?\n""")
        answer = msvcrt.getch().decode().lower()
        if answer == "t":
            if TV_count == 0:
                read_letters("""\033[1;31;40m\n\n   
    You inspect the TV, and turn it on.... Static                                             
    But you swear you're hearing things.
\033[1;37;40m\n    (W)ait around or (B)ack?\n""")
                answer = msvcrt.getch().decode().lower()
                if answer == "w":
                    TV_count += 1
                    read_letters(
                        "\033[1;31;40m\n\n#̷͍̝͔͚̩̻̰̮͇̪̝̃̓̐̄̏͗̔̆͂̈́́̾̓͜͜͝ͅ#̷̰̘̠̩̖̱̟̜̅̈́̉͆͂̉̾̕#̶̭̼̘̥͉̙̖̝̭̖̄̏#̵̢̂̊̓͐̌͂̊͋͂͘͠͝   #̸̳͚̲͇̅̌̈́͛̈́̓͠#̶̘̤͓͈̓̌̆̄̈́̋́̈́̾̕̕͝#̷͍̝͔͚̩̻̰̮͇̪̝̃̓̐̄̏͗̔̆͂̈́́̾̓͜͜͝ͅ#̷̰̘̠̩̖̱̟̜̅̈́̉͆͂̉̾̕#̶̭̼̘̥͉̙̖̝̭̖̄̏#̵̢̂̊̓͐̌͂̊͋͂͘͠͝#̷̤̦̟̼̭̳͗͋̈́̊͊̒͝#̷̡̼̪̱̫̱̻̣̾͆͑ͅ#̷̡̦̼̰̥͈̱̣̼͉͎͚̖̌̈́̂͜#̸̳̜̤͉͈̅͆̂̾͛͛́͌̕͝.  #̷̢̘̱̳͖̺̞͖͂̆̋̀͋̍̇́̑̄̍̅̿̽̃́̇̓̉͆̋̄͂̂̇̈̓͊͆͘͝#̷̡̛̦̯̻̬̥̟̹͉̲͈̘͋̓̈͌̾̅̊͂̔̆̂̓͂̏̈́͒̀̾̈̿͗́́̈̑̑͘͠#̷̢͍̺̻̻̩̘͇͍͎̪̲͈̰̝̦͍̱̹͙̠̥̹͒͊͐͐̍̈̏̀͒͌̔̄̀̉̄̾̅̎̉͂̕͝ͅ#̸̡̡̨̡̛̮̦̞̟̝͍͉̰͓͕̯͇̜̖̖̥͎̯̜͙̪͇̼̦̮̮͙̝͍́̋͂͒̽̅̎̅͑͆͗̍́̆̓͗̽̐̋̉͒̂͛̀̃̂͂̆͌͛̽̆͘ͅͅ#̸̡̢̙͔̥͙͚͇͓̙̠̍͑̇͒͜͝#̷̧̨̧̪̟̦͙̳̬̼̻͚̹̻͔̤̩͚̳̽́͜͜#̵̖̬̝̖͚͉̫̥̖̹̪̭̳̻̜̤̪͍͈̞̏̿̀̂̃͒̊͝   #̶̖͍̦̟̲͙̖͍̔͌͗̌̍̎̒ͅ#̷͈̦͇̬̌̂̋̊́̽̎͒͠#̴̢̛̝̠̩̯̮̝͗͋̓̑̕#̴̡̱̤͍͙̪͎̽̈́̾̇̚͜͝͠\n#̶͚̅̈́͗̾͝#̶̠̰̠͔̯̱̌#̷̛̜̠̐̀̌̅͘̚͘͝ͅ#̸̠̜̒͌̿̽#̷̭͓̪͊   #̷̡̛̦̯̻̬̥̟̹͉̲͈̘͋̓̈͌̾̅̊͂̔̆̂̓͂̏̈́͒̀̾̈̿͗́́̈̑̑͘͠#̷̢͍̺̻̻̩̘͇͍͎̪̲͈̰̝̦͍̱̹͙̠̥̹͒͊͐͐̍̈̏̀͒͌̔̄̀̉̄̾̅̎̉͂̕͝ͅ#̸̡̡̨̡̛̮̦̞̟̝͍͉̰͓͕̯͇̜̖̖̥͎̯̜͙̪͇̼̦̮̮͙̝͍̘́̋͂͒̽̅̎̅͑͆͗̍́̆̓͗̽̐̋̉͒̂͛̀̃̂͂̆͌͛̽̆͘ͅͅ"
                    )

                    read_letters(
                        "\n\n\033[1;37;40m\n    Seem there's nothing but static on tv...\n"
                    )
                elif answer == "b":
                    read_letters(
                        "\n    You leave the TV alone, god knows what they're showing here.\n"
                    )
            else:
                read_letters(
                    "\n    You seem to have done everything you can with the TV.\n"
                )
        elif answer == "w":
            if ward_count == 0:
                read_letters(
                    "\n    You walk over to the wardrobe, it can be opened.\n    Would you like to open the Wardrobe? Y/N\n"
                )
                answer = msvcrt.getch().decode().lower()
                if answer == "i":
                    get_items()
                elif answer == "y":
                    read_letters(
                        """\033[1;31;40m\n    You inspect the wardrobe and a-\n\n\n\n\n\n BODY FALLS OUT?!?!?\n
    Do you want to inspect the body?...   (Y/N)""")
                    answer = msvcrt.getch().decode().lower()
                    if answer == "i":
                        get_items()
                    elif answer == "y":
                        read_letters(
                            """\033[1;37;40m\n\n    Checking the body, you see it seems to have been horrificly morphed by time,
    With mold and maggots, but you notice something sticking out of it's chest..."""
                        )
                        print("""
\033[1;37;40m      .---.
      |---|
      |---|
      |---|
      |^ - \--.
      |________:
\033[1;30;40m      |  |//|
      |  |//|
      |  |//|
      |  |//|
      |  |\033[1;31;40m//|
      |  |//|
__\033[1;30;40m    |  |.-|
  \033[1;31;40m\___|  \033[1;31;40m|**|______________""")
                        read_letters(
                            "\n\n\033[1;31;40m\n    'A knife? Poor fella' You mutter to yourself\n\033[1;37;40m    Do you want to retreive the rusty knife? (Y/N)\n"
                        )
                        answer = msvcrt.getch().decode().lower()
                        if answer == "i":
                            get_items()
                        elif answer == "y":
                            read_letters(
                                "\033[1;37;40m\n    You decide to take the knife, with it taking a bit more tug that you'd have liked...\n"
                            )
                            add_item("Rusty Knife")
                            ward_count += 1
                        elif answer == "n":
                            read_letters(
                                "    It's probably best to leave the knife in it's 'pedestal'..."
                            )
                    elif answer == "n":
                        read_letters(
                            "\n    You leave the body alone, respecting the dead\n"
                        )
                elif answer == "n":
                    read_letters("\n    You leave the wardrobe alone.\n")
            else:
                read_letters(
                    "\n    You seem to have done everything you can with the wardrobe.\n"
                )
        elif answer == "b":
            if bath_count == 0:
                read_letters(
                    "\033[1;31;40m\n    You enter the bathroom, where the acidic smell gets worse."
                )
                d = True
                bath_7()
            else:
                read_letters(
                    "    It appears you've done everything you can in the bathroom."
                )
        elif answer == "c":
            d = True
            motel_navigation.enter_corridor()
        elif answer == "i":
            get_items()
Пример #19
0
 def test_addXincremental(self):
     assert get_quantity(1, 1) == 2
     add_item(1, 1, 1)
     assert get_quantity(1, 1) == 3
     add_item(1, 1, 1)
     assert get_quantity(1, 1) == 4
Пример #20
0
def enter():
    global bed
    global knife
    os.system("cls")
    room_one_story = [
        """
    \n
    On entering room one you see a comfortable bed which makes you feel weary, moving towards the bed you 
    step on a squeaky floorboard and examine it, hmmm, seems you could pull it up with a bit of force. The 
    window in the room looks like a way of escape and looking out you see a kennel with four vicious looking 
    dogs who stare at you and begin to snarl.
    \n
    """
    ]
    read_text.read_letters(room_one_story)
    options = [
        "\n", "    What would you like to do?",
        "    (L)ie on bed, (E)scape through window, (R)aise floorboard of go back to (C)orridor"
    ]
    read_text.read_line(options)
    cont = False
    while cont == False:
        key_pressed = msvcrt.getch().decode().lower()  # gets the key pressed
        if key_pressed == "i" or key_pressed == "q":
            os.system("cls")
            option_functions.other_options(key_pressed)
            read_text.read_line(options)
        elif key_pressed == "s":
            os.system("cls")
            cont = True
            enter()
        elif key_pressed == "l":
            if bed == False:
                read_text.read_letters(
                    "\n    You lie on the bed, as your eyes gaze up you notice four numbers scrawled on the cieling in blood, hmmm \n    what could they mean, you commit the numbers to memory and decide to get up off the bed."
                )
                inventory.add_item("Numbers off ceiling = 8374")
                bed = True
                read_text.read_line(options)
            else:
                read_text.read_letters(
                    "\n    You have already had a lie down, get on with it man, your life is in danger!"
                )
                read_text.read_line(options)
        elif key_pressed == "e":
            read_text.read_letters(
                "\n    You decide to make a break for it and jump out of the window, just as you land on the grass you notice\n    that the dogs are not chained up, as they run at you despair creeps in and you fall to the ground. The\n    dogs reach you and begin to rip you apart. THe game is over for you my friend, you are never seen again!"
            )
            print("\n\n\n       (Press spacebar to (Q)uit")
            qui = False
            while qui == False:
                q = msvcrt.getch().decode().lower()
                if q == " ":
                    qui = True
                    quit()
        elif key_pressed == "r":
            if knife == False:
                read_text.read_letters(
                    "\n    You manage to force the floorboard from its nails and looking under the floor you see something glint\n    in the dim light, on further investigation you discover a hunting knife which you quickly pun in your\n    pocket with intentions of using it to get past Norman!"
                )
                inventory.add_item("Hunting knife")
                knife = True
                read_text.read_line(options)
            else:
                read_text.read_letters([
                    "\n    You lift the floorboard again but there is nothing else there!"
                ])
                read_text.read_line(options)
        elif key_pressed == "c":
            motel_navigation.enter_corridor()
            cont = True
Пример #21
0
if __name__ == "__main__":

    while True:
        USER_INPUT = input('What would you like to do' +
                           '(add/exit/delete/list/find)? ')
        USER_FORM = USER_INPUT.lower().strip(' ')
        if USER_FORM == 'exit':
            print('Goodbye!!!')
            break
        if USER_FORM == 'add':
            NAME = input('What is name of the item? ')
            NAME = NAME.upper().strip(' ')
            TYPE = input('What is item type? ')
            TYPE = TYPE.upper().strip(' ')
            PRICE = input('What is the price? ')
            add_item({'name': NAME, 'type': TYPE, 'price': PRICE})
            continue
        if USER_FORM == 'delete':
            DEL_ITEM = input('What is the name of the Item you' +
                             'wish to delete? ').upper().strip()
            remove_item_by_name(DEL_ITEM)
            continue
        if USER_FORM == 'list':
            print(get_inventory())
            continue

        while USER_FORM == 'find':
            FIND_OPT = input('Would you like to find by ' +
                             '(name/type/price/back)').lower().strip(' ')
            if FIND_OPT == 'name':
                FIND_NAME = input('What is the name of the item? ')
Пример #22
0
def bath_7():
    global bath_count
    global sink_count
    e = False
    while e == False:
        read_letters("""\n\033[1;37;40m\n    There is
    A (B)ath filled with a murky dark acidic smelling liquid
    A (S)ink cabinet.
    (L)eave
    What would you like to do?\n\n""")
        answer = msvcrt.getch().decode().lower()
        if answer == "i":
            get_items()
        elif answer == "b":
            if bath_count == 0:
                invent = inv()
                if invent.count("Plastic Gloves") > 0:
                    read_letters(
                        "    You can stick your hand in the acidic bath wearing the Plastic Gloves, continue? (Y/N)\n"
                    )
                    answer = msvcrt.getch().decode().lower()
                    if answer == "i":
                        get_items()
                    elif answer == "y":
                        read_letters(
                            """\033[1;31;40m    You put your hand in the bath and feel around the liquid...
    You can't tell what's in there, but you don't want to know either.
    Eventually you feel something and pull your hand out as quickly as you can"""
                        )
                        read_letters(
                            """\n    A bone?... You run out of the bathroom immediately"""
                        )
                        time.sleep(3)
                        bath_count += 1
                        e = True
                        in_room7()
                    elif answer == "n":
                        read_letters(
                            "    It's probably of the right idea that you don't put you hand in there at all."
                        )
                else:
                    read_letters(
                        "    You can risk putting your arm in the bath, but it might not be the best idea. Proceed? (Y/N)"
                    )
                    answer = msvcrt.getch().decode().lower()
                    if answer == "i":
                        get_items()
                    elif answer == "y":
                        read_letters(
                            """\033[1;31;40m\n    You put your arm down into the bath's liquid and start to slowly feel pain.
    and the pain scales incredibly quickly- you jerk your arm out of the bath to see"""
                        )
                        print("""
\033[1;37;40m        _     .-.
       ( `. .'   )
        `. `   /'
          |   |
\033[1;31;40m       ,. |   |,.,
\033[1;33;40m      |  \033[1;31;40m`**^^*`  \033[1;33;40m|
      |           |
      |           |""")
                        read_letters("\033[1;31;40mOh... My... God...\n")
                        read_letters(
                            """    The sudden realisation that your arm is missing overwhelms you with pain
    To the point your screaming in agony, writhing in pain bleeding down your missing arm
    Until you eventually pass out and bleed out on the floor...\n""")
                        retry.retry()
                    elif answer == "n":
                        read_letters(
                            "\n    Not putting your hand in that? Yeah that's definitely for the better\n"
                        )
                    else:
                        read_letters("    Invalid answer, please try retry\n")
            else:
                read_letters(
                    "    It appears you've done everything you can in the bathroom.\n"
                )
                e = True
                in_room7()
        elif answer == "s":
            if sink_count == 0:
                sink_count += 1
                read_letters(
                    """    You inspect the sink cabinet and find a pair of
    Latex plastic gloves. Maybe you could stick your hand in the bath without fearing anything now"""
                )
                add_item("Plastic Gloves")
            else:
                read_letters(
                    "    It appears you've done everything you can with the sink.\n"
                )
        elif answer == "l":
            e = True
            in_room7()