def inventory_menu_screen(ga, map_arr, this_district):
    while True:
        clear_screen()
        standard_title_display("Inventory")
        inventory_open(main_menu.GAME_WIDTH)
        main_menu.empty_line(2)
        main_menu.dotted_line(main_menu.GAME_WIDTH)

        list_clues = [
            "1", "clue", "clues", "gameclue", "hints", "hint", "1. clues"
        ]
        list_items = ["2", "item", "items", "about items", "2. items"]
        list_back = [
            "3", "exit", "return", "back", "resume", "resume game",
            "3. resume game", "q", "quit"
        ]

        while True:
            selection = input(">>> ").lower()

            if command_parsing(selection, list_clues):  # Clues
                clues_screen(ga)
                break
            if command_parsing(selection, list_items):  # Items
                view_drop_inventory_item(ga, map_arr, this_district)
                break
            if command_parsing(selection, list_back):  # Back to the game
                return

            cline_print_up_cline("Invalid Input. Try again.")
    def play_char_puzzle(self, ga, this_district):
        clear_screen()
        msg = self.get_greeting()
        dotted_line_length = GAME_WIDTH
        dotted_line(dotted_line_length)
        empty_line(1)
        narration(msg, dotted_line_length)
        empty_line(1)
        dotted_line(dotted_line_length)

        if self._puzzle.state == PuzzleState.SOLVED :
            input("Press [Enter] to continue...")
        else:
            selection = yes_no_selection(input("Yes/No >>> "))
            if selection == 1:  #yes
                clear_screen()
                self._character_state = CharacterState.SPOKEN
                if self._puzzle.play_puzzle(self._dialogs[DialogCategory.FAIL.value], ga) is True:
                    narrationScreen(self._dialogs[DialogCategory.SUCCESS.value])
                    if self._item:
                        if ga.space_in_inventory():
                            ga.add_to_inventory(self._item)
                            narrationScreen(self._item.name + " added to inventory.")
                        else:
                            this_district._dropped_items.append(self._item)
                            narrationScreen("You don't have space for " + self._item.name + ". It is dropped in the district instead.")

                        self._item = None
Ejemplo n.º 3
0
def look_feature(location):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration.narration(location._long_description, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("\nPress [Enter] to continue...\n")
Ejemplo n.º 4
0
 def narration_screen(self, narr):
     clear_screen()
     dotted_line(GAME_WIDTH)
     empty_line(2)
     narration(narr, GAME_WIDTH)
     empty_line(2)
     dotted_line(GAME_WIDTH)
     input("Press [Enter] to continue...")
     clear_screen()
Ejemplo n.º 5
0
def narrationScreen(msg: str):
    clear_screen()
    dotted_line_length = main_menu.GAME_WIDTH
    main_menu.dotted_line(dotted_line_length)
    main_menu.empty_line(1)
    narration(msg, main_menu.GAME_WIDTH)
    main_menu.empty_line(1)
    main_menu.dotted_line(dotted_line_length)
    input("Press [Enter] to continue...")
Ejemplo n.º 6
0
def end_game_screen(msg1, msg2):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration.narration(msg1, main_menu.GAME_WIDTH)
    main_menu.empty_line(1)
    narration.narration(msg2, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("\nPress [Enter] to continue...\n")
    clear_screen()
Ejemplo n.º 7
0
    def enter_lair_confirmation(self) -> int:
        msg1 = "Are you sure you want to continue into the Lair?"
        msg2 = "Once you've entered, there's no going back!"

        clear_screen()
        dotted_line(GAME_WIDTH)
        empty_line(1)
        print_in_the_middle(GAME_WIDTH, msg1)
        print_in_the_middle(GAME_WIDTH, msg2)
        empty_line(1)
        dotted_line(GAME_WIDTH)

        selection = yes_no_selection(input("Yes/No >>> "))
        return selection
Ejemplo n.º 8
0
def itemHelp():
    itemString = "There are regular items and legendary items. " \
                    "Both can be picked up and dropped. But "\
                    "Legendary items are imperative in order to defeat Dr.Crime." \
                    "Obtaining certain items can add a clue.  Clue remains " \
                    "even if the item is dropped, because it's considered " \
                    "an intellectual property."
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration(itemString, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
    clear_screen()
def save_game_confirmation(slot_num: int):
    game_version = "1.0"
    msg1 = "Are you sure you want to overwrite GAME SLOT " + str(
        slot_num) + "?"

    dotted_line_length = GAME_WIDTH
    dotted_line(dotted_line_length)
    empty_line(1)
    print_in_the_middle(dotted_line_length, msg1)
    empty_line(1)
    dotted_line(dotted_line_length)

    selection = yes_no_selection(input("Yes/No >>> "))

    return selection
def print_inventory_item(ga):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    if len(ga.current_inventory) == 0:
        narration("There are no items obtained.", main_menu.GAME_WIDTH)
    else:
        narration("These are following items obtained:", main_menu.GAME_WIDTH)
        narration(
            "(Type 'view' or 'drop' followed by the item name to see its description or drop it from the inventory, or 'back' to go back.)",
            main_menu.GAME_WIDTH)
        main_menu.empty_line(2)
        for item in ga.current_inventory:
            narration("- " + item.name, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
Ejemplo n.º 11
0
 def play_boss_puzzle(self, number_of_tries) -> (bool, int):
     clear_screen()
     msg1 = self._data.question
     msg2 = "(You must solve the puzzle! If you exit or use up your tries, you lose the game!)"
     dotted_line_length = GAME_WIDTH
     dotted_line(dotted_line_length)
     empty_line(1)
     narration(msg1, dotted_line_length)
     empty_line(1)
     narration(msg2, dotted_line_length)
     dotted_line(dotted_line_length)
     selection, number_of_tries = self.boss_puzzle_selection(input(">>> "), self._data.answers, number_of_tries)
     if selection == 1:  #puzzle solved
         return True, number_of_tries
     else:
         return False, number_of_tries
def load_save_success_screen(choice: SaveLoad):
    clear_screen()
    msg1 = "Game SUCCESSFULLY "
    if choice == SaveLoad.SAVE:
        msg1 += "saved."
    elif choice == SaveLoad.LOAD:
        msg1 += "loaded."

    dotted_line_length = GAME_WIDTH
    dotted_line(dotted_line_length)
    empty_line(1)
    print_in_the_middle(dotted_line_length, msg1)
    empty_line(1)
    dotted_line(dotted_line_length)

    input("Press [Enter] to continue...")
def load_game_confirmation(slot_num: int):
    game_version = "1.0"
    msg1 = "Are you sure you want to load GAME SLOT " + str(slot_num) + "?"
    msg2 = "Any unsaved progress in current game will be loss."

    dotted_line_length = GAME_WIDTH
    dotted_line(dotted_line_length)
    empty_line(1)
    print_in_the_middle(dotted_line_length, msg1)
    print_in_the_middle(dotted_line_length, msg2)
    empty_line(1)
    dotted_line(dotted_line_length)

    selection = yes_no_selection(input("Yes/No >>> "))

    return selection
def clues_screen(ga):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    if (len(ga.obtained_clues) == 0):
        nothing_string = "There are no clues obtained."
        narration(nothing_string, main_menu.GAME_WIDTH)
    else:
        narration_clues = "These are following clues obtained:"
        narration(narration_clues, main_menu.GAME_WIDTH)
        main_menu.empty_line(2)
        for clue in ga.obtained_clues:
            clueString = "- " + clue
            narration(clueString, main_menu.GAME_WIDTH)

    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
Ejemplo n.º 15
0
 def play_puzzle(self, failed_msg: str, ga) -> bool:
     self.state = PuzzleState.FOUND
     clear_screen()
     msg1 = self._data.question
     msg2 = "Type \"back\" to exit puzzle."
     dotted_line_length = GAME_WIDTH
     dotted_line(dotted_line_length)
     empty_line(1)
     narration(msg1, dotted_line_length)
     empty_line(1)
     narration(msg2, dotted_line_length)
     empty_line(1)
     dotted_line(dotted_line_length)
     selection = self.puzzle_selection(input(">>> "), self._data.answers, failed_msg, ga)
     if selection == 1:  #puzzle solved
         self.state = PuzzleState.SOLVED
         return True
     else:
         return False
def load_menu():
    game_version = "1.0"
    title = "Load Game"

    # Load Menu Options
    menu_options = [
        "1. Game Slot 1", "2. Game Slot 2", "3. Game Slot 3", "4. Go back"
    ]

    slot_tracker = [False, False, False]

    dirname = os.path.join(os.path.realpath('.'), "savedgames")

    for num in range(3):
        game_slot = num + 1
        filename = "savedgame_" + str(game_slot)
        fullpath = os.path.join(dirname, filename)
        if os.path.exists(fullpath):
            menu_options[num] += " -- " + str(
                time.ctime(os.path.getmtime(fullpath)))
            slot_tracker[num] = True
        else:
            menu_options[num] += " -- no file"

    dotted_line_length = GAME_WIDTH
    dotted_line(dotted_line_length)

    empty_line(1)

    print_in_the_middle(dotted_line_length, title)

    empty_line(1)
    for x in menu_options:
        print_left_indented(int(dotted_line_length / 3.5), x)
    empty_line(1)

    print("Ver. " + game_version)
    dotted_line(dotted_line_length)

    selection = load_selection(input("Make your selection >>> "), slot_tracker)

    return selection
Ejemplo n.º 17
0
def gameNarrationHelp(narr1, narr2):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration(narr1, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration(narr2, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
    clear_screen()
Ejemplo n.º 18
0
def intro_narration():

    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration.narration(narration.start_narration1(), main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("\nPress [Enter] to continue...\n")

    clear_screen()

    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration.narration(narration.start_narration2(), main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("\nPress [Enter] to continue...\n")
Ejemplo n.º 19
0
def mainCharNarration(agtD, drC):
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration("Agent Dope", main_menu.GAME_WIDTH)
    main_menu.empty_line(1)
    narration(agtD, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
    clear_screen()
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    narration("Dr. Crime", main_menu.GAME_WIDTH)
    main_menu.empty_line(1)
    narration(drC, main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    input("Press [Enter] to continue...")
    clear_screen()
Ejemplo n.º 20
0
def standard_title_display(string):
    main_menu.dotted_line(main_menu.GAME_WIDTH)
    main_menu.empty_line(2)
    main_menu.print_in_the_middle(main_menu.GAME_WIDTH, (string))
    main_menu.empty_line(2)
Ejemplo n.º 21
0
def help_menu_screen():
    back_to_game = False
    while back_to_game == False:
        standard_title_display("Help")
        main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                      ("1. Game Story   "))
        main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                      ("2. Characters   "))
        main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                      ("3. Game Commands"))
        main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                      ("4. Items        "))
        main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                      ("5. Resume Game  "))
        main_menu.empty_line(3)
        main_menu.dotted_line(main_menu.GAME_WIDTH)

        list_game_story = [
            "1", "game story", "story", "about game", "1. game story"
        ]
        list_characters = [
            "2", "character", "characters", "char", "chars", "game characters",
            "2. characters"
        ]
        list_game_commands = [
            "3", "game commands", "game command", "commands", "command",
            "3. game commands"
        ]
        list_items = ["4", "item", "items", "about items", "4. items"]
        list_back = [
            "5", "exit", "return", "back", "resume", "resume game",
            "5. resume game"
        ]

        selection = input(">>> ")

        while True:
            if command_parsing(selection,
                               list_game_story) == 1:  #Help for game story
                gameNarrationHelp(start_narration1(), start_narration2())
                break
            if command_parsing(
                    selection,
                    list_characters) == 1:  #Help for game characters
                mainCharNarration(long_for_agt_dope(), long_for_dr_crime())
                break
            if command_parsing(
                    selection,
                    list_game_commands) == 1:  #Help for game commands
                clear_screen()
                main_menu.dotted_line(main_menu.GAME_WIDTH)
                main_menu.empty_line(2)
                command_help(main_menu.GAME_WIDTH)
                main_menu.empty_line(2)
                main_menu.dotted_line(main_menu.GAME_WIDTH)
                input("Press [Enter] to continue...")
                clear_screen()
                break
            if command_parsing(selection,
                               list_items) == 1:  #Help for game items
                itemHelp()
                break
            if command_parsing(selection, list_back) == 1:  #Back to the game
                clear_screen()
                back_to_game = True
                break
            main_menu.write_over("Invalid Input.  Try again.")
            sys.stdout.write("\033[F")  # go up one line
            sys.stdout.write("\033[K")  # clear line
            selection = str(input(">>> ")).lower()
Ejemplo n.º 22
0
def game_play(ga: gameaction.GameAction):

    clear_screen()

    # For new games, load in game data and play intro narration
    if ga.check_visited(STARTING_LOCATION) == False:
        map_arr, ga.game_state.uncollected_legendary_items, ga.game_state.boss_puzzles = stub_map.get_map_stub(
        )
        intro_narration()
        clear_screen()
    else:  # For load game, load stored map data into map_arr
        map_arr = ga.map_arr

    # Game loop
    while True:
        # When game over condition is met
        if ga.turns_remaining <= 0:
            end_game_screen("< G A M E   O V E R >",
                            "You've ran out of turns.")
            break
        clear_screen()

        # Display game stuff
        main_menu.dotted_line(main_menu.GAME_WIDTH)
        (nswe_districts, district_exits,
         this_district) = general_info(ga, map_arr)
        main_menu.dotted_line(main_menu.GAME_WIDTH)

        # Get validated input
        selection = game_play_selection.gameplay_selection(
            ga, input(">>> "), nswe_districts, district_exits, this_district)

        # Perform action based on key action noun
        if selection == "exit":
            clear_screen()
            confirmation = main_menu.exit_to_main_confirmation()
            if confirmation == 1:
                break
        elif selection == "inventory":
            clear_screen()
            inventory.inventory_menu_screen(ga, map_arr, this_district)
        elif selection == "help":
            clear_screen()
            narration.help_menu_screen()
        elif selection == "go up":
            location_change(ga, nswe_districts[0])
        elif selection == "go down":
            location_change(ga, nswe_districts[1])
        elif selection == "go left":
            location_change(ga, nswe_districts[2])
        elif selection == "go right":
            location_change(ga, nswe_districts[3])
        elif selection == "savegame":
            clear_screen()
            ga.set_map_arr(map_arr)
            ga, save_menu_choice = load_save_menu.ingame_save_game(ga)
            map_arr = ga.map_arr
        elif selection == "loadgame":
            clear_screen()
            ga.set_map_arr(map_arr)
            ga, load_menu_choice = load_save_menu.ingame_load_game(ga)
            map_arr = ga.map_arr
        elif selection == "wingame":
            end_game_screen(
                "< Y O U   W I N >",
                "You've defeated Dr. Crime and saved the City of New San Diego!"
            )
            break
        elif selection == "losegame":
            end_game_screen("< G A M E   O V E R >",
                            "You weren't able to defeat Dr. Crime!")
            break
        elif selection == "brokestone":
            end_game_screen(
                "< G A M E   O V E R >",
                "The Stone held together the fabric of Time and Space, and you broke it! Everyone died."
            )
            break
        elif selection == "look":
            look_feature(this_district)