Esempio n. 1
0
def handleBlueCorridor3(userInput, state):
    if userInput == 'GO SOUTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_2',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_2',
                             userInput) and handleRustyKeyPickupCorridor2(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_2', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_4',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_4', userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_4',
                             userInput) and handleRustyKeyPickupCorridor4(
                                 state, userInput)
    elif userInput == "TAKE RUSTY KEY" or userInput == "TAKE KEY":
        return takeItem(state, 'rustyKey') and handleRustyKeyPickup(
            state, userInput)
    elif userInput == 'GO WEST' or userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 2
0
def handleCaptainsCabin(userInput, state):
    if userInput == 'GO WEST':
        return goToLevel(state, 'SHIPWRECK', userInput) and handleNewShipwreckDesc(state, userInput)
    elif userInput == "GO EAST" or userInput == "GO NORTH" or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    elif userInput == "TAKE TORN PAGES" or userInput == "TAKE PAGES":
        return takeItem(state, "tornPages")
    elif userInput == "TAKE FAMILY PHOTOGRAPH" or userInput == "TAKE PHOTOGRAPH" or userInput == "TAKE FAMILY PHOTO" or userInput == "TAKE FRAMED FAMILY PHOTOGRAPH":
        return handleInvalidPhoto(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 3
0
def handleAttic(userInput, state):
    if userInput == 'GO SOUTH':
        return handleDoorLock(state, 'ATTIC', userInput)
    elif userInput == 'USE LADDER' and "ladder" in state["inventory"]:
        return goToLevel(state, 'UPPER_FLOOR', userInput)
    elif userInput == 'TAKE GREY KEY' or userInput == 'TAKE KEY':
        return takeItem(state, 'greyKey')
    elif userInput == 'TAKE BOX' or userInput == 'TAKE BOXES':
        return handleInvalidBox(state)
    elif userInput == 'GO NORTH' or userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 4
0
def handleCellar(userInput, state):
    if userInput == 'GO WEST' or userInput == "GO NORTH" or userInput == "GO EAST" or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if "oilLamp" in state["inventory"]:
            return goToLevel(state, 'SHED', userInput) and handleNewShedDesc(state, userInput)
        else:
            return goToLevel(state, "SHED", userInput)
    elif userInput == "USE OIL LAMP" and "oilLamp" in state["inventory"]:
        return handleNewCellarDesc(state)
    elif userInput == "TAKE BRONZE KEY" or userInput == "TAKE KEY":
        return takeItem(state, 'bronzeKey')
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 5
0
def handleTorchRoom(userInput, state):
    if userInput == "TAKE TORCH":
        return takeItem(state, 'torch')
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_START', userInput)
        else:
            return goToLevel(state, 'BLUE_START',
                             userInput) and handleTrueTorchLevel(
                                 state, userInput)
    elif userInput == 'GO NORTH' or userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 6
0
def handleBabyRoom(userInput, state):
    if userInput == 'GO EAST':
        if len(state['pinkPuzzleItems']) != 0:
                return handleInvalidDirection(state)
        elif 'pinkKey' in state['inventory']:
            return goToLevel(state, "STUDY_ROOM", userInput) and studyRoomWithPinkKeyPickedUp(state)
        elif 'moldyPacifier' in state ['inventory']:
            return goToLevel(state, "NURSING_ROOM", userInput) and nursingRoomWithPacifierPickedUp(state)
        else:
            return goToLevel(state, 'NURSING_ROOM', userInput)
    elif userInput == 'GO SOUTH':
            if len(state['pinkPuzzleItems']) != 0:
                return handleInvalidDirection(state)
            else:
                return goToLevel(state, 'TOY_CAR_ROOM', userInput)
    elif userInput == "TAKE WORN DOLL" or userInput == "TAKE DOLL":
        return takeItem(state, 'wornDoll')
    elif 'USE' in userInput:
        puzzleList = state['pinkPuzzleItems']
        if len(puzzleList) == 0:
            items=[
                'crib', 'moldyPacifier', 'wornDoll', 'dirtyBlanket', 'nurseryRhyme'
            ]
            currentItems=state['inventory']
            for item in items:
                if item not in currentItems:
                    return handleDoorLock(state, 'BABY_ROOM', userInput)
            return pinkRoomPuzzle(state, userInput)
        else:
            return pinkRoomPuzzle(state, userInput)
    elif userInput == "TAKE PINK KEY" or userInput == "TAKE KEY":
        return takeItem(state, 'pinkKey')
    elif userInput == 'GO NORTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 7
0
def handleCribRoom(userInput, state):
    if userInput == 'GO NORTH':
        return goToLevel(state, 'TOY_CAR_ROOM', userInput)
    elif userInput == 'GO EAST':
        if 'nurseryRhyme' in state ['inventory']:
            return goToLevel(state, 'MESSY_ROOM', userInput) and messyRoomWithRhymePickedUp(state)
        else:
            return goToLevel(state, 'MESSY_ROOM', userInput)
        return handleInvalidDirection(state)
    elif userInput == "TAKE CRIB":
        return takeItem(state, 'crib')
    elif userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 8
0
def handleBasement(userInput, state):
    if userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if 'photograph' in state['inventory']:
            return goToLevel(state, 'KITCHEN',
                             userInput) and handleNewKitchenDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'KITCHEN', userInput)
    elif userInput == 'TAKE LADDER':
        return takeItem(state, 'ladder')
    elif userInput == 'TAKE TOYS' or userInput == 'TAKE OLD TOYS':
        return handleInvalidToy(state)
    elif userInput == 'GO WEST' or userInput == 'GO SOUTH' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 9
0
def handleBedroom(userInput, state):
    if userInput == 'GO EAST' and "greyKey" in state['inventory']:
        if 'photograph' in state['inventory'] and 'carKeys' in state[
                'inventory'] and 'canvas' in state['inventory']:
            state['inventory']['greyKey']['itemUse'] = True
            return goToLevel(state, 'UPPER_FLOOR',
                             userInput) and handleFireLoudDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'UPPER_FLOOR', userInput)
    elif userInput == 'TAKE CANVAS':
        return takeItem(state, 'canvas')
    elif userInput == 'GO NORTH' or userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 10
0
def handleStudyRoom(userInput, state):
    if userInput == 'GO NORTH':
        if 'moldyPacifier' in state ['inventory']:
            return goToLevel(state, 'NURSING_ROOM', userInput) and nursingRoomWithPacifierPickedUp(state)
        else:
            return goToLevel(state, 'NURSING_ROOM', userInput)
    elif userInput == 'GO SOUTH':
        if 'nurseryRhyme' in state ['inventory']:
            return goToLevel(state, 'MESSY_ROOM', userInput) and messyRoomWithRhymePickedUp(state)
        else:
            return goToLevel(state, 'MESSY_ROOM', userInput)
    elif userInput == "TAKE DIRTY BLANKET" or userInput == "TAKE BLANKET":
        return takeItem(state, 'dirtyBlanket')
    elif userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 11
0
def handleMessyRoom(userInput, state):
    if userInput == 'GO NORTH':
        if 'dirtyBlanket' in state ['inventory']:
            return goToLevel(state, 'STUDY_ROOM', userInput) and studyRoomWithBlanketPickedUp(state)
        else:
            return goToLevel(state, 'STUDY_ROOM', userInput)
    elif userInput == 'GO WEST':
        if 'crib' in state ['inventory']:
            return goToLevel(state, 'CRIB_ROOM', userInput) and cribRoomWithCribPickedUp(state)
        else:
            return goToLevel(state, 'CRIB_ROOM', userInput)
    elif userInput == "TAKE NURSERY RHYME" or userInput == "TAKE RHYME" or userInput == "TAKE NOTEBOOK":
        return takeItem(state, 'nurseryRhyme')
    elif userInput == 'GO EAST' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 12
0
def handleGreenHouse(userInput, state):
    if userInput == 'GO EAST':
        return goToLevel(state, 'OUTSIDE', userInput)
    elif userInput == "USE LIGHTSWITCH":
        return handlePersistantItems(state, "lightswitch", "GREENHOUSE") and handleLightGreenhouse(state)
    elif userInput == "TAKE BRASS KEY" or userInput == "TAKE KEY":
        if "lightswitch" in state['usedItems']:
            return takeItem(state, 'brassKey') and handleKeyTakeGreenhouse(state)
        else:
            return {
        'state': state,
        'pageChanges': {
            'levelChatboxText': "It's too dark to see anything, try turning on the light first"
        }
    } 
    elif userInput == 'GO NORTH' or userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 13
0
def handleKitchen(userInput, state):
    if userInput == 'GO WEST':
        if 'photograph' and 'carKeys' and 'canvas' in state['inventory']:
            return goToLevel(state, 'LIVING_ROOM',
                             userInput) and handleNewLivingRoomDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'LIVING_ROOM', userInput)
    elif userInput == 'TAKE PHOTOGRAPH':
        return takeItem(state, 'photograph')
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if 'ladder' in state['inventory']:
            return goToLevel(state, 'BASEMENT',
                             userInput) and handleNewBasementDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'BASEMENT', userInput)
    elif userInput == 'GO NORTH' or userInput == 'GO EAST' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 14
0
def handleNursingRoom(userInput, state):
    if userInput == 'GO WEST':
        if 'wornDoll' in state['inventory']:
            return goToLevel(state, 'BABY_ROOM', userInput) and babyRoomWithDollPickedUp(state)
        else:
            return goToLevel(state, 'BABY_ROOM', userInput)
    elif userInput == 'GO SOUTH':
        if 'dirtyBlanket' in state ['inventory']:
            return goToLevel(state, 'STUDY_ROOM', userInput) and studyRoomWithBlanketPickedUp(state)
        else:
            return goToLevel(state, 'STUDY_ROOM', userInput)
    elif userInput == "TAKE MOLDY PACIFIER" or userInput == "TAKE PACIFIER":
        return takeItem(state, 'moldyPacifier')
    elif userInput == "GO EAST":
        if 'pinkKey' in state['inventory']:
            return goToLevel(state, 'BLUE_START', userInput)
        else:
            return finishPuzzleFirst(state)
    elif userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 15
0
def handleHall(userInput, state):
    if userInput == 'GO EAST':
        if 'photograph' and 'carKeys' and 'canvas' in state['inventory']:
            return goToLevel(state, 'LIVING_ROOM',
                             userInput) and handleNewLivingRoomDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'LIVING_ROOM', userInput)
    elif userInput == 'TAKE CAR KEYS' or userInput == 'TAKE KEY':
        return takeItem(state, 'carKeys')
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if 'photograph' and 'carKeys' and 'canvas' in state['inventory']:
            return goToLevel(state, 'UPPER_FLOOR',
                             userInput) and handleFireLoudDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'UPPER_FLOOR', userInput)
    elif userInput == 'TAKE PICTURE':
        return handleInvalidPicture(state)
    elif userInput == 'GO SOUTH' or userInput == 'GO WEST' or userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 16
0
def handleShed(userInput, state):
    global shedCalled
    if userInput == 'GO WEST' or userInput == "GO SOUTH" or userInput == "GO NORTH":
        return handleInvalidDirection(state)
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if "oilLamp" in state["inventory"] and shedCalled < 1:
            return handleBasement(state)
        elif "oilLamp" not in state["inventory"]:
            return handleNoOillamp(state)
        elif "bronzeKey" not in state["inventory"] and shedCalled >= 1:
            return goToLevel(state, "CELLAR", userInput) and handleNewStairsNoLamp(state)
        elif "bronzeKey" in state["inventory"] and shedCalled >= 1:
            return goToLevel(state, "CELLAR", userInput) and handleNewStairsDesc(state)
        else:
            goToLevel(state, "SHED", userInput)
    elif userInput == "TAKE OIL LAMP" or userInput == "TAKE LAMP" or userInput == "TAKE OLD FASHIONED OIL LAMP" or userInput == "TAKE OLD-FASHIONED OIL LAMP":
        return takeItem(state, 'oilLamp')
    elif userInput == "THROW OIL LAMP" and "oilLamp" in state["inventory"]:
        return handleNewShedDescOilLamp(state)
    elif userInput == 'GO EAST':
        return goToLevel(state, "SHED_FRONT_DOOR", userInput) and handleNewShedFrontDoorDesc(state, userInput)
    elif userInput == "TAKE FISHERMAN GEAR" or userInput == "TAKE OLD FISHERMAN GEAR":
        return handleInvalidGear(state)
    elif userInput == "USE PADLOCK" or userInput == "USE LOCK":
        if shedCalled >= 1:
            return handlePadlockUsed(state)
        else:
            shedCalled = shedCalled + 1
            return handlePadlock(state)
    elif userInput == "JOYFUL" and shedCalled >= 1:
        if "tornPages" in state["inventory"] and "oilLamp" in state["inventory"]:
            return goToLevelShedPuzzle(state, "CELLAR", userInput)
        else:
            return handleDoorLock(state, "SHED", userInput)
    else:
        return handleInvalidInput(userInput, state)