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
Exemplo 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")
Exemplo n.º 4
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...")
Exemplo n.º 5
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()
Exemplo n.º 6
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
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
Exemplo n.º 8
0
def general_info(ga, map_arr):
    main_menu.empty_line(2)
    main_menu.print_in_the_middle(main_menu.GAME_WIDTH,
                                  ("Remaining Turns: %s" % ga.turns_remaining))
    main_menu.print_in_the_middle(
        main_menu.GAME_WIDTH, ("Current Location: %s" % ga.current_location))
    main_menu.empty_line(2)
    (nswe_districts, district_exits,
     this_district) = gametext_output(ga, map_arr)
    main_menu.empty_line(2)
    legendary_status(ga)
    main_menu.empty_line(2)
    narration.help_menu()
    main_menu.empty_line(1)
    return (nswe_districts, district_exits, this_district)
Exemplo n.º 9
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 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
Exemplo n.º 12
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
Exemplo n.º 13
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()
Exemplo n.º 14
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")
Exemplo n.º 15
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()
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)
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...")
Exemplo n.º 18
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
Exemplo 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)
Exemplo 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()
Exemplo n.º 22
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()
Exemplo n.º 23
0
def gametext_output(ga, map_arr) -> Tuple[List[str], List[str], city.District]:
    # Current x,y coord
    this_district = None
    district_exits = None
    xy_coord = (None, None)

    # North, South, West, East -- district info
    cardinal_dir = ["north", "south", "west", "east"]
    nswe_districts = [None, None, None, None]
    relative_coord = [(0, 1), (0, -1), (-1, 0), (1, 0)]
    static_coord = [None, None, None, None]

    # Get x,y coords of current location
    for district_obj in map_arr:
        if ga.current_location == district_obj._district_name:
            this_district = district_obj
            district_exits = district_obj._district_exits.get_exits()
            xy_coord = district_obj._id.get_id()
            break

    # get N, S, W, E districts
    # https://stackoverflow.com/questions/1169725/adding-values-from-tuples-of-same-length
    for i in range(4):
        static_coord[i] = tuple(
            sum(x) for x in zip(xy_coord, relative_coord[i]))

    # Assign district names to NSWE
    for district_obj in map_arr:
        for i in range(4):
            if static_coord[i] == district_obj._id.get_id():
                nswe_districts[i] = district_obj._district_name

    # String to print
    str_to_print = None

    # Concat either long or short description
    if ga.check_visited(ga.current_location) == False:
        str_to_print = this_district._long_description
        ga.change_visited(ga.current_location)
    else:
        str_to_print = this_district._short_description

    # Append relevant item narration
    for item in this_district._district_items:
        if (item):
            str_to_print += " " + item.narration

    # Append relevant character narration
    for character in this_district._characters:
        str_to_print += " " + character._narration

    # Print narration
    narration.left_narration(str_to_print, main_menu.GAME_WIDTH)

    # Print lair if lair_location w/ vision orb found
    if ga.lair_discovered():
        empty_line(1)
        narration.left_narration(
            "A Lair can be seen shrouded in a dark cloud. There's appears to be an entrance.",
            main_menu.GAME_WIDTH)

    # Print dropped items if any
    num_of_dropped_items = len(this_district._dropped_items)
    if num_of_dropped_items > 0:
        empty_line(1)
        dropped_items_str = "The following items were dropped in this district: "
        for i in range(num_of_dropped_items):
            if i == 0:
                dropped_items_str += this_district._dropped_items[i].name
            elif i == num_of_dropped_items - 1:
                dropped_items_str += (", and " +
                                      this_district._dropped_items[i].name)
            else:
                dropped_items_str += (", " +
                                      this_district._dropped_items[i].name)
        dropped_items_str += "."
        narration.left_narration(dropped_items_str, main_menu.GAME_WIDTH)

    empty_line(2)

    for i in range(4):
        if nswe_districts[i] is not None:
            print("To the " + cardinal_dir[i] + " is " + nswe_districts[i] +
                  ".",
                  end=" ")
            if (district_exits[i] != ""):
                print(district_exits[i] + " is in that direction.")
            else:
                print("")

    return (nswe_districts, district_exits, this_district)